summaryrefslogtreecommitdiff
path: root/cui/source/options
diff options
context:
space:
mode:
Diffstat (limited to 'cui/source/options')
-rw-r--r--cui/source/options/cfgchart.cxx327
-rw-r--r--cui/source/options/cfgchart.hxx119
-rw-r--r--cui/source/options/connpoolconfig.cxx226
-rw-r--r--cui/source/options/connpoolconfig.hxx57
-rw-r--r--cui/source/options/connpooloptions.cxx516
-rw-r--r--cui/source/options/connpooloptions.hrc52
-rw-r--r--cui/source/options/connpooloptions.hxx95
-rw-r--r--cui/source/options/connpooloptions.src169
-rw-r--r--cui/source/options/connpoolsettings.cxx126
-rw-r--r--cui/source/options/connpoolsettings.hxx111
-rw-r--r--cui/source/options/cuisrchdlg.cxx103
-rw-r--r--cui/source/options/dbregister.cxx512
-rw-r--r--cui/source/options/dbregister.hrc45
-rw-r--r--cui/source/options/dbregister.src93
-rw-r--r--cui/source/options/dbregisterednamesconfig.cxx187
-rw-r--r--cui/source/options/dbregisterednamesconfig.hxx57
-rw-r--r--cui/source/options/dbregistersettings.cxx77
-rw-r--r--cui/source/options/dbregistersettings.hxx66
-rw-r--r--cui/source/options/doclinkdialog.cxx227
-rw-r--r--cui/source/options/doclinkdialog.hrc53
-rw-r--r--cui/source/options/doclinkdialog.hxx96
-rw-r--r--cui/source/options/doclinkdialog.src154
-rw-r--r--cui/source/options/fontsubs.cxx614
-rw-r--r--cui/source/options/fontsubs.hrc65
-rw-r--r--cui/source/options/fontsubs.hxx137
-rw-r--r--cui/source/options/fontsubs.src199
-rw-r--r--cui/source/options/internationaloptions.cxx167
-rw-r--r--cui/source/options/internationaloptions.hrc75
-rw-r--r--cui/source/options/internationaloptions.src106
-rwxr-xr-xcui/source/options/makefile.mk122
-rw-r--r--cui/source/options/optHeaderTabListbox.cxx90
-rw-r--r--cui/source/options/optHeaderTabListbox.hxx48
-rw-r--r--cui/source/options/optaccessibility.cxx188
-rw-r--r--cui/source/options/optaccessibility.hrc87
-rw-r--r--cui/source/options/optaccessibility.hxx68
-rw-r--r--cui/source/options/optaccessibility.src155
-rw-r--r--cui/source/options/optasian.cxx470
-rw-r--r--cui/source/options/optasian.hrc52
-rw-r--r--cui/source/options/optasian.src177
-rw-r--r--cui/source/options/optchart.cxx239
-rw-r--r--cui/source/options/optchart.hrc40
-rw-r--r--cui/source/options/optchart.hxx92
-rw-r--r--cui/source/options/optchart.src86
-rw-r--r--cui/source/options/optcolor.cxx1633
-rw-r--r--cui/source/options/optcolor.hrc222
-rw-r--r--cui/source/options/optcolor.hxx84
-rw-r--r--cui/source/options/optcolor.src552
-rw-r--r--cui/source/options/optctl.cxx173
-rw-r--r--cui/source/options/optctl.hrc61
-rw-r--r--cui/source/options/optctl.hxx73
-rw-r--r--cui/source/options/optctl.src119
-rw-r--r--cui/source/options/optdict.cxx805
-rw-r--r--cui/source/options/optdict.hrc68
-rw-r--r--cui/source/options/optdict.src282
-rw-r--r--cui/source/options/optfltr.cxx439
-rw-r--r--cui/source/options/optfltr.hrc58
-rw-r--r--cui/source/options/optfltr.hxx118
-rw-r--r--cui/source/options/optfltr.src204
-rw-r--r--cui/source/options/optgdlg.cxx1921
-rw-r--r--cui/source/options/optgdlg.hrc208
-rw-r--r--cui/source/options/optgdlg.hxx220
-rw-r--r--cui/source/options/optgdlg.src643
-rw-r--r--cui/source/options/optgenrl.cxx584
-rw-r--r--cui/source/options/optgenrl.hrc88
-rw-r--r--cui/source/options/optgenrl.src315
-rw-r--r--cui/source/options/opthtml.cxx271
-rw-r--r--cui/source/options/opthtml.hrc66
-rw-r--r--cui/source/options/opthtml.hxx92
-rw-r--r--cui/source/options/opthtml.src290
-rw-r--r--cui/source/options/optimprove.cxx230
-rw-r--r--cui/source/options/optimprove.hrc53
-rw-r--r--cui/source/options/optimprove.src124
-rw-r--r--cui/source/options/optimprove2.cxx272
-rw-r--r--cui/source/options/optinet2.cxx2339
-rw-r--r--cui/source/options/optinet2.hrc180
-rw-r--r--cui/source/options/optinet2.hxx355
-rw-r--r--cui/source/options/optinet2.src647
-rw-r--r--cui/source/options/optjava.cxx1138
-rw-r--r--cui/source/options/optjava.hrc86
-rw-r--r--cui/source/options/optjava.hxx217
-rw-r--r--cui/source/options/optjava.src290
-rw-r--r--cui/source/options/optjsearch.cxx385
-rw-r--r--cui/source/options/optjsearch.hrc53
-rw-r--r--cui/source/options/optjsearch.hxx96
-rw-r--r--cui/source/options/optjsearch.src223
-rw-r--r--cui/source/options/optlingu.cxx2555
-rw-r--r--cui/source/options/optlingu.hrc91
-rw-r--r--cui/source/options/optlingu.src357
-rw-r--r--cui/source/options/optmemory.cxx274
-rw-r--r--cui/source/options/optmemory.hrc89
-rw-r--r--cui/source/options/optmemory.hxx92
-rw-r--r--cui/source/options/optmemory.src210
-rw-r--r--cui/source/options/optpath.cxx866
-rw-r--r--cui/source/options/optpath.hrc46
-rw-r--r--cui/source/options/optpath.src203
-rw-r--r--cui/source/options/optsave.cxx822
-rw-r--r--cui/source/options/optsave.hrc84
-rw-r--r--cui/source/options/optsave.hxx108
-rw-r--r--cui/source/options/optsave.src325
-rw-r--r--cui/source/options/optspell.hrc45
-rw-r--r--cui/source/options/optspell.src128
-rw-r--r--cui/source/options/optupdt.cxx415
-rw-r--r--cui/source/options/optupdt.hrc52
-rw-r--r--cui/source/options/optupdt.hxx84
-rw-r--r--cui/source/options/optupdt.src114
-rw-r--r--cui/source/options/radiobtnbox.cxx118
-rw-r--r--cui/source/options/readonlyimage.cxx84
-rw-r--r--cui/source/options/readonlyimage.hxx46
-rw-r--r--cui/source/options/readonlyimage.src55
-rw-r--r--cui/source/options/sdbcdriverenum.cxx132
-rw-r--r--cui/source/options/sdbcdriverenum.hxx79
-rw-r--r--cui/source/options/securityoptions.cxx107
-rw-r--r--cui/source/options/securityoptions.hrc83
-rw-r--r--cui/source/options/securityoptions.hxx94
-rw-r--r--cui/source/options/securityoptions.src168
-rw-r--r--cui/source/options/treeopt.cxx2850
-rw-r--r--cui/source/options/treeopt.hrc103
-rw-r--r--cui/source/options/treeopt.src387
-rw-r--r--cui/source/options/webconninfo.cxx377
-rw-r--r--cui/source/options/webconninfo.hrc65
-rw-r--r--cui/source/options/webconninfo.hxx88
-rw-r--r--cui/source/options/webconninfo.src106
122 files changed, 34924 insertions, 0 deletions
diff --git a/cui/source/options/cfgchart.cxx b/cui/source/options/cfgchart.cxx
new file mode 100644
index 000000000000..822a3632a76d
--- /dev/null
+++ b/cui/source/options/cfgchart.cxx
@@ -0,0 +1,327 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: cfgchart.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <com/sun/star/uno/Sequence.hxx>
+// header for SvStream
+#include <tools/stream.hxx>
+// header for SAL_STATIC_CAST
+#include <sal/types.h>
+#include "cfgchart.hxx"
+#include <dialmgr.hxx>
+#include <cuires.hrc>
+
+#define ROW_COLOR_COUNT 12
+
+using namespace com::sun::star;
+
+TYPEINIT1( SvxChartColorTableItem, SfxPoolItem );
+
+SvxChartColorTable::SvxChartColorTable()
+{}
+
+SvxChartColorTable::SvxChartColorTable( const SvxChartColorTable & _rSource ) :
+ m_aColorEntries( _rSource.m_aColorEntries )
+{}
+
+// accessors
+size_t SvxChartColorTable::size() const
+{
+ return m_aColorEntries.size();
+}
+
+const XColorEntry & SvxChartColorTable::operator[]( size_t _nIndex ) const
+{
+ if ( _nIndex >= m_aColorEntries.size() )
+ {
+ DBG_ERRORFILE( "SvxChartColorTable::[] invalid index" );
+ return m_aColorEntries[ 0 ];
+ }
+
+ return m_aColorEntries[ _nIndex ];
+}
+
+ColorData SvxChartColorTable::getColorData( size_t _nIndex ) const
+{
+ if ( _nIndex >= m_aColorEntries.size() )
+ {
+ DBG_ERRORFILE( "SvxChartColorTable::getColorData invalid index" );
+ return COL_BLACK;
+ }
+
+ // GetColor should be const but unfortunately isn't
+ return const_cast< XColorEntry & >( m_aColorEntries[ _nIndex ] ).GetColor().GetRGBColor();
+}
+
+// mutators
+void SvxChartColorTable::clear()
+{
+ m_aColorEntries.clear();
+}
+
+void SvxChartColorTable::append( const XColorEntry & _rEntry )
+{
+ m_aColorEntries.push_back( _rEntry );
+}
+
+void SvxChartColorTable::replace( size_t _nIndex, const XColorEntry & _rEntry )
+{
+ DBG_ASSERT( _nIndex <= m_aColorEntries.size(),
+ "SvxChartColorTable::replace invalid index" );
+
+ Color aCol1 = m_aColorEntries[ _nIndex ].GetColor(), aCol2;
+ m_aColorEntries[ _nIndex ] = _rEntry;
+ aCol2 = m_aColorEntries[ _nIndex ].GetColor();
+ if ( aCol2 != const_cast< XColorEntry& >( _rEntry ).GetColor() )
+ {
+ DBG_ERRORFILE( "wrong color" );
+ }
+}
+
+void SvxChartColorTable::useDefault()
+{
+ ColorData aColors[] = {
+ RGB_COLORDATA( 0x00, 0x45, 0x86 ),
+ RGB_COLORDATA( 0xff, 0x42, 0x0e ),
+ RGB_COLORDATA( 0xff, 0xd3, 0x20 ),
+ RGB_COLORDATA( 0x57, 0x9d, 0x1c ),
+ RGB_COLORDATA( 0x7e, 0x00, 0x21 ),
+ RGB_COLORDATA( 0x83, 0xca, 0xff ),
+ RGB_COLORDATA( 0x31, 0x40, 0x04 ),
+ RGB_COLORDATA( 0xae, 0xcf, 0x00 ),
+ RGB_COLORDATA( 0x4b, 0x1f, 0x6f ),
+ RGB_COLORDATA( 0xff, 0x95, 0x0e ),
+ RGB_COLORDATA( 0xc5, 0x00, 0x0b ),
+ RGB_COLORDATA( 0x00, 0x84, 0xd1 )
+ };
+
+ clear();
+
+ String aResName( CUI_RES( RID_SVXSTR_DIAGRAM_ROW ) );
+ String aPrefix, aPostfix, aName;
+ xub_StrLen nPos = aResName.SearchAscii( "$(ROW)" );
+ if( nPos != STRING_NOTFOUND )
+ {
+ aPrefix = String( aResName, 0, nPos );
+ aPostfix = String( aResName, nPos + sizeof( "$(ROW)" ) - 1, STRING_LEN );
+ }
+ else
+ aPrefix = aResName;
+
+ for( sal_Int32 i=0; i<ROW_COLOR_COUNT; i++ )
+ {
+ aName = aPrefix;
+ aName.Append( String::CreateFromInt32( i + 1 ));
+ aName.Append( aPostfix );
+
+ append( XColorEntry( aColors[ i % sizeof( aColors ) ], aName ));
+ }
+}
+
+// comparison
+bool SvxChartColorTable::operator==( const SvxChartColorTable & _rOther ) const
+{
+ // note: XColorEntry has no operator ==
+ bool bEqual = ( this->m_aColorEntries.size() == _rOther.m_aColorEntries.size() );
+
+ if( bEqual )
+ {
+ for( size_t i = 0; i < m_aColorEntries.size(); ++i )
+ {
+ if( getColorData( i ) != _rOther.getColorData( i ))
+ {
+ bEqual = false;
+ break;
+ }
+ }
+ }
+
+ return bEqual;
+}
+
+// ====================
+// class SvxChartOptions
+// ====================
+
+SvxChartOptions::SvxChartOptions() :
+ ::utl::ConfigItem( rtl::OUString::createFromAscii( "Office.Chart" )),
+ mbIsInitialized( FALSE )
+{
+ maPropertyNames.realloc( 1 );
+ maPropertyNames[ 0 ] = ::rtl::OUString::createFromAscii( "DefaultColor/Series" );
+}
+
+SvxChartOptions::~SvxChartOptions()
+{
+}
+
+const SvxChartColorTable& SvxChartOptions::GetDefaultColors()
+{
+ if ( !mbIsInitialized )
+ mbIsInitialized = RetrieveOptions();
+ return maDefColors;
+}
+
+void SvxChartOptions::SetDefaultColors( const SvxChartColorTable& aCol )
+{
+ maDefColors = aCol;
+ SetModified();
+}
+
+BOOL SvxChartOptions::RetrieveOptions()
+{
+ // get sequence containing all properties
+
+ uno::Sequence< ::rtl::OUString > aNames = GetPropertyNames();
+ uno::Sequence< uno::Any > aProperties( aNames.getLength());
+ aProperties = GetProperties( aNames );
+
+ if( aProperties.getLength() == aNames.getLength())
+ {
+ // 1. default colors for series
+ maDefColors.clear();
+ uno::Sequence< sal_Int64 > aColorSeq;
+ aProperties[ 0 ] >>= aColorSeq;
+
+ sal_Int32 nCount = aColorSeq.getLength();
+ Color aCol;
+
+ // create strings for entry names
+ String aResName( CUI_RES( RID_SVXSTR_DIAGRAM_ROW ) );
+ String aPrefix, aPostfix, aName;
+ xub_StrLen nPos = aResName.SearchAscii( "$(ROW)" );
+ if( nPos != STRING_NOTFOUND )
+ {
+ aPrefix = String( aResName, 0, nPos );
+ aPostfix = String( aResName, nPos + sizeof( "$(ROW)" ) - 1, STRING_LEN );
+ }
+ else
+ aPrefix = aResName;
+
+ // set color values
+ for( sal_Int32 i=0; i < nCount; i++ )
+ {
+ aCol.SetColor( SAL_STATIC_CAST( ColorData, aColorSeq[ i ] ));
+
+ aName = aPrefix;
+ aName.Append( String::CreateFromInt32( i + 1 ));
+ aName.Append( aPostfix );
+
+ maDefColors.append( XColorEntry( aCol, aName ));
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+void SvxChartOptions::Commit()
+{
+ uno::Sequence< ::rtl::OUString > aNames = GetPropertyNames();
+ uno::Sequence< uno::Any > aValues( aNames.getLength());
+
+ if( aValues.getLength() >= 1 )
+ {
+ // 1. default colors for series
+ // convert list to sequence
+ const size_t nCount = maDefColors.size();
+ uno::Sequence< sal_Int64 > aColors( nCount );
+ for( size_t i=0; i < nCount; i++ )
+ {
+ ColorData aData = maDefColors.getColorData( i );
+ aColors[ i ] = aData;
+ }
+
+ aValues[ 0 ] <<= aColors;
+ }
+
+ PutProperties( aNames, aValues );
+}
+
+void SvxChartOptions::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& )
+{
+}
+
+// --------------------
+// class SvxChartColorTableItem
+// --------------------
+
+SvxChartColorTableItem::SvxChartColorTableItem( USHORT nWhich_, const SvxChartColorTable& aTable ) :
+ SfxPoolItem( nWhich_ ),
+ m_aColorTable( aTable )
+{
+}
+
+SvxChartColorTableItem::SvxChartColorTableItem( const SvxChartColorTableItem& rOther ) :
+ SfxPoolItem( rOther ),
+ m_aColorTable( rOther.m_aColorTable )
+{
+}
+
+SfxPoolItem* __EXPORT SvxChartColorTableItem::Clone( SfxItemPool * ) const
+{
+ return new SvxChartColorTableItem( *this );
+}
+
+int __EXPORT SvxChartColorTableItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==( rAttr ), "SvxChartColorTableItem::operator== : types differ" );
+
+ const SvxChartColorTableItem * rCTItem( dynamic_cast< const SvxChartColorTableItem * >( & rAttr ));
+ if( rCTItem )
+ {
+ return (this->m_aColorTable == rCTItem->GetColorTable());
+ }
+
+ return 0;
+}
+
+void __EXPORT SvxChartColorTableItem::SetOptions( SvxChartOptions* pOpts ) const
+{
+ if ( pOpts )
+ pOpts->SetDefaultColors( m_aColorTable );
+}
+
+
+SvxChartColorTable & SvxChartColorTableItem::GetColorTable()
+{
+ return m_aColorTable;
+}
+
+const SvxChartColorTable & SvxChartColorTableItem::GetColorTable() const
+{
+ return m_aColorTable;
+}
+
+void SvxChartColorTableItem::ReplaceColorByIndex( size_t _nIndex, const XColorEntry & _rEntry )
+{
+ m_aColorTable.replace( _nIndex, _rEntry );
+}
diff --git a/cui/source/options/cfgchart.hxx b/cui/source/options/cfgchart.hxx
new file mode 100644
index 000000000000..89f18e621cff
--- /dev/null
+++ b/cui/source/options/cfgchart.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: cfgchart.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_CFGCHART_HXX
+#define _SVX_CFGCHART_HXX
+
+// header for TYPEINFO
+#include <tools/rtti.hxx>
+// header for ConfigItem
+#include <unotools/configitem.hxx>
+// header for SfxPoolItem
+#include <svl/poolitem.hxx>
+// header for XColorEntry
+#include <svx/xtable.hxx>
+
+#include <vector>
+
+class SvxChartColorTable
+{
+private:
+ ::std::vector< XColorEntry > m_aColorEntries;
+
+public:
+ SvxChartColorTable();
+ explicit SvxChartColorTable( const SvxChartColorTable & _rSource );
+
+ // accessors
+ size_t size() const;
+ const XColorEntry & operator[]( size_t _nIndex ) const;
+ ColorData getColorData( size_t _nIndex ) const;
+
+ // mutators
+ void clear();
+ void append( const XColorEntry & _rEntry );
+ void replace( size_t _nIndex, const XColorEntry & _rEntry );
+ void useDefault();
+
+ // comparison
+ bool operator==( const SvxChartColorTable & _rOther ) const;
+};
+
+// ====================
+// all options
+// ====================
+class SvxChartOptions : public ::utl::ConfigItem
+{
+private:
+ SvxChartColorTable maDefColors;
+ BOOL mbIsInitialized;
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString >
+ maPropertyNames;
+
+ inline ::com::sun::star::uno::Sequence< ::rtl::OUString > GetPropertyNames() const
+ { return maPropertyNames; }
+ BOOL RetrieveOptions();
+
+public:
+ SvxChartOptions();
+ virtual ~SvxChartOptions();
+
+ const SvxChartColorTable& GetDefaultColors();
+ void SetDefaultColors( const SvxChartColorTable& aCol );
+
+ virtual void Commit();
+ virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames);
+};
+
+// ====================
+// items
+// ====================
+class SvxChartColorTableItem : public SfxPoolItem
+{
+public:
+ TYPEINFO();
+ SvxChartColorTableItem( USHORT nWhich, const SvxChartColorTable& );
+ SvxChartColorTableItem( const SvxChartColorTableItem& );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+ void SetOptions( SvxChartOptions* pOpts ) const;
+
+ const SvxChartColorTable & GetColorTable() const ;
+ SvxChartColorTable & GetColorTable();
+ void ReplaceColorByIndex( size_t _nIndex, const XColorEntry & _rEntry );
+
+private:
+ SvxChartColorTable m_aColorTable;
+};
+
+#endif // _SVX_CFGCHART_HXX
+
diff --git a/cui/source/options/connpoolconfig.cxx b/cui/source/options/connpoolconfig.cxx
new file mode 100644
index 000000000000..1a681beb263e
--- /dev/null
+++ b/cui/source/options/connpoolconfig.cxx
@@ -0,0 +1,226 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: connpoolconfig.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "connpoolconfig.hxx"
+#include "connpoolsettings.hxx"
+
+#include "connpooloptions.hxx"
+#include <svl/itemset.hxx>
+#include <unotools/confignode.hxx>
+#include <comphelper/extract.hxx>
+#include <svl/eitem.hxx>
+#include <comphelper/processfactory.hxx>
+#include "sdbcdriverenum.hxx"
+
+//........................................................................
+namespace offapp
+{
+//........................................................................
+
+ using namespace ::utl;
+ using namespace ::com::sun::star::uno;
+
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& getConnectionPoolNodeName()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("org.openoffice.Office.DataAccess/ConnectionPool");
+ return s_sNodeName;
+ }
+
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& getEnablePoolingNodeName()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("EnablePooling");
+ return s_sNodeName;
+ }
+
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& getDriverSettingsNodeName()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("DriverSettings");
+ return s_sNodeName;
+ }
+
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& getDriverNameNodeName()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("DriverName");
+ return s_sNodeName;
+ }
+
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& getEnableNodeName()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("Enable");
+ return s_sNodeName;
+ }
+
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& getTimeoutNodeName()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("Timeout");
+ return s_sNodeName;
+ }
+
+ //====================================================================
+ //= ConnectionPoolConfig
+ //====================================================================
+ //--------------------------------------------------------------------
+ void ConnectionPoolConfig::GetOptions(SfxItemSet& _rFillItems)
+ {
+ // the config node where all pooling relevant info are stored under
+ OConfigurationTreeRoot aConnectionPoolRoot = OConfigurationTreeRoot::createWithServiceFactory(
+ ::comphelper::getProcessServiceFactory(), getConnectionPoolNodeName(), -1, OConfigurationTreeRoot::CM_READONLY);
+
+ // the global "enabled" flag
+ Any aEnabled = aConnectionPoolRoot.getNodeValue(getEnablePoolingNodeName());
+ sal_Bool bEnabled = sal_True;
+ aEnabled >>= bEnabled;
+ _rFillItems.Put(SfxBoolItem(SID_SB_POOLING_ENABLED, bEnabled));
+
+ // the settings for the single drivers
+ DriverPoolingSettings aSettings;
+ // first get all the drivers register at the driver manager
+ ODriverEnumeration aEnumDrivers;
+ for ( ODriverEnumeration::const_iterator aLoopDrivers = aEnumDrivers.begin();
+ aLoopDrivers != aEnumDrivers.end();
+ ++aLoopDrivers
+ )
+ {
+ aSettings.push_back(DriverPooling(*aLoopDrivers, sal_False, 120));
+ }
+
+ // then look for which of them settings are stored in the configuration
+ OConfigurationNode aDriverSettings = aConnectionPoolRoot.openNode(getDriverSettingsNodeName());
+
+ Sequence< ::rtl::OUString > aDriverKeys = aDriverSettings.getNodeNames();
+ const ::rtl::OUString* pDriverKeys = aDriverKeys.getConstArray();
+ const ::rtl::OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength();
+ for (;pDriverKeys != pDriverKeysEnd; ++pDriverKeys)
+ {
+ // the name of the driver in this round
+ OConfigurationNode aThisDriverSettings = aDriverSettings.openNode(*pDriverKeys);
+ ::rtl::OUString sThisDriverName;
+ aThisDriverSettings.getNodeValue(getDriverNameNodeName()) >>= sThisDriverName;
+
+ // look if we (resp. the driver manager) know this driver
+ // doing O(n) search here, which is expensive, but this doesn't matter in this small case ...
+ DriverPoolingSettings::iterator aLookup;
+ for ( aLookup = aSettings.begin();
+ aLookup != aSettings.end();
+ ++aLookup
+ )
+ if (sThisDriverName.equals(aLookup->sName))
+ break;
+
+ if (aLookup == aSettings.end())
+ { // do not know the driver - add it
+ aSettings.push_back(DriverPooling(sThisDriverName, sal_False, 120));
+
+ // and the position of the new entry
+ aLookup = aSettings.end();
+ --aLookup;
+ }
+
+ // now fill this entry with the settings from the configuration
+ aThisDriverSettings.getNodeValue(getEnableNodeName()) >>= aLookup->bEnabled;
+ aThisDriverSettings.getNodeValue(getTimeoutNodeName()) >>= aLookup->nTimeoutSeconds;
+ }
+
+ _rFillItems.Put(DriverPoolingSettingsItem(SID_SB_DRIVER_TIMEOUTS, aSettings));
+ }
+
+ //--------------------------------------------------------------------
+ void ConnectionPoolConfig::SetOptions(const SfxItemSet& _rSourceItems)
+ {
+ // the config node where all pooling relevant info are stored under
+ OConfigurationTreeRoot aConnectionPoolRoot = OConfigurationTreeRoot::createWithServiceFactory(
+ ::comphelper::getProcessServiceFactory(), getConnectionPoolNodeName(), -1, OConfigurationTreeRoot::CM_UPDATABLE);
+
+ if (!aConnectionPoolRoot.isValid())
+ // already asserted by the OConfigurationTreeRoot
+ return;
+
+ sal_Bool bNeedCommit = sal_False;
+
+ // the global "enabled" flag
+ SFX_ITEMSET_GET( _rSourceItems, pEnabled, SfxBoolItem, SID_SB_POOLING_ENABLED, sal_True );
+ if (pEnabled)
+ {
+ sal_Bool bEnabled = pEnabled->GetValue();
+ aConnectionPoolRoot.setNodeValue(getEnablePoolingNodeName(), Any(&bEnabled, ::getBooleanCppuType()));
+ bNeedCommit = sal_True;
+ }
+
+ // the settings for the single drivers
+ SFX_ITEMSET_GET( _rSourceItems, pDriverSettings, DriverPoolingSettingsItem, SID_SB_DRIVER_TIMEOUTS, sal_True );
+ if (pDriverSettings)
+ {
+ OConfigurationNode aDriverSettings = aConnectionPoolRoot.openNode(getDriverSettingsNodeName());
+ if (!aDriverSettings.isValid())
+ return;
+
+ ::rtl::OUString sThisDriverName;
+ OConfigurationNode aThisDriverSettings;
+
+ const DriverPoolingSettings& rNewSettings = pDriverSettings->getSettings();
+ for ( DriverPoolingSettings::const_iterator aLoop = rNewSettings.begin();
+ aLoop != rNewSettings.end();
+ ++aLoop
+ )
+ {
+ // need the name as ::rtl::OUString
+ sThisDriverName = aLoop->sName;
+
+ // the sub-node for this driver
+ if (aDriverSettings.hasByName(aLoop->sName))
+ aThisDriverSettings = aDriverSettings.openNode(aLoop->sName);
+ else
+ aThisDriverSettings = aDriverSettings.createNode(aLoop->sName);
+
+ // set the values
+ aThisDriverSettings.setNodeValue(getDriverNameNodeName(), makeAny(sThisDriverName));
+ aThisDriverSettings.setNodeValue(getEnableNodeName(), Any(&aLoop->bEnabled, ::getBooleanCppuType()));
+ aThisDriverSettings.setNodeValue(getTimeoutNodeName(), makeAny(aLoop->nTimeoutSeconds));
+ }
+ bNeedCommit = sal_True;
+ }
+ if (bNeedCommit)
+ aConnectionPoolRoot.commit();
+ }
+
+//........................................................................
+} // namespace offapp
+//........................................................................
+
+
diff --git a/cui/source/options/connpoolconfig.hxx b/cui/source/options/connpoolconfig.hxx
new file mode 100644
index 000000000000..248dd16146f0
--- /dev/null
+++ b/cui/source/options/connpoolconfig.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: connpoolconfig.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _OFFAPP_CONNPOOLCONFIG_HXX_
+#define _OFFAPP_CONNPOOLCONFIG_HXX_
+
+class SfxItemSet;
+//........................................................................
+namespace offapp
+{
+//........................................................................
+
+ //====================================================================
+ //= ConnectionPoolConfig
+ //====================================================================
+ class ConnectionPoolConfig
+ {
+
+ public:
+ static void GetOptions(SfxItemSet& _rFillItems);
+ static void SetOptions(const SfxItemSet& _rSourceItems);
+ };
+
+//........................................................................
+} // namespace offapp
+//........................................................................
+
+#endif // _OFFAPP_CONNPOOLCONFIG_HXX_
+
+
diff --git a/cui/source/options/connpooloptions.cxx b/cui/source/options/connpooloptions.cxx
new file mode 100644
index 000000000000..fd195b18a7e3
--- /dev/null
+++ b/cui/source/options/connpooloptions.cxx
@@ -0,0 +1,516 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: connpooloptions.cxx,v $
+ * $Revision: 1.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#ifdef SVX_DLLIMPLEMENTATION
+#undef SVX_DLLIMPLEMENTATION
+#endif
+#include "connpooloptions.hxx"
+#ifndef _OFFAPP_CONNPOOLOPTIONS_HRC_
+#include "connpooloptions.hrc"
+#endif
+#include <svtools/editbrowsebox.hxx>
+#include <vcl/field.hxx>
+#include "connpoolsettings.hxx"
+#include <svl/eitem.hxx>
+
+#include <cuires.hrc>
+#include "helpid.hrc"
+#include <dialmgr.hxx>
+
+//........................................................................
+namespace offapp
+{
+//........................................................................
+
+ //====================================================================
+ //= DriverListControl
+ //====================================================================
+ typedef ::svt::EditBrowseBox DriverListControl_Base;
+ class DriverListControl : public DriverListControl_Base
+ {
+ using Window::Update;
+ protected:
+ DriverPoolingSettings m_aSavedSettings;
+ DriverPoolingSettings m_aSettings;
+ DriverPoolingSettings::const_iterator m_aSeekRow;
+
+ String m_sYes;
+ String m_sNo;
+
+ Link m_aRowChangeHandler;
+
+ public:
+ DriverListControl( Window* _pParent, const ResId& _rId);
+
+ virtual void Init();
+ void Update(const DriverPoolingSettings& _rSettings);
+ virtual String GetCellText( long nRow, USHORT nColId ) const;
+
+ // the handler will be called with a DriverPoolingSettings::const_iterator as parameter,
+ // or NULL if no valid current row exists
+ void SetRowChangeHandler(const Link& _rHdl) { m_aRowChangeHandler = _rHdl; }
+ Link GetRowChangeHandler() const { return m_aRowChangeHandler; }
+
+ const DriverPooling* getCurrentRow() const;
+ DriverPooling* getCurrentRow();
+ void updateCurrentRow();
+
+ const DriverPoolingSettings& getSettings() const { return m_aSettings; }
+
+ void saveValue() { m_aSavedSettings = m_aSettings; }
+ sal_Bool isModified() const;
+
+ protected:
+ virtual void InitController( ::svt::CellControllerRef& rController, long nRow, USHORT nCol );
+ virtual ::svt::CellController* GetController( long nRow, USHORT nCol );
+
+ virtual void PaintCell( OutputDevice& rDev, const Rectangle& rRect, USHORT nColId ) const;
+
+ virtual BOOL SeekRow( long nRow );
+ virtual BOOL SaveModified();
+
+ virtual sal_Bool IsTabAllowed(sal_Bool _bForward) const;
+
+ virtual void StateChanged( StateChangedType nStateChange );
+
+ virtual void CursorMoved();
+
+ protected:
+ virtual sal_uInt32 GetTotalCellWidth(long nRow, USHORT nColId);
+
+
+ private:
+ String implGetCellText(DriverPoolingSettings::const_iterator _rPos, sal_uInt16 _nColId) const;
+ };
+
+ //--------------------------------------------------------------------
+ DriverListControl::DriverListControl( Window* _pParent, const ResId& _rId)
+// :DriverListControl_Base(_pParent, _rId, DBBF_NOROWPICTURE, BROWSER_AUTO_VSCROLL | BROWSER_AUTO_HSCROLL | BROWSER_COLUMNSELECTION | BROWSER_HLINESFULL | BROWSER_VLINESFULL | BROWSER_HIDESELECT | BROWSER_CURSOR_WO_FOCUS)
+ :DriverListControl_Base(_pParent, _rId, EBBF_NOROWPICTURE, BROWSER_AUTO_VSCROLL | BROWSER_AUTO_HSCROLL | BROWSER_HIDECURSOR | BROWSER_AUTOSIZE_LASTCOL)
+ ,m_aSeekRow(m_aSettings.end())
+ ,m_sYes(ResId(STR_YES,*_rId.GetResMgr()))
+ ,m_sNo(ResId(STR_NO,*_rId.GetResMgr()))
+ {
+ SetStyle((GetStyle() & ~WB_HSCROLL) | WB_AUTOHSCROLL);
+
+ SetUniqueId(UID_OFA_CONNPOOL_DRIVERLIST_BACK);
+ GetDataWindow().SetHelpId(HID_OFA_CONNPOOL_DRIVERLIST);
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool DriverListControl::IsTabAllowed(sal_Bool /*_bForward*/) const
+ {
+ // no travinling within the fields via RETURN and TAB
+ return sal_False;
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool DriverListControl::isModified() const
+ {
+ if (m_aSettings.size() != m_aSavedSettings.size())
+ return sal_True;
+
+ DriverPoolingSettings::const_iterator aCurrent = m_aSettings.begin();
+ DriverPoolingSettings::const_iterator aCurrentEnd = m_aSettings.end();
+ DriverPoolingSettings::const_iterator aSaved = m_aSavedSettings.begin();
+ for (;aCurrent != aCurrentEnd; ++aCurrent, ++aSaved)
+ {
+ if (*aCurrent != *aSaved)
+ return sal_True;
+ }
+
+ return sal_False;
+ }
+
+ //--------------------------------------------------------------------
+ void DriverListControl::Init()
+ {
+ DriverListControl_Base::Init();
+
+ Size aColWidth = LogicToPixel(Size(160, 0), MAP_APPFONT);
+ InsertDataColumn(1, String(CUI_RES(STR_DRIVER_NAME)), aColWidth.Width());
+ aColWidth = LogicToPixel(Size(30, 0), MAP_APPFONT);
+ InsertDataColumn(2, String(CUI_RES(STR_POOLED_FLAG)), aColWidth.Width());
+ aColWidth = LogicToPixel(Size(60, 0), MAP_APPFONT);
+ InsertDataColumn(3, String(CUI_RES(STR_POOL_TIMEOUT)), aColWidth.Width());
+ // Attention: the resource of the string is local to the resource of the enclosing dialog!
+ }
+
+ //--------------------------------------------------------------------
+ void DriverListControl::CursorMoved()
+ {
+ DriverListControl_Base::CursorMoved();
+
+ // call the row change handler
+ if ( m_aRowChangeHandler.IsSet() )
+ {
+ if ( GetCurRow() >= 0 )
+ { // == -1 may happen in case the browse box has just been cleared
+ m_aRowChangeHandler.Call( getCurrentRow() );
+ }
+ }
+ }
+
+ //--------------------------------------------------------------------
+ const DriverPooling* DriverListControl::getCurrentRow() const
+ {
+ OSL_ENSURE( ( GetCurRow() < m_aSettings.size() ) && ( GetCurRow() >= 0 ),
+ "DriverListControl::getCurrentRow: invalid current row!");
+
+ if ( ( GetCurRow() >= 0 ) && ( GetCurRow() < m_aSettings.size() ) )
+ return &(*(m_aSettings.begin() + GetCurRow()));
+
+ return NULL;
+ }
+
+ //--------------------------------------------------------------------
+ DriverPooling* DriverListControl::getCurrentRow()
+ {
+ OSL_ENSURE( ( GetCurRow() < m_aSettings.size() ) && ( GetCurRow() >= 0 ),
+ "DriverListControl::getCurrentRow: invalid current row!");
+
+ if ( ( GetCurRow() >= 0 ) && ( GetCurRow() < m_aSettings.size() ) )
+ return &(*(m_aSettings.begin() + GetCurRow()));
+
+ return NULL;
+ }
+
+ //--------------------------------------------------------------------
+ void DriverListControl::updateCurrentRow()
+ {
+ Window::Invalidate( GetRowRectPixel( GetCurRow() ), INVALIDATE_UPDATE );
+ }
+
+ //--------------------------------------------------------------------
+ void DriverListControl::Update(const DriverPoolingSettings& _rSettings)
+ {
+ m_aSettings = _rSettings;
+
+ SetUpdateMode(sal_False);
+ RowRemoved(0, GetRowCount());
+ RowInserted(0, m_aSettings.size());
+ SetUpdateMode(sal_True);
+
+ ActivateCell(1, 0);
+ }
+
+ //--------------------------------------------------------------------
+ sal_uInt32 DriverListControl::GetTotalCellWidth(long nRow, USHORT nColId)
+ {
+ return GetDataWindow().GetTextWidth(GetCellText(nRow, nColId));
+ }
+
+ //--------------------------------------------------------------------
+ String DriverListControl::implGetCellText(DriverPoolingSettings::const_iterator _rPos, sal_uInt16 _nColId) const
+ {
+ OSL_ENSURE(_rPos < m_aSettings.end(), "DriverListControl::implGetCellText: invalid position!");
+
+ String sReturn;
+ switch (_nColId)
+ {
+ case 1:
+ sReturn = _rPos->sName;
+ break;
+ case 2:
+ sReturn = _rPos->bEnabled ? m_sYes : m_sNo;
+ break;
+ case 3:
+ if (_rPos->bEnabled)
+ sReturn = String::CreateFromInt32(_rPos->nTimeoutSeconds);
+ break;
+ default:
+ OSL_ENSURE(sal_False, "DriverListControl::implGetCellText: invalid column id!");
+ }
+ return sReturn;
+ }
+
+ //--------------------------------------------------------------------
+ void DriverListControl::StateChanged( StateChangedType nStateChange )
+ {
+ if (STATE_CHANGE_ENABLE == nStateChange)
+ Window::Invalidate(INVALIDATE_UPDATE);
+ DriverListControl_Base::StateChanged( nStateChange );
+ }
+
+ //--------------------------------------------------------------------
+ String DriverListControl::GetCellText( long nRow, USHORT nColId ) const
+ {
+ String sReturn;
+ if (nRow > m_aSettings.size())
+ {
+ OSL_ENSURE(sal_False, "DriverListControl::GetCellText: don't ask me for such rows!");
+ }
+ else
+ {
+ sReturn = implGetCellText(m_aSettings.begin() + nRow, nColId);
+ }
+ return sReturn;
+ }
+
+ //--------------------------------------------------------------------
+ void DriverListControl::InitController( ::svt::CellControllerRef& rController, long nRow, USHORT nCol )
+ {
+ rController->GetWindow().SetText(GetCellText(nRow, nCol));
+ }
+
+ //--------------------------------------------------------------------
+ ::svt::CellController* DriverListControl::GetController( long /*nRow*/, USHORT /*nCol*/ )
+ {
+ return NULL;
+ }
+
+ //--------------------------------------------------------------------
+ BOOL DriverListControl::SaveModified()
+ {
+ return TRUE;
+ }
+
+ //--------------------------------------------------------------------
+ BOOL DriverListControl::SeekRow( long _nRow )
+ {
+ DriverListControl_Base::SeekRow(_nRow);
+
+ if (_nRow < m_aSettings.size())
+ m_aSeekRow = m_aSettings.begin() + _nRow;
+ else
+ m_aSeekRow = m_aSettings.end();
+
+ return m_aSeekRow != m_aSettings.end();
+ }
+
+ //--------------------------------------------------------------------
+ void DriverListControl::PaintCell( OutputDevice& rDev, const Rectangle& rRect, USHORT nColId ) const
+ {
+ OSL_ENSURE(m_aSeekRow != m_aSettings.end(), "DriverListControl::PaintCell: invalid row!");
+
+ if (m_aSeekRow != m_aSettings.end())
+ {
+ rDev.SetClipRegion(rRect);
+
+ sal_uInt16 nStyle = TEXT_DRAW_CLIP;
+ if (!IsEnabled())
+ nStyle |= TEXT_DRAW_DISABLE;
+ switch (nColId)
+ {
+ case 1: nStyle |= TEXT_DRAW_LEFT; break;
+ case 2:
+ case 3: nStyle |= TEXT_DRAW_CENTER; break;
+ }
+
+ rDev.DrawText(rRect, implGetCellText(m_aSeekRow, nColId), nStyle);
+
+ rDev.SetClipRegion();
+ }
+ }
+
+ //====================================================================
+ //= ConnectionPoolOptionsPage
+ //====================================================================
+ //--------------------------------------------------------------------
+ ConnectionPoolOptionsPage::ConnectionPoolOptionsPage(Window* _pParent, const SfxItemSet& _rAttrSet)
+ :SfxTabPage(_pParent, CUI_RES(RID_OFAPAGE_CONNPOOLOPTIONS ), _rAttrSet)
+ ,m_aFrame (this, CUI_RES(FL_POOLING))
+ ,m_aEnablePooling (this, CUI_RES(CB_POOL_CONNS))
+ ,m_aDriversLabel (this, CUI_RES(FT_DRIVERS))
+ ,m_pDriverList(new DriverListControl(this, CUI_RES(CTRL_DRIVER_LIST)))
+ ,m_aDriverLabel (this, CUI_RES(FT_DRIVERLABEL))
+ ,m_aDriver (this, CUI_RES(FT_DRIVER))
+ ,m_aDriverPoolingEnabled(this, CUI_RES(CB_DRIVERPOOLING))
+ ,m_aTimeoutLabel (this, CUI_RES(FT_TIMEOUT))
+ ,m_aTimeout (this, CUI_RES(NF_TIMEOUT))
+ {
+ m_pDriverList->Init();
+ m_pDriverList->Show();
+
+ FreeResource();
+
+ m_aEnablePooling.SetClickHdl( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) );
+ m_aDriverPoolingEnabled.SetClickHdl( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) );
+
+ m_pDriverList->SetRowChangeHandler( LINK(this, ConnectionPoolOptionsPage, OnDriverRowChanged) );
+ }
+
+ //--------------------------------------------------------------------
+ SfxTabPage* ConnectionPoolOptionsPage::Create(Window* _pParent, const SfxItemSet& _rAttrSet)
+ {
+ return new ConnectionPoolOptionsPage(_pParent, _rAttrSet);
+ }
+
+ //--------------------------------------------------------------------
+ ConnectionPoolOptionsPage::~ConnectionPoolOptionsPage()
+ {
+ delete m_pDriverList;
+ }
+
+ //--------------------------------------------------------------------
+ void ConnectionPoolOptionsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool /*_bFromReset*/)
+ {
+ // the enabled flag
+ SFX_ITEMSET_GET( _rSet, pEnabled, SfxBoolItem, SID_SB_POOLING_ENABLED, sal_True );
+ OSL_ENSURE(pEnabled, "ConnectionPoolOptionsPage::implInitControls: missing the Enabled item!");
+ m_aEnablePooling.Check(pEnabled ? pEnabled->GetValue() : sal_True);
+
+ m_aEnablePooling.SaveValue();
+
+ // the settings for the single drivers
+ SFX_ITEMSET_GET( _rSet, pDriverSettings, DriverPoolingSettingsItem, SID_SB_DRIVER_TIMEOUTS, sal_True );
+ if (pDriverSettings)
+ m_pDriverList->Update(pDriverSettings->getSettings());
+ else
+ {
+ OSL_ENSURE(sal_False, "ConnectionPoolOptionsPage::implInitControls: missing the DriverTimeouts item!");
+ m_pDriverList->Update(DriverPoolingSettings());
+ }
+ m_pDriverList->saveValue();
+
+ // reflect the new settings
+ OnEnabledDisabled(&m_aEnablePooling);
+ }
+
+ //--------------------------------------------------------------------
+ long ConnectionPoolOptionsPage::Notify( NotifyEvent& _rNEvt )
+ {
+ if (EVENT_LOSEFOCUS == _rNEvt.GetType())
+ if (m_aTimeout.IsWindowOrChild(_rNEvt.GetWindow()))
+ commitTimeoutField();
+
+ return SfxTabPage::Notify(_rNEvt);
+ }
+
+ //--------------------------------------------------------------------
+ BOOL ConnectionPoolOptionsPage::FillItemSet(SfxItemSet& _rSet)
+ {
+ commitTimeoutField();
+
+ sal_Bool bModified = sal_False;
+ // the enabled flag
+ if (m_aEnablePooling.GetSavedValue() != m_aEnablePooling.IsChecked())
+ {
+ _rSet.Put(SfxBoolItem(SID_SB_POOLING_ENABLED, m_aEnablePooling.IsChecked()), SID_SB_POOLING_ENABLED);
+ bModified = sal_True;
+ }
+
+ // the settings for the single drivers
+ if (m_pDriverList->isModified())
+ {
+ _rSet.Put(DriverPoolingSettingsItem(SID_SB_DRIVER_TIMEOUTS, m_pDriverList->getSettings()), SID_SB_DRIVER_TIMEOUTS);
+ bModified = sal_True;
+ }
+
+ return bModified;
+ }
+
+ //--------------------------------------------------------------------
+ void ConnectionPoolOptionsPage::ActivatePage( const SfxItemSet& _rSet)
+ {
+ SfxTabPage::ActivatePage(_rSet);
+ implInitControls(_rSet, sal_False);
+ }
+
+ //--------------------------------------------------------------------
+ void ConnectionPoolOptionsPage::Reset(const SfxItemSet& _rSet)
+ {
+ implInitControls(_rSet, sal_True);
+ }
+
+ //--------------------------------------------------------------------
+ IMPL_LINK( ConnectionPoolOptionsPage, OnDriverRowChanged, const void*, _pRowIterator )
+ {
+ sal_Bool bValidRow = (NULL != _pRowIterator);
+ m_aDriverPoolingEnabled.Enable(bValidRow && m_aEnablePooling.IsChecked());
+ m_aTimeoutLabel.Enable(bValidRow);
+ m_aTimeout.Enable(bValidRow);
+
+ if (!bValidRow)
+ { // positioned on an invalid row
+ m_aDriver.SetText(String());
+ }
+ else
+ {
+ const DriverPooling *pDriverPos = static_cast<const DriverPooling*>(_pRowIterator);
+
+ m_aDriver.SetText(pDriverPos->sName);
+ m_aDriverPoolingEnabled.Check(pDriverPos->bEnabled);
+ m_aTimeout.SetText(String::CreateFromInt32(pDriverPos->nTimeoutSeconds));
+
+ OnEnabledDisabled(&m_aDriverPoolingEnabled);
+ }
+
+ return 0L;
+ }
+
+ //--------------------------------------------------------------------
+ void ConnectionPoolOptionsPage::commitTimeoutField()
+ {
+ if (DriverPooling* pCurrentDriver = m_pDriverList->getCurrentRow())
+ {
+ pCurrentDriver->nTimeoutSeconds = static_cast<long>(m_aTimeout.GetValue());
+ m_pDriverList->updateCurrentRow();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ IMPL_LINK( ConnectionPoolOptionsPage, OnEnabledDisabled, const CheckBox*, _pCheckBox )
+ {
+ sal_Bool bGloballyEnabled = m_aEnablePooling.IsChecked();
+ sal_Bool bLocalDriverChanged = &m_aDriverPoolingEnabled == _pCheckBox;
+
+ if (&m_aEnablePooling == _pCheckBox)
+ {
+ m_aDriversLabel.Enable(bGloballyEnabled);
+ m_pDriverList->Enable(bGloballyEnabled);
+ m_aDriverLabel.Enable(bGloballyEnabled);
+ m_aDriver.Enable(bGloballyEnabled);
+ m_aDriverPoolingEnabled.Enable(bGloballyEnabled);
+ }
+ else
+ OSL_ENSURE(bLocalDriverChanged, "ConnectionPoolOptionsPage::OnEnabledDisabled: where did this come from?");
+
+ m_aTimeoutLabel.Enable(bGloballyEnabled && m_aDriverPoolingEnabled.IsChecked());
+ m_aTimeout.Enable(bGloballyEnabled && m_aDriverPoolingEnabled.IsChecked());
+
+ if (bLocalDriverChanged)
+ {
+ // update the list
+ m_pDriverList->getCurrentRow()->bEnabled = m_aDriverPoolingEnabled.IsChecked();
+ m_pDriverList->updateCurrentRow();
+ }
+
+ return 0L;
+ }
+
+//........................................................................
+} // namespace offapp
+//........................................................................
+
+
diff --git a/cui/source/options/connpooloptions.hrc b/cui/source/options/connpooloptions.hrc
new file mode 100644
index 000000000000..89f3ae64e1f8
--- /dev/null
+++ b/cui/source/options/connpooloptions.hrc
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: connpooloptions.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _OFFAPP_CONNPOOLOPTIONS_HRC_
+#define _OFFAPP_CONNPOOLOPTIONS_HRC_
+
+#define FL_POOLING 1
+#define CB_POOL_CONNS 2
+#define FT_DRIVERS 3
+#define CTRL_DRIVER_LIST 4
+#define FT_DRIVERLABEL 5
+#define FT_DRIVER 6
+#define CB_DRIVERPOOLING 7
+#define FT_TIMEOUT 8
+#define NF_TIMEOUT 9
+
+#define STR_DRIVER_NAME 1
+#define STR_POOLED_FLAG 2
+#define STR_POOL_TIMEOUT 3
+#define STR_YES 4
+#define STR_NO 5
+
+#endif // _OFFAPP_CONNPOOLOPTIONS_HRC_
+
+
diff --git a/cui/source/options/connpooloptions.hxx b/cui/source/options/connpooloptions.hxx
new file mode 100644
index 000000000000..b2b40354f433
--- /dev/null
+++ b/cui/source/options/connpooloptions.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: connpooloptions.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _OFFAPP_CONNPOOLOPTIONS_HXX_
+#define _OFFAPP_CONNPOOLOPTIONS_HXX_
+
+#include <svl/solar.hrc>
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/field.hxx>
+#include <svx/databaseregistrationui.hxx>
+
+//........................................................................
+namespace offapp
+{
+//........................................................................
+
+ //====================================================================
+ //= ConnectionPoolOptionsPage
+ //====================================================================
+ class DriverListControl;
+ class ConnectionPoolOptionsPage : public SfxTabPage
+ {
+ using TabPage::ActivatePage;
+
+ protected:
+ FixedLine m_aFrame;
+ CheckBox m_aEnablePooling;
+ FixedText m_aDriversLabel;
+ DriverListControl* m_pDriverList;
+ FixedText m_aDriverLabel;
+ FixedText m_aDriver;
+ CheckBox m_aDriverPoolingEnabled;
+ FixedText m_aTimeoutLabel;
+ NumericField m_aTimeout;
+
+ protected:
+ ConnectionPoolOptionsPage(Window* _pParent, const SfxItemSet& _rAttrSet);
+
+ public:
+ static SfxTabPage* Create(Window* _pParent, const SfxItemSet& _rAttrSet);
+
+ ~ConnectionPoolOptionsPage();
+
+ protected:
+ virtual long Notify( NotifyEvent& _rNEvt );
+
+ virtual BOOL FillItemSet(SfxItemSet& _rSet);
+ virtual void Reset(const SfxItemSet& _rSet);
+ virtual void ActivatePage( const SfxItemSet& _rSet);
+
+ protected:
+ DECL_LINK( OnEnabledDisabled, const CheckBox* );
+ DECL_LINK( OnDriverRowChanged, const void* );
+
+ void implInitControls(const SfxItemSet& _rSet, sal_Bool _bFromReset);
+
+ void commitTimeoutField();
+ };
+
+//........................................................................
+} // namespace offapp
+//........................................................................
+
+#endif // _OFFAPP_CONNPOOLOPTIONS_HXX_
+
+
diff --git a/cui/source/options/connpooloptions.src b/cui/source/options/connpooloptions.src
new file mode 100644
index 000000000000..c8d1dd03e47d
--- /dev/null
+++ b/cui/source/options/connpooloptions.src
@@ -0,0 +1,169 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: connpooloptions.src,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "connpooloptions.hrc"
+#include <cuires.hrc>
+
+#define PAGE_SIZE_X 260
+#define PAGE_SIZE_Y 185
+
+#define LIST_SIZE_Y 100
+
+TabPage RID_OFAPAGE_CONNPOOLOPTIONS
+{
+ // HelpId = ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( PAGE_SIZE_X, PAGE_SIZE_Y ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+
+ FixedLine FL_POOLING
+ {
+ Pos = MAP_APPFONT( 4, 3 );
+ Size = MAP_APPFONT( PAGE_SIZE_X - 8, 8 );
+ Text [ en-US ] = "Connection pool";
+ };
+ CheckBox CB_POOL_CONNS
+ {
+ Pos = MAP_APPFONT( 7, 15 );
+ Size = MAP_APPFONT( PAGE_SIZE_X - 14, 10 );
+ Text [ en-US ] = "Connection pooling enabled";
+ };
+ FixedText FT_DRIVERS
+ {
+ Pos = MAP_APPFONT( 17, 28 );
+ Size = MAP_APPFONT( PAGE_SIZE_X - 14 - 8, 8 );
+ Text [ en-US ] = "Drivers known in %PRODUCTNAME";
+ };
+ Control CTRL_DRIVER_LIST
+ {
+ Pos = MAP_APPFONT( 17, 39 );
+ Size = MAP_APPFONT( PAGE_SIZE_X - 14 - 8, LIST_SIZE_Y );
+ TabStop = TRUE;
+ Border = TRUE;
+ SVLook = TRUE;
+ };
+ FixedText FT_DRIVERLABEL
+ {
+ Pos = MAP_APPFONT( 17, 39 + LIST_SIZE_Y + 4 );
+ Size = MAP_APPFONT( 70, 8 );
+ Text [ en-US ] = "Current driver:";
+ };
+ FixedText FT_DRIVER
+ {
+ Pos = MAP_APPFONT( 17 + 70 + 3, 39 + LIST_SIZE_Y + 4 );
+ Size = MAP_APPFONT( PAGE_SIZE_X - ( 15 + 70 + 3 ) - 7, 8 );
+ };
+ CheckBox CB_DRIVERPOOLING
+ {
+ Pos = MAP_APPFONT( 17, 39 + LIST_SIZE_Y + 4 + 8 + 3 );
+ Size = MAP_APPFONT( PAGE_SIZE_X - 23, 10 );
+ Text [ en-US ] = "Enable pooling for this driver";
+ };
+ FixedText FT_TIMEOUT
+ {
+ Pos = MAP_APPFONT( 27, 39 + LIST_SIZE_Y + 4 + 8 + 3 + 10 + 3 + 2 );
+ Size = MAP_APPFONT( 100, 8 );
+ Text [ en-US ] = "Timeout (seconds)";
+ };
+ NumericField NF_TIMEOUT
+ {
+ Pos = MAP_APPFONT( 27 + 100 + 3, 39 + LIST_SIZE_Y + 4 + 8 + 3 + 10 + 3 );
+ Size = MAP_APPFONT( 40, 12 );
+ SvLook = TRUE;
+ Border = TRUE;
+ Right = TRUE;
+ Spin = TRUE;
+ Repeat = TRUE;
+ Minimum = 30;
+ Maximum = 600;
+ StrictFormat = TRUE;
+ DecimalDigits = 0;
+ SpinSize = 1;
+ };
+
+ String STR_DRIVER_NAME
+ {
+ Text [ en-US ] = "Driver name";
+ };
+ String STR_POOLED_FLAG
+ {
+ Text [ en-US ] = "Pool";
+ };
+ String STR_POOL_TIMEOUT
+ {
+ Text [ en-US ] = "Timeout";
+ };
+ String STR_YES
+ {
+ Text [ en-US ] = "Yes";
+ };
+ String STR_NO
+ {
+ Text [ en-US ] = "No";
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/connpoolsettings.cxx b/cui/source/options/connpoolsettings.cxx
new file mode 100644
index 000000000000..03951a4ee271
--- /dev/null
+++ b/cui/source/options/connpoolsettings.cxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: connpoolsettings.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#ifdef SVX_DLLIMPLEMENTATION
+#undef SVX_DLLIMPLEMENTATION
+#endif
+#include "connpoolsettings.hxx"
+
+//........................................................................
+namespace offapp
+{
+//........................................................................
+
+ //====================================================================
+ //= DriverPooling
+ //====================================================================
+ //--------------------------------------------------------------------
+ DriverPooling::DriverPooling()
+ :bEnabled(sal_False)
+ ,nTimeoutSeconds(0)
+ {
+ }
+
+ //--------------------------------------------------------------------
+ DriverPooling::DriverPooling( const String& _rName, sal_Bool _bEnabled, const sal_Int32 _nTimeout )
+ :sName(_rName)
+ ,bEnabled(_bEnabled)
+ ,nTimeoutSeconds(_nTimeout)
+ {
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool DriverPooling::operator == (const DriverPooling& _rR) const
+ {
+ return (sName == _rR.sName)
+ && (bEnabled == _rR.bEnabled)
+ && (nTimeoutSeconds == _rR.nTimeoutSeconds);
+ }
+
+ //====================================================================
+ //= DriverPoolingSettings
+ //====================================================================
+ //--------------------------------------------------------------------
+ DriverPoolingSettings::DriverPoolingSettings()
+ {
+ }
+
+ //====================================================================
+ //= DriverPoolingSettingsItem
+ //====================================================================
+ TYPEINIT1( DriverPoolingSettingsItem, SfxPoolItem )
+ //--------------------------------------------------------------------
+ DriverPoolingSettingsItem::DriverPoolingSettingsItem( sal_uInt16 _nId, const DriverPoolingSettings _rSettings )
+ :SfxPoolItem(_nId)
+ ,m_aSettings(_rSettings)
+ {
+ }
+
+ //--------------------------------------------------------------------
+ int DriverPoolingSettingsItem::operator==( const SfxPoolItem& _rCompare ) const
+ {
+ const DriverPoolingSettingsItem* pItem = PTR_CAST(DriverPoolingSettingsItem, &_rCompare);
+ if (!pItem)
+ return sal_False;
+
+ if (m_aSettings.size() != pItem->m_aSettings.size())
+ return sal_False;
+
+ DriverPoolingSettings::const_iterator aOwn = m_aSettings.begin();
+ DriverPoolingSettings::const_iterator aOwnEnd = m_aSettings.end();
+ DriverPoolingSettings::const_iterator aForeign = pItem->m_aSettings.begin();
+ while (aOwn < aOwnEnd)
+ {
+ if (*aOwn != *aForeign)
+ return sal_False;
+
+ ++aForeign;
+ ++aOwn;
+ }
+
+ return sal_True;
+ }
+
+ //--------------------------------------------------------------------
+ SfxPoolItem* DriverPoolingSettingsItem::Clone( SfxItemPool * ) const
+ {
+ return new DriverPoolingSettingsItem(Which(), m_aSettings);
+ }
+
+ //--------------------------------------------------------------------
+
+//........................................................................
+} // namespace offapp
+//........................................................................
+
+
diff --git a/cui/source/options/connpoolsettings.hxx b/cui/source/options/connpoolsettings.hxx
new file mode 100644
index 000000000000..085732a6db74
--- /dev/null
+++ b/cui/source/options/connpoolsettings.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: connpoolsettings.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _OFFAPP_CONNPOOLSETTINGS_HXX_
+#define _OFFAPP_CONNPOOLSETTINGS_HXX_
+
+#include <tools/string.hxx>
+#include <comphelper/stl_types.hxx>
+#include <svl/poolitem.hxx>
+
+//........................................................................
+namespace offapp
+{
+//........................................................................
+
+ //====================================================================
+ //= DriverPooling
+ //====================================================================
+ struct DriverPooling
+ {
+ String sName;
+ sal_Bool bEnabled;
+ sal_Int32 nTimeoutSeconds;
+
+ DriverPooling();
+ DriverPooling( const String& _rName, sal_Bool _bEnabled, const sal_Int32 _nTimeout );
+
+ sal_Bool operator == (const DriverPooling& _rR) const;
+ sal_Bool operator != (const DriverPooling& _rR) const { return !operator ==(_rR); }
+ };
+
+ //====================================================================
+ //= DriverPoolingSettings
+ //====================================================================
+ class DriverPoolingSettings
+ {
+ protected:
+ DECLARE_STL_VECTOR( DriverPooling, DriverSettings );
+ DriverSettings m_aDrivers;
+
+ public:
+ typedef ConstDriverSettingsIterator const_iterator;
+ typedef DriverSettingsIterator iterator;
+
+ public:
+ DriverPoolingSettings();
+
+ sal_Int32 size() const { return m_aDrivers.size(); }
+
+ const_iterator begin() const { return m_aDrivers.begin(); }
+ const_iterator end() const { return m_aDrivers.end(); }
+
+ iterator begin() { return m_aDrivers.begin(); }
+ iterator end() { return m_aDrivers.end(); }
+
+ void push_back(const DriverPooling& _rElement) { m_aDrivers.push_back(_rElement); }
+ };
+
+ //====================================================================
+ //= DriverPoolingSettingsItem
+ //====================================================================
+ class DriverPoolingSettingsItem : public SfxPoolItem
+ {
+ protected:
+ DriverPoolingSettings m_aSettings;
+
+ public:
+ TYPEINFO();
+
+ DriverPoolingSettingsItem( sal_uInt16 _nId, const DriverPoolingSettings _rSettings );
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ const DriverPoolingSettings& getSettings() const { return m_aSettings; }
+ };
+
+//........................................................................
+} // namespace offapp
+//........................................................................
+
+#endif // _OFFAPP_CONNPOOLSETTINGS_HXX_
+
+
diff --git a/cui/source/options/cuisrchdlg.cxx b/cui/source/options/cuisrchdlg.cxx
new file mode 100644
index 000000000000..c958204fe3c4
--- /dev/null
+++ b/cui/source/options/cuisrchdlg.cxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: cuisrchdlg.cxx,v $
+ * $Revision: 1.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <vcl/wrkwin.hxx>
+#include <vcl/morebtn.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/slstitm.hxx>
+#include <svl/itemiter.hxx>
+#include <svl/style.hxx>
+#include <unotools/searchopt.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/module.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <svl/cjkoptions.hxx>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+
+#define _CUI_SRCHDLG_CXX
+#include "cuisrchdlg.hxx"
+
+#include <cuires.hrc>
+
+#define ITEMID_SETITEM 0
+
+#include <sfx2/srchitem.hxx>
+#include <svx/pageitem.hxx>
+#include <dialmgr.hxx>
+#include <svx/dlgutil.hxx>
+#include <optjsearch.hxx>
+#include <svx/brshitem.hxx>
+#include "backgrnd.hxx"
+
+
+// class SvxJSearchOptionsDialog -----------------------------------------
+
+SvxJSearchOptionsDialog::SvxJSearchOptionsDialog(
+ Window *pParent,
+ const SfxItemSet& rOptionsSet, INT32 nInitialFlags ) :
+ SfxSingleTabDialog ( pParent, rOptionsSet, RID_SVXPAGE_JSEARCH_OPTIONS ),
+ nInitialTlFlags( nInitialFlags )
+{
+ pPage = (SvxJSearchOptionsPage *)
+ SvxJSearchOptionsPage::Create( this, rOptionsSet );
+ SetTabPage( pPage ); //! implicitly calls pPage->Reset(...)!
+ pPage->EnableSaveOptions( FALSE );
+}
+
+
+SvxJSearchOptionsDialog::~SvxJSearchOptionsDialog()
+{
+ // pPage will be implicitly destroyed by the
+ // SfxSingleTabDialog destructor
+}
+
+
+void SvxJSearchOptionsDialog::Activate()
+{
+ pPage->SetTransliterationFlags( nInitialTlFlags );
+}
+
+
+INT32 SvxJSearchOptionsDialog::GetTransliterationFlags() const
+{
+ return pPage->GetTransliterationFlags();
+}
+
+
+void SvxJSearchOptionsDialog::SetTransliterationFlags( INT32 nSettings )
+{
+ pPage->SetTransliterationFlags( nSettings );
+}
diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx
new file mode 100644
index 000000000000..23e8bf865626
--- /dev/null
+++ b/cui/source/options/dbregister.cxx
@@ -0,0 +1,512 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dbregister.cxx,v $
+ * $Revision: 1.16 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "dbregister.hxx"
+#include "dbregister.hrc"
+#include "dbregistersettings.hxx"
+#include "connpooloptions.hxx"
+#include <svl/filenotation.hxx>
+#include <cuires.hrc>
+#include "helpid.hrc"
+#include <svtools/editbrowsebox.hxx>
+#include <cuires.hrc>
+#include <vcl/field.hxx>
+#include <svl/eitem.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <vcl/msgbox.hxx>
+#include <svtools/svtabbx.hxx>
+#include <svl/itemset.hxx>
+#include "doclinkdialog.hxx"
+#include <tools/urlobj.hxx>
+#include <unotools/localfilehelper.hxx>
+#include "optHeaderTabListbox.hxx"
+#include <sfx2/docfilt.hxx>
+#include <dialmgr.hxx>
+#include "dbregisterednamesconfig.hxx"
+#include <svx/dialogs.hrc>
+
+#define TAB_WIDTH1 80
+#define TAB_WIDTH_MIN 10
+#define TAB_WIDTH2 1000
+#define ITEMID_TYPE 1
+#define ITEMID_PATH 2
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star::uno;
+using namespace ::svt;
+
+// class RegistrationItemSetHolder -------------------------------------------------
+
+RegistrationItemSetHolder::RegistrationItemSetHolder( const SfxItemSet& _rMasterSet )
+ :m_aRegistrationItems( _rMasterSet )
+{
+ DbRegisteredNamesConfig::GetOptions( m_aRegistrationItems );
+}
+
+RegistrationItemSetHolder::~RegistrationItemSetHolder()
+{
+}
+
+// class DatabaseRegistrationDialog ------------------------------------------------
+
+DatabaseRegistrationDialog::DatabaseRegistrationDialog( Window* pParent, const SfxItemSet& rInAttrs )
+ :RegistrationItemSetHolder( rInAttrs )
+ ,SfxSingleTabDialog( pParent, getRegistrationItems(), RID_SFXPAGE_DBREGISTER )
+{
+ SfxTabPage* page = DbRegistrationOptionsPage::Create( this, getRegistrationItems() );
+
+ SetTabPage( page );
+ SetText( page->GetText() );
+}
+
+DatabaseRegistrationDialog::~DatabaseRegistrationDialog()
+{
+}
+
+short DatabaseRegistrationDialog::Execute()
+{
+ short result = SfxSingleTabDialog::Execute();
+ if ( result == RET_OK )
+ {
+ DBG_ASSERT( GetOutputItemSet(), "DatabaseRegistrationDialog::Execute: no output items!" );
+ if ( GetOutputItemSet() )
+ DbRegisteredNamesConfig::SetOptions( *GetOutputItemSet() );
+ }
+ return result;
+}
+
+// class DbRegistrationOptionsPage --------------------------------------------------
+
+DbRegistrationOptionsPage::DbRegistrationOptionsPage( Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, CUI_RES( RID_SFXPAGE_DBREGISTER), rSet ),
+
+ aTypeText ( this, CUI_RES( FT_TYPE ) ),
+ aPathText ( this, CUI_RES( FT_PATH ) ),
+ aPathCtrl ( this, CUI_RES( LB_PATH ) ),
+ m_aNew ( this, CUI_RES( BTN_NEW ) ),
+ m_aEdit ( this, CUI_RES( BTN_EDIT ) ),
+ m_aDelete ( this, CUI_RES( BTN_DELETE ) ),
+ aStdBox ( this, CUI_RES( GB_STD ) ),
+ pHeaderBar ( NULL ),
+ pPathBox ( NULL ),
+ m_pCurEntry ( NULL ),
+ m_nOldCount ( 0 ),
+ m_bModified ( FALSE )
+{
+ m_aNew.SetClickHdl( LINK( this, DbRegistrationOptionsPage, NewHdl ) );
+ m_aEdit.SetClickHdl( LINK( this, DbRegistrationOptionsPage, EditHdl ) );
+ m_aDelete.SetClickHdl( LINK( this, DbRegistrationOptionsPage, DeleteHdl ) );
+
+ Size aBoxSize = aPathCtrl.GetOutputSizePixel();
+
+
+ WinBits nBits = WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP;
+ pPathBox = new ::svx::OptHeaderTabListBox( &aPathCtrl, nBits );
+
+ pHeaderBar = new HeaderBar( &aPathCtrl, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
+ pHeaderBar->SetPosSizePixel( Point( 0, 0 ), Size( aBoxSize.Width(), 16 ) );
+ pHeaderBar->SetSelectHdl( LINK( this, DbRegistrationOptionsPage, HeaderSelect_Impl ) );
+ pHeaderBar->SetEndDragHdl( LINK( this, DbRegistrationOptionsPage, HeaderEndDrag_Impl ) );
+ Size aSz;
+ aSz.Width() = TAB_WIDTH1;
+ pHeaderBar->InsertItem( ITEMID_TYPE, aTypeText.GetText(),
+ LogicToPixel( aSz, MapMode( MAP_APPFONT ) ).Width(),
+ HIB_LEFT | HIB_VCENTER | HIB_CLICKABLE | HIB_UPARROW );
+ aSz.Width() = TAB_WIDTH2;
+ pHeaderBar->InsertItem( ITEMID_PATH, aPathText.GetText(),
+ LogicToPixel( aSz, MapMode( MAP_APPFONT ) ).Width(),
+ HIB_LEFT | HIB_VCENTER );
+
+ static long nTabs[] = {3, 0, TAB_WIDTH1, TAB_WIDTH1 + TAB_WIDTH2 };
+ Size aHeadSize = pHeaderBar->GetSizePixel();
+
+ aPathCtrl.SetFocusControl( pPathBox );
+ pPathBox->SetWindowBits( nBits );
+ pPathBox->SetDoubleClickHdl( LINK( this, DbRegistrationOptionsPage, EditHdl ) );
+ pPathBox->SetSelectHdl( LINK( this, DbRegistrationOptionsPage, PathSelect_Impl ) );
+ pPathBox->SetSelectionMode( SINGLE_SELECTION );
+ pPathBox->SetPosSizePixel( Point( 0, aHeadSize.Height() ),
+ Size( aBoxSize.Width(), aBoxSize.Height() - aHeadSize.Height() ) );
+ pPathBox->SetTabs( &nTabs[0], MAP_APPFONT );
+ pPathBox->InitHeaderBar( pHeaderBar );
+ pPathBox->SetHighlightRange();
+
+ pPathBox->SetHelpId( HID_DBPATH_CTL_PATH );
+ pHeaderBar->SetHelpId( HID_DBPATH_HEADERBAR );
+
+ pPathBox->Show();
+ pHeaderBar->Show();
+
+ FreeResource();
+}
+
+// -----------------------------------------------------------------------
+
+DbRegistrationOptionsPage::~DbRegistrationOptionsPage()
+{
+ // #110603# do not grab focus to a destroyed window !!!
+ aPathCtrl.SetFocusControl( NULL );
+
+ pHeaderBar->Hide();
+ for ( USHORT i = 0; i < pPathBox->GetEntryCount(); ++i )
+ delete static_cast<String*>(pPathBox->GetEntry(i)->GetUserData());
+ delete pPathBox;
+ delete pHeaderBar;
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* DbRegistrationOptionsPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new DbRegistrationOptionsPage( pParent, rAttrSet ) );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL DbRegistrationOptionsPage::FillItemSet( SfxItemSet& rCoreSet )
+{
+ // the settings for the single drivers
+ sal_Bool bModified = sal_False;
+ TNameLocationMap aMap;
+ ULONG nCount = pPathBox->GetEntryCount();
+ for ( ULONG i = 0; i < nCount; ++i )
+ {
+ SvLBoxEntry* pEntry = pPathBox->GetEntry(i);
+ String* pPath = static_cast<String*>(pEntry->GetUserData());
+ if ( pPath && pPath->Len() )
+ {
+ OFileNotation aTransformer(*pPath);
+ aMap.insert(TNameLocationMap::value_type(::rtl::OUString(pPathBox->GetEntryText(pEntry,0)),aTransformer.get(OFileNotation::N_URL)));
+ }
+ }
+ if ( m_nOldCount != aMap.size() || m_bModified )
+ {
+ rCoreSet.Put(DatabaseMapItem(SID_SB_DB_REGISTER, aMap), SID_SB_DB_REGISTER);
+ bModified = sal_True;
+ }
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+void DbRegistrationOptionsPage::Reset( const SfxItemSet& rSet )
+{
+ // the settings for the single drivers
+ SFX_ITEMSET_GET( rSet, pSettings, DatabaseMapItem, SID_SB_DB_REGISTER, sal_True );
+
+ if ( pSettings )
+ {
+ // TabListBox f"ullen
+ pPathBox->Clear();
+
+ const TNameLocationMap& rMap = pSettings->getSettings();
+ m_nOldCount = rMap.size();
+ TNameLocationMap::const_iterator aIter = rMap.begin();
+ TNameLocationMap::const_iterator aEnd = rMap.end();
+ for (; aIter != aEnd; ++aIter)
+ {
+ OFileNotation aTransformer(aIter->second);
+ insertNewEntry(aIter->first,aTransformer.get(OFileNotation::N_SYSTEM));
+ }
+
+ String aUserData = GetUserData();
+
+ if ( aUserData.Len() )
+ {
+ // Spaltenbreite restaurieren
+ pHeaderBar->SetItemSize( ITEMID_TYPE, aUserData.GetToken(0).ToInt32() );
+ HeaderEndDrag_Impl( NULL );
+ // Sortierrichtung restaurieren
+ BOOL bUp = (BOOL)(USHORT)aUserData.GetToken(1).ToInt32();
+ HeaderBarItemBits nBits = pHeaderBar->GetItemBits(ITEMID_TYPE);
+
+ if ( bUp )
+ {
+ nBits &= ~HIB_UPARROW;
+ nBits |= HIB_DOWNARROW;
+ }
+ else
+ {
+ nBits &= ~HIB_DOWNARROW;
+ nBits |= HIB_UPARROW;
+ }
+ pHeaderBar->SetItemBits( ITEMID_TYPE, nBits );
+ HeaderSelect_Impl( NULL );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void DbRegistrationOptionsPage::FillUserData()
+{
+ String aUserData = String::CreateFromInt32( pHeaderBar->GetItemSize( ITEMID_TYPE ) );
+ aUserData += ';';
+ HeaderBarItemBits nBits = pHeaderBar->GetItemBits( ITEMID_TYPE );
+ BOOL bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
+ aUserData += bUp ? '1' : '0';
+ SetUserData( aUserData );
+}
+// -----------------------------------------------------------------------
+
+IMPL_LINK( DbRegistrationOptionsPage, DeleteHdl, void *, EMPTYARG )
+{
+ SvLBoxEntry* pEntry = pPathBox->FirstSelected();
+ if ( pEntry )
+ {
+ QueryBox aQuery(this,CUI_RES(QUERY_DELETE_CONFIRM));
+ if ( aQuery.Execute() == RET_YES )
+ pPathBox->GetModel()->Remove(pEntry);
+ }
+ return 0;
+}
+// -----------------------------------------------------------------------
+IMPL_LINK( DbRegistrationOptionsPage, NewHdl, void *, EMPTYARG )
+{
+ String sNewName,sNewLocation;
+ openLinkDialog(sNewName,sNewLocation);
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( DbRegistrationOptionsPage, EditHdl, void *, EMPTYARG )
+{
+ SvLBoxEntry* pEntry = pPathBox->GetCurEntry();
+ if ( pEntry )
+ {
+ String* pOldLocation = static_cast<String*>(pEntry->GetUserData());
+ String sOldName = pPathBox->GetEntryText(pEntry,0);
+ m_pCurEntry = pEntry;
+ openLinkDialog(sOldName,*pOldLocation,pEntry);
+ m_pCurEntry = NULL;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( DbRegistrationOptionsPage, HeaderSelect_Impl, HeaderBar*, pBar )
+{
+ if ( pBar && pBar->GetCurItemId() != ITEMID_TYPE )
+ return 0;
+
+ HeaderBarItemBits nBits = pHeaderBar->GetItemBits(ITEMID_TYPE);
+ BOOL bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
+ SvSortMode eMode = SortAscending;
+
+ if ( bUp )
+ {
+ nBits &= ~HIB_UPARROW;
+ nBits |= HIB_DOWNARROW;
+ eMode = SortDescending;
+ }
+ else
+ {
+ nBits &= ~HIB_DOWNARROW;
+ nBits |= HIB_UPARROW;
+ }
+ pHeaderBar->SetItemBits( ITEMID_TYPE, nBits );
+ SvTreeList* pModel = pPathBox->GetModel();
+ pModel->SetSortMode( eMode );
+ pModel->Resort();
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( DbRegistrationOptionsPage, HeaderEndDrag_Impl, HeaderBar*, pBar )
+{
+ if ( pBar && !pBar->GetCurItemId() )
+ return 0;
+
+ if ( !pHeaderBar->IsItemMode() )
+ {
+ Size aSz;
+ USHORT nTabs = pHeaderBar->GetItemCount();
+ long nTmpSz = 0;
+ long nWidth = pHeaderBar->GetItemSize(ITEMID_TYPE);
+ long nBarWidth = pHeaderBar->GetSizePixel().Width();
+
+ if(nWidth < TAB_WIDTH_MIN)
+ pHeaderBar->SetItemSize( ITEMID_TYPE, TAB_WIDTH_MIN);
+ else if ( ( nBarWidth - nWidth ) < TAB_WIDTH_MIN )
+ pHeaderBar->SetItemSize( ITEMID_TYPE, nBarWidth - TAB_WIDTH_MIN );
+
+ for ( USHORT i = 1; i <= nTabs; ++i )
+ {
+ long _nWidth = pHeaderBar->GetItemSize(i);
+ aSz.Width() = _nWidth + nTmpSz;
+ nTmpSz += _nWidth;
+ pPathBox->SetTab( i, PixelToLogic( aSz, MapMode(MAP_APPFONT) ).Width(), MAP_APPFONT );
+ }
+ }
+ return 1;
+}
+// -----------------------------------------------------------------------
+
+IMPL_LINK( DbRegistrationOptionsPage, PathSelect_Impl, SvTabListBox *, EMPTYARG )
+
+/* [Beschreibung]
+
+*/
+
+{
+ SvLBoxEntry* pEntry = pPathBox->FirstSelected();
+
+ m_aEdit.Enable( pEntry != NULL);
+ m_aDelete.Enable( pEntry != NULL);
+ return 0;
+}
+// -----------------------------------------------------------------------------
+void DbRegistrationOptionsPage::insertNewEntry(const ::rtl::OUString& _sName,const ::rtl::OUString& _sLocation)
+{
+ String aStr( _sName );
+ aStr += '\t';
+ aStr += String(_sLocation);
+ SvLBoxEntry* pEntry = pPathBox->InsertEntry( aStr );
+ String* pLocation = new String( _sLocation );
+ pEntry->SetUserData( pLocation );
+}
+// -----------------------------------------------------------------------------
+String DbRegistrationOptionsPage::getFileLocation(const String& _sLocation)
+{
+ try
+ {
+ rtl::OUString aService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) );
+ Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ Reference < XFilePicker > xFilePicker( xFactory->createInstance( aService ), UNO_QUERY );
+ OSL_ENSURE(xFilePicker.is() ,"Could create file picker service!");
+ Reference < XFilterManager> xFilterManager(xFilePicker,UNO_QUERY);
+ static const String s_sDatabaseType = String::CreateFromAscii("StarOffice XML (Base)");
+ const SfxFilter* pFilter = SfxFilter::GetFilterByName( s_sDatabaseType);
+ if ( pFilter )
+ {
+ xFilterManager->appendFilter( pFilter->GetUIName(),pFilter->GetDefaultExtension());
+ xFilterManager->setCurrentFilter(pFilter->GetUIName());
+ }
+
+ INetURLObject aURL( _sLocation, INET_PROT_FILE );
+ xFilePicker->setMultiSelectionMode(sal_False);
+ xFilePicker->setDisplayDirectory( aURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ short nRet = xFilePicker->execute();
+
+ if ( ExecutableDialogResults::OK == nRet )
+ {
+
+ // old path is an URL?
+ INetURLObject aObj( _sLocation );
+ FASTBOOL bURL = ( aObj.GetProtocol() != INET_PROT_NOT_VALID );
+ Sequence< ::rtl::OUString > aFiles = xFilePicker->getFiles();
+ INetURLObject aNewObj( aFiles[0] );
+ aNewObj.removeFinalSlash();
+
+ // then the new path also an URL else system path
+ String sNewLocation = bURL ? rtl::OUString(aFiles[0]) : aNewObj.getFSysPath( INetURLObject::FSYS_DETECT );
+
+ if (
+#ifdef UNX
+ // Unix is case sensitive
+ ( sNewLocation != _sLocation )
+#else
+ ( sNewLocation.CompareIgnoreCaseToAscii( _sLocation ) != COMPARE_EQUAL )
+#endif
+ )
+ return sNewLocation;
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERRORFILE( "DbRegistrationOptionsPage::EditLocationHdl: exception from folder picker" );
+ }
+
+ return String();
+}
+// -----------------------------------------------------------------------------
+void DbRegistrationOptionsPage::openLinkDialog(const String& _sOldName,const String& _sOldLocation,SvLBoxEntry* _pEntry)
+{
+ ODocumentLinkDialog aDlg(this,_pEntry == NULL);
+
+ aDlg.set(_sOldName,_sOldLocation);
+ aDlg.setNameValidator(LINK( this, DbRegistrationOptionsPage, NameValidator ) );
+
+ if ( aDlg.Execute() == RET_OK )
+ {
+ String sNewName,sNewLocation;
+ aDlg.get(sNewName,sNewLocation);
+ if ( _pEntry == NULL || sNewName != _sOldName || sNewLocation != _sOldLocation )
+ {
+ if ( _pEntry )
+ {
+ delete static_cast<String*>(_pEntry->GetUserData());
+ pPathBox->GetModel()->Remove(_pEntry);
+ }
+ insertNewEntry(sNewName,sNewLocation);
+ m_bModified = sal_True;
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+IMPL_LINK( DbRegistrationOptionsPage, NameValidator, String*, _pName )
+{
+ if ( _pName )
+ {
+ ULONG nCount = pPathBox->GetEntryCount();
+ for ( ULONG i = 0; i < nCount; ++i )
+ {
+ SvLBoxEntry* pEntry = pPathBox->GetEntry(i);
+ if ( (!m_pCurEntry || m_pCurEntry != pEntry) && pPathBox->GetEntryText(pEntry,0) == *_pName )
+ return 0L;
+ }
+ }
+ return 1L;
+}
+//........................................................................
+} // namespace svx
+//........................................................................
+
+
diff --git a/cui/source/options/dbregister.hrc b/cui/source/options/dbregister.hrc
new file mode 100644
index 000000000000..f2324aac186c
--- /dev/null
+++ b/cui/source/options/dbregister.hrc
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dbregister.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SVX_DBREGISTER_HRC
+#define SVX_DBREGISTER_HRC
+// defines ---------------------------------------------------------------
+
+#define FT_TYPE 10
+#define FT_PATH 11
+#define LB_PATH 12
+#define BTN_NEW 13
+#define BTN_EDIT 14
+#define GB_STD 15
+#define IMG_LOCK 16
+#define IMG_LOCK_HC 17
+#define BTN_DELETE 18
+
+#endif // SVX_DBREGISTER_HRC
+
diff --git a/cui/source/options/dbregister.src b/cui/source/options/dbregister.src
new file mode 100644
index 000000000000..aaa8dc5302bc
--- /dev/null
+++ b/cui/source/options/dbregister.src
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dbregister.src,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "dbregister.hrc"
+#include <cuires.hrc>
+#include <cuires.hrc>
+#include <svx/dialogs.hrc>
+
+// RID_SFXPAGE_PATH -----------------------------------------------------
+#define STD_MASKCOLOR Color { Red=0xffff; Green=0x0000; Blue=0xffff; }
+TabPage RID_SFXPAGE_DBREGISTER
+{
+ // HelpId = HID_OPTIONS_DBREGISTER ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "Registered databases" ;
+
+ FixedText FT_TYPE
+ {
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "Registered name" ;
+ };
+ FixedText FT_PATH
+ {
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( 110 , 14 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "Database file" ;
+ };
+ Control LB_PATH
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 236 , 147 ) ;
+ Border = TRUE ;
+ TabStop = TRUE;
+ };
+ PushButton BTN_NEW
+ {
+ Pos = MAP_APPFONT ( 47 , 165 ) ;
+ Size = MAP_APPFONT ( 65 , 14 ) ;
+ Text [ en-US ] = "~New..." ;
+ };
+ PushButton BTN_EDIT
+ {
+ Pos = MAP_APPFONT ( 183 , 165 ) ;
+ Size = MAP_APPFONT ( 65 , 14 ) ;
+ Text [ en-US ] = "~Edit..." ;
+ };
+ PushButton BTN_DELETE
+ {
+ Pos = MAP_APPFONT ( 115 , 165 ) ;
+ Size = MAP_APPFONT ( 65 , 14 ) ;
+ Text [ en-US ] = "~Delete" ;
+ };
+ FixedLine GB_STD
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Registered databases" ;
+ };
+};
+
diff --git a/cui/source/options/dbregisterednamesconfig.cxx b/cui/source/options/dbregisterednamesconfig.cxx
new file mode 100644
index 000000000000..6fd7e34b2729
--- /dev/null
+++ b/cui/source/options/dbregisterednamesconfig.cxx
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dbregisterednamesconfig.cxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include "dbregisterednamesconfig.hxx"
+#include <svl/itemset.hxx>
+#include <tools/diagnose_ex.h>
+#include <unotools/confignode.hxx>
+#include <comphelper/extract.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/uno/XNamingService.hpp>
+#include <svl/eitem.hxx>
+#include <comphelper/processfactory.hxx>
+#include <unotools/pathoptions.hxx>
+#include "dbregistersettings.hxx"
+#include "connpooloptions.hxx"
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ using namespace ::utl;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::container;
+
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& getDbRegisteredNamesNodeName()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("org.openoffice.Office.DataAccess/RegisteredNames");
+ return s_sNodeName;
+ }
+
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& getDbNameNodeName()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("Name");
+ return s_sNodeName;
+ }
+
+ //--------------------------------------------------------------------
+ static const ::rtl::OUString& getDbLocationNodeName()
+ {
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("Location");
+ return s_sNodeName;
+ }
+
+ //====================================================================
+ //= DbRegisteredNamesConfig
+ //====================================================================
+ //--------------------------------------------------------------------
+ void DbRegisteredNamesConfig::GetOptions(SfxItemSet& _rFillItems)
+ {
+ // the config node where all pooling relevant info are stored under
+ OConfigurationTreeRoot aDbRegisteredNamesRoot = OConfigurationTreeRoot::createWithServiceFactory(
+ ::comphelper::getProcessServiceFactory(), getDbRegisteredNamesNodeName(), -1, OConfigurationTreeRoot::CM_READONLY);
+
+ TNameLocationMap aSettings;
+
+ // then look for which of them settings are stored in the configuration
+ Sequence< ::rtl::OUString > aDriverKeys = aDbRegisteredNamesRoot.getNodeNames();
+ const ::rtl::OUString* pDriverKeys = aDriverKeys.getConstArray();
+ const ::rtl::OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength();
+ for (;pDriverKeys != pDriverKeysEnd; ++pDriverKeys)
+ {
+ // the name of the driver in this round
+ OConfigurationNode aThisDriverSettings = aDbRegisteredNamesRoot.openNode(*pDriverKeys);
+ ::rtl::OUString sName, sLocation;
+ aThisDriverSettings.getNodeValue(getDbNameNodeName()) >>= sName;
+ aThisDriverSettings.getNodeValue(getDbLocationNodeName()) >>= sLocation;
+ sLocation = SvtPathOptions().SubstituteVariable(sLocation);
+
+ aSettings.insert(TNameLocationMap::value_type(sName,sLocation));
+ }
+
+ _rFillItems.Put(DatabaseMapItem(SID_SB_DB_REGISTER, aSettings));
+ }
+
+ //--------------------------------------------------------------------
+ void DbRegisteredNamesConfig::SetOptions(const SfxItemSet& _rSourceItems)
+ {
+ // the config node where all pooling relevant info are stored under
+ OConfigurationTreeRoot aDbRegisteredNamesRoot = OConfigurationTreeRoot::createWithServiceFactory(
+ ::comphelper::getProcessServiceFactory(), getDbRegisteredNamesNodeName(), -1, OConfigurationTreeRoot::CM_UPDATABLE);
+
+ if (!aDbRegisteredNamesRoot.isValid())
+ // already asserted by the OConfigurationTreeRoot
+ return;
+
+ sal_Bool bNeedCommit = sal_False;
+
+
+ // the settings for the single drivers
+ SFX_ITEMSET_GET( _rSourceItems, pDriverSettings, DatabaseMapItem, SID_SB_DB_REGISTER, sal_True );
+ if (pDriverSettings)
+ {
+ Reference< XNameAccess > xDatabaseContext = Reference< XNameAccess >(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DatabaseContext"))), UNO_QUERY);
+ Reference< XNamingService> xNamingService(xDatabaseContext,UNO_QUERY);
+ ::rtl::OUString sName, sLocation;
+ OConfigurationNode aThisDriverSettings;
+
+ const TNameLocationMap& rNewSettings = pDriverSettings->getSettings();
+ TNameLocationMap::const_iterator aEnd = rNewSettings.end();
+ for ( TNameLocationMap::const_iterator aLoop = rNewSettings.begin();
+ aLoop != aEnd;
+ ++aLoop
+ )
+ {
+ // need the name as ::rtl::OUString
+ sName = aLoop->first;
+
+ // the sub-node for this driver
+ if (aDbRegisteredNamesRoot.hasByName(sName))
+ {
+ aThisDriverSettings = aDbRegisteredNamesRoot.openNode(sName);
+ // set the values
+ aThisDriverSettings.setNodeValue(getDbNameNodeName(), makeAny(sName));
+ aThisDriverSettings.setNodeValue(getDbLocationNodeName(), makeAny(aLoop->second));
+ bNeedCommit = sal_True;
+ }
+ else
+ {
+ try
+ {
+ xNamingService->registerObject(sName,Reference< ::com::sun::star::uno::XInterface >(xDatabaseContext->getByName(aLoop->second),UNO_QUERY));
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+ if (bNeedCommit)
+ aDbRegisteredNamesRoot.commit();
+
+ // delete unused entry
+ Sequence< ::rtl::OUString > aDriverKeys = xDatabaseContext->getElementNames();
+ const ::rtl::OUString* pDriverKeys = aDriverKeys.getConstArray();
+ const ::rtl::OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength();
+ for (;pDriverKeys != pDriverKeysEnd; ++pDriverKeys)
+ {
+ if ( rNewSettings.find(*pDriverKeys) == rNewSettings.end() )
+ {
+ try
+ {
+ xNamingService->revokeObject(*pDriverKeys);
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+ }
+ }
+
+//........................................................................
+} // namespace svx
+//........................................................................
diff --git a/cui/source/options/dbregisterednamesconfig.hxx b/cui/source/options/dbregisterednamesconfig.hxx
new file mode 100644
index 000000000000..366910c0f193
--- /dev/null
+++ b/cui/source/options/dbregisterednamesconfig.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dbregisterednamesconfig.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_DBREGISTEREDNAMESCONFIG_HXX
+#define SVX_DBREGISTEREDNAMESCONFIG_HXX
+
+class SfxItemSet;
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= DbRegisteredNamesConfig
+ //====================================================================
+ class DbRegisteredNamesConfig
+ {
+
+ public:
+ static void GetOptions(SfxItemSet& _rFillItems);
+ static void SetOptions(const SfxItemSet& _rSourceItems);
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // SVX_DBREGISTEREDNAMESCONFIG_HXX
+
+
diff --git a/cui/source/options/dbregistersettings.cxx b/cui/source/options/dbregistersettings.cxx
new file mode 100644
index 000000000000..c3d3b7e8c244
--- /dev/null
+++ b/cui/source/options/dbregistersettings.cxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dbregistersettings.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "dbregistersettings.hxx"
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= DatabaseMapItem
+ //====================================================================
+ TYPEINIT1( DatabaseMapItem, SfxPoolItem )
+ //--------------------------------------------------------------------
+ DatabaseMapItem::DatabaseMapItem( sal_uInt16 _nId, const TNameLocationMap& _rSettings )
+ :SfxPoolItem(_nId)
+ ,m_aSettings(_rSettings)
+ {
+ }
+
+ //--------------------------------------------------------------------
+ int DatabaseMapItem::operator==( const SfxPoolItem& _rCompare ) const
+ {
+ const DatabaseMapItem* pItem = PTR_CAST(DatabaseMapItem, &_rCompare);
+ if (!pItem)
+ return sal_False;
+
+ if (m_aSettings.size() != pItem->m_aSettings.size())
+ return sal_False;
+
+ return m_aSettings != pItem->m_aSettings;
+ }
+
+ //--------------------------------------------------------------------
+ SfxPoolItem* DatabaseMapItem::Clone( SfxItemPool * ) const
+ {
+ return new DatabaseMapItem(Which(), m_aSettings);
+ }
+
+ //--------------------------------------------------------------------
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+
diff --git a/cui/source/options/dbregistersettings.hxx b/cui/source/options/dbregistersettings.hxx
new file mode 100644
index 000000000000..672d4bf63bcd
--- /dev/null
+++ b/cui/source/options/dbregistersettings.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dbregistersettings.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_DBREGISTERSETTING_HXX
+#define SVX_DBREGISTERSETTING_HXX
+
+#include <comphelper/stl_types.hxx>
+#include <svl/poolitem.hxx>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= DatabaseMapItem
+ //====================================================================
+ DECLARE_STL_USTRINGACCESS_MAP(::rtl::OUString,TNameLocationMap);
+ class DatabaseMapItem : public SfxPoolItem
+ {
+ protected:
+ TNameLocationMap m_aSettings;
+
+ public:
+ TYPEINFO();
+
+ DatabaseMapItem( sal_uInt16 _nId, const TNameLocationMap& _rSettings );
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ const TNameLocationMap& getSettings() const { return m_aSettings; }
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+#endif // SVX_DBREGISTERSETTING_HXX
+
diff --git a/cui/source/options/doclinkdialog.cxx b/cui/source/options/doclinkdialog.cxx
new file mode 100644
index 000000000000..1af621348023
--- /dev/null
+++ b/cui/source/options/doclinkdialog.cxx
@@ -0,0 +1,227 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: doclinkdialog.cxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "doclinkdialog.hxx"
+#include "doclinkdialog.hrc"
+#include <cuires.hrc>
+#include <tools/debug.hxx>
+#include <svl/filenotation.hxx>
+#include <vcl/msgbox.hxx>
+#include <ucbhelper/content.hxx>
+#include <dialmgr.hxx>
+#include <tools/urlobj.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <sfx2/docfilt.hxx>
+//......................................................................
+namespace svx
+{
+//......................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::ucb;
+ using namespace ::svt;
+
+ //==================================================================
+ //= ODocumentLinkDialog
+ //==================================================================
+ //------------------------------------------------------------------
+ ODocumentLinkDialog::ODocumentLinkDialog( Window* _pParent, sal_Bool _bCreateNew )
+ :ModalDialog( _pParent, CUI_RES(DLG_DOCUMENTLINK) )
+ ,m_aURLLabel (this, CUI_RES(FT_URL))
+ ,m_aURL (this, CUI_RES(CMB_URL))
+ ,m_aBrowseFile (this, CUI_RES(PB_BROWSEFILE))
+ ,m_aNameLabel (this, CUI_RES(FT_NAME))
+ ,m_aName (this, CUI_RES(ET_NAME))
+ ,m_aBottomLine (this, CUI_RES(FL_BOTTOM))
+ ,m_aOK (this, CUI_RES(BTN_OK))
+ ,m_aCancel (this, CUI_RES(BTN_CANCEL))
+ ,m_aHelp (this, CUI_RES(BTN_HELP))
+ ,m_bCreatingNew(_bCreateNew)
+ {
+ String sText = String( CUI_RES( m_bCreatingNew ? STR_NEW_LINK : STR_EDIT_LINK ) );
+ SetText(sText);
+
+ FreeResource();
+
+ String sTemp = String::CreateFromAscii("*.odb");
+ m_aURL.SetFilter(sTemp);
+
+ m_aName.SetModifyHdl( LINK(this, ODocumentLinkDialog, OnTextModified) );
+ m_aURL.SetModifyHdl( LINK(this, ODocumentLinkDialog, OnTextModified) );
+ m_aBrowseFile.SetClickHdl( LINK(this, ODocumentLinkDialog, OnBrowseFile) );
+ m_aOK.SetClickHdl( LINK(this, ODocumentLinkDialog, OnOk) );
+
+ m_aURL.SetDropDownLineCount(10);
+
+ validate();
+
+ // m_aURL.SetHelpId( HID_DOCLINKEDIT_URL );
+ m_aURL.SetDropDownLineCount( 5 );
+ }
+
+ //------------------------------------------------------------------
+ void ODocumentLinkDialog::set( const String& _rName, const String& _rURL )
+ {
+ m_aName.SetText(_rName);
+ m_aURL.SetText(_rURL);
+ validate();
+ }
+
+ //------------------------------------------------------------------
+ void ODocumentLinkDialog::get( String& _rName, String& _rURL ) const
+ {
+ _rName = m_aName.GetText();
+ _rURL = m_aURL.GetText();
+ }
+
+ //------------------------------------------------------------------
+ void ODocumentLinkDialog::validate( )
+ {
+
+ m_aOK.Enable( (0 != m_aName.GetText().Len()) && ( 0 != m_aURL.GetText().Len() ) );
+ }
+
+ //------------------------------------------------------------------
+ IMPL_LINK( ODocumentLinkDialog, OnOk, void*, EMPTYARG )
+ {
+ // get the current URL
+ ::rtl::OUString sURL = m_aURL.GetText();
+ OFileNotation aTransformer(sURL);
+ sURL = aTransformer.get(OFileNotation::N_URL);
+
+ // check for the existence of the selected file
+ sal_Bool bFileExists = sal_False;
+ try
+ {
+ ::ucbhelper::Content aFile(sURL, Reference< XCommandEnvironment >());
+ if (aFile.isDocument())
+ bFileExists = sal_True;
+ }
+ catch(Exception&)
+ {
+ }
+
+ if (!bFileExists)
+ {
+ String sMsg = String(CUI_RES(STR_LINKEDDOC_DOESNOTEXIST));
+ sMsg.SearchAndReplaceAscii("$file$", m_aURL.GetText());
+ ErrorBox aError(this, WB_OK , sMsg);
+ aError.Execute();
+ return 0L;
+ } // if (!bFileExists)
+ INetURLObject aURL( sURL );
+ if ( aURL.GetProtocol() != INET_PROT_FILE )
+ {
+ String sMsg = String(CUI_RES(STR_LINKEDDOC_NO_SYSTEM_FILE));
+ sMsg.SearchAndReplaceAscii("$file$", m_aURL.GetText());
+ ErrorBox aError(this, WB_OK , sMsg);
+ aError.Execute();
+ return 0L;
+ }
+
+ String sCurrentText = m_aName.GetText();
+ if ( m_aNameValidator.IsSet() )
+ {
+ if ( !m_aNameValidator.Call( &sCurrentText ) )
+ {
+ String sMsg = String(CUI_RES(STR_NAME_CONFLICT));
+ sMsg.SearchAndReplaceAscii("$file$", sCurrentText);
+ InfoBox aError(this, sMsg);
+ aError.Execute();
+
+ m_aName.SetSelection(Selection(0,sCurrentText.Len()));
+ m_aName.GrabFocus();
+ return 0L;
+ }
+ }
+
+ EndDialog(RET_OK);
+ return 0L;
+ }
+
+ //------------------------------------------------------------------
+ IMPL_LINK( ODocumentLinkDialog, OnBrowseFile, void*, EMPTYARG )
+ {
+ ::sfx2::FileDialogHelper aFileDlg(WB_3DLOOK | WB_STDMODAL | WB_OPEN);
+ static const String s_sDatabaseType = String::CreateFromAscii("StarOffice XML (Base)");
+ const SfxFilter* pFilter = SfxFilter::GetFilterByName( s_sDatabaseType);
+ if ( pFilter )
+ {
+ aFileDlg.AddFilter(pFilter->GetUIName(),pFilter->GetDefaultExtension());
+ aFileDlg.SetCurrentFilter(pFilter->GetUIName());
+ }
+
+ String sPath = m_aURL.GetText();
+ if (sPath.Len())
+ {
+ OFileNotation aTransformer( sPath, OFileNotation::N_SYSTEM );
+ aFileDlg.SetDisplayDirectory( aTransformer.get( OFileNotation::N_URL ) );
+ }
+
+ if (0 != aFileDlg.Execute())
+ return 0L;
+
+ if (0 == m_aName.GetText().Len())
+ { // default the name to the base of the chosen URL
+ INetURLObject aParser;
+
+ aParser.SetSmartProtocol(INET_PROT_FILE);
+ aParser.SetSmartURL(aFileDlg.GetPath());
+
+ m_aName.SetText(aParser.getBase(INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET));
+
+ m_aName.SetSelection(Selection(0,m_aName.GetText().Len()));
+ m_aName.GrabFocus();
+ }
+ else
+ m_aURL.GrabFocus();
+
+ // get the path in system notation
+ OFileNotation aTransformer(aFileDlg.GetPath(), OFileNotation::N_URL);
+ m_aURL.SetText(aTransformer.get(OFileNotation::N_SYSTEM));
+
+ validate();
+ return 0L;
+ }
+
+ //------------------------------------------------------------------
+ IMPL_LINK( ODocumentLinkDialog, OnTextModified, Control*, EMPTYARG )
+ {
+ validate( );
+ return 0L;
+ }
+
+//......................................................................
+} // namespace svx
+//......................................................................
+
diff --git a/cui/source/options/doclinkdialog.hrc b/cui/source/options/doclinkdialog.hrc
new file mode 100644
index 000000000000..022c43b6d620
--- /dev/null
+++ b/cui/source/options/doclinkdialog.hrc
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: doclinkdialog.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_DOCLINKDIALOG_HRC_
+#define _SVX_DOCLINKDIALOG_HRC_
+
+#define FT_NAME 1
+#define FT_URL 2
+
+#define ET_NAME 1
+
+#define CMB_URL 1
+
+#define PB_BROWSEFILE 1
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+
+#define FL_BOTTOM 1
+
+#define STR_EDIT_LINK 1
+#define STR_NEW_LINK 2
+
+#endif // _SVX_DOCLINKDIALOG_HRC_
+
diff --git a/cui/source/options/doclinkdialog.hxx b/cui/source/options/doclinkdialog.hxx
new file mode 100644
index 000000000000..81ec0c34d0c5
--- /dev/null
+++ b/cui/source/options/doclinkdialog.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: doclinkdialog.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_DOCLINKDIALOG_HXX_
+#define _SVX_DOCLINKDIALOG_HXX_
+
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/edit.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <svtools/inettbc.hxx>
+#include <svtools/urlcontrol.hxx>
+
+//......................................................................
+namespace svx
+{
+//......................................................................
+
+ //==================================================================
+ //= ODocumentLinkDialog
+ //==================================================================
+ /** dialog for editing document links associated with data sources
+ */
+ class ODocumentLinkDialog : public ModalDialog
+ {
+ protected:
+ FixedText m_aURLLabel;
+ ::svt::OFileURLControl m_aURL;
+ PushButton m_aBrowseFile;
+ FixedText m_aNameLabel;
+ Edit m_aName;
+
+ FixedLine m_aBottomLine;
+ OKButton m_aOK;
+ CancelButton m_aCancel;
+ HelpButton m_aHelp;
+
+ sal_Bool m_bCreatingNew;
+
+ Link m_aNameValidator;
+
+ public:
+ ODocumentLinkDialog( Window* _pParent, sal_Bool _bCreateNew );
+
+ // name validation has to be done by an external instance
+ // the validator link gets a pointer to a String, and should return 0 if the string is not
+ // acceptable
+ void setNameValidator( const Link& _rValidator ) { m_aNameValidator = _rValidator; }
+ Link getNameValidator( ) const { return m_aNameValidator; }
+
+ void set( const String& _rName, const String& _rURL );
+ void get( String& _rName, String& _rURL ) const;
+
+ protected:
+ DECL_LINK( OnTextModified, Control* );
+ DECL_LINK( OnBrowseFile, void* );
+ DECL_LINK( OnOk, void* );
+
+ void validate( );
+ };
+
+//......................................................................
+} // namespace svx
+//......................................................................
+
+#endif // _SVX_DOCLINKDIALOG_HXX_
+
diff --git a/cui/source/options/doclinkdialog.src b/cui/source/options/doclinkdialog.src
new file mode 100644
index 000000000000..9fe56360b82a
--- /dev/null
+++ b/cui/source/options/doclinkdialog.src
@@ -0,0 +1,154 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: doclinkdialog.src,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <cuires.hrc>
+#ifndef _SVX_DOCLINKDIALOG_HRC_
+#include "doclinkdialog.hrc"
+#endif
+
+#define DIALOG_SIZE_X 200
+#define DIALOG_SIZE_Y 94
+#define BUTTON_SIZE_X 50
+#define BUTTON_SIZE_Y 14
+
+#define LABEL_WIDTH 50
+
+#define HEIGHT_LABEL 8
+#define HEIGHT_EDIT 12
+
+#define LINE_1_Y 6
+#define LINE_2_Y LINE_1_Y + HEIGHT_EDIT + 4
+#define OFFSET_Y 6
+
+ModalDialog DLG_DOCUMENTLINK
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( DIALOG_SIZE_X , DIALOG_SIZE_Y ) ;
+
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ FixedText FT_URL
+ {
+
+ Pos = MAP_APPFONT ( 6, LINE_1_Y ) ;
+ Size = MAP_APPFONT ( DIALOG_SIZE_X - 6, HEIGHT_LABEL ) ;
+ Group = TRUE;
+
+ Text [ en-US ] = "~Database file";
+ };
+ ComboBox CMB_URL
+ {
+ Pos = MAP_APPFONT ( 6 , LINE_1_Y + OFFSET_Y + HEIGHT_LABEL - 3) ;
+ Size = MAP_APPFONT ( DIALOG_SIZE_X - 3*LINE_1_Y - BUTTON_SIZE_X , HEIGHT_EDIT ) ;
+
+ SVLook = TRUE ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ AutoHScroll = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_BROWSEFILE
+ {
+ Pos = MAP_APPFONT ( DIALOG_SIZE_X - BUTTON_SIZE_X - 6 , LINE_1_Y + OFFSET_Y + HEIGHT_LABEL - 4) ;
+ Size = MAP_APPFONT ( BUTTON_SIZE_X, BUTTON_SIZE_Y );
+ Text [ en-US ] = "~Browse...";
+ };
+
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( 6, LINE_1_Y + 2*OFFSET_Y + HEIGHT_LABEL + BUTTON_SIZE_Y - 3) ;
+ Size = MAP_APPFONT ( DIALOG_SIZE_X - 6, HEIGHT_LABEL ) ;
+ Group = TRUE;
+
+ Text [ en-US ] = "Registered ~name";
+ };
+ Edit ET_NAME
+ {
+ Pos = MAP_APPFONT ( 6, LINE_1_Y + 3*OFFSET_Y + 2*HEIGHT_LABEL + BUTTON_SIZE_Y - 6) ;
+ Size = MAP_APPFONT ( DIALOG_SIZE_X - 3*LINE_1_Y - BUTTON_SIZE_X , HEIGHT_EDIT ) ;
+ TabStop = TRUE ;
+ Border = TRUE ;
+ };
+
+ FixedLine FL_BOTTOM
+ {
+ Pos = MAP_APPFONT ( 4, LINE_1_Y + 4*OFFSET_Y + 2*HEIGHT_LABEL + BUTTON_SIZE_Y + HEIGHT_EDIT - 6);
+ Size = MAP_APPFONT ( DIALOG_SIZE_X - 8, 8 );
+ };
+
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( DIALOG_SIZE_X - 3 * ( BUTTON_SIZE_X + 3 ) - 6, DIALOG_SIZE_Y - 6 - BUTTON_SIZE_Y );
+ Size = MAP_APPFONT ( BUTTON_SIZE_X, BUTTON_SIZE_Y );
+ DefButton = TRUE;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( DIALOG_SIZE_X - 2 * ( BUTTON_SIZE_X + 3 ) - 6, DIALOG_SIZE_Y - 6 - BUTTON_SIZE_Y );
+ Size = MAP_APPFONT ( BUTTON_SIZE_X, BUTTON_SIZE_Y );
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( DIALOG_SIZE_X - 1 * ( BUTTON_SIZE_X + 3 ) - 3, DIALOG_SIZE_Y - 6 - BUTTON_SIZE_Y );
+ Size = MAP_APPFONT ( BUTTON_SIZE_X, BUTTON_SIZE_Y );
+ };
+
+ String STR_EDIT_LINK
+ {
+ Text [ en-US ] = "Edit Database Link";
+ };
+ String STR_NEW_LINK
+ {
+ Text [ en-US ] = "Create Database Link";
+ };
+};
+
+String STR_LINKEDDOC_DOESNOTEXIST
+{
+ Text [ en-US ] = "The file\n$file$\ndoes not exist.";
+};
+
+String STR_LINKEDDOC_NO_SYSTEM_FILE
+{
+ Text [ en-US ] = "The file\n$file$\ndoes not exist in the local file system.";
+};
+
+String STR_NAME_CONFLICT
+{
+ Text [ en-US ] = "The name '$file$' is already used for another database.\nPlease choose a different name.";
+};
+
+QueryBox QUERY_DELETE_CONFIRM
+{
+ Buttons = WB_YES_NO ;
+ Message [ en-US ] = "Do you want to delete the entry?" ;
+};
diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx
new file mode 100644
index 000000000000..614993aeb91f
--- /dev/null
+++ b/cui/source/options/fontsubs.cxx
@@ -0,0 +1,614 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: fontsubs.cxx,v $
+ * $Revision: 1.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include <tools/shl.hxx>
+#include <svtools/ctrltool.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <svtools/fontsubstconfig.hxx>
+#include <unotools/sourceviewconfig.hxx>
+#include "fontsubs.hrc"
+#include "fontsubs.hxx"
+#include <dialmgr.hxx>
+#include "helpid.hrc"
+#include <cuires.hrc>
+
+/*********************************************************************/
+/* */
+/* TabPage Fontersetzung */
+/* */
+/*********************************************************************/
+
+#define CBCOL_FIRST 0
+#define CBCOL_SECOND 1
+#define CBCOL_BOTH 2
+
+SvxFontSubstTabPage::SvxFontSubstTabPage( Window* pParent,
+ const SfxItemSet& rSet ) :
+ SfxTabPage(pParent, CUI_RES(RID_SVX_FONT_SUBSTITUTION), rSet),
+ aUseTableCB (this, CUI_RES(CB_USETABLE)),
+ aFont1FT (this, CUI_RES(FT_FONT1)),
+ aFont1CB (this, CUI_RES(CB_FONT1)),
+ aFont2FT (this, CUI_RES(FT_FONT2)),
+ aFont2CB (this, CUI_RES(CB_FONT2)),
+ aNewDelTBX (this, CUI_RES(TBX_SUBSTNEWDEL)),
+ aCheckLB (this, CUI_RES(CLB_SUBSTITUTES)),
+
+ aSourceViewFontsFL (this, CUI_RES(FL_SOURCEVIEW )),
+ aFontNameFT (this, CUI_RES(FT_FONTNAME )),
+ aFontNameLB (this, CUI_RES(LB_FONTNAME )),
+ aNonPropFontsOnlyCB(this, CUI_RES(CB_NONPROP )),
+ aFontHeightFT (this, CUI_RES(FT_FONTHEIGHT )),
+ aFontHeightLB (this, CUI_RES(LB_FONTHEIGHT )),
+
+ aImageList (CUI_RES(IL_ICON)),
+
+ sAutomatic (CUI_RES( STR_AUTOMATIC )),
+ pConfig(new SvtFontSubstConfig),
+ pSourceViewConfig(new utl::SourceViewConfig),
+
+ sHeader1 (CUI_RES( STR_HEADER1 )),
+ sHeader2 (CUI_RES( STR_HEADER2 )),
+ sHeader3 (CUI_RES( STR_HEADER3 )),
+ sHeader4 (CUI_RES( STR_HEADER4 )),
+
+ sFontGroup ("FontSubstitution"),
+ pCheckButtonData(0)
+{
+ FreeResource();
+
+ aTextColor = aCheckLB.GetTextColor();
+
+ for(USHORT k = 0; k < aNewDelTBX.GetItemCount(); k++)
+ aNewDelTBX.SetItemImage(aNewDelTBX.GetItemId(k),
+ aImageList.GetImage(aNewDelTBX.GetItemId(k)));
+
+ aNewDelTBX.SetSizePixel( aNewDelTBX.CalcWindowSizePixel() );
+
+ long nDelta = ( aFont1CB.GetSizePixel().Height() -
+ aNewDelTBX.GetSizePixel().Height() ) / 2;
+ Point aNewPnt = aNewDelTBX.GetPosPixel();
+ aNewPnt.Y() += nDelta;
+ aNewDelTBX.SetPosPixel( aNewPnt );
+
+ aCheckLB.SetHelpId(HID_OFA_FONT_SUBST_CLB);
+ aCheckLB.SetWindowBits(aCheckLB.GetStyle()|WB_HSCROLL|WB_VSCROLL);
+ aCheckLB.SetSelectionMode(MULTIPLE_SELECTION);
+ aCheckLB.SortByCol(2);
+
+ Link aLink(LINK(this, SvxFontSubstTabPage, SelectHdl));
+
+ aCheckLB.SetSelectHdl(aLink);
+ aUseTableCB.SetClickHdl(aLink);
+ aFont1CB.SetSelectHdl(aLink);
+ aFont1CB.SetModifyHdl(aLink);
+ aFont2CB.SetSelectHdl(aLink);
+ aFont2CB.SetModifyHdl(aLink);
+ aNewDelTBX.SetClickHdl(aLink);
+
+ aNonPropFontsOnlyCB.SetClickHdl(LINK(this, SvxFontSubstTabPage, NonPropFontsHdl));
+
+ static long aStaticTabs[] = { 4, 0, 0, 0, 0 };
+ long nW1 = GetTextWidth( sHeader1 );
+ long nW2 = GetTextWidth( sHeader2 );
+ long nMax = Max( nW1, nW2 ) + 6; // width of the longest header + a little offset
+ long nMin = aFontNameFT.LogicToPixel( Size( 30, 0 ), MAP_APPFONT ).Width();
+ nMax = Max( nMax, nMin );
+ const long nDoubleMax = 2*nMax;
+ const long nRest = aCheckLB.GetSizePixel().Width() - nDoubleMax;
+ aStaticTabs[2] = nMax;
+ aStaticTabs[3] = nDoubleMax;
+ aStaticTabs[4] = nDoubleMax + nRest/2;
+ aCheckLB.SvxSimpleTable::SetTabs( aStaticTabs, MAP_PIXEL );
+
+ String sHeader(sHeader1);
+ String sTab(String::CreateFromAscii("\t"));
+ String sTabSpace(String::CreateFromAscii("\t "));
+ sHeader += sTab;
+ sHeader += sHeader2;
+ sHeader += sTabSpace;
+ sHeader += sHeader3;
+ sHeader += sTabSpace;
+ sHeader += sHeader4;
+// sHeader += sTabSpace;
+ aCheckLB.InsertHeaderEntry(sHeader);
+
+ HeaderBar* pBar = aCheckLB.GetTheHeaderBar();
+
+ HeaderBarItemBits nBits = pBar->GetItemBits(1) | HIB_FIXEDPOS | HIB_FIXED;
+ nBits &= ~HIB_CLICKABLE;
+ pBar->SetItemBits(1, nBits);
+ pBar->SetItemBits(2, nBits);
+
+ USHORT nHeight;
+ for(nHeight = 6; nHeight <= 16; nHeight++)
+ aFontHeightLB.InsertEntry(String::CreateFromInt32(nHeight));
+ for(nHeight = 18; nHeight <= 28; nHeight+= 2)
+ aFontHeightLB.InsertEntry(String::CreateFromInt32(nHeight));
+ for(nHeight = 32; nHeight <= 48; nHeight+= 4)
+ aFontHeightLB.InsertEntry(String::CreateFromInt32(nHeight));
+ for(nHeight = 54; nHeight <= 72; nHeight+= 6)
+ aFontHeightLB.InsertEntry(String::CreateFromInt32(nHeight));
+ for(nHeight = 80; nHeight <= 96; nHeight+= 8)
+ aFontHeightLB.InsertEntry(String::CreateFromInt32(nHeight));
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+SvLBoxEntry* SvxFontSubstTabPage::CreateEntry(String& rFont1, String& rFont2)
+{
+ SvLBoxEntry* pEntry = new SvLBoxEntry;
+
+ if( !pCheckButtonData )
+ pCheckButtonData = new SvLBoxButtonData( &aCheckLB );
+
+ pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff!
+
+ pEntry->AddItem( new SvLBoxButton( pEntry,
+ SvLBoxButtonKind_enabledCheckbox, 0,
+ pCheckButtonData ) );
+ pEntry->AddItem( new SvLBoxButton( pEntry,
+ SvLBoxButtonKind_enabledCheckbox, 0,
+ pCheckButtonData ) );
+
+ pEntry->AddItem( new SvLBoxString( pEntry, 0, rFont1 ) );
+ pEntry->AddItem( new SvLBoxString( pEntry, 0, rFont2 ) );
+
+ return pEntry;
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+
+ SvxFontSubstTabPage::~SvxFontSubstTabPage()
+{
+ delete pCheckButtonData;
+ delete pConfig;
+ delete pSourceViewConfig;
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+SfxTabPage* SvxFontSubstTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new SvxFontSubstTabPage(pParent, rAttrSet);
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+BOOL SvxFontSubstTabPage::FillItemSet( SfxItemSet& )
+{
+ pConfig->ClearSubstitutions();// remove all entries
+
+ pConfig->Enable(aUseTableCB.IsChecked());
+
+ SvLBoxEntry* pEntry = aCheckLB.First();
+
+ while (pEntry)
+ {
+ SubstitutionStruct aAdd;
+ aAdd.sFont = aCheckLB.GetEntryText(pEntry, 0);
+ aAdd.sReplaceBy = aCheckLB.GetEntryText(pEntry, 1);
+ aAdd.bReplaceAlways = aCheckLB.IsChecked(pEntry, 0);
+ aAdd.bReplaceOnScreenOnly = aCheckLB.IsChecked(pEntry, 1);
+ pConfig->AddSubstitution(aAdd);
+ pEntry = aCheckLB.Next(pEntry);
+ }
+ if(pConfig->IsModified())
+ pConfig->Commit();
+ pConfig->Apply();
+ if(aFontHeightLB.GetSavedValue() != aFontHeightLB.GetSelectEntryPos())
+ pSourceViewConfig->SetFontHeight((sal_Int16)aFontHeightLB.GetSelectEntry().ToInt32());
+ if(aNonPropFontsOnlyCB.GetSavedValue() != aNonPropFontsOnlyCB.IsChecked())
+ pSourceViewConfig->SetShowProportionalFontsOnly(aNonPropFontsOnlyCB.IsChecked());
+ //font name changes cannot be detected by saved values
+ String sFontName;
+ if(aFontNameLB.GetSelectEntryPos())
+ sFontName = aFontNameLB.GetSelectEntry();
+ pSourceViewConfig->SetFontName(sFontName);
+
+ return FALSE;
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+
+void SvxFontSubstTabPage::Reset( const SfxItemSet& )
+{
+ aCheckLB.SetUpdateMode(FALSE);
+ aCheckLB.Clear();
+
+ FontList aFntLst( Application::GetDefaultDevice() );
+ aFont1CB.Fill( &aFntLst );
+ aFont2CB.Fill( &aFntLst );
+
+ sal_Int32 nCount = pConfig->SubstitutionCount();
+ if (nCount)
+ aUseTableCB.Check(pConfig->IsEnabled());
+
+ for (sal_Int32 i = 0; i < nCount; i++)
+ {
+ const SubstitutionStruct* pSubs = pConfig->GetSubstitution(i);
+ String aTmpStr1(pSubs->sFont);
+ String aTmpStr2(pSubs->sReplaceBy);
+ SvLBoxEntry* pEntry = CreateEntry(aTmpStr1, aTmpStr2);
+ aCheckLB.Insert(pEntry);
+ aCheckLB.CheckEntry(pEntry, 0, pSubs->bReplaceAlways);
+ aCheckLB.CheckEntry(pEntry, 1, pSubs->bReplaceOnScreenOnly);
+ }
+
+ CheckEnable();
+ aCheckLB.SetUpdateMode(TRUE);
+
+ //fill font name box first
+ aNonPropFontsOnlyCB.Check(pSourceViewConfig->IsShowProportionalFontsOnly());
+ NonPropFontsHdl(&aNonPropFontsOnlyCB);
+ String sFontName(pSourceViewConfig->GetFontName());
+ if(sFontName.Len())
+ aFontNameLB.SelectEntry(sFontName);
+ else
+ aFontNameLB.SelectEntryPos(0);
+ short nFontHeight = pSourceViewConfig->GetFontHeight();
+ aFontHeightLB.SelectEntry(String::CreateFromInt32(nFontHeight));
+ aNonPropFontsOnlyCB.SaveValue();
+ aFontHeightLB.SaveValue();
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+IMPL_LINK(SvxFontSubstTabPage, SelectHdl, Window*, pWin)
+{
+ if (pWin == &aNewDelTBX)
+ {
+ SvLBoxEntry* pEntry;
+ // nCol ist behaemmerterweise die nCol'te Textspalte, werden nicht gezaehlt!
+ // Daher als Spalte "0".
+ ULONG nPos = aCheckLB.GetEntryPos(aFont1CB.GetText(), 0);
+
+ switch (aNewDelTBX.GetCurItemId())
+ {
+ case BT_SUBSTAPPLY:
+ {
+ if (nPos != 0xffffffff)
+ {
+ // Eintrag aendern
+ aCheckLB.SetEntryText(aFont2CB.GetText(), nPos, 1);
+ pEntry = aCheckLB.GetEntry(nPos);
+ }
+ else
+ {
+ // Neuer Eintrag
+ String sFont1 = aFont1CB.GetText();
+ String sFont2 = aFont2CB.GetText();
+
+ pEntry = CreateEntry(sFont1, sFont2);
+ aCheckLB.Insert(pEntry);
+ }
+ aCheckLB.SelectAll(FALSE);
+ aCheckLB.Select(pEntry);
+ }
+ break;
+
+ case BT_SUBSTDELETE:
+ {
+ if (nPos != 0xffffffff)
+ {
+ pEntry = aCheckLB.FirstSelected();
+ while (pEntry)
+ {
+ SvLBoxEntry* pDelEntry = pEntry;
+ pEntry = aCheckLB.NextSelected(pEntry);
+ aCheckLB.RemoveEntry(pDelEntry);
+ }
+ }
+ }
+ break;
+ }
+ }
+
+ if (pWin == &aCheckLB)
+ {
+ SvLBoxEntry* pEntry = aCheckLB.FirstSelected();
+
+ if (aCheckLB.NextSelected(pEntry) == 0)
+ {
+ aFont1CB.SetText(aCheckLB.GetEntryText(pEntry, 0));
+ aFont2CB.SetText(aCheckLB.GetEntryText(pEntry, 1));
+ }
+ }
+
+ if (pWin == &aFont1CB)
+ {
+ ULONG nPos = aCheckLB.GetEntryPos(aFont1CB.GetText(), 0);
+
+ if (nPos != 0xffffffff)
+ {
+ SvLBoxEntry* pEntry = aCheckLB.GetEntry(nPos);
+
+ if (pEntry != aCheckLB.FirstSelected())
+ {
+ aCheckLB.SelectAll(FALSE);
+ aCheckLB.Select(pEntry);
+ }
+ }
+ }
+
+ CheckEnable();
+
+ return 0;
+}
+/* -----------------------------29.08.2002 11:47------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxFontSubstTabPage, NonPropFontsHdl, CheckBox*, pBox)
+{
+ String sFontName = aFontNameLB.GetSelectEntry();
+ BOOL bNonPropOnly = pBox->IsChecked();
+ aFontNameLB.Clear();
+ FontList aFntLst( Application::GetDefaultDevice() );
+ aFontNameLB.InsertEntry(sAutomatic);
+ USHORT nFontCount = aFntLst.GetFontNameCount();
+ for(USHORT nFont = 0; nFont < nFontCount; nFont++)
+ {
+ const FontInfo& rInfo = aFntLst.GetFontName( nFont );
+ if(!bNonPropOnly || rInfo.GetPitch() == PITCH_FIXED)
+ aFontNameLB.InsertEntry(rInfo.GetName());
+ }
+ aFontNameLB.SelectEntry(sFontName);
+ return 0;
+}
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+void SvxFontSubstTabPage::CheckEnable()
+{
+ BOOL bEnableAll = aUseTableCB.IsChecked();
+
+ if (bEnableAll)
+ {
+ BOOL bApply, bDelete;
+
+ SvLBoxEntry* pEntry = aCheckLB.FirstSelected();
+
+ String sEntry = aFont1CB.GetText();
+ sEntry += '\t';
+ sEntry += aFont2CB.GetText();
+
+/* if (!aFont1CB.GetText().Len() || !aFont2CB.GetText().Len() ||
+ aFont1CB.GetText() == aFont2CB.GetText() ||
+ aCheckLB.GetEntryPos(sEntry) != 0xffffffff ||
+ (pEntry != 0 && aCheckLB.NextSelected(pEntry) != 0))
+ bApply = FALSE;
+ else
+ bApply = TRUE;*/
+
+ // Wegen OS/2-Optimierungsfehler (Bug #56267) etwas umstaendlicher:
+ if (!aFont1CB.GetText().Len() || !aFont2CB.GetText().Len())
+ bApply = FALSE;
+ else if(aFont1CB.GetText() == aFont2CB.GetText())
+ bApply = FALSE;
+ else if(aCheckLB.GetEntryPos(sEntry) != 0xffffffff)
+ bApply = FALSE;
+ else if(pEntry != 0 && aCheckLB.NextSelected(pEntry) != 0)
+ bApply = FALSE;
+ else
+ bApply = TRUE;
+
+ bDelete = pEntry != 0;
+
+ aNewDelTBX.EnableItem(BT_SUBSTAPPLY, bApply);
+ aNewDelTBX.EnableItem(BT_SUBSTDELETE, bDelete);
+ }
+
+ if (bEnableAll)
+ {
+ if (!aCheckLB.IsEnabled())
+ {
+ aCheckLB.EnableTable();
+ aCheckLB.SetTextColor(aTextColor);
+ aCheckLB.Invalidate();
+ SelectHdl(&aFont1CB);
+ }
+ }
+ else
+ {
+ if (aCheckLB.IsEnabled())
+ {
+ aCheckLB.DisableTable();
+ aCheckLB.SetTextColor(Color(COL_GRAY));
+ aCheckLB.Invalidate();
+ aCheckLB.SelectAll(FALSE);
+ }
+ }
+ aNewDelTBX.Enable(bEnableAll);
+ aFont1FT.Enable(bEnableAll);
+ aFont1CB.Enable(bEnableAll);
+ aFont2FT.Enable(bEnableAll);
+ aFont2CB.Enable(bEnableAll);
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+void SvxFontSubstCheckListBox::SetTabs()
+{
+ SvxSimpleTable::SetTabs();
+ USHORT nAdjust = SV_LBOXTAB_ADJUST_RIGHT|SV_LBOXTAB_ADJUST_LEFT|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_ADJUST_NUMERIC|SV_LBOXTAB_FORCE;
+
+ SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(1);
+ pTab->nFlags &= ~nAdjust;
+ pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE;
+
+ pTab = (SvLBoxTab*)aTabs.GetObject(2);
+ pTab->nFlags &= ~nAdjust;
+ pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE;
+}
+/* -----------------------------22.05.2002 11:06------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxFontSubstCheckListBox::KeyInput( const KeyEvent& rKEvt )
+{
+ if(!rKEvt.GetKeyCode().GetModifier() &&
+ KEY_SPACE == rKEvt.GetKeyCode().GetCode())
+ {
+ ULONG nSelPos = GetModel()->GetAbsPos(GetCurEntry());
+ USHORT nCol = GetCurrentTabPos() - 1;
+ if ( nCol < 2 )
+ {
+ CheckEntryPos( nSelPos, nCol, !IsChecked( nSelPos, nCol ) );
+ CallImplEventListeners( VCLEVENT_CHECKBOX_TOGGLE, (void*)GetEntry( nSelPos ) );
+ }
+ else
+ {
+ USHORT nCheck = IsChecked(nSelPos, 1) ? 1 : 0;
+ if(IsChecked(nSelPos, 0))
+ nCheck += 2;
+ nCheck--;
+ nCheck &= 3;
+ CheckEntryPos(nSelPos, 1, 0 != (nCheck & 1));
+ CheckEntryPos(nSelPos, 0, 0 != (nCheck & 2));
+ }
+ }
+ else
+ SvxSimpleTable::KeyInput(rKEvt);
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+void SvxFontSubstCheckListBox::CheckEntryPos(ULONG nPos, USHORT nCol, BOOL bChecked)
+{
+ if ( nPos < GetEntryCount() )
+ SetCheckButtonState(
+ GetEntry(nPos),
+ nCol,
+ bChecked ? SvButtonState( SV_BUTTON_CHECKED ) :
+ SvButtonState( SV_BUTTON_UNCHECKED ) );
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+void SvxFontSubstCheckListBox::CheckEntry(SvLBoxEntry* pEntry, USHORT nCol, BOOL bChecked)
+{
+ if ( pEntry )
+ SetCheckButtonState(
+ pEntry,
+ nCol,
+ bChecked ? SvButtonState( SV_BUTTON_CHECKED ) :
+ SvButtonState( SV_BUTTON_UNCHECKED ) );
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+BOOL SvxFontSubstCheckListBox::IsChecked(ULONG nPos, USHORT nCol)
+{
+ return GetCheckButtonState( GetEntry(nPos), nCol ) == SV_BUTTON_CHECKED;
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+BOOL SvxFontSubstCheckListBox::IsChecked(SvLBoxEntry* pEntry, USHORT nCol)
+{
+ return GetCheckButtonState( pEntry, nCol ) == SV_BUTTON_CHECKED;
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+void SvxFontSubstCheckListBox::SetCheckButtonState( SvLBoxEntry* pEntry, USHORT nCol, SvButtonState eState)
+{
+ SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1));
+
+ DBG_ASSERT(pItem,"SetCheckButton:Item not found");
+ if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON)
+ {
+ switch( eState )
+ {
+ case SV_BUTTON_CHECKED:
+ pItem->SetStateChecked();
+ break;
+
+ case SV_BUTTON_UNCHECKED:
+ pItem->SetStateUnchecked();
+ break;
+
+ case SV_BUTTON_TRISTATE:
+ pItem->SetStateTristate();
+ break;
+ }
+ InvalidateEntry( pEntry );
+ }
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+SvButtonState SvxFontSubstCheckListBox::GetCheckButtonState( SvLBoxEntry* pEntry, USHORT nCol ) const
+{
+ SvButtonState eState = SV_BUTTON_UNCHECKED;
+ SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1));
+ DBG_ASSERT(pItem,"GetChButnState:Item not found");
+
+ if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON)
+ {
+ USHORT nButtonFlags = pItem->GetButtonFlags();
+ eState = pCheckButtonData->ConvertToButtonState( nButtonFlags );
+ }
+
+ return eState;
+}
+
+
diff --git a/cui/source/options/fontsubs.hrc b/cui/source/options/fontsubs.hrc
new file mode 100644
index 000000000000..6ef1c7a9047a
--- /dev/null
+++ b/cui/source/options/fontsubs.hrc
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: fontsubs.hrc,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FONT_SUBSTITUTION
+#define _SVX_FONT_SUBSTITUTION
+
+#include <cuires.hrc>
+
+// defines ------------------------------------------------------------------
+
+#define CLB_SUBSTITUTES 1
+#define FT_FONT1 2
+#define CB_FONT1 3
+#define FT_FONT2 4
+#define CB_FONT2 5
+#define TBX_SUBSTNEWDEL 6
+#define BT_SUBSTAPPLY 7
+#define BT_SUBSTDELETE 8
+//#define BT_SUBSTINFO 9
+
+#define STR_HEADER1 10
+#define STR_HEADER2 11
+#define STR_HEADER3 12
+#define STR_HEADER4 13
+
+#define IL_ICON 20
+#define CB_USETABLE 21
+
+#define FL_SOURCEVIEW 22
+#define FT_FONTNAME 23
+#define LB_FONTNAME 24
+#define CB_NONPROP 25
+#define FT_FONTHEIGHT 26
+#define LB_FONTHEIGHT 27
+#define STR_AUTOMATIC 28
+
+#endif
+
+
diff --git a/cui/source/options/fontsubs.hxx b/cui/source/options/fontsubs.hxx
new file mode 100644
index 000000000000..f14ce19c490b
--- /dev/null
+++ b/cui/source/options/fontsubs.hxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: fontsubs.hxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FONT_SUBSTITUTION_HXX
+#define _SVX_FONT_SUBSTITUTION_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <svx/simptabl.hxx>
+#include <vcl/toolbox.hxx>
+#include <svtools/ctrlbox.hxx>
+
+namespace utl
+{
+ class SourceViewConfig;
+}
+
+// class SvxFontSubstCheckListBox ------------------------------------------
+
+class SvxFontSubstCheckListBox : public SvxSimpleTable
+{
+ friend class SvxFontSubstTabPage;
+ using SvxSimpleTable::SetTabs;
+ using SvTreeListBox::GetCheckButtonState;
+ using SvTreeListBox::SetCheckButtonState;
+
+ protected:
+ virtual void SetTabs();
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+ public:
+ SvxFontSubstCheckListBox(Window* pParent, const ResId& rResId ) :
+ SvxSimpleTable( pParent, rResId ){}
+
+ inline void *GetUserData(ULONG nPos) { return GetEntry(nPos)->GetUserData(); }
+ inline void SetUserData(ULONG nPos, void *pData ) { GetEntry(nPos)->SetUserData(pData); }
+
+ BOOL IsChecked(ULONG nPos, USHORT nCol = 0);
+ BOOL IsChecked(SvLBoxEntry* pEntry, USHORT nCol = 0);
+ void CheckEntryPos(ULONG nPos, USHORT nCol, BOOL bChecked);
+ void CheckEntry(SvLBoxEntry* pEntry, USHORT nCol, BOOL bChecked);
+ SvButtonState GetCheckButtonState( SvLBoxEntry*, USHORT nCol ) const;
+ void SetCheckButtonState( SvLBoxEntry*, USHORT nCol, SvButtonState );
+};
+
+// class SvxFontSubstTabPage ----------------------------------------------------
+class SvtFontSubstConfig;
+namespace svt {class SourceViewConfig;}
+class SvxFontSubstTabPage : public SfxTabPage
+{
+ CheckBox aUseTableCB;
+ FixedText aFont1FT;
+ FontNameBox aFont1CB;
+ FixedText aFont2FT;
+ FontNameBox aFont2CB;
+ ToolBox aNewDelTBX;
+ SvxFontSubstCheckListBox aCheckLB;
+
+ FixedLine aSourceViewFontsFL;
+ FixedText aFontNameFT;
+ ListBox aFontNameLB;
+ CheckBox aNonPropFontsOnlyCB;
+ FixedText aFontHeightFT;
+ ListBox aFontHeightLB;
+
+ ImageList aImageList;
+ String sAutomatic;
+
+ SvtFontSubstConfig* pConfig;
+ utl::SourceViewConfig* pSourceViewConfig;
+
+ String sHeader1;
+ String sHeader2;
+ String sHeader3;
+ String sHeader4;
+
+ Color aTextColor;
+ ByteString sFontGroup;
+
+ SvLBoxButtonData* pCheckButtonData;
+
+ DECL_LINK(SelectHdl, Window *pWin = 0);
+ DECL_LINK(NonPropFontsHdl, CheckBox* pBox);
+
+ SvLBoxEntry* CreateEntry(String& rFont1, String& rFont2);
+ void CheckEnable();
+
+
+ SvxFontSubstTabPage( Window* pParent, const SfxItemSet& rSet );
+ ~SvxFontSubstTabPage();
+
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet);
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+
+#endif // _SVX_FONT_SUBSTITUTION_HXX
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/fontsubs.src b/cui/source/options/fontsubs.src
new file mode 100644
index 000000000000..3400162c6992
--- /dev/null
+++ b/cui/source/options/fontsubs.src
@@ -0,0 +1,199 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: fontsubs.src,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // include ------------------------------------------------------------------
+
+#include "fontsubs.hrc"
+#include "helpid.hrc"
+
+ // pragma -------------------------------------------------------------------
+
+
+
+
+/**************************************************************************/
+/* */
+/* */
+/* */
+/**************************************************************************/
+
+TabPage RID_SVX_FONT_SUBSTITUTION
+{
+ HelpID = HID_OFA_FONT_SUBSTITUTION ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ CheckBox CB_USETABLE
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 248 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Apply replacement table";
+ };
+ FixedText FT_FONT1
+ {
+ Pos = MAP_APPFONT ( 6 , 20 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Font";
+ };
+ ComboBox CB_FONT1
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 33 ) ;
+ Size = MAP_APPFONT ( 100 , 100 ) ;
+ TabStop = TRUE ;
+ AutoSize = TRUE ;
+ AutoHScroll = TRUE ;
+ DDExtraWidth = TRUE ;
+ DropDown = TRUE;
+ Sort = TRUE;
+ };
+ FixedText FT_FONT2
+ {
+ Pos = MAP_APPFONT ( 110 , 20 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Re~place with";
+ };
+ ComboBox CB_FONT2
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 110 , 33 ) ;
+ Size = MAP_APPFONT ( 100 , 100 ) ;
+ TabStop = TRUE ;
+ AutoSize = TRUE ;
+ AutoHScroll = TRUE ;
+ DDExtraWidth = TRUE ;
+ DropDown = TRUE;
+ Sort = TRUE;
+ };
+ ImageList IL_ICON
+ {
+ Prefix = "nu";
+ MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+ IdList =
+ {
+ BT_SUBSTAPPLY ;
+ BT_SUBSTDELETE ;
+ };
+ IdCount = { 2 ; };
+ };
+ ToolBox TBX_SUBSTNEWDEL
+ {
+ Pos = MAP_APPFONT ( 214 , 33 ) ;
+ SVLook = TRUE ;
+ Border = FALSE ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = BT_SUBSTAPPLY ;
+ HelpID = HID_OFA_SUBST_APPLY ;
+ Text [ en-US ] = "Apply" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = BT_SUBSTDELETE ;
+ HelpID = HID_OFA_SUBST_DELETE ;
+ Text [ en-US ] = "Delete" ;
+ };
+ };
+ };
+ Control CLB_SUBSTITUTES
+ {
+ Pos = MAP_APPFONT ( 6 , 48 ) ;
+ Size = MAP_APPFONT ( 248 , 75 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_SOURCEVIEW
+ {
+ Pos = MAP_APPFONT ( 6 , 129 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Font settings for HTML, Basic and SQL sources" ;
+ };
+ FixedText FT_FONTNAME
+ {
+ Pos = MAP_APPFONT ( 6 , 142 ) ;
+ Size = MAP_APPFONT ( 57 , 8 ) ;
+ Text [ en-US ] = "Fonts" ;
+ };
+ ListBox LB_FONTNAME
+ {
+ Pos = MAP_APPFONT ( 65 , 140 ) ;
+ Size = MAP_APPFONT ( 100 , 68 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ DropDown = TRUE;
+ };
+ CheckBox CB_NONPROP
+ {
+ Pos = MAP_APPFONT ( 65 , 155 ) ;
+ Size = MAP_APPFONT ( 180 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Non-proportional fonts only" ;
+ };
+ FixedText FT_FONTHEIGHT
+ {
+ Pos = MAP_APPFONT ( 6 , 171 ) ;
+ Size = MAP_APPFONT ( 57 , 8 ) ;
+ Text [ en-US ] ="~Size";
+ };
+ ListBox LB_FONTHEIGHT
+ {
+ Pos = MAP_APPFONT ( 65 , 169 ) ;
+ Size = MAP_APPFONT ( 30 , 68 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ DropDown = TRUE;
+ };
+ String STR_HEADER1
+ {
+ Text [ en-US ] = "Always";
+ };
+ String STR_HEADER2
+ {
+ Text [ en-US ] = "Screen only";
+ };
+ String STR_HEADER3
+ {
+ Text [ en-US ] = "Font";
+ };
+ String STR_HEADER4
+ {
+ Text [ en-US ] = "Replace with";
+ };
+ String STR_AUTOMATIC
+ {
+ Text [ en-US ] = "Automatic";
+ };
+};
+
diff --git a/cui/source/options/internationaloptions.cxx b/cui/source/options/internationaloptions.cxx
new file mode 100644
index 000000000000..c5e00404ced1
--- /dev/null
+++ b/cui/source/options/internationaloptions.cxx
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: internationaloptions.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "internationaloptions.hxx"
+#include "internationaloptions.hrc"
+#include <svl/eitem.hxx>
+#include <cuires.hrc>
+#include "helpid.hrc"
+#include <dialmgr.hxx>
+#include <svx/dialogs.hrc>
+
+namespace offapp
+{
+
+ struct InternationalOptionsPage::IMPL
+ {
+ FixedLine m_aFL_DefaultTextDirection;
+ RadioButton m_aRB_TxtDirLeft2Right;
+ RadioButton m_aRB_TxtDirRight2Left;
+ FixedLine m_aFL_SheetView;
+ CheckBox m_aCB_ShtVwRight2Left;
+ CheckBox m_aCB_ShtVwCurrentDocOnly;
+
+ BOOL m_bEnable_SheetView_Opt : 1;
+
+ inline IMPL( Window* _pParent );
+
+ inline void EnableOption_SheetView( BOOL _bEnable = TRUE );
+ void ShowOption_SheetView( BOOL _bShow = TRUE );
+
+ BOOL FillItemSet( SfxItemSet& _rSet );
+ void Reset( const SfxItemSet& _rSet );
+ };
+
+ inline InternationalOptionsPage::IMPL::IMPL( Window* _pParent ) :
+ m_aFL_DefaultTextDirection ( _pParent, CUI_RES( FL_DEFTXTDIRECTION ) )
+ ,m_aRB_TxtDirLeft2Right ( _pParent, CUI_RES( RB_TXTDIR_LEFT2RIGHT ) )
+ ,m_aRB_TxtDirRight2Left ( _pParent, CUI_RES( RB_TXTDIR_RIGHT2LEFT ) )
+ ,m_aFL_SheetView ( _pParent, CUI_RES( FL_SHEETVIEW ) )
+ ,m_aCB_ShtVwRight2Left ( _pParent, CUI_RES( CB_SHTVW_RIGHT2LEFT ) )
+ ,m_aCB_ShtVwCurrentDocOnly ( _pParent, CUI_RES( CB_SHTVW_CURRENTDOCONLY ) )
+
+ ,m_bEnable_SheetView_Opt ( FALSE )
+ {
+ ShowOption_SheetView( m_bEnable_SheetView_Opt );
+ }
+
+ inline void InternationalOptionsPage::IMPL::EnableOption_SheetView( BOOL _bEnable )
+ {
+ if( m_bEnable_SheetView_Opt != _bEnable )
+ {
+ ShowOption_SheetView( _bEnable );
+
+ m_bEnable_SheetView_Opt = _bEnable;
+ }
+ }
+
+ void InternationalOptionsPage::IMPL::ShowOption_SheetView( BOOL _bShow )
+ {
+ m_aFL_SheetView.Show( _bShow );
+ m_aCB_ShtVwRight2Left.Show( _bShow );
+ m_aCB_ShtVwCurrentDocOnly.Show( _bShow );
+ }
+
+ BOOL InternationalOptionsPage::IMPL::FillItemSet( SfxItemSet& _rSet )
+ {
+ DBG_ASSERT( _rSet.GetPool(), "-InternationalOptionsPage::FillItemSet(): no pool gives rums!" );
+
+ // handling of DefaultTextDirection stuff
+ _rSet.Put( SfxBoolItem( _rSet.GetPool()->GetWhich( SID_ATTR_PARA_LEFT_TO_RIGHT ),
+ m_aRB_TxtDirLeft2Right.IsChecked() ),
+ SID_ATTR_PARA_LEFT_TO_RIGHT );
+
+ // handling of SheetView stuff
+// if( m_bEnable_SheetView_Opt )
+// {
+// }
+
+ return TRUE;
+ }
+
+ void InternationalOptionsPage::IMPL::Reset( const SfxItemSet& _rSet )
+ {
+ // handling of DefaultTextDirection stuff
+ const SfxBoolItem* pLeft2RightItem = static_cast< const SfxBoolItem* >( GetItem( _rSet, SID_ATTR_PARA_LEFT_TO_RIGHT ) );
+
+ DBG_ASSERT( pLeft2RightItem, "+InternationalOptionsPage::Reset(): SID_ATTR_PARA_LEFT_TO_RIGHT not set!" );
+
+ BOOL bLeft2Right = pLeft2RightItem? pLeft2RightItem->GetValue() : TRUE;
+ m_aRB_TxtDirLeft2Right.Check( bLeft2Right );
+
+ // handling of SheetView stuff
+// if( m_bEnable_SheetView_Opt )
+// {
+// m_aCB_ShtVwRight2Left.Check( FALSE );
+//
+// m_aCB_ShtVwCurrentDocOnly.Check( FALSE );
+// }
+ }
+
+ InternationalOptionsPage::InternationalOptionsPage( Window* _pParent, const SfxItemSet& _rAttrSet ) :
+ SfxTabPage ( _pParent, CUI_RES( RID_OFA_TP_INTERNATIONAL ), _rAttrSet )
+
+ ,m_pImpl ( new IMPL( this ) )
+ {
+ FreeResource();
+ }
+
+ SfxTabPage* InternationalOptionsPage::CreateSd( Window* _pParent, const SfxItemSet& _rAttrSet )
+ {
+ return new InternationalOptionsPage( _pParent, _rAttrSet );
+ }
+
+ SfxTabPage* InternationalOptionsPage::CreateSc( Window* _pParent, const SfxItemSet& _rAttrSet )
+ {
+ InternationalOptionsPage* p = new InternationalOptionsPage( _pParent, _rAttrSet );
+// p->m_pImpl->EnableOption_SheetView();
+ return p;
+ }
+
+ InternationalOptionsPage::~InternationalOptionsPage()
+ {
+ DELETEZ( m_pImpl );
+ }
+
+ BOOL InternationalOptionsPage::FillItemSet( SfxItemSet& _rSet )
+ {
+ return m_pImpl->FillItemSet( _rSet );
+ }
+
+ void InternationalOptionsPage::Reset( const SfxItemSet& _rSet )
+ {
+ m_pImpl->Reset( _rSet );
+ }
+
+} // /namespace offapp
+
diff --git a/cui/source/options/internationaloptions.hrc b/cui/source/options/internationaloptions.hrc
new file mode 100644
index 000000000000..b367340ba2fe
--- /dev/null
+++ b/cui/source/options/internationaloptions.hrc
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: internationaloptions.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _OFFAPP_INTERNATIONALOPTIONS_HRC_
+#define _OFFAPP_INTERNATIONALOPTIONS_HRC_
+
+#include <svtools/controldims.hrc>
+
+// general sizes
+#define PAGE_SIZE_X 260
+#define PAGE_SIZE_Y 185
+
+// x-positions
+#define COL_0 RSC_SP_TBPG_INNERBORDER_LEFT
+#define COL_1 (COL_0 + RSC_SP_FLGR_SPACE_X)
+#define COL_2 (COL_1 + RSC_SP_CHK_TEXTINDENT)
+#define COL_LAST (PAGE_SIZE_X - RSC_SP_TBPG_INNERBORDER_RIGHT)
+
+// heights
+#define HEIGHT_FL RSC_CD_FIXEDLINE_HEIGHT
+#define HEIGHT_RB RSC_CD_RADIOBUTTON_HEIGHT
+#define HEIGHT_CB RSC_CD_CHECKBOX_HEIGHT
+
+// vertical spacing
+#define SPACE_FL_NEXTCTRL_Y RSC_SP_CTRL_DESC_Y
+
+// y-positions
+#define ROW_0 RSC_SP_TBPG_INNERBORDER_TOP
+#define ROW_1 (ROW_0 + HEIGHT_FL + SPACE_FL_NEXTCTRL_Y)
+#define ROW_2 (ROW_1 + HEIGHT_RB + RSC_SP_CTRL_GROUP_Y)
+#define ROW_3 (ROW_2 + HEIGHT_RB + RSC_SP_FLGR_SPACE_Y)
+#define ROW_4 (ROW_3 + HEIGHT_FL + SPACE_FL_NEXTCTRL_Y)
+#define ROW_5 (ROW_4 + HEIGHT_CB + RSC_SP_CTRL_GROUP_Y)
+
+// misc calculation makros
+#define WIDTH2END( startcol ) (COL_LAST - startcol)
+
+
+// resource IDs
+#define FL_DEFTXTDIRECTION 1
+#define RB_TXTDIR_LEFT2RIGHT 2
+#define RB_TXTDIR_RIGHT2LEFT 3
+#define FL_SHEETVIEW 4
+#define CB_SHTVW_RIGHT2LEFT 5
+#define CB_SHTVW_CURRENTDOCONLY 6
+
+#endif
+
diff --git a/cui/source/options/internationaloptions.src b/cui/source/options/internationaloptions.src
new file mode 100644
index 000000000000..846bb444c9b5
--- /dev/null
+++ b/cui/source/options/internationaloptions.src
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: internationaloptions.src,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "internationaloptions.hrc"
+#include "helpid.hrc"
+#include <cuires.hrc>
+#include <svx/dialogs.hrc>
+
+TabPage RID_OFA_TP_INTERNATIONAL
+{
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( PAGE_SIZE_X, PAGE_SIZE_Y ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+
+ FixedLine FL_DEFTXTDIRECTION
+ {
+ Pos = MAP_APPFONT( COL_0, ROW_0 );
+ Size = MAP_APPFONT( WIDTH2END( COL_0 ), HEIGHT_FL );
+ Text [ en-US ] = "Default text direction";
+ };
+
+ RadioButton RB_TXTDIR_LEFT2RIGHT
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_1 );
+ Size = MAP_APPFONT( WIDTH2END( COL_1 ), HEIGHT_RB );
+ Group = TRUE;
+ Text [ en-US ] = "~Left-to-right";
+ };
+
+ RadioButton RB_TXTDIR_RIGHT2LEFT
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_2 );
+ Size = MAP_APPFONT( WIDTH2END( COL_1 ), HEIGHT_RB );
+ Text [ en-US ] = "~Right-to-left";
+ };
+
+ FixedLine FL_SHEETVIEW
+ {
+ Pos = MAP_APPFONT( COL_0, ROW_3 );
+ Size = MAP_APPFONT( WIDTH2END( COL_0 ), HEIGHT_FL );
+ Text [ en-US ] = "Sheet view";
+ };
+
+ CheckBox CB_SHTVW_RIGHT2LEFT
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_4 );
+ Size = MAP_APPFONT( WIDTH2END( COL_1 ), HEIGHT_CB );
+ Text [ en-US ] = "Right-~to-left";
+ };
+
+ CheckBox CB_SHTVW_CURRENTDOCONLY
+ {
+ Pos = MAP_APPFONT( COL_2, ROW_5 );
+ Size = MAP_APPFONT( WIDTH2END( COL_2 ), HEIGHT_CB );
+ Text [ en-US ] = "~Current document only";
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/makefile.mk b/cui/source/options/makefile.mk
new file mode 100755
index 000000000000..b31d70f3e773
--- /dev/null
+++ b/cui/source/options/makefile.mk
@@ -0,0 +1,122 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.65 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+PRJ=..$/..
+PRJNAME=cui
+TARGET=options
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+.IF "$(ENABLE_LAYOUT)" == "TRUE"
+CFLAGS+= -DENABLE_LAYOUT=1 -I../$(PRJ)/layout/inc -I../$(PRJ)/layout/$(INPATH)/inc
+.ENDIF # ENABLE_LAYOUT == TRUE
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=options
+SRC1FILES = \
+ connpooloptions.src \
+ dbregister.src \
+ doclinkdialog.src \
+ fontsubs.src \
+ internationaloptions.src \
+ optaccessibility.src \
+ optasian.src \
+ optchart.src \
+ optcolor.src \
+ optctl.src \
+ optdict.src \
+ optfltr.src \
+ optgdlg.src \
+ optgenrl.src \
+ opthtml.src \
+ optimprove.src \
+ optinet2.src \
+ optjava.src \
+ optjsearch.src \
+ optlingu.src \
+ optmemory.src \
+ optpath.src \
+ optsave.src \
+ optupdt.src \
+ readonlyimage.src \
+ securityoptions.src \
+ treeopt.src \
+ webconninfo.src \
+
+
+SLOFILES+=\
+ $(SLO)$/cfgchart.obj \
+ $(SLO)$/connpoolconfig.obj \
+ $(SLO)$/connpooloptions.obj \
+ $(SLO)$/connpoolsettings.obj \
+ $(SLO)$/cuisrchdlg.obj \
+ $(SLO)$/dbregister.obj \
+ $(SLO)$/dbregisterednamesconfig.obj \
+ $(SLO)$/dbregistersettings.obj \
+ $(SLO)$/doclinkdialog.obj \
+ $(SLO)$/fontsubs.obj \
+ $(SLO)$/internationaloptions.obj \
+ $(SLO)$/optaccessibility.obj \
+ $(SLO)$/optasian.obj \
+ $(SLO)$/optchart.obj \
+ $(SLO)$/optcolor.obj \
+ $(SLO)$/optctl.obj \
+ $(SLO)$/optdict.obj \
+ $(SLO)$/optfltr.obj \
+ $(SLO)$/optgdlg.obj \
+ $(SLO)$/optgenrl.obj \
+ $(SLO)$/optHeaderTabListbox.obj \
+ $(SLO)$/opthtml.obj \
+ $(SLO)$/optimprove.obj \
+ $(SLO)$/optimprove2.obj \
+ $(SLO)$/optinet2.obj \
+ $(SLO)$/optjava.obj \
+ $(SLO)$/optjsearch.obj \
+ $(SLO)$/optlingu.obj \
+ $(SLO)$/optmemory.obj \
+ $(SLO)$/optpath.obj \
+ $(SLO)$/optsave.obj \
+ $(SLO)$/optupdt.obj \
+ $(SLO)$/radiobtnbox.obj \
+ $(SLO)$/readonlyimage.obj \
+ $(SLO)$/sdbcdriverenum.obj \
+ $(SLO)$/securityoptions.obj \
+ $(SLO)$/treeopt.obj \
+ $(SLO)$/webconninfo.obj \
+
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/cui/source/options/optHeaderTabListbox.cxx b/cui/source/options/optHeaderTabListbox.cxx
new file mode 100644
index 000000000000..a3107df7069b
--- /dev/null
+++ b/cui/source/options/optHeaderTabListbox.cxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optHeaderTabListbox.cxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include "optHeaderTabListbox.hxx"
+#include <vcl/svapp.hxx>
+#include <svtools/headbar.hxx>
+
+
+namespace svx
+{
+// class OptLBoxString_Impl ----------------------------------------------
+
+class OptLBoxString_Impl : public SvLBoxString
+{
+public:
+ OptLBoxString_Impl( SvLBoxEntry* pEntry, USHORT nFlags, const String& rTxt ) :
+ SvLBoxString( pEntry, nFlags, rTxt ) {}
+
+ virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags, SvLBoxEntry* pEntry );
+};
+
+// -----------------------------------------------------------------------
+
+void OptLBoxString_Impl::Paint( const Point& rPos, SvLBox& rDev, USHORT, SvLBoxEntry* pEntry )
+{
+ Font aOldFont( rDev.GetFont() );
+ Font aFont( aOldFont );
+ //detect readonly state by asking for a valid Image
+ if(pEntry && !(!((OptHeaderTabListBox&)rDev).GetCollapsedEntryBmp(pEntry)))
+ aFont.SetColor( Application::GetSettings().GetStyleSettings().GetDeactiveTextColor() );
+ rDev.SetFont( aFont );
+ rDev.DrawText( rPos, GetText() );
+ rDev.SetFont( aOldFont );
+}
+// -----------------------------------------------------------------------------
+
+OptHeaderTabListBox::OptHeaderTabListBox( Window* pParent, WinBits nWinStyle ) :
+
+ SvHeaderTabListBox( pParent, nWinStyle )
+{
+}
+
+// -----------------------------------------------------------------------
+void OptHeaderTabListBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt,
+ const Image& rImg1, const Image& rImg2,
+ SvLBoxButtonKind eButtonKind )
+{
+ SvTabListBox::InitEntry( pEntry, rTxt, rImg1, rImg2, eButtonKind );
+ USHORT _nTabCount = TabCount();
+
+ for ( USHORT nCol = 1; nCol < _nTabCount; ++nCol )
+ {
+ // alle Spalten mit eigener Klasse initialisieren (Spalte 0 == Bitmap)
+ SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nCol );
+ OptLBoxString_Impl* pStr = new OptLBoxString_Impl( pEntry, 0, pCol->GetText() );
+ pEntry->ReplaceItem( pStr, nCol );
+ }
+}
+
+} // namespace svx
diff --git a/cui/source/options/optHeaderTabListbox.hxx b/cui/source/options/optHeaderTabListbox.hxx
new file mode 100644
index 000000000000..26608d9791b8
--- /dev/null
+++ b/cui/source/options/optHeaderTabListbox.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optHeaderTabListbox.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SVX_OPTHEADERTABLISTBOX_HXX
+#define SVX_OPTHEADERTABLISTBOX_HXX
+
+#include <svtools/svtabbx.hxx>
+
+namespace svx
+{
+ // class OptHeaderTabListBox ---------------------------------------------
+
+ class OptHeaderTabListBox : public SvHeaderTabListBox
+ {
+ public:
+ OptHeaderTabListBox( Window* pParent, WinBits nBits );
+
+ virtual void InitEntry( SvLBoxEntry*, const XubString&, const Image&, const Image&, SvLBoxButtonKind );
+ };
+} // svx
+#endif // SVX_OPTHEADERTABLISTBOX_HXX
+
diff --git a/cui/source/options/optaccessibility.cxx b/cui/source/options/optaccessibility.cxx
new file mode 100644
index 000000000000..3ceacf56d082
--- /dev/null
+++ b/cui/source/options/optaccessibility.cxx
@@ -0,0 +1,188 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optaccessibility.cxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <optaccessibility.hxx>
+#include <optaccessibility.hrc>
+#include <dialmgr.hxx>
+#include <cuires.hrc>
+#include <svtools/accessibilityoptions.hxx>
+#include <vcl/settings.hxx>
+#include <vcl/svapp.hxx>
+
+static void MovePosY( Window& _rWin, long _nDelta )
+{
+ Point aPoint = _rWin.GetPosPixel();
+ aPoint.Y() += _nDelta;
+
+ _rWin.SetPosPixel( aPoint );
+}
+
+struct SvxAccessibilityOptionsTabPage_Impl
+{
+ SvtAccessibilityOptions m_aConfig;
+ SvxAccessibilityOptionsTabPage_Impl()
+ : m_aConfig(){}
+};
+
+SvxAccessibilityOptionsTabPage::SvxAccessibilityOptionsTabPage( Window* pParent, const SfxItemSet& rSet )
+ :SfxTabPage(pParent, CUI_RES( RID_SVXPAGE_ACCESSIBILITYCONFIG ), rSet)
+ ,m_aMiscellaneousLabel (this, CUI_RES(FL_MISCELLANEOUS ))
+ ,m_aAccessibilityTool (this, CUI_RES(CB_ACCESSIBILITY_TOOL ))
+ ,m_aTextSelectionInReadonly (this, CUI_RES(CB_TEXTSELECTION ))
+ ,m_aAnimatedGraphics (this, CUI_RES(CB_ANIMATED_GRAPHICS ))
+ ,m_aAnimatedTexts (this, CUI_RES(CB_ANIMATED_TEXTS ))
+ ,m_aTipHelpCB (this, CUI_RES(CB_TIPHELP ))
+ ,m_aTipHelpNF (this, CUI_RES(NF_TIPHELP ))
+ ,m_aTipHelpFT (this, CUI_RES(FT_TIPHELP ))
+ ,m_aHCOptionsLabel (this, CUI_RES(FL_HC_OPTIONS ))
+ ,m_aAutoDetectHC (this, CUI_RES(CB_AUTO_DETECT_HC ))
+ ,m_aAutomaticFontColor (this, CUI_RES(CB_AUTOMATIC_FONT_COLOR))
+ ,m_aPagePreviews (this, CUI_RES(CB_PAGE_PREVIEWS ))
+ ,m_pImpl(new SvxAccessibilityOptionsTabPage_Impl)
+{
+ FreeResource();
+ m_aTipHelpCB.SetClickHdl(LINK(this, SvxAccessibilityOptionsTabPage, TipHelpHdl));
+
+ long nHeightDelta = 0; // to correct positions _under_ m_aAccessibilityTool
+
+#ifdef UNX
+ {
+ // UNIX: read the gconf2 setting instead to use the checkbox
+ m_aAccessibilityTool.Hide();
+ nHeightDelta = -( ROWA_2 - ROWA_1 );
+ }
+#else
+ // calculate the height of the checkbox. Do we need two (default in resource) or only one line
+ String aText = m_aAccessibilityTool.GetText();
+ long nWidth = m_aAccessibilityTool.GetTextWidth( aText );
+ long nCtrlWidth = m_aAccessibilityTool.GetSizePixel().Width() - ( COL2 - COL1 );
+ if ( nWidth > nCtrlWidth )
+ {
+ long nDelta = 2 * RSC_CD_FIXEDLINE_HEIGHT + LINESPACE - RSC_CD_CHECKBOX_HEIGHT;
+ nHeightDelta = nDelta;
+ Size aSize = m_aAccessibilityTool.LogicToPixel( Size( 0, nDelta ), MAP_APPFONT );
+ nDelta = aSize.Height();
+ aSize = m_aAccessibilityTool.GetSizePixel();
+ aSize.Height() += nDelta;
+ m_aAccessibilityTool.SetSizePixel( aSize );
+ }
+#endif
+
+ if( nHeightDelta )
+ { //adjust positions of controls under m_aAccessibilityTool
+ Size aSize = m_aAccessibilityTool.LogicToPixel( Size( 0, nHeightDelta ), MAP_APPFONT );
+ nHeightDelta = aSize.Height();
+
+ MovePosY( m_aTextSelectionInReadonly, nHeightDelta );
+ MovePosY( m_aAnimatedGraphics, nHeightDelta );
+ MovePosY( m_aAnimatedTexts, nHeightDelta );
+ MovePosY( m_aTipHelpCB, nHeightDelta );
+ MovePosY( m_aTipHelpNF, nHeightDelta );
+ MovePosY( m_aTipHelpFT, nHeightDelta );
+ MovePosY( m_aHCOptionsLabel, nHeightDelta );
+ MovePosY( m_aAutoDetectHC, nHeightDelta );
+ MovePosY( m_aAutomaticFontColor, nHeightDelta );
+ MovePosY( m_aPagePreviews, nHeightDelta );
+ }
+}
+
+SvxAccessibilityOptionsTabPage::~SvxAccessibilityOptionsTabPage()
+{
+ delete m_pImpl;
+}
+
+SfxTabPage* SvxAccessibilityOptionsTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new SvxAccessibilityOptionsTabPage(pParent, rAttrSet);
+}
+
+BOOL SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet& )
+{
+ //aConfig.Set... from controls
+
+ m_pImpl->m_aConfig.SetIsForPagePreviews( m_aPagePreviews.IsChecked() );
+ m_pImpl->m_aConfig.SetIsHelpTipsDisappear( m_aTipHelpCB.IsChecked() );
+ m_pImpl->m_aConfig.SetHelpTipSeconds( (short)m_aTipHelpNF.GetValue() );
+ m_pImpl->m_aConfig.SetIsAllowAnimatedGraphics( m_aAnimatedGraphics.IsChecked() );
+ m_pImpl->m_aConfig.SetIsAllowAnimatedText( m_aAnimatedTexts.IsChecked() );
+ m_pImpl->m_aConfig.SetIsAutomaticFontColor( m_aAutomaticFontColor.IsChecked() );
+ m_pImpl->m_aConfig.SetSelectionInReadonly( m_aTextSelectionInReadonly.IsChecked());
+ m_pImpl->m_aConfig.SetAutoDetectSystemHC( m_aAutoDetectHC.IsChecked());
+
+ if(m_pImpl->m_aConfig.IsModified())
+ m_pImpl->m_aConfig.Commit();
+
+ AllSettings aAllSettings = Application::GetSettings();
+ MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
+#ifndef UNX
+ aMiscSettings.SetEnableATToolSupport( m_aAccessibilityTool.IsChecked() );
+#endif
+ aAllSettings.SetMiscSettings(aMiscSettings);
+ Application::MergeSystemSettings( aAllSettings );
+ Application::SetSettings(aAllSettings);
+
+ return FALSE;
+}
+
+void SvxAccessibilityOptionsTabPage::Reset( const SfxItemSet& )
+{
+ //set controls from aConfig.Get...
+
+ m_aPagePreviews.Check( m_pImpl->m_aConfig.GetIsForPagePreviews() );
+ EnableTipHelp( m_pImpl->m_aConfig.GetIsHelpTipsDisappear() );
+ m_aTipHelpNF.SetValue( m_pImpl->m_aConfig.GetHelpTipSeconds() );
+ m_aAnimatedGraphics.Check( m_pImpl->m_aConfig.GetIsAllowAnimatedGraphics() );
+ m_aAnimatedTexts.Check( m_pImpl->m_aConfig.GetIsAllowAnimatedText() );
+ m_aAutomaticFontColor.Check( m_pImpl->m_aConfig.GetIsAutomaticFontColor() );
+// m_aSystemFont.Check( m_pImpl->m_aConfig.GetIsSystemFont() );
+ m_aTextSelectionInReadonly.Check( m_pImpl->m_aConfig.IsSelectionInReadonly() );
+ m_aAutoDetectHC.Check( m_pImpl->m_aConfig.GetAutoDetectSystemHC() );
+
+
+ AllSettings aAllSettings = Application::GetSettings();
+ MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
+ m_aAccessibilityTool.Check( aMiscSettings.GetEnableATToolSupport() );
+}
+
+IMPL_LINK(SvxAccessibilityOptionsTabPage, TipHelpHdl, CheckBox*, pBox)
+{
+ sal_Bool bChecked = pBox->IsChecked();
+ m_aTipHelpNF.Enable(bChecked);
+ return 0;
+}
+
+void SvxAccessibilityOptionsTabPage::EnableTipHelp(sal_Bool bCheck)
+{
+ m_aTipHelpCB.Check(bCheck);
+ m_aTipHelpNF.Enable(bCheck);
+}
diff --git a/cui/source/options/optaccessibility.hrc b/cui/source/options/optaccessibility.hrc
new file mode 100644
index 000000000000..248cf16bc96e
--- /dev/null
+++ b/cui/source/options/optaccessibility.hrc
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optaccessibility.hrc,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTACCESSIBILITY_HRC
+#define _SVX_OPTACCESSIBILITY_HRC
+
+#include <svtools/controldims.hrc>
+
+// defines for positions and sizes
+
+#define GB_WIDTH 248
+#define CB_WIDTH 240
+#define EDIT_WIDTH 25
+
+#define COL0 6
+#define COL1 (COL0+6)
+#define COL2 (COL1+10)
+#define COL3 (COL1+(CB_WIDTH * 2/3))
+#define COL4 (COL3+EDIT_WIDTH+RSC_SP_CTRL_DESC_X)
+
+#define UNIT_WIDTH (COL1+CB_WIDTH-COL4)
+
+#define ROWSPACE RSC_SP_CTRL_DESC_Y
+#define LINESPACE 1
+#define GROUPSPACE RSC_SP_CTRL_DESC_Y + 2
+#define ROWA_0 3
+#define ROWA_1 ( ROWA_0 + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE )
+#define ROWA_2 ( ROWA_1 + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE )
+#define ROWA_3 ( ROWA_2 + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE )
+#define ROWA_4 ( ROWA_3 + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE )
+#define ROWA_5 ( ROWA_4 + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE )
+
+#define ROWB_0 ( ROWA_5 + RSC_CD_TEXTBOX_HEIGHT + ROWSPACE + GROUPSPACE )
+#define ROWB_1 ( ROWB_0 + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE )
+#define ROWB_2 ( ROWB_1 + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE )
+#define ROWB_3 ( ROWB_2 + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE )
+
+#define WHOLE_HEIGHT 185
+#define LASTTEXT_HEIGHT (WHOLE_HEIGHT-ROWB_8)
+#define OFFS_TEXTBOX_FIXEDTEXT(base) (base+(RSC_CD_TEXTBOX_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)
+#define DIFF(v1,v2) (v2-v1)
+#define SUM(v1,v2) (v2+v1)
+
+//
+
+#define FL_MISCELLANEOUS 1
+#define CB_PAGE_PREVIEWS 2
+#define FL_HC_OPTIONS 3
+#define CB_TIPHELP 4
+#define NF_TIPHELP 5
+#define FT_TIPHELP 6
+#define CB_ANIMATED_GRAPHICS 7
+#define CB_ANIMATED_TEXTS 8
+#define CB_AUTOMATIC_FONT_COLOR 9
+#define CB_SYSTEM_FONT 10
+#define CB_ACCESSIBILITY_TOOL 11
+#define CB_TEXTSELECTION 12
+#define CB_AUTO_DETECT_HC 13
+
+#endif
+
diff --git a/cui/source/options/optaccessibility.hxx b/cui/source/options/optaccessibility.hxx
new file mode 100644
index 000000000000..ff0eee457c1a
--- /dev/null
+++ b/cui/source/options/optaccessibility.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optaccessibility.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTACCESSIBILITY_HXX
+#define _SVX_OPTACCESSIBILITY_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+struct SvxAccessibilityOptionsTabPage_Impl;
+class SvxAccessibilityOptionsTabPage : public SfxTabPage
+{
+ FixedLine m_aMiscellaneousLabel; // FL_MISCELLANEOUS
+ CheckBox m_aAccessibilityTool; // CB_ACCESSIBILITY_TOOL
+ CheckBox m_aTextSelectionInReadonly; // CB_TEXTSELECTION
+ CheckBox m_aAnimatedGraphics; // CB_ANIMATED_GRAPHICS
+ CheckBox m_aAnimatedTexts; // CB_ANIMATED_TEXTS
+ CheckBox m_aTipHelpCB; // CB_TIPHELP
+ NumericField m_aTipHelpNF; // NF_TIPHELP
+ FixedText m_aTipHelpFT; // FT_TIPHELP
+ FixedLine m_aHCOptionsLabel; // FL_HC_OPTIONS
+ CheckBox m_aAutoDetectHC; // CB_AUTO_DETECT_HC
+ CheckBox m_aAutomaticFontColor; // CB_AUTOMATIC_FONT_COLOR
+ CheckBox m_aPagePreviews; // CB_PAGEPREVIEWS
+
+ DECL_LINK(TipHelpHdl, CheckBox*);
+ void EnableTipHelp(sal_Bool bCheck);
+
+ SvxAccessibilityOptionsTabPage_Impl* m_pImpl;
+
+ SvxAccessibilityOptionsTabPage( Window* pParent, const SfxItemSet& rSet );
+public:
+
+ virtual ~SvxAccessibilityOptionsTabPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+#endif
+
diff --git a/cui/source/options/optaccessibility.src b/cui/source/options/optaccessibility.src
new file mode 100644
index 000000000000..ef375fb80117
--- /dev/null
+++ b/cui/source/options/optaccessibility.src
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optaccessibility.src,v $
+ * $Revision: 1.36 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <optaccessibility.hrc>
+#include <sfx2/sfx.hrc>
+#include "helpid.hrc"
+#include <cuires.hrc>
+
+TabPage RID_SVXPAGE_ACCESSIBILITYCONFIG
+{
+ HelpId = HID_OPTIONS_ACCESSIBILITYCONFIG ;
+ Size = MAP_APPFONT ( 260 , WHOLE_HEIGHT ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ FixedLine FL_MISCELLANEOUS
+ {
+ Pos = MAP_APPFONT ( COL0, ROWA_0 ) ;
+ Size = MAP_APPFONT ( GB_WIDTH , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Miscellaneous options";
+ };
+ CheckBox CB_ACCESSIBILITY_TOOL
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT( COL1, ROWA_1 );
+ Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ WordBreak = TRUE;
+ Text [ en-US ] = "Support ~assistive technology tools (program restart required)";
+ };
+ CheckBox CB_TEXTSELECTION
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT( COL1, ROWA_2 );
+ Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Use te~xt selection cursor in read-only text documents";
+ };
+ CheckBox CB_ANIMATED_GRAPHICS
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT( COL1, ROWA_3 );
+ Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Allow animated ~graphics";
+ };
+ CheckBox CB_ANIMATED_TEXTS
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT( COL1, ROWA_4 );
+ Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Allow animated ~text";
+ };
+ CheckBox CB_TIPHELP
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT( ROWA_5 ) );
+ Size = MAP_APPFONT( DIFF(COL2,COL3), RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "~Help tips disappear after ";
+ };
+ NumericField NF_TIPHELP
+ {
+ TabStop = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT( COL3, ROWA_5 );
+ Size = MAP_APPFONT( EDIT_WIDTH, RSC_CD_TEXTBOX_HEIGHT );
+ Minimum = 1;
+ Maximum = 99;
+ First = 1 ;
+ Last = 99 ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ };
+ FixedText FT_TIPHELP
+ {
+ Pos = MAP_APPFONT( COL4, OFFS_TEXTBOX_FIXEDTEXT( ROWA_5 ) );
+ Size = MAP_APPFONT( UNIT_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "seconds";
+ };
+ FixedLine FL_HC_OPTIONS
+ {
+ Pos = MAP_APPFONT ( COL0, ROWB_0 ) ;
+ Size = MAP_APPFONT ( GB_WIDTH , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Options for high contrast appearance";
+ };
+ CheckBox CB_AUTO_DETECT_HC
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT( COL1, ROWB_1 );
+ Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Automatically ~detect high contrast mode of operating system";
+ };
+ CheckBox CB_AUTOMATIC_FONT_COLOR
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT( COL1, ROWB_2 );
+ Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Use automatic font ~color for screen display";
+ };
+ CheckBox CB_PAGE_PREVIEWS
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT( COL1, ROWB_3 );
+ Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "~Use system colors for page previews";
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/optasian.cxx b/cui/source/options/optasian.cxx
new file mode 100644
index 000000000000..0bbf0ac287bd
--- /dev/null
+++ b/cui/source/options/optasian.cxx
@@ -0,0 +1,470 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optasian.cxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <optasian.hxx>
+#include <svx/langitem.hxx>
+#include <svx/unolingu.hxx>
+#include <optasian.hrc>
+#include <dialmgr.hxx>
+#include <cuires.hrc>
+#include <tools/table.hxx>
+#include <tools/shl.hxx>
+#include <svx/asiancfg.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/objsh.hxx>
+#include <vcl/svapp.hxx>
+#include <comphelper/processfactory.hxx>
+#include <unotools/localedatawrapper.hxx>
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::i18n;
+using namespace com::sun::star::frame;
+using namespace com::sun::star::beans;
+using rtl::OUString;
+
+#define C2U(cChar) rtl::OUString::createFromAscii(cChar)
+
+const sal_Char cIsKernAsianPunctuation[] = "IsKernAsianPunctuation";
+const sal_Char cCharacterCompressionType[] = "CharacterCompressionType";
+
+struct SvxForbiddenChars_Impl
+{
+ sal_Bool bRemoved;
+ ForbiddenCharacters* pCharacters;
+};
+
+DECLARE_TABLE( _SvxForbiddenCharacterTable_Impl, SvxForbiddenChars_Impl* )
+
+class SvxForbiddenCharacterTable_Impl : public _SvxForbiddenCharacterTable_Impl
+{
+public:
+ SvxForbiddenCharacterTable_Impl()
+ : _SvxForbiddenCharacterTable_Impl( 4, 4 )
+ {}
+ ~SvxForbiddenCharacterTable_Impl();
+};
+
+struct SvxAsianLayoutPage_Impl
+{
+ SvxAsianConfig aConfig;
+ SvxAsianLayoutPage_Impl() :
+ aConfig(sal_False){}
+
+ Reference< XForbiddenCharacters > xForbidden;
+ Reference< XPropertySet > xPrSet;
+ Reference< XPropertySetInfo > xPrSetInfo;
+ SvxForbiddenCharacterTable_Impl aChangedLanguagesTbl;
+
+ sal_Bool hasForbiddenCharacters(LanguageType eLang);
+ SvxForbiddenChars_Impl* getForbiddenCharacters(LanguageType eLang);
+ void addForbiddenCharacters(LanguageType eLang, ForbiddenCharacters* pForbidden);
+};
+/* -----------------------------24.01.01 14:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxForbiddenCharacterTable_Impl::~SvxForbiddenCharacterTable_Impl()
+{
+ for( SvxForbiddenChars_Impl* pDel = First(); pDel; pDel = Next() )
+ {
+ delete pDel->pCharacters;
+ delete pDel;
+ }
+}
+/* -----------------------------24.01.01 14:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SvxAsianLayoutPage_Impl::hasForbiddenCharacters(LanguageType eLang)
+{
+ return 0 != aChangedLanguagesTbl.Get(eLang);
+}
+/* -----------------------------24.01.01 14:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxForbiddenChars_Impl* SvxAsianLayoutPage_Impl::getForbiddenCharacters(LanguageType eLang)
+{
+ SvxForbiddenChars_Impl* pImp = aChangedLanguagesTbl.Get(eLang);
+ DBG_ASSERT(pImp, "language not available");
+ if(pImp)
+ return pImp;
+ return 0;
+}
+/* -----------------------------24.01.01 14:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxAsianLayoutPage_Impl::addForbiddenCharacters(
+ LanguageType eLang, ForbiddenCharacters* pForbidden)
+{
+ SvxForbiddenChars_Impl* pOld = aChangedLanguagesTbl.Get(eLang);
+ if( !pOld )
+ {
+ pOld = new SvxForbiddenChars_Impl;
+ pOld->bRemoved = 0 == pForbidden;
+ pOld->pCharacters = pForbidden ? new ForbiddenCharacters(*pForbidden) : 0;
+ aChangedLanguagesTbl.Insert( eLang, pOld );
+ }
+ else
+ {
+ pOld->bRemoved = 0 == pForbidden;
+ delete pOld->pCharacters;
+ pOld->pCharacters = pForbidden ? new ForbiddenCharacters(*pForbidden) : 0;
+ }
+
+}
+/*-- 09.01.01 13:29:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+static LanguageType eLastUsedLanguageTypeForForbiddenCharacters = USHRT_MAX;
+
+SvxAsianLayoutPage::SvxAsianLayoutPage( Window* pParent, const SfxItemSet& rSet ) :
+ SfxTabPage(pParent, CUI_RES( RID_SVXPAGE_ASIAN_LAYOUT ), rSet),
+ aKerningGB( this, CUI_RES(GB_KERNING )),
+ aCharKerningRB( this, CUI_RES(RB_CHAR_KERNING )),
+ aCharPunctKerningRB( this, CUI_RES(RB_CHAR_PUNCT )),
+ aCharDistGB( this, CUI_RES(GB_CHAR_DIST )),
+ aNoCompressionRB( this, CUI_RES(RB_NO_COMP )),
+ aPunctCompressionRB( this, CUI_RES(RB_PUNCT_COMP )),
+ aPunctKanaCompressionRB(this, CUI_RES(RB_PUNCT_KANA_COMP )),
+ aStartEndGB( this, CUI_RES(GB_START_END )),
+ aLanguageFT( this, CUI_RES(FT_LANGUAGE )),
+ aLanguageLB( this, CUI_RES(LB_LANGUAGE )),
+ aStandardCB( this, CUI_RES(CB_STANDARD )),
+ aStartFT( this, CUI_RES(FT_START )),
+ aStartED( this, CUI_RES(ED_START )),
+ aEndFT( this, CUI_RES(FT_END )),
+ aEndED( this, CUI_RES(ED_END )),
+ aHintFT( this, CUI_RES(FT_HINT )),
+ pImpl(new SvxAsianLayoutPage_Impl)
+{
+ FreeResource();
+ LanguageHdl(&aLanguageLB);
+ aLanguageLB.SetSelectHdl(LINK(this, SvxAsianLayoutPage, LanguageHdl));
+ aStandardCB.SetClickHdl(LINK(this, SvxAsianLayoutPage, ChangeStandardHdl));
+ Link aLk(LINK(this, SvxAsianLayoutPage, ModifyHdl));
+ aStartED.SetModifyHdl(aLk);
+ aEndED.SetModifyHdl(aLk);
+
+ aLanguageLB.SetLanguageList( LANG_LIST_FBD_CHARS, FALSE, FALSE );
+}
+/*-- 09.01.01 13:29:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SvxAsianLayoutPage::~SvxAsianLayoutPage()
+{
+ delete pImpl;
+}
+/*-- 09.01.01 13:29:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxTabPage* SvxAsianLayoutPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new SvxAsianLayoutPage(pParent, rAttrSet);
+}
+/*-- 09.01.01 13:29:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+BOOL SvxAsianLayoutPage::FillItemSet( SfxItemSet& )
+{
+ if(aCharKerningRB.IsChecked() != aCharKerningRB.GetSavedValue())
+ {
+ pImpl->aConfig.SetKerningWesternTextOnly(aCharKerningRB.IsChecked());
+ OUString sPunct(C2U(cIsKernAsianPunctuation));
+ if(pImpl->xPrSetInfo.is() && pImpl->xPrSetInfo->hasPropertyByName(sPunct))
+ {
+ Any aVal;
+ BOOL bVal = !aCharKerningRB.IsChecked();
+ aVal.setValue(&bVal, ::getBooleanCppuType());
+ pImpl->xPrSet->setPropertyValue(sPunct, aVal);
+ }
+ }
+
+ if(aNoCompressionRB.IsChecked() != aNoCompressionRB.GetSavedValue() ||
+ aPunctCompressionRB.IsChecked() != aPunctCompressionRB.GetSavedValue())
+ {
+ sal_Int16 nSet = aNoCompressionRB.IsChecked() ? 0 :
+ aPunctCompressionRB.IsChecked() ? 1 : 2;
+ pImpl->aConfig.SetCharDistanceCompression(nSet);
+ OUString sCompress(C2U(cCharacterCompressionType));
+ if(pImpl->xPrSetInfo.is() && pImpl->xPrSetInfo->hasPropertyByName(sCompress))
+ {
+ Any aVal;
+ aVal <<= nSet;
+ pImpl->xPrSet->setPropertyValue(sCompress, aVal);
+ }
+ }
+ if(pImpl->aConfig.IsModified())
+ pImpl->aConfig.Commit();
+ if(pImpl->xForbidden.is())
+ {
+ try
+ {
+ for( SvxForbiddenChars_Impl* pElem = pImpl->aChangedLanguagesTbl.First();
+ pElem; pElem = pImpl->aChangedLanguagesTbl.Next() )
+ {
+ ULONG nLang = pImpl->aChangedLanguagesTbl.GetKey( pElem );
+ Locale aLocale;
+ SvxLanguageToLocale(aLocale, (USHORT)nLang );
+ if(pElem->bRemoved)
+ pImpl->xForbidden->removeForbiddenCharacters( aLocale );
+ else if(pElem->pCharacters)
+ pImpl->xForbidden->setForbiddenCharacters( aLocale, *pElem->pCharacters );
+ }
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("exception in XForbiddenCharacters");
+ }
+ }
+ eLastUsedLanguageTypeForForbiddenCharacters = aLanguageLB.GetSelectLanguage();
+
+ return FALSE;
+}
+/*-- 09.01.01 13:29:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SvxAsianLayoutPage::Reset( const SfxItemSet& )
+{
+ SfxViewFrame* pCurFrm = SfxViewFrame::Current();
+ SfxObjectShell* pDocSh = pCurFrm ? pCurFrm->GetObjectShell() : 0;
+ Reference< XModel > xModel;
+ if(pDocSh)
+ xModel = pDocSh->GetModel();
+ Reference<XMultiServiceFactory> xFact(xModel, UNO_QUERY);
+ if(xFact.is())
+ {
+ pImpl->xPrSet = Reference<XPropertySet>(
+ xFact->createInstance(C2U("com.sun.star.document.Settings")), UNO_QUERY);
+ }
+ if( pImpl->xPrSet.is() )
+ pImpl->xPrSetInfo = pImpl->xPrSet->getPropertySetInfo();
+ OUString sForbidden(C2U("ForbiddenCharacters"));
+ sal_Bool bKernWesternText = pImpl->aConfig.IsKerningWesternTextOnly();
+ sal_Int16 nCompress = pImpl->aConfig.GetCharDistanceCompression();
+ if(pImpl->xPrSetInfo.is())
+ {
+ if(pImpl->xPrSetInfo->hasPropertyByName(sForbidden))
+ {
+ Any aForbidden = pImpl->xPrSet->getPropertyValue(sForbidden);
+ aForbidden >>= pImpl->xForbidden;
+ }
+ OUString sCompress(C2U(cCharacterCompressionType));
+ if(pImpl->xPrSetInfo->hasPropertyByName(sCompress))
+ {
+ Any aVal = pImpl->xPrSet->getPropertyValue(sCompress);
+ aVal >>= nCompress;
+ }
+ OUString sPunct(C2U(cIsKernAsianPunctuation));
+ if(pImpl->xPrSetInfo->hasPropertyByName(sPunct))
+ {
+ Any aVal = pImpl->xPrSet->getPropertyValue(sPunct);
+ bKernWesternText = !*(sal_Bool*)aVal.getValue();
+ }
+ }
+ else
+ {
+ aStartEndGB.Enable(FALSE);
+ aLanguageFT.Enable(FALSE);
+ aLanguageLB.Enable(FALSE);
+ aStandardCB.Enable(FALSE);
+ aStartFT.Enable(FALSE);
+ aStartED.Enable(FALSE);
+ aEndFT.Enable(FALSE);
+ aEndED.Enable(FALSE);
+ aHintFT.Enable(FALSE);
+ }
+ if(bKernWesternText)
+ aCharKerningRB.Check(TRUE);
+ else
+ aCharPunctKerningRB.Check(TRUE);
+ switch(nCompress)
+ {
+ case 0 : aNoCompressionRB.Check(); break;
+ case 1 : aPunctCompressionRB.Check(); break;
+ default: aPunctKanaCompressionRB.Check();
+ }
+ aCharKerningRB.SaveValue();
+ aNoCompressionRB.SaveValue();
+ aPunctCompressionRB.SaveValue();
+ aPunctKanaCompressionRB.SaveValue();
+
+ aLanguageLB.SelectEntryPos(0);
+ //preselect the system language in the box - if available
+ if(USHRT_MAX == eLastUsedLanguageTypeForForbiddenCharacters)
+ {
+ eLastUsedLanguageTypeForForbiddenCharacters = SvxLocaleToLanguage(
+ Application::GetSettings().GetLocale() );
+ switch(eLastUsedLanguageTypeForForbiddenCharacters)
+ {
+ case LANGUAGE_CHINESE :
+ case LANGUAGE_CHINESE_SINGAPORE :
+ eLastUsedLanguageTypeForForbiddenCharacters = LANGUAGE_CHINESE_SIMPLIFIED;
+ break;
+ case LANGUAGE_CHINESE_HONGKONG :
+ case LANGUAGE_CHINESE_MACAU :
+ eLastUsedLanguageTypeForForbiddenCharacters = LANGUAGE_CHINESE_TRADITIONAL;
+ break;
+ }
+ }
+ aLanguageLB.SelectLanguage( eLastUsedLanguageTypeForForbiddenCharacters );
+ LanguageHdl(&aLanguageLB);
+}
+/* -----------------------------17.01.01 11:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxAsianLayoutPage, LanguageHdl, SvxLanguageBox*, EMPTYARG )
+{
+ //set current value
+ Locale aLocale;
+ LanguageType eSelectLanguage = aLanguageLB.GetSelectLanguage();
+ SvxLanguageToLocale(aLocale, eSelectLanguage );
+
+ OUString sStart, sEnd;
+ sal_Bool bAvail;
+ if(pImpl->xForbidden.is())
+ {
+ bAvail = pImpl->hasForbiddenCharacters(eSelectLanguage);
+ if(bAvail)
+ {
+ SvxForbiddenChars_Impl* pElement = pImpl->getForbiddenCharacters(eSelectLanguage);
+ if(pElement->bRemoved || !pElement->pCharacters)
+ {
+ bAvail = FALSE;
+ }
+ else
+ {
+ sStart = pElement->pCharacters->beginLine;
+ sEnd = pElement->pCharacters->endLine;
+ }
+ }
+ else
+ {
+ try
+ {
+ bAvail = pImpl->xForbidden->hasForbiddenCharacters(aLocale);
+ if(bAvail)
+ {
+ ForbiddenCharacters aForbidden = pImpl->xForbidden->getForbiddenCharacters( aLocale );
+ sStart = aForbidden.beginLine;
+ sEnd = aForbidden.endLine;
+ }
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("exception in XForbiddenCharacters");
+ }
+ }
+ }
+ else
+ {
+ bAvail = pImpl->aConfig.GetStartEndChars( aLocale, sStart, sEnd );
+ }
+ if(!bAvail)
+ {
+ Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ LocaleDataWrapper aWrap( xMSF, aLocale );
+ ForbiddenCharacters aForbidden = aWrap.getForbiddenCharacters();
+ sStart = aForbidden.beginLine;
+ sEnd = aForbidden.endLine;
+ }
+ aStandardCB.Check(!bAvail);
+ aStartED.Enable(bAvail);
+ aEndED.Enable(bAvail);
+ aStartFT.Enable(bAvail);
+ aEndFT.Enable(bAvail);
+ aStartED.SetText(sStart);
+ aEndED.SetText(sEnd);
+
+ return 0;
+}
+/* -----------------------------17.01.01 11:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxAsianLayoutPage, ChangeStandardHdl, CheckBox*, pBox)
+{
+ sal_Bool bCheck = pBox->IsChecked();
+ aStartED.Enable(!bCheck);
+ aEndED.Enable(!bCheck);
+ aStartFT.Enable(!bCheck);
+ aEndFT.Enable(!bCheck);
+
+ ModifyHdl(&aStartED);
+ return 0;
+}
+/* -----------------------------17.01.01 12:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxAsianLayoutPage, ModifyHdl, Edit*, pEdit)
+{
+ Locale aLocale;
+ LanguageType eSelectLanguage = aLanguageLB.GetSelectLanguage();
+ SvxLanguageToLocale(aLocale, eSelectLanguage );
+ OUString sStart = aStartED.GetText();
+ OUString sEnd = aEndED.GetText();
+ sal_Bool bEnable = pEdit->IsEnabled();
+ if(pImpl->xForbidden.is())
+ {
+ try
+ {
+ if(bEnable)
+ {
+ ForbiddenCharacters aSet;
+ aSet.beginLine = sStart;
+ aSet.endLine = sEnd;
+// pImpl->xForbidden->setForbiddenCharacters( aLocale, aSet );
+ pImpl->addForbiddenCharacters(eSelectLanguage, &aSet);
+ }
+ else
+ pImpl->addForbiddenCharacters(eSelectLanguage, 0);
+// pImpl->xForbidden->removeForbiddenCharacters( aLocale );
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("exception in XForbiddenCharacters");
+ }
+ }
+ pImpl->aConfig.SetStartEndChars( aLocale, bEnable ? &sStart : 0, bEnable ? &sEnd : 0);
+ return 0;
+}
+/*-- 07.09.2007 12:05:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+USHORT* SvxAsianLayoutPage::GetRanges()
+{
+ //no items are used
+ static USHORT pAsianLayoutRanges[] = { 0 };
+ return pAsianLayoutRanges;
+}
diff --git a/cui/source/options/optasian.hrc b/cui/source/options/optasian.hrc
new file mode 100644
index 000000000000..2d9c8a282352
--- /dev/null
+++ b/cui/source/options/optasian.hrc
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optasian.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTASIAN_HRC
+#define _SVX_OPTASIAN_HRC
+
+#define GB_KERNING 1
+#define RB_CHAR_KERNING 2
+#define RB_CHAR_PUNCT 3
+#define GB_CHAR_DIST 4
+#define RB_NO_COMP 5
+#define RB_PUNCT_COMP 6
+#define RB_PUNCT_KANA_COMP 7
+#define GB_START_END 8
+#define CB_STANDARD 9
+
+#define FT_LANGUAGE 11
+#define LB_LANGUAGE 12
+#define FT_START 13
+#define ED_START 14
+#define FT_END 15
+#define ED_END 16
+#define FT_HINT 17
+
+#endif
+
diff --git a/cui/source/options/optasian.src b/cui/source/options/optasian.src
new file mode 100644
index 000000000000..f8286ea1186c
--- /dev/null
+++ b/cui/source/options/optasian.src
@@ -0,0 +1,177 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optasian.src,v $
+ * $Revision: 1.48 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <optasian.hrc>
+#include <sfx2/sfx.hrc>
+#include "helpid.hrc"
+#include <cuires.hrc>
+
+TabPage RID_SVXPAGE_ASIAN_LAYOUT
+{
+ HelpId = HID_OPTIONS_ASIAN_LAYOUT ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ FixedLine GB_KERNING
+ {
+ Pos = MAP_APPFONT ( 6, 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Kerning";
+ };
+ RadioButton RB_CHAR_KERNING
+ {
+ Pos = MAP_APPFONT ( 12, 14 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ Text [ en-US ] = "~Western characters only";
+ };
+ RadioButton RB_CHAR_PUNCT
+ {
+ Pos = MAP_APPFONT ( 12, 27 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ Text [ en-US ] = "Western ~text and Asian punctuation";
+ };
+ FixedLine GB_CHAR_DIST
+ {
+ Pos = MAP_APPFONT ( 6, 43 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Character spacing";
+ };
+ RadioButton RB_NO_COMP
+ {
+ Pos = MAP_APPFONT ( 12, 54 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ Text [ en-US ] = "~No compression";
+ };
+ RadioButton RB_PUNCT_COMP
+ {
+ Pos = MAP_APPFONT ( 12, 67) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ Text [ en-US ] = "~Compress punctuation only";
+ };
+ RadioButton RB_PUNCT_KANA_COMP
+ {
+ Pos = MAP_APPFONT ( 12, 80 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ Text [ en-US ] = "Compress ~punctuation and Japanese Kana";
+ };
+ FixedLine GB_START_END
+ {
+ Pos = MAP_APPFONT ( 6, 96 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "First and last characters";
+ };
+ FixedText FT_LANGUAGE
+ {
+ Pos = MAP_APPFONT ( 12 , 109 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "~Language";
+ };
+ ListBox LB_LANGUAGE
+ {
+ Pos = MAP_APPFONT ( 95 , 107 ) ;
+ Size = MAP_APPFONT ( 80 , 48 ) ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ };
+ CheckBox CB_STANDARD
+ {
+ Pos = MAP_APPFONT ( 180, 109 ) ;
+ Size = MAP_APPFONT ( 74 , 10 ) ;
+ Text [ en-US ] = "~Default";
+ };
+ FixedText FT_START
+ {
+ Pos = MAP_APPFONT ( 12 , 125 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Not at start of line:";
+ };
+ Edit ED_START
+ {
+ Pos = MAP_APPFONT ( 95 , 123 ) ;
+ Size = MAP_APPFONT ( 159 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_END
+ {
+ Pos = MAP_APPFONT ( 12 , 141 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Not at end of line:";
+ };
+ Edit ED_END
+ {
+ Pos = MAP_APPFONT ( 95 , 139 ) ;
+ Size = MAP_APPFONT ( 159 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_HINT
+ {
+ Pos = MAP_APPFONT ( 12 , 155 ) ;
+ Size = MAP_APPFONT ( 242 , 8 ) ;
+ Text [ en-US ] = "Without user-defined line break symbols";
+ };
+ Text [ en-US ] = "Proxy";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx
new file mode 100644
index 000000000000..c32bffe730c9
--- /dev/null
+++ b/cui/source/options/optchart.cxx
@@ -0,0 +1,239 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optchart.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include <unotools/pathoptions.hxx>
+#include <cuires.hrc>
+#include "optchart.hxx"
+#include "optchart.hrc"
+#include <dialmgr.hxx>
+#include <svx/svxids.hrc> // for SID_SCH_EDITOPTIONS
+
+// ====================
+// class ChartColorLB
+// ====================
+void ChartColorLB::FillBox( const SvxChartColorTable & rTab )
+{
+ long nCount = rTab.size();
+ SetUpdateMode( FALSE );
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ Append( const_cast< XColorEntry * >( & rTab[ i ] ));
+ }
+ SetUpdateMode( TRUE );
+}
+
+
+// ====================
+// class SvxDefaultColorOptPage
+// ====================
+SvxDefaultColorOptPage::SvxDefaultColorOptPage( Window* pParent, const SfxItemSet& rInAttrs ) :
+
+ SfxTabPage( pParent, CUI_RES( RID_OPTPAGE_CHART_DEFCOLORS ), rInAttrs ),
+
+ aGbChartColors ( this, CUI_RES( FL_CHART_COLOR_LIST ) ),
+ aLbChartColors ( this, CUI_RES( LB_CHART_COLOR_LIST ) ),
+ aGbColorBox ( this, CUI_RES( FL_COLOR_BOX ) ),
+ aValSetColorBox ( this, CUI_RES( CT_COLOR_BOX ) ),
+ aPBDefault ( this, CUI_RES( PB_RESET_TO_DEFAULT ) )
+{
+ FreeResource();
+
+ aPBDefault.SetClickHdl( LINK( this, SvxDefaultColorOptPage, ResetToDefaults ) );
+ aLbChartColors.SetSelectHdl( LINK( this, SvxDefaultColorOptPage, ListClickedHdl ) );
+ aValSetColorBox.SetSelectHdl( LINK( this, SvxDefaultColorOptPage, BoxClickedHdl ) );
+
+ aValSetColorBox.SetStyle( aValSetColorBox.GetStyle()
+ | WB_VSCROLL | WB_ITEMBORDER | WB_NAMEFIELD );
+ aValSetColorBox.SetColCount( 8 );
+ aValSetColorBox.SetLineCount( 12 );
+ aValSetColorBox.SetExtraSpacing( 0 );
+ aValSetColorBox.Show();
+
+ pChartOptions = new SvxChartOptions;
+ pColorTab = new XColorTable( SvtPathOptions().GetPalettePath() );
+
+ const SfxPoolItem* pItem = NULL;
+ if ( rInAttrs.GetItemState( SID_SCH_EDITOPTIONS, FALSE, &pItem ) == SFX_ITEM_SET )
+ {
+ pColorConfig = SAL_STATIC_CAST( SvxChartColorTableItem*, pItem->Clone() );
+ }
+ else
+ {
+ SvxChartColorTable aTable;
+ aTable.useDefault();
+ pColorConfig = new SvxChartColorTableItem( SID_SCH_EDITOPTIONS, aTable );
+ pColorConfig->SetOptions( pChartOptions );
+ }
+
+ Construct();
+}
+
+SvxDefaultColorOptPage::~SvxDefaultColorOptPage()
+{
+ // save changes
+ pChartOptions->SetDefaultColors( pColorConfig->GetColorTable() );
+ pChartOptions->Commit();
+
+ delete pColorConfig;
+ delete pColorTab;
+ delete pChartOptions;
+}
+
+void SvxDefaultColorOptPage::Construct()
+{
+ if( pColorConfig )
+ aLbChartColors.FillBox( pColorConfig->GetColorTable() );
+
+ FillColorBox();
+
+ aLbChartColors.SelectEntryPos( 0 );
+ ListClickedHdl( &aLbChartColors );
+}
+
+
+SfxTabPage* __EXPORT SvxDefaultColorOptPage::Create( Window* pParent, const SfxItemSet& rAttrs )
+{
+ return new SvxDefaultColorOptPage( pParent, rAttrs );
+}
+
+BOOL __EXPORT SvxDefaultColorOptPage::FillItemSet( SfxItemSet& rOutAttrs )
+{
+ if( pColorConfig )
+ rOutAttrs.Put( *SAL_STATIC_CAST( SfxPoolItem*, pColorConfig ));
+
+ return TRUE;
+}
+
+void __EXPORT SvxDefaultColorOptPage::Reset( const SfxItemSet& )
+{
+ aLbChartColors.SelectEntryPos( 0 );
+ ListClickedHdl( &aLbChartColors );
+}
+
+void SvxDefaultColorOptPage::FillColorBox()
+{
+ if( !pColorTab ) return;
+
+ long nCount = pColorTab->Count();
+ XColorEntry* pColorEntry;
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ pColorEntry = pColorTab->GetColor( i );
+ aValSetColorBox.InsertItem( (USHORT) i + 1, pColorEntry->GetColor(), pColorEntry->GetName() );
+ }
+}
+
+
+long SvxDefaultColorOptPage::GetColorIndex( const Color& rCol )
+{
+ if( pColorTab )
+ {
+ long nCount = pColorTab->Count();
+ XColorEntry* pColorEntry;
+
+ for( long i = nCount - 1; i >= 0; i-- ) // default chart colors are at the end of the table
+ {
+ pColorEntry = pColorTab->GetColor( i );
+ if( pColorEntry && pColorEntry->GetColor() == rCol )
+ return SAL_STATIC_CAST( XPropertyTable*, pColorTab )->Get( pColorEntry->GetName() );
+ }
+ }
+ return -1L;
+}
+
+
+
+// --------------------
+// event handlers
+// --------------------
+
+// ResetToDefaults
+// ---------------
+
+IMPL_LINK( SvxDefaultColorOptPage, ResetToDefaults, void *, EMPTYARG )
+{
+ if( pColorConfig )
+ {
+ pColorConfig->GetColorTable().useDefault();
+
+ aLbChartColors.Clear();
+ aLbChartColors.FillBox( pColorConfig->GetColorTable() );
+
+ aLbChartColors.GetFocus();
+ }
+
+ return 0L;
+}
+
+// ListClickedHdl
+// --------------
+
+IMPL_LINK( SvxDefaultColorOptPage, ListClickedHdl, ChartColorLB*, pColorList )
+{
+ Color aCol = pColorList->GetSelectEntryColor();
+
+ long nIndex = GetColorIndex( aCol );
+
+ if( nIndex == -1 ) // not found
+ {
+ aValSetColorBox.SetNoSelection();
+ }
+ else
+ {
+ aValSetColorBox.SelectItem( (USHORT)nIndex + 1 ); // ValueSet is 1-based
+ }
+
+ return 0L;
+}
+
+// BoxClickedHdl
+// -------------
+
+IMPL_LINK( SvxDefaultColorOptPage, BoxClickedHdl, ValueSet*, EMPTYARG )
+{
+ USHORT nIdx = aLbChartColors.GetSelectEntryPos();
+ if( nIdx != LISTBOX_ENTRY_NOTFOUND )
+ {
+ XColorEntry aEntry( aValSetColorBox.GetItemColor( aValSetColorBox.GetSelectItemId() ),
+ aLbChartColors.GetSelectEntry() );
+
+ aLbChartColors.Modify( & aEntry, nIdx );
+ pColorConfig->ReplaceColorByIndex( nIdx, aEntry );
+
+ aLbChartColors.SelectEntryPos( nIdx ); // reselect entry
+ }
+
+ return 0L;
+}
+
diff --git a/cui/source/options/optchart.hrc b/cui/source/options/optchart.hrc
new file mode 100644
index 000000000000..ac42f857f8ea
--- /dev/null
+++ b/cui/source/options/optchart.hrc
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optchart.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// tab page for setting the default colors used for new charts
+
+#define FL_CHART_COLOR_LIST 1
+#define LB_CHART_COLOR_LIST 2
+
+#define FL_COLOR_BOX 3
+#define CT_COLOR_BOX 4
+
+#define PB_RESET_TO_DEFAULT 5
+
diff --git a/cui/source/options/optchart.hxx b/cui/source/options/optchart.hxx
new file mode 100644
index 000000000000..9316d2a8ea85
--- /dev/null
+++ b/cui/source/options/optchart.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optchart.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_OPTCHART_HXX
+#define _SVX_OPTCHART_HXX
+
+// header for SfxTabPage
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+// header for ValueSet
+#include <svtools/valueset.hxx>
+// header for ColorLB
+#include <svx/dlgctrl.hxx>
+// header for PushButton
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+// header for XColorTable
+#include <svx/xtable.hxx>
+
+#include "cfgchart.hxx"
+
+class ChartColorLB : public ColorLB
+{
+public:
+ ChartColorLB( Window* pParent, ResId Id ) : ColorLB( pParent, Id ) {}
+ ChartColorLB( Window* pParent, WinBits aWB ) : ColorLB( pParent, aWB ) {}
+
+ void FillBox( const SvxChartColorTable & rTab );
+};
+
+
+class SvxDefaultColorOptPage : public SfxTabPage
+{
+private:
+ FixedLine aGbChartColors;
+ ChartColorLB aLbChartColors;
+ FixedLine aGbColorBox;
+ ValueSet aValSetColorBox;
+ PushButton aPBDefault;
+
+ SvxChartOptions* pChartOptions;
+ SvxChartColorTableItem* pColorConfig;
+ XColorTable* pColorTab;
+
+ DECL_LINK( ResetToDefaults, void * );
+ DECL_LINK( ListClickedHdl, ChartColorLB * );
+ DECL_LINK( BoxClickedHdl, ValueSet * );
+
+ void FillColorBox();
+ long GetColorIndex( const Color& rCol );
+
+public:
+ SvxDefaultColorOptPage( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~SvxDefaultColorOptPage();
+
+ void Construct();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual BOOL FillItemSet( SfxItemSet& rOutAttrs );
+ virtual void Reset( const SfxItemSet& rInAttrs );
+};
+
+#endif // _SVX_OPTCHART_HXX
+
diff --git a/cui/source/options/optchart.src b/cui/source/options/optchart.src
new file mode 100644
index 000000000000..1008f5383a11
--- /dev/null
+++ b/cui/source/options/optchart.src
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optchart.src,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "optchart.hrc"
+#include <cuires.hrc>
+#include "helpid.hrc"
+
+// tab page for setting the default colors used for new charts
+
+TabPage RID_OPTPAGE_CHART_DEFCOLORS
+{
+ HelpID = HID_OPTIONS_CHART_DEFCOLORS;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Default Colors";
+ FixedLine FL_CHART_COLOR_LIST
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Chart colors";
+ Text [ x-comment ] = " ";
+ };
+ ListBox LB_CHART_COLOR_LIST
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 12 , 15 );
+ Size = MAP_APPFONT ( 68 , 152 );
+ DropDown = FALSE;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_COLOR_BOX
+ {
+ Pos = MAP_APPFONT ( 92 , 3 ) ;
+ Size = MAP_APPFONT ( 106 , 8 ) ;
+ Text [ en-US ] = "Color table" ;
+ Text [ x-comment ] = " ";
+ };
+ Control CT_COLOR_BOX
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 98 , 15 );
+ Size = MAP_APPFONT ( 94 , 152 );
+ TabStop = TRUE ;
+ };
+ PushButton PB_RESET_TO_DEFAULT
+ {
+ Pos = MAP_APPFONT ( 204 , 165 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Default";
+ Text [ x-comment ] = " ";
+ };
+};
+
+String RID_SVXSTR_DIAGRAM_ROW
+{
+ // $(ROW) can be a number or the caption of the row in quotes
+
+ Text [ en-US ] = "Data Series $(ROW)" ;
+};
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
new file mode 100644
index 000000000000..6d451c53cab9
--- /dev/null
+++ b/cui/source/options/optcolor.cxx
@@ -0,0 +1,1633 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optcolor.cxx,v $
+ * $Revision: 1.18.256.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <svtools/colorcfg.hxx>
+#include <svtools/extcolorcfg.hxx>
+#include <svtools/headbar.hxx>
+#include <svtools/ctrlbox.hxx>
+#include <vcl/scrbar.hxx>
+#include <svx/xtable.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <unotools/pathoptions.hxx>
+#include <vcl/msgbox.hxx>
+#include <boost/shared_ptr.hpp>
+#include <svx/svxdlg.hxx>
+#include <helpid.hrc>
+#include <dialmgr.hxx>
+#include "optcolor.hxx"
+#include <cuires.hrc>
+#include "optcolor.hrc"
+#include <svx/dlgutil.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::svtools;
+
+#define GROUP_COUNT 7
+#define GROUP_UNKNOWN -1
+#define GROUP_GENERAL 0
+#define GROUP_WRITER 1
+#define GROUP_HTML 2
+#define GROUP_CALC 3
+#define GROUP_DRAW 4
+#define GROUP_BASIC 5
+#define GROUP_SQL 6
+
+/* -----------------------------2002/06/26 10:48------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+class SvxExtFixedText_Impl : public FixedText
+{
+private:
+ long m_nGroupHeight;
+
+protected:
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+public:
+ SvxExtFixedText_Impl(Window* pParent, const ResId& rResId) :
+ FixedText(pParent, rResId), m_nGroupHeight(0) {}
+
+ inline long GetGroupHeight() { return m_nGroupHeight; }
+ inline void SetGroupHeight( long _nHeight ) { m_nGroupHeight = _nHeight; }
+};
+
+/* -----------------------------25.03.2002 15:48------------------------------
+
+ ---------------------------------------------------------------------------*/
+class ColorConfigCtrl_Impl;
+class ColorConfigWindow_Impl : public Window
+{
+ friend class ColorConfigCtrl_Impl;
+ Window aGeneralBackWN;
+ SvxExtFixedText_Impl aGeneralFT;
+ FixedText aDocColorFT;
+ ColorListBox aDocColorLB;
+ Window aDocColorWN;
+ CheckBox aDocBoundCB;
+ ColorListBox aDocBoundLB;
+ Window aDocBoundWN;
+ FixedText aAppBackFT;
+ ColorListBox aAppBackLB;
+ Window aAppBackWN;
+ CheckBox aObjBoundCB;
+ ColorListBox aObjBoundLB;
+ Window aObjBoundWN;
+ CheckBox aTableBoundCB;
+ ColorListBox aTableBoundLB;
+ Window aTableBoundWN;
+ FixedText aFontColorFT;
+ ColorListBox aFontColorLB;
+ Window aFontColorWN;
+ CheckBox aLinksCB;
+ ColorListBox aLinksLB;
+ Window aLinksWN;
+ CheckBox aLinksVisitedCB;
+ ColorListBox aLinksVisitedLB;
+ Window aLinksVisitedWN;
+ FixedText aSpellFT;
+ ColorListBox aSpellLB;
+ Window aSpellWN;
+ FixedText aSmarttagsFT;
+ ColorListBox aSmarttagsLB;
+ Window aSmarttagsWN;
+ Window aWriterBackWN;
+ SvxExtFixedText_Impl aWriterFT;
+ FixedText aWrtTextGridFT;
+ ColorListBox aWrtTextGridLB;
+ Window aWrtTextGridWN;
+ CheckBox aWrtFieldCB;
+ ColorListBox aWrtFieldLB;
+ Window aWrtFieldWN;
+ CheckBox aWrtIdxShadingBackCB;
+ ColorListBox aWrtIdxShadingBackLB;
+ Window aWrtIdxShadingBackWN;
+ FixedText aWrtScriptIndicatorFT;
+ ColorListBox aWrtScriptIndicatorLB;
+ Window aWrtScriptIndicatorWN;
+ CheckBox aWrtSectionBoundCB;
+ ColorListBox aWrtSectionBoundLB;
+ Window aWrtSectionBoundWN;
+ FixedText aWrtPageBreaksFT;
+ ColorListBox aWrtPageBreaksLB;
+ Window aWrtPageBreaksWN;
+ FixedText aWrtDirectCrsrFT;
+ ColorListBox aWrtDirectCrsrLB;
+ Window aWrtDirectCrsrWN;
+ Window aHTMLBackWN;
+ SvxExtFixedText_Impl aHTMLFT;
+ FixedText aHTMLSGMLFT;
+ ColorListBox aHTMLSGMLLB;
+ Window aHTMLSGMLWN;
+ FixedText aHTMLCommentFT;
+ ColorListBox aHTMLCommentLB;
+ Window aHTMLCommentWN;
+ FixedText aHTMLKeywdFT;
+ ColorListBox aHTMLKeywdLB;
+ Window aHTMLKeywdWN;
+ FixedText aHTMLUnknownFT;
+ ColorListBox aHTMLUnknownLB;
+ Window aHTMLUnknownWN;
+ Window aCalcBackWN;
+ SvxExtFixedText_Impl aCalcFT;
+ FixedText aCalcGridFT;
+ ColorListBox aCalcGridLB;
+ Window aCalcGridWN;
+ FixedText aCalcPageBreakFT;
+ ColorListBox aCalcPageBreakLB;
+ Window aCalcPageBreakWN;
+ FixedText aCalcPageBreakManualFT;
+ ColorListBox aCalcPageBreakManualLB;
+ Window aCalcPageBreakManualWN;
+ FixedText aCalcPageBreakAutoFT;
+ ColorListBox aCalcPageBreakAutoLB;
+ Window aCalcPageBreakAutoWN;
+ FixedText aCalcDetectiveFT;
+ ColorListBox aCalcDetectiveLB;
+ Window aCalcDetectiveWN;
+ FixedText aCalcDetectiveErrorFT;
+ ColorListBox aCalcDetectiveErrorLB;
+ Window aCalcDetectiveErrorWN;
+ FixedText aCalcReferenceFT;
+ ColorListBox aCalcReferenceLB;
+ Window aCalcReferenceWN;
+ FixedText aCalcNotesBackFT;
+ ColorListBox aCalcNotesBackLB;
+ Window aCalcNotesBackWN;
+ Window aDrawBackWN;
+ SvxExtFixedText_Impl aDrawFT;
+ FixedText aDrawGridFT;
+ ColorListBox aDrawGridLB;
+ Window aDrawGridWN;
+ Window aBasicBackWN;
+ SvxExtFixedText_Impl aBasicFT;
+ FixedText aBasicIdentifierFT;
+ ColorListBox aBasicIdentifierLB;
+ Window aBasicIdentifierWN;
+ FixedText aBasicCommentFT;
+ ColorListBox aBasicCommentLB;
+ Window aBasicCommentWN;
+ FixedText aBasicNumberFT;
+ ColorListBox aBasicNumberLB;
+ Window aBasicNumberWN;
+ FixedText aBasicStringFT;
+ ColorListBox aBasicStringLB;
+ Window aBasicStringWN;
+ FixedText aBasicOperatorFT;
+ ColorListBox aBasicOperatorLB;
+ Window aBasicOperatorWN;
+ FixedText aBasicKeywordFT;
+ ColorListBox aBasicKeywordLB;
+ Window aBasicKeywordWN;
+ FixedText aBasicErrorFT;
+ ColorListBox aBasicErrorLB;
+ Window aBasicErrorWN;
+ Window aSQLBackWN;
+ SvxExtFixedText_Impl aSQLFT;
+ FixedText aSQLIdentifierFT;
+ ColorListBox aSQLIdentifierLB;
+ Window aSQLIdentifierWN;
+ FixedText aSQLNumberFT;
+ ColorListBox aSQLNumberLB;
+ Window aSQLNumberWN;
+ FixedText aSQLStringFT;
+ ColorListBox aSQLStringLB;
+ Window aSQLStringWN;
+ FixedText aSQLOperatorFT;
+ ColorListBox aSQLOperatorLB;
+ Window aSQLOperatorWN;
+ FixedText aSQLKeywordFT;
+ ColorListBox aSQLKeywordLB;
+ Window aSQLKeywordWN;
+ FixedText aSQLParameterFT;
+ ColorListBox aSQLParameterLB;
+ Window aSQLParameterWN;
+ FixedText aSQLCommentFT;
+ ColorListBox aSQLCommentLB;
+ Window aSQLCommentWN;
+
+ ::std::vector< SvxExtFixedText_Impl*> aChapters;
+ ::std::vector< Window* > aChapterWins;
+ ::std::vector< FixedText* > aFixedTexts;
+ ::std::vector< CheckBox* > aCheckBoxes;
+ ::std::vector< ColorListBox* > aColorBoxes;
+ ::std::vector< Window* > aWindows; // [ColorConfigEntryCount]
+ ::std::vector< ::boost::shared_ptr<SvxExtFixedText_Impl> > m_aExtensionTitles;
+
+ SvtModuleOptions m_aModuleOptions;
+
+ void SetNewPosition( sal_Int32 _nFeature, Window* _pWin );
+
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+public:
+ ColorConfigWindow_Impl(Window* pParent, const ResId& rResId);
+ ~ColorConfigWindow_Impl();
+
+ inline const SvtModuleOptions& GetModuleOptions() const { return m_aModuleOptions; }
+};
+
+sal_Bool lcl_isGroupVisible( sal_Int32 _nGroup, const SvtModuleOptions& _rModOptions )
+{
+ sal_Bool bRet = sal_True;
+
+ switch ( _nGroup )
+ {
+ case GROUP_WRITER :
+ case GROUP_HTML :
+ {
+ bRet = _rModOptions.IsModuleInstalled( SvtModuleOptions::E_SWRITER );
+ break;
+ }
+
+ case GROUP_CALC :
+ {
+ bRet = _rModOptions.IsModuleInstalled( SvtModuleOptions::E_SCALC );
+ break;
+ }
+
+ case GROUP_DRAW :
+ {
+ bRet = ( _rModOptions.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) ||
+ _rModOptions.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) );
+ break;
+ }
+ case GROUP_SQL :
+ {
+ bRet = _rModOptions.IsModuleInstalled( SvtModuleOptions::E_SDATABASE );
+ break;
+ }
+ }
+
+ return bRet;
+}
+
+sal_Int16 lcl_getGroup( sal_Int32 _nFeature )
+{
+ if ( _nFeature >= ColorConfigEntryCount )
+ return GROUP_COUNT; // feature of an extension
+
+ sal_Int16 nRet = GROUP_UNKNOWN;
+
+ switch ( _nFeature )
+ {
+ case DOCCOLOR :
+ case DOCBOUNDARIES :
+ case APPBACKGROUND :
+ case OBJECTBOUNDARIES :
+ case TABLEBOUNDARIES :
+ case FONTCOLOR :
+ case LINKS :
+ case LINKSVISITED :
+ case ANCHOR :
+ case SPELL :
+ case SMARTTAGS :
+ {
+ nRet = GROUP_GENERAL;
+ break;
+ }
+
+ case WRITERTEXTGRID :
+ case WRITERFIELDSHADINGS :
+ case WRITERIDXSHADINGS :
+ case WRITERDIRECTCURSOR :
+ case WRITERSCRIPTINDICATOR :
+ case WRITERSECTIONBOUNDARIES :
+ case WRITERPAGEBREAKS :
+ {
+ nRet = GROUP_WRITER;
+ break;
+ }
+
+ case HTMLSGML :
+ case HTMLCOMMENT :
+ case HTMLKEYWORD :
+ case HTMLUNKNOWN :
+ {
+ nRet = GROUP_HTML;
+ break;
+ }
+
+ case CALCGRID :
+ case CALCPAGEBREAK :
+ case CALCPAGEBREAKMANUAL :
+ case CALCPAGEBREAKAUTOMATIC :
+ case CALCDETECTIVE :
+ case CALCDETECTIVEERROR :
+ case CALCREFERENCE :
+ case CALCNOTESBACKGROUND :
+ {
+ nRet = GROUP_CALC;
+ break;
+ }
+
+ case DRAWGRID :
+ case DRAWDRAWING :
+ case DRAWFILL :
+ {
+ nRet = GROUP_DRAW;
+ break;
+ }
+
+ case BASICIDENTIFIER :
+ case BASICCOMMENT :
+ case BASICNUMBER :
+ case BASICSTRING :
+ case BASICOPERATOR :
+ case BASICKEYWORD :
+ case BASICERROR :
+ {
+ nRet = GROUP_BASIC;
+ break;
+ }
+ case SQLIDENTIFIER :
+ case SQLNUMBER:
+ case SQLSTRING:
+ case SQLOPERATOR:
+ case SQLKEYWORD:
+ case SQLPARAMETER:
+ case SQLCOMMENT:
+ {
+ nRet = GROUP_SQL;
+ break;
+ }
+ }
+ return nRet;
+}
+
+/* -----------------------------25.03.2002 17:05------------------------------
+
+ ---------------------------------------------------------------------------*/
+ColorConfigWindow_Impl::ColorConfigWindow_Impl(Window* pParent, const ResId& rResId) :
+ Window(pParent, rResId),
+ aGeneralBackWN(this),
+ aGeneralFT(&aGeneralBackWN, ResId( FT_GENERAL, *rResId.GetResMgr() )),
+ aDocColorFT(this, ResId( FT_DOCCOLOR, *rResId.GetResMgr())),
+ aDocColorLB(this, ResId( LB_DOCCOLOR, *rResId.GetResMgr())),
+ aDocColorWN(this, ResId( WN_DOCCOLOR, *rResId.GetResMgr())),
+ aDocBoundCB(this, ResId( CB_DOCBOUND, *rResId.GetResMgr())),
+ aDocBoundLB(this, ResId( LB_DOCBOUND, *rResId.GetResMgr())),
+ aDocBoundWN(this, ResId( WN_DOCBOUND, *rResId.GetResMgr())),
+ aAppBackFT(this, ResId( FT_APPBACKGROUND, *rResId.GetResMgr())),
+ aAppBackLB(this, ResId( LB_APPBACKGROUND, *rResId.GetResMgr())),
+ aAppBackWN(this, ResId( WN_APPBACKGROUND, *rResId.GetResMgr())),
+ aObjBoundCB(this, ResId( CB_OBJECTBOUNDARIES, *rResId.GetResMgr())),
+ aObjBoundLB(this, ResId( LB_OBJECTBOUNDARIES, *rResId.GetResMgr())),
+ aObjBoundWN(this, ResId( WN_OBJECTBOUNDARIES, *rResId.GetResMgr())),
+ aTableBoundCB(this, ResId( CB_TABLEBOUNDARIES, *rResId.GetResMgr())),
+ aTableBoundLB(this, ResId( LB_TABLEBOUNDARIES, *rResId.GetResMgr())),
+ aTableBoundWN(this, ResId( WN_TABLEBOUNDARIES, *rResId.GetResMgr())),
+ aFontColorFT(this, ResId( FT_FONTCOLOR, *rResId.GetResMgr())),
+ aFontColorLB(this, ResId( LB_FONTCOLOR, *rResId.GetResMgr())),
+ aFontColorWN(this, ResId( WN_FONTCOLOR, *rResId.GetResMgr())),
+ aLinksCB(this, ResId( CB_LINKS, *rResId.GetResMgr())),
+ aLinksLB(this, ResId( LB_LINKS, *rResId.GetResMgr())),
+ aLinksWN(this, ResId( WN_LINKS, *rResId.GetResMgr())),
+ aLinksVisitedCB(this, ResId( CB_LINKSVISITED, *rResId.GetResMgr())),
+ aLinksVisitedLB(this, ResId( LB_LINKSVISITED, *rResId.GetResMgr())),
+ aLinksVisitedWN(this, ResId( WN_LINKSVISITED, *rResId.GetResMgr())),
+ aSpellFT(this, ResId( FT_SPELL, *rResId.GetResMgr())),
+ aSpellLB(this, ResId( LB_SPELL, *rResId.GetResMgr())),
+ aSpellWN(this, ResId( WN_SPELL, *rResId.GetResMgr())),
+ aSmarttagsFT(this, ResId( FT_SMARTTAGS, *rResId.GetResMgr() )),
+ aSmarttagsLB(this, ResId( LB_SMARTTAGS, *rResId.GetResMgr() )),
+ aSmarttagsWN(this, ResId( WN_SMARTTAGS, *rResId.GetResMgr() )),
+ aWriterBackWN(this),
+ aWriterFT(this, ResId(FT_WRITER, *rResId.GetResMgr())),
+ aWrtTextGridFT(this, ResId( FT_WRITERTEXTGRID, *rResId.GetResMgr())),
+ aWrtTextGridLB(this, ResId( LB_WRITERTEXTGRID, *rResId.GetResMgr())),
+ aWrtTextGridWN(this, ResId( WN_WRITERTEXTGRID, *rResId.GetResMgr())),
+ aWrtFieldCB(this, ResId( CB_WRITERFIELDSHADINGS, *rResId.GetResMgr())),
+ aWrtFieldLB(this, ResId( LB_WRITERFIELDSHADINGS, *rResId.GetResMgr())),
+ aWrtFieldWN(this, ResId( WN_WRITERFIELDSHADINGS, *rResId.GetResMgr())),
+ aWrtIdxShadingBackCB(this, ResId( CB_WRITERIDXSHADINGS, *rResId.GetResMgr())),
+ aWrtIdxShadingBackLB(this, ResId( LB_WRITERIDXSHADINGS, *rResId.GetResMgr())),
+ aWrtIdxShadingBackWN(this, ResId( WN_WRITERIDXSHADINGS, *rResId.GetResMgr())),
+ aWrtScriptIndicatorFT(this, ResId( FT_WRITERSCRIPTINDICATOR, *rResId.GetResMgr())),
+ aWrtScriptIndicatorLB(this, ResId( LB_WRITERSCRIPTINDICATOR, *rResId.GetResMgr())),
+ aWrtScriptIndicatorWN(this, ResId( WN_WRITERSCRIPTINDICATOR, *rResId.GetResMgr())),
+ aWrtSectionBoundCB(this, ResId( CB_WRITERSECTIONBOUNDARIES, *rResId.GetResMgr())),
+ aWrtSectionBoundLB(this, ResId( LB_WRITERSECTIONBOUNDARIES, *rResId.GetResMgr())),
+ aWrtSectionBoundWN(this, ResId( WN_WRITERSECTIONBOUNDARIES, *rResId.GetResMgr())),
+ aWrtPageBreaksFT(this, ResId( FT_WRITERPAGEBREAKS, *rResId.GetResMgr())),
+ aWrtPageBreaksLB(this, ResId( LB_WRITERPAGEBREAKS, *rResId.GetResMgr())),
+ aWrtPageBreaksWN(this, ResId( WN_WRITERPAGEBREAKS, *rResId.GetResMgr())),
+ aWrtDirectCrsrFT(this, ResId( FT_WRITERDIRECTCURSOR, *rResId.GetResMgr())),
+ aWrtDirectCrsrLB(this, ResId( LB_WRITERDIRECTCURSOR, *rResId.GetResMgr())),
+ aWrtDirectCrsrWN(this, ResId( WN_WRITERDIRECTCURSOR, *rResId.GetResMgr())),
+ aHTMLBackWN(this),
+ aHTMLFT(this, ResId( FT_HTML, *rResId.GetResMgr())),
+ aHTMLSGMLFT(this, ResId( FT_HTMLSGML, *rResId.GetResMgr())),
+ aHTMLSGMLLB(this, ResId( LB_HTMLSGML, *rResId.GetResMgr())),
+ aHTMLSGMLWN(this, ResId( WN_HTMLSGML, *rResId.GetResMgr())),
+ aHTMLCommentFT(this, ResId( FT_HTMLCOMMENT, *rResId.GetResMgr())),
+ aHTMLCommentLB(this, ResId( LB_HTMLCOMMENT, *rResId.GetResMgr())),
+ aHTMLCommentWN(this, ResId( WN_HTMLCOMMENT, *rResId.GetResMgr())),
+ aHTMLKeywdFT(this, ResId( FT_HTMLKEYWORD, *rResId.GetResMgr())),
+ aHTMLKeywdLB(this, ResId( LB_HTMLKEYWORD, *rResId.GetResMgr())),
+ aHTMLKeywdWN(this, ResId( WN_HTMLKEYWORD, *rResId.GetResMgr())),
+ aHTMLUnknownFT(this, ResId( FT_HTMLUNKNOWN, *rResId.GetResMgr())),
+ aHTMLUnknownLB(this, ResId( LB_HTMLUNKNOWN, *rResId.GetResMgr())),
+ aHTMLUnknownWN(this, ResId( WN_HTMLUNKNOWN, *rResId.GetResMgr())),
+ aCalcBackWN(this),
+ aCalcFT(this, ResId( FT_CALC, *rResId.GetResMgr())),
+ aCalcGridFT(this, ResId( FT_CALCGRID, *rResId.GetResMgr())),
+ aCalcGridLB(this, ResId( LB_CALCGRID, *rResId.GetResMgr())),
+ aCalcGridWN(this, ResId( WN_CALCGRID, *rResId.GetResMgr())),
+ aCalcPageBreakFT(this, ResId( FT_CALCPAGEBREAK, *rResId.GetResMgr())),
+ aCalcPageBreakLB(this, ResId( LB_CALCPAGEBREAK, *rResId.GetResMgr())),
+ aCalcPageBreakWN(this, ResId( WN_CALCPAGEBREAK, *rResId.GetResMgr())),
+ aCalcPageBreakManualFT(this, ResId( FT_CALCPAGEBREAKMANUAL, *rResId.GetResMgr())),
+ aCalcPageBreakManualLB(this, ResId( LB_CALCPAGEBREAKMANUAL, *rResId.GetResMgr())),
+ aCalcPageBreakManualWN(this, ResId( WN_CALCPAGEBREAKMANUAL, *rResId.GetResMgr())),
+ aCalcPageBreakAutoFT(this, ResId( FT_CALCPAGEBREAKAUTO, *rResId.GetResMgr())),
+ aCalcPageBreakAutoLB(this, ResId( LB_CALCPAGEBREAKAUTO, *rResId.GetResMgr())),
+ aCalcPageBreakAutoWN(this, ResId( WN_CALCPAGEBREAKAUTO, *rResId.GetResMgr())),
+ aCalcDetectiveFT(this, ResId( FT_CALCDETECTIVE, *rResId.GetResMgr())),
+ aCalcDetectiveLB(this, ResId( LB_CALCDETECTIVE, *rResId.GetResMgr())),
+ aCalcDetectiveWN(this, ResId( WN_CALCDETECTIVE, *rResId.GetResMgr())),
+ aCalcDetectiveErrorFT(this, ResId( FT_CALCDETECTIVEERROR, *rResId.GetResMgr())),
+ aCalcDetectiveErrorLB(this, ResId( LB_CALCDETECTIVEERROR, *rResId.GetResMgr())),
+ aCalcDetectiveErrorWN(this, ResId( WN_CALCDETECTIVEERROR, *rResId.GetResMgr())),
+ aCalcReferenceFT(this, ResId( FT_CALCREFERENCE, *rResId.GetResMgr())),
+ aCalcReferenceLB(this, ResId( LB_CALCREFERENCE, *rResId.GetResMgr())),
+ aCalcReferenceWN(this, ResId( WN_CALCREFERENCE, *rResId.GetResMgr())),
+ aCalcNotesBackFT(this, ResId( FT_CALCNOTESBACKGROUND, *rResId.GetResMgr())),
+ aCalcNotesBackLB(this, ResId( LB_CALCNOTESBACKGROUND, *rResId.GetResMgr())),
+ aCalcNotesBackWN(this, ResId( WN_CALCNOTESBACKGROUND, *rResId.GetResMgr())),
+ aDrawBackWN(this),
+ aDrawFT(this, ResId( FT_DRAW, *rResId.GetResMgr())),
+ aDrawGridFT(this, ResId( FT_DRAWGRID, *rResId.GetResMgr())),
+ aDrawGridLB(this, ResId( LB_DRAWGRID, *rResId.GetResMgr())),
+ aDrawGridWN(this, ResId( WN_DRAWGRID, *rResId.GetResMgr())),
+ aBasicBackWN(this),
+ aBasicFT(this, ResId( FT_BASIC, *rResId.GetResMgr())),
+ aBasicIdentifierFT(this, ResId( FT_BASICIDENTIFIER, *rResId.GetResMgr())),
+ aBasicIdentifierLB(this, ResId( LB_BASICIDENTIFIER, *rResId.GetResMgr())),
+ aBasicIdentifierWN(this, ResId( WN_BASICIDENTIFIER, *rResId.GetResMgr())),
+ aBasicCommentFT(this, ResId( FT_BASICCOMMENT, *rResId.GetResMgr())),
+ aBasicCommentLB(this, ResId( LB_BASICCOMMENT, *rResId.GetResMgr())),
+ aBasicCommentWN(this, ResId( WN_BASICCOMMENT, *rResId.GetResMgr())),
+ aBasicNumberFT(this, ResId( FT_BASICNUMBER, *rResId.GetResMgr())),
+ aBasicNumberLB(this, ResId( LB_BASICNUMBER, *rResId.GetResMgr())),
+ aBasicNumberWN(this, ResId( WN_BASICNUMBER, *rResId.GetResMgr())),
+ aBasicStringFT(this, ResId( FT_BASICSTRING, *rResId.GetResMgr())),
+ aBasicStringLB(this, ResId( LB_BASICSTRING, *rResId.GetResMgr())),
+ aBasicStringWN(this, ResId( WN_BASICSTRING, *rResId.GetResMgr())),
+ aBasicOperatorFT(this, ResId( FT_BASICOPERATOR, *rResId.GetResMgr())),
+ aBasicOperatorLB(this, ResId( LB_BASICOPERATOR, *rResId.GetResMgr())),
+ aBasicOperatorWN(this, ResId( WN_BASICOPERATOR, *rResId.GetResMgr())),
+ aBasicKeywordFT(this, ResId( FT_BASICKEYWORD, *rResId.GetResMgr())),
+ aBasicKeywordLB(this, ResId( LB_BASICKEYWORD, *rResId.GetResMgr())),
+ aBasicKeywordWN(this, ResId( WN_BASICKEYWORD, *rResId.GetResMgr())),
+ aBasicErrorFT(this, ResId( FT_BASICERROR, *rResId.GetResMgr())),
+ aBasicErrorLB(this, ResId( LB_BASICERROR, *rResId.GetResMgr())),
+ aBasicErrorWN(this, ResId( WN_BASICERROR, *rResId.GetResMgr())),
+
+ aSQLBackWN(this),
+ aSQLFT(this, ResId( FT_SQL_COMMAND, *rResId.GetResMgr())),
+ aSQLIdentifierFT(this, ResId( FT_SQLIDENTIFIER, *rResId.GetResMgr())),
+ aSQLIdentifierLB(this, ResId( LB_SQLIDENTIFIER, *rResId.GetResMgr())),
+ aSQLIdentifierWN(this, ResId( WN_SQLIDENTIFIER, *rResId.GetResMgr())),
+
+ aSQLNumberFT(this, ResId( FT_SQLNUMBER, *rResId.GetResMgr())),
+ aSQLNumberLB(this, ResId( LB_SQLNUMBER, *rResId.GetResMgr())),
+ aSQLNumberWN(this, ResId( WN_SQLNUMBER, *rResId.GetResMgr())),
+
+ aSQLStringFT(this, ResId( FT_SQLSTRING, *rResId.GetResMgr())),
+ aSQLStringLB(this, ResId( LB_SQLSTRING, *rResId.GetResMgr())),
+ aSQLStringWN(this, ResId( WN_SQLSTRING, *rResId.GetResMgr())),
+
+ aSQLOperatorFT(this, ResId( FT_SQLOPERATOR, *rResId.GetResMgr())),
+ aSQLOperatorLB(this, ResId( LB_SQLOPERATOR, *rResId.GetResMgr())),
+ aSQLOperatorWN(this, ResId( WN_SQLOPERATOR, *rResId.GetResMgr())),
+
+ aSQLKeywordFT(this, ResId( FT_SQLKEYWORD, *rResId.GetResMgr())),
+ aSQLKeywordLB(this, ResId( LB_SQLKEYWORD, *rResId.GetResMgr())),
+ aSQLKeywordWN(this, ResId( WN_SQLKEYWORD, *rResId.GetResMgr())),
+
+ aSQLParameterFT(this, ResId( FT_SQLPARAMETER, *rResId.GetResMgr())),
+ aSQLParameterLB(this, ResId( LB_SQLPARAMETER, *rResId.GetResMgr())),
+ aSQLParameterWN(this, ResId( WN_SQLPARAMETER, *rResId.GetResMgr())),
+
+ aSQLCommentFT(this, ResId( FT_SQLCOMMENT, *rResId.GetResMgr())),
+ aSQLCommentLB(this, ResId( LB_SQLCOMMENT, *rResId.GetResMgr())),
+ aSQLCommentWN(this, ResId( WN_SQLCOMMENT, *rResId.GetResMgr()))
+{
+ aFixedTexts.resize(ColorConfigEntryCount);
+ aCheckBoxes.resize(ColorConfigEntryCount);
+ aColorBoxes.resize(ColorConfigEntryCount);
+ aWindows.resize(ColorConfigEntryCount);
+
+ aFixedTexts[DOCCOLOR ] = &aDocColorFT;
+ aCheckBoxes[DOCBOUNDARIES ] = &aDocBoundCB ;
+ aFixedTexts[APPBACKGROUND ] = &aAppBackFT;
+ aCheckBoxes[OBJECTBOUNDARIES ] = &aObjBoundCB ;
+ aCheckBoxes[TABLEBOUNDARIES ] = &aTableBoundCB ;
+ aFixedTexts[FONTCOLOR ] = &aFontColorFT ;
+ aCheckBoxes[LINKS ] = &aLinksCB ;
+ aCheckBoxes[LINKSVISITED ] = &aLinksVisitedCB ;
+ aFixedTexts[SPELL ]=& aSpellFT;
+ aFixedTexts[SMARTTAGS ]=& aSmarttagsFT;
+ aFixedTexts[WRITERTEXTGRID ]=& aWrtTextGridFT;
+ aCheckBoxes[WRITERFIELDSHADINGS ] = &aWrtFieldCB ;
+ aCheckBoxes[WRITERIDXSHADINGS ] = &aWrtIdxShadingBackCB ;
+ aFixedTexts[WRITERDIRECTCURSOR ]=& aWrtDirectCrsrFT;
+ aFixedTexts[WRITERSCRIPTINDICATOR ]=& aWrtScriptIndicatorFT;
+ aCheckBoxes[WRITERSECTIONBOUNDARIES ]=& aWrtSectionBoundCB;
+ aFixedTexts[HTMLSGML ]=& aHTMLSGMLFT;
+ aFixedTexts[HTMLCOMMENT ]=& aHTMLCommentFT;
+ aFixedTexts[HTMLKEYWORD ]=& aHTMLKeywdFT;
+ aFixedTexts[HTMLUNKNOWN ]=& aHTMLUnknownFT;
+ aFixedTexts[CALCGRID ] = &aCalcGridFT ;
+ aFixedTexts[CALCPAGEBREAK ] = &aCalcPageBreakFT;
+ aFixedTexts[CALCPAGEBREAKMANUAL ] = &aCalcPageBreakManualFT;
+ aFixedTexts[CALCPAGEBREAKAUTOMATIC ] = &aCalcPageBreakAutoFT;
+ aFixedTexts[CALCDETECTIVE ]=& aCalcDetectiveFT;
+ aFixedTexts[CALCDETECTIVEERROR ]=& aCalcDetectiveErrorFT;
+ aFixedTexts[CALCREFERENCE ]=& aCalcReferenceFT;
+ aFixedTexts[CALCNOTESBACKGROUND ]=& aCalcNotesBackFT;
+ aFixedTexts[WRITERPAGEBREAKS] = &aWrtPageBreaksFT;
+ aFixedTexts[DRAWGRID ] = &aDrawGridFT ;
+ aFixedTexts[BASICIDENTIFIER ] = &aBasicIdentifierFT;
+ aFixedTexts[BASICCOMMENT ] = &aBasicCommentFT;
+ aFixedTexts[BASICNUMBER ] = &aBasicNumberFT;
+ aFixedTexts[BASICSTRING ] = &aBasicStringFT;
+ aFixedTexts[BASICOPERATOR ] = &aBasicOperatorFT;
+ aFixedTexts[BASICKEYWORD ] = &aBasicKeywordFT;
+ aFixedTexts[BASICERROR ] = &aBasicErrorFT;
+ aFixedTexts[SQLIDENTIFIER ] = &aSQLIdentifierFT;
+ aFixedTexts[SQLNUMBER ] = &aSQLNumberFT;
+ aFixedTexts[SQLSTRING ] = &aSQLStringFT;
+ aFixedTexts[SQLOPERATOR ] = &aSQLOperatorFT;
+ aFixedTexts[SQLKEYWORD ] = &aSQLKeywordFT;
+ aFixedTexts[SQLPARAMETER ] = &aSQLParameterFT;
+ aFixedTexts[SQLCOMMENT ] = &aSQLCommentFT;
+
+ aColorBoxes[DOCCOLOR ] = &aDocColorLB ;
+ aColorBoxes[DOCBOUNDARIES ] = &aDocBoundLB ;
+ aColorBoxes[APPBACKGROUND ] = &aAppBackLB ;
+ aColorBoxes[OBJECTBOUNDARIES ] = &aObjBoundLB ;
+ aColorBoxes[TABLEBOUNDARIES ] = &aTableBoundLB ;
+ aColorBoxes[FONTCOLOR ] = &aFontColorLB ;
+ aColorBoxes[LINKS ] = &aLinksLB ;
+ aColorBoxes[LINKSVISITED ] = &aLinksVisitedLB ;
+ aColorBoxes[SPELL ] = &aSpellLB ;
+ aColorBoxes[SMARTTAGS ] = &aSmarttagsLB ;
+ aColorBoxes[WRITERTEXTGRID ] = &aWrtTextGridLB ;
+ aColorBoxes[WRITERFIELDSHADINGS ] = &aWrtFieldLB ;
+ aColorBoxes[WRITERIDXSHADINGS ] = &aWrtIdxShadingBackLB ;
+ aColorBoxes[WRITERDIRECTCURSOR ] = &aWrtDirectCrsrLB ;
+ aColorBoxes[WRITERSCRIPTINDICATOR ] = &aWrtScriptIndicatorLB ;
+ aColorBoxes[WRITERSECTIONBOUNDARIES ] = &aWrtSectionBoundLB ;
+ aColorBoxes[WRITERPAGEBREAKS] = &aWrtPageBreaksLB;
+ aColorBoxes[HTMLSGML ] = &aHTMLSGMLLB ;
+ aColorBoxes[HTMLCOMMENT ] = &aHTMLCommentLB ;
+ aColorBoxes[HTMLKEYWORD ] = &aHTMLKeywdLB ;
+ aColorBoxes[HTMLUNKNOWN ] = &aHTMLUnknownLB ;
+ aColorBoxes[CALCGRID ] = &aCalcGridLB ;
+ aColorBoxes[CALCPAGEBREAK ] = &aCalcPageBreakLB ;
+ aColorBoxes[CALCPAGEBREAKMANUAL ] = &aCalcPageBreakManualLB ;
+ aColorBoxes[CALCPAGEBREAKAUTOMATIC]= &aCalcPageBreakAutoLB ;
+ aColorBoxes[CALCDETECTIVE ] = &aCalcDetectiveLB ;
+ aColorBoxes[CALCDETECTIVEERROR ] = &aCalcDetectiveErrorLB ;
+ aColorBoxes[CALCREFERENCE ] = &aCalcReferenceLB ;
+ aColorBoxes[CALCNOTESBACKGROUND ] = &aCalcNotesBackLB ;
+ aColorBoxes[DRAWGRID ] = &aDrawGridLB ;
+ aColorBoxes[BASICIDENTIFIER ] = &aBasicIdentifierLB;
+ aColorBoxes[BASICCOMMENT ] = &aBasicCommentLB;
+ aColorBoxes[BASICNUMBER ] = &aBasicNumberLB;
+ aColorBoxes[BASICSTRING ] = &aBasicStringLB;
+ aColorBoxes[BASICOPERATOR ] = &aBasicOperatorLB;
+ aColorBoxes[BASICKEYWORD ] = &aBasicKeywordLB;
+ aColorBoxes[BASICERROR ] = &aBasicErrorLB;
+ aColorBoxes[SQLIDENTIFIER ] = &aSQLIdentifierLB;
+ aColorBoxes[SQLNUMBER ] = &aSQLNumberLB;
+ aColorBoxes[SQLSTRING ] = &aSQLStringLB;
+ aColorBoxes[SQLOPERATOR ] = &aSQLOperatorLB;
+ aColorBoxes[SQLKEYWORD ] = &aSQLKeywordLB;
+ aColorBoxes[SQLPARAMETER ] = &aSQLParameterLB;
+ aColorBoxes[SQLCOMMENT ] = &aSQLCommentLB;
+
+ aWindows[DOCCOLOR ] = &aDocColorWN ;
+ aWindows[DOCBOUNDARIES ] = &aDocBoundWN ;
+ aWindows[APPBACKGROUND ] = &aAppBackWN ;
+ aWindows[OBJECTBOUNDARIES ] = &aObjBoundWN ;
+ aWindows[TABLEBOUNDARIES ] = &aTableBoundWN ;
+ aWindows[FONTCOLOR ] = &aFontColorWN ;
+ aWindows[LINKS ] = &aLinksWN ;
+ aWindows[LINKSVISITED ] = &aLinksVisitedWN ;
+ aWindows[SPELL ] = &aSpellWN ;
+ aWindows[SMARTTAGS ] = &aSmarttagsWN ;
+ aWindows[WRITERTEXTGRID ] = &aWrtTextGridWN ;
+ aWindows[WRITERFIELDSHADINGS ] = &aWrtFieldWN ;
+ aWindows[WRITERIDXSHADINGS ] = &aWrtIdxShadingBackWN ;
+ aWindows[WRITERDIRECTCURSOR ] = &aWrtDirectCrsrWN ;
+ aWindows[WRITERSCRIPTINDICATOR ] = &aWrtScriptIndicatorWN ;
+ aWindows[WRITERSECTIONBOUNDARIES ] = &aWrtSectionBoundWN ;
+ aWindows[WRITERPAGEBREAKS] = &aWrtPageBreaksWN;
+ aWindows[HTMLSGML ] = &aHTMLSGMLWN ;
+ aWindows[HTMLCOMMENT ] = &aHTMLCommentWN ;
+ aWindows[HTMLKEYWORD ] = &aHTMLKeywdWN ;
+ aWindows[HTMLUNKNOWN ] = &aHTMLUnknownWN ;
+ aWindows[CALCGRID ] = &aCalcGridWN ;
+ aWindows[CALCPAGEBREAK ] = &aCalcPageBreakWN ;
+ aWindows[CALCPAGEBREAKMANUAL ] = &aCalcPageBreakManualWN ;
+ aWindows[CALCPAGEBREAKAUTOMATIC] = &aCalcPageBreakAutoWN ;
+ aWindows[CALCDETECTIVE ] = &aCalcDetectiveWN ;
+ aWindows[CALCDETECTIVEERROR ] = &aCalcDetectiveErrorWN ;
+ aWindows[CALCREFERENCE ] = &aCalcReferenceWN ;
+ aWindows[CALCNOTESBACKGROUND ] = &aCalcNotesBackWN ;
+ aWindows[DRAWGRID ] = &aDrawGridWN ;
+ aWindows[BASICIDENTIFIER ] = &aBasicIdentifierWN;
+ aWindows[BASICCOMMENT ] = &aBasicCommentWN;
+ aWindows[BASICNUMBER ] = &aBasicNumberWN;
+ aWindows[BASICSTRING ] = &aBasicStringWN;
+ aWindows[BASICOPERATOR ] = &aBasicOperatorWN;
+ aWindows[BASICKEYWORD ] = &aBasicKeywordWN;
+ aWindows[BASICERROR ] = &aBasicErrorWN;
+ aWindows[SQLIDENTIFIER ] = &aSQLIdentifierWN;
+ aWindows[SQLNUMBER ] = &aSQLNumberWN;
+ aWindows[SQLSTRING ] = &aSQLStringWN;
+ aWindows[SQLOPERATOR ] = &aSQLOperatorWN;
+ aWindows[SQLKEYWORD ] = &aSQLKeywordWN;
+ aWindows[SQLPARAMETER ] = &aSQLParameterWN;
+ aWindows[SQLCOMMENT ] = &aSQLCommentWN;
+
+ aChapters.push_back(&aGeneralFT); aChapterWins.push_back(&aGeneralBackWN);
+ aChapters.push_back(&aWriterFT); aChapterWins.push_back(&aWriterBackWN);
+ aChapters.push_back(&aHTMLFT); aChapterWins.push_back(&aHTMLBackWN);
+ aChapters.push_back(&aCalcFT); aChapterWins.push_back(&aCalcBackWN);
+ aChapters.push_back(&aDrawFT); aChapterWins.push_back(&aDrawBackWN);
+ aChapters.push_back(&aBasicFT); aChapterWins.push_back(&aBasicBackWN);
+ aChapters.push_back(&aSQLFT); aChapterWins.push_back(&aSQLBackWN);
+
+ // calculate heights of groups which can be hidden
+ aChapters[GROUP_WRITER ]->SetGroupHeight( aChapters[GROUP_HTML]->GetPosPixel().Y() - aChapters[GROUP_WRITER]->GetPosPixel().Y() );
+ aChapters[GROUP_HTML ]->SetGroupHeight( aChapters[GROUP_CALC]->GetPosPixel().Y() - aChapters[GROUP_HTML]->GetPosPixel().Y() );
+ aChapters[GROUP_CALC ]->SetGroupHeight( aChapters[GROUP_DRAW]->GetPosPixel().Y() - aChapters[GROUP_CALC]->GetPosPixel().Y() );
+ aChapters[GROUP_DRAW ]->SetGroupHeight( aChapters[GROUP_BASIC]->GetPosPixel().Y() - aChapters[GROUP_DRAW]->GetPosPixel().Y() );
+ aChapters[GROUP_BASIC ]->SetGroupHeight( aChapters[GROUP_SQL]->GetPosPixel().Y() - aChapters[GROUP_BASIC]->GetPosPixel().Y() );
+
+ ExtendedColorConfig aExtConfig;
+ sal_Int32 nExtCount = aExtConfig.GetComponentCount();
+ if ( nExtCount )
+ {
+ // calculate position behind last chapter
+ sal_Int32 nLastY = aSQLCommentWN.GetPosPixel().Y() + aSQLCommentWN.GetSizePixel().Height();
+ nLastY = nLastY + LogicToPixel( Size( 0, 3 ), MAP_APPFONT ).Height();
+ // to calculate the number of lines
+ sal_Int32 nHeight = LogicToPixel( Size( 0, _LINE_HEIGHT ), MAP_APPFONT ).Height();
+ sal_Int32 nLineNum = nLastY / nHeight;
+
+ Point aFixedPos = LogicToPixel( Point( _FT_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT );
+ Point aLBPos = LogicToPixel( Point( _LB_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT );
+ Size aFixedSize = LogicToPixel( Size( _FT_WIDTH , _FT_HEIGHT ), MAP_APPFONT );
+ Size aLBSize = LogicToPixel( Size( _LB_WIDTH , _LB_HEIGHT ), MAP_APPFONT );
+ Size aWinSize = LogicToPixel( Size( _WN_WIDTH , _WN_HEIGHT ), MAP_APPFONT );
+
+ for (sal_Int32 j = 0; j < nExtCount; ++j)
+ {
+ ::rtl::OUString sComponentName = aExtConfig.GetComponentName(j);
+ aChapterWins.push_back(new Window(this));
+ ::boost::shared_ptr<SvxExtFixedText_Impl> pTitle(new SvxExtFixedText_Impl(this,ResId(FT_SQL_COMMAND, *rResId.GetResMgr())));
+ m_aExtensionTitles.push_back(pTitle);
+ pTitle->SetPosSizePixel(LogicToPixel( Point( _FT_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT ),aFixedSize);
+ pTitle->SetText(aExtConfig.GetComponentDisplayName(sComponentName));
+ aChapters.push_back(pTitle.get());
+ ++nLineNum;
+ sal_Int32 nColorCount = aExtConfig.GetComponentColorCount(sComponentName);
+ for (sal_Int32 i = 0; i < nColorCount; ++i,++nLineNum)
+ {
+ ExtendedColorConfigValue aColorEntry = aExtConfig.GetComponentColorConfigValue(sComponentName,i);
+ FixedText* pFixedText = new FixedText(this,ResId(FT_BASICERROR, *rResId.GetResMgr()));
+ pFixedText->SetPosSizePixel(LogicToPixel( Point( _FT_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT ),aFixedSize);
+ pFixedText->SetText(aColorEntry.getDisplayName());
+ aFixedTexts.push_back(pFixedText);
+ aCheckBoxes.push_back(NULL); // no checkboxes
+ ColorListBox* pColorBox = new ColorListBox(this,ResId(LB_BASICERROR, *rResId.GetResMgr()));
+ pColorBox->SetPosSizePixel(LogicToPixel( Point( _LB_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT ),aLBSize);
+ aColorBoxes.push_back(pColorBox);
+ Window* pWin = new Window(this,ResId(WN_BASICERROR, *rResId.GetResMgr()));
+ pWin->SetPosSizePixel(LogicToPixel( Point( _WN_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT ),aWinSize);
+ aWindows.push_back(pWin);
+ } // for (sal_Int32 i = 0; i < nExtCount; ++i,++nLineNum)
+ }
+ }
+
+ FreeResource();
+
+ Color TempColor(COL_TRANSPARENT);
+ Wallpaper aTransparentWall(TempColor);
+ sal_Int32 nWinWidth = GetSizePixel().Width();
+ sal_Int32 nFTHeight = aChapters[0]->GetSizePixel().Height();
+ Color aBackColor;
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ sal_Bool bHighContrast = rStyleSettings.GetHighContrastMode();
+ if ( bHighContrast )
+ aBackColor = rStyleSettings.GetShadowColor();
+ else
+ aBackColor = Color( COL_LIGHTGRAY);
+ sal_Int32 nCount = aChapterWins.size();
+ for(sal_Int32 i = 0; i < nCount; ++i)
+ {
+ if ( lcl_isGroupVisible( i, m_aModuleOptions ) )
+ {
+ Font aFont = aChapters[i]->GetFont();
+ aFont.SetWeight(WEIGHT_BOLD);
+ aChapters[i]->SetFont(aFont);
+ aChapters[i]->SetBackground(aTransparentWall);
+ aChapterWins[i]->SetPosSizePixel( Point(0, aChapters[i]->GetPosPixel().Y()),
+ Size(nWinWidth, nFTHeight));
+ aChapterWins[i]->SetBackground(Wallpaper(aBackColor));
+ aChapterWins[i]->Show();
+ }
+ else
+ {
+ aChapters[i]->Hide();
+ aChapterWins[i]->Hide();
+ }
+ }
+ Color aTextColor;
+ BOOL bSetTextColor = FALSE;
+ //#104195# when the window color is the same as the text color it has to be changed
+ Color aWinCol = rStyleSettings.GetWindowColor();
+ Color aRCheckCol = rStyleSettings.GetRadioCheckTextColor();
+ if(aWinCol == aRCheckCol )
+ {
+ bSetTextColor = TRUE;
+ aRCheckCol.Invert();
+ //if inversion didn't work (gray) then it's set to black
+ if(aRCheckCol == aWinCol)
+ aRCheckCol = Color(COL_BLACK);
+ } // if(aWinCol == aRCheckCol )
+ nCount = aFixedTexts.size();
+ sal_Int16 nGroup = GROUP_UNKNOWN;
+ for( sal_Int32 i = 0; i < nCount; i++ )
+ {
+ if(ANCHOR == i)
+ continue;
+ sal_Int16 nNewGroup = lcl_getGroup(i);
+ sal_Bool bShow = lcl_isGroupVisible( nNewGroup, m_aModuleOptions );
+
+ if ( nNewGroup > nGroup )
+ {
+ nGroup = nNewGroup;
+ if ( bShow && nGroup >= GROUP_CALC )
+ {
+ SetNewPosition( i, aChapters[nGroup] );
+ SetNewPosition( i, aChapterWins[nGroup] );
+ }
+ }
+ if(aCheckBoxes[i])
+ {
+ if ( bShow )
+ SetNewPosition( i, aCheckBoxes[i] );
+ else
+ aCheckBoxes[i]->Hide();
+ aCheckBoxes[i]->SetBackground(aTransparentWall);
+ aCheckBoxes[i]->SetHelpId(HID_COLORPAGE_CHECKBOX_START + i);
+ if(bSetTextColor)
+ aCheckBoxes[i]->SetTextColor(aRCheckCol);
+ }
+ if(aFixedTexts[i])
+ {
+ if ( bShow )
+ SetNewPosition( i, aFixedTexts[i] );
+ else
+ aFixedTexts[i]->Hide();
+ aFixedTexts[i]->SetBackground(aTransparentWall);
+ if(bSetTextColor)
+ aFixedTexts[i]->SetTextColor(aRCheckCol);
+ }
+ if(aWindows[i])
+ {
+ if ( bShow )
+ SetNewPosition( i, aWindows[i] );
+ else
+ aWindows[i]->Hide();
+ aWindows[i]->SetBorderStyle(WINDOW_BORDER_MONO);
+ }
+
+ if ( aColorBoxes[i] )
+ {
+ if ( bShow )
+ SetNewPosition( i, aColorBoxes[i] );
+ else
+ aColorBoxes[i]->Hide();
+ }
+ }
+
+ XColorTable aColorTable( SvtPathOptions().GetPalettePath() );
+ aColorBoxes[0]->InsertAutomaticEntry();
+ for( sal_Int32 i = 0; i < aColorTable.Count(); i++ )
+ {
+ XColorEntry* pEntry = aColorTable.GetColor(i);
+ aColorBoxes[0]->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
+ }
+ aColorBoxes[0]->SetHelpId(HID_COLORPAGE_LISTBOX_START);
+ for( sal_Int32 i = 1; i < nCount; i++ )
+ {
+ if(aColorBoxes[i])
+ {
+ aColorBoxes[i]->CopyEntries( *aColorBoxes[0] );
+ aColorBoxes[i]->SetHelpId(HID_COLORPAGE_LISTBOX_START + i);
+ }
+ }
+}
+/* -----------------------------27.03.2002 11:04------------------------------
+
+ ---------------------------------------------------------------------------*/
+ColorConfigWindow_Impl::~ColorConfigWindow_Impl()
+{
+ aChapters.clear();
+ ::std::vector< SvxExtFixedText_Impl*>().swap(aChapters);
+
+
+ sal_Int32 nCount = aFixedTexts.size();
+ for (sal_Int32 i = ColorConfigEntryCount; i < nCount; ++i)
+ {
+ delete aFixedTexts[i];
+ delete aCheckBoxes[i];
+ delete aColorBoxes[i];
+ delete aWindows[i];
+ }
+ for (sal_uInt32 i = GROUP_COUNT; i < aChapterWins.size(); ++i)
+ delete aChapterWins[i];
+ aChapterWins.clear();
+ ::std::vector< Window*>().swap(aChapterWins);
+}
+/* -----------------------------2002/06/20 12:48------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ColorConfigWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ sal_Bool bHighContrast = rStyleSettings.GetHighContrastMode();
+ Color aBackColor( bHighContrast ? COL_TRANSPARENT : COL_LIGHTGRAY);
+ ::std::vector< Window* >::iterator aIter = aChapterWins.begin();
+ ::std::vector< Window* >::iterator aEnd = aChapterWins.end();
+ for(;aIter != aEnd; ++aIter )
+ (*aIter)->SetBackground(Wallpaper(aBackColor));
+ SetBackground(Wallpaper(rStyleSettings.GetWindowColor()));
+ }
+}
+/* -----------------------------2002/06/26 10:49------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxExtFixedText_Impl::DataChanged(const DataChangedEvent& rDCEvt)
+{
+ FixedText::DataChanged(rDCEvt);
+ Color TempColor(COL_TRANSPARENT);
+ Wallpaper aTransparentWall(TempColor);
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ Font aFont = GetFont();
+ aFont.SetWeight(WEIGHT_BOLD);
+ SetFont(aFont);
+ SetBackground(aTransparentWall);
+ }
+}
+
+void ColorConfigWindow_Impl::SetNewPosition( sal_Int32 _nFeature, Window* _pWin )
+{
+ DBG_ASSERT( _pWin, "ColorConfigWindow_Impl::SetNewPosition(): no window" );
+
+ // calculate the overall height of the invisible groups
+ long nDelta = 0;
+ sal_Int16 nGroup = lcl_getGroup( _nFeature ) - 1;
+ while ( nGroup > 0 ) // GROUP_GENERAL (0) is always visible
+ {
+ if ( !lcl_isGroupVisible( nGroup, m_aModuleOptions ) )
+ nDelta += aChapters[nGroup]->GetGroupHeight();
+ nGroup--;
+ }
+
+ // move this window to its new position
+ if ( nDelta > 0 )
+ {
+ Point aPos = _pWin->GetPosPixel();
+ aPos.Y() -= nDelta;
+ _pWin->SetPosPixel( aPos );
+ }
+}
+
+/* -----------------------------08.04.2002 17:10------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ColorConfigWindow_Impl::Command( const CommandEvent& rCEvt )
+{
+ GetParent()->Command(rCEvt);
+}
+/* -----------------------------25.03.2002 10:44------------------------------
+
+ ---------------------------------------------------------------------------*/
+class ColorConfigCtrl_Impl : public Control
+{
+ HeaderBar aHeaderHB;
+ ScrollBar aVScroll;
+
+ String sOn;
+ String sUIElem;
+ String sColSetting;
+ String sPreview;
+ ColorConfigWindow_Impl aScrollWindow;
+
+ EditableColorConfig* pColorConfig;
+ EditableExtendedColorConfig* pExtColorConfig;
+
+ long nScrollPos;
+
+ DECL_LINK(ScrollHdl, ScrollBar*);
+ DECL_LINK(ClickHdl, CheckBox*);
+ DECL_LINK(ColorHdl, ColorListBox*);
+ DECL_LINK(ControlFocusHdl, Control*);
+
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+public:
+ ColorConfigCtrl_Impl(Window* pParent, const ResId& rResId );
+ ~ColorConfigCtrl_Impl();
+
+ void SetConfig(EditableColorConfig& rConfig) {pColorConfig = &rConfig;}
+ void SetExtendedConfig(EditableExtendedColorConfig& rConfig) {pExtColorConfig = &rConfig;}
+ void Update();
+ sal_Int32 GetScrollPosition() {return aVScroll.GetThumbPos();}
+ void SetScrollPosition(sal_Int32 nSet)
+ {
+ aVScroll.SetThumbPos(nSet);
+ ScrollHdl(&aVScroll);
+ }
+};
+/* -----------------------------25.03.2002 17:09------------------------------
+
+ ---------------------------------------------------------------------------*/
+ColorConfigCtrl_Impl::ColorConfigCtrl_Impl(
+ Window* pParent, const ResId& rResId) :
+ Control(pParent, rResId),
+
+
+ aHeaderHB(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER),
+ aVScroll(this, ResId(VB_VSCROLL, *rResId.GetResMgr())),
+ sOn( ResId(ST_ON, *rResId.GetResMgr())),
+ sUIElem( ResId(ST_UIELEM, *rResId.GetResMgr())),
+ sColSetting( ResId(ST_COLSET, *rResId.GetResMgr())),
+ sPreview( ResId(ST_PREVIEW, *rResId.GetResMgr())),
+ aScrollWindow(this, ResId(WN_SCROLL, *rResId.GetResMgr())),
+
+ pColorConfig(0),
+ pExtColorConfig(0),
+ nScrollPos(0)
+{
+ FreeResource();
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ aScrollWindow.SetBackground(Wallpaper(rStyleSettings.GetFieldColor()));
+ aScrollWindow.SetHelpId( HID_OPTIONS_COLORCONFIG_COLORLIST_WIN );
+ aVScroll.EnableDrag();
+ aVScroll.Show();
+ aHeaderHB.SetPosSizePixel(
+ Point(0,0),
+ Size(GetOutputSizePixel().Width(), aVScroll.GetPosPixel().Y()));
+ sal_Int32 nFirstWidth = aScrollWindow.aGeneralFT.GetPosPixel().X();
+ sal_Int32 nSecondWidth = aScrollWindow.aColorBoxes[0]->GetPosPixel().X() - nFirstWidth;
+ sal_Int32 nThirdWidth = aScrollWindow.aWindows[0]->GetPosPixel().X() - nFirstWidth - nSecondWidth;
+
+ const WinBits nHeadBits = HIB_VCENTER | HIB_FIXED| HIB_FIXEDPOS;
+ aHeaderHB.InsertItem( 1, sOn, nFirstWidth, (USHORT)nHeadBits|HIB_CENTER);
+ aHeaderHB.InsertItem( 2, sUIElem, nSecondWidth, (USHORT)nHeadBits|HIB_LEFT);
+ aHeaderHB.InsertItem( 3, sColSetting, nThirdWidth, (USHORT)nHeadBits|HIB_LEFT);
+ aHeaderHB.InsertItem( 4, sPreview,
+ aHeaderHB.GetSizePixel().Width() - nFirstWidth - nSecondWidth - nThirdWidth, (USHORT)nHeadBits|HIB_LEFT);
+ aHeaderHB.Show();
+
+ aVScroll.SetRangeMin(0);
+ sal_Int32 nScrollOffset = aScrollWindow.aColorBoxes[1]->GetPosPixel().Y() - aScrollWindow.aColorBoxes[0]->GetPosPixel().Y();
+ sal_Int32 nVisibleEntries = aScrollWindow.GetSizePixel().Height() / nScrollOffset;
+
+ aVScroll.SetRangeMax(aScrollWindow.aCheckBoxes.size() + aScrollWindow.aChapters.size() );
+ // static: minus three for ANCHOR, DRAWFILL and DRAWDRAWING
+ aVScroll.SetRangeMax( aVScroll.GetRangeMax() - 3 );
+ // dynamic: calculate the hidden lines
+ long nInvisibleLines = 0;
+ sal_Int16 nGroup = GROUP_UNKNOWN;
+ sal_Int32 nCount = aScrollWindow.aCheckBoxes.size();
+ for ( sal_Int32 i = 0; i < nCount; i++ )
+ {
+ if ( ANCHOR == i || DRAWFILL == i || DRAWDRAWING == i ) // not used at the moment
+ continue;
+ sal_Int16 nNewGroup = lcl_getGroup(i);
+ sal_Bool bVisible = lcl_isGroupVisible( nNewGroup, aScrollWindow.GetModuleOptions() );
+ if ( !bVisible )
+ nInvisibleLines++;
+ if ( nNewGroup > nGroup )
+ {
+ nGroup = nNewGroup;
+ if ( !bVisible )
+ nInvisibleLines++;
+ }
+ }
+ aVScroll.SetRangeMax( aVScroll.GetRangeMax() - nInvisibleLines );
+
+ aVScroll.SetPageSize( nVisibleEntries - 1 );
+ aVScroll.SetVisibleSize(nVisibleEntries);
+ Link aScrollLink = LINK(this, ColorConfigCtrl_Impl, ScrollHdl);
+ aVScroll.SetScrollHdl(aScrollLink);
+ aVScroll.SetEndScrollHdl(aScrollLink);
+
+ Link aCheckLink = LINK(this, ColorConfigCtrl_Impl, ClickHdl);
+ Link aColorLink = LINK(this, ColorConfigCtrl_Impl, ColorHdl);
+ Link aGetFocusLink = LINK(this, ColorConfigCtrl_Impl, ControlFocusHdl);
+ for( sal_Int16 i = 0; i < nCount; i++ )
+ {
+ if(aScrollWindow.aColorBoxes[i])
+ {
+ aScrollWindow.aColorBoxes[i]->SetSelectHdl(aColorLink);
+ aScrollWindow.aColorBoxes[i]->SetGetFocusHdl(aGetFocusLink);
+ }
+ if(aScrollWindow.aCheckBoxes[i])
+ {
+ aScrollWindow.aCheckBoxes[i]->SetClickHdl(aCheckLink);
+ aScrollWindow.aCheckBoxes[i]->SetGetFocusHdl(aGetFocusLink);
+ }
+ }
+}
+/* -----------------------------27.03.2002 10:46------------------------------
+
+ ---------------------------------------------------------------------------*/
+ColorConfigCtrl_Impl::~ColorConfigCtrl_Impl()
+{
+}
+/* -----------------------------25.03.2002 17:19------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ColorConfigCtrl_Impl::Update()
+{
+ DBG_ASSERT(pColorConfig, "Configuration not set" );
+ sal_Int32 i;
+ for( i = 0; i < ColorConfigEntryCount; i++ )
+ {
+ if(ANCHOR == i)
+ continue;
+ const ColorConfigValue& rColorEntry = pColorConfig->GetColorValue(ColorConfigEntry(i));
+ if(COL_AUTO == (UINT32)rColorEntry.nColor)
+ {
+ if(aScrollWindow.aColorBoxes[i])
+ aScrollWindow.aColorBoxes[i]->SelectEntryPos(0);
+ if(aScrollWindow.aWindows[i])
+ aScrollWindow.aWindows[i]->SetBackground(
+ Wallpaper(ColorConfig::GetDefaultColor((ColorConfigEntry) i)));
+ }
+ else
+ {
+ Color aColor(rColorEntry.nColor);
+ if(aScrollWindow.aColorBoxes[i])
+ aScrollWindow.aColorBoxes[i]->SelectEntry( aColor );
+ if(aScrollWindow.aWindows[i])
+ aScrollWindow.aWindows[i]->SetBackground(Wallpaper(aColor));
+ }
+ if(aScrollWindow.aWindows[i])
+ aScrollWindow.aWindows[i]->Invalidate();
+ if(aScrollWindow.aCheckBoxes[i])
+ aScrollWindow.aCheckBoxes[i]->Check(rColorEntry.bIsVisible);
+ } // for( i = 0; i < ColorConfigEntryCount; i++ )
+
+
+ sal_Int32 nExtCount = pExtColorConfig->GetComponentCount();
+ sal_Int32 nCount = aScrollWindow.aCheckBoxes.size();
+ sal_Int32 nPos = 0;
+ i = ColorConfigEntryCount;
+ for (sal_Int32 j = 0; j < nExtCount; ++j)
+ {
+ ::rtl::OUString sComponentName = pExtColorConfig->GetComponentName(j);
+ sal_Int32 nColorCount = pExtColorConfig->GetComponentColorCount(sComponentName);
+
+ for( sal_Int32 k = 0; i < nCount && k < nColorCount; ++i ,++nPos,++k)
+ {
+ if(aScrollWindow.aColorBoxes[i])
+ {
+ ExtendedColorConfigValue aColorEntry = pExtColorConfig->GetComponentColorConfigValue(sComponentName,k);
+ Color aColor(aColorEntry.getColor());
+ if(aColorEntry.getDefaultColor() == aColorEntry.getColor() )
+ {
+ aScrollWindow.aColorBoxes[i]->SelectEntryPos(0);
+ }
+ else
+ {
+ aScrollWindow.aColorBoxes[i]->SelectEntry( aColor );
+ }
+ if(aScrollWindow.aWindows[i])
+ aScrollWindow.aWindows[i]->SetBackground(Wallpaper(aColor));
+
+ if(aScrollWindow.aWindows[i])
+ aScrollWindow.aWindows[i]->Invalidate();
+ }
+ }
+ }
+}
+/* -----------------------------26.03.2002 12:55------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool lcl_MoveAndShow(Window* pWindow, long nOffset, long nMaxVisible, bool _bShow)
+{
+ BOOL bHide = TRUE;
+ if(pWindow)
+ {
+ Point aPos = pWindow->GetPosPixel();
+ aPos.Y() += nOffset;
+ pWindow->SetPosPixel(aPos);
+ if ( _bShow )
+ bHide = aPos.Y() > nMaxVisible || (aPos.Y() + pWindow->GetSizePixel().Height()) < 0;
+ pWindow->Show(!bHide);
+ }
+ return !bHide;
+}
+IMPL_LINK(ColorConfigCtrl_Impl, ScrollHdl, ScrollBar*, pScrollBar)
+{
+ aScrollWindow.SetUpdateMode(TRUE);
+ sal_Int16 i;
+ long nOffset = aScrollWindow.aColorBoxes[1]->GetPosPixel().Y() - aScrollWindow.aColorBoxes[0]->GetPosPixel().Y();
+ nOffset *= (nScrollPos - pScrollBar->GetThumbPos());
+ nScrollPos = pScrollBar->GetThumbPos();
+ const long nWindowHeight = aScrollWindow.GetSizePixel().Height();
+ sal_Int16 nFirstVisible = -1;
+ sal_Int16 nLastVisible = -1;
+ sal_Int32 nCount = aScrollWindow.aFixedTexts.size();
+ for( i = 0; i < nCount; i++ )
+ {
+ if(ANCHOR == i)
+ continue;
+ Point aPos;
+ //controls outside of the view need to be hidden to speed up accessibility tools
+ bool bShowCtrl = ( lcl_isGroupVisible(
+ lcl_getGroup(i), aScrollWindow.GetModuleOptions() ) != sal_False );
+ lcl_MoveAndShow(aScrollWindow.aCheckBoxes[i], nOffset, nWindowHeight, bShowCtrl);
+ lcl_MoveAndShow(aScrollWindow.aFixedTexts[i], nOffset, nWindowHeight, bShowCtrl);
+ lcl_MoveAndShow(aScrollWindow.aWindows[i] , nOffset, nWindowHeight, bShowCtrl);
+ BOOL bShow = lcl_MoveAndShow(aScrollWindow.aColorBoxes[i], nOffset, nWindowHeight, bShowCtrl);
+ if(bShow)
+ {
+ if(nFirstVisible == -1)
+ nFirstVisible = i;
+ else
+ nLastVisible = i;
+ }
+ }
+ //show the one prior to the first visible and the first after the last visble control
+ //to enable KEY_TAB travelling
+
+ if(nFirstVisible)
+ {
+ //skip gaps where no controls exist for the related ColorConfigEntry
+ do
+ --nFirstVisible;
+ while(!aScrollWindow.aCheckBoxes[nFirstVisible] && !aScrollWindow.aColorBoxes[nFirstVisible] && nFirstVisible >= 0);
+
+ if ( lcl_isGroupVisible(
+ lcl_getGroup( nFirstVisible ), aScrollWindow.GetModuleOptions() ) != sal_False )
+ {
+ if(aScrollWindow.aCheckBoxes[nFirstVisible])
+ aScrollWindow.aCheckBoxes[nFirstVisible]->Show();
+ if(aScrollWindow.aColorBoxes[nFirstVisible])
+ aScrollWindow.aColorBoxes[nFirstVisible]->Show();
+ }
+ }
+
+ if(nLastVisible < nCount - 1)
+ {
+ nLastVisible++;
+ //skip gaps where no controls exist for the related ColorConfigEntry
+ while(!aScrollWindow.aCheckBoxes[nLastVisible] && !aScrollWindow.aColorBoxes[nLastVisible] &&
+ nLastVisible < nCount - 1 )
+ nLastVisible++;
+ if ( nLastVisible < nCount )
+ {
+ if ( lcl_isGroupVisible(
+ lcl_getGroup( nLastVisible ), aScrollWindow.GetModuleOptions() ) != sal_False )
+ {
+ if(aScrollWindow.aCheckBoxes[nLastVisible])
+ aScrollWindow.aCheckBoxes[nLastVisible]->Show();
+ if(aScrollWindow.aColorBoxes[nLastVisible])
+ aScrollWindow.aColorBoxes[nLastVisible]->Show();
+ }
+ }
+ } // if(nLastVisible < nCount - 1)
+ sal_Int32 nChapterCount = aScrollWindow.aChapters.size();
+ for( i = 0; i < nChapterCount; i++ )
+ {
+ Point aPos = aScrollWindow.aChapters[i]->GetPosPixel(); aPos.Y() += nOffset; aScrollWindow.aChapters[i]->SetPosPixel(aPos);
+ aPos = aScrollWindow.aChapterWins[i]->GetPosPixel(); aPos.Y() += nOffset; aScrollWindow.aChapterWins[i]->SetPosPixel(aPos);
+ }
+ aScrollWindow.SetUpdateMode(TRUE);
+ return 0;
+}
+/* -----------------------------29.04.2002 17:02------------------------------
+
+ ---------------------------------------------------------------------------*/
+long ColorConfigCtrl_Impl::PreNotify( NotifyEvent& rNEvt )
+{
+ if(rNEvt.GetType() == EVENT_COMMAND)
+ {
+ const CommandEvent* pCEvt = rNEvt.GetCommandEvent();
+ USHORT nCmd = pCEvt->GetCommand();
+ if( COMMAND_WHEEL == nCmd )
+ {
+ Command(*pCEvt);
+ return 1;
+ }
+ }
+ return Control::PreNotify(rNEvt);
+}
+/* -----------------------------08.04.2002 16:37------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ColorConfigCtrl_Impl::Command( const CommandEvent& rCEvt )
+{
+ switch ( rCEvt.GetCommand() )
+ {
+
+ case COMMAND_WHEEL:
+ case COMMAND_STARTAUTOSCROLL:
+ case COMMAND_AUTOSCROLL:
+ {
+ const CommandWheelData* pWheelData = rCEvt.GetWheelData();
+ if(pWheelData && !pWheelData->IsHorz() && COMMAND_WHEEL_ZOOM != pWheelData->GetMode())
+ {
+ HandleScrollCommand( rCEvt, 0, &aVScroll );
+ }
+ }
+ break;
+ default:
+ Control::Command(rCEvt);
+ }
+}
+
+/* -----------------------------14.12.2005 12:37------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ColorConfigCtrl_Impl::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ SetBackground(Wallpaper(rStyleSettings.GetFieldColor()));
+ }
+}
+
+
+/* -----------------------------27.03.2002 11:43------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(ColorConfigCtrl_Impl, ClickHdl, CheckBox*, pBox)
+{
+ DBG_ASSERT(pColorConfig, "Configuration not set" );
+
+ for( sal_Int32 i = 0; i < ColorConfigEntryCount; i++ )
+ {
+ if(ANCHOR == i)
+ continue;
+ if(aScrollWindow.aCheckBoxes[i] == pBox )
+ {
+ ColorConfigValue aBoundCol = pColorConfig->GetColorValue(ColorConfigEntry(i));
+ aBoundCol.bIsVisible = pBox->IsChecked();
+ pColorConfig->SetColorValue(ColorConfigEntry(i), aBoundCol);
+ break;
+ }
+ } // for( sal_Int32 i = 0; i < ColorConfigEntryCount; i++ )
+ return 0;
+}
+/* -----------------------------27.03.2002 11:43------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(ColorConfigCtrl_Impl, ColorHdl, ColorListBox*, pBox)
+{
+ DBG_ASSERT(pColorConfig, "Configuration not set" );
+ sal_Int32 i = 0;
+ for( ; i < ColorConfigEntryCount; i++ )
+ {
+ if(pBox && aScrollWindow.aColorBoxes[i] == pBox)
+ {
+ ColorConfigValue aColorEntry = pColorConfig->GetColorValue(ColorConfigEntry(i));
+ if(!pBox->GetSelectEntryPos())
+ {
+ aColorEntry.nColor = COL_AUTO;
+ if(aScrollWindow.aWindows[i])
+ aScrollWindow.aWindows[i]->SetBackground(
+ Wallpaper(ColorConfig::GetDefaultColor((ColorConfigEntry) i)));
+ }
+ else
+ {
+ Color aColor = pBox->GetSelectEntryColor(); // #i14869# no Color&, 'cause it's a ref to a temp object on the stack!
+ aColorEntry.nColor = aColor.GetColor();
+ if(aScrollWindow.aWindows[i])
+ aScrollWindow.aWindows[i]->SetBackground(Wallpaper(aColor));
+ }
+ if(aScrollWindow.aWindows[i])
+ aScrollWindow.aWindows[i]->Invalidate();
+ pColorConfig->SetColorValue(ColorConfigEntry(i), aColorEntry);
+ break;
+ }
+ } // for( sal_Int32 i = 0; i < ColorConfigEntryCount; i++ )
+ sal_Int32 nExtCount = pExtColorConfig->GetComponentCount();
+ sal_Int32 nCount = aScrollWindow.aCheckBoxes.size();
+ sal_Int32 nPos = 0;
+ i = ColorConfigEntryCount;
+ for (sal_Int32 j = 0; j < nExtCount; ++j)
+ {
+ ::rtl::OUString sComponentName = pExtColorConfig->GetComponentName(j);
+ sal_Int32 nColorCount = pExtColorConfig->GetComponentColorCount(sComponentName);
+
+ for( sal_Int32 k = 0; i < nCount && k < nColorCount; ++i ,++nPos,++k)
+ {
+ if(pBox && aScrollWindow.aColorBoxes[i] == pBox)
+ {
+ ExtendedColorConfigValue aColorEntry = pExtColorConfig->GetComponentColorConfigValue(sComponentName,k);
+ Color aColor = pBox->GetSelectEntryColor(); // #i14869# no Color&, 'cause it's a ref to a temp object on the stack!
+ aColorEntry.setColor(aColor.GetColor());
+ if( !pBox->GetSelectEntryPos() ) // auto color
+ {
+ aColorEntry.setColor(aColorEntry.getDefaultColor());
+ aColor.SetColor(aColorEntry.getColor());
+ }
+ if ( aScrollWindow.aWindows[i] )
+ {
+ aScrollWindow.aWindows[i]->SetBackground(Wallpaper(aColor));
+ aScrollWindow.aWindows[i]->Invalidate();
+ }
+ pExtColorConfig->SetColorValue(sComponentName,aColorEntry);
+ break;
+ }
+ }
+ }
+ return 0;
+}
+IMPL_LINK(ColorConfigCtrl_Impl, ControlFocusHdl, Control*, pCtrl)
+{
+ //determine whether a control is completely visible
+ //and make it visible
+ Point aCtrlPos(pCtrl->GetPosPixel());
+ sal_Int32 nWinHeight = aScrollWindow.GetSizePixel().Height();
+ if(0 != (GETFOCUS_TAB & pCtrl->GetGetFocusFlags() &&
+ (aCtrlPos.Y() < 0 ||
+ nWinHeight < aCtrlPos.Y() + aScrollWindow.aColorBoxes[0]->GetSizePixel().Height())))
+ {
+ long nThumbPos = aVScroll.GetThumbPos();
+ if(nWinHeight < aCtrlPos.Y() + aScrollWindow.aColorBoxes[0]->GetSizePixel().Height())
+ {
+ //scroll down
+ nThumbPos +=2;
+ }
+ else
+ {
+ //scroll up
+ nThumbPos -= 2;
+ if(nThumbPos < 0)
+ nThumbPos = 0;
+ }
+ aVScroll.SetThumbPos(nThumbPos);
+ ScrollHdl(&aVScroll);
+ }
+ return 0;
+};
+/* -----------------------------25.03.2002 10:47------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxColorOptionsTabPage::SvxColorOptionsTabPage(
+ Window* pParent, const SfxItemSet& rCoreSet) :
+ SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_COLORCONFIG ), rCoreSet ),
+ aColorSchemeFL( this, CUI_RES( FL_COLORSCHEME ) ),
+ aColorSchemeFT( this, CUI_RES( FT_COLORSCHEME ) ),
+ aColorSchemeLB( this, CUI_RES( LB_COLORSCHEME ) ),
+ aSaveSchemePB( this, CUI_RES( PB_SAVESCHEME) ),
+ aDeleteSchemePB( this, CUI_RES( PB_DELETESCHEME ) ),
+ aCustomColorsFL( this, CUI_RES( FL_CUSTOMCOLORS ) ),
+ bFillItemSetCalled(FALSE),
+ pColorConfig(0),
+ pExtColorConfig(0),
+ pColorConfigCT( new ColorConfigCtrl_Impl(this, CUI_RES( CT_COLORCONFIG ) ))
+{
+ FreeResource();
+ aColorSchemeLB.SetSelectHdl(LINK(this, SvxColorOptionsTabPage, SchemeChangedHdl_Impl));
+ Link aLk = LINK(this, SvxColorOptionsTabPage, SaveDeleteHdl_Impl );
+ aSaveSchemePB.SetClickHdl(aLk);
+ aDeleteSchemePB.SetClickHdl(aLk);
+}
+/* -----------------------------25.03.2002 10:47------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxColorOptionsTabPage::~SvxColorOptionsTabPage()
+{
+ //when the dialog is cancelled but the color scheme ListBox has been changed these
+ //changes need to be undone
+ if(!bFillItemSetCalled && aColorSchemeLB.GetSavedValue() != aColorSchemeLB.GetSelectEntryPos())
+ {
+ rtl::OUString sOldScheme = aColorSchemeLB.GetEntry(aColorSchemeLB.GetSavedValue());
+ if(sOldScheme.getLength())
+ {
+ pColorConfig->SetCurrentSchemeName(sOldScheme);
+ pExtColorConfig->SetCurrentSchemeName(sOldScheme);
+ }
+ }
+ delete pColorConfigCT;
+ pColorConfig->ClearModified();
+ pColorConfig->EnableBroadcast();
+ delete pColorConfig;
+ pExtColorConfig->ClearModified();
+ pExtColorConfig->EnableBroadcast();
+ delete pExtColorConfig;
+}
+/* -----------------------------25.03.2002 10:47------------------------------
+
+ ---------------------------------------------------------------------------*/
+SfxTabPage* SvxColorOptionsTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return ( new SvxColorOptionsTabPage( pParent, rAttrSet ) );
+}
+/* -----------------------------25.03.2002 10:47------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SvxColorOptionsTabPage::FillItemSet( SfxItemSet& )
+{
+ bFillItemSetCalled = TRUE;
+ if(aColorSchemeLB.GetSavedValue() != aColorSchemeLB.GetSelectEntryPos())
+ {
+ pColorConfig->SetModified();
+ pExtColorConfig->SetModified();
+ }
+ if(pColorConfig->IsModified())
+ pColorConfig->Commit();
+ if(pExtColorConfig->IsModified())
+ pExtColorConfig->Commit();
+ return TRUE;
+}
+/* -----------------------------25.03.2002 10:47------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxColorOptionsTabPage::Reset( const SfxItemSet& )
+{
+ if(pColorConfig)
+ {
+ pColorConfig->ClearModified();
+ pColorConfig->DisableBroadcast();
+ delete pColorConfig;
+ }
+ pColorConfig = new EditableColorConfig;
+ pColorConfigCT->SetConfig(*pColorConfig);
+
+ if(pExtColorConfig)
+ {
+ pExtColorConfig->ClearModified();
+ pExtColorConfig->DisableBroadcast();
+ delete pExtColorConfig;
+ }
+ pExtColorConfig = new EditableExtendedColorConfig;
+ pColorConfigCT->SetExtendedConfig(*pExtColorConfig);
+
+ String sUser = GetUserData();
+ //has to be called always to speed up accessibility tools
+ pColorConfigCT->SetScrollPosition(sUser.ToInt32());
+ aColorSchemeLB.Clear();
+ uno::Sequence< ::rtl::OUString > aSchemes = pColorConfig->GetSchemeNames();
+ const rtl::OUString* pSchemes = aSchemes.getConstArray();
+ for(sal_Int32 i = 0; i < aSchemes.getLength(); i++)
+ aColorSchemeLB.InsertEntry(pSchemes[i]);
+ aColorSchemeLB.SelectEntry(pColorConfig->GetCurrentSchemeName());
+ aColorSchemeLB.SaveValue();
+ aDeleteSchemePB.Enable( aSchemes.getLength() > 1 );
+ UpdateColorConfig();
+}
+/* -----------------------------25.03.2002 10:47------------------------------
+
+ ---------------------------------------------------------------------------*/
+int SvxColorOptionsTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return( LEAVE_PAGE );
+}
+/* -----------------------------25.03.2002 15:32------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxColorOptionsTabPage::UpdateColorConfig()
+{
+ //update the color config control
+ pColorConfigCT->Update();
+}
+/* -----------------------------25.03.2002 15:30------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxColorOptionsTabPage, SchemeChangedHdl_Impl, ListBox*, pBox)
+{
+ pColorConfig->LoadScheme(pBox->GetSelectEntry());
+ pExtColorConfig->LoadScheme(pBox->GetSelectEntry());
+ UpdateColorConfig();
+ return 0;
+}
+/* -----------------------------09.04.2002 15:21------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxColorOptionsTabPage, SaveDeleteHdl_Impl, PushButton*, pButton )
+{
+ if(&aSaveSchemePB == pButton)
+ {
+ String sName;
+ //CHINA001 SvxNameDialog aNameDlg(pButton,
+ //CHINA001 sName,
+ //CHINA001 String(CUI_RES(RID_SVXSTR_COLOR_CONFIG_SAVE2)));
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractSvxNameDialog* aNameDlg = pFact->CreateSvxNameDialog( pButton,
+ sName, String(CUI_RES(RID_SVXSTR_COLOR_CONFIG_SAVE2)) );
+ DBG_ASSERT(aNameDlg, "Dialogdiet fail!");//CHINA001
+ aNameDlg->SetCheckNameHdl( LINK(this, SvxColorOptionsTabPage, CheckNameHdl_Impl));
+ aNameDlg->SetText(String(CUI_RES(RID_SVXSTR_COLOR_CONFIG_SAVE1)));
+ aNameDlg->SetHelpId(HID_OPTIONS_COLORCONFIG_SAVE_SCHEME);
+ aNameDlg->SetEditHelpId(HID_OPTIONS_COLORCONFIG_NAME_SCHEME);
+ aNameDlg->SetCheckNameHdl( LINK(this, SvxColorOptionsTabPage, CheckNameHdl_Impl));
+ if(RET_OK == aNameDlg->Execute()) //CHINA001 if(RET_OK == aNameDlg.Execute())
+ {
+ aNameDlg->GetName(sName); //CHINA001 aNameDlg.GetName(sName);
+ pColorConfig->AddScheme(sName);
+ pExtColorConfig->AddScheme(sName);
+ aColorSchemeLB.InsertEntry(sName);
+ aColorSchemeLB.SelectEntry(sName);
+ aColorSchemeLB.GetSelectHdl().Call(&aColorSchemeLB);
+ }
+ delete aNameDlg; //add by CHINA001
+ }
+ else
+ {
+ DBG_ASSERT(aColorSchemeLB.GetEntryCount() > 1, "don't delete the last scheme");
+ QueryBox aQuery(pButton, CUI_RES(RID_SVXQB_DELETE_COLOR_CONFIG));
+ aQuery.SetText(String(CUI_RES(RID_SVXSTR_COLOR_CONFIG_DELETE)));
+ if(RET_YES == aQuery.Execute())
+ {
+ rtl::OUString sDeleteScheme(aColorSchemeLB.GetSelectEntry());
+ aColorSchemeLB.RemoveEntry(aColorSchemeLB.GetSelectEntryPos());
+ aColorSchemeLB.SelectEntryPos(0);
+ aColorSchemeLB.GetSelectHdl().Call(&aColorSchemeLB);
+ //first select the new scheme and then delete the old one
+ pColorConfig->DeleteScheme(sDeleteScheme);
+ pExtColorConfig->DeleteScheme(sDeleteScheme);
+ }
+ }
+ aDeleteSchemePB.Enable( aColorSchemeLB.GetEntryCount() > 1 );
+ return 0;
+}
+/* -----------------------------09.04.2002 15:47------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxColorOptionsTabPage, CheckNameHdl_Impl, AbstractSvxNameDialog*, pDialog )
+{
+ String sName;
+ pDialog->GetName(sName);
+ return sName.Len() && LISTBOX_ENTRY_NOTFOUND == aColorSchemeLB.GetEntryPos( sName );
+}
+/* -----------------------------25.04.2002 15:12------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxColorOptionsTabPage::FillUserData()
+{
+ SetUserData(String::CreateFromInt32(pColorConfigCT->GetScrollPosition()));
+}
+
diff --git a/cui/source/options/optcolor.hrc b/cui/source/options/optcolor.hrc
new file mode 100644
index 000000000000..06730cf196c0
--- /dev/null
+++ b/cui/source/options/optcolor.hrc
@@ -0,0 +1,222 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optcolor.hrc,v $
+ * $Revision: 1.8.196.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTCOLOR_HRC
+#define _SVX_OPTCOLOR_HRC
+
+//Color config page
+#define FL_COLORSCHEME 1
+#define FT_COLORSCHEME 2
+#define LB_COLORSCHEME 3
+#define PB_SAVESCHEME 4
+#define PB_DELETESCHEME 5
+#define FL_CUSTOMCOLORS 6
+#define CT_COLORCONFIG 7
+
+#define HB_HEADER 10
+#define VB_VSCROLL 11
+#define WN_SCROLL 12
+#define ST_ON 17
+#define ST_UIELEM 18
+#define ST_COLSET 19
+#define ST_PREVIEW 20
+
+#define FT_GENERAL 30
+#define FT_DOCCOLOR 31
+#define LB_DOCCOLOR 32
+#define WN_DOCCOLOR 33
+#define CB_DOCBOUND 34
+#define LB_DOCBOUND 35
+#define WN_DOCBOUND 36
+#define FT_APPBACKGROUND 37
+#define LB_APPBACKGROUND 38
+#define WN_APPBACKGROUND 39
+#define CB_OBJECTBOUNDARIES 40
+#define LB_OBJECTBOUNDARIES 41
+#define WN_OBJECTBOUNDARIES 42
+#define CB_TABLEBOUNDARIES 43
+#define LB_TABLEBOUNDARIES 44
+#define WN_TABLEBOUNDARIES 45
+#define FT_FONTCOLOR 46
+#define LB_FONTCOLOR 47
+#define WN_FONTCOLOR 48
+#define CB_LINKS 49
+#define LB_LINKS 50
+#define WN_LINKS 51
+#define CB_LINKSVISITED 52
+#define LB_LINKSVISITED 53
+#define WN_LINKSVISITED 54
+
+#define FT_SPELL 58
+#define LB_SPELL 59
+#define WN_SPELL 60
+
+#define FT_WRITER 61
+#define FT_WRITERTEXTGRID 62
+#define LB_WRITERTEXTGRID 63
+#define WN_WRITERTEXTGRID 64
+#define CB_WRITERFIELDSHADINGS 65
+#define LB_WRITERFIELDSHADINGS 66
+#define WN_WRITERFIELDSHADINGS 67
+#define CB_WRITERIDXSHADINGS 68
+#define LB_WRITERIDXSHADINGS 69
+#define WN_WRITERIDXSHADINGS 70
+#define LB_WRITERDIRECTCURSOR 71
+#define FT_WRITERDIRECTCURSOR 72
+#define WN_WRITERDIRECTCURSOR 73
+#define LB_WRITERSCRIPTINDICATOR 77
+#define FT_WRITERSCRIPTINDICATOR 78
+#define WN_WRITERSCRIPTINDICATOR 79
+#define LB_WRITERSECTIONBOUNDARIES 80
+#define CB_WRITERSECTIONBOUNDARIES 81
+#define WN_WRITERSECTIONBOUNDARIES 82
+#define LB_WRITERPAGEBREAKS 83
+#define FT_WRITERPAGEBREAKS 84
+#define WN_WRITERPAGEBREAKS 85
+
+#define FT_HTML 88
+#define FT_HTMLSGML 89
+#define LB_HTMLSGML 90
+#define WN_HTMLSGML 91
+#define FT_HTMLCOMMENT 92
+#define LB_HTMLCOMMENT 93
+#define WN_HTMLCOMMENT 94
+#define FT_HTMLKEYWORD 95
+#define LB_HTMLKEYWORD 96
+#define WN_HTMLKEYWORD 97
+#define FT_HTMLUNKNOWN 98
+#define LB_HTMLUNKNOWN 99
+#define WN_HTMLUNKNOWN 100
+
+#define FT_CALC 103
+#define FT_CALCGRID 104
+#define LB_CALCGRID 105
+#define WN_CALCGRID 106
+#define FT_CALCPAGEBREAK 107
+#define LB_CALCPAGEBREAK 108
+#define WN_CALCPAGEBREAK 109
+#define FT_CALCPAGEBREAKMANUAL 100
+#define LB_CALCPAGEBREAKMANUAL 101
+#define WN_CALCPAGEBREAKMANUAL 112
+#define FT_CALCPAGEBREAKAUTO 113
+#define LB_CALCPAGEBREAKAUTO 114
+#define WN_CALCPAGEBREAKAUTO 115
+#define FT_CALCDETECTIVE 116
+#define LB_CALCDETECTIVE 117
+#define WN_CALCDETECTIVE 118
+#define FT_CALCDETECTIVEERROR 119
+#define LB_CALCDETECTIVEERROR 120
+#define WN_CALCDETECTIVEERROR 121
+#define FT_CALCREFERENCE 122
+#define LB_CALCREFERENCE 123
+#define WN_CALCREFERENCE 124
+#define FT_CALCNOTESBACKGROUND 125
+#define LB_CALCNOTESBACKGROUND 126
+#define WN_CALCNOTESBACKGROUND 127
+#define FT_DRAW 128
+#define FT_DRAWGRID 132
+#define LB_DRAWGRID 133
+#define WN_DRAWGRID 134
+#define FT_BASICIDENTIFIER 141
+#define LB_BASICIDENTIFIER 142
+#define WN_BASICIDENTIFIER 143
+#define FT_BASICCOMMENT 144
+#define LB_BASICCOMMENT 145
+#define WN_BASICCOMMENT 146
+#define FT_BASICNUMBER 147
+#define LB_BASICNUMBER 148
+#define WN_BASICNUMBER 142
+#define FT_BASICSTRING 153
+#define LB_BASICSTRING 154
+#define WN_BASICSTRING 155
+#define FT_BASICOPERATOR 156
+#define LB_BASICOPERATOR 157
+#define WN_BASICOPERATOR 158
+#define FT_BASICKEYWORD 159
+#define LB_BASICKEYWORD 160
+#define WN_BASICKEYWORD 161
+#define FT_BASIC 162
+#define FT_BASICERROR 163
+#define LB_BASICERROR 164
+#define WN_BASICERROR 165
+
+#define FT_SQL_COMMAND 173
+#define FT_SQLIDENTIFIER 174
+#define LB_SQLIDENTIFIER 175
+#define WN_SQLIDENTIFIER 176
+#define FT_SQLNUMBER 177
+#define LB_SQLNUMBER 178
+#define WN_SQLNUMBER 179
+#define FT_SQLSTRING 180
+#define LB_SQLSTRING 181
+#define WN_SQLSTRING 182
+#define FT_SQLOPERATOR 183
+#define LB_SQLOPERATOR 184
+#define WN_SQLOPERATOR 185
+#define FT_SQLKEYWORD 186
+#define LB_SQLKEYWORD 187
+#define WN_SQLKEYWORD 188
+#define FT_SQLPARAMETER 189
+#define LB_SQLPARAMETER 190
+#define WN_SQLPARAMETER 191
+#define FT_SQLCOMMENT 192
+#define LB_SQLCOMMENT 193
+#define WN_SQLCOMMENT 194
+
+#define ST_EXTENSION 166
+
+
+
+#define _FT_WIDTH 120
+#define _LINE_HEIGHT 15
+#define _FT_HEIGHT 10
+#define _CB_WIDTH 130
+#define _FT_XPOS 14
+#define _CB_XPOS 6
+#define _LB_XPOS 139
+#define _LB_WIDTH 50
+#define _LB_HEIGHT 50
+#define _WN_WIDTH 30
+#define _WN_HEIGHT 12
+#define _WN_XPOS 195
+
+#define FT_SMARTTAGS 168
+#define LB_SMARTTAGS 169
+#define WN_SMARTTAGS 170
+
+#define ST_SPELL_CHECK_HIGHLIGHTING 171
+#define ST_GRAMMAR_CHECK_HIGHLIGHTING 172
+
+
+#endif
+
+
+
+
+
diff --git a/cui/source/options/optcolor.hxx b/cui/source/options/optcolor.hxx
new file mode 100644
index 000000000000..c50062f15366
--- /dev/null
+++ b/cui/source/options/optcolor.hxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optcolor.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTCOLOR_HXX
+#define _SVX_OPTCOLOR_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/group.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+
+/* -----------------------------25.03.2002 10:40------------------------------
+
+ ---------------------------------------------------------------------------*/
+namespace svtools {class EditableColorConfig;class EditableExtendedColorConfig;}
+class ColorConfigCtrl_Impl;
+class AbstractSvxNameDialog; //CHINA001 class SvxNameDialog;
+class SvxColorOptionsTabPage : public SfxTabPage
+{
+ using SfxTabPage::DeactivatePage;
+
+ FixedLine aColorSchemeFL;
+ FixedText aColorSchemeFT;
+ ListBox aColorSchemeLB;
+ PushButton aSaveSchemePB;
+ PushButton aDeleteSchemePB;
+
+ FixedLine aCustomColorsFL;
+
+ BOOL bFillItemSetCalled;
+
+ svtools::EditableColorConfig* pColorConfig;
+ svtools::EditableExtendedColorConfig* pExtColorConfig;
+ ColorConfigCtrl_Impl* pColorConfigCT;
+
+ DECL_LINK(SchemeChangedHdl_Impl, ListBox*);
+ DECL_LINK(SaveDeleteHdl_Impl, PushButton*);
+ DECL_LINK(CheckNameHdl_Impl, AbstractSvxNameDialog*);
+ void UpdateColorConfig();
+
+public:
+ SvxColorOptionsTabPage( Window* pParent, const SfxItemSet& rSet );
+ ~SvxColorOptionsTabPage( );
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ virtual int DeactivatePage( SfxItemSet* pSet );
+ virtual void FillUserData();
+
+};
+
+#endif
+
diff --git a/cui/source/options/optcolor.src b/cui/source/options/optcolor.src
new file mode 100644
index 000000000000..9f3b42e0be30
--- /dev/null
+++ b/cui/source/options/optcolor.src
@@ -0,0 +1,552 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optcolor.src,v $
+ * $Revision: 1.47.196.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#include <sfx2/sfx.hrc>
+#include "helpid.hrc"
+#include <cuires.hrc>
+#include "optcolor.hrc"
+ // pragma ----------------------------------------------------------------
+
+TabPage RID_SVXPAGE_COLORCONFIG
+{
+ HelpId = HID_OPTIONS_COLORCONFIG ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine FL_COLORSCHEME
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Color scheme";
+ };
+ FixedText FT_COLORSCHEME
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "Scheme";
+ };
+ ListBox LB_COLORSCHEME
+ {
+ Pos = MAP_APPFONT ( 65 , 14 ) ;
+ Size = MAP_APPFONT ( 77 , 58 ) ;
+ Border = TRUE;
+ Sort = TRUE;
+ DropDown = TRUE;
+ };
+ PushButton PB_SAVESCHEME
+ {
+ Pos = MAP_APPFONT ( 145, 13 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Save...";
+ };
+ PushButton PB_DELETESCHEME
+ {
+ Pos = MAP_APPFONT ( 198 , 13 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Delete";
+ };
+ FixedLine FL_CUSTOMCOLORS
+ {
+ Pos = MAP_APPFONT ( 6 , 34 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+
+ Text [ en-US ] = "Custom colors";
+ };
+ Control CT_COLORCONFIG
+ {
+ Pos = MAP_APPFONT ( 12 , 45 ) ;
+ Size = MAP_APPFONT ( 236 , 134 ) ;
+ Border = TRUE;
+ DialogControl = TRUE;
+ OutputSize = TRUE ;
+ ScrollBar VB_VSCROLL
+ {
+ Pos = MAP_APPFONT ( 228 , 10 ) ;
+ Size = MAP_APPFONT ( 8 , 124 ) ;
+ VScroll = TRUE;
+ };
+ String ST_ON
+ {
+ Text [ en-US ] = "On";
+ };
+ String ST_UIELEM
+ {
+ Text [ en-US ] = "User interface elements";
+ };
+ String ST_COLSET
+ {
+ Text [ en-US ] = "Color setting";
+ };
+ String ST_PREVIEW
+ {
+ Text [ en-US ] = "Preview";
+ };
+ Window WN_SCROLL
+ {
+
+// misc defines to shorten defining of standard elements
+// standard sizes
+#define FT_SEP_SIZE Size = MAP_APPFONT ( _FT_WIDTH , 8 )
+#define FT_SIZE Size = MAP_APPFONT ( _FT_WIDTH , _FT_HEIGHT )
+#define LB_SIZE Size = MAP_APPFONT ( _LB_WIDTH , _LB_HEIGHT )
+#define WN_SIZE Size = MAP_APPFONT ( _WN_WIDTH , _WN_HEIGHT )
+#define CB_SIZE Size = MAP_APPFONT ( _CB_WIDTH , _FT_HEIGHT )
+
+// combination of position and size
+#define POS_SIZE( POSX, LINENUM, CONTRL_SIZE ) Pos = MAP_APPFONT ( POSX , LINENUM * _LINE_HEIGHT ) ; CONTRL_SIZE
+
+// ... for special types
+#define FT_SEP_POS_SIZE( LINENUM ) POS_SIZE( 14, LINENUM, FT_SEP_SIZE )
+#define FT_POS_SIZE( LINENUM ) POS_SIZE( _FT_XPOS, LINENUM, FT_SIZE )
+#define LB_POS_SIZE( LINENUM ) POS_SIZE( _LB_XPOS, LINENUM, LB_SIZE )
+#define WN_POS_SIZE( LINENUM ) POS_SIZE( _WN_XPOS, LINENUM, WN_SIZE )
+#define CB_POS_SIZE( LINENUM ) POS_SIZE( _CB_XPOS, LINENUM, CB_SIZE )
+
+// combination of a listbox (color chooser) and window (color preview)
+#define LB_WN( ID_POST, LINENUM ) ListBox LB_#ID_POST{LB_POS_SIZE(LINENUM);DropDown=TRUE;};Window WN_#ID_POST{WN_POS_SIZE(LINENUM);Border=TRUE;};
+
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 10 ) ;
+ Size = MAP_APPFONT ( 228 , 124 ) ;
+ DialogControl = TRUE;
+
+ FixedText FT_GENERAL
+ {
+ FT_SEP_POS_SIZE( 0 );
+ Text [ en-US ] = "General";
+ };
+
+ FixedText FT_DOCCOLOR
+ {
+ FT_POS_SIZE( 1 );
+ Text [ en-US ] = "Document background";
+ };
+ LB_WN( DOCCOLOR, 1 )
+
+ CheckBox CB_DOCBOUND
+ {
+ CB_POS_SIZE( 2 );
+ Text [ en-US ] = "Text boundaries";
+ };
+ LB_WN( DOCBOUND, 2 )
+
+ FixedText FT_APPBACKGROUND
+ {
+ FT_POS_SIZE( 3 );
+ Text [ en-US ] = "Application background";
+ };
+ LB_WN( APPBACKGROUND, 3 )
+
+ CheckBox CB_OBJECTBOUNDARIES
+ {
+ CB_POS_SIZE( 4 );
+ Text [ en-US ] = "Object boundaries";
+ };
+ LB_WN( OBJECTBOUNDARIES, 4 )
+
+ CheckBox CB_TABLEBOUNDARIES
+ {
+ CB_POS_SIZE( 5 );
+ Text [ en-US ] = "Table boundaries";
+ };
+ LB_WN( TABLEBOUNDARIES, 5 )
+
+ FixedText FT_FONTCOLOR
+ {
+ FT_POS_SIZE( 6 );
+ Text [ en-US ] = "Font color";
+ };
+ LB_WN( FONTCOLOR, 6 )
+
+ CheckBox CB_LINKS
+ {
+ CB_POS_SIZE( 7 );
+ Text [ en-US ] = "Unvisited links";
+ };
+ LB_WN( LINKS, 7 )
+
+ CheckBox CB_LINKSVISITED
+ {
+ CB_POS_SIZE( 8 );
+ Text [ en-US ] = "Visited links";
+ };
+ LB_WN( LINKSVISITED, 8 )
+
+ FixedText FT_SPELL
+ {
+ FT_POS_SIZE( 9 );
+ Text [ en-US ] = "AutoSpellcheck";
+ };
+ LB_WN( SPELL, 9 )
+
+ FixedText FT_SMARTTAGS
+ {
+ FT_POS_SIZE( 10 );
+ Text [ en-US ] = "Smart Tags";
+ };
+ LB_WN( SMARTTAGS, 10 )
+
+ FixedText FT_WRITER
+ {
+ FT_SEP_POS_SIZE( 11 );
+ Text [ en-US ] = "Text Document";
+ };
+
+ FixedText FT_WRITERTEXTGRID
+ {
+ FT_POS_SIZE( 12 );
+ Text [ en-US ] = "Grid";
+ };
+ LB_WN( WRITERTEXTGRID, 12 )
+
+ CheckBox CB_WRITERFIELDSHADINGS
+ {
+ CB_POS_SIZE( 13 );
+ Text [ en-US ] = "Field shadings";
+ };
+ LB_WN( WRITERFIELDSHADINGS, 13 )
+
+ CheckBox CB_WRITERIDXSHADINGS
+ {
+ CB_POS_SIZE( 14 );
+ Text [ en-US ] = "Index and table shadings";
+ };
+ LB_WN( WRITERIDXSHADINGS, 14 )
+
+
+ FixedText FT_WRITERSCRIPTINDICATOR
+ {
+ FT_POS_SIZE( 15 );
+ Text [ en-US ] = "Script indicator";
+ };
+ LB_WN( WRITERSCRIPTINDICATOR, 15 )
+
+ CheckBox CB_WRITERSECTIONBOUNDARIES
+ {
+ CB_POS_SIZE( 16 );
+ Text [ en-US ] = "Section boundaries";
+ };
+ LB_WN( WRITERSECTIONBOUNDARIES, 16 )
+
+ FixedText FT_WRITERPAGEBREAKS
+ {
+ FT_POS_SIZE( 17 );
+ Text [ en-US ] = "Page and column breaks";
+ };
+ LB_WN( WRITERPAGEBREAKS, 17 )
+
+ FixedText FT_WRITERDIRECTCURSOR
+ {
+ FT_POS_SIZE( 18 );
+ Text [ en-US ] = "Direct cursor";
+ };
+ LB_WN( WRITERDIRECTCURSOR, 18 )
+
+ FixedText FT_HTML
+ {
+ FT_SEP_POS_SIZE( 19 );
+ Text [ en-US ] = "HTML Document";
+ };
+
+ FixedText FT_HTMLSGML
+ {
+ FT_POS_SIZE( 20 );
+ Text [ en-US ] = "SGML syntax highlighting";
+ };
+ LB_WN( HTMLSGML, 20 )
+
+ FixedText FT_HTMLCOMMENT
+ {
+ FT_POS_SIZE( 21 );
+ Text [ en-US ] = "Comment highlighting";
+ };
+ LB_WN( HTMLCOMMENT, 21 )
+
+ FixedText FT_HTMLKEYWORD
+ {
+ FT_POS_SIZE( 22 );
+ Text [ en-US ] = "Keyword highlighting";
+ };
+ LB_WN( HTMLKEYWORD, 22 )
+
+ FixedText FT_HTMLUNKNOWN
+ {
+ FT_POS_SIZE( 23 );
+ Text [ en-US ] = "Text";
+ };
+ LB_WN( HTMLUNKNOWN, 23 )
+
+ FixedText FT_CALC
+ {
+ FT_SEP_POS_SIZE( 24 );
+ Text [ en-US ] = "Spreadsheet";
+ };
+
+ FixedText FT_CALCGRID
+ {
+ FT_POS_SIZE( 25 );
+ Text [ en-US ] = "Grid lines";
+ };
+ LB_WN( CALCGRID, 25 )
+
+ FixedText FT_CALCPAGEBREAK
+ {
+ FT_POS_SIZE( 26 );
+ Text [ en-US ] = "Page breaks";
+ };
+ LB_WN( CALCPAGEBREAK, 26 )
+
+ FixedText FT_CALCPAGEBREAKMANUAL
+ {
+ FT_POS_SIZE( 27 );
+ Text [ en-US ] = "Manual page breaks";
+ };
+ LB_WN( CALCPAGEBREAKMANUAL, 27 )
+
+ FixedText FT_CALCPAGEBREAKAUTO
+ {
+ FT_POS_SIZE( 28 );
+ Text [ en-US ] = "Automatic page breaks";
+ };
+ LB_WN( CALCPAGEBREAKAUTO, 28)
+
+ FixedText FT_CALCDETECTIVE
+ {
+ FT_POS_SIZE( 29 );
+ Text [ en-US ] = "Detective";
+ };
+ LB_WN( CALCDETECTIVE, 29 )
+
+ FixedText FT_CALCDETECTIVEERROR
+ {
+ FT_POS_SIZE( 30 );
+ Text [ en-US ] = "Detective error";
+ };
+ LB_WN( CALCDETECTIVEERROR, 30 )
+
+ FixedText FT_CALCREFERENCE
+ {
+ FT_POS_SIZE( 31 );
+ Text [ en-US ] = "References";
+ };
+ LB_WN( CALCREFERENCE, 31 )
+
+ FixedText FT_CALCNOTESBACKGROUND
+ {
+ FT_POS_SIZE( 32 );
+ Text [ en-US ] = "Notes background";
+ };
+ LB_WN( CALCNOTESBACKGROUND, 32 )
+
+ FixedText FT_DRAW
+ {
+ FT_SEP_POS_SIZE( 33 );
+ Text [ en-US ] = "Drawing / Presentation";
+ };
+
+ FixedText FT_DRAWGRID
+ {
+ FT_POS_SIZE( 34 );
+ Text [ en-US ] = "Grid";
+ };
+ LB_WN( DRAWGRID, 34 )
+
+ FixedText FT_BASIC
+ {
+ FT_SEP_POS_SIZE( 35 );
+ Text [ en-US ] = "Basic Syntax Highlighting";
+ };
+
+ FixedText FT_BASICIDENTIFIER
+ {
+ FT_POS_SIZE( 36 );
+ Text [ en-US ] = "Identifier";
+ };
+ LB_WN( BASICIDENTIFIER, 36 )
+
+ FixedText FT_BASICCOMMENT
+ {
+ FT_POS_SIZE( 37 );
+ Text [ en-US ] = "Comment";
+ };
+ LB_WN( BASICCOMMENT, 37 )
+
+ FixedText FT_BASICNUMBER
+ {
+ FT_POS_SIZE( 38 );
+ Text [ en-US ] = "Number";
+ };
+ LB_WN( BASICNUMBER, 38)
+
+ FixedText FT_BASICSTRING
+ {
+ FT_POS_SIZE( 39 );
+ Text [ en-US ] = "String";
+ };
+ LB_WN( BASICSTRING, 39 )
+
+ FixedText FT_BASICOPERATOR
+ {
+ FT_POS_SIZE( 40 );
+ Text [ en-US ] = "Operator";
+ };
+ LB_WN( BASICOPERATOR, 40 )
+
+ FixedText FT_BASICKEYWORD
+ {
+ FT_POS_SIZE( 41 );
+ Text [ en-US ] = "Reserved expression";
+ };
+ LB_WN( BASICKEYWORD, 41 )
+
+ FixedText FT_BASICERROR
+ {
+ FT_POS_SIZE( 42 );
+ Text [ en-US ] = "Error";
+ };
+ LB_WN( BASICERROR, 42 )
+
+ FixedText FT_SQL_COMMAND
+ {
+ FT_SEP_POS_SIZE( 43 );
+ Text [ en-US ] = "SQL Syntax Highlighting";
+ };
+
+ FixedText FT_SQLIDENTIFIER
+ {
+ FT_POS_SIZE( 44 );
+ Text [ en-US ] = "Identifier";
+ };
+ LB_WN( SQLIDENTIFIER, 44 )
+
+ FixedText FT_SQLNUMBER
+ {
+ FT_POS_SIZE( 45 );
+ Text [ en-US ] = "Number";
+ };
+ LB_WN( SQLNUMBER, 45 )
+
+ FixedText FT_SQLSTRING
+ {
+ FT_POS_SIZE( 46 );
+ Text [ en-US ] = "String";
+ };
+ LB_WN( SQLSTRING, 46 )
+
+ FixedText FT_SQLOPERATOR
+ {
+ FT_POS_SIZE( 47 );
+ Text [ en-US ] = "Operator";
+ };
+ LB_WN( SQLOPERATOR, 47 )
+
+ FixedText FT_SQLKEYWORD
+ {
+ FT_POS_SIZE( 48 );
+ Text [ en-US ] = "Keyword";
+ };
+ LB_WN( SQLKEYWORD, 48 )
+
+ FixedText FT_SQLPARAMETER
+ {
+ FT_POS_SIZE( 49 );
+ Text [ en-US ] = "Parameter";
+ };
+ LB_WN( SQLPARAMETER, 49 )
+
+ FixedText FT_SQLCOMMENT
+ {
+ FT_POS_SIZE( 50 );
+ Text [ en-US ] = "Comment";
+ };
+ LB_WN( SQLCOMMENT, 50 )
+
+ String ST_EXTENSION
+ {
+ Text [ en-US ] = "Colorsettings of the Extensions";
+ };
+ String ST_SPELL_CHECK_HIGHLIGHTING
+ {
+ Text [ en-US ] = "Spell check highlighting";
+ };
+ String ST_GRAMMAR_CHECK_HIGHLIGHTING
+ {
+ Text [ en-US ] = "Grammar check highlighting";
+ };
+ };
+ };
+};
+QueryBox RID_SVXQB_DELETE_COLOR_CONFIG
+{
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_NO ;
+ Message [ en-US ] = "Do you really want to delete the color scheme?" ;
+};
+String RID_SVXSTR_COLOR_CONFIG_DELETE
+{
+ Text [ en-US ] = "Color Scheme Deletion" ;
+};
+String RID_SVXSTR_COLOR_CONFIG_SAVE1
+{
+ Text [ en-US ] = "Save scheme" ;
+};
+String RID_SVXSTR_COLOR_CONFIG_SAVE2
+{
+ Text [ en-US ] = "Name of color scheme" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/optctl.cxx b/cui/source/options/optctl.cxx
new file mode 100644
index 000000000000..199fcc38090b
--- /dev/null
+++ b/cui/source/options/optctl.cxx
@@ -0,0 +1,173 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optctl.cxx,v $
+ * $Revision: 1.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include "optctl.hxx"
+#include <dialmgr.hxx>
+#include "optctl.hrc"
+#include <cuires.hrc>
+#include <svl/ctloptions.hxx>
+
+// class SvxCTLOptionsPage -----------------------------------------------------
+
+IMPL_LINK( SvxCTLOptionsPage, SequenceCheckingCB_Hdl, void*, EMPTYARG )
+{
+ sal_Bool bIsSequenceChecking = m_aSequenceCheckingCB.IsChecked();
+ m_aRestrictedCB.Enable( bIsSequenceChecking );
+ m_aTypeReplaceCB.Enable( bIsSequenceChecking );
+ // #i48117#: by default restricted and type&replace have to be switched on
+ if(bIsSequenceChecking)
+ {
+ m_aTypeReplaceCB.Check( sal_True );
+ m_aRestrictedCB.Check( sal_True );
+ }
+ return 0;
+}
+
+SvxCTLOptionsPage::SvxCTLOptionsPage( Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_OPTIONS_CTL ), rSet ),
+
+ m_aSequenceCheckingFL ( this, CUI_RES( FL_SEQUENCECHECKING ) ),
+ m_aSequenceCheckingCB ( this, CUI_RES( CB_SEQUENCECHECKING ) ),
+ m_aRestrictedCB ( this, CUI_RES( CB_RESTRICTED ) ),
+ m_aTypeReplaceCB ( this, CUI_RES( CB_TYPE_REPLACE ) ),
+ m_aCursorControlFL ( this, CUI_RES( FL_CURSORCONTROL ) ),
+ m_aMovementFT ( this, CUI_RES( FT_MOVEMENT ) ),
+ m_aMovementLogicalRB ( this, CUI_RES( RB_MOVEMENT_LOGICAL ) ),
+ m_aMovementVisualRB ( this, CUI_RES( RB_MOVEMENT_VISUAL ) ),
+ m_aGeneralFL ( this, CUI_RES( FL_GENERAL ) ),
+ m_aNumeralsFT ( this, CUI_RES( FT_NUMERALS ) ),
+ m_aNumeralsLB ( this, CUI_RES( LB_NUMERALS ) )
+
+{
+ FreeResource();
+
+ m_aSequenceCheckingCB.SetClickHdl( LINK( this, SvxCTLOptionsPage, SequenceCheckingCB_Hdl ) );
+
+ m_aNumeralsLB.SetDropDownLineCount( m_aNumeralsLB.GetEntryCount() );
+}
+// -----------------------------------------------------------------------------
+SvxCTLOptionsPage::~SvxCTLOptionsPage()
+{
+}
+// -----------------------------------------------------------------------------
+SfxTabPage* SvxCTLOptionsPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new SvxCTLOptionsPage( pParent, rAttrSet );
+}
+// -----------------------------------------------------------------------------
+BOOL SvxCTLOptionsPage::FillItemSet( SfxItemSet& )
+{
+ BOOL bModified = FALSE;
+ SvtCTLOptions aCTLOptions;
+
+ // Sequence checking
+ BOOL bChecked = m_aSequenceCheckingCB.IsChecked();
+ if ( bChecked != m_aSequenceCheckingCB.GetSavedValue() )
+ {
+ aCTLOptions.SetCTLSequenceChecking( bChecked );
+ bModified = TRUE;
+ }
+
+ bChecked = m_aRestrictedCB.IsChecked();
+ if( bChecked != m_aRestrictedCB.GetSavedValue() )
+ {
+ aCTLOptions.SetCTLSequenceCheckingRestricted( bChecked );
+ bModified = TRUE;
+ }
+ bChecked = m_aTypeReplaceCB.IsChecked();
+ if( bChecked != m_aTypeReplaceCB.GetSavedValue())
+ {
+ aCTLOptions.SetCTLSequenceCheckingTypeAndReplace(bChecked);
+ bModified = TRUE;
+ }
+
+ BOOL bLogicalChecked = m_aMovementLogicalRB.IsChecked();
+ BOOL bVisualChecked = m_aMovementVisualRB.IsChecked();
+ if ( bLogicalChecked != m_aMovementLogicalRB.GetSavedValue() ||
+ bVisualChecked != m_aMovementVisualRB.GetSavedValue() )
+ {
+ SvtCTLOptions::CursorMovement eMovement =
+ bLogicalChecked ? SvtCTLOptions::MOVEMENT_LOGICAL : SvtCTLOptions::MOVEMENT_VISUAL;
+ aCTLOptions.SetCTLCursorMovement( eMovement );
+ bModified = TRUE;
+ }
+
+ USHORT nPos = m_aNumeralsLB.GetSelectEntryPos();
+ if ( nPos != m_aNumeralsLB.GetSavedValue() )
+ {
+ aCTLOptions.SetCTLTextNumerals( (SvtCTLOptions::TextNumerals)nPos );
+ bModified = TRUE;
+ }
+
+ return bModified;
+}
+// -----------------------------------------------------------------------------
+void SvxCTLOptionsPage::Reset( const SfxItemSet& )
+{
+ SvtCTLOptions aCTLOptions;
+
+ m_aSequenceCheckingCB.Check( aCTLOptions.IsCTLSequenceChecking() );
+ m_aRestrictedCB.Check( aCTLOptions.IsCTLSequenceCheckingRestricted() );
+ m_aTypeReplaceCB.Check( aCTLOptions.IsCTLSequenceCheckingTypeAndReplace() );
+
+ SvtCTLOptions::CursorMovement eMovement = aCTLOptions.GetCTLCursorMovement();
+ switch ( eMovement )
+ {
+ case SvtCTLOptions::MOVEMENT_LOGICAL :
+ m_aMovementLogicalRB.Check();
+ break;
+
+ case SvtCTLOptions::MOVEMENT_VISUAL :
+ m_aMovementVisualRB.Check();
+ break;
+
+ default:
+ DBG_ERRORFILE( "SvxCTLOptionsPage::Reset(): invalid movement enum" );
+ }
+
+ USHORT nPos = (USHORT)aCTLOptions.GetCTLTextNumerals();
+ DBG_ASSERT( nPos < m_aNumeralsLB.GetEntryCount(), "SvxCTLOptionsPage::Reset(): invalid numerals enum" );
+ m_aNumeralsLB.SelectEntryPos( nPos );
+
+ m_aSequenceCheckingCB.SaveValue();
+ m_aRestrictedCB.SaveValue();
+ m_aTypeReplaceCB.SaveValue();
+ m_aMovementLogicalRB.SaveValue();
+ m_aMovementVisualRB.SaveValue();
+ m_aNumeralsLB.SaveValue();
+
+ sal_Bool bIsSequenceChecking = m_aSequenceCheckingCB.IsChecked();
+ m_aRestrictedCB.Enable( bIsSequenceChecking );
+ m_aTypeReplaceCB.Enable( bIsSequenceChecking );
+}
+
diff --git a/cui/source/options/optctl.hrc b/cui/source/options/optctl.hrc
new file mode 100644
index 000000000000..4897926f610c
--- /dev/null
+++ b/cui/source/options/optctl.hrc
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optctl.hrc,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTCTL_HRC
+#define _SVX_OPTCTL_HRC
+
+#include <svtools/controldims.hrc>
+
+#define FL_SEQUENCECHECKING 10
+#define CB_SEQUENCECHECKING 11
+#define CB_RESTRICTED 12
+#define CB_TYPE_REPLACE 13
+
+#define FL_CURSORCONTROL 20
+#define FT_MOVEMENT 21
+#define RB_MOVEMENT_LOGICAL 22
+#define RB_MOVEMENT_VISUAL 23
+
+#define FL_GENERAL 30
+#define FT_NUMERALS 31
+#define LB_NUMERALS 32
+
+#define EXTRA_SPACE_Y 16
+#define ROW_0 (RSC_SP_TBPG_INNERBORDER_TOP)
+#define ROW_1 (ROW_0+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_2 (ROW_1+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_3 (ROW_2+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_Y+EXTRA_SPACE_Y)
+#define ROW_4 (ROW_3+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_5 (ROW_4+(RSC_CD_RADIOBUTTON_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)
+#define ROW_6 (ROW_5+RSC_CD_RADIOBUTTON_HEIGHT+RSC_SP_CTRL_Y+EXTRA_SPACE_Y)
+#define ROW_7 (ROW_6+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_8 (ROW_7+(RSC_CD_DROPDOWN_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)
+
+#endif // #ifndef _SVX_OPTCTL_HRC
+
diff --git a/cui/source/options/optctl.hxx b/cui/source/options/optctl.hxx
new file mode 100644
index 000000000000..0dae0e24f180
--- /dev/null
+++ b/cui/source/options/optctl.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optctl.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTCTL_HXX
+#define _SVX_OPTCTL_HXX
+
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <sfx2/tabdlg.hxx>
+
+// class SvxCTLOptionsPage -----------------------------------------------------
+
+class SvxCTLOptionsPage : public SfxTabPage
+{
+private:
+ FixedLine m_aSequenceCheckingFL;
+ CheckBox m_aSequenceCheckingCB;
+ CheckBox m_aRestrictedCB;
+ CheckBox m_aTypeReplaceCB;
+
+ FixedLine m_aCursorControlFL;
+ FixedText m_aMovementFT;
+ RadioButton m_aMovementLogicalRB;
+ RadioButton m_aMovementVisualRB;
+
+ FixedLine m_aGeneralFL;
+ FixedText m_aNumeralsFT;
+ ListBox m_aNumeralsLB;
+
+ DECL_LINK( SequenceCheckingCB_Hdl, void* );
+
+ SvxCTLOptionsPage( Window* pParent, const SfxItemSet& rSet );
+
+public:
+
+ virtual ~SvxCTLOptionsPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+#endif // #ifndef _SVX_OPTCTL_HXX
+
diff --git a/cui/source/options/optctl.src b/cui/source/options/optctl.src
new file mode 100644
index 000000000000..f750264a1df1
--- /dev/null
+++ b/cui/source/options/optctl.src
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optctl.src,v $
+ * $Revision: 1.20.254.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "optctl.hrc"
+#include "helpid.hrc"
+#include <cuires.hrc>
+
+#include <sfx2/sfx.hrc>
+
+TabPage RID_SVXPAGE_OPTIONS_CTL
+{
+ HelpId = HID_OPTIONS_CTL ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Complex Text Layout" ;
+ FixedLine FL_SEQUENCECHECKING
+ {
+ Pos = MAP_APPFONT ( 6, ROW_0 ) ;
+ Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Sequence checking";
+ };
+ CheckBox CB_SEQUENCECHECKING
+ {
+ Pos = MAP_APPFONT ( 12, ROW_1 ) ;
+ Size = MAP_APPFONT ( 236 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "Use se~quence checking";
+ };
+ CheckBox CB_RESTRICTED
+ {
+ Pos = MAP_APPFONT ( 18, ROW_2 );
+ Size = MAP_APPFONT ( 236, RSC_CD_CHECKBOX_HEIGHT );
+ Text[ en-US ] = "Restricted";
+ };
+ CheckBox CB_TYPE_REPLACE
+ {
+ Pos = MAP_APPFONT ( 18, ROW_2+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y );
+ Size = MAP_APPFONT ( 236, RSC_CD_CHECKBOX_HEIGHT );
+ Text[ en-US ] = "~Type and replace";
+ };
+ FixedLine FL_CURSORCONTROL
+ {
+ Pos = MAP_APPFONT ( 6, ROW_3 ) ;
+ Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Cursor control";
+ };
+ FixedText FT_MOVEMENT
+ {
+ Pos = MAP_APPFONT ( 12, ROW_5 ) ;
+ Size = MAP_APPFONT ( 90 , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Movement";
+ };
+ RadioButton RB_MOVEMENT_LOGICAL
+ {
+ Pos = MAP_APPFONT ( 105, ROW_4 ) ;
+ Size = MAP_APPFONT ( 69 , RSC_CD_RADIOBUTTON_HEIGHT ) ;
+ Text [ en-US ] = "Lo~gical";
+ };
+ RadioButton RB_MOVEMENT_VISUAL
+ {
+ Pos = MAP_APPFONT ( 177, ROW_4 ) ;
+ Size = MAP_APPFONT ( 69 , RSC_CD_RADIOBUTTON_HEIGHT ) ;
+ Text [ en-US ] = "~Visual";
+ };
+ FixedLine FL_GENERAL
+ {
+ Pos = MAP_APPFONT ( 6, ROW_6 ) ;
+ Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "General options";
+ };
+ FixedText FT_NUMERALS
+ {
+ Pos = MAP_APPFONT ( 12, ROW_8 ) ;
+ Size = MAP_APPFONT ( 90 , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "~Numerals";
+ };
+ ListBox LB_NUMERALS
+ {
+ Pos = MAP_APPFONT ( 105, ROW_7 ) ;
+ Size = MAP_APPFONT ( 69 , 3*RSC_CD_DROPDOWN_HEIGHT ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ StringList [ en-US ]=
+ {
+ < "Arabic" ; > ;
+ < "Hindi" ; > ;
+ < "System" ; > ;
+ < "Context" ; > ;
+ };
+ };
+};
diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx
new file mode 100644
index 000000000000..e56089dd351e
--- /dev/null
+++ b/cui/source/options/optdict.cxx
@@ -0,0 +1,805 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optdict.cxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <svx/unolingu.hxx>
+#include <svx/dlgutil.hxx>
+#include <sfx2/sfxuno.hxx>
+#include <svl/eitem.hxx>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <comphelper/processfactory.hxx>
+#include <unotools/intlwrapper.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/dialogs.hrc>
+
+#define _SVX_OPTDICT_CXX
+
+#include <linguistic/misc.hxx>
+#include <cuires.hrc>
+#include "optdict.hrc"
+#include "optdict.hxx"
+#include <dialmgr.hxx>
+#include <svx/svxerr.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::linguistic2;
+
+// static ----------------------------------------------------------------
+
+static const sal_uInt16 nNameLen = 8;
+static const short NOACTDICT = -1;
+
+static long nStaticTabs[]=
+{
+ 2,10,71,120
+};
+
+// static function -------------------------------------------------------
+
+static String getNormDicEntry_Impl( const String &rText )
+{
+ String aTmp( rText );
+ aTmp.EraseTrailingChars( '.' );
+ aTmp.EraseAllChars( '=' );
+ return aTmp;
+}
+
+
+// Compare Dictionary Entry result
+enum CDE_RESULT { CDE_EQUAL, CDE_SIMILAR, CDE_DIFFERENT };
+
+static CDE_RESULT cmpDicEntry_Impl( const String &rText1, const String &rText2 )
+{
+ CDE_RESULT eRes = CDE_DIFFERENT;
+
+ if (rText1 == rText2)
+ eRes = CDE_EQUAL;
+ else
+ { // similar = equal up to trailing '.' and hyphenation positions
+ // marked with '='
+ if (getNormDicEntry_Impl( rText1 ) == getNormDicEntry_Impl( rText2 ))
+ eRes = CDE_SIMILAR;
+ }
+
+ return eRes;
+}
+
+// class SvxNewDictionaryDialog -------------------------------------------
+
+SvxNewDictionaryDialog::SvxNewDictionaryDialog( Window* pParent,
+ Reference< XSpellChecker1 > &xSpl ) :
+
+ ModalDialog( pParent, CUI_RES( RID_SFXDLG_NEWDICT ) ),
+
+ aNameText ( this, CUI_RES( FT_DICTNAME ) ),
+ aNameEdit ( this, CUI_RES( ED_DICTNAME ) ),
+ aLanguageText ( this, CUI_RES( FT_DICTLANG ) ),
+ aLanguageLB ( this, CUI_RES( LB_DICTLANG ) ),
+ aExceptBtn ( this, CUI_RES( BTN_EXCEPT ) ),
+ aNewDictBox ( this, CUI_RES( GB_NEWDICT ) ),
+ aOKBtn ( this, CUI_RES( BTN_NEWDICT_OK ) ),
+ aCancelBtn ( this, CUI_RES( BTN_NEWDICT_ESC ) ),
+ aHelpBtn ( this, CUI_RES( BTN_NEWDICT_HLP ) ),
+ xSpell( xSpl )
+{
+ // Handler installieren
+ aNameEdit.SetModifyHdl(
+ LINK( this, SvxNewDictionaryDialog, ModifyHdl_Impl ) );
+ aOKBtn.SetClickHdl( LINK( this, SvxNewDictionaryDialog, OKHdl_Impl ) );
+
+ // Sprachen anzeigen
+ aLanguageLB.SetLanguageList( LANG_LIST_ALL, TRUE, TRUE );
+ aLanguageLB.SelectEntryPos(0);
+
+ FreeResource();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxNewDictionaryDialog, OKHdl_Impl, Button *, EMPTYARG )
+{
+ String sDict = aNameEdit.GetText();
+ sDict.EraseTrailingChars();
+ // add extension for personal dictionaries
+ sDict.AppendAscii(".dic");
+
+ Reference< XDictionaryList > xDicList( SvxGetDictionaryList() );
+
+ Sequence< Reference< XDictionary > > aDics;
+ if (xDicList.is())
+ aDics = xDicList->getDictionaries();
+ const Reference< XDictionary > *pDic = aDics.getConstArray();
+ sal_Int32 nCount = (sal_uInt16) aDics.getLength();
+
+ sal_Bool bFound = sal_False;
+ sal_uInt16 i;
+ for (i = 0; !bFound && i < nCount; ++i )
+ if ( sDict.EqualsIgnoreCaseAscii( String(pDic[i]->getName()) ))
+ bFound = sal_True;
+
+ if ( bFound )
+ {
+ // Doppelte Namen?
+ InfoBox( this, CUI_RESSTR( RID_SVXSTR_OPT_DOUBLE_DICTS ) ).Execute();
+ aNameEdit.GrabFocus();
+ return 0;
+ }
+
+ // Erzeugen und hinzufuegen
+ sal_uInt16 nLang = aLanguageLB.GetSelectLanguage();
+ try
+ {
+ // create new dictionary
+ DictionaryType eType = aExceptBtn.IsChecked() ?
+ DictionaryType_NEGATIVE : DictionaryType_POSITIVE;
+ if (xDicList.is())
+ {
+ lang::Locale aLocale( SvxCreateLocale(nLang) );
+ String aURL( linguistic::GetWritableDictionaryURL( sDict ) );
+ xNewDic = Reference< XDictionary > (
+ xDicList->createDictionary( sDict, aLocale, eType, aURL ) , UNO_QUERY );
+ }
+ DBG_ASSERT(xNewDic.is(), "NULL pointer");
+ }
+ catch(...)
+ {
+ xNewDic = NULL;
+
+ // Fehler: konnte neues W"orterbuch nicht anlegen
+ SfxErrorContext aContext( ERRCTX_SVX_LINGU_DICTIONARY, String(),
+ this, RID_SVXERRCTX, &CUI_MGR() );
+ ErrorHandler::HandleError( *new StringErrorInfo(
+ ERRCODE_SVX_LINGU_DICT_NOTWRITEABLE, sDict ) );
+
+ EndDialog( RET_CANCEL );
+ }
+
+ if (xDicList.is() && xNewDic.is())
+ {
+ xDicList->addDictionary( Reference< XDictionary > ( xNewDic, UNO_QUERY ) );
+
+ // refresh list of dictionaries
+ //! dictionaries may have been added/removed elsewhere too.
+ aDics = xDicList->getDictionaries();
+ }
+ pDic = aDics.getConstArray();
+ nCount = (sal_uInt16) aDics.getLength();
+
+
+ EndDialog( RET_OK );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( SvxNewDictionaryDialog, ModifyHdl_Impl, Edit *, EMPTYARG )
+{
+ if ( aNameEdit.GetText().Len() )
+ aOKBtn.Enable();
+ else
+ aOKBtn.Disable();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxNewDictionaryDialog, ModifyHdl_Impl, Edit *, EMPTYARG )
+
+//==========================================================================
+//
+// class SvxEditDictionaryDialog -------------------------------------------
+//
+//==========================================================================
+
+SvxEditDictionaryDialog::SvxEditDictionaryDialog(
+ Window* pParent,
+ const String& rName,
+ Reference< XSpellChecker1 > &xSpl ) :
+
+ ModalDialog( pParent, CUI_RES( RID_SFXDLG_EDITDICT ) ),
+
+ aBookFT ( this, CUI_RES( FT_BOOK ) ),
+ aAllDictsLB ( this, CUI_RES( LB_ALLDICTS ) ),
+ aLangFT ( this, CUI_RES( FT_DICTLANG ) ),
+ aLangLB ( this, CUI_RES( LB_DICTLANG ) ),
+ aWordFT ( this, CUI_RES( FT_WORD ) ),
+ aWordED ( this, CUI_RES( ED_WORD ) ),
+ aReplaceFT ( this, CUI_RES( FT_REPLACE ) ),
+ aReplaceED ( this, CUI_RES( ED_REPLACE ) ),
+ aWordsLB ( this, CUI_RES( TLB_REPLACE ) ),
+ aNewReplacePB ( this, CUI_RES( PB_NEW_REPLACE ) ),
+ aDeletePB ( this, CUI_RES( PB_DELETE_REPLACE ) ),
+ aEditDictsBox ( this, CUI_RES( GB_EDITDICTS ) ),
+ aCloseBtn ( this, CUI_RES( BTN_EDITCLOSE ) ),
+ aHelpBtn ( this, CUI_RES( BTN_EDITHELP ) ),
+ sModify (CUI_RES(STR_MODIFY)),
+ sNew (aNewReplacePB.GetText()),
+ aDecoView ( this),
+ xSpell ( xSpl ),
+ nOld ( NOACTDICT ),
+ bFirstSelect (sal_True),
+ bDoNothing (sal_False)
+
+{
+ if (SvxGetDictionaryList().is())
+ aDics = SvxGetDictionaryList()->getDictionaries();
+
+ aWordsLB.SetSelectHdl(LINK(this, SvxEditDictionaryDialog, SelectHdl));
+ aWordsLB.SetTabs(nStaticTabs);
+
+ //! we use an algorithm of our own to insert elements sorted
+ aWordsLB.SetWindowBits(/*WB_SORT|*/WB_HSCROLL|WB_CLIPCHILDREN);
+
+
+ nWidth=aWordED.GetSizePixel().Width();
+ // Handler installieren
+ aNewReplacePB.SetClickHdl(
+ LINK( this, SvxEditDictionaryDialog, NewDelHdl));
+ aDeletePB.SetClickHdl(
+ LINK( this, SvxEditDictionaryDialog, NewDelHdl));
+
+ aLangLB.SetSelectHdl(
+ LINK( this, SvxEditDictionaryDialog, SelectLangHdl_Impl ) );
+ aAllDictsLB.SetSelectHdl(
+ LINK( this, SvxEditDictionaryDialog, SelectBookHdl_Impl ) );
+
+ aWordED.SetModifyHdl(LINK(this, SvxEditDictionaryDialog, ModifyHdl));
+ aReplaceED.SetModifyHdl(LINK(this, SvxEditDictionaryDialog, ModifyHdl));
+ aWordED.SetActionHdl(LINK(this, SvxEditDictionaryDialog, NewDelHdl));
+ aReplaceED.SetActionHdl(LINK(this, SvxEditDictionaryDialog, NewDelHdl));
+
+ // Listbox mit allen verfuegbaren WB's fuellen
+ const Reference< XDictionary > *pDic = aDics.getConstArray();
+ sal_Int32 nCount = aDics.getLength();
+
+ String aLookUpEntry;
+ for ( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ Reference< XDictionary > xDic( pDic[i], UNO_QUERY );
+ if (xDic.is())
+ {
+ sal_Bool bNegative = xDic->getDictionaryType() == DictionaryType_NEGATIVE ?
+ sal_True : sal_False;
+ String aDicName( xDic->getName() );
+ const String aTxt( ::GetDicInfoStr( aDicName, SvxLocaleToLanguage( xDic->getLocale() ),
+ bNegative ) );
+ aAllDictsLB.InsertEntry( aTxt );
+
+ if (rName == aDicName)
+ aLookUpEntry = aTxt;
+ }
+ }
+
+ aLangLB.SetLanguageList( LANG_LIST_ALL, TRUE, TRUE );
+
+ aReplaceED.SetSpaces(sal_True);
+ aWordED.SetSpaces(sal_True);
+
+ if ( nCount > 0 )
+ {
+ aAllDictsLB.SelectEntry( aLookUpEntry );
+ sal_uInt16 nPos = aAllDictsLB.GetSelectEntryPos();
+
+ if ( nPos == LISTBOX_ENTRY_NOTFOUND )
+ {
+ nPos = 0;
+ aAllDictsLB.SelectEntryPos( nPos );
+ }
+ Reference< XDictionary > xDic;
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ xDic = Reference< XDictionary > ( aDics.getConstArray()[ nPos ], UNO_QUERY );
+ if (xDic.is())
+ SetLanguage_Impl( SvxLocaleToLanguage( xDic->getLocale() ) );
+
+ // check if dictionary is read-only
+ SetDicReadonly_Impl(xDic);
+ sal_Bool bEnable = !IsDicReadonly_Impl();
+ aNewReplacePB .Enable( sal_False );
+ aDeletePB .Enable( sal_False );
+ aLangFT.Enable( bEnable );
+ aLangLB.Enable( bEnable );
+ ShowWords_Impl( nPos );
+
+ }
+ else
+ {
+ aNewReplacePB.Disable();
+ aDeletePB .Disable();
+ }
+ FreeResource();
+}
+
+// -----------------------------------------------------------------------
+
+SvxEditDictionaryDialog::~SvxEditDictionaryDialog()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvxEditDictionaryDialog::Paint( const Rectangle& rRect )
+{
+ ModalDialog::Paint(rRect );
+
+ Rectangle aRect(aEditDictsBox.GetPosPixel(),aEditDictsBox.GetSizePixel());
+
+ sal_uInt16 nStyle=BUTTON_DRAW_NOFILL;
+ aDecoView.DrawButton( aRect, nStyle);
+}
+
+// -----------------------------------------------------------------------
+
+void SvxEditDictionaryDialog::SetDicReadonly_Impl(
+ Reference< XDictionary > &xDic )
+{
+ // enable or disable new and delete button according to file attributes
+ bDicIsReadonly = sal_True;
+ if (xDic.is())
+ {
+ Reference< frame::XStorable > xStor( xDic, UNO_QUERY );
+ if ( !xStor.is() // non persistent dictionary
+ || !xStor->hasLocation() // not yet persistent
+ || !xStor->isReadonly() )
+ {
+ bDicIsReadonly = sal_False;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxEditDictionaryDialog::SetLanguage_Impl( util::Language nLanguage )
+{
+ // select language
+ aLangLB.SelectLanguage( nLanguage );
+}
+
+USHORT SvxEditDictionaryDialog::GetLBInsertPos(const String &rDicWord)
+{
+ USHORT nPos = USHRT_MAX;
+
+ IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
+ const CollatorWrapper* pCollator = aIntlWrapper.getCollator();
+ USHORT j;
+ for( j = 0; j < aWordsLB.GetEntryCount(); j++ )
+ {
+ SvLBoxEntry* pEntry = aWordsLB.GetEntry(j);
+ DBG_ASSERT( pEntry, "NULL pointer");
+ String aNormEntry( getNormDicEntry_Impl( rDicWord ) );
+ StringCompare eCmpRes = (StringCompare)pCollator->
+ compareString( aNormEntry, getNormDicEntry_Impl( aWordsLB.GetEntryText(pEntry, 0) ) );
+ if( COMPARE_LESS == eCmpRes )
+ break;
+ }
+ if (j < aWordsLB.GetEntryCount()) // entry found?
+ nPos = j;
+
+ return nPos;
+}
+
+void SvxEditDictionaryDialog::RemoveDictEntry(SvLBoxEntry* pEntry)
+{
+ sal_uInt16 nLBPos = aAllDictsLB.GetSelectEntryPos();
+
+ if ( pEntry != NULL && nLBPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ String sTmpShort(aWordsLB.GetEntryText(pEntry, 0));
+
+ Reference< XDictionary > xDic = aDics.getConstArray()[ nLBPos ];
+ if (xDic->remove( sTmpShort )) // sal_True on success
+ {
+ aWordsLB.GetModel()->Remove(pEntry);
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxEditDictionaryDialog, SelectBookHdl_Impl, ListBox *, EMPTYARG )
+{
+ sal_uInt16 nPos = aAllDictsLB.GetSelectEntryPos();
+
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ aNewReplacePB.Enable( sal_False );
+ aDeletePB .Enable( sal_False );
+ // Dictionary anzeigen
+ ShowWords_Impl( nPos );
+ // enable or disable new and delete button according to file attributes
+ Reference< XDictionary > xDic( aDics.getConstArray()[ nPos ], UNO_QUERY );
+ if (xDic.is())
+ SetLanguage_Impl( SvxLocaleToLanguage( xDic->getLocale() ) );
+
+ SetDicReadonly_Impl(xDic);
+ sal_Bool bEnable = !IsDicReadonly_Impl();
+ aLangFT.Enable( bEnable );
+ aLangLB.Enable( bEnable );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxEditDictionaryDialog, SelectLangHdl_Impl, ListBox *, EMPTYARG )
+{
+ sal_uInt16 nDicPos = aAllDictsLB.GetSelectEntryPos();
+ sal_uInt16 nLang = aLangLB.GetSelectLanguage();
+ Reference< XDictionary > xDic( aDics.getConstArray()[ nDicPos ], UNO_QUERY );
+ INT16 nOldLang = SvxLocaleToLanguage( xDic->getLocale() );
+
+ if ( nLang != nOldLang )
+ {
+ QueryBox aBox( this, CUI_RES( RID_SFXQB_SET_LANGUAGE ) );
+ String sTxt( aBox.GetMessText() );
+ sTxt.SearchAndReplaceAscii( "%1", aAllDictsLB.GetSelectEntry() );
+ aBox.SetMessText( sTxt );
+
+ if ( aBox.Execute() == RET_YES )
+ {
+ xDic->setLocale( SvxCreateLocale( nLang ) );
+ sal_Bool bNegativ = xDic->getDictionaryType() == DictionaryType_NEGATIVE;
+
+ const String sName(
+ ::GetDicInfoStr( xDic->getName(),
+ SvxLocaleToLanguage( xDic->getLocale() ),
+ bNegativ ) );
+ aAllDictsLB.RemoveEntry( nDicPos );
+ aAllDictsLB.InsertEntry( sName, nDicPos );
+ aAllDictsLB.SelectEntryPos( nDicPos );
+ }
+ else
+ SetLanguage_Impl( nOldLang );
+ }
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxEditDictionaryDialog::ShowWords_Impl( sal_uInt16 nId )
+{
+ Reference< XDictionary > xDic = aDics.getConstArray()[ nId ];
+
+ nOld = nId;
+ EnterWait();
+
+ String aStr;
+
+ aWordED.SetText(aStr);
+ aReplaceED.SetText(aStr);
+
+ if(xDic->getDictionaryType() != DictionaryType_POSITIVE)
+ {
+ nStaticTabs[0]=2;
+
+ // make controls for replacement text active
+ if(!aReplaceFT.IsVisible())
+ {
+ Size aSize=aWordED.GetSizePixel();
+ aSize.Width()=nWidth;
+ aWordED.SetSizePixel(aSize);
+ aReplaceFT.Show();
+ aReplaceED.Show();
+ }
+ }
+ else
+ {
+ nStaticTabs[0]=1;
+
+ // deactivate controls for replacement text
+ if(aReplaceFT.IsVisible())
+ {
+ Size aSize=aWordED.GetSizePixel();
+ aSize.Width()=aWordsLB.GetSizePixel().Width();
+ aWordED.SetSizePixel(aSize);
+ aReplaceFT.Hide();
+ aReplaceED.Hide();
+ }
+
+ }
+
+ aWordsLB.SetTabs(nStaticTabs);
+ aWordsLB.Clear();
+
+ Sequence< Reference< XDictionaryEntry > > aEntries( xDic->getEntries() );
+ const Reference< XDictionaryEntry > *pEntry = aEntries.getConstArray();
+ sal_Int32 nCount = aEntries.getLength();
+
+ for (sal_Int32 i = 0; i < nCount; i++)
+ {
+ aStr = String(pEntry[i]->getDictionaryWord());
+ USHORT nPos = GetLBInsertPos( aStr );
+ if(pEntry[i]->isNegative())
+ {
+ aStr += '\t';
+ aStr += String(pEntry[i]->getReplacementText());
+ }
+ aWordsLB.InsertEntry(aStr, 0, sal_False, nPos == USHRT_MAX ? LIST_APPEND : nPos);
+ }
+
+ if (aWordsLB.GetEntryCount())
+ {
+ aWordED .SetText( aWordsLB.GetEntryText(0LU, 0) );
+ aReplaceED.SetText( aWordsLB.GetEntryText(0LU, 1) );
+ }
+
+ LeaveWait();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK(SvxEditDictionaryDialog, SelectHdl, SvTabListBox*, pBox)
+{
+ if(!bDoNothing)
+ {
+ if(!bFirstSelect)
+ {
+ SvLBoxEntry* pEntry = pBox->FirstSelected();
+ String sTmpShort(pBox->GetEntryText(pEntry, 0));
+ // wird der Text ueber den ModifyHdl gesetzt, dann steht der Cursor
+ //sonst immer am Wortanfang, obwohl man gerade hier editiert
+ if(aWordED.GetText() != sTmpShort)
+ aWordED.SetText(sTmpShort);
+ aReplaceED.SetText(pBox->GetEntryText(pEntry, 1));
+ }
+ else
+ bFirstSelect = sal_False;
+
+ // entries in the list box should exactly correspond to those from the
+ // dictionary. Thus:
+ aNewReplacePB.Enable(sal_False);
+ aDeletePB .Enable( sal_True && !IsDicReadonly_Impl() );
+ }
+ return 0;
+};
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK(SvxEditDictionaryDialog, NewDelHdl, PushButton*, pBtn)
+{
+ SvLBoxEntry* pEntry = aWordsLB.FirstSelected();
+
+ if(pBtn == &aDeletePB)
+ {
+ DBG_ASSERT(pEntry, "keine Eintrag selektiert");
+ String aStr;
+
+ aWordED.SetText(aStr);
+ aReplaceED.SetText(aStr);
+ aDeletePB.Disable();
+
+ RemoveDictEntry(pEntry); // remove entry from dic and list-box
+ }
+ if(pBtn == &aNewReplacePB || aNewReplacePB.IsEnabled())
+ {
+ SvLBoxEntry* _pEntry = aWordsLB.FirstSelected();
+ XubString aNewWord(aWordED.GetText());
+ String sEntry(aNewWord);
+ XubString aReplaceStr(aReplaceED.GetText());
+
+ sal_Int16 nAddRes = DIC_ERR_UNKNOWN;
+ sal_uInt16 nPos = aAllDictsLB.GetSelectEntryPos();
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND && aNewWord.Len() > 0)
+ {
+ DBG_ASSERT(nPos < aDics.getLength(), "invalid dictionary index");
+ Reference< XDictionary > xDic( aDics.getConstArray()[ nPos ], UNO_QUERY );
+ if (xDic.is())
+ {
+ // make changes in dic
+
+ //! ...IsVisible should reflect wether the dictionary is a negativ
+ //! or not (hopefully...)
+ sal_Bool bIsNegEntry = aReplaceFT.IsVisible();
+ ::rtl::OUString aRplcText;
+ if(bIsNegEntry)
+ aRplcText = aReplaceStr;
+
+ if (_pEntry) // entry selected in aWordsLB ie action = modify entry
+ xDic->remove( aWordsLB.GetEntryText( _pEntry, 0 ) );
+ // if remove has failed the following add should fail too
+ // and thus a warning message should be triggered...
+
+ Reference<XDictionary> aXDictionary(xDic, UNO_QUERY);
+ nAddRes = linguistic::AddEntryToDic( aXDictionary,
+ aNewWord, bIsNegEntry,
+ aRplcText, SvxLocaleToLanguage( xDic->getLocale() ), sal_False );
+ }
+ }
+ if (DIC_ERR_NONE != nAddRes)
+ SvxDicError( this, nAddRes );
+
+ if(DIC_ERR_NONE == nAddRes && sEntry.Len())
+ {
+ // insert new entry in list-box etc...
+
+ aWordsLB.SetUpdateMode(sal_False);
+ sal_uInt16 _nPos = USHRT_MAX;
+
+ if(aReplaceFT.IsVisible())
+ {
+ sEntry += '\t';
+ sEntry += aReplaceStr;
+ }
+
+ SvLBoxEntry* pNewEntry = NULL;
+ if(_pEntry) // entry selected in aWordsLB ie action = modify entry
+ {
+ aWordsLB.SetEntryText( sEntry, _pEntry );
+ pNewEntry = _pEntry;
+ }
+ else
+ {
+ _nPos = GetLBInsertPos( aNewWord );
+ SvLBoxEntry* pInsEntry = aWordsLB.InsertEntry(sEntry, 0, sal_False,
+ _nPos == USHRT_MAX ? LIST_APPEND : (sal_uInt32)_nPos);
+ pNewEntry = pInsEntry;
+ }
+
+ aWordsLB.MakeVisible( pNewEntry );
+ aWordsLB.SetUpdateMode(sal_True);
+ // falls der Request aus dem ReplaceEdit kam, dann Focus in das ShortEdit setzen
+ if(aReplaceED.HasFocus())
+ aWordED.GrabFocus();
+ }
+ }
+ else
+ {
+ // das kann nur ein Enter in einem der beiden Edit-Felder sein und das
+ // bedeutet EndDialog() - muss im KeyInput ausgewertet werden
+ return 0;
+ }
+ ModifyHdl(&aWordED);
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK(SvxEditDictionaryDialog, ModifyHdl, Edit*, pEdt)
+{
+ SvLBoxEntry* pFirstSel = aWordsLB.FirstSelected();
+ String rEntry = pEdt->GetText();
+
+ xub_StrLen nWordLen=rEntry.Len();
+ const String& rRepString = aReplaceED.GetText();
+
+ BOOL bEnableNewReplace = FALSE;
+ BOOL bEnableDelete = FALSE;
+ String aNewReplaceText = sNew;
+
+ if(pEdt == &aWordED)
+ {
+ if(nWordLen>0)
+ {
+ sal_Bool bFound = sal_False;
+ sal_Bool bTmpSelEntry=sal_False;
+ CDE_RESULT eCmpRes = CDE_DIFFERENT;
+
+ for(sal_uInt16 i = 0; i < aWordsLB.GetEntryCount(); i++)
+ {
+ SvLBoxEntry* pEntry = aWordsLB.GetEntry( i );
+ String aTestStr( aWordsLB.GetEntryText(pEntry, 0) );
+ eCmpRes = cmpDicEntry_Impl( rEntry, aTestStr );
+ if(CDE_DIFFERENT != eCmpRes)
+ {
+ if(rRepString.Len())
+ bFirstSelect = sal_True;
+ bDoNothing=sal_True;
+ aWordsLB.SetCurEntry(pEntry);
+ bDoNothing=sal_False;
+ pFirstSel = pEntry;
+ aReplaceED.SetText(aWordsLB.GetEntryText(pEntry, 1));
+
+ if (CDE_SIMILAR == eCmpRes)
+ {
+ aNewReplaceText = sModify;
+ bEnableNewReplace = TRUE;
+ }
+ bFound= sal_True;
+ break;
+ }
+ else if(getNormDicEntry_Impl(aTestStr).Search(
+ getNormDicEntry_Impl( rEntry ) ) == 0
+ && !bTmpSelEntry)
+ {
+ bDoNothing=sal_True;
+ aWordsLB.MakeVisible(pEntry);
+ bDoNothing=sal_False;
+ bTmpSelEntry=sal_True;
+
+ aNewReplaceText = sNew;
+ bEnableNewReplace = TRUE;
+ }
+ }
+
+ if(!bFound)
+ {
+ aWordsLB.SelectAll(sal_False);
+ pFirstSel = 0;
+
+ aNewReplaceText = sNew;
+ bEnableNewReplace = TRUE;
+ }
+ bEnableDelete = CDE_DIFFERENT != eCmpRes;
+ }
+ else if(aWordsLB.GetEntryCount()>0)
+ {
+ SvLBoxEntry* pEntry = aWordsLB.GetEntry( 0 );
+ bDoNothing=sal_True;
+ aWordsLB.MakeVisible(pEntry);
+ bDoNothing=sal_False;
+ }
+ }
+ else if(pEdt == &aReplaceED)
+ {
+ String aReplaceText;
+ String aWordText;
+ if (pFirstSel) // a aWordsLB entry is selected
+ {
+ aWordText = aWordsLB.GetEntryText( pFirstSel, 0 );
+ aReplaceText = aWordsLB.GetEntryText( pFirstSel, 1 );
+
+ aNewReplaceText = sModify;
+ bEnableDelete = TRUE;
+ }
+ BOOL bIsChange =
+ CDE_EQUAL != cmpDicEntry_Impl(aWordED.GetText(), aWordText)
+ || CDE_EQUAL != cmpDicEntry_Impl(aReplaceED.GetText(), aReplaceText);
+ if (aWordED.GetText().Len() && bIsChange)
+ bEnableNewReplace = TRUE;
+ }
+
+ aNewReplacePB.SetText( aNewReplaceText );
+ aNewReplacePB.Enable( bEnableNewReplace && !IsDicReadonly_Impl() );
+ aDeletePB .Enable( bEnableDelete && !IsDicReadonly_Impl() );
+
+ return 0;
+}
+
+//=========================================================
+//SvxDictEdit
+//=========================================================
+void SvxDictEdit::KeyInput( const KeyEvent& rKEvt )
+{
+ const KeyCode aKeyCode = rKEvt.GetKeyCode();
+ const sal_uInt16 nModifier = aKeyCode.GetModifier();
+ if( aKeyCode.GetCode() == KEY_RETURN )
+ {
+ //wird bei Enter nichts getan, dann doch die Basisklasse rufen
+ // um den Dialog zu schliessen
+ if(!nModifier && !aActionLink.Call(this))
+ Edit::KeyInput(rKEvt);
+ }
+ else if(bSpaces || aKeyCode.GetCode() != KEY_SPACE)
+ Edit::KeyInput(rKEvt);
+}
+
+
diff --git a/cui/source/options/optdict.hrc b/cui/source/options/optdict.hrc
new file mode 100644
index 000000000000..af9e9302d7d5
--- /dev/null
+++ b/cui/source/options/optdict.hrc
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optdict.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTDICT_HRC
+#define _SVX_OPTDICT_HRC
+
+// defines ------------------------------------------------------------------
+
+#define FT_DICTNAME 10
+#define ED_DICTNAME 11
+#define FT_DICTLANG 12
+#define LB_DICTLANG 13
+#define BTN_EXCEPT 14
+#define GB_NEWDICT 15
+
+#define BTN_NEWDICT_OK 20
+#define BTN_NEWDICT_ESC 21
+#define BTN_NEWDICT_HLP 22
+
+#define FT_BOOK 30
+#define FT_CONTENT 31
+#define LB_ALLDICTS 32
+#define GB_EDITDICTS 34
+#define FT_WORD 35
+#define ED_WORD 36
+#define FT_REPLACE 37
+#define ED_REPLACE 38
+#define PB_NEW_REPLACE 39
+#define PB_DELETE_REPLACE 40
+#define TLB_REPLACE 41
+#define STR_MODIFY 42
+
+#define BTN_EDITCLOSE 50
+#define BTN_EDITNEW 51
+#define BTN_EDITCHANGE 52
+#define BTN_EDITREMOVE 53
+#define BTN_EDITHELP 54
+
+
+
+#endif
+
diff --git a/cui/source/options/optdict.src b/cui/source/options/optdict.src
new file mode 100644
index 000000000000..589f73b4f46b
--- /dev/null
+++ b/cui/source/options/optdict.src
@@ -0,0 +1,282 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optdict.src,v $
+ * $Revision: 1.31 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#include <sfx2/sfx.hrc>
+#include "helpid.hrc"
+#include <cuires.hrc>
+#include "optdict.hrc"
+ // pragma ----------------------------------------------------------------
+
+ // RID_SFXDLG_NEWDICT ----------------------------------------------------
+ModalDialog RID_SFXDLG_NEWDICT
+{
+ HelpId = HID_OPTIONS_DICT_NEW ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 213 , 66 ) ;
+ Moveable = TRUE ;
+ /* ### ACHTUNG: Neuer Text in Resource? Benutzerwörterbuch anlegen : Benutzerw÷rterbuch anlegen */
+ /* ### ACHTUNG: Neuer Text in Resource? Benutzerwörterbuch anlegen : Benutzerw÷rterbuch anlegen */
+ Text [ en-US ] = "New Dictionary" ;
+ FixedText FT_DICTNAME
+ {
+ Pos = MAP_APPFONT ( 11 , 15 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "~Name" ;
+ LeftLabel = TRUE ;
+ };
+ Edit ED_DICTNAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 55 , 14 ) ;
+ Size = MAP_APPFONT ( 90 , 12 ) ;
+ MaxTextLength = 32 ;
+ };
+ FixedText FT_DICTLANG
+ {
+ Pos = MAP_APPFONT ( 12 , 30 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "~Language" ;
+ LeftLabel = TRUE ;
+ };
+ ListBox LB_DICTLANG
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 55 , 30 ) ;
+ Size = MAP_APPFONT ( 90 , 66 ) ;
+ DropDown = TRUE ;
+ };
+ CheckBox BTN_EXCEPT
+ {
+ Pos = MAP_APPFONT ( 12 , 44 ) ;
+ Size = MAP_APPFONT ( 57 , 10 ) ;
+ Text [ en-US ] = "~Exception (-)" ;
+ };
+ FixedLine GB_NEWDICT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 145 , 8 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Wörterbuch : W÷rterbuch */
+ /* ### ACHTUNG: Neuer Text in Resource? Wörterbuch : W÷rterbuch */
+ Text [ en-US ] = "Dictionary" ;
+ };
+ OKButton BTN_NEWDICT_OK
+ {
+ Pos = MAP_APPFONT ( 157 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Disable = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_NEWDICT_ESC
+ {
+ Pos = MAP_APPFONT ( 157 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton BTN_NEWDICT_HLP
+ {
+ Pos = MAP_APPFONT ( 157 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+
+ // RID_SFXDLG_EDITDICT ---------------------------------------------------
+ModalDialog RID_SFXDLG_EDITDICT
+{
+ HelpId = HID_OPTIONS_DICT_EDIT ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT( 270, 161 );
+
+ /* ### ACHTUNG: Neuer Text in Resource? Benutzerwörterbuch bearbeiten : Benutzerw÷rterbuch bearbeiten */
+ /* ### ACHTUNG: Neuer Text in Resource? Benutzerwörterbuch bearbeiten : Benutzerw÷rterbuch bearbeiten */
+ Text [ en-US ] = "Edit Custom Dictionary" ;
+
+ Moveable = TRUE ;
+ FixedText FT_BOOK
+ {
+ Pos = MAP_APPFONT ( 12 , 10 ) ;
+ Size = MAP_APPFONT ( 86 , 10 ) ;
+ Text [ en-US ] = "~Book" ;
+ };
+ ListBox LB_ALLDICTS
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 82 , 9 ) ;
+ Size = MAP_APPFONT ( 121 , 62 ) ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_DICTLANG
+ {
+ Pos = MAP_APPFONT ( 12 , 26 ) ;
+ Size = MAP_APPFONT ( 86 , 10 ) ;
+ Text [ en-US ] = "~Language" ;
+ };
+ ListBox LB_DICTLANG
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 82 , 25 ) ;
+ Size = MAP_APPFONT ( 121 , 66 ) ;
+ DropDown = TRUE ;
+ };
+
+ FixedLine GB_EDITDICTS
+ {
+ Pos = MAP_APPFONT( 1, 1 );
+ Size = MAP_APPFONT( 268, 138 );
+ Hide=TRUE;
+ };
+
+ FixedText FT_WORD
+ {
+ Pos = MAP_APPFONT ( 13 , 46 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Text [ en-US ] = "~Word";
+ };
+ Edit ED_WORD
+ {
+ Pos = MAP_APPFONT ( 12 , 56 ) ;
+ Size = MAP_APPFONT ( 71 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_REPLACE
+ {
+ Pos = MAP_APPFONT ( 84 , 46 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "Replace ~By:";
+ };
+
+ Edit ED_REPLACE
+ {
+ Pos = MAP_APPFONT ( 83 , 56 ) ;
+ Size = MAP_APPFONT ( 120 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+
+ PushButton PB_NEW_REPLACE
+ {
+ Pos = MAP_APPFONT ( 209 , 56 ) ;
+ Size = MAP_APPFONT ( 55 , 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~New" ;
+ };
+ PushButton PB_DELETE_REPLACE
+ {
+ Pos = MAP_APPFONT ( 209 , 71 ) ;
+ Size = MAP_APPFONT ( 55 , 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Delete" ;
+ };
+ Control TLB_REPLACE
+ {
+ HelpId = HID_OPTIONS_DICT_EDIT_ENTRIES_LIST;
+ Pos = MAP_APPFONT ( 12 , 71 ) ;
+ Size = MAP_APPFONT ( 191 , 58 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ String STR_MODIFY
+ {
+ Text [ en-US ] = "~Replace" ;
+ };
+
+
+
+ HelpButton BTN_EDITHELP
+ {
+ Pos = MAP_APPFONT( 145, 143 );
+ Size = MAP_APPFONT( 55, 14 );
+ };
+
+ CancelButton BTN_EDITCLOSE
+ {
+ Pos = MAP_APPFONT ( 209 , 143 ) ;
+ Size = MAP_APPFONT ( 55 , 14 ) ;
+
+ /* ### ACHTUNG: Neuer Text in Resource? ~Schließen : ~Schlie˜en */
+ /* ### ACHTUNG: Neuer Text in Resource? ~Schließen : ~Schlie˜en */
+ Text [ en-US ] = "~Close" ;
+ };
+};
+
+ // Strings ---------------------------------------------------------------
+String RID_SVXSTR_OPT_DOUBLE_DICTS
+{
+ Text [ en-US ] = "The specified name already exists.\nPlease enter a new name." ;
+};
+ // RID_SFXQB_SET_LANGUAGE ------------------------------------------------
+QueryBox RID_SFXQB_SET_LANGUAGE
+{
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_NO ;
+ /* ### ACHTUNG: Neuer Text in Resource? Möchten Sie die Sprache des Wörterbuches '%1' ändern? : Möchten Sie die Sprache des Wörterbuches ''%1'' ändern? */
+ /* ### ACHTUNG: Neuer Text in Resource? Möchten Sie die Sprache des Wörterbuches '%1' ändern? : Möchten Sie die Sprache des Wörterbuches ''%1'' ändern? */
+ /* ### ACHTUNG: Neuer Text in Resource? Möchten Sie die Sprache des Wörterbuches '%1' ändern? : M÷chten Sie die Sprache des W÷rterbuches '%1' õndern? */
+ /* ### ACHTUNG: Neuer Text in Resource? Möchten Sie die Sprache des Wörterbuches '%1' ändern? : M÷chten Sie die Sprache des W÷rterbuches '%1' õndern? */
+ Message [ en-US ] = "Do you want to change the '%1' dictionary language?" ;
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx
new file mode 100644
index 000000000000..feb38daff447
--- /dev/null
+++ b/cui/source/options/optfltr.cxx
@@ -0,0 +1,439 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optfltr.cxx,v $
+ * $Revision: 1.16 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <unotools/moduleoptions.hxx>
+#include <unotools/fltrcfg.hxx>
+#include "optfltr.hxx"
+#include "optfltr.hrc"
+#include <cuires.hrc>
+#include "helpid.hrc"
+#include <dialmgr.hxx>
+
+enum MSFltrPg2_CheckBoxEntries {
+ Math,
+ Writer,
+ Calc,
+ Impress,
+ InvalidCBEntry
+};
+
+#define CBCOL_FIRST 0
+#define CBCOL_SECOND 1
+
+// -----------------------------------------------------------------------
+
+OfaMSFilterTabPage::OfaMSFilterTabPage(Window* pParent, const SfxItemSet& rSet)
+ : SfxTabPage( pParent, CUI_RES( RID_OFAPAGE_MSFILTEROPT ), rSet ),
+ aMSWordGB ( this, CUI_RES( GB_WORD ) ),
+ aWBasicCodeCB ( this, CUI_RES( CB_WBAS_CODE ) ),
+ aWBasicStgCB ( this, CUI_RES( CB_WBAS_STG ) ),
+ aMSExcelGB ( this, CUI_RES( GB_EXCEL ) ),
+ aEBasicCodeCB ( this, CUI_RES( CB_EBAS_CODE ) ),
+ aEBasicExectblCB( this, CUI_RES( CB_EBAS_EXECTBL ) ),
+ aEBasicStgCB ( this, CUI_RES( CB_EBAS_STG ) ),
+ aMSPPointGB ( this, CUI_RES( GB_PPOINT ) ),
+ aPBasicCodeCB ( this, CUI_RES( CB_PBAS_CODE ) ),
+ aPBasicStgCB ( this, CUI_RES( CB_PBAS_STG ) )
+{
+ FreeResource();
+
+ aEBasicCodeCB.SetClickHdl( LINK( this, OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl ) );
+}
+
+OfaMSFilterTabPage::~OfaMSFilterTabPage()
+{
+}
+
+IMPL_LINK( OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl, CheckBox*, EMPTYARG )
+{
+ aEBasicExectblCB.Enable( aEBasicCodeCB.IsChecked() );
+ return 0;
+}
+
+SfxTabPage* OfaMSFilterTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return new OfaMSFilterTabPage( pParent, rAttrSet );
+}
+
+BOOL OfaMSFilterTabPage::FillItemSet( SfxItemSet& )
+{
+ SvtFilterOptions* pOpt = SvtFilterOptions::Get();
+
+ BOOL bFlag;
+ if( aWBasicCodeCB.GetSavedValue() != (bFlag = aWBasicCodeCB.IsChecked()))
+ pOpt->SetLoadWordBasicCode( bFlag );
+ if( aWBasicStgCB.GetSavedValue() != (bFlag = aWBasicStgCB.IsChecked()))
+ pOpt->SetLoadWordBasicStorage( bFlag );
+
+ if( aEBasicCodeCB.GetSavedValue() != (bFlag = aEBasicCodeCB.IsChecked()))
+ pOpt->SetLoadExcelBasicCode( bFlag );
+ if( aEBasicExectblCB.GetSavedValue() != (bFlag = aEBasicExectblCB.IsChecked()))
+ pOpt->SetLoadExcelBasicExecutable( bFlag );
+ if( aEBasicStgCB.GetSavedValue() != (bFlag = aEBasicStgCB.IsChecked()))
+ pOpt->SetLoadExcelBasicStorage( bFlag );
+
+ if( aPBasicCodeCB.GetSavedValue() != (bFlag = aPBasicCodeCB.IsChecked()))
+ pOpt->SetLoadPPointBasicCode( bFlag );
+ if( aPBasicStgCB.GetSavedValue() != (bFlag = aPBasicStgCB.IsChecked()))
+ pOpt->SetLoadPPointBasicStorage( bFlag );
+
+ return FALSE;
+}
+
+/*-----------------02.09.96 13.47-------------------
+
+--------------------------------------------------*/
+
+void OfaMSFilterTabPage::Reset( const SfxItemSet& )
+{
+ SvtFilterOptions* pOpt = SvtFilterOptions::Get();
+
+ aWBasicCodeCB.Check( pOpt->IsLoadWordBasicCode() );
+ aWBasicCodeCB.SaveValue();
+ aWBasicStgCB.Check( pOpt->IsLoadWordBasicStorage() );
+ aWBasicStgCB.SaveValue();
+
+ aEBasicCodeCB.Check( pOpt->IsLoadExcelBasicCode() );
+ aEBasicCodeCB.SaveValue();
+ aEBasicExectblCB.Check( pOpt->IsLoadExcelBasicExecutable() );
+ aEBasicExectblCB.SaveValue();
+ aEBasicStgCB.Check( pOpt->IsLoadExcelBasicStorage() );
+ aEBasicStgCB.SaveValue();
+ LoadExcelBasicCheckHdl_Impl( &aEBasicCodeCB );
+
+ aPBasicCodeCB.Check( pOpt->IsLoadPPointBasicCode() );
+ aPBasicCodeCB.SaveValue();
+ aPBasicStgCB.Check( pOpt->IsLoadPPointBasicStorage() );
+ aPBasicStgCB.SaveValue();
+
+}
+
+/*-----------------29.06.00 13:22-------------------
+ *
+ * --------------------------------------------------*/
+OfaMSFilterTabPage2::OfaMSFilterTabPage2( Window* pParent,
+ const SfxItemSet& rSet )
+ : SfxTabPage( pParent, CUI_RES( RID_OFAPAGE_MSFILTEROPT2 ), rSet ),
+ aCheckLB ( this, CUI_RES( CLB_SETTINGS )),
+ aHeader1FT ( this, CUI_RES( FT_HEADER1_EXPLANATION )),
+ aHeader2FT ( this, CUI_RES( FT_HEADER2_EXPLANATION )),
+ sHeader1 ( CUI_RES( ST_HEADER1 )),
+ sHeader2 ( CUI_RES( ST_HEADER2 )),
+ sChgToFromMath ( CUI_RES( ST_CHG_MATH )),
+ sChgToFromWriter ( CUI_RES( ST_CHG_WRITER )),
+ sChgToFromCalc ( CUI_RES( ST_CHG_CALC )),
+ sChgToFromImpress ( CUI_RES( ST_CHG_IMPRESS )),
+ pCheckButtonData(0)
+{
+ FreeResource();
+
+ static long aStaticTabs[] = { 3, 0, 20, 40 };
+ aCheckLB.SvxSimpleTable::SetTabs( aStaticTabs );
+
+ String sHeader( sHeader1 );
+ (( sHeader += '\t' ) += sHeader2 ) += '\t';
+ aCheckLB.InsertHeaderEntry( sHeader, HEADERBAR_APPEND,
+ HIB_CENTER | HIB_VCENTER | HIB_FIXEDPOS | HIB_FIXED );
+
+ aCheckLB.SetHelpId( HID_OFAPAGE_MSFLTR2_CLB );
+ aCheckLB.SetWindowBits( WB_HSCROLL| WB_VSCROLL );
+}
+
+OfaMSFilterTabPage2::~OfaMSFilterTabPage2()
+{
+ delete pCheckButtonData;
+}
+
+SfxTabPage* OfaMSFilterTabPage2::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return new OfaMSFilterTabPage2( pParent, rAttrSet );
+}
+
+BOOL OfaMSFilterTabPage2::FillItemSet( SfxItemSet& )
+{
+ BOOL bModified = FALSE;
+ SvtFilterOptions* pOpt = SvtFilterOptions::Get();
+
+ static struct ChkCBoxEntries{
+ MSFltrPg2_CheckBoxEntries eType;
+ BOOL (SvtFilterOptions:: *FnIs)() const;
+ void (SvtFilterOptions:: *FnSet)( BOOL bFlag );
+ } aChkArr[] = {
+ { Math, &SvtFilterOptions::IsMathType2Math,
+ &SvtFilterOptions::SetMathType2Math },
+ { Math, &SvtFilterOptions::IsMath2MathType,
+ &SvtFilterOptions::SetMath2MathType },
+ { Writer, &SvtFilterOptions::IsWinWord2Writer,
+ &SvtFilterOptions::SetWinWord2Writer },
+ { Writer, &SvtFilterOptions::IsWriter2WinWord,
+ &SvtFilterOptions::SetWriter2WinWord },
+ { Calc, &SvtFilterOptions::IsExcel2Calc,
+ &SvtFilterOptions::SetExcel2Calc },
+ { Calc, &SvtFilterOptions::IsCalc2Excel,
+ &SvtFilterOptions::SetCalc2Excel },
+ { Impress, &SvtFilterOptions::IsPowerPoint2Impress,
+ &SvtFilterOptions::SetPowerPoint2Impress },
+ { Impress, &SvtFilterOptions::IsImpress2PowerPoint,
+ &SvtFilterOptions::SetImpress2PowerPoint },
+ { InvalidCBEntry, 0, 0 }
+ };
+
+ BOOL bCheck, bFirst = TRUE;
+ for( const ChkCBoxEntries* pArr = aChkArr;
+ InvalidCBEntry != pArr->eType; ++pArr, bFirst = !bFirst )
+ {
+ USHORT nCol = bFirst ? 1 : 2;
+ SvLBoxEntry* pEntry = GetEntry4Type( pArr->eType );
+ if( pEntry )
+ {
+ SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem( nCol ));
+ if( pItem && ((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON )
+ {
+ USHORT nButtonFlags = pItem->GetButtonFlags();
+ bCheck = SV_BUTTON_CHECKED ==
+ pCheckButtonData->ConvertToButtonState( nButtonFlags );
+
+ if( bCheck != (pOpt->*pArr->FnIs)() )
+ {
+ bModified = TRUE;
+ (pOpt->*pArr->FnSet)( bCheck );
+ }
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+void OfaMSFilterTabPage2::Reset( const SfxItemSet& )
+{
+ SvtFilterOptions* pOpt = SvtFilterOptions::Get();
+
+ aCheckLB.SetUpdateMode(FALSE);
+ aCheckLB.Clear();
+
+ SvtModuleOptions aModuleOpt;
+
+ // int the same sequence as the enums of MSFltrPg2_CheckBoxEntries
+ if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SMATH ) )
+ InsertEntry( sChgToFromMath, static_cast< sal_IntPtr >( Math ) );
+ if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) )
+ InsertEntry( sChgToFromWriter, static_cast< sal_IntPtr >( Writer ) );
+ if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) )
+ InsertEntry( sChgToFromCalc, static_cast< sal_IntPtr >( Calc ) );
+ if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) )
+ InsertEntry( sChgToFromImpress, static_cast< sal_IntPtr >( Impress ) );
+
+ static struct ChkCBoxEntries{
+ MSFltrPg2_CheckBoxEntries eType;
+ BOOL (SvtFilterOptions:: *FnIs)() const;
+ } aChkArr[] = {
+ { Math, &SvtFilterOptions::IsMathType2Math },
+ { Math, &SvtFilterOptions::IsMath2MathType },
+ { Writer, &SvtFilterOptions::IsWinWord2Writer },
+ { Writer, &SvtFilterOptions::IsWriter2WinWord },
+ { Calc, &SvtFilterOptions::IsExcel2Calc },
+ { Calc, &SvtFilterOptions::IsCalc2Excel },
+ { Impress, &SvtFilterOptions::IsPowerPoint2Impress },
+ { Impress, &SvtFilterOptions::IsImpress2PowerPoint },
+ { InvalidCBEntry, NULL }
+ };
+
+ BOOL bFirst = TRUE;
+ for( const ChkCBoxEntries* pArr = aChkArr;
+ InvalidCBEntry != pArr->eType; ++pArr, bFirst = !bFirst )
+ {
+ USHORT nCol = bFirst ? 1 : 2;
+ SvLBoxEntry* pEntry = GetEntry4Type( static_cast< sal_IntPtr >( pArr->eType ) );
+ if( pEntry )
+ {
+ SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem( nCol ));
+ if( pItem && ((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON )
+ {
+ if( (pOpt->*pArr->FnIs)() )
+ pItem->SetStateChecked();
+ else
+ pItem->SetStateUnchecked();
+ aCheckLB.InvalidateEntry( pEntry );
+ }
+ }
+ }
+ aCheckLB.SetUpdateMode( TRUE );
+}
+
+void OfaMSFilterTabPage2::InsertEntry( const String& _rTxt, sal_IntPtr _nType )
+{
+ SvLBoxEntry* pEntry = new SvLBoxEntry;
+
+ if( !pCheckButtonData )
+ pCheckButtonData = new SvLBoxButtonData( &aCheckLB );
+
+ pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0));
+ pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox,
+ 0, pCheckButtonData ) );
+ pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox,
+ 0, pCheckButtonData ) );
+ pEntry->AddItem( new SvLBoxString( pEntry, 0, _rTxt ) );
+
+ pEntry->SetUserData( (void*)_nType );
+ aCheckLB.Insert( pEntry );
+}
+
+SvLBoxEntry* OfaMSFilterTabPage2::GetEntry4Type( sal_IntPtr _nType ) const
+{
+ SvLBoxEntry* pEntry = aCheckLB.First();
+ while ( pEntry )
+ {
+ if ( _nType == sal_IntPtr( pEntry->GetUserData() ) )
+ return pEntry;
+ pEntry = aCheckLB.Next( pEntry );
+ }
+ return NULL;
+}
+
+void OfaMSFilterTabPage2::MSFltrSimpleTable::SetTabs()
+{
+ SvxSimpleTable::SetTabs();
+ USHORT nAdjust = SV_LBOXTAB_ADJUST_RIGHT|SV_LBOXTAB_ADJUST_LEFT|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_ADJUST_NUMERIC|SV_LBOXTAB_FORCE;
+
+ if( aTabs.Count() > 1 )
+ {
+ SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(1);
+ pTab->nFlags &= ~nAdjust;
+ pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE;
+ }
+ if( aTabs.Count() > 2 )
+ {
+ SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(2);
+ pTab->nFlags &= ~nAdjust;
+ pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE;
+ }
+}
+
+void OfaMSFilterTabPage2::MSFltrSimpleTable::HBarClick()
+{
+ // Sortierung durch diese Ueberladung abgeklemmt
+}
+/* -----------------------------2002/06/20 11:51------------------------------
+
+ ---------------------------------------------------------------------------*/
+void OfaMSFilterTabPage2::MSFltrSimpleTable::SetCheckButtonState(
+ SvLBoxEntry* pEntry, USHORT nCol, SvButtonState eState)
+{
+ SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1));
+
+ DBG_ASSERT(pItem,"SetCheckButton:Item not found");
+ if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON)
+ {
+ switch( eState )
+ {
+ case SV_BUTTON_CHECKED:
+ pItem->SetStateChecked();
+ break;
+
+ case SV_BUTTON_UNCHECKED:
+ pItem->SetStateUnchecked();
+ break;
+
+ case SV_BUTTON_TRISTATE:
+ pItem->SetStateTristate();
+ break;
+ }
+ InvalidateEntry( pEntry );
+ }
+}
+/* -----------------------------2002/06/20 11:56------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvButtonState OfaMSFilterTabPage2::MSFltrSimpleTable::GetCheckButtonState(
+ SvLBoxEntry* pEntry, USHORT nCol ) const
+{
+ SvButtonState eState = SV_BUTTON_UNCHECKED;
+ SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1));
+ DBG_ASSERT(pItem,"GetChButnState:Item not found");
+
+ if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON)
+ {
+ USHORT nButtonFlags = pItem->GetButtonFlags();
+ eState = pCheckButtonData->ConvertToButtonState( nButtonFlags );
+ }
+
+ return eState;
+}
+/* -----------------------------2002/06/20 11:57------------------------------
+
+ ---------------------------------------------------------------------------*/
+void OfaMSFilterTabPage2::MSFltrSimpleTable::CheckEntryPos(ULONG nPos, USHORT nCol, BOOL bChecked)
+{
+ if ( nPos < GetEntryCount() )
+ SetCheckButtonState(
+ GetEntry(nPos),
+ nCol,
+ bChecked ? SvButtonState( SV_BUTTON_CHECKED ) :
+ SvButtonState( SV_BUTTON_UNCHECKED ) );
+}
+/* -----------------------------2002/06/20 11:51------------------------------
+
+ ---------------------------------------------------------------------------*/
+void OfaMSFilterTabPage2::MSFltrSimpleTable::KeyInput( const KeyEvent& rKEvt )
+{
+ if(!rKEvt.GetKeyCode().GetModifier() &&
+ KEY_SPACE == rKEvt.GetKeyCode().GetCode())
+ {
+ ULONG nSelPos = GetModel()->GetAbsPos(GetCurEntry());
+ USHORT nCol = GetCurrentTabPos() - 1;
+ if ( nCol < 2 )
+ {
+ SvLBoxEntry* pEntry = GetEntry( nSelPos );
+ sal_Bool bIsChecked = ( GetCheckButtonState( pEntry, nCol ) == SV_BUTTON_CHECKED );
+ CheckEntryPos( nSelPos, nCol, !bIsChecked );
+ CallImplEventListeners( VCLEVENT_CHECKBOX_TOGGLE, (void*)pEntry );
+ }
+ else
+ {
+ USHORT nCheck = GetCheckButtonState( GetEntry(nSelPos), 1 ) == SV_BUTTON_CHECKED ? 1 : 0;
+ if(GetCheckButtonState( GetEntry(nSelPos), 0 ))
+ nCheck += 2;
+ nCheck--;
+ nCheck &= 3;
+ CheckEntryPos(nSelPos, 1, 0 != (nCheck & 1));
+ CheckEntryPos(nSelPos, 0, 0 != (nCheck & 2));
+ }
+ }
+ else
+ SvxSimpleTable::KeyInput(rKEvt);
+}
+
diff --git a/cui/source/options/optfltr.hrc b/cui/source/options/optfltr.hrc
new file mode 100644
index 000000000000..dad722916860
--- /dev/null
+++ b/cui/source/options/optfltr.hrc
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optfltr.hrc,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTFLTR_HRC
+#define _SVX_OPTFLTR_HRC
+
+// defines ------------------------------------------------------------------
+
+#define GB_WORD 1
+#define GB_EXCEL 2
+#define GB_PPOINT 3
+
+#define CB_WBAS_CODE 1
+#define CB_WBAS_STG 2
+#define CB_EBAS_CODE 3
+#define CB_EBAS_EXECTBL 4
+#define CB_EBAS_STG 5
+#define CB_PBAS_CODE 6
+#define CB_PBAS_STG 7
+
+#define CLB_SETTINGS 1
+#define ST_CHG_MATH 1
+#define ST_CHG_WRITER 2
+#define ST_CHG_CALC 3
+#define ST_CHG_IMPRESS 4
+#define ST_HEADER1 5
+#define ST_HEADER2 6
+#define FT_HEADER1_EXPLANATION 1
+#define FT_HEADER2_EXPLANATION 2
+
+#endif
+
diff --git a/cui/source/options/optfltr.hxx b/cui/source/options/optfltr.hxx
new file mode 100644
index 000000000000..6f8c975098db
--- /dev/null
+++ b/cui/source/options/optfltr.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optfltr.hxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _OFA_OPTFLTR_HXX
+#define _OFA_OPTFLTR_HXX
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#ifndef _GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+#include <vcl/fixed.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svx/simptabl.hxx>
+
+
+
+class OfaMSFilterTabPage : public SfxTabPage
+{
+ FixedLine aMSWordGB;
+ CheckBox aWBasicCodeCB;
+ CheckBox aWBasicStgCB;
+ FixedLine aMSExcelGB;
+ CheckBox aEBasicCodeCB;
+ CheckBox aEBasicExectblCB;
+ CheckBox aEBasicStgCB;
+ FixedLine aMSPPointGB;
+ CheckBox aPBasicCodeCB;
+ CheckBox aPBasicStgCB;
+
+ OfaMSFilterTabPage( Window* pParent, const SfxItemSet& rSet );
+ virtual ~OfaMSFilterTabPage();
+
+ DECL_LINK( LoadExcelBasicCheckHdl_Impl, CheckBox* );
+public:
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+class OfaMSFilterTabPage2 : public SfxTabPage
+{
+ class MSFltrSimpleTable : public SvxSimpleTable
+ {
+ using SvTreeListBox::GetCheckButtonState;
+ using SvTreeListBox::SetCheckButtonState;
+ using SvxSimpleTable::SetTabs;
+
+ void CheckEntryPos(ULONG nPos, USHORT nCol, BOOL bChecked);
+ SvButtonState GetCheckButtonState( SvLBoxEntry*, USHORT nCol ) const;
+ void SetCheckButtonState( SvLBoxEntry*, USHORT nCol, SvButtonState );
+ protected:
+ virtual void SetTabs();
+ virtual void HBarClick();
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+ public:
+ MSFltrSimpleTable(Window* pParent, const ResId& rResId ) :
+ SvxSimpleTable( pParent, rResId ){}
+ };
+
+ MSFltrSimpleTable aCheckLB;
+ FixedText aHeader1FT, aHeader2FT;
+ String sHeader1, sHeader2;
+ String sChgToFromMath,
+ sChgToFromWriter,
+ sChgToFromCalc,
+ sChgToFromImpress;
+ SvLBoxButtonData* pCheckButtonData;
+
+ OfaMSFilterTabPage2( Window* pParent, const SfxItemSet& rSet );
+ virtual ~OfaMSFilterTabPage2();
+
+ void InsertEntry( const String& _rTxt, sal_IntPtr _nType );
+ SvLBoxEntry* GetEntry4Type( sal_IntPtr _nType ) const;
+
+public:
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+
+#endif //
+
+
diff --git a/cui/source/options/optfltr.src b/cui/source/options/optfltr.src
new file mode 100644
index 000000000000..a03a3bc1cc9c
--- /dev/null
+++ b/cui/source/options/optfltr.src
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optfltr.src,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include -----------------------------------------------------------------
+#include "optfltr.hrc"
+#include <cuires.hrc>
+ // pragma ------------------------------------------------------------------
+
+// RID_OFAPAGE_MSFILTEROPT -----------------------------------------------------
+TabPage RID_OFAPAGE_MSFILTEROPT
+{
+ // HelpId = ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+
+ FixedLine GB_WORD
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Microsoft Word 97/2000/XP";
+ };
+ CheckBox CB_WBAS_CODE
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Load Basic ~code";
+ };
+ CheckBox CB_WBAS_STG
+ {
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Save ~original Basic code";
+ };
+
+ FixedLine GB_EXCEL
+ {
+ Pos = MAP_APPFONT ( 6 , 44 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Microsoft Excel 97/2000/XP";
+ };
+ CheckBox CB_EBAS_CODE
+ {
+ Pos = MAP_APPFONT ( 12 , 55 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Lo~ad Basic code";
+ };
+ CheckBox CB_EBAS_EXECTBL
+ {
+ Pos = MAP_APPFONT ( 22 , 69 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "E~xecutable code";
+ };
+ CheckBox CB_EBAS_STG
+ {
+ Pos = MAP_APPFONT ( 12 , 83 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Sa~ve original Basic code";
+ };
+
+ FixedLine GB_PPOINT
+ {
+ Pos = MAP_APPFONT ( 6 , 99 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Microsoft PowerPoint 97/2000/XP";
+ };
+ CheckBox CB_PBAS_CODE
+ {
+ Pos = MAP_APPFONT ( 12 , 110 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Load Ba~sic code";
+ };
+ CheckBox CB_PBAS_STG
+ {
+ Pos = MAP_APPFONT ( 12 , 124 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Sav~e original Basic code";
+ };
+};
+
+// RID_OFAPAGE_MSFILTEROPT2 -----------------------------------------------------
+TabPage RID_OFAPAGE_MSFILTEROPT2
+{
+ // HelpId = ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+
+ Control CLB_SETTINGS
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 248 , 147 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ String ST_HEADER1
+ {
+ Text [ en-US ] = "[L]";
+ };
+ String ST_HEADER2
+ {
+ Text [ en-US ] = "[S]";
+ };
+ FixedText FT_HEADER1_EXPLANATION
+ {
+ Pos = MAP_APPFONT ( 6 , 160 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "[L]: Load and convert the object";
+ };
+ FixedText FT_HEADER2_EXPLANATION
+ {
+ Pos = MAP_APPFONT ( 6 , 171 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "[S]: Convert and save the object";
+ };
+ String ST_CHG_MATH
+ {
+ Text [ en-US ] = "MathType to %PRODUCTNAME Math / %PRODUCTNAME Math to MathType";
+ };
+ String ST_CHG_WRITER
+ {
+ Text [ en-US ] = "WinWord to %PRODUCTNAME Writer / %PRODUCTNAME Writer to WinWord";
+ };
+ String ST_CHG_CALC
+ {
+ Text [ en-US ] = "Excel to %PRODUCTNAME Calc / %PRODUCTNAME Calc to Excel";
+ };
+ String ST_CHG_IMPRESS
+ {
+ Text [ en-US ] = "PowerPoint to %PRODUCTNAME Impress / %PRODUCTNAME Impress to PowerPoint";
+ };
+};
+
+ // ******************************************************************* EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
new file mode 100644
index 000000000000..656eca17fd22
--- /dev/null
+++ b/cui/source/options/optgdlg.cxx
@@ -0,0 +1,1921 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optgdlg.cxx,v $
+ * $Revision: 1.53.20.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include <svl/zforlist.hxx>
+#include <goodies/grfmgr.hxx>
+#include <svl/flagitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <unotools/lingucfg.hxx>
+#include <svl/szitem.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/imgmgr.hxx>
+#include <vcl/configsettings.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/mnemonic.hxx>
+#include <i18npool/mslangid.hxx>
+#include <unotools/useroptions.hxx>
+#include <unotools/cacheoptions.hxx>
+#include <unotools/fontoptions.hxx>
+#include <svtools/menuoptions.hxx>
+#include <unotools/startoptions.hxx>
+#include <svl/languageoptions.hxx>
+#include <svtools/miscopt.hxx>
+#include <unotools/printwarningoptions.hxx>
+#include <unotools/syslocaleoptions.hxx>
+#include <svtools/helpopt.hxx>
+#include <svtools/accessibilityoptions.hxx>
+#include <unotools/configitem.hxx>
+#include <sfx2/objsh.hxx>
+#include <comphelper/types.hxx>
+#include <svl/ctloptions.hxx>
+#include <svtools/langtab.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <unotools/configmgr.hxx>
+#include "cuioptgenrl.hxx"
+#include "optpath.hxx"
+#include "optsave.hxx"
+#include "optlingu.hxx"
+#include <svx/xpool.hxx>
+#include <svx/dlgutil.hxx>
+#include "cuitabarea.hxx"
+#include <cuires.hrc>
+#include <svx/unolingu.hxx>
+#include <svx/langitem.hxx>
+#include <comphelper/processfactory.hxx>
+#include <rtl/ustrbuf.hxx>
+
+
+#include <dialmgr.hxx>
+#include <svtools/helpopt.hxx>
+#include <unotools/saveopt.hxx>
+
+#include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#include <com/sun/star/container/XSet.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
+
+#include <vcl/svapp.hxx>
+
+#include "optgdlg.hrc"
+#include "optgdlg.hxx"
+#include <svx/ofaitem.hxx>
+#include <svtools/apearcfg.hxx>
+#include <svtools/optionsdrawinglayer.hxx>
+
+#define CONFIG_LANGUAGES "OfficeLanguages"
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::util;
+using namespace ::utl;
+using ::rtl::OString;
+using ::rtl::OUString;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+
+#define MAX_PROGRAM_ENTRIES 3
+
+// class OfaMiscTabPage --------------------------------------------------
+
+int OfaMiscTabPage::DeactivatePage( SfxItemSet* pSet_ )
+{
+ if ( pSet_ )
+ FillItemSet( *pSet_ );
+ return LEAVE_PAGE;
+}
+
+namespace
+{
+ ::rtl::OUString impl_SystemFileOpenServiceName()
+ {
+ const ::rtl::OUString &rDesktopEnvironment =
+ Application::GetDesktopEnvironment();
+
+ if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "gnome" ) )
+ {
+ #ifdef ENABLE_GTK
+ return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.GtkFilePicker" );
+ #else
+ return rtl::OUString();
+ #endif
+ }
+ else if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde4" ) )
+ {
+ #ifdef ENABLE_KDE4
+ return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.KDE4FilePicker" );
+ #else
+ return rtl::OUString();
+ #endif
+ }
+ else if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde" ) )
+ {
+ #ifdef ENABLE_KDE
+ return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.KDEFilePicker" );
+ #else
+ return rtl::OUString();
+ #endif
+ }
+ #if defined WNT
+ return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.SystemFilePicker" );
+ #elif (defined MACOSX && defined QUARTZ)
+ return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.AquaFilePicker" );
+ #else
+ return rtl::OUString();
+ #endif
+ }
+
+ sal_Bool lcl_HasSystemFilePicker()
+ {
+ Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
+ sal_Bool bRet = sal_False;
+
+ Reference< XContentEnumerationAccess > xEnumAccess( xFactory, UNO_QUERY );
+ Reference< XSet > xSet( xFactory, UNO_QUERY );
+
+ if ( ! xEnumAccess.is() || ! xSet.is() )
+ return bRet;
+
+ try
+ {
+ ::rtl::OUString aFileService = impl_SystemFileOpenServiceName();
+ Reference< XEnumeration > xEnum = xEnumAccess->createContentEnumeration( aFileService );
+ if ( xEnum.is() && xEnum->hasMoreElements() )
+ bRet = sal_True;
+ }
+
+ catch( IllegalArgumentException ) {}
+ catch( ElementExistException ) {}
+ return bRet;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+OfaMiscTabPage::OfaMiscTabPage(Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, CUI_RES( OFA_TP_MISC ), rSet ),
+
+ aHelpFL ( this, CUI_RES( FL_HELP ) ),
+ aToolTipsCB ( this, CUI_RES( CB_TOOLTIP ) ),
+ aExtHelpCB ( this, CUI_RES( CB_EXTHELP ) ),
+ aHelpAgentCB ( this, CUI_RES( CB_HELPAGENT ) ),
+ aHelpAgentResetBtn ( this, CUI_RES( PB_HELPAGENT_RESET ) ),
+ aHelpFormatFT ( this, CUI_RES( FT_HELPFORMAT ) ),
+ aHelpFormatLB ( this, CUI_RES( LB_HELPFORMAT ) ),
+ aFileDlgFL ( this, CUI_RES( FL_FILEDLG ) ),
+ aFileDlgROImage ( this, CUI_RES( FI_FILEDLG_RO ) ),
+ aFileDlgCB ( this, CUI_RES( CB_FILEDLG ) ),
+ aPrintDlgFL ( this, CUI_RES( FL_PRINTDLG ) ),
+ aPrintDlgCB ( this, CUI_RES( CB_PRINTDLG ) ),
+ aDocStatusFL ( this, CUI_RES( FL_DOCSTATUS ) ),
+ aDocStatusCB ( this, CUI_RES( CB_DOCSTATUS ) ),
+ aTwoFigureFL ( this, CUI_RES( FL_TWOFIGURE ) ),
+ aInterpretFT ( this, CUI_RES( FT_INTERPRET ) ),
+ aYearValueField ( this, CUI_RES( NF_YEARVALUE ) ),
+ aToYearFT ( this, CUI_RES( FT_TOYEAR ) )
+
+{
+ FreeResource();
+
+ if (!lcl_HasSystemFilePicker())
+ {
+ aFileDlgFL.Hide();
+ aFileDlgCB.Hide();
+ }
+
+ #if ! defined(QUARTZ)
+ aPrintDlgFL.Hide();
+ aPrintDlgCB.Hide();
+ #endif
+
+ if ( !aFileDlgCB.IsVisible() )
+ {
+ // rearrange the following controls
+ Point aNewPos = aDocStatusFL.GetPosPixel();
+ long nDelta = aNewPos.Y() - aFileDlgFL.GetPosPixel().Y();
+
+ Window* pWins[] =
+ {
+ &aPrintDlgFL, &aPrintDlgCB, &aDocStatusFL, &aDocStatusCB, &aTwoFigureFL,
+ &aInterpretFT, &aYearValueField, &aToYearFT
+ };
+ Window** pCurrent = pWins;
+ const sal_Int32 nCount = sizeof( pWins ) / sizeof( pWins[ 0 ] );
+ for ( sal_Int32 i = 0; i < nCount; ++i, ++pCurrent )
+ {
+ aNewPos = (*pCurrent)->GetPosPixel();
+ aNewPos.Y() -= nDelta;
+ (*pCurrent)->SetPosPixel( aNewPos );
+ }
+ }
+ else if ( SvtMiscOptions().IsUseSystemFileDialogReadOnly() )
+ {
+ aFileDlgROImage.Show();
+ aFileDlgCB.Disable();
+ }
+
+ if ( aPrintDlgCB.IsVisible() )
+ {
+ // rearrange the following controls
+ Point aNewPos = aDocStatusFL.GetPosPixel();
+ long nDelta = aNewPos.Y() - aFileDlgFL.GetPosPixel().Y();
+
+ Window* pWins[] =
+ {
+ &aDocStatusFL, &aDocStatusCB, &aTwoFigureFL,
+ &aInterpretFT, &aYearValueField, &aToYearFT
+ };
+ Window** pCurrent = pWins;
+ const sal_Int32 nCount = sizeof( pWins ) / sizeof( pWins[ 0 ] );
+ for ( sal_Int32 i = 0; i < nCount; ++i, ++pCurrent )
+ {
+ aNewPos = (*pCurrent)->GetPosPixel();
+ aNewPos.Y() += nDelta;
+ (*pCurrent)->SetPosPixel( aNewPos );
+ }
+ }
+
+ // at least the button is as wide as its text
+ long nTxtWidth = aHelpAgentResetBtn.GetTextWidth( aHelpAgentResetBtn.GetText() );
+ Size aBtnSz = aHelpAgentResetBtn.GetSizePixel();
+ if ( aBtnSz.Width() < nTxtWidth )
+ {
+ aBtnSz.Width() = nTxtWidth;
+ aHelpAgentResetBtn.SetSizePixel( aBtnSz );
+ }
+
+ aStrDateInfo = aToYearFT.GetText();
+ aYearValueField.SetModifyHdl( LINK( this, OfaMiscTabPage, TwoFigureHdl ) );
+ Link aLink = LINK( this, OfaMiscTabPage, TwoFigureConfigHdl );
+ aYearValueField.SetDownHdl( aLink );
+ aYearValueField.SetUpHdl( aLink );
+ aYearValueField.SetLoseFocusHdl( aLink );
+ aYearValueField.SetFirstHdl( aLink );
+ TwoFigureConfigHdl( &aYearValueField );
+
+ SetExchangeSupport();
+
+ aLink = LINK( this, OfaMiscTabPage, HelpCheckHdl_Impl );
+ aToolTipsCB.SetClickHdl( aLink );
+ aHelpAgentCB.SetClickHdl( aLink );
+ aHelpAgentResetBtn.SetClickHdl( LINK( this, OfaMiscTabPage, HelpAgentResetHdl_Impl ) );
+
+ //fill default names as user data
+ static const char* aHelpFormatNames[] =
+ {
+ "Default",
+ "HighContrast1",
+ "HighContrast2",
+ "HighContrastBlack",
+ "HighContrastWhite"
+ };
+
+ for ( USHORT i = 0; i < aHelpFormatLB.GetEntryCount(); i++ )
+ {
+ String* pData = new String( String::CreateFromAscii( aHelpFormatNames[i] ) );
+ aHelpFormatLB.SetEntryData( i, pData );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+OfaMiscTabPage::~OfaMiscTabPage()
+{
+ for(USHORT i = 0; i < aHelpFormatLB.GetEntryCount(); i++)
+ {
+ delete static_cast< String* >( aHelpFormatLB.GetEntryData(i) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* OfaMiscTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new OfaMiscTabPage( pParent, rAttrSet );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL OfaMiscTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ BOOL bModified = FALSE;
+
+ SvtHelpOptions aHelpOptions;
+ BOOL bChecked = aToolTipsCB.IsChecked();
+ if ( bChecked != aToolTipsCB.GetSavedValue() )
+ aHelpOptions.SetHelpTips( bChecked );
+ bChecked = ( aExtHelpCB.IsChecked() && aToolTipsCB.IsChecked() );
+ if ( bChecked != aExtHelpCB.GetSavedValue() )
+ aHelpOptions.SetExtendedHelp( bChecked );
+ bChecked = aHelpAgentCB.IsChecked();
+ if ( bChecked != aHelpAgentCB.GetSavedValue() )
+ aHelpOptions.SetHelpAgentAutoStartMode( bChecked );
+ USHORT nHelpFormatPos = aHelpFormatLB.GetSelectEntryPos();
+ if ( nHelpFormatPos != LISTBOX_ENTRY_NOTFOUND &&
+ nHelpFormatPos != aHelpFormatLB.GetSavedValue() )
+ {
+ aHelpOptions.SetHelpStyleSheet( *static_cast< String* >( aHelpFormatLB.GetEntryData( nHelpFormatPos ) ) );
+ }
+
+ if ( aFileDlgCB.IsChecked() != aFileDlgCB.GetSavedValue() )
+ {
+ SvtMiscOptions aMiscOpt;
+ aMiscOpt.SetUseSystemFileDialog( !aFileDlgCB.IsChecked() );
+ bModified = TRUE;
+ }
+
+ if ( aPrintDlgCB.IsChecked() != aPrintDlgCB.GetSavedValue() )
+ {
+ SvtMiscOptions aMiscOpt;
+ aMiscOpt.SetUseSystemPrintDialog( !aPrintDlgCB.IsChecked() );
+ bModified = TRUE;
+ }
+
+ if ( aDocStatusCB.IsChecked() != aDocStatusCB.GetSavedValue() )
+ {
+ SvtPrintWarningOptions aPrintOptions;
+ aPrintOptions.SetModifyDocumentOnPrintingAllowed( aDocStatusCB.IsChecked() );
+ bModified = TRUE;
+ }
+
+ const SfxUInt16Item* pUInt16Item =
+ PTR_CAST( SfxUInt16Item, GetOldItem( rSet, SID_ATTR_YEAR2000 ) );
+ USHORT nNum = (USHORT)aYearValueField.GetText().ToInt32();
+ if ( pUInt16Item && pUInt16Item->GetValue() != nNum )
+ {
+ bModified = TRUE;
+ rSet.Put( SfxUInt16Item( SID_ATTR_YEAR2000, nNum ) );
+ }
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+void OfaMiscTabPage::Reset( const SfxItemSet& rSet )
+{
+ SvtHelpOptions aHelpOptions;
+ aToolTipsCB.Check( aHelpOptions.IsHelpTips() );
+ aExtHelpCB.Check( aHelpOptions.IsHelpTips() && aHelpOptions.IsExtendedHelp() );
+ aHelpAgentCB.Check( aHelpOptions.IsHelpAgentAutoStartMode() );
+ String sStyleSheet = aHelpOptions.GetHelpStyleSheet();
+ for ( USHORT i = 0; i < aHelpFormatLB.GetEntryCount(); ++i )
+ {
+ if ( *static_cast< String* >( aHelpFormatLB.GetEntryData(i) ) == sStyleSheet )
+ {
+ aHelpFormatLB.SelectEntryPos(i);
+ break;
+ }
+ }
+
+ aToolTipsCB.SaveValue();
+ aExtHelpCB.SaveValue();
+ aHelpAgentCB.SaveValue();
+ aHelpFormatLB.SaveValue();
+ HelpCheckHdl_Impl( &aHelpAgentCB );
+
+ SvtMiscOptions aMiscOpt;
+ aFileDlgCB.Check( !aMiscOpt.UseSystemFileDialog() );
+ aFileDlgCB.SaveValue();
+ aPrintDlgCB.Check( !aMiscOpt.UseSystemPrintDialog() );
+ aPrintDlgCB.SaveValue();
+
+ SvtPrintWarningOptions aPrintOptions;
+ aDocStatusCB.Check(aPrintOptions.IsModifyDocumentOnPrintingAllowed());
+ aDocStatusCB.SaveValue();
+
+ const SfxPoolItem* pItem = NULL;
+ if ( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_YEAR2000, FALSE, &pItem ) )
+ {
+ aYearValueField.SetValue( ((SfxUInt16Item*)pItem)->GetValue() );
+ TwoFigureConfigHdl( &aYearValueField );
+ }
+ else
+ {
+ aYearValueField.Enable(FALSE);
+ aTwoFigureFL.Enable(FALSE);
+ aInterpretFT.Enable(FALSE);
+ aToYearFT.Enable(FALSE);
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( OfaMiscTabPage, TwoFigureHdl, NumericField*, pEd )
+{
+ (void)pEd;
+
+ String aOutput( aStrDateInfo );
+ String aStr( aYearValueField.GetText() );
+ String sSep( SvtSysLocale().GetLocaleData().getNumThousandSep() );
+ xub_StrLen nIndex = 0;
+ while ((nIndex = aStr.Search( sSep, nIndex)) != STRING_NOTFOUND)
+ aStr.Erase( nIndex, sSep.Len());
+ long nNum = aStr.ToInt32();
+ if ( aStr.Len() != 4 || nNum < aYearValueField.GetMin() || nNum > aYearValueField.GetMax() )
+ aOutput.AppendAscii("????");
+ else
+ {
+ nNum += 99;
+ aOutput += String::CreateFromInt32( nNum );
+ }
+ aToYearFT.SetText( aOutput );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( OfaMiscTabPage, TwoFigureConfigHdl, NumericField*, pEd )
+{
+ sal_Int64 nNum = aYearValueField.GetValue();
+ String aOutput( String::CreateFromInt64( nNum ) );
+ aYearValueField.SetText( aOutput );
+ aYearValueField.SetSelection( Selection( 0, aOutput.Len() ) );
+ TwoFigureHdl( pEd );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( OfaMiscTabPage, HelpCheckHdl_Impl, CheckBox*, EMPTYARG )
+{
+ aExtHelpCB.Enable( aToolTipsCB.IsChecked() );
+ aHelpAgentResetBtn.Enable( aHelpAgentCB.IsChecked() );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( OfaMiscTabPage, HelpAgentResetHdl_Impl, PushButton*, EMPTYARG )
+{
+ SvtHelpOptions().resetAgentIgnoreURLCounter();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+// -------------------------------------------------------------------
+class CanvasSettings
+{
+public:
+ CanvasSettings();
+
+ BOOL IsHardwareAccelerationEnabled() const;
+ BOOL IsHardwareAccelerationAvailable() const;
+ void EnabledHardwareAcceleration( BOOL _bEnabled ) const;
+
+private:
+ typedef std::vector< std::pair<OUString,Sequence<OUString> > > ServiceVector;
+
+ Reference<XNameAccess> mxForceFlagNameAccess;
+ ServiceVector maAvailableImplementations;
+ mutable BOOL mbHWAccelAvailable;
+ mutable BOOL mbHWAccelChecked;
+};
+
+// -------------------------------------------------------------------
+CanvasSettings::CanvasSettings() :
+ mxForceFlagNameAccess(),
+ mbHWAccelAvailable(FALSE),
+ mbHWAccelChecked(FALSE)
+{
+ try
+ {
+ Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
+ Reference<XMultiServiceFactory> xConfigProvider(
+ xFactory->createInstance(
+ OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")),
+ UNO_QUERY_THROW );
+
+ Any propValue(
+ makeAny( PropertyValue(
+ OUString::createFromAscii("nodepath"), -1,
+ makeAny( OUString::createFromAscii("/org.openoffice.Office.Canvas") ),
+ PropertyState_DIRECT_VALUE ) ) );
+
+ mxForceFlagNameAccess.set(
+ xConfigProvider->createInstanceWithArguments(
+ OUString::createFromAscii("com.sun.star.configuration.ConfigurationUpdateAccess"),
+ Sequence<Any>( &propValue, 1 ) ),
+ UNO_QUERY_THROW );
+
+ propValue = makeAny(
+ PropertyValue(
+ OUString::createFromAscii("nodepath"), -1,
+ makeAny( OUString::createFromAscii("/org.openoffice.Office.Canvas/CanvasServiceList") ),
+ PropertyState_DIRECT_VALUE ) );
+
+ Reference<XNameAccess> xNameAccess(
+ xConfigProvider->createInstanceWithArguments(
+ OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess"),
+ Sequence<Any>( &propValue, 1 ) ), UNO_QUERY_THROW );
+ Reference<XHierarchicalNameAccess> xHierarchicalNameAccess(
+ xNameAccess, UNO_QUERY_THROW);
+
+ Sequence<OUString> serviceNames = xNameAccess->getElementNames();
+ const OUString* pCurr = serviceNames.getConstArray();
+ const OUString* const pEnd = pCurr + serviceNames.getLength();
+ while( pCurr != pEnd )
+ {
+ Reference<XNameAccess> xEntryNameAccess(
+ xHierarchicalNameAccess->getByHierarchicalName(*pCurr),
+ UNO_QUERY );
+
+ if( xEntryNameAccess.is() )
+ {
+ Sequence<OUString> preferredImplementations;
+ if( (xEntryNameAccess->getByName( OUString::createFromAscii("PreferredImplementations") ) >>= preferredImplementations) )
+ maAvailableImplementations.push_back( std::make_pair(*pCurr,preferredImplementations) );
+ }
+
+ ++pCurr;
+ }
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+// -------------------------------------------------------------------
+BOOL CanvasSettings::IsHardwareAccelerationAvailable() const
+{
+ if( !mbHWAccelChecked )
+ {
+ mbHWAccelChecked = true;
+
+ Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
+
+ // check whether any of the service lists has an
+ // implementation that presents the "HardwareAcceleration" property
+ ServiceVector::const_iterator aCurr=maAvailableImplementations.begin();
+ const ServiceVector::const_iterator aEnd=maAvailableImplementations.end();
+ while( aCurr != aEnd )
+ {
+ const OUString* pCurrImpl = aCurr->second.getConstArray();
+ const OUString* const pEndImpl = pCurrImpl + aCurr->second.getLength();
+
+ while( pCurrImpl != pEndImpl )
+ {
+ try
+ {
+ Reference<XPropertySet> xPropSet( xFactory->createInstance(
+ pCurrImpl->trim() ),
+ UNO_QUERY_THROW );
+ bool bHasAccel(false);
+ if( (xPropSet->getPropertyValue(OUString::createFromAscii("HardwareAcceleration")) >>= bHasAccel) )
+ if( bHasAccel )
+ {
+ mbHWAccelAvailable = true;
+ return mbHWAccelAvailable;
+ }
+ }
+ catch (Exception &)
+ {}
+
+ ++pCurrImpl;
+ }
+
+ ++aCurr;
+ }
+ }
+
+ return mbHWAccelAvailable;
+}
+
+// -------------------------------------------------------------------
+BOOL CanvasSettings::IsHardwareAccelerationEnabled() const
+{
+ bool bForceLastEntry(false);
+ if( !mxForceFlagNameAccess.is() )
+ return true;
+
+ if( !(mxForceFlagNameAccess->getByName( OUString::createFromAscii("ForceSafeServiceImpl") ) >>= bForceLastEntry) )
+ return true;
+
+ return !bForceLastEntry;
+}
+
+// -------------------------------------------------------------------
+void CanvasSettings::EnabledHardwareAcceleration( BOOL _bEnabled ) const
+{
+ Reference< XNameReplace > xNameReplace(
+ mxForceFlagNameAccess, UNO_QUERY );
+
+ if( !xNameReplace.is() )
+ return;
+
+ xNameReplace->replaceByName( OUString::createFromAscii("ForceSafeServiceImpl"),
+ makeAny(!_bEnabled) );
+
+ Reference< XChangesBatch > xChangesBatch(
+ mxForceFlagNameAccess, UNO_QUERY );
+
+ if( !xChangesBatch.is() )
+ return;
+
+ xChangesBatch->commitChanges();
+}
+
+// class OfaViewTabPage --------------------------------------------------
+
+OfaViewTabPage::OfaViewTabPage(Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, CUI_RES( OFA_TP_VIEW ), rSet ),
+
+ aUserInterfaceFL ( this, CUI_RES( FL_USERINTERFACE ) ),
+ aWindowSizeFT ( this, CUI_RES( FT_WINDOWSIZE ) ),
+ aWindowSizeMF ( this, CUI_RES( MF_WINDOWSIZE ) ),
+ aIconSizeStyleFT ( this, CUI_RES( FT_ICONSIZESTYLE ) ),
+ aIconSizeLB ( this, CUI_RES( LB_ICONSIZE ) ),
+ aIconStyleLB ( this, CUI_RES( LB_ICONSTYLE ) ),
+ m_aSystemFont (this, CUI_RES( CB_SYSTEM_FONT ) ),
+#if defined( UNX )
+ aFontAntiAliasing ( this, CUI_RES( CB_FONTANTIALIASING )),
+ aAAPointLimitLabel ( this, CUI_RES( FT_POINTLIMIT_LABEL )),
+ aAAPointLimit ( this, CUI_RES( NF_AA_POINTLIMIT )),
+ aAAPointLimitUnits ( this, CUI_RES( FT_POINTLIMIT_UNIT )),
+#endif
+ aMenuFL ( this, CUI_RES( FL_MENU ) ),
+ aMenuIconsFT ( this, CUI_RES( FT_MENU_ICONS )),
+ aMenuIconsLB ( this, CUI_RES( LB_MENU_ICONS )),
+ aFontListsFL ( this, CUI_RES( FL_FONTLISTS) ),
+ aFontShowCB ( this, CUI_RES( CB_FONT_SHOW ) ),
+ aFontHistoryCB ( this, CUI_RES( CB_FONT_HISTORY ) ),
+ aRenderingFL ( this, CUI_RES( FL_RENDERING ) ),
+ aUseHardwareAccell ( this, CUI_RES( CB_USE_HARDACCELL ) ),
+ aUseAntiAliase ( this, CUI_RES( CB_USE_ANTIALIASE ) ),
+ aMouseFL ( this, CUI_RES( FL_MOUSE ) ),
+ aMousePosFT ( this, CUI_RES( FT_MOUSEPOS ) ),
+ aMousePosLB ( this, CUI_RES( LB_MOUSEPOS ) ),
+ aMouseMiddleFT ( this, CUI_RES( FT_MOUSEMIDDLE ) ),
+ aMouseMiddleLB ( this, CUI_RES( LB_MOUSEMIDDLE ) ),
+
+ // #i97672#
+ maSelectionFL(this, CUI_RES(FL_SELECTION)),
+ maSelectionCB(this, CUI_RES(CB_SELECTION)),
+ maSelectionMF(this, CUI_RES(MF_SELECTION)),
+
+ nSizeLB_InitialSelection(0),
+ nStyleLB_InitialSelection(0),
+ pAppearanceCfg(new SvtTabAppearanceCfg),
+ pCanvasSettings(new CanvasSettings),
+ mpDrawinglayerOpt(new SvtOptionsDrawinglayer)
+{
+#if defined( UNX )
+ aFontAntiAliasing.SetToggleHdl( LINK( this, OfaViewTabPage, OnAntialiasingToggled ) );
+
+ // depending on the size of the text in aAAPointLimitLabel, we slightly re-arrange aAAPointLimit and aAAPointLimitUnits
+ //#110391# if the label has no mnemonic and we are in a CJK version the mnemonic "(X)" will be added which
+ // influences the width calculation
+ MnemonicGenerator aMnemonicGenerator;
+ String sLabel(aAAPointLimitLabel.GetText());
+ aMnemonicGenerator.RegisterMnemonic( sLabel );
+ aMnemonicGenerator.CreateMnemonic( sLabel );
+ sLabel.EraseAllChars('~');
+
+ sal_Int32 nLabelWidth = aAAPointLimitLabel.GetTextWidth( sLabel );
+ nLabelWidth += 3; // small gap
+ // pixels to move both controls to the left
+ Size aSize = aAAPointLimitLabel.GetSizePixel();
+ sal_Int32 nMoveLeft = aSize.Width() - nLabelWidth;
+ // resize the first label
+ aSize.Width() = nLabelWidth;
+ aAAPointLimitLabel.SetSizePixel( aSize );
+
+ // move the numeric field
+ Point aPos( aAAPointLimit.GetPosPixel() );
+ aPos.X() -= nMoveLeft;
+ aAAPointLimit.SetPosPixel( aPos );
+
+ // move (and resize) the units FixedText
+ aPos = ( aAAPointLimitUnits.GetPosPixel() );
+ aPos.X() -= nMoveLeft;
+ aSize = aAAPointLimitUnits.GetSizePixel();
+ aSize.Width() += nMoveLeft;
+ aAAPointLimitUnits.SetPosSizePixel( aPos, aSize );
+#else
+ // on this platform, we do not have the anti aliasing options - move the other checkboxes accordingly
+ // (in the resource, the coordinates are calculated for the AA options beeing present)
+ Control* pMiscOptions[] =
+ {
+ &aMenuFL, &aMenuIconsFT, &aMenuIconsLB,
+ &aFontListsFL, &aFontShowCB, &aFontHistoryCB
+ };
+
+ // temporaryly create the checkbox for the anti aliasing (we need to to determine it's pos)
+ CheckBox* pFontAntiAliasing = new CheckBox( this, CUI_RES( CB_FONTANTIALIASING ) );
+ sal_Int32 nMoveUp = aMenuFL.GetPosPixel().Y() - pFontAntiAliasing->GetPosPixel().Y();
+ DELETEZ( pFontAntiAliasing );
+
+ Point aPos;
+ for ( sal_Int32 i = 0; i < sizeof( pMiscOptions ) / sizeof( pMiscOptions[0] ); ++i )
+ {
+ aPos = pMiscOptions[i]->GetPosPixel( );
+ aPos.Y() -= nMoveUp;
+ pMiscOptions[i]->SetPosPixel( aPos );
+ }
+
+#endif
+
+ // #i97672#
+ maSelectionCB.SetToggleHdl( LINK( this, OfaViewTabPage, OnSelectionToggled ) );
+
+ FreeResource();
+
+ if( ! Application::ValidateSystemFont() )
+ {
+ m_aSystemFont.Check( FALSE );
+ m_aSystemFont.Enable( FALSE );
+ }
+
+ const StyleSettings& aStyleSettings = Application::GetSettings().GetStyleSettings();
+
+ // remove non-installed icon themes
+ if( aIconStyleLB.GetEntryCount() == STYLE_SYMBOLS_THEMES_MAX )
+ {
+ // do not check 0th item == auto; it is not a real theme
+ aIconStyleItemId[0] = 0;
+ ULONG nItem = 1;
+ for ( ULONG n=0; ++n < STYLE_SYMBOLS_THEMES_MAX; )
+ {
+ if ( aStyleSettings.CheckSymbolStyle( n ) )
+ {
+ // existing style => save the item id
+ aIconStyleItemId[n] = nItem++;
+ }
+ else
+ {
+ // non-existing style => remove item;
+ aIconStyleLB.RemoveEntry( nItem );
+ aIconStyleItemId[n] = 0;
+ }
+ }
+ }
+
+ // add real theme name to 'auto' theme, e.g. 'auto' => 'auto (classic)'
+ if( aIconStyleLB.GetEntryCount() > 1 )
+ {
+ ::rtl::OUString aAutoStr( aIconStyleLB.GetEntry( 0 ) );
+
+ aAutoStr += ::rtl::OUString::createFromAscii( " (" );
+
+ ULONG nAutoStyle = aStyleSettings.GetAutoSymbolsStyle();
+ if ( aIconStyleItemId[nAutoStyle] )
+ aAutoStr += aIconStyleLB.GetEntry( aIconStyleItemId[nAutoStyle] );
+
+ aIconStyleLB.RemoveEntry( 0 );
+ aIconStyleLB.InsertEntry( aAutoStr += ::rtl::OUString::createFromAscii( ")" ), 0 );
+ // separate auto and other icon themes
+ aIconStyleLB.SetSeparatorPos( 0 );
+ }
+}
+
+OfaViewTabPage::~OfaViewTabPage()
+{
+ delete mpDrawinglayerOpt;
+ delete pCanvasSettings;
+ delete pAppearanceCfg;
+}
+
+#if defined( UNX )
+//--- 20.08.01 10:16:12 ---------------------------------------------------
+IMPL_LINK( OfaViewTabPage, OnAntialiasingToggled, void*, NOTINTERESTEDIN )
+{
+ (void)NOTINTERESTEDIN;
+
+ sal_Bool bAAEnabled = aFontAntiAliasing.IsChecked();
+
+ aAAPointLimitLabel.Enable( bAAEnabled );
+ aAAPointLimit.Enable( bAAEnabled );
+ aAAPointLimitUnits.Enable( bAAEnabled );
+
+ return 0L;
+}
+#endif
+
+// #i97672#
+IMPL_LINK( OfaViewTabPage, OnSelectionToggled, void*, NOTINTERESTEDIN )
+{
+ (void)NOTINTERESTEDIN;
+ const bool bSelectionEnabled(maSelectionCB.IsChecked());
+ maSelectionMF.Enable(bSelectionEnabled);
+ return 0;
+}
+
+/*-----------------06.12.96 11.50-------------------
+
+--------------------------------------------------*/
+
+SfxTabPage* OfaViewTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new OfaViewTabPage(pParent, rAttrSet);
+}
+
+/*-----------------06.12.96 11.50-------------------
+
+--------------------------------------------------*/
+
+BOOL OfaViewTabPage::FillItemSet( SfxItemSet& )
+{
+ SvtFontOptions aFontOpt;
+ SvtMenuOptions aMenuOpt;
+ SvtStartOptions aStartOpt;
+
+ BOOL bModified = FALSE;
+ BOOL bMenuOptModified = FALSE;
+ bool bRepaintWindows(false);
+
+ SvtMiscOptions aMiscOptions;
+ UINT16 nSizeLB_NewSelection = aIconSizeLB.GetSelectEntryPos();
+ if( nSizeLB_InitialSelection != nSizeLB_NewSelection )
+ {
+ // from now on it's modified, even if via auto setting the same size was set as now selected in the LB
+ sal_Int16 eSet = SFX_SYMBOLS_SIZE_AUTO;
+ switch( nSizeLB_NewSelection )
+ {
+ case 0: eSet = SFX_SYMBOLS_SIZE_AUTO; break;
+ case 1: eSet = SFX_SYMBOLS_SIZE_SMALL; break;
+ case 2: eSet = SFX_SYMBOLS_SIZE_LARGE; break;
+ default:
+ DBG_ERROR( "OfaViewTabPage::FillItemSet(): This state of aIconSizeLB should not be possible!" );
+ }
+ aMiscOptions.SetSymbolsSize( eSet );
+ }
+
+ UINT16 nStyleLB_NewSelection = aIconStyleLB.GetSelectEntryPos();
+ if( nStyleLB_InitialSelection != nStyleLB_NewSelection )
+ {
+ // find the style name in the aIconStyleItemId table
+ // items from the non-installed icon themes were removed
+ for ( ULONG n=0; n < STYLE_SYMBOLS_THEMES_MAX; n++ )
+ {
+ if ( aIconStyleItemId[n] == nStyleLB_NewSelection )
+ {
+ aMiscOptions.SetSymbolsStyle( n );
+ n = STYLE_SYMBOLS_THEMES_MAX;
+ }
+ }
+ }
+
+ BOOL bAppearanceChanged = FALSE;
+
+
+ // Screen Scaling
+ UINT16 nOldScale = pAppearanceCfg->GetScaleFactor();
+ UINT16 nNewScale = (UINT16)aWindowSizeMF.GetValue();
+
+ if ( nNewScale != nOldScale )
+ {
+ pAppearanceCfg->SetScaleFactor(nNewScale);
+ bAppearanceChanged = TRUE;
+ }
+
+ // Mouse Snap Mode
+ short eOldSnap = pAppearanceCfg->GetSnapMode();
+ short eNewSnap = aMousePosLB.GetSelectEntryPos();
+ if(eNewSnap > 2)
+ eNewSnap = 2;
+
+ if ( eNewSnap != eOldSnap )
+ {
+ pAppearanceCfg->SetSnapMode(eNewSnap );
+ bAppearanceChanged = TRUE;
+ }
+
+ // Middle Mouse Button
+ short eOldMiddleMouse = pAppearanceCfg->GetMiddleMouseButton();
+ short eNewMiddleMouse = aMouseMiddleLB.GetSelectEntryPos();
+ if(eNewMiddleMouse > 2)
+ eNewMiddleMouse = 2;
+
+ if ( eNewMiddleMouse != eOldMiddleMouse )
+ {
+ pAppearanceCfg->SetMiddleMouseButton( eNewMiddleMouse );
+ bAppearanceChanged = TRUE;
+ }
+
+#if defined( UNX )
+ if ( aFontAntiAliasing.IsChecked() != aFontAntiAliasing.GetSavedValue() )
+ {
+ pAppearanceCfg->SetFontAntiAliasing( aFontAntiAliasing.IsChecked() );
+ bAppearanceChanged = TRUE;
+ }
+
+ if ( aAAPointLimit.GetValue() != aAAPointLimit.GetSavedValue().ToInt32() )
+ {
+ pAppearanceCfg->SetFontAntialiasingMinPixelHeight( aAAPointLimit.GetValue() );
+ bAppearanceChanged = TRUE;
+ }
+#endif
+
+ if ( aFontShowCB.IsChecked() != aFontShowCB.GetSavedValue() )
+ {
+ aFontOpt.EnableFontWYSIWYG( aFontShowCB.IsChecked() );
+ bModified = TRUE;
+ }
+
+ if(aMenuIconsLB.GetSelectEntryPos() != aMenuIconsLB.GetSavedValue())
+ {
+ aMenuOpt.SetMenuIconsState( aMenuIconsLB.GetSelectEntryPos() == 0 ? 2 : aMenuIconsLB.GetSelectEntryPos() - 1);
+ bModified = TRUE;
+ bMenuOptModified = TRUE;
+ bAppearanceChanged = TRUE;
+ }
+
+ if ( aFontHistoryCB.IsChecked() != aFontHistoryCB.GetSavedValue() )
+ {
+ aFontOpt.EnableFontHistory( aFontHistoryCB.IsChecked() );
+ bModified = TRUE;
+ }
+
+ // #i95644# if disabled, do not use value, see in ::Reset()
+ if(aUseHardwareAccell.IsEnabled())
+ {
+ if(aUseHardwareAccell.IsChecked() != aUseHardwareAccell.GetSavedValue())
+ {
+ pCanvasSettings->EnabledHardwareAcceleration(aUseHardwareAccell.IsChecked());
+ bModified = TRUE;
+ }
+ }
+
+ // #i95644# if disabled, do not use value, see in ::Reset()
+ if(aUseAntiAliase.IsEnabled())
+ {
+ if(aUseAntiAliase.IsChecked() != mpDrawinglayerOpt->IsAntiAliasing())
+ {
+ mpDrawinglayerOpt->SetAntiAliasing(aUseAntiAliase.IsChecked());
+ bModified = TRUE;
+ bRepaintWindows = true;
+ }
+ }
+
+ // #i97672#
+ if(maSelectionCB.IsEnabled())
+ {
+ const bool bNewSelection(maSelectionCB.IsChecked());
+ const sal_uInt16 nNewTransparence((sal_uInt16)maSelectionMF.GetValue());
+
+ if(bNewSelection != (bool)mpDrawinglayerOpt->IsTransparentSelection())
+ {
+ mpDrawinglayerOpt->SetTransparentSelection(maSelectionCB.IsChecked());
+ bModified = TRUE;
+ bRepaintWindows = true;
+ }
+
+ // #i104150# even read the value when maSelectionMF is disabled; it may have been
+ // modified by enabling-modify-disabling by the user
+ if(nNewTransparence != mpDrawinglayerOpt->GetTransparentSelectionPercent())
+ {
+ mpDrawinglayerOpt->SetTransparentSelectionPercent(nNewTransparence);
+ bModified = TRUE;
+ bRepaintWindows = true;
+ }
+ }
+
+ SvtAccessibilityOptions aAccessibilityOptions;
+ if( aAccessibilityOptions.GetIsSystemFont() != m_aSystemFont.IsChecked() &&
+ m_aSystemFont.IsEnabled() )
+ {
+ aAccessibilityOptions.SetIsSystemFont( m_aSystemFont.IsChecked() );
+ bModified = TRUE;
+ bMenuOptModified = TRUE;
+ }
+
+ if( bMenuOptModified )
+ {
+ // Set changed settings to the application instance
+ AllSettings aAllSettings = Application::GetSettings();
+ StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
+ if( m_aSystemFont.IsEnabled() )
+ aStyleSettings.SetUseSystemUIFonts( m_aSystemFont.IsChecked() );
+ aAllSettings.SetStyleSettings(aStyleSettings);
+ Application::MergeSystemSettings( aAllSettings );
+ Application::SetSettings(aAllSettings);
+ }
+
+ if ( bAppearanceChanged )
+ {
+ pAppearanceCfg->Commit();
+ pAppearanceCfg->SetApplicationDefaults ( GetpApp() );
+ }
+
+ if(bRepaintWindows)
+ {
+ Window* pAppWindow = Application::GetFirstTopLevelWindow();
+
+ while(pAppWindow)
+ {
+ pAppWindow->Invalidate();
+ pAppWindow = Application::GetNextTopLevelWindow(pAppWindow);
+ }
+ }
+
+ return bModified;
+}
+
+/*-----------------06.12.96 11.50-------------------
+
+--------------------------------------------------*/
+void OfaViewTabPage::Reset( const SfxItemSet& )
+{
+ SvtMiscOptions aMiscOptions;
+
+ if( aMiscOptions.GetSymbolsSize() != SFX_SYMBOLS_SIZE_AUTO )
+ nSizeLB_InitialSelection = ( aMiscOptions.AreCurrentSymbolsLarge() )? 2 : 1;
+ aIconSizeLB.SelectEntryPos( nSizeLB_InitialSelection );
+ aIconSizeLB.SaveValue();
+
+ if( aMiscOptions.GetSymbolsStyle() != STYLE_SYMBOLS_AUTO )
+ nStyleLB_InitialSelection = aIconStyleItemId[aMiscOptions.GetCurrentSymbolsStyle()];
+
+ aIconStyleLB.SelectEntryPos( nStyleLB_InitialSelection );
+ aIconStyleLB.SaveValue();
+
+ if( m_aSystemFont.IsEnabled() )
+ {
+ SvtAccessibilityOptions aAccessibilityOptions;
+ m_aSystemFont.Check( aAccessibilityOptions.GetIsSystemFont() );
+ }
+
+ // Screen Scaling
+ aWindowSizeMF.SetValue ( pAppearanceCfg->GetScaleFactor() );
+ // Mouse Snap
+ aMousePosLB.SelectEntryPos(pAppearanceCfg->GetSnapMode());
+ aMousePosLB.SaveValue();
+
+ // Mouse Snap
+ aMouseMiddleLB.SelectEntryPos(pAppearanceCfg->GetMiddleMouseButton());
+ aMouseMiddleLB.SaveValue();
+
+#if defined( UNX )
+ aFontAntiAliasing.Check( pAppearanceCfg->IsFontAntiAliasing() );
+ aAAPointLimit.SetValue( pAppearanceCfg->GetFontAntialiasingMinPixelHeight() );
+#endif
+
+ // WorkingSet
+ SvtFontOptions aFontOpt;
+ aFontShowCB.Check( aFontOpt.IsFontWYSIWYGEnabled() );
+ SvtMenuOptions aMenuOpt;
+ aMenuIconsLB.SelectEntryPos(aMenuOpt.GetMenuIconsState() == 2 ? 0 : aMenuOpt.GetMenuIconsState() + 1);
+ aMenuIconsLB.SaveValue();
+ aFontHistoryCB.Check( aFontOpt.IsFontHistoryEnabled() );
+
+ { // #i95644# HW accel (unified to disable mechanism)
+ if(pCanvasSettings->IsHardwareAccelerationAvailable())
+ {
+ aUseHardwareAccell.Check(pCanvasSettings->IsHardwareAccelerationEnabled());
+ }
+ else
+ {
+ aUseHardwareAccell.Check(false);
+ aUseHardwareAccell.Disable();
+ }
+
+ aUseHardwareAccell.SaveValue();
+ }
+
+ { // #i95644# AntiAliasing
+ if(mpDrawinglayerOpt->IsAAPossibleOnThisSystem())
+ {
+ aUseAntiAliase.Check(mpDrawinglayerOpt->IsAntiAliasing());
+ }
+ else
+ {
+ aUseAntiAliase.Check(false);
+ aUseAntiAliase.Disable();
+ }
+
+ aUseAntiAliase.SaveValue();
+ }
+
+ {
+ // #i97672# Selection
+ // check if transparent selection is possible on this system
+ const bool bTransparentSelectionPossible(
+ !GetSettings().GetStyleSettings().GetHighContrastMode()
+ && supportsOperation(OutDevSupport_TransparentRect));
+
+ // enter values
+ if(bTransparentSelectionPossible)
+ {
+ maSelectionCB.Check(mpDrawinglayerOpt->IsTransparentSelection());
+ }
+ else
+ {
+ maSelectionCB.Enable(false);
+ }
+
+ maSelectionMF.SetValue(mpDrawinglayerOpt->GetTransparentSelectionPercent());
+ maSelectionMF.Enable(mpDrawinglayerOpt->IsTransparentSelection() && bTransparentSelectionPossible);
+ }
+
+#if defined( UNX )
+ aFontAntiAliasing.SaveValue();
+ aAAPointLimit.SaveValue();
+#endif
+ aFontShowCB.SaveValue();
+ aFontHistoryCB.SaveValue();
+
+#if defined( UNX )
+ LINK( this, OfaViewTabPage, OnAntialiasingToggled ).Call( NULL );
+#endif
+}
+/* -----------------------------23.11.00 14:55--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class LangConfigItem_Impl : public ConfigItem
+{
+ Any aValue;
+ OUString aPropertyName;
+public:
+ LangConfigItem_Impl(const OUString& rTree, const OUString& rProperty);
+ ~LangConfigItem_Impl();
+
+ virtual void Commit();
+
+ const Any& GetValue() const {return aValue;}
+ void SetValue(Any& rValue) {aValue = rValue; SetModified();}
+};
+/* -----------------------------23.11.00 15:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+LangConfigItem_Impl::LangConfigItem_Impl(
+ const OUString& rTree, const OUString& rProperty) :
+ ConfigItem(rTree),
+ aPropertyName(rProperty)
+{
+ Sequence<OUString> aNames(1);
+ aNames.getArray()[0] = aPropertyName;
+ Sequence<Any> aValues = GetProperties(aNames);
+ aValue = aValues.getConstArray()[0];
+}
+/* -----------------------------23.11.00 15:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+LangConfigItem_Impl::~LangConfigItem_Impl()
+{}
+/* -----------------------------23.11.00 15:10--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void LangConfigItem_Impl::Commit()
+{
+ Sequence<OUString> aNames(1);
+ aNames.getArray()[0] = aPropertyName;
+ Sequence<Any> aValues(1);
+ aValues.getArray()[0] = aValue;
+ PutProperties(aNames, aValues);
+}
+/* -----------------22.07.2003 10:33-----------------
+
+ --------------------------------------------------*/
+struct LanguageConfig_Impl
+{
+ SvtLanguageOptions aLanguageOptions;
+ SvtSysLocaleOptions aSysLocaleOptions;
+ SvtLinguConfig aLinguConfig;
+};
+/* -----------------------------23.11.00 13:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static sal_Bool bLanguageCurrentDoc_Impl = sal_False;
+
+// some things we'll need...
+static const OUString sConfigSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider");
+static const OUString sAccessSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess");
+static const OUString sAccessUpdSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationUpdateAccess");
+static const OUString sInstalledLocalesPath = OUString::createFromAscii("org.openoffice.Setup/Office/InstalledLocales");
+static OUString sUserLocalePath = OUString::createFromAscii("org.openoffice.Office.Linguistic/General");
+//static const OUString sUserLocalePath = OUString::createFromAscii("org.openoffice.Office/Linguistic");
+static const OUString sUserLocaleKey = OUString::createFromAscii("UILocale");
+static const OUString sSystemLocalePath = OUString::createFromAscii("org.openoffice.System/L10N");
+static const OUString sSystemLocaleKey = OUString::createFromAscii("UILocale");
+static const OUString sOfficeLocalePath = OUString::createFromAscii("org.openoffice.Office/L10N");
+static const OUString sOfficeLocaleKey = OUString::createFromAscii("ooLocale");
+static Sequence< OUString > seqInstalledLanguages;
+
+OfaLanguagesTabPage::OfaLanguagesTabPage( Window* pParent, const SfxItemSet& rSet ) :
+ SfxTabPage( pParent, CUI_RES( OFA_TP_LANGUAGES ), rSet ),
+ aUILanguageGB(this, CUI_RES(FL_UI_LANG )),
+ aLocaleSettingFI(this, CUI_RES(FI_LOCALESETTING)),
+ aUserInterfaceFT(this, CUI_RES(FT_USERINTERFACE)),
+ aUserInterfaceLB(this, CUI_RES(LB_USERINTERFACE)),
+ aLocaleSettingFT(this, CUI_RES(FT_LOCALESETTING)),
+ aLocaleSettingLB(this, CUI_RES(LB_LOCALESETTING)),
+ aCurrencyFI( this, CUI_RES(FI_CURRENCY )),
+ aDecimalSeparatorFT(this, CUI_RES(FT_DECIMALSEPARATOR)),
+ aDecimalSeparatorCB(this, CUI_RES(CB_DECIMALSEPARATOR)),
+ aCurrencyFT( this, CUI_RES(FT_CURRENCY )),
+ aCurrencyLB( this, CUI_RES(LB_CURRENCY )),
+ aLinguLanguageGB(this, CUI_RES(FL_LINGU_LANG )),
+ aWesternLanguageFI(this, CUI_RES(FI_WEST_LANG )),
+ aWesternLanguageFT(this, CUI_RES(FT_WEST_LANG )),
+ aWesternLanguageLB(this, CUI_RES(LB_WEST_LANG )),
+ aAsianLanguageFI(this, CUI_RES(FI_ASIAN_LANG )),
+ aAsianLanguageFT(this, CUI_RES(FT_ASIAN_LANG )),
+ aAsianLanguageLB(this, CUI_RES(LB_ASIAN_LANG )),
+ aComplexLanguageFI(this, CUI_RES(FI_COMPLEX_LANG )),
+ aComplexLanguageFT(this, CUI_RES(FT_COMPLEX_LANG )),
+ aComplexLanguageLB(this, CUI_RES(LB_COMPLEX_LANG )),
+ aCurrentDocCB(this, CUI_RES(CB_CURRENT_DOC )),
+ aEnhancedFL(this, CUI_RES(FL_ENHANCED )),
+ aAsianSupportFI(this, CUI_RES(FI_ASIANSUPPORT )),
+ aAsianSupportCB(this, CUI_RES(CB_ASIANSUPPORT )),
+ aCTLSupportFI(this, CUI_RES(FI_CTLSUPPORT )),
+ aCTLSupportCB(this, CUI_RES(CB_CTLSUPPORT )),
+ sDecimalSeparatorLabel(aDecimalSeparatorCB.GetText()),
+ pLangConfig(new LanguageConfig_Impl)
+{
+ FreeResource();
+
+ // initialize user interface language selection
+ SvtLanguageTable* pLanguageTable = new SvtLanguageTable;
+ const String aStr( pLanguageTable->GetString( LANGUAGE_SYSTEM ) );
+
+ String aUILang(aStr);
+ aUILang += String::CreateFromAscii(" - ");
+ aUILang += pLanguageTable->GetString( Application::GetSettings().GetUILanguage() );
+
+ aUserInterfaceLB.InsertEntry(aUILang);
+ aUserInterfaceLB.SetEntryData(0, 0);
+ aUserInterfaceLB.SelectEntryPos(0);
+ try
+ {
+ OUString sOfficeLocaleValue;
+ OUString sSystemLocaleValue;
+
+ Reference< XMultiServiceFactory > theMSF = comphelper::getProcessServiceFactory();
+ Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory > (
+ theMSF->createInstance( sConfigSrvc ),UNO_QUERY_THROW);
+ Sequence< Any > theArgs(2);
+ Reference< XNameAccess > theNameAccess;
+
+ // find out which locales are currently installed and add them to the listbox
+ theArgs[0] = makeAny(NamedValue(OUString::createFromAscii("NodePath"), makeAny(sInstalledLocalesPath)));
+ theArgs[1] = makeAny(NamedValue(OUString::createFromAscii("reload"), makeAny(sal_True)));
+ theNameAccess = Reference< XNameAccess > (
+ theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs ), UNO_QUERY_THROW );
+ seqInstalledLanguages = theNameAccess->getElementNames();
+ LanguageType aLang = LANGUAGE_DONTKNOW;
+ for (sal_Int32 i=0; i<seqInstalledLanguages.getLength(); i++)
+ {
+ aLang = MsLangId::convertIsoStringToLanguage(seqInstalledLanguages[i]);
+ if (aLang != LANGUAGE_DONTKNOW)
+ {
+ //USHORT p = aUserInterfaceLB.InsertLanguage(aLang);
+ String aLangStr( pLanguageTable->GetString( aLang ) );
+ USHORT p = aUserInterfaceLB.InsertEntry(aLangStr);
+ aUserInterfaceLB.SetEntryData(p, (void*)(i+1));
+ }
+ }
+
+ // find out whether the user has a specific locale specified
+ Sequence< Any > theArgs2(1);
+ theArgs2[0] = makeAny(NamedValue(OUString::createFromAscii("NodePath"), makeAny(sUserLocalePath)));
+ theNameAccess = Reference< XNameAccess > (
+ theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs2 ), UNO_QUERY_THROW );
+ if (theNameAccess->hasByName(sUserLocaleKey))
+ theNameAccess->getByName(sUserLocaleKey) >>= m_sUserLocaleValue;
+ // select the user specified locale in the listbox
+ if (m_sUserLocaleValue.getLength() > 0)
+ {
+ sal_Int32 d = 0;
+ for (USHORT i=0; i < aUserInterfaceLB.GetEntryCount(); i++)
+ {
+ d = (sal_Int32)(sal_IntPtr)aUserInterfaceLB.GetEntryData(i);
+ if ( d > 0 && seqInstalledLanguages.getLength() > d-1 && seqInstalledLanguages[d-1].equals(m_sUserLocaleValue))
+ aUserInterfaceLB.SelectEntryPos(i);
+ }
+ }
+
+ }
+ catch (Exception &e)
+ {
+ // we'll just leave the box in it's default setting and won't
+ // even give it event handler...
+ OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US);
+ OSL_ENSURE(sal_False, aMsg.getStr());
+ }
+
+ aWesternLanguageLB.SetLanguageList( LANG_LIST_WESTERN | LANG_LIST_ONLY_KNOWN, TRUE, FALSE, TRUE );
+ aWesternLanguageLB.InsertDefaultLanguage( ::com::sun::star::i18n::ScriptType::LATIN );
+ aAsianLanguageLB.SetLanguageList( LANG_LIST_CJK | LANG_LIST_ONLY_KNOWN, TRUE, FALSE, TRUE );
+ aAsianLanguageLB.InsertDefaultLanguage( ::com::sun::star::i18n::ScriptType::ASIAN );
+ aComplexLanguageLB.SetLanguageList( LANG_LIST_CTL | LANG_LIST_ONLY_KNOWN, TRUE, FALSE, TRUE );
+ aComplexLanguageLB.InsertDefaultLanguage( ::com::sun::star::i18n::ScriptType::COMPLEX );
+
+ aLocaleSettingLB.SetLanguageList( LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, FALSE, FALSE, FALSE);
+ aLocaleSettingLB.InsertDefaultLanguage( ::com::sun::star::i18n::ScriptType::WEAK );
+
+ const NfCurrencyTable& rCurrTab = SvNumberFormatter::GetTheCurrencyTable();
+ const NfCurrencyEntry& rCurr = SvNumberFormatter::GetCurrencyEntry( LANGUAGE_SYSTEM );
+ // insert SYSTEM entry
+ String aDefaultCurr(aStr);
+ aDefaultCurr += String::CreateFromAscii(" - ");
+ aDefaultCurr += rCurr.GetBankSymbol();
+ aCurrencyLB.InsertEntry( aDefaultCurr );
+ // all currencies
+ String aTwoSpace( RTL_CONSTASCII_USTRINGPARAM( " " ) );
+ USHORT nCurrCount = rCurrTab.Count();
+ // first entry is SYSTEM, skip it
+ for ( USHORT j=1; j < nCurrCount; ++j )
+ {
+ const NfCurrencyEntry* pCurr = rCurrTab[j];
+ String aStr_( pCurr->GetBankSymbol() );
+ aStr_ += aTwoSpace;
+ aStr_ += pCurr->GetSymbol();
+ aStr_ = ApplyLreOrRleEmbedding( aStr_ );
+ aStr_ += aTwoSpace;
+ aStr_ += ApplyLreOrRleEmbedding( pLanguageTable->GetString( pCurr->GetLanguage() ) );
+ USHORT nPos = aCurrencyLB.InsertEntry( aStr_ );
+ aCurrencyLB.SetEntryData( nPos, (void*) pCurr );
+ }
+ delete pLanguageTable;
+
+ aLocaleSettingLB.SetSelectHdl( LINK( this, OfaLanguagesTabPage, LocaleSettingHdl ) );
+ Link aLink( LINK( this, OfaLanguagesTabPage, SupportHdl ) );
+ aAsianSupportCB.SetClickHdl( aLink );
+ aCTLSupportCB.SetClickHdl( aLink );
+
+ aAsianSupportCB.Check( m_bOldAsian = pLangConfig->aLanguageOptions.IsAnyEnabled() );
+ aAsianSupportCB.SaveValue();
+ sal_Bool bReadonly = pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_ALLCJK);
+ aAsianSupportCB.Enable(!bReadonly);
+ aAsianSupportFI.Show(bReadonly);
+ SupportHdl( &aAsianSupportCB );
+
+ aCTLSupportCB.Check( m_bOldCtl = pLangConfig->aLanguageOptions.IsCTLFontEnabled() );
+ aCTLSupportCB.SaveValue();
+ bReadonly = pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_CTLFONT);
+ aCTLSupportCB.Enable(!bReadonly);
+ aCTLSupportFI.Show(bReadonly);
+ SupportHdl( &aCTLSupportCB );
+}
+/*-- 23.11.00 13:06:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OfaLanguagesTabPage::~OfaLanguagesTabPage()
+{
+ delete pLangConfig;
+}
+/*-- 23.11.00 13:06:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxTabPage* OfaLanguagesTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new OfaLanguagesTabPage(pParent, rAttrSet);
+}
+/*-- 23.11.00 13:06:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+LanguageType lcl_LangStringToLangType(const OUString& rLang)
+{
+ Locale aLocale;
+ sal_Int32 nSep = rLang.indexOf('-');
+ if (nSep < 0)
+ aLocale.Language = rLang;
+ else
+ {
+ aLocale.Language = rLang.copy(0, nSep);
+ if (nSep < rLang.getLength())
+ aLocale.Country = rLang.copy(nSep+1, rLang.getLength() - (nSep+1));
+ }
+ LanguageType eLangType = SvxLocaleToLanguage( aLocale );
+ return eLangType;
+}
+
+/*-- 23.11.00 13:06:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void lcl_UpdateAndDelete(SfxVoidItem* pInvalidItems[], SfxBoolItem* pBoolItems[], sal_uInt16 nCount)
+{
+ SfxViewFrame* pCurrentFrm = SfxViewFrame::Current();
+ SfxViewFrame* pViewFrm = SfxViewFrame::GetFirst();
+ while(pViewFrm)
+ {
+ SfxBindings& rBind = pViewFrm->GetBindings();
+ for(sal_Int16 i = 0; i < nCount; i++)
+ {
+ if(pCurrentFrm == pViewFrm)
+ rBind.InvalidateAll(sal_False);
+ rBind.SetState( *pInvalidItems[i] );
+ rBind.SetState( *pBoolItems[i] );
+ }
+ pViewFrm = SfxViewFrame::GetNext(*pViewFrm);
+ }
+ for(sal_Int16 i = 0; i < nCount; i++)
+ {
+ delete pInvalidItems[i];
+ delete pBoolItems[i] ;
+ }
+}
+
+BOOL OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ // lock configuration broadcasters so that we can coordinate the notifications
+ pLangConfig->aSysLocaleOptions.BlockBroadcasts( TRUE );
+ pLangConfig->aLanguageOptions.BlockBroadcasts( TRUE );
+ pLangConfig->aLinguConfig.BlockBroadcasts( TRUE );
+
+ if(aCTLSupportCB.IsChecked() &&
+ (aCTLSupportCB.GetSavedValue() != aCTLSupportCB.IsChecked()) ||
+ (aComplexLanguageLB.GetSavedValue() != aComplexLanguageLB.GetSelectEntryPos()))
+ {
+ //sequence checking has to be switched on depending on the selected CTL language
+ LanguageType eCTLLang = aComplexLanguageLB.GetSelectLanguage();
+ sal_Bool bOn = MsLangId::needsSequenceChecking( eCTLLang);
+ pLangConfig->aLanguageOptions.SetCTLSequenceCheckingRestricted(bOn);
+ pLangConfig->aLanguageOptions.SetCTLSequenceChecking(bOn);
+ pLangConfig->aLanguageOptions.SetCTLSequenceCheckingTypeAndReplace(bOn);
+ }
+ try
+ {
+ // handle settings for UI Language
+ // a change of setting needs to bring up a warning message
+ OUString aLangString;
+ sal_Int32 d = (sal_Int32)(sal_IntPtr)aUserInterfaceLB.GetEntryData(aUserInterfaceLB.GetSelectEntryPos());
+ if( d > 0 && seqInstalledLanguages.getLength() > d-1)
+ aLangString = seqInstalledLanguages[d-1];
+
+ /*
+ if( aUserInterfaceLB.GetSelectEntryPos() > 0)
+ aLangString = ConvertLanguageToIsoString(aUserInterfaceLB.GetSelectLanguage());
+ */
+ Reference< XMultiServiceFactory > theMSF = comphelper::getProcessServiceFactory();
+ Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory > (
+ theMSF->createInstance( sConfigSrvc ),UNO_QUERY_THROW);
+ Sequence< Any > theArgs(1);
+ theArgs[0] = makeAny(sUserLocalePath);
+ Reference< XPropertySet >xProp(
+ theConfigProvider->createInstanceWithArguments(sAccessUpdSrvc, theArgs ), UNO_QUERY_THROW );
+ if ( !m_sUserLocaleValue.equals(aLangString))
+ {
+ // OSL_ENSURE(sal_False, "UserInterface language was changed, restart.");
+ // write new value
+ xProp->setPropertyValue(sUserLocaleKey, makeAny(aLangString));
+ Reference< XChangesBatch >(xProp, UNO_QUERY_THROW)->commitChanges();
+ // display info
+ InfoBox aBox(this, CUI_RES(RID_SVX_MSGBOX_LANGUAGE_RESTART));
+ aBox.Execute();
+
+ // tell quickstarter to stop being a veto listener
+
+ Reference< XInitialization > xInit(theMSF->createInstance(
+ OUString::createFromAscii("com.sun.star.office.Quickstart")), UNO_QUERY);
+ if (xInit.is())
+ {
+ Sequence< Any > args(3);
+ args[0] = makeAny(sal_False); // will be ignored
+ args[1] = makeAny(sal_False); // will be ignored
+ args[2] = makeAny(sal_False); // disable veto
+ xInit->initialize(args);
+ }
+ }
+ }
+ catch (Exception& e)
+ {
+ // we'll just leave the box in it's default setting and won't
+ // even give it event handler...
+ OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US);
+ OSL_ENSURE(sal_False, aMsg.getStr());
+ }
+
+ OUString sLang = pLangConfig->aSysLocaleOptions.GetLocaleConfigString();
+ LanguageType eOldLocale = (sLang.getLength() ?
+ lcl_LangStringToLangType( sLang ) : LANGUAGE_SYSTEM);
+ LanguageType eNewLocale = aLocaleSettingLB.GetSelectLanguage();
+ if ( eOldLocale != eNewLocale )
+ {
+ // an empty string denotes SYSTEM locale
+ OUString sNewLang;
+ if ( eNewLocale != LANGUAGE_SYSTEM )
+ {
+ Locale aLocale;
+ SvxLanguageToLocale( aLocale, eNewLocale );
+ sNewLang = aLocale.Language;
+ if ( aLocale.Country.getLength() > 0 )
+ {
+ sNewLang += C2U("-");
+ sNewLang += aLocale.Country;
+ }
+ }
+
+ // locale nowadays get to AppSettings via notification
+ // this will happen after releasing the lock on the ConfigurationBroadcaster at
+ // the end of this method
+ pLangConfig->aSysLocaleOptions.SetLocaleConfigString( sNewLang );
+ rSet.Put( SfxBoolItem( SID_OPT_LOCALE_CHANGED, TRUE ) );
+ }
+
+ if(aDecimalSeparatorCB.GetSavedValue() != aDecimalSeparatorCB.IsChecked())
+ pLangConfig->aSysLocaleOptions.SetDecimalSeparatorAsLocale(aDecimalSeparatorCB.IsChecked());
+
+ // Configured currency, for example, USD-en-US or EUR-de-DE, or empty for locale default.
+ OUString sOldCurr = pLangConfig->aSysLocaleOptions.GetCurrencyConfigString();
+ USHORT nCurrPos = aCurrencyLB.GetSelectEntryPos();
+ const NfCurrencyEntry* pCurr = (const NfCurrencyEntry*)
+ aCurrencyLB.GetEntryData( nCurrPos );
+ OUString sNewCurr;
+ if ( pCurr )
+ sNewCurr = SvtSysLocaleOptions::CreateCurrencyConfigString(
+ pCurr->GetBankSymbol(), pCurr->GetLanguage() );
+ if ( sOldCurr != sNewCurr )
+ pLangConfig->aSysLocaleOptions.SetCurrencyConfigString( sNewCurr );
+
+ BOOL bRet = FALSE;
+ SfxObjectShell* pCurrentDocShell = SfxObjectShell::Current();
+ Reference< XPropertySet > xLinguProp( LinguMgr::GetLinguPropertySet(), UNO_QUERY );
+ BOOL bCurrentDocCBChecked = aCurrentDocCB.IsChecked();
+ if(aCurrentDocCB.IsEnabled())
+ bLanguageCurrentDoc_Impl = bCurrentDocCBChecked;
+ BOOL bCurrentDocCBChanged = bCurrentDocCBChecked != aCurrentDocCB.GetSavedValue();
+
+ BOOL bValChanged = aWesternLanguageLB.GetSavedValue() != aWesternLanguageLB.GetSelectEntryPos();
+ if( (bCurrentDocCBChanged && !bCurrentDocCBChecked) || bValChanged)
+ {
+ LanguageType eSelectLang = aWesternLanguageLB.GetSelectLanguage();
+ if(!bCurrentDocCBChecked)
+ {
+ Any aValue;
+ Locale aLocale = MsLangId::convertLanguageToLocale( eSelectLang, false );
+ aValue <<= aLocale;
+ OUString aPropName( C2U("DefaultLocale") );
+ pLangConfig->aLinguConfig.SetProperty( aPropName, aValue );
+ if (xLinguProp.is())
+ xLinguProp->setPropertyValue( aPropName, aValue );
+ }
+ if(pCurrentDocShell)
+ {
+ rSet.Put(SvxLanguageItem(MsLangId::resolveSystemLanguageByScriptType(eSelectLang, ::com::sun::star::i18n::ScriptType::LATIN),
+ SID_ATTR_LANGUAGE));
+ bRet = TRUE;
+ }
+ }
+ bValChanged = aAsianLanguageLB.GetSavedValue() != aAsianLanguageLB.GetSelectEntryPos();
+ if( (bCurrentDocCBChanged && !bCurrentDocCBChecked) || bValChanged)
+ {
+ LanguageType eSelectLang = aAsianLanguageLB.GetSelectLanguage();
+ if(!bCurrentDocCBChecked)
+ {
+ Any aValue;
+ Locale aLocale = MsLangId::convertLanguageToLocale( eSelectLang, false );
+ aValue <<= aLocale;
+ OUString aPropName( C2U("DefaultLocale_CJK") );
+ pLangConfig->aLinguConfig.SetProperty( aPropName, aValue );
+ if (xLinguProp.is())
+ xLinguProp->setPropertyValue( aPropName, aValue );
+ }
+ if(pCurrentDocShell)
+ {
+ rSet.Put(SvxLanguageItem(MsLangId::resolveSystemLanguageByScriptType(eSelectLang, ::com::sun::star::i18n::ScriptType::ASIAN),
+ SID_ATTR_CHAR_CJK_LANGUAGE));
+ bRet = TRUE;
+ }
+ }
+ bValChanged = aComplexLanguageLB.GetSavedValue() != aComplexLanguageLB.GetSelectEntryPos();
+ if( (bCurrentDocCBChanged && !bCurrentDocCBChecked) || bValChanged)
+ {
+ LanguageType eSelectLang = aComplexLanguageLB.GetSelectLanguage();
+ if(!bCurrentDocCBChecked)
+ {
+ Any aValue;
+ Locale aLocale = MsLangId::convertLanguageToLocale( eSelectLang, false );
+ aValue <<= aLocale;
+ OUString aPropName( C2U("DefaultLocale_CTL") );
+ pLangConfig->aLinguConfig.SetProperty( aPropName, aValue );
+ if (xLinguProp.is())
+ xLinguProp->setPropertyValue( aPropName, aValue );
+ }
+ if(pCurrentDocShell)
+ {
+ rSet.Put(SvxLanguageItem(MsLangId::resolveSystemLanguageByScriptType(eSelectLang, ::com::sun::star::i18n::ScriptType::COMPLEX),
+ SID_ATTR_CHAR_CTL_LANGUAGE));
+ bRet = TRUE;
+ }
+ }
+
+ if(aAsianSupportCB.GetSavedValue() != aAsianSupportCB.IsChecked() )
+ {
+ sal_Bool bChecked = aAsianSupportCB.IsChecked();
+ pLangConfig->aLanguageOptions.SetAll(bChecked);
+
+ //iterate over all bindings to invalidate vertical text direction
+ const sal_uInt16 STATE_COUNT = 2;
+
+ SfxBoolItem* pBoolItems[STATE_COUNT];
+ pBoolItems[0] = new SfxBoolItem(SID_VERTICALTEXT_STATE, FALSE);
+ pBoolItems[1] = new SfxBoolItem(SID_TEXT_FITTOSIZE_VERTICAL, FALSE);
+
+ SfxVoidItem* pInvalidItems[STATE_COUNT];
+ pInvalidItems[0] = new SfxVoidItem(SID_VERTICALTEXT_STATE);
+ pInvalidItems[1] = new SfxVoidItem(SID_TEXT_FITTOSIZE_VERTICAL);
+
+ lcl_UpdateAndDelete(pInvalidItems, pBoolItems, STATE_COUNT);
+ }
+
+ if ( aCTLSupportCB.GetSavedValue() != aCTLSupportCB.IsChecked() )
+ {
+ pLangConfig->aLanguageOptions.SetCTLFontEnabled( aCTLSupportCB.IsChecked() );
+
+ const sal_uInt16 STATE_COUNT = 1;
+ SfxBoolItem* pBoolItems[STATE_COUNT];
+ pBoolItems[0] = new SfxBoolItem(SID_CTLFONT_STATE, FALSE);
+ SfxVoidItem* pInvalidItems[STATE_COUNT];
+ pInvalidItems[0] = new SfxVoidItem(SID_CTLFONT_STATE);
+ lcl_UpdateAndDelete(pInvalidItems, pBoolItems, STATE_COUNT);
+ }
+
+ if ( pLangConfig->aSysLocaleOptions.IsModified() )
+ pLangConfig->aSysLocaleOptions.Commit();
+
+ // first release the lock on the ConfigurationBroadcaster for Locale changes
+ // it seems that our code relies on the fact that before other changes like e.g. currency
+ // are broadcasted locale changes have been done
+ pLangConfig->aSysLocaleOptions.BlockBroadcasts( FALSE );
+ pLangConfig->aLanguageOptions.BlockBroadcasts( FALSE );
+ pLangConfig->aLinguConfig.BlockBroadcasts( FALSE );
+
+ return FALSE;
+}
+//-----------------------------------------------------------------------------
+void OfaLanguagesTabPage::Reset( const SfxItemSet& rSet )
+{
+ OUString sLang = pLangConfig->aSysLocaleOptions.GetLocaleConfigString();
+ if ( sLang.getLength() )
+ aLocaleSettingLB.SelectLanguage(lcl_LangStringToLangType(sLang));
+ else
+ aLocaleSettingLB.SelectLanguage( LANGUAGE_SYSTEM );
+ sal_Bool bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::E_LOCALE);
+ aLocaleSettingLB.Enable(!bReadonly);
+ aLocaleSettingFT.Enable(!bReadonly);
+ aLocaleSettingFI.Show(bReadonly);
+
+ //
+ aDecimalSeparatorCB.Check( pLangConfig->aSysLocaleOptions.IsDecimalSeparatorAsLocale());
+ aDecimalSeparatorCB.SaveValue();
+
+ // let LocaleSettingHdl enable/disable checkboxes for CJK/CTL support
+ // #i15812# must be done *before* the configured currency is set
+ // and update the decimal separator used for the given locale
+ LocaleSettingHdl(&aLocaleSettingLB);
+
+ // configured currency, for example, USD-en-US or EUR-de-DE, or empty for locale default
+ String aAbbrev;
+ LanguageType eLang;
+ const NfCurrencyEntry* pCurr = NULL;
+ sLang = pLangConfig->aSysLocaleOptions.GetCurrencyConfigString();
+ if ( sLang.getLength() )
+ {
+ SvtSysLocaleOptions::GetCurrencyAbbrevAndLanguage( aAbbrev, eLang, sLang );
+ pCurr = SvNumberFormatter::GetCurrencyEntry( aAbbrev, eLang );
+ }
+ // if pCurr==NULL the SYSTEM entry is selected
+ USHORT nPos = aCurrencyLB.GetEntryPos( (void*) pCurr );
+ aCurrencyLB.SelectEntryPos( nPos );
+ bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::E_CURRENCY);
+ aCurrencyLB.Enable(!bReadonly);
+ aCurrencyFT.Enable(!bReadonly);
+ aCurrencyFI.Show(bReadonly);
+
+ //western/CJK/CLK language
+ LanguageType eCurLang = LANGUAGE_NONE;
+ LanguageType eCurLangCJK = LANGUAGE_NONE;
+ LanguageType eCurLangCTL = LANGUAGE_NONE;
+ SfxObjectShell* pCurrentDocShell = SfxObjectShell::Current();
+ //collect the configuration values first
+ aCurrentDocCB.Enable(FALSE);
+ //
+ Any aWestLang;
+ Any aCJKLang;
+ Any aCTLLang;
+ try
+ {
+ aWestLang = pLangConfig->aLinguConfig.GetProperty(C2U("DefaultLocale"));
+ Locale aLocale;
+ aWestLang >>= aLocale;
+
+ eCurLang = MsLangId::convertLocaleToLanguage( aLocale );
+
+ aCJKLang = pLangConfig->aLinguConfig.GetProperty(C2U("DefaultLocale_CJK"));
+ aLocale = Locale();
+ aCJKLang >>= aLocale;
+ eCurLangCJK = MsLangId::convertLocaleToLanguage( aLocale );
+
+ aCTLLang = pLangConfig->aLinguConfig.GetProperty(C2U("DefaultLocale_CTL"));
+ aLocale = Locale();
+ aCTLLang >>= aLocale;
+ eCurLangCTL = MsLangId::convertLocaleToLanguage( aLocale );
+ }
+ catch(Exception&)
+ {
+ }
+ //overwrite them by the values provided by the DocShell
+ if(pCurrentDocShell)
+ {
+ aCurrentDocCB.Enable(TRUE);
+ aCurrentDocCB.Check(bLanguageCurrentDoc_Impl);
+ const SfxPoolItem* pLang;
+ if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_LANGUAGE, FALSE, &pLang))
+ {
+ LanguageType eTempCurLang = ((const SvxLanguageItem*)pLang)->GetValue();
+ if (MsLangId::resolveSystemLanguageByScriptType(eCurLang, ::com::sun::star::i18n::ScriptType::LATIN) != eTempCurLang)
+ eCurLang = eTempCurLang;
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_CHAR_CJK_LANGUAGE, FALSE, &pLang))
+ {
+ LanguageType eTempCurLang = ((const SvxLanguageItem*)pLang)->GetValue();
+ if (MsLangId::resolveSystemLanguageByScriptType(eCurLangCJK, ::com::sun::star::i18n::ScriptType::ASIAN) != eTempCurLang)
+ eCurLangCJK = eTempCurLang;
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_CHAR_CTL_LANGUAGE, FALSE, &pLang))
+ {
+ LanguageType eTempCurLang = ((const SvxLanguageItem*)pLang)->GetValue();
+ if (MsLangId::resolveSystemLanguageByScriptType(eCurLangCTL, ::com::sun::star::i18n::ScriptType::COMPLEX) != eTempCurLang)
+ eCurLangCTL = eTempCurLang;
+ }
+ }
+ if(LANGUAGE_NONE == eCurLang || LANGUAGE_DONTKNOW == eCurLang)
+ aWesternLanguageLB.SelectLanguage(LANGUAGE_NONE);
+ else
+ aWesternLanguageLB.SelectLanguage(eCurLang);
+
+ if(LANGUAGE_NONE == eCurLangCJK || LANGUAGE_DONTKNOW == eCurLangCJK)
+ aAsianLanguageLB.SelectLanguage(LANGUAGE_NONE);
+ else
+ aAsianLanguageLB.SelectLanguage(eCurLangCJK);
+
+ if(LANGUAGE_NONE == eCurLangCTL || LANGUAGE_DONTKNOW == eCurLangCTL)
+ aComplexLanguageLB.SelectLanguage(LANGUAGE_NONE);
+ else
+ aComplexLanguageLB.SelectLanguage(eCurLangCTL);
+
+ aWesternLanguageLB.SaveValue();
+ aAsianLanguageLB.SaveValue();
+ aComplexLanguageLB.SaveValue();
+ aCurrentDocCB.SaveValue();
+
+ sal_Bool bEnable = !pLangConfig->aLinguConfig.IsReadOnly( C2U("DefaultLocale") );
+ aWesternLanguageFT.Enable( bEnable );
+ aWesternLanguageLB.Enable( bEnable );
+
+
+ aWesternLanguageFI.Show(!bEnable);
+
+ // #i15812# controls for CJK/CTL already enabled/disabled from LocaleSettingHdl
+#if 0
+ bEnable = ( !pLangConfig->aLinguConfig.IsReadOnly( C2U("DefaultLocale_CJK") ) && aAsianSupportCB.IsChecked() );
+ aAsianLanguageFT.Enable( bEnable );
+ aAsianLanguageLB.Enable( bEnable );
+
+ bEnable = ( !pLangConfig->aLinguConfig.IsReadOnly( C2U("DefaultLocale_CTL") ) && aCTLSupportCB.IsChecked() );
+ aComplexLanguageFT.Enable( bEnable );
+ aComplexLanguageLB.Enable( bEnable );
+#endif
+ /*---------------------07-05-07--------------------------
+ check the box "For the current document only"
+ set the focus to the Western Language box
+ --------------------------------------------------------*/
+ const SfxPoolItem* pLang = 0;
+ if ( SFX_ITEM_SET == rSet.GetItemState(SID_SET_DOCUMENT_LANGUAGE, FALSE, &pLang ) &&( (const SfxBoolItem*)pLang)->GetValue() == TRUE )
+ {
+ aWesternLanguageLB.GrabFocus();
+ aCurrentDocCB.Enable(TRUE);
+ aCurrentDocCB.Check(TRUE);
+ }
+}
+/* -----------------------------20.04.01 15:09--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( OfaLanguagesTabPage, SupportHdl, CheckBox*, pBox )
+{
+ DBG_ASSERT( pBox, "OfaLanguagesTabPage::SupportHdl(): pBox invalid" );
+
+ sal_Bool bCheck = pBox->IsChecked();
+ if ( &aAsianSupportCB == pBox )
+ {
+ sal_Bool bReadonly = pLangConfig->aLinguConfig.IsReadOnly( C2U("DefaultLocale_CJK"));
+ bCheck = ( bCheck && !bReadonly );
+ aAsianLanguageFT.Enable( bCheck );
+ aAsianLanguageLB.Enable( bCheck );
+ aAsianLanguageFI.Show(bReadonly);
+ if( pBox->IsEnabled() )
+ m_bOldAsian = bCheck;
+ }
+ else if ( &aCTLSupportCB == pBox )
+ {
+ sal_Bool bReadonly = pLangConfig->aLinguConfig.IsReadOnly( C2U("DefaultLocale_CTL"));
+ bCheck = ( bCheck && !bReadonly );
+ aComplexLanguageFT.Enable( bCheck );
+ aComplexLanguageLB.Enable( bCheck );
+ aComplexLanguageFI.Show(bReadonly);
+ if( pBox->IsEnabled() )
+ m_bOldCtl = bCheck;
+ }
+ else
+ {
+ DBG_ERRORFILE( "OfaLanguagesTabPage::SupportHdl(): wrong pBox" );
+ }
+
+ return 0;
+}
+
+namespace
+{
+ void lcl_checkLanguageCheckBox(CheckBox& _rCB,sal_Bool _bNewValue,sal_Bool _bOldValue)
+ {
+ if ( _bNewValue )
+ _rCB.Check(TRUE);
+ else
+ _rCB.Check( _bOldValue );
+// #i15082# do not call SaveValue() in running dialog...
+// _rCB.SaveValue();
+ _rCB.Enable( !_bNewValue );
+ }
+}
+/* -----------------08.06.01 17:56-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK( OfaLanguagesTabPage, LocaleSettingHdl, SvxLanguageBox*, pBox )
+{
+ LanguageType eLang = pBox->GetSelectLanguage();
+ sal_uInt16 nType = SvtLanguageOptions::GetScriptTypeOfLanguage(eLang);
+ // first check if CTL must be enabled
+ // #103299# - if CTL font setting is not readonly
+ if(!pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_CTLFONT))
+ {
+ bool bIsCTLFixed = (nType & SCRIPTTYPE_COMPLEX) != 0;
+ lcl_checkLanguageCheckBox(aCTLSupportCB, bIsCTLFixed, m_bOldCtl);
+ SupportHdl( &aCTLSupportCB );
+ }
+ // second check if CJK must be enabled
+ // #103299# - if CJK support is not readonly
+ if(!pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_ALLCJK))
+ {
+ bool bIsCJKFixed = (nType & SCRIPTTYPE_ASIAN) != 0;
+ lcl_checkLanguageCheckBox(aAsianSupportCB, bIsCJKFixed, m_bOldAsian);
+ SupportHdl( &aAsianSupportCB );
+ }
+
+ USHORT nPos;
+ if ( eLang == LANGUAGE_SYSTEM )
+ nPos = aCurrencyLB.GetEntryPos( (void*) NULL );
+ else
+ {
+ const NfCurrencyEntry* pCurr = &SvNumberFormatter::GetCurrencyEntry( eLang );
+ nPos = aCurrencyLB.GetEntryPos( (void*) pCurr );
+ }
+ aCurrencyLB.SelectEntryPos( nPos );
+
+ //update the decimal separator key of the related CheckBox
+ Locale aTempLocale;
+ SvxLanguageToLocale( aTempLocale, eLang );
+ LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), aTempLocale );
+ String sTempLabel(sDecimalSeparatorLabel);
+ sTempLabel.SearchAndReplaceAscii("%1", aLocaleWrapper.getNumDecimalSep() );
+ aDecimalSeparatorCB.SetText(sTempLabel);
+
+ return 0;
+}
+
diff --git a/cui/source/options/optgdlg.hrc b/cui/source/options/optgdlg.hrc
new file mode 100644
index 000000000000..3ad985caa706
--- /dev/null
+++ b/cui/source/options/optgdlg.hrc
@@ -0,0 +1,208 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optgdlg.hrc,v $
+ * $Revision: 1.22 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTGDLG_HRC
+#define _SVX_OPTGDLG_HRC
+#include <svtools/controldims.hrc>
+
+// defines for positions and sizes ---------------------------------------
+
+#define WHOLE_WIDTH 248
+#define EDIT_WIDTH 30
+#define UNIT_WIDTH 40
+
+#define COLSPACE RSC_SP_CTRL_DESC_X
+#define COL0 6
+#define COL1 (COL0+6)
+#define COL2 (COL1+10)
+#define COL3 (COL2+100)
+#define COL4 (COL3+COLSPACE)
+#define COL5 (COL4+EDIT_WIDTH)
+#define COL6 (COL5+COLSPACE)
+
+#define ROWSPACE RSC_SP_CTRL_DESC_Y
+#define ROW0 3
+#define ROW1 (ROW0+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE)
+#define ROW2 (ROW1+RSC_CD_CHECKBOX_HEIGHT+ROWSPACE)
+#define ROW3 (ROW2+RSC_CD_CHECKBOX_HEIGHT+ROWSPACE)
+#define ROW4 (ROW3+RSC_CD_CHECKBOX_HEIGHT+ROWSPACE)
+#define ROW5 (ROW4+RSC_CD_PUSHBUTTON_HEIGHT+ROWSPACE)
+#define ROW6 (ROW5+RSC_CD_DROPDOWN_HEIGHT+ROWSPACE)
+#define ROW7 (ROW6+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE)
+#define ROW8 (ROW7+RSC_CD_CHECKBOX_HEIGHT+ROWSPACE)
+#define ROW9 (ROW8+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE)
+#define ROW10 (ROW9+RSC_CD_CHECKBOX_HEIGHT+ROWSPACE)
+#define ROW11 (ROW10+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE)
+
+#define DIFF(v1,v2) (v2-v1)
+#define OFFS_TEXTBOX_FIXEDTEXT(base) (base+(RSC_CD_TEXTBOX_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)
+//#define OFFS_PUSHBUTTON_FIXEDTEXT(base) (base+(RSC_CD_PUSHBUTTON_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)
+
+#define ROW_MF_SCALING (13)
+#define ROW_FT_ICONSIZESTYLE (ROW_MF_SCALING+RSC_CD_DROPDOWN_HEIGHT+ROWSPACE)
+#define ROW_LB_ICONSIZESTYLE (ROW_FT_ICONSIZESTYLE+RSC_CD_FIXEDTEXT_HEIGHT+ROWSPACE)
+#define ROW_CB_SYSTEM_FONT (ROW_LB_ICONSIZESTYLE+RSC_CD_DROPDOWN_HEIGHT+ROWSPACE)
+#define ROW_CB_FONTANTIALIASING (ROW_CB_SYSTEM_FONT+ (2 * RSC_CD_FIXEDLINE_HEIGHT) +ROWSPACE)
+#define ROW_NF_AA_POINTLIMIT (ROW_CB_FONTANTIALIASING+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE)
+
+#define ROW_FL_MENU (ROW_NF_AA_POINTLIMIT+RSC_CD_DROPDOWN_HEIGHT+RSC_SP_FLGR_SPACE_X)
+#define ROW_FT_MENU_ICONS (ROW_FL_MENU + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE)
+#define ROW_LB_MENU_ICONS (ROW_FT_MENU_ICONS + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE)
+
+#define ROW_FL_FONTLISTS (ROW_LB_MENU_ICONS + RSC_CD_CHECKBOX_HEIGHT + RSC_SP_FLGR_SPACE_X)
+#define ROW_CB_FONT_SHOW (ROW_FL_FONTLISTS + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE)
+#define ROW_CB_FONT_HISTORY (ROW_CB_FONT_SHOW + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE)
+
+// #i95644# start on top with rendering section
+#define ROW_FL_RENDERING (3)
+#define ROW_CB_USE_HARDACCELL (ROW_FL_RENDERING + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE)
+#define ROW_CB_USE_ANTIALIASE (ROW_CB_USE_HARDACCELL + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE)
+
+// #i95644# set Menu to follow vertically (was (ROW_FL_MENU)) previously)
+#define ROW_FL_MOUSE (ROW_CB_USE_ANTIALIASE + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_SPACE_X)
+#define ROW_FT_MOUSEPOS (ROW_FL_MOUSE + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE)
+#define ROW_LB_MOUSEPOS (ROW_FT_MOUSEPOS + RSC_CD_FIXEDTEXT_HEIGHT + ROWSPACE)
+#define ROW_FT_MOUSEMIDDLE (ROW_LB_MOUSEPOS + RSC_CD_DROPDOWN_HEIGHT + ROWSPACE)
+#define ROW_LB_MOUSEMIDDLE (ROW_FT_MOUSEMIDDLE + RSC_CD_FIXEDTEXT_HEIGHT + ROWSPACE)
+
+// #i97672#
+#define ROW_FL_SELECTION (ROW_LB_MOUSEMIDDLE + RSC_CD_DROPDOWN_HEIGHT + RSC_SP_FLGR_SPACE_X)
+#define ROW_CB_SELECTION (ROW_FL_SELECTION + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE)
+
+// tabpage general -------------------------------------------------------
+
+#define FL_HELP 10
+#define CB_TOOLTIP 11
+#define CB_EXTHELP 12
+#define CB_HELPAGENT 13
+#define PB_HELPAGENT_RESET 14
+#define FT_HELPFORMAT 15
+#define LB_HELPFORMAT 16
+
+//#define FL_FILEDLG 20
+//#define CB_FILEDLG 21
+
+//#define FL_DOCSTATUS 30
+//#define CB_DOCSTATUS 31
+
+#define FL_TWOFIGURE 40
+#define FT_INTERPRET 41
+#define NF_YEARVALUE 42
+#define FT_TOYEAR 43
+#define FL_PRINTDLG 44
+#define CB_PRINTDLG 45
+
+// tabpage view ----------------------------------------------------------
+// #i95644# 10 .. 14 freed, may be reused
+
+#define FL_USERINTERFACE 20
+#define FT_WINDOWSIZE 21
+#define MF_WINDOWSIZE 22
+
+#define FL_MOUSE 30
+#define LB_MOUSEPOS 31
+#define FT_MOUSEPOS 32
+#define FT_MOUSEMIDDLE 33
+#define LB_MOUSEMIDDLE 34
+
+#define FT_MENU_ICONS 40
+#define LB_MENU_ICONS 41
+#define FL_MENU 42
+#define FL_FONTLISTS 43
+
+#define LB_ICONSIZE 54
+#define FT_ICONSIZESTYLE 55
+#define LB_ICONSTYLE 56
+#define CB_SYSTEM_FONT 57
+#define STR_ICONSIZE 58
+
+#define CB_FONT_SHOW 60
+#define CB_FONT_HISTORY 62
+
+#define CB_FONTANTIALIASING 63
+#define NF_AA_POINTLIMIT 64
+#define FT_POINTLIMIT_LABEL 65
+#define FT_POINTLIMIT_UNIT 66
+
+#define FL_RENDERING 67
+#define CB_USE_HARDACCELL 68
+#define CB_USE_ANTIALIASE 69
+
+// #i97672#
+#define FL_SELECTION 70
+#define CB_SELECTION 71
+#define MF_SELECTION 72
+
+// tabpage languages -----------------------------------------------------
+
+#define FL_UI_LANG 1
+#define FT_UI_LANG 2
+#define LB_UI_LANG 3
+#define FL_LINGU_LANG 4
+#define FT_WEST_LANG 5
+#define LB_WEST_LANG 6
+#define FT_ASIAN_LANG 7
+#define LB_ASIAN_LANG 8
+#define FT_COMPLEX_LANG 9
+#define LB_COMPLEX_LANG 10
+#define CB_CURRENT_DOC 11
+#define FL_ENHANCED 12
+#define CB_ASIANSUPPORT 13
+#define CB_CTLSUPPORT 15
+#define FT_LOCALESETTING 16
+#define LB_LOCALESETTING 17
+#define FT_CURRENCY 18
+#define LB_CURRENCY 19
+#define FI_WEST_LANG 20
+#define FI_ASIAN_LANG 21
+#define FI_COMPLEX_LANG 22
+#define FI_ASIANSUPPORT 23
+#define FI_CTLSUPPORT 24
+#define FI_LOCALESETTING 25
+#define FI_CURRENCY 26
+#define FT_DECIMALSEPARATOR 27
+#define CB_DECIMALSEPARATOR 28
+#define FI_USERINTERFACE 29
+#define FT_USERINTERFACE 30
+#define LB_USERINTERFACE 31
+#define STR_IB_LANGCHANGE_TITLE 32
+
+#define FL_FILEDLG 53
+#define FI_FILEDLG_RO 54
+#define CB_FILEDLG 55
+#define FT_GRAPHICCACHE_UNIT 56
+#define FT_GRAPHICOBJECTCACHE_UNIT 57
+#define FT_GRAPHICOBJECTTIME_UNIT 58
+#define FT_HELPAGENT_TIME_UNIT 59
+#define FL_DOCSTATUS 60
+#define CB_DOCSTATUS 61
+#endif // #ifndef _SVX_OPTGDLG_HRC
+
+// ******************************************************************* EOF
+
diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx
new file mode 100644
index 000000000000..4813e23c4305
--- /dev/null
+++ b/cui/source/options/optgdlg.hxx
@@ -0,0 +1,220 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optgdlg.hxx,v $
+ * $Revision: 1.23 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _OFA_OPTGDLG_HXX
+#define _OFA_OPTGDLG_HXX
+#include <vcl/lstbox.hxx>
+#include <vcl/group.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svx/langbox.hxx>
+#include <readonlyimage.hxx>
+#define FOLDERWEBVIEW_DEFAULTFILE "folder.so"
+
+// predeclarations
+class CanvasSettings;
+class SvtOptionsDrawinglayer;
+
+// class OfaMiscTabPage --------------------------------------------------
+
+class OfaMiscTabPage : public SfxTabPage
+{
+ using TabPage::DeactivatePage;
+private:
+ FixedLine aHelpFL;
+ CheckBox aToolTipsCB;
+ CheckBox aExtHelpCB;
+ CheckBox aHelpAgentCB;
+ PushButton aHelpAgentResetBtn;
+ FixedText aHelpFormatFT;
+ ListBox aHelpFormatLB;
+
+ FixedLine aFileDlgFL;
+ ReadOnlyImage aFileDlgROImage;
+ CheckBox aFileDlgCB;
+
+ FixedLine aPrintDlgFL;
+ CheckBox aPrintDlgCB;
+
+ FixedLine aDocStatusFL;
+ CheckBox aDocStatusCB;
+
+ FixedLine aTwoFigureFL;
+ FixedText aInterpretFT;
+ NumericField aYearValueField;
+ FixedText aToYearFT;
+
+ String aStrDateInfo;
+
+ DECL_LINK( TwoFigureHdl, NumericField* );
+ DECL_LINK( TwoFigureConfigHdl, NumericField* );
+ DECL_LINK( HelpCheckHdl_Impl, CheckBox* );
+ DECL_LINK( HelpAgentResetHdl_Impl, PushButton* );
+protected:
+ virtual int DeactivatePage( SfxItemSet* pSet = NULL );
+
+public:
+ OfaMiscTabPage( Window* pParent, const SfxItemSet& rSet );
+ ~OfaMiscTabPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+// class OfaViewTabPage --------------------------------------------------
+class SvtTabAppearanceCfg;
+
+class OfaViewTabPage : public SfxTabPage
+{
+private:
+ FixedLine aUserInterfaceFL;
+ FixedText aWindowSizeFT;
+ MetricField aWindowSizeMF;
+ FixedText aIconSizeStyleFT;
+ ListBox aIconSizeLB;
+ ListBox aIconStyleLB;
+ CheckBox m_aSystemFont;
+
+#if defined( UNX )
+ CheckBox aFontAntiAliasing;
+ FixedText aAAPointLimitLabel;
+ NumericField aAAPointLimit;
+ FixedText aAAPointLimitUnits;
+#endif
+
+ FixedLine aMenuFL;
+ FixedText aMenuIconsFT;
+ ListBox aMenuIconsLB;
+
+ FixedLine aFontListsFL;
+ CheckBox aFontShowCB;
+ CheckBox aFontHistoryCB;
+
+ FixedLine aRenderingFL;
+ CheckBox aUseHardwareAccell;
+ CheckBox aUseAntiAliase;
+
+ FixedLine aMouseFL;
+ FixedText aMousePosFT;
+ ListBox aMousePosLB;
+ FixedText aMouseMiddleFT;
+ ListBox aMouseMiddleLB;
+
+ // #i97672#
+ FixedLine maSelectionFL;
+ CheckBox maSelectionCB;
+ MetricField maSelectionMF;
+
+ UINT16 nSizeLB_InitialSelection;
+ UINT16 nStyleLB_InitialSelection;
+ BOOL bSfxSymbolsAuto;
+
+ // item ID for the given icon theme
+ // might be zero when the theme is not installed and the item is removed
+ ULONG aIconStyleItemId[STYLE_SYMBOLS_THEMES_MAX];
+ SvtTabAppearanceCfg* pAppearanceCfg;
+ CanvasSettings* pCanvasSettings;
+ SvtOptionsDrawinglayer* mpDrawinglayerOpt;
+
+#if defined( UNX )
+ DECL_LINK( OnAntialiasingToggled, void* );
+#endif
+ // #i97672#
+ DECL_LINK( OnSelectionToggled, void* );
+
+public:
+ OfaViewTabPage( Window* pParent, const SfxItemSet& rSet );
+ ~OfaViewTabPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+/* -----------------------------23.11.00 13:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+struct LanguageConfig_Impl;
+class OfaLanguagesTabPage : public SfxTabPage
+{
+ FixedLine aUILanguageGB;
+ ReadOnlyImage aLocaleSettingFI;
+ FixedText aUserInterfaceFT;
+ ListBox aUserInterfaceLB;
+ FixedText aLocaleSettingFT;
+ SvxLanguageBox aLocaleSettingLB;
+ ReadOnlyImage aCurrencyFI;
+ FixedText aDecimalSeparatorFT;
+ CheckBox aDecimalSeparatorCB;
+ FixedText aCurrencyFT;
+ ListBox aCurrencyLB;
+
+ FixedLine aLinguLanguageGB;
+ ReadOnlyImage aWesternLanguageFI;
+ FixedText aWesternLanguageFT;
+ SvxLanguageBox aWesternLanguageLB;
+ ReadOnlyImage aAsianLanguageFI;
+ FixedText aAsianLanguageFT;
+ SvxLanguageBox aAsianLanguageLB;
+ ReadOnlyImage aComplexLanguageFI;
+ FixedText aComplexLanguageFT;
+ SvxLanguageBox aComplexLanguageLB;
+ CheckBox aCurrentDocCB;
+ FixedLine aEnhancedFL;
+ ReadOnlyImage aAsianSupportFI;
+ CheckBox aAsianSupportCB;
+ ReadOnlyImage aCTLSupportFI;
+ CheckBox aCTLSupportCB;
+
+ const String sDecimalSeparatorLabel;
+
+ sal_Bool m_bOldAsian;
+ sal_Bool m_bOldCtl;
+ LanguageConfig_Impl* pLangConfig;
+
+ rtl::OUString m_sUserLocaleValue;
+
+ DECL_LINK( SupportHdl, CheckBox* ) ;
+ DECL_LINK( LocaleSettingHdl, SvxLanguageBox* ) ;
+
+public:
+ OfaLanguagesTabPage( Window* pParent, const SfxItemSet& rSet );
+ ~OfaLanguagesTabPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+#endif // #ifndef _OFA_OPTGDLG_HXX
+
+
diff --git a/cui/source/options/optgdlg.src b/cui/source/options/optgdlg.src
new file mode 100644
index 000000000000..8318d4eccd10
--- /dev/null
+++ b/cui/source/options/optgdlg.src
@@ -0,0 +1,643 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optgdlg.src,v $
+ * $Revision: 1.32 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+
+#include <cuires.hrc>
+#include "optgdlg.hrc"
+#include "helpid.hrc"
+
+ //****************************************************************************
+ //
+ // TabPage Sonstiges
+ //
+ //****************************************************************************
+
+TabPage OFA_TP_MISC
+{
+ HelpID = HID_OFA_TP_MISC ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_HELP
+ {
+ Pos = MAP_APPFONT( COL0, ROW0 );
+ Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Help";
+ };
+ CheckBox CB_TOOLTIP
+ {
+ Pos = MAP_APPFONT( COL1, ROW1 );
+ Size = MAP_APPFONT( WHOLE_WIDTH - COL1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "~Tips";
+ };
+ CheckBox CB_EXTHELP
+ {
+ Pos = MAP_APPFONT( COL2, ROW2 );
+ Size = MAP_APPFONT( WHOLE_WIDTH - COL2, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "~Extended tips";
+ };
+ CheckBox CB_HELPAGENT
+ {
+ Pos = MAP_APPFONT( COL1, ROW3 );
+ Size = MAP_APPFONT( WHOLE_WIDTH - COL1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "~Help Agent";
+ };
+ PushButton PB_HELPAGENT_RESET
+ {
+ Pos = MAP_APPFONT( COL2, ROW4 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text [ en-US ] = "~Reset Help Agent";
+ };
+ FixedText FT_HELPFORMAT
+ {
+ Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT(ROW5) );
+ Size = MAP_APPFONT( DIFF( COL1, COL3 ), RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Help ~formatting";
+ };
+ ListBox LB_HELPFORMAT
+ {
+ Pos = MAP_APPFONT( COL4, ROW5 );
+ Size = MAP_APPFONT( WHOLE_WIDTH - COL4, 50 );
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Default" ; > ;
+ < "High Contrast #1" ; > ;
+ < "High Contrast #2" ; > ;
+ < "High Contrast Black" ; > ;
+ < "High Contrast White" ; > ;
+ };
+ };
+ FixedLine FL_FILEDLG
+ {
+ Pos = MAP_APPFONT( COL0, ROW6 );
+ Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Open/Save dialogs";
+ };
+ FixedImage FI_FILEDLG_RO
+ {
+ Pos = MAP_APPFONT( COL1 - 7, ROW7 + 2 );
+ Size = MAP_APPFONT( 6, 6 );
+ Hide = TRUE;
+ };
+ CheckBox CB_FILEDLG
+ {
+ Pos = MAP_APPFONT( COL1, ROW7 );
+ Size = MAP_APPFONT( WHOLE_WIDTH - COL1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "~Use %PRODUCTNAME dialogs";
+ };
+ FixedLine FL_DOCSTATUS
+ {
+ Pos = MAP_APPFONT( COL0, ROW8 );
+ Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Document status";
+ };
+ CheckBox CB_DOCSTATUS
+ {
+ Pos = MAP_APPFONT( COL1, ROW9 );
+ Size = MAP_APPFONT( WHOLE_WIDTH - COL1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "~Printing sets \"document modified\" status";
+ };
+ FixedLine FL_TWOFIGURE
+ {
+ Pos = MAP_APPFONT( COL0, ROW10 );
+ Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Year (two digits)" ;
+ };
+ FixedText FT_INTERPRET
+ {
+ Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT(ROW11) );
+ Size = MAP_APPFONT( DIFF( COL1, COL3), RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Interpret as years between";
+ };
+ NumericField NF_YEARVALUE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT( COL4, ROW11 );
+ Size = MAP_APPFONT( EDIT_WIDTH, RSC_CD_TEXTBOX_HEIGHT );
+ Minimum = 1583 ;
+ Maximum = 9857 ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ };
+ FixedText FT_TOYEAR
+ {
+ Pos = MAP_APPFONT( COL6, OFFS_TEXTBOX_FIXEDTEXT(ROW11) );
+ Size = MAP_APPFONT( WHOLE_WIDTH - COL6, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "and " ;
+ };
+ FixedLine FL_PRINTDLG
+ {
+ Pos = MAP_APPFONT( COL0, ROW8 );
+ Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Print dialogs";
+ };
+ CheckBox CB_PRINTDLG
+ {
+ Pos = MAP_APPFONT( COL1, ROW9 );
+ Size = MAP_APPFONT( WHOLE_WIDTH - COL1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Use %PRODUCTNAME ~dialogs";
+ };
+};
+
+ //****************************************************************************
+ //
+ // TabPage Ansicht
+ //
+ //****************************************************************************
+
+TabPage OFA_TP_VIEW
+{
+ HelpID = HID_OFA_TP_VIEW ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_USERINTERFACE
+ {
+ Pos = MAP_APPFONT ( 6 , ROW0 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "User Interface" ;
+ };
+ FixedText FT_WINDOWSIZE
+ {
+ Pos = MAP_APPFONT ( 12 , OFFS_TEXTBOX_FIXEDTEXT( ROW_MF_SCALING ) ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Sc~aling" ;
+ };
+ MetricField MF_WINDOWSIZE
+ {
+ Pos = MAP_APPFONT ( 95 , ROW_MF_SCALING ) ;
+ Size = MAP_APPFONT ( 31 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 80 ;
+ Maximum = 130 ;
+ DecimalDigits = 0 ;
+ First = 80 ;
+ Last = 130 ;
+ SpinSize = 1 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ };
+ FixedText FT_ICONSIZESTYLE
+ {
+ Pos = MAP_APPFONT ( 12 , ROW_FT_ICONSIZESTYLE ) ;
+ Size = MAP_APPFONT ( 114 , 8 ) ;
+ Text [ en-US ] = "Icon size and style" ;
+ };
+ String STR_ICONSIZE
+ {
+ Text [ en-US ] = "Icon size" ;
+ };
+ ListBox LB_ICONSIZE
+ {
+ Pos = MAP_APPFONT ( 12 , ROW_LB_ICONSIZESTYLE ) ;
+ Size = MAP_APPFONT ( 45 , 60 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Automatic" ; > ;
+ < "Small" ; > ;
+ < "Large" ; > ;
+ };
+ };
+ ListBox LB_ICONSTYLE
+ {
+ Pos = MAP_APPFONT ( 61 , ROW_LB_ICONSIZESTYLE ) ;
+ Size = MAP_APPFONT ( 65 , 70 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Automatic" ; > ;
+ < "Galaxy (default)" ; > ;
+ < "High Contrast" ; > ;
+ < "Industrial" ; > ;
+ < "Crystal" ; > ;
+ < "Tango" ; > ;
+ < "Oxygen" ; > ;
+ < "Classic" ; > ;
+ };
+ };
+ CheckBox CB_SYSTEM_FONT
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT( 12, ROW_CB_SYSTEM_FONT );
+ Size = MAP_APPFONT( 114, 16 );
+ WordBreak = TRUE;
+ Text[ en-US ] = "Use system ~font for user interface";
+ };
+
+ CheckBox CB_FONTANTIALIASING
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 12 , ROW_CB_FONTANTIALIASING ) ;
+ Size = MAP_APPFONT ( 110 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "Screen font antialiasing" ;
+ };
+ FixedText FT_POINTLIMIT_LABEL
+ {
+ Pos = MAP_APPFONT ( 23 , OFFS_TEXTBOX_FIXEDTEXT( ROW_NF_AA_POINTLIMIT ) ) ;
+ Size = MAP_APPFONT ( 20 , 8 ) ;
+ Text [ en-US ] = "from";
+ };
+ NumericField NF_AA_POINTLIMIT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 46, ROW_NF_AA_POINTLIMIT ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Minimum = 1;
+ Maximum = 10000;
+ SpinSize = 1;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ };
+ FixedText FT_POINTLIMIT_UNIT
+ {
+ Pos = MAP_APPFONT ( 79 , OFFS_TEXTBOX_FIXEDTEXT( ROW_NF_AA_POINTLIMIT ) ) ;
+ Size = MAP_APPFONT ( 47 , 8 ) ;
+ Text [ en-US ] = "Pixels";
+ };
+ FixedLine FL_MENU
+ {
+ Pos = MAP_APPFONT ( 6, ROW_FL_MENU ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "Menu" ;
+ };
+ FixedText FT_MENU_ICONS
+ {
+ Pos = MAP_APPFONT ( 12 , ROW_FT_MENU_ICONS ) ;
+ Size = MAP_APPFONT ( 114 , 8 ) ;
+ Text [ en-US ] = "Icons in menus" ;
+ };
+ ListBox LB_MENU_ICONS
+ {
+ Pos = MAP_APPFONT ( 12 , ROW_LB_MENU_ICONS ) ;
+ Size = MAP_APPFONT ( 114 , 60 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Automatic" ; > ;
+ < "Hide" ; > ;
+ < "Show" ; > ;
+ };
+ };
+ FixedLine FL_FONTLISTS
+ {
+ Pos = MAP_APPFONT ( 6, ROW_FL_FONTLISTS ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "Font Lists" ;
+ };
+ CheckBox CB_FONT_SHOW
+ {
+ Pos = MAP_APPFONT ( 12, ROW_CB_FONT_SHOW ) ;
+ Size = MAP_APPFONT ( 118 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "Show p~review of fonts" ;
+ };
+ CheckBox CB_FONT_HISTORY
+ {
+ Pos = MAP_APPFONT ( 12, ROW_CB_FONT_HISTORY ) ;
+ Size = MAP_APPFONT ( 118 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "Show font h~istory" ;
+ };
+ FixedLine FL_RENDERING
+ {
+ Pos = MAP_APPFONT ( 133 , ROW_FL_RENDERING ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "Graphics output";
+ };
+
+ CheckBox CB_USE_HARDACCELL
+ {
+ Pos = MAP_APPFONT ( 139, ROW_CB_USE_HARDACCELL ) ;
+ Size = MAP_APPFONT ( 118 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "Use hardware acceleration" ;
+ };
+
+ CheckBox CB_USE_ANTIALIASE
+ {
+ Pos = MAP_APPFONT ( 139, ROW_CB_USE_ANTIALIASE ) ;
+ Size = MAP_APPFONT ( 118 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "Use Anti-Aliasing" ;
+ };
+
+ FixedLine FL_MOUSE
+ {
+ Pos = MAP_APPFONT ( 133 , ROW_FL_MOUSE ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "Mouse";
+ };
+ FixedText FT_MOUSEPOS
+ {
+ Pos = MAP_APPFONT ( 139, ROW_FT_MOUSEPOS ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "Mouse positioning" ;
+ };
+ ListBox LB_MOUSEPOS
+ {
+ Pos = MAP_APPFONT ( 139, ROW_LB_MOUSEPOS ) ;
+ Size = MAP_APPFONT ( 114 , 60 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Default button" ; > ;
+ < "Dialog center" ; > ;
+ < "No automatic positioning" ; > ;
+ };
+ };
+ FixedText FT_MOUSEMIDDLE
+ {
+ Pos = MAP_APPFONT ( 139, ROW_FT_MOUSEMIDDLE ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "Middle mouse button";
+ };
+ ListBox LB_MOUSEMIDDLE
+ {
+ Pos = MAP_APPFONT ( 139, ROW_LB_MOUSEMIDDLE ) ;
+ Size = MAP_APPFONT ( 114 , 60 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "No function" ; > ;
+ < "Automatic scrolling" ; > ;
+ < "Paste clipboard" ; > ;
+ };
+ };
+
+ // #i97672#
+ FixedLine FL_SELECTION
+ {
+ Pos = MAP_APPFONT ( 133 , ROW_FL_SELECTION ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "Selection";
+ };
+
+ CheckBox CB_SELECTION
+ {
+ Pos = MAP_APPFONT ( 139, ROW_CB_SELECTION + (((12 - RSC_CD_CHECKBOX_HEIGHT) / 2) + 1)) ;
+ Size = MAP_APPFONT ( 118 - 34 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "Transparency" ;
+ };
+
+ MetricField MF_SELECTION
+ {
+ Pos = MAP_APPFONT ( 139 + (95 - 12), ROW_CB_SELECTION ) ;
+ Size = MAP_APPFONT ( 31 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 10 ;
+ Maximum = 90 ;
+ DecimalDigits = 0 ;
+ First = 10 ;
+ Last = 90 ;
+ SpinSize = 5 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText [ en-US ] = "%" ;
+ };
+};
+// *******************************************************************
+
+TabPage OFA_TP_LANGUAGES
+{
+ HelpID = HID_OFA_TP_LANGUAGES ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_UI_LANG
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Language of";
+ };
+ FixedImage FI_USERINTERFACE
+ {
+ Pos = MAP_APPFONT ( 5 , 17 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+ FixedText FT_USERINTERFACE
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 108 , 8 ) ;
+ Text [ en-US ] = "~User interface";
+ };
+ ListBox LB_USERINTERFACE
+ {
+ Pos = MAP_APPFONT ( 123 , 14 ) ;
+ Size = MAP_APPFONT ( 125 , 60 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Sort = TRUE;
+ };
+ FixedImage FI_LOCALESETTING
+ {
+ Pos = MAP_APPFONT ( 5 , 32 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+ FixedText FT_LOCALESETTING
+ {
+ Pos = MAP_APPFONT ( 12 , 31 ) ;
+ Size = MAP_APPFONT ( 108 , 8 ) ;
+ Text [ en-US ] = "Locale setting";
+ };
+ ListBox LB_LOCALESETTING
+ {
+ Pos = MAP_APPFONT ( 123 , 30 ) ;
+ Size = MAP_APPFONT ( 125 , 60 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Sort = TRUE;
+ };
+ FixedText FT_DECIMALSEPARATOR
+ {
+ Pos = MAP_APPFONT ( 12 , 46 ) ;
+ Size = MAP_APPFONT ( 108 , 8 ) ;
+ Text [ en-US ] = "Decimal separator key";
+ };
+ CheckBox CB_DECIMALSEPARATOR
+ {
+ Pos = MAP_APPFONT ( 123 , 46) ;
+ Size = MAP_APPFONT ( 125 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "~Same as locale setting ( %1 )";
+ };
+ FixedImage FI_CURRENCY
+ {
+ Pos = MAP_APPFONT ( 5 , 63 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+ FixedText FT_CURRENCY
+ {
+ Pos = MAP_APPFONT ( 12 , 61 ) ;
+ Size = MAP_APPFONT ( 108 , 8 ) ;
+ Text [ en-US ] = "~Default currency";
+ };
+ ListBox LB_CURRENCY
+ {
+ Pos = MAP_APPFONT ( 123 , 59 ) ;
+ Size = MAP_APPFONT ( 125 , 60 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Sort = TRUE;
+ };
+ FixedLine FL_LINGU_LANG
+ {
+ Pos = MAP_APPFONT ( 6 , 77 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Default languages for documents";
+ };
+ FixedImage FI_WEST_LANG
+ {
+ Pos = MAP_APPFONT ( 5 , 92 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+ FixedText FT_WEST_LANG
+ {
+ Pos = MAP_APPFONT ( 12 , 90 ) ;
+ Size = MAP_APPFONT ( 108 , 8 ) ;
+ Text [ en-US ] = "Western";
+ };
+
+ ListBox LB_WEST_LANG
+ {
+ Pos = MAP_APPFONT ( 123 , 88 ) ;
+ Size = MAP_APPFONT ( 125 , 60 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Sort = TRUE;
+ };
+ FixedImage FI_ASIAN_LANG
+ {
+ Pos = MAP_APPFONT ( 5 , 108 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+ FixedText FT_ASIAN_LANG
+ {
+ Pos = MAP_APPFONT ( 12 , 106 ) ;
+ Size = MAP_APPFONT ( 108 , 8 ) ;
+ Text [ en-US ] = "Asian";
+ };
+ ListBox LB_ASIAN_LANG
+ {
+ Pos = MAP_APPFONT ( 123 , 104 ) ;
+ Size = MAP_APPFONT ( 125 , 60 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Sort = TRUE;
+ };
+ FixedImage FI_COMPLEX_LANG
+ {
+ Pos = MAP_APPFONT ( 5 , 124 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+ FixedText FT_COMPLEX_LANG
+ {
+ Pos = MAP_APPFONT ( 12 , 122 ) ;
+ Size = MAP_APPFONT ( 108 , 8 ) ;
+ Text [ en-US ] = "C~TL";
+ };
+ ListBox LB_COMPLEX_LANG
+ {
+ Pos = MAP_APPFONT ( 123 , 120 ) ;
+ Size = MAP_APPFONT ( 125 , 60 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Sort = TRUE;
+ };
+ CheckBox CB_CURRENT_DOC
+ {
+ Pos = MAP_APPFONT ( 123 , 135 ) ;
+ Size = MAP_APPFONT ( 125 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "For the current document only";
+ };
+ FixedLine FL_ENHANCED
+ {
+ Pos = MAP_APPFONT ( 6 , 145 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Enhanced language support";
+ };
+ FixedImage FI_ASIANSUPPORT
+ {
+ Pos = MAP_APPFONT ( 5 , 160 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+ CheckBox CB_ASIANSUPPORT
+ {
+ Pos = MAP_APPFONT ( 12 , 158 ) ;
+ Size = MAP_APPFONT ( 236 ,RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "E~nabled for Asian languages";
+ };
+ FixedImage FI_CTLSUPPORT
+ {
+ Pos = MAP_APPFONT ( 5 , 175 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+ CheckBox CB_CTLSUPPORT
+ {
+ Pos = MAP_APPFONT ( 12 , 173 ) ;
+ Size = MAP_APPFONT ( 236 , RSC_CD_CHECKBOX_HEIGHT ) ;
+ Text [ en-US ] = "Ena~bled for complex text layout (CTL)";
+ };
+};
+
+InfoBox RID_SVX_MSGBOX_LANGUAGE_RESTART
+{
+ Message [ en-US ] = "The language setting of the user interface has been updated and will take effect the next time you start %PRODUCTNAME %PRODUCTVERSION";
+};
+
+
diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx
new file mode 100644
index 000000000000..85c0d450cc47
--- /dev/null
+++ b/cui/source/options/optgenrl.cxx
@@ -0,0 +1,584 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optgenrl.cxx,v $
+ * $Revision: 1.14 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/msgbox.hxx>
+#include <unotools/saveopt.hxx>
+
+#define _SVX_OPTGENRL_CXX
+
+#include <cuires.hrc>
+#include "optgenrl.hrc"
+#include <unotools/useroptions.hxx>
+#include "cuioptgenrl.hxx"
+#include <dialmgr.hxx>
+#include <svx/dlgutil.hxx>
+#include <svx/strarray.hxx>
+#include <svx/svxids.hrc> // SID_FIELD_GRABFOCUS
+
+#define TRIM(s) s.EraseLeadingChars().EraseTrailingChars()
+
+// struct GeneralTabPage_Impl --------------------------------------------
+
+struct GeneralTabPage_Impl
+{
+ BOOL mbStreetEnabled;
+ BOOL mbPLZEnabled;
+ BOOL mbCityEnabled;
+ BOOL mbUsCityEnabled;
+ BOOL mbUsZipEnabled;
+
+ String maQueryStr;
+
+ GeneralTabPage_Impl() :
+ mbStreetEnabled ( FALSE ),
+ mbPLZEnabled ( FALSE ),
+ mbCityEnabled ( FALSE ),
+ mbUsCityEnabled ( FALSE ),
+ mbUsZipEnabled ( FALSE ) {}
+};
+
+// -----------------------------------------------------------------------
+
+// kommt aus adritem.cxx
+//CHINA001 extern String ConvertToStore_Impl( const String& );
+//copy from adritem.cxx, since it will leave in svx.
+String ConvertToStore_Impl( const String& rText )
+{
+ String sRet;
+ USHORT i = 0;
+
+ while ( i < rText.Len() )
+ {
+ if ( rText.GetChar(i) == '\\' || rText.GetChar(i) == '#' )
+ sRet += '\\';
+ sRet += rText.GetChar(i++);
+ }
+ return sRet;
+}
+
+
+// -----------------------------------------------------------------------
+
+SvxGeneralTabPage::SvxGeneralTabPage( Window* pParent, const SfxItemSet& rCoreSet ) :
+
+ SfxTabPage( pParent, CUI_RES(RID_SFXPAGE_GENERAL), rCoreSet ),
+
+ aCompanyLbl ( this, CUI_RES( FT_COMPANY ), true ),
+ aCompanyEdit ( this, CUI_RES( ED_COMPANY ), INDEX_NOTSET, &aCompanyLbl ),
+ aNameLbl ( this, CUI_RES( FT_NAME ), true ),
+ aNameLblRuss ( this, CUI_RES( FT_NAME_RUSS ), true ),
+ aNameLblEastern ( this, CUI_RES( FT_NAME_EASTERN ), true ),
+ aFirstName ( this, CUI_RES( ED_FIRSTNAME ), 0, &aNameLbl ),
+ aFatherName ( this, CUI_RES( ED_FATHERNAME ) ),
+ aName ( this, CUI_RES( ED_NAME ), 1, &aNameLbl ),
+ aShortName ( this, CUI_RES( ED_SHORTNAME ), 2, &aNameLbl ),
+ aStreetLbl ( this, CUI_RES( FT_STREET ), true ),
+ aStreetLblRuss ( this, CUI_RES( FT_STREET_RUSS ), true ),
+ aStreetEdit ( this, CUI_RES( ED_STREET ), 0, &aStreetLbl ),
+ aApartmentNrEdit( this, CUI_RES( ED_APARTMENTNR ), 1, &aStreetLblRuss ),
+ aCityLbl ( this, CUI_RES( FT_CITY ), true ),
+ aPLZEdit ( this, CUI_RES( ED_PLZ ), 0, &aCityLbl ),
+ aCityEdit ( this, CUI_RES( ED_CITY ), 1, &aCityLbl ),
+ aUsCityEdit ( this, CUI_RES( ED_US_CITY ), 0, &aCityLbl ),
+ aUsStateEdit ( this, CUI_RES( ED_US_STATE ), 1, &aCityLbl ),
+ aUsZipEdit ( this, CUI_RES( ED_US_ZIPCODE ), 2, &aCityLbl ),
+ aCountryLbl ( this, CUI_RES( FT_COUNTRY ), true ),
+ aCountryEdit ( this, CUI_RES( ED_COUNTRY ), INDEX_NOTSET, &aCountryLbl ),
+ aTitlePosLbl ( this, CUI_RES( FT_TITLEPOS ), true ),
+ aTitleEdit ( this, CUI_RES( ED_TITLE ), 0, &aTitlePosLbl ),
+ aPositionEdit ( this, CUI_RES( ED_POSITION ), 1, &aTitlePosLbl ),
+ aPhoneLbl ( this, CUI_RES( FT_PHONE ), true ),
+ aTelPrivEdit ( this, CUI_RES( ED_TELPRIVAT ), 0, &aPhoneLbl ),
+ aTelCompanyEdit ( this, CUI_RES( ED_TELCOMPANY ), 1, &aPhoneLbl ),
+ aFaxMailLbl ( this, CUI_RES( FT_FAXMAIL ), true ),
+ aFaxEdit ( this, CUI_RES( ED_FAX ), 0, &aFaxMailLbl ),
+ aEmailEdit ( this, CUI_RES( ED_EMAIL ), 1, &aFaxMailLbl ),
+ aAddrFrm ( this, CUI_RES( GB_ADDRESS ) ),
+ aUseDataCB ( this, CUI_RES( CB_USEDATA ) ),
+
+ pImpl ( new GeneralTabPage_Impl )
+
+{
+ LanguageType eLang = Application::GetSettings().GetUILanguage();
+ pImpl->maQueryStr = String( CUI_RES( STR_QUERY_REG ) );
+
+ if ( LANGUAGE_ENGLISH_US == eLang )
+ {
+ // amerikanische Postadresse aufbauen
+ aPLZEdit.Hide();
+ aCityEdit.Hide();
+ aCityLbl.SetText( CUI_RES( STR_US_STATE ) );
+ }
+ else if ( LANGUAGE_RUSSIAN == eLang )
+ {
+ aUsCityEdit.Hide();
+ aUsStateEdit.Hide();
+ aUsZipEdit.Hide();
+ aNameLbl.Hide();
+ aNameLblRuss.Show();
+ aStreetLbl.Hide();
+ aStreetLblRuss.Show();
+ aFatherName.Show();
+ aName.SetIndex( 0 );
+ aName.SetLabel( &aNameLblRuss );
+ aFirstName.SetIndex( 1 );
+ aFirstName.SetLabel( &aNameLblRuss );
+ aFatherName.SetIndex( 2 );
+ aFatherName.SetLabel( &aNameLblRuss );
+ aShortName.SetIndex( 3 );
+ aShortName.SetLabel( &aNameLblRuss );
+
+ Point aEditPoint = LogicToPixel( Point( MID, LINE(1) ), MAP_APPFONT );
+ Point aRightPoint = LogicToPixel( Point( RIGHT, LINE(1) ), MAP_APPFONT );
+ Size aEditSize = LogicToPixel( Size( 42, 12 ), MAP_APPFONT );
+ Size a2Size = LogicToPixel( Size( 2, 2 ), MAP_APPFONT );
+ long nDelta = aEditSize.Width() + a2Size.Width();
+ aName.SetPosSizePixel( aEditPoint, aEditSize );
+ aEditPoint.X() = aEditPoint.X() + nDelta;
+ aFirstName.SetPosSizePixel( aEditPoint, aEditSize );
+ aEditPoint.X() = aEditPoint.X() + nDelta;
+ aFatherName.SetPosSizePixel( aEditPoint, aEditSize );
+ aEditPoint.X() = aEditPoint.X() + nDelta;
+ aEditSize.Width() = aRightPoint.X() - aEditPoint.X();
+ aShortName.SetPosSizePixel( aEditPoint, aEditSize );
+
+ Size aStreetSize = aStreetEdit.GetSizePixel();
+ aStreetSize.Width() = aStreetSize.Width() - aEditSize.Width() - a2Size.Width();
+ aStreetEdit.SetSizePixel( aStreetSize );
+ aApartmentNrEdit.Show();
+ Point aApartmentPoint = LogicToPixel( Point( MID, LINE(2) ), MAP_APPFONT );
+ aApartmentPoint.X() = aEditPoint.X();
+ aApartmentNrEdit.SetPosSizePixel( aApartmentPoint, aEditSize );
+
+ aName.SetZOrder( &aNameLblRuss, WINDOW_ZORDER_BEHIND );
+ aFirstName.SetZOrder( &aName, WINDOW_ZORDER_BEHIND );
+ aFatherName.SetZOrder( &aFirstName, WINDOW_ZORDER_BEHIND );
+ }
+ else if ( LANGUAGE_JAPANESE == eLang ||
+ LANGUAGE_KOREAN == eLang ||
+ LANGUAGE_CHINESE_TRADITIONAL == eLang ||
+ LANGUAGE_CHINESE_SIMPLIFIED == eLang)
+ {
+ aUsCityEdit.Hide();
+ aUsStateEdit.Hide();
+ aUsZipEdit.Hide();
+ aNameLbl.Hide();
+ aNameLblEastern.Show();
+
+ // swap "first name" field and "last name" field
+ Point aPosTmp = aFirstName.GetPosPixel();
+ aFirstName.SetPosPixel( aName.GetPosPixel() );
+ aName.SetPosPixel( aPosTmp );
+ aFirstName.SetZOrder( &aName, WINDOW_ZORDER_BEHIND );
+ }
+ else
+ {
+ aUsCityEdit.Hide();
+ aUsStateEdit.Hide();
+ aUsZipEdit.Hide();
+ }
+
+ FreeResource();
+
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ Link aLink = LINK( this, SvxGeneralTabPage, ModifyHdl_Impl );
+ aFirstName.SetModifyHdl( aLink );
+ aName.SetModifyHdl( aLink );
+
+ // because some labels have text for more than one edit field we have to split these texts
+ // and set these texts as accessible name of the corresponding edit fields
+ SvxUserEdit* pEdits[] =
+ {
+ &aCompanyEdit, &aFirstName, &aFatherName, &aName, &aShortName, &aStreetEdit,
+ &aApartmentNrEdit, &aPLZEdit, &aCityEdit, &aUsCityEdit, &aUsStateEdit, &aUsZipEdit,
+ &aCountryEdit, &aTitleEdit, &aPositionEdit, &aTelPrivEdit, &aTelCompanyEdit,
+ &aFaxEdit, &aEmailEdit, NULL
+ };
+ SvxUserEdit** pCurrent = pEdits;
+ while ( *pCurrent )
+ {
+ Window* pLabel = (*pCurrent)->GetLabel();
+ if ( pLabel )
+ {
+ String sName, sText = pLabel->GetDisplayText();
+ sal_Int16 nIndex = (*pCurrent)->GetIndex();
+ if ( INDEX_NOTSET == nIndex )
+ sName = sText;
+ else
+ sName = sText.GetToken( nIndex, '/' );
+ sName.EraseAllChars( '(' );
+ sName.EraseAllChars( ')' );
+ if ( sName.Len() > 0 )
+ (*pCurrent)->SetAccessibleName( sName );
+ }
+ pCurrent++;
+ }
+}
+
+//------------------------------------------------------------------------
+
+SvxGeneralTabPage::~SvxGeneralTabPage()
+{
+ delete pImpl;
+}
+
+//------------------------------------------------------------------------
+
+SfxTabPage* SvxGeneralTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return ( new SvxGeneralTabPage( pParent, rAttrSet ) );
+}
+
+//------------------------------------------------------------------------
+
+BOOL SvxGeneralTabPage::FillItemSet( SfxItemSet& )
+{
+ // Eingaben trimmen (f"uhrende und nachfolgende Leerzeichen entfernen)
+ aCompanyEdit.SetText( TRIM(aCompanyEdit.GetText()) );
+ aFirstName.SetText( TRIM(aFirstName.GetText()) );
+ aName.SetText( TRIM(aName.GetText()) );
+ aShortName.SetText( TRIM(aShortName.GetText()) );
+ aStreetEdit.SetText( TRIM(aStreetEdit.GetText()) );
+ aCountryEdit.SetText( TRIM(aCountryEdit.GetText()) );
+ aPLZEdit.SetText( TRIM(aPLZEdit.GetText()) );
+ aCityEdit.SetText( TRIM(aCityEdit.GetText()) );
+ aUsCityEdit.SetText( TRIM(aUsCityEdit.GetText()) );
+ aUsStateEdit.SetText( TRIM(aUsStateEdit.GetText()) );
+ aUsZipEdit.SetText( TRIM(aUsZipEdit.GetText()) );
+ aTitleEdit.SetText( TRIM(aTitleEdit.GetText()) );
+ aPositionEdit.SetText( TRIM(aPositionEdit.GetText()) );
+ aTelPrivEdit.SetText( TRIM(aTelPrivEdit.GetText()) );
+ aTelCompanyEdit.SetText( TRIM(aTelCompanyEdit.GetText()) );
+ aFaxEdit.SetText( TRIM(aFaxEdit.GetText()) );
+ aEmailEdit.SetText( TRIM(aEmailEdit.GetText()) );
+
+ BOOL bModified = FALSE;
+ bModified |= GetAddress_Impl();
+ SvtSaveOptions aSaveOpt;
+ if ( aUseDataCB.IsChecked() != aSaveOpt.IsUseUserData() )
+ {
+ aSaveOpt.SetUseUserData( aUseDataCB.IsChecked() );
+ bModified |= TRUE;
+ }
+ return bModified;
+}
+
+//------------------------------------------------------------------------
+
+void SvxGeneralTabPage::Reset( const SfxItemSet& rSet )
+{
+ SetAddress_Impl();
+
+ USHORT nWhich = GetWhich( SID_FIELD_GRABFOCUS );
+ if ( rSet.GetItemState( nWhich ) == SFX_ITEM_SET )
+ {
+ USHORT nField = ( (SfxUInt16Item&)rSet.Get( nWhich ) ).GetValue();
+
+ switch ( nField )
+ {
+ case COMPANY_EDIT: aCompanyEdit.GrabFocus(); break;
+ case FIRSTNAME_EDIT: aFirstName.GrabFocus(); break;
+ case LASTNAME_EDIT: aName.GrabFocus(); break;
+ case STREET_EDIT: aStreetEdit.GrabFocus(); break;
+ case COUNTRY_EDIT: aCountryEdit.GrabFocus(); break;
+ case PLZ_EDIT:
+ if ( aPLZEdit.IsVisible() )
+ aPLZEdit.GrabFocus();
+ else
+ aUsZipEdit.GrabFocus();
+ break;
+ case CITY_EDIT:
+ if ( aCityEdit.IsVisible() )
+ aCityEdit.GrabFocus();
+ else
+ aUsCityEdit.GrabFocus();
+ break;
+ case STATE_EDIT:
+ if ( aUsStateEdit.IsVisible() )
+ aUsStateEdit.GrabFocus();
+ else
+ aCityEdit.GrabFocus();
+ break;
+ case TITLE_EDIT: aTitleEdit.GrabFocus(); break;
+ case POSITION_EDIT: aPositionEdit.GrabFocus(); break;
+ case SHORTNAME_EDIT: aShortName.GrabFocus(); break;
+ case TELPRIV_EDIT: aTelPrivEdit.GrabFocus(); break;
+ case TELCOMPANY_EDIT: aTelCompanyEdit.GrabFocus(); break;
+ case FAX_EDIT: aFaxEdit.GrabFocus(); break;
+ case EMAIL_EDIT: aEmailEdit.GrabFocus(); break;
+ default: aCompanyEdit.GrabFocus();
+ }
+ }
+
+ aUseDataCB.Check( SvtSaveOptions().IsUseUserData() );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxGeneralTabPage, ModifyHdl_Impl, Edit *, pEdit )
+{
+ if ( aShortName.IsEnabled() )
+ {
+ String aShortStr( aShortName.GetText() );
+ switch ( aShortStr.Len() )
+ {
+ case 0:
+ aShortStr = String( RTL_CONSTASCII_STRINGPARAM(" ") );
+ break;
+
+ case 1:
+ aShortStr += ' ';
+ break;
+ }
+
+ USHORT nPos = ( pEdit == &aFirstName ) ? 0 : 1;
+ String aTxt = pEdit->GetText();
+ sal_Unicode cChar = ( aTxt.Len() > 0 ) ? aTxt.GetChar(0) : ' ';
+ aShortStr.SetChar( nPos, cChar );
+ aShortStr.EraseTrailingChars();
+ aShortName.SetText( aShortStr );
+ }
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxGeneralTabPage::GetAddress_Impl()
+{
+ BOOL bRet =
+ ( aCompanyEdit.GetSavedValue() != aCompanyEdit.GetText() ||
+ aFirstName.GetSavedValue() != aFirstName.GetText() ||
+ aFatherName.GetSavedValue() != aFatherName.GetText() ||
+ aName.GetSavedValue() != aName.GetText() ||
+ aShortName.GetSavedValue() != aShortName.GetText() ||
+ aStreetEdit.GetSavedValue() != aStreetEdit.GetText() ||
+ aApartmentNrEdit.GetSavedValue() != aApartmentNrEdit.GetText() ||
+ aPLZEdit.GetSavedValue() != aPLZEdit.GetText() ||
+ aCityEdit.GetSavedValue() != aCityEdit.GetText() ||
+ aUsCityEdit.GetSavedValue() != aUsCityEdit.GetText() ||
+ aUsStateEdit.GetSavedValue() != aUsStateEdit.GetText() ||
+ aUsZipEdit.GetSavedValue() != aUsZipEdit.GetText() ||
+ aCountryEdit.GetSavedValue() != aCountryEdit.GetText() ||
+ aTitleEdit.GetSavedValue() != aTitleEdit.GetText() ||
+ aPositionEdit.GetSavedValue() != aPositionEdit.GetText() ||
+ aTelPrivEdit.GetSavedValue() != aTelPrivEdit.GetText() ||
+ aTelCompanyEdit.GetSavedValue() != aTelCompanyEdit.GetText() ||
+ aFaxEdit.GetSavedValue() != aFaxEdit.GetText() ||
+ aEmailEdit.GetSavedValue() != aEmailEdit.GetText() );
+
+ LanguageType eLang = Application::GetSettings().GetUILanguage();
+ BOOL bUS = ( LANGUAGE_ENGLISH_US == eLang );
+
+ SvtUserOptions aUserOpt;
+ aUserOpt.SetCompany(aCompanyEdit.GetText());
+ aUserOpt.SetFirstName(aFirstName.GetText());
+ aUserOpt.SetLastName(aName.GetText());
+ aUserOpt.SetID( aShortName.GetText());
+
+ aUserOpt.SetStreet(aStreetEdit.GetText() );
+
+ aUserOpt.SetCountry(aCountryEdit.GetText() );
+
+ aUserOpt.SetZip(bUS ? aUsZipEdit.GetText() : aPLZEdit.GetText() );
+ aUserOpt.SetCity(bUS ? aUsCityEdit.GetText() : aCityEdit.GetText() );
+
+ aUserOpt.SetTitle( aTitleEdit.GetText() );
+ aUserOpt.SetPosition(aPositionEdit.GetText() );
+ aUserOpt.SetTelephoneHome( aTelPrivEdit.GetText() );
+ aUserOpt.SetTelephoneWork( aTelCompanyEdit.GetText() );
+ aUserOpt.SetFax( aFaxEdit.GetText() );
+ aUserOpt.SetEmail( aEmailEdit.GetText() );
+ aUserOpt.SetState( bUS ? aUsStateEdit.GetText() : String() );
+
+ if ( LANGUAGE_RUSSIAN == eLang )
+ {
+ aUserOpt.SetFathersName( aFatherName.GetText() );
+ aUserOpt.SetApartment( aApartmentNrEdit.GetText() );
+ }
+ return bRet;
+}
+
+//------------------------------------------------------------------------
+
+void SvxGeneralTabPage::SetAddress_Impl()
+{
+ LanguageType eLang = Application::GetSettings().GetUILanguage();
+ BOOL bUS = ( LANGUAGE_ENGLISH_US == eLang );
+ SvtUserOptions aUserOpt;
+ aCompanyEdit.SetText( aUserOpt.GetCompany() );
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_COMPANY ) )
+ {
+ aCompanyLbl.Disable();
+ aCompanyEdit.Disable();
+ }
+ sal_Int16 nEditCount = 0;
+ aFirstName.SetText( aUserOpt.GetFirstName() );
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_FIRSTNAME ) )
+ {
+ aFirstName.Disable();
+ nEditCount++;
+ }
+ aName.SetText( aUserOpt.GetLastName() );
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_LASTNAME ) )
+ {
+ aName.Disable();
+ nEditCount++;
+ }
+ aShortName.SetText( aUserOpt.GetID() );
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_ID ) )
+ {
+ aShortName.Disable();
+ nEditCount++;
+ }
+ aNameLbl.Enable( ( nEditCount != 3 ) );
+ aStreetEdit.SetText( aUserOpt.GetStreet() );
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_STREET ) )
+ {
+ aStreetLbl.Disable();
+ aStreetEdit.Disable();
+ }
+ Edit* pPLZEdit = bUS ? &aUsZipEdit : &aPLZEdit;
+ Edit* pCityEdit = bUS ? &aUsCityEdit : &aCityEdit;
+ pPLZEdit->SetText( aUserOpt.GetZip() );
+ pCityEdit->SetText( aUserOpt.GetCity() );
+ nEditCount = 0;
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_ZIP ) )
+ {
+ pPLZEdit->Disable();
+ nEditCount++;
+ }
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_CITY ) )
+ {
+ pCityEdit->Disable();
+ nEditCount++;
+ }
+ if ( bUS )
+ {
+ aUsStateEdit.SetText( aUserOpt.GetState() );
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_STATE ) )
+ {
+ aUsStateEdit.Disable();
+ nEditCount++;
+ }
+ }
+ aCityLbl.Enable( ( nEditCount != ( bUS ? 3 : 2 ) ) );
+ aCountryEdit.SetText( aUserOpt.GetCountry() );
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_COUNTRY ) )
+ {
+ aCountryLbl.Disable();
+ aCountryEdit.Disable();
+ }
+ aTitleEdit.SetText( aUserOpt.GetTitle() );
+ aPositionEdit.SetText( aUserOpt.GetPosition() );
+ nEditCount = 0;
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_TITLE ) )
+ {
+ aTitleEdit.Disable();
+ nEditCount++;
+ }
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_POSITION ) )
+ {
+ aPositionEdit.Disable();
+ nEditCount++;
+ }
+ aTitlePosLbl.Enable( ( nEditCount != 2 ) );
+ aTelPrivEdit.SetText( aUserOpt.GetTelephoneHome() );
+ aTelCompanyEdit.SetText( aUserOpt.GetTelephoneWork() );
+ nEditCount = 0;
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_TELEPHONEHOME ) )
+ {
+ aTelPrivEdit.Disable();
+ nEditCount++;
+ }
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_TELEPHONEWORK ) )
+ {
+ aTelCompanyEdit.Disable();
+ nEditCount++;
+ }
+ aPhoneLbl.Enable( ( nEditCount != 2 ) );
+ aFaxEdit.SetText( aUserOpt.GetFax() );
+ aEmailEdit.SetText( aUserOpt.GetEmail() );
+ nEditCount = 0;
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_FAX ) )
+ {
+ aFaxEdit.Disable();
+ nEditCount++;
+ }
+ if ( aUserOpt.IsTokenReadonly( USER_OPT_EMAIL ) )
+ {
+ aEmailEdit.Disable();
+ nEditCount++;
+ }
+ aFaxMailLbl.Enable( ( nEditCount != 2 ) );
+
+ if ( LANGUAGE_RUSSIAN == eLang )
+ {
+ aFatherName.SetText( aUserOpt.GetFathersName() );
+ aApartmentNrEdit.SetText( aUserOpt.GetApartment() );
+ }
+
+ aCompanyEdit.SaveValue();
+ aFirstName.SaveValue();
+ aFatherName.SaveValue();
+ aName.SaveValue();
+ aShortName.SaveValue();
+ aStreetEdit.SaveValue();
+ aApartmentNrEdit.SaveValue();
+ aPLZEdit.SaveValue();
+ aCityEdit.SaveValue();
+ aUsCityEdit.SaveValue();
+ aUsStateEdit.SaveValue();
+ aUsZipEdit.SaveValue();
+ aCountryEdit.SaveValue();
+ aTitleEdit.SaveValue();
+ aPositionEdit.SaveValue();
+ aTelPrivEdit.SaveValue();
+ aTelCompanyEdit.SaveValue();
+ aFaxEdit.SaveValue();
+ aEmailEdit.SaveValue();
+}
+
+// -----------------------------------------------------------------------
+
+int SvxGeneralTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return LEAVE_PAGE;
+}
+
diff --git a/cui/source/options/optgenrl.hrc b/cui/source/options/optgenrl.hrc
new file mode 100644
index 000000000000..4c519d5ebb70
--- /dev/null
+++ b/cui/source/options/optgenrl.hrc
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optgenrl.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTGENRL_HRC
+#define _SVX_OPTGENRL_HRC
+
+// defines ------------------------------------------------------------------
+
+#define FT_COMPANY 10
+#define ED_COMPANY 11
+#define FT_NAME 12
+#define FT_NAME_RUSS 13
+#define ED_FATHERNAME 14
+#define ED_FIRSTNAME 15
+#define ED_NAME 16
+#define ED_SHORTNAME 17
+#define FT_STREET 18
+#define FT_STREET_RUSS 19
+#define ED_STREET 20
+#define ED_APARTMENTNR 21
+#define FT_CITY 22
+#define ED_PLZ 23
+#define ED_CITY 24
+#define ED_US_CITY 25
+#define ED_US_STATE 26
+#define ED_US_ZIPCODE 27
+#define FT_COUNTRY 28
+#define ED_COUNTRY 29
+#define FT_TITLEPOS 30
+#define ED_TITLE 31
+#define ED_POSITION 32
+#define FT_PHONE 33
+#define ED_TELPRIVAT 34
+#define ED_TELCOMPANY 35
+#define FT_FAXMAIL 36
+#define ED_FAX 37
+#define ED_EMAIL 38
+#define GB_ADDRESS 39
+#define CB_USEDATA 40
+#define FT_NAME_EASTERN 41
+
+#define STR_US_STATE 10
+#define STR_QUERY_REG 11
+
+// Positionierungshilfen f"ur den Dialog
+
+#define HSPACE 2
+#define VSPACE 3
+#define LINEH 12
+#define FLINEH 8
+#define LEFT 12
+#define MID 100
+#define RIGHT 248
+#define TOP 10
+#define LINE(y) (14+y*15)
+#define FLINE(y) (16+y*15)
+#define NAMELEN 74
+
+#endif // #ifndef _SVX_OPTGENRL_HRC
+
+// ******************************************************************* EOF
+
diff --git a/cui/source/options/optgenrl.src b/cui/source/options/optgenrl.src
new file mode 100644
index 000000000000..1d0b049dd204
--- /dev/null
+++ b/cui/source/options/optgenrl.src
@@ -0,0 +1,315 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optgenrl.src,v $
+ * $Revision: 1.57 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// include ------------------------------------------------------------------
+
+#include <sfx2/sfx.hrc>
+
+#include "helpid.hrc"
+#include <cuires.hrc>
+#include "optgenrl.hrc"
+
+// RID_SFXPAGE_GENERAL ------------------------------------------------------
+
+TabPage RID_SFXPAGE_GENERAL
+{
+ HelpId = HID_OPTIONS_GENERAL ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "User Data" ;
+ FixedText FT_COMPANY
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 0 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~Company" ;
+ };
+ Edit ED_COMPANY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID , LINE ( 0 ) ) ;
+ Size = MAP_APPFONT ( RIGHT-MID , LINEH ) ;
+ };
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 1 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "First/Last ~name/Initials" ;
+ };
+ FixedText FT_NAME_RUSS
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 1 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ LeftLabel = TRUE ;
+ Hide = TRUE;
+ Text [ en-US ] = "Last Name/First name/Father's name/Initials";
+ };
+ FixedText FT_NAME_EASTERN
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 1 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ LeftLabel = TRUE ;
+ Hide = TRUE;
+ Text [ en-US ] = "Last/First ~name/Initials" ;
+ };
+ Edit ED_FATHERNAME
+ {
+ Border = TRUE ;
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( MID , LINE ( 1 ) ) ;
+ Size = MAP_APPFONT ( NAMELEN-8 , LINEH ) ;
+ };
+ Edit ED_FIRSTNAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID , LINE ( 1 ) ) ;
+ Size = MAP_APPFONT ( NAMELEN-8 , LINEH ) ;
+ };
+ Edit ED_NAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID+NAMELEN-8+HSPACE , LINE ( 1 ) ) ;
+ Size = MAP_APPFONT ( NAMELEN-8 , LINEH ) ;
+ };
+ Edit ED_SHORTNAME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID+2* ( NAMELEN-8+HSPACE ) , LINE ( 1 ) ) ;
+ Size = MAP_APPFONT ( RIGHT- ( MID+2* ( NAMELEN-8+HSPACE ) ) , LINEH ) ;
+ };
+ FixedText FT_STREET
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 2 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~Street" ;
+ };
+ FixedText FT_STREET_RUSS
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 2 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ LeftLabel = TRUE ;
+ Hide = TRUE;
+ Text [ en-US ] = "Street/Apartment number";
+ };
+ Edit ED_STREET
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID , LINE ( 2 ) ) ;
+ Size = MAP_APPFONT ( RIGHT-MID , LINEH ) ;
+ };
+ Edit ED_APARTMENTNR
+ {
+ Border = TRUE ;
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( MID , LINE ( 2 ) ) ;
+ Size = MAP_APPFONT ( RIGHT-MID , LINEH ) ;
+ };
+ FixedText FT_CITY
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 3 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "Zip/City";
+ };
+ Edit ED_PLZ
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID , LINE ( 3 ) ) ;
+ Size = MAP_APPFONT ( 24 , LINEH ) ;
+ };
+ Edit ED_CITY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID + 24 + HSPACE , LINE ( 3 ) ) ;
+ Size = MAP_APPFONT ( RIGHT - ( MID + 24 + HSPACE ) , LINEH ) ;
+ };
+ Edit ED_US_CITY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID , LINE ( 3 ) ) ;
+ Size = MAP_APPFONT ( 90 , LINEH ) ;
+ };
+ Edit ED_US_STATE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID + 90 + HSPACE, LINE ( 3 ) ) ;
+ Size = MAP_APPFONT ( 30 , LINEH ) ;
+ };
+ Edit ED_US_ZIPCODE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID + 90 + HSPACE + 30 + HSPACE, LINE ( 3 ) ) ;
+ Size = MAP_APPFONT ( RIGHT - ( MID + 90 + HSPACE + 30 + HSPACE ) , LINEH ) ;
+ };
+ FixedText FT_COUNTRY
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 4 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "Country/Region";
+ };
+ Edit ED_COUNTRY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID , LINE ( 4 ) ) ;
+ Size = MAP_APPFONT ( RIGHT - MID , LINEH ) ;
+ };
+ FixedText FT_TITLEPOS
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 5 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~Title/Position" ;
+ };
+ Edit ED_TITLE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID , LINE ( 5 ) ) ;
+ Size = MAP_APPFONT ( NAMELEN-1 , LINEH ) ;
+ };
+ Edit ED_POSITION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID+NAMELEN-1+HSPACE , LINE ( 5 ) ) ;
+ Size = MAP_APPFONT ( RIGHT- ( MID+NAMELEN-1+HSPACE ) , LINEH ) ;
+ };
+ FixedText FT_PHONE
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 6 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ Text [ en-US ] = "Tel. (Home/Work)" ;
+ LeftLabel = TRUE ;
+ };
+ Edit ED_TELPRIVAT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID , LINE ( 6 ) ) ;
+ Size = MAP_APPFONT ( NAMELEN-1 , LINEH ) ;
+ };
+ Edit ED_TELCOMPANY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID+NAMELEN-1+HSPACE , LINE ( 6 ) ) ;
+ Size = MAP_APPFONT ( RIGHT- ( MID+NAMELEN-1+HSPACE ) , LINEH ) ;
+ };
+ FixedText FT_FAXMAIL
+ {
+ Pos = MAP_APPFONT ( LEFT , FLINE ( 7 ) ) ;
+ Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "Fa~x / E-mail" ;
+ };
+ Edit ED_FAX
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID , LINE ( 7 ) ) ;
+ Size = MAP_APPFONT ( NAMELEN-1 , LINEH ) ;
+ };
+ Edit ED_EMAIL
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( MID+NAMELEN-1+HSPACE , LINE ( 7 ) ) ;
+ Size = MAP_APPFONT ( RIGHT- ( MID+NAMELEN-1+HSPACE ) , LINEH ) ;
+ };
+ FixedLine GB_ADDRESS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Address " ;
+ };
+ CheckBox CB_USEDATA
+ {
+ Pos = MAP_APPFONT ( 6 , 122 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Use data for document properties";
+ };
+
+ // extra Resourcen f"ur die amerikanische Postadresse
+ String STR_US_STATE
+ {
+ Text [ en-US ] = "City/State/Zip";
+ };
+ String STR_QUERY_REG
+ {
+ Text [ en-US ] = "Note that street, Zip code and city are used to generate the registration key. You will not be able to change the user data again until the registration has been carried out. Do you want to modify the user data now?";
+ };
+};
+
+// RID_SVXQB_CHANGEDATA ---------------------------------------------------
+
+QueryBox RID_SVXQB_CHANGEDATA
+{
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_NO ;
+ Message [ en-US ] = "The User Data have been changed.\nNote that, if you continue, the registration key will become invalid.\nTherefore, a new registration key is needed within 30 days.\nYou can find the registration form in the menu Help - Registration...\nDo you really want to change your User Data?";
+};
+
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/opthtml.cxx b/cui/source/options/opthtml.cxx
new file mode 100644
index 000000000000..bddcd4a9e182
--- /dev/null
+++ b/cui/source/options/opthtml.cxx
@@ -0,0 +1,271 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: opthtml.cxx,v $
+ * $Revision: 1.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <svtools/langtab.hxx>
+
+#include <svx/htmlcfg.hxx>
+#include "opthtml.hxx"
+#include "opthtml.hrc"
+#include <cuires.hrc>
+#include "helpid.hrc"
+#include <dialmgr.hxx>
+
+// Umwandlung der Modi zu den Positionen in der Listbox
+const USHORT aPosToExportArr[] =
+{
+ HTML_CFG_HTML32,
+ HTML_CFG_MSIE_40,
+ HTML_CFG_NS40,
+ HTML_CFG_WRITER
+};
+
+//#define DEPRECATED_ENTRY 0xFFFF
+
+const USHORT aExportToPosArr[] =
+{
+ 0, //HTML 3.2
+ 1, //MS Internet Explorer 4.0
+ 3, //StarWriter
+ 2 //Netscape Navigator 4.0
+};
+// -----------------------------------------------------------------------
+
+OfaHtmlTabPage::OfaHtmlTabPage(Window* pParent, const SfxItemSet& rSet) :
+ SfxTabPage( pParent, CUI_RES( RID_OFAPAGE_HTMLOPT ), rSet ),
+ aFontSizeGB ( this, CUI_RES( GB_FONTSIZE ) ),
+ aSize1FT ( this, CUI_RES( FT_SIZE1 ) ),
+ aSize1NF ( this, CUI_RES( NF_SIZE1 ) ),
+ aSize2FT ( this, CUI_RES( FT_SIZE2 ) ),
+ aSize2NF ( this, CUI_RES( NF_SIZE2 ) ),
+ aSize3FT ( this, CUI_RES( FT_SIZE3 ) ),
+ aSize3NF ( this, CUI_RES( NF_SIZE3 ) ),
+ aSize4FT ( this, CUI_RES( FT_SIZE4 ) ),
+ aSize4NF ( this, CUI_RES( NF_SIZE4 ) ),
+ aSize5FT ( this, CUI_RES( FT_SIZE5 ) ),
+ aSize5NF ( this, CUI_RES( NF_SIZE5 ) ),
+ aSize6FT ( this, CUI_RES( FT_SIZE6 ) ),
+ aSize6NF ( this, CUI_RES( NF_SIZE6 ) ),
+ aSize7FT ( this, CUI_RES( FT_SIZE7 ) ),
+ aSize7NF ( this, CUI_RES( NF_SIZE7 ) ),
+ aImportGB ( this, CUI_RES( GB_IMPORT ) ),
+ aNumbersEnglishUSCB ( this, CUI_RES( CB_NUMBERS_ENGLISH_US ) ),
+ aUnknownTagCB ( this, CUI_RES( CB_UNKNOWN_TAGS ) ),
+ aIgnoreFontNamesCB( this, CUI_RES( CB_IGNORE_FONTNAMES ) ),
+ aExportGB ( this, CUI_RES( GB_EXPORT ) ),
+ aExportLB ( this, CUI_RES( LB_EXPORT ) ),
+ aStarBasicCB ( this, CUI_RES( CB_STARBASIC ) ),
+ aStarBasicWarningCB(this, CUI_RES( CB_STARBASIC_WARNING ) ),
+ aPrintExtensionCB( this,CUI_RES(CB_PRINT_EXTENSION )),
+ aSaveGrfLocalCB ( this, CUI_RES( CB_LOCAL_GRF ) ),
+ aCharSetFT ( this, CUI_RES( FT_CHARSET ) ),
+ aCharSetLB ( this, CUI_RES( LB_CHARSET ) )
+
+{
+ FreeResource();
+
+ // replace placeholder with UI string from language list
+ String aText( aNumbersEnglishUSCB.GetText());
+ String aPlaceholder( RTL_CONSTASCII_USTRINGPARAM( "%ENGLISHUSLOCALE"));
+ xub_StrLen nPos;
+ if ((nPos = aText.Search( aPlaceholder)) != STRING_NOTFOUND)
+ {
+ SvtLanguageTable aLangTab;
+ const String& rStr = aLangTab.GetString( LANGUAGE_ENGLISH_US);
+ if (rStr.Len())
+ {
+ aText.Replace( nPos, aPlaceholder.Len(), rStr);
+ aNumbersEnglishUSCB.SetText( aText);
+ }
+ }
+
+ aExportLB.SetSelectHdl(LINK(this, OfaHtmlTabPage, ExportHdl_Impl));
+ aStarBasicCB.SetClickHdl(LINK(this, OfaHtmlTabPage, CheckBoxHdl_Impl));
+
+ // initialize the characterset listbox
+ aCharSetLB.FillWithMimeAndSelectBest();
+}
+
+/*-----------------02.09.96 13.47-------------------
+
+--------------------------------------------------*/
+
+OfaHtmlTabPage::~OfaHtmlTabPage()
+{
+}
+
+/*-----------------02.09.96 13.47-------------------
+
+--------------------------------------------------*/
+
+SfxTabPage* OfaHtmlTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return new OfaHtmlTabPage(pParent, rAttrSet);
+}
+
+/*-----------------02.09.96 13.47-------------------
+
+--------------------------------------------------*/
+
+BOOL OfaHtmlTabPage::FillItemSet( SfxItemSet& )
+{
+ SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
+ if(aSize1NF.GetSavedValue() != aSize1NF.GetText())
+ pHtmlOpt->SetFontSize(0, (USHORT)aSize1NF.GetValue());
+ if(aSize2NF.GetSavedValue() != aSize2NF.GetText())
+ pHtmlOpt->SetFontSize(1, (USHORT)aSize2NF.GetValue());
+ if(aSize3NF.GetSavedValue() != aSize3NF.GetText())
+ pHtmlOpt->SetFontSize(2, (USHORT)aSize3NF.GetValue());
+ if(aSize4NF.GetSavedValue() != aSize4NF.GetText())
+ pHtmlOpt->SetFontSize(3, (USHORT)aSize4NF.GetValue());
+ if(aSize5NF.GetSavedValue() != aSize5NF.GetText())
+ pHtmlOpt->SetFontSize(4, (USHORT)aSize5NF.GetValue());
+ if(aSize6NF.GetSavedValue() != aSize6NF.GetText())
+ pHtmlOpt->SetFontSize(5, (USHORT)aSize6NF.GetValue());
+ if(aSize7NF.GetSavedValue() != aSize7NF.GetText())
+ pHtmlOpt->SetFontSize(6, (USHORT)aSize7NF.GetValue());
+
+ if(aNumbersEnglishUSCB.IsChecked() != aNumbersEnglishUSCB.GetSavedValue())
+ pHtmlOpt->SetNumbersEnglishUS(aNumbersEnglishUSCB.IsChecked());
+
+ if(aUnknownTagCB.IsChecked() != aUnknownTagCB.GetSavedValue())
+ pHtmlOpt->SetImportUnknown(aUnknownTagCB.IsChecked());
+
+ if(aIgnoreFontNamesCB.IsChecked() != aIgnoreFontNamesCB.GetSavedValue())
+ pHtmlOpt->SetIgnoreFontFamily(aIgnoreFontNamesCB.IsChecked());
+
+ if(aExportLB.GetSelectEntryPos() != aExportLB.GetSavedValue())
+ pHtmlOpt->SetExportMode(aPosToExportArr[aExportLB.GetSelectEntryPos()]);
+
+ if(aStarBasicCB.IsChecked() != aStarBasicCB.GetSavedValue())
+ pHtmlOpt->SetStarBasic(aStarBasicCB.IsChecked());
+
+ if(aStarBasicWarningCB.IsChecked() != aStarBasicWarningCB.GetSavedValue())
+ pHtmlOpt->SetStarBasicWarning(aStarBasicWarningCB.IsChecked());
+
+ if(aSaveGrfLocalCB.IsChecked() != aSaveGrfLocalCB.GetSavedValue())
+ pHtmlOpt->SetSaveGraphicsLocal(aSaveGrfLocalCB.IsChecked());
+
+ if(aPrintExtensionCB.IsChecked() != aPrintExtensionCB.GetSavedValue())
+ pHtmlOpt->SetPrintLayoutExtension(aPrintExtensionCB.IsChecked());
+
+ if( aCharSetLB.GetSelectTextEncoding() != pHtmlOpt->GetTextEncoding() )
+ pHtmlOpt->SetTextEncoding( aCharSetLB.GetSelectTextEncoding() );
+
+ return FALSE;
+}
+
+/*-----------------02.09.96 13.47-------------------
+
+--------------------------------------------------*/
+
+void OfaHtmlTabPage::Reset( const SfxItemSet& )
+{
+ SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
+ aSize1NF.SetValue(pHtmlOpt->GetFontSize(0));
+ aSize2NF.SetValue(pHtmlOpt->GetFontSize(1));
+ aSize3NF.SetValue(pHtmlOpt->GetFontSize(2));
+ aSize4NF.SetValue(pHtmlOpt->GetFontSize(3));
+ aSize5NF.SetValue(pHtmlOpt->GetFontSize(4));
+ aSize6NF.SetValue(pHtmlOpt->GetFontSize(5));
+ aSize7NF.SetValue(pHtmlOpt->GetFontSize(6));
+ aNumbersEnglishUSCB.Check(pHtmlOpt->IsNumbersEnglishUS());
+ aUnknownTagCB.Check(pHtmlOpt->IsImportUnknown());
+ aIgnoreFontNamesCB.Check(pHtmlOpt->IsIgnoreFontFamily());
+ USHORT nExport = pHtmlOpt->GetExportMode();
+ if( nExport >= ( sizeof( aExportToPosArr ) / sizeof( USHORT ) ) )
+ nExport = 4; // default for bad config entry is NS 4.0
+ USHORT nPosArr = aExportToPosArr[ nExport ];
+// if( nPosArr == DEPRECATED_ENTRY )
+// nPosArr = aExportToPosArr[ 4 ]; // again: NS 4.0 is default
+ aExportLB.SelectEntryPos( nPosArr );
+ aExportLB.SaveValue();
+
+ ExportHdl_Impl(&aExportLB);
+
+ aStarBasicCB .Check(pHtmlOpt->IsStarBasic());
+ aStarBasicWarningCB .Check(pHtmlOpt->IsStarBasicWarning());
+ aStarBasicWarningCB.Enable(!aStarBasicCB.IsChecked());
+ aSaveGrfLocalCB.Check(pHtmlOpt->IsSaveGraphicsLocal());
+ aPrintExtensionCB.Check(pHtmlOpt->IsPrintLayoutExtension());
+
+ aPrintExtensionCB.SaveValue();
+ aStarBasicCB .SaveValue();
+ aStarBasicWarningCB .SaveValue();
+ aSaveGrfLocalCB.SaveValue();
+ aSize1NF.SaveValue();
+ aSize2NF.SaveValue();
+ aSize3NF.SaveValue();
+ aSize4NF.SaveValue();
+ aSize5NF.SaveValue();
+ aSize6NF.SaveValue();
+ aSize7NF.SaveValue();
+ aNumbersEnglishUSCB.SaveValue();
+ aUnknownTagCB.SaveValue();
+ aIgnoreFontNamesCB.SaveValue();
+
+ if( !pHtmlOpt->IsDefaultTextEncoding() &&
+ aCharSetLB.GetSelectTextEncoding() != pHtmlOpt->GetTextEncoding() )
+ aCharSetLB.SelectTextEncoding( pHtmlOpt->GetTextEncoding() );
+}
+
+/*-----------------16.04.98 16:03-------------------
+
+--------------------------------------------------*/
+IMPL_LINK(OfaHtmlTabPage, ExportHdl_Impl, ListBox*, pBox)
+{
+ USHORT nExport = aPosToExportArr[ pBox->GetSelectEntryPos() ];
+ switch( nExport )
+ {
+ case HTML_CFG_MSIE_40:
+ case HTML_CFG_NS40 :
+ case HTML_CFG_WRITER :
+ aPrintExtensionCB.Enable(TRUE);
+ break;
+ default: aPrintExtensionCB.Enable(FALSE);
+ }
+
+ return 0;
+}
+/* -----------------05.02.99 09:17-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK(OfaHtmlTabPage, CheckBoxHdl_Impl, CheckBox*, pBox)
+{
+ aStarBasicWarningCB.Enable(!pBox->IsChecked());
+ return 0;
+}
+
+
diff --git a/cui/source/options/opthtml.hrc b/cui/source/options/opthtml.hrc
new file mode 100644
index 000000000000..6525a31fc877
--- /dev/null
+++ b/cui/source/options/opthtml.hrc
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: opthtml.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTHTML_HRC
+#define _SVX_OPTHTML_HRC
+
+// defines ------------------------------------------------------------------
+
+#define GB_FONTSIZE 1
+#define FT_SIZE1 2
+#define NF_SIZE1 3
+#define FT_SIZE2 4
+#define NF_SIZE2 5
+#define FT_SIZE3 6
+#define NF_SIZE3 7
+#define FT_SIZE4 8
+#define NF_SIZE4 9
+#define FT_SIZE5 10
+#define NF_SIZE5 11
+#define FT_SIZE6 12
+#define NF_SIZE6 13
+#define FT_SIZE7 14
+#define NF_SIZE7 15
+#define GB_IMPORT 20
+#define CB_UNKNOWN_TAGS 21
+#define CB_IGNORE_FONTNAMES 22
+#define CB_NUMBERS_ENGLISH_US 23
+
+#define GB_EXPORT 30
+#define CB_STARBASIC 31
+#define CB_STARBASIC_WARNING 32
+
+#define CB_LOCAL_GRF 37
+#define CB_PRINT_EXTENSION 38
+#define LB_EXPORT 39
+#define FT_CHARSET 40
+#define LB_CHARSET 41
+
+#endif
+
diff --git a/cui/source/options/opthtml.hxx b/cui/source/options/opthtml.hxx
new file mode 100644
index 000000000000..3d630ea692ff
--- /dev/null
+++ b/cui/source/options/opthtml.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: opthtml.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _OFA_OPTHTML_HXX
+#define _OFA_OPTHTML_HXX
+
+#include <vcl/button.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/group.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svx/txencbox.hxx>
+
+class OfaHtmlTabPage : public SfxTabPage
+{
+ FixedLine aFontSizeGB;
+ FixedText aSize1FT;
+ NumericField aSize1NF;
+ FixedText aSize2FT;
+ NumericField aSize2NF;
+ FixedText aSize3FT;
+ NumericField aSize3NF;
+ FixedText aSize4FT;
+ NumericField aSize4NF;
+ FixedText aSize5FT;
+ NumericField aSize5NF;
+ FixedText aSize6FT;
+ NumericField aSize6NF;
+ FixedText aSize7FT;
+ NumericField aSize7NF;
+
+ FixedLine aImportGB;
+ CheckBox aNumbersEnglishUSCB;
+ CheckBox aUnknownTagCB;
+ CheckBox aIgnoreFontNamesCB;
+
+ FixedLine aExportGB;
+ ListBox aExportLB;
+ CheckBox aStarBasicCB;
+ CheckBox aStarBasicWarningCB;
+ CheckBox aPrintExtensionCB;
+ CheckBox aSaveGrfLocalCB;
+ FixedText aCharSetFT;
+ SvxTextEncodingBox aCharSetLB;
+
+ DECL_LINK(ExportHdl_Impl, ListBox*);
+ DECL_LINK(CheckBoxHdl_Impl, CheckBox*);
+
+ OfaHtmlTabPage(Window* pParent, const SfxItemSet& rSet);
+ virtual ~OfaHtmlTabPage();
+public:
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+};
+
+
+#endif //
+
+
+
diff --git a/cui/source/options/opthtml.src b/cui/source/options/opthtml.src
new file mode 100644
index 000000000000..29f5ff1fe78e
--- /dev/null
+++ b/cui/source/options/opthtml.src
@@ -0,0 +1,290 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: opthtml.src,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // include -----------------------------------------------------------------
+#include "opthtml.hrc"
+#include <cuires.hrc>
+
+ // RID_OFAPAGE_HTMLOPT -----------------------------------------------------
+TabPage RID_OFAPAGE_HTMLOPT
+{
+ // HelpId = ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ FixedText FT_SIZE1
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Size ~1" ;
+ };
+ NumericField NF_SIZE1
+ {
+ Pos = MAP_APPFONT ( 45 , 14 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 50 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 50 ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_SIZE2
+ {
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Size ~2" ;
+ };
+ NumericField NF_SIZE2
+ {
+ Pos = MAP_APPFONT ( 45 , 30 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 50 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 50 ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_SIZE3
+ {
+ Pos = MAP_APPFONT ( 12 , 48 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Size ~3" ;
+ };
+ NumericField NF_SIZE3
+ {
+ Pos = MAP_APPFONT ( 45 , 46 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 50 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 50 ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_SIZE4
+ {
+ Pos = MAP_APPFONT ( 12 , 64 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Size ~4" ;
+ };
+ NumericField NF_SIZE4
+ {
+ Pos = MAP_APPFONT ( 45 , 62 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 50 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 50 ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_SIZE5
+ {
+ Pos = MAP_APPFONT ( 12 , 80 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Size ~5" ;
+ };
+ NumericField NF_SIZE5
+ {
+ Pos = MAP_APPFONT ( 45 , 78 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 50 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 50 ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_SIZE6
+ {
+ Pos = MAP_APPFONT ( 12 , 96 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Size ~6" ;
+ };
+ NumericField NF_SIZE6
+ {
+ Pos = MAP_APPFONT ( 45 , 94 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 50 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 50 ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_SIZE7
+ {
+ Pos = MAP_APPFONT ( 12 , 112 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Size ~7" ;
+ };
+ NumericField NF_SIZE7
+ {
+ Pos = MAP_APPFONT ( 45 , 110 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 50 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 50 ;
+ SpinSize = 1 ;
+ };
+ FixedLine GB_FONTSIZE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 75 , 8 ) ;
+ Text [ en-US ] = "Font sizes" ;
+ };
+ FixedLine GB_IMPORT
+ {
+ Pos = MAP_APPFONT ( 87 , 3 ) ;
+ Size = MAP_APPFONT ( 167 , 8 ) ;
+ Text [ en-US ] = "Import" ;
+ };
+ CheckBox CB_NUMBERS_ENGLISH_US
+ {
+ Pos = MAP_APPFONT ( 93 , 14 ) ;
+ Size = MAP_APPFONT ( 161 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Use '%ENGLISHUSLOCALE' locale for numbers" ;
+ };
+ CheckBox CB_UNKNOWN_TAGS
+ {
+ Pos = MAP_APPFONT ( 93 , 28 ) ;
+ Size = MAP_APPFONT ( 155 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Import unknown HTML tags as fields" ;
+ };
+ CheckBox CB_IGNORE_FONTNAMES
+ {
+ Pos = MAP_APPFONT ( 93 , 42 ) ;
+ Size = MAP_APPFONT ( 155 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Ignore ~font settings" ;
+ };
+ FixedLine GB_EXPORT
+ {
+ Pos = MAP_APPFONT ( 87 , 58 ) ;
+ Size = MAP_APPFONT ( 167 , 8 ) ;
+ Text [ en-US ] = "Export" ;
+ };
+ ListBox LB_EXPORT
+ {
+ Pos = MAP_APPFONT ( 93 , 69 ) ;
+ Size = MAP_APPFONT ( 155 , 50 ) ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ StringList =
+ {
+ < "HTML 3.2" ; > ;
+ < "Microsoft Internet Explorer" ; > ;
+ < "Netscape Navigator"; > ;
+ < "%PRODUCTNAME Writer" ; > ;
+ };
+ };
+ CheckBox CB_STARBASIC
+ {
+ Pos = MAP_APPFONT ( 93 , 88 ) ;
+ Size = MAP_APPFONT ( 155 , 10 ) ;
+ Text = "%PRODUCTNAME ~Basic" ;
+ };
+ CheckBox CB_STARBASIC_WARNING
+ {
+ Pos = MAP_APPFONT ( 99 , 102 ) ;
+ Size = MAP_APPFONT ( 149 , 10 ) ;
+ Text [ en-US ] = "Display ~warning";
+ };
+ CheckBox CB_PRINT_EXTENSION
+ {
+ Pos = MAP_APPFONT ( 93 , 116 ) ;
+ Size = MAP_APPFONT ( 155 , 10 ) ;
+ Text [ en-US ] = "~Print layout" ;
+ };
+ CheckBox CB_LOCAL_GRF
+ {
+ Pos = MAP_APPFONT ( 93 , 130 ) ;
+ Size = MAP_APPFONT ( 155 , 10 ) ;
+ Text [ en-US ] = "~Copy local graphics to Internet" ;
+ };
+
+ FixedText FT_CHARSET
+ {
+ Pos = MAP_APPFONT ( 93 , 144 ) ;
+ Size = MAP_APPFONT ( 65 , 8 ) ;
+ Text [ en-US ] = "Character set";
+ };
+ ListBox LB_CHARSET
+ {
+ Pos = MAP_APPFONT ( 162 , 143 ) ;
+ Size = MAP_APPFONT ( 86 , 61 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+};
+ // ******************************************************************* EOF
diff --git a/cui/source/options/optimprove.cxx b/cui/source/options/optimprove.cxx
new file mode 100644
index 000000000000..c8f52a63e708
--- /dev/null
+++ b/cui/source/options/optimprove.cxx
@@ -0,0 +1,230 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optimprove.cxx,v $
+ * $Revision: 1.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#define _SVX_OPTIMPROVE_CXX
+
+#include <optimprove.hxx>
+#include <dialmgr.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/dialogs.hrc>
+#include "optimprove.hrc"
+#include "helpid.hrc"
+#include <cuires.hrc>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/system/XSystemShellExecute.hpp>
+#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
+#include <com/sun/star/oooimprovement/XCoreController.hpp>
+#include <comphelper/configurationhelper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/uieventslogger.hxx>
+#include <tools/testtoolloader.hxx>
+
+namespace lang = ::com::sun::star::lang;
+namespace uno = ::com::sun::star::uno;
+using namespace com::sun::star::system;
+
+// class SvxImprovementPage ----------------------------------------------
+
+SvxImprovementPage::SvxImprovementPage( Window* pParent ) :
+
+ TabPage( pParent, CUI_RES( RID_SVXPAGE_IMPROVEMENT ) ),
+
+ m_aImproveFL ( this, CUI_RES( FL_IMPROVE ) ),
+ m_aInvitationFT ( this, CUI_RES( FT_INVITATION ) ),
+ m_aYesRB ( this, CUI_RES( RB_YES ) ),
+ m_aNoRB ( this, CUI_RES( RB_NO ) ),
+ m_aDataFL ( this, CUI_RES( FL_DATA ) ),
+ m_aNumberOfReportsFT ( this, CUI_RES( FT_NR_REPORTS ) ),
+ m_aNumberOfReportsValueFT ( this, CUI_RES( FT_NR_REPORTS_VALUE ) ),
+ m_aNumberOfActionsFT ( this, CUI_RES( FT_NR_ACTIONS ) ),
+ m_aNumberOfActionsValueFT ( this, CUI_RES( FT_NR_ACTIONS_VALUE ) ),
+ m_aShowDataPB ( this, CUI_RES( PB_SHOWDATA ) ),
+
+ m_sInfo ( CUI_RES( STR_INFO ) ),
+ m_sMoreInfo ( CUI_RES( STR_MOREINFO ) )
+
+{
+ FreeResource();
+
+ m_aInvitationFT.Show();
+ m_aDataFL.Hide();
+ m_aNumberOfReportsFT.Hide();
+ m_aNumberOfReportsValueFT.Hide();
+ m_aNumberOfActionsFT.Hide();
+ m_aNumberOfActionsValueFT.Hide();
+ m_aShowDataPB.Hide();
+
+ Size aNewSize = m_aInvitationFT.GetSizePixel();
+ const long nMinWidth = m_aYesRB.CalcMinimumSize().Width();
+ const long nNewWidth = std::max( aNewSize.Width() * 4 / 5, nMinWidth );
+ const long nWDelta = aNewSize.Width() - nNewWidth;
+ aNewSize.Width() = nNewWidth;
+ const Size aCalcSize = m_aInvitationFT.CalcMinimumSize( nNewWidth );
+ const long nHDelta = aCalcSize.Height() - aNewSize.Height();
+ aNewSize.Height() = aCalcSize.Height();
+ m_aInvitationFT.SetSizePixel( aNewSize );
+
+ aNewSize = m_aYesRB.GetSizePixel();
+ aNewSize.Width() = nNewWidth;
+ Point aNewPos = m_aYesRB.GetPosPixel();
+ aNewPos.Y() += nHDelta;
+ m_aYesRB.SetPosSizePixel( aNewPos, aNewSize );
+ aNewSize = m_aNoRB.GetSizePixel();
+ aNewSize.Width() = nNewWidth;
+ aNewPos = m_aNoRB.GetPosPixel();
+ aNewPos.Y() += nHDelta;
+ m_aNoRB.SetPosSizePixel( aNewPos, aNewSize );
+ aNewSize = m_aImproveFL.GetSizePixel();
+ aNewSize.Width() -= nWDelta;
+ m_aImproveFL.SetSizePixel( aNewSize );
+
+ Size aSize = GetOutputSizePixel();
+ aSize.Width() -= nWDelta;
+ aSize.Height() = m_aDataFL.GetPosPixel().Y();
+ aSize.Height() += nHDelta;
+ SetSizePixel( aSize );
+}
+
+// -----------------------------------------------------------------------
+
+SvxImprovementPage::~SvxImprovementPage()
+{
+}
+
+// class SvxImprovementDialog --------------------------------------------
+
+SvxImprovementDialog::SvxImprovementDialog( Window* pParent, const String& rInfoURL ) :
+
+ SfxSingleTabDialog( pParent, RID_SVXPAGE_IMPROVEMENT, rInfoURL ),
+
+ m_pPage( NULL )
+
+{
+ m_pPage = new SvxImprovementPage( this );
+ SetInfoLink( LINK( this, SvxImprovementDialog, HandleHyperlink ) );
+ SetPage( m_pPage );
+ if ( GetOKButton() )
+ GetOKButton()->SetClickHdl( LINK( this, SvxImprovementDialog, HandleOK ) );
+}
+
+IMPL_LINK( SvxImprovementDialog, HandleHyperlink, svt::FixedHyperlinkImage*, pHyperlinkImage )
+{
+ ::rtl::OUString sURL( pHyperlinkImage->GetURL() );
+
+ if ( sURL.getLength() > 0 )
+ {
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xSMGR =
+ ::comphelper::getProcessServiceFactory();
+ uno::Reference< XSystemShellExecute > xSystemShell(
+ xSMGR->createInstance( ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ),
+ uno::UNO_QUERY_THROW );
+ if ( xSystemShell.is() )
+ {
+ xSystemShell->execute(
+ sURL, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS );
+ }
+ }
+ catch( const uno::Exception& e )
+ {
+ OSL_TRACE( "Caught exception: %s\n thread terminated.\n",
+ rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
+ }
+
+ return 0;
+}
+
+IMPL_LINK( SvxImprovementDialog, HandleOK, OKButton*, EMPTYARG )
+{
+ uno::Reference< lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
+ uno::Reference< com::sun::star::oooimprovement::XCoreController > core_c(
+ xSMGR->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.oooimprovement.CoreController")),
+ uno::UNO_QUERY);
+ if(core_c.is())
+ {
+ ::comphelper::ConfigurationHelper::writeDirectKey(
+ xSMGR,
+ ::rtl::OUString::createFromAscii("/org.openoffice.Office.OOoImprovement.Settings"),
+ ::rtl::OUString::createFromAscii("Participation"),
+ ::rtl::OUString::createFromAscii("ShowedInvitation"),
+ uno::makeAny( true ),
+ ::comphelper::ConfigurationHelper::E_STANDARD );
+ ::comphelper::ConfigurationHelper::writeDirectKey(
+ xSMGR,
+ ::rtl::OUString::createFromAscii("/org.openoffice.Office.OOoImprovement.Settings"),
+ ::rtl::OUString::createFromAscii("Participation"),
+ ::rtl::OUString::createFromAscii("InvitationAccepted"),
+ uno::makeAny( m_pPage->IsYesChecked() ),
+ ::comphelper::ConfigurationHelper::E_STANDARD );
+ // TODO: refactor
+ ::comphelper::UiEventsLogger::reinit();
+ ::tools::InitTestToolLib();
+ }
+ EndDialog( RET_OK );
+ return 0;
+}
+
+// class SvxInfoWindow ---------------------------------------------------
+
+SvxInfoWindow::SvxInfoWindow( Window* pParent, const ResId& rResId ) :
+ Window( pParent, rResId ),
+ m_aInfoText( this )
+{
+ m_aInfoText.SetPosSizePixel( Point( 10, 10 ), Size( 150, 10 ) );
+
+ const StyleSettings& rSettings = GetSettings().GetStyleSettings();
+ Wallpaper aWall( rSettings.GetWindowColor() );
+ SetBackground( aWall );
+ Font aNewFont( m_aInfoText.GetFont() );
+ aNewFont.SetTransparent( TRUE );
+ m_aInfoText.SetFont( aNewFont );
+ m_aInfoText.SetBackground( aWall );
+ m_aInfoText.SetControlForeground( rSettings.GetWindowTextColor() );
+}
+
+void SvxInfoWindow::SetInfoText( const String& rText )
+{
+ m_aInfoText.SetText( rText );
+ Size aSize = m_aInfoText.CalcMinimumSize();
+ Size aWinSize = GetSizePixel();
+ Point aPos( ( aWinSize.Width() - aSize.Width() ) / 2, ( aWinSize.Height() - aSize.Height() ) / 2 );
+ m_aInfoText.SetPosSizePixel( aPos, aSize );
+}
+
diff --git a/cui/source/options/optimprove.hrc b/cui/source/options/optimprove.hrc
new file mode 100644
index 000000000000..919b01c6fb6a
--- /dev/null
+++ b/cui/source/options/optimprove.hrc
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optimprove.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTIMPROVE_HRC
+#define _SVX_OPTIMPROVE_HRC
+
+// defines ---------------------------------------------------------------
+
+#define FL_IMPROVE 10
+#define FT_INVITATION 11
+#define RB_YES 12
+#define RB_NO 13
+#define FL_DATA 14
+#define FT_NR_REPORTS 15
+#define FT_NR_REPORTS_VALUE 16
+#define FT_NR_ACTIONS 17
+#define FT_NR_ACTIONS_VALUE 18
+#define PB_SHOWDATA 19
+#define FI_INFO 20
+#define WIN_INFO 21
+#define BTN_OK 22
+
+#define STR_INFO 10
+#define STR_MOREINFO 11
+
+#endif
+
diff --git a/cui/source/options/optimprove.src b/cui/source/options/optimprove.src
new file mode 100644
index 000000000000..d8782144cdb3
--- /dev/null
+++ b/cui/source/options/optimprove.src
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optimprove.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// include --------------------------------------------------------------
+
+#include "optimprove.hrc"
+#include <cuires.hrc>
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+
+TabPage RID_SVXPAGE_IMPROVEMENT
+{
+ //!HelpId = HID_OPTIONS_IMPROVEMENT ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "%PRODUCTNAME Improvement Program" ;
+ FixedLine FL_IMPROVE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Improvement Program" ;
+ };
+ FixedText FT_INVITATION
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 242 , 72 ) ;
+ WordBreak = TRUE ;
+ Text [ en-US ] = "We invite you to join our %PRODUCTNAME Improvement Program to help optimize the quality of %PRODUCTNAME.\n\nIf you are willing to participate, we will collect anonymous statistics about how you use %PRODUCTNAME. The data is used to identify usage patterns.\n\nThe %PRODUCTNAME Improvement Program will not collect any personal data, or document content." ;
+ };
+ RadioButton RB_YES
+ {
+ Pos = MAP_APPFONT ( 12 , 92 ) ;
+ Size = MAP_APPFONT ( 215 , 10 ) ;
+ Check = TRUE ;
+ Text [ en-US ] = "~Yes, I am willing to participate in the %PRODUCTNAME Improvement Program" ;
+ };
+ RadioButton RB_NO
+ {
+ Pos = MAP_APPFONT ( 12 , 105 ) ;
+ Size = MAP_APPFONT ( 215 , 10 ) ;
+ Text [ en-US ] = "~No, I do not wish to participate" ;
+ };
+ FixedImage FI_INFO
+ {
+ Pos = MAP_APPFONT ( 230 , 91 ) ;
+ Size = MAP_APPFONT ( 24 , 24 ) ;
+ Fixed = Image
+ {
+ ImageBitmap = Bitmap { File = "info.png"; };
+ };
+ };
+ FixedLine FL_DATA
+ {
+ Pos = MAP_APPFONT ( 6 , 121 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Tracked Data" ;
+ };
+ FixedText FT_NR_REPORTS
+ {
+ Pos = MAP_APPFONT ( 12 , 132 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Number of reports sent:" ;
+ };
+ FixedText FT_NR_REPORTS_VALUE
+ {
+ Pos = MAP_APPFONT ( 95 , 132 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ };
+ FixedText FT_NR_ACTIONS
+ {
+ Pos = MAP_APPFONT ( 12 , 145 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Number of tracked actions:" ;
+ };
+ FixedText FT_NR_ACTIONS_VALUE
+ {
+ Pos = MAP_APPFONT ( 95 , 145 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ };
+ PushButton PB_SHOWDATA
+ {
+ Pos = MAP_APPFONT ( 12 , 161 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Show Data" ;
+ };
+ String STR_INFO
+ {
+ Text [ en-US ] = "Help Optimize the Quality of %PRODUCTNAME" ;
+ };
+ String STR_MOREINFO
+ {
+ Text [ en-US ] = "More Information" ;
+ };
+};
+
diff --git a/cui/source/options/optimprove2.cxx b/cui/source/options/optimprove2.cxx
new file mode 100644
index 000000000000..1509b88ce186
--- /dev/null
+++ b/cui/source/options/optimprove2.cxx
@@ -0,0 +1,272 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optimprove2.cxx,v $
+ * $Revision: 1.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#define _SVX_OPTIMPROVE_CXX
+
+#include <optimprove.hxx>
+#include <dialmgr.hxx>
+#include <vcl/msgbox.hxx>
+
+#include "optimprove.hrc"
+#include "helpid.hrc"
+#include <cuires.hrc>
+#include <svx/dialogs.hrc>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/oooimprovement/XCore.hpp>
+#include <com/sun/star/oooimprovement/XCoreController.hpp>
+#include <com/sun/star/system/XSystemShellExecute.hpp>
+#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
+#include <com/sun/star/util/XStringSubstitution.hpp>
+#include <comphelper/configurationhelper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/synchronousdispatch.hxx>
+#include <comphelper/uieventslogger.hxx>
+#include <tools/testtoolloader.hxx>
+
+#define C2S(s) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
+
+namespace beans = ::com::sun::star::beans;
+namespace lang = ::com::sun::star::lang;
+namespace uno = ::com::sun::star::uno;
+namespace util = ::com::sun::star::util;
+using namespace com::sun::star::system;
+
+// class SvxEmptyPage ----------------------------------------------------
+
+SvxEmptyPage::SvxEmptyPage( Window* pParent ) :
+
+ TabPage( pParent, CUI_RES( RID_SVXPAGE_IMPROVEMENT ) )
+
+{
+ FreeResource();
+}
+
+// class SvxImprovementOptionsPage ---------------------------------------
+
+SvxImprovementOptionsPage::SvxImprovementOptionsPage( Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_IMPROVEMENT ), rSet ),
+
+ m_aImproveFL ( this, CUI_RES( FL_IMPROVE ) ),
+ m_aInvitationFT ( this, CUI_RES( FT_INVITATION ) ),
+ m_aYesRB ( this, CUI_RES( RB_YES ) ),
+ m_aNoRB ( this, CUI_RES( RB_NO ) ),
+ m_aInfoFI ( this, CUI_RES( FI_INFO ) ),
+ m_aDataFL ( this, CUI_RES( FL_DATA ) ),
+ m_aNumberOfReportsFT ( this, CUI_RES( FT_NR_REPORTS ) ),
+ m_aNumberOfReportsValueFT ( this, CUI_RES( FT_NR_REPORTS_VALUE ) ),
+ m_aNumberOfActionsFT ( this, CUI_RES( FT_NR_ACTIONS ) ),
+ m_aNumberOfActionsValueFT ( this, CUI_RES( FT_NR_ACTIONS_VALUE ) ),
+ m_aShowDataPB ( this, CUI_RES( PB_SHOWDATA ) ),
+
+ m_sInfo ( CUI_RES( STR_INFO ) ),
+ m_sMoreInfo ( CUI_RES( STR_MOREINFO ) )
+
+{
+ FreeResource();
+
+ m_aInfoFI.SetURL( C2S( "www.sun.com/privacy/" ) );
+ m_aInfoFI.SetClickHdl( LINK( this, SvxImprovementOptionsPage, HandleHyperlink ) );
+ m_aShowDataPB.SetClickHdl( LINK( this, SvxImprovementOptionsPage, HandleShowData ) );
+}
+
+SvxImprovementOptionsPage::~SvxImprovementOptionsPage()
+{
+}
+
+IMPL_LINK( SvxImprovementOptionsPage, HandleHyperlink, svt::FixedHyperlinkImage*, EMPTYARG )
+{
+ ::rtl::OUString sURL( m_aInfoFI.GetURL() );
+
+ if ( sURL.getLength() > 0 )
+ {
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xSMGR =
+ ::comphelper::getProcessServiceFactory();
+ uno::Reference< XSystemShellExecute > xSystemShell(
+ xSMGR->createInstance( ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ),
+ uno::UNO_QUERY_THROW );
+ if ( xSystemShell.is() )
+ {
+ xSystemShell->execute(
+ sURL, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS );
+ }
+ }
+ catch( const uno::Exception& e )
+ {
+ OSL_TRACE( "Caught exception: %s\n thread terminated.\n",
+ rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
+ }
+
+ return 0;
+}
+
+IMPL_LINK( SvxImprovementOptionsPage, HandleShowData, PushButton*, EMPTYARG )
+{
+ uno::Reference < uno::XInterface > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(
+ C2S("com.sun.star.frame.Desktop") ), uno::UNO_QUERY );
+ if ( xDesktop.is() )
+ {
+ ::rtl::OUString sLogFile( m_sLogPath );
+ sLogFile += C2S("/Current.csv");
+ uno::Sequence< beans::PropertyValue > aArgs(3);
+ aArgs[0].Name = ::rtl::OUString::createFromAscii("FilterName");
+ aArgs[0].Value = uno::makeAny(::rtl::OUString::createFromAscii("Text - txt - csv (StarCalc)"));
+ aArgs[1].Name = ::rtl::OUString::createFromAscii("FilterOptions");
+ aArgs[1].Value = uno::makeAny(::rtl::OUString::createFromAscii("44,34,12,1,"));
+ aArgs[2].Name = ::rtl::OUString::createFromAscii("ReadOnly");
+ aArgs[2].Value = uno::makeAny(true);
+
+ uno::Reference< lang::XComponent > xDoc = ::comphelper::SynchronousDispatch::dispatch(
+ xDesktop, sLogFile, C2S("_default"), 0, aArgs );
+ if ( xDoc.is() )
+ return 1;
+ }
+
+ return 0;
+}
+
+SfxTabPage* SvxImprovementOptionsPage::Create( Window* pParent, const SfxItemSet& rSet )
+{
+ return new SvxImprovementOptionsPage( pParent, rSet );
+}
+
+sal_uInt16* SvxImprovementOptionsPage::GetRanges()
+{
+ return NULL;
+}
+
+sal_Bool SvxImprovementOptionsPage::FillItemSet( SfxItemSet& /*rSet*/ )
+{
+ uno::Reference< lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
+ uno::Reference< uno::XInterface > xConfig;
+
+ try
+ {
+ xConfig = ::comphelper::ConfigurationHelper::openConfig(
+ xSMGR, C2S("/org.openoffice.Office.OOoImprovement.Settings"),
+ ::comphelper::ConfigurationHelper::E_STANDARD );
+ ::comphelper::ConfigurationHelper::writeRelativeKey(
+ xConfig, C2S("Participation"), C2S("ShowedInvitation"), uno::makeAny( true ) );
+ ::comphelper::ConfigurationHelper::writeRelativeKey(
+ xConfig, C2S("Participation"), C2S("InvitationAccepted"), uno::makeAny( m_aYesRB.IsChecked() != FALSE ) );
+ ::comphelper::ConfigurationHelper::flush( xConfig );
+ // TODO: refactor
+ ::comphelper::UiEventsLogger::reinit();
+ ::tools::InitTestToolLib();
+ }
+ catch( uno::Exception& )
+ {
+ }
+
+ return sal_False;
+}
+
+void SvxImprovementOptionsPage::Reset( const SfxItemSet& /*rSet*/ )
+{
+ uno::Reference< lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
+ uno::Reference< com::sun::star::oooimprovement::XCore > xCore(
+ xSMGR->createInstance( C2S("com.sun.star.oooimprovement.Core") ),
+ uno::UNO_QUERY );
+ uno::Reference< uno::XInterface > xConfig;
+
+ try
+ {
+ m_aNoRB.Check();
+ xConfig = ::comphelper::ConfigurationHelper::openConfig(
+ xSMGR, C2S("/org.openoffice.Office.OOoImprovement.Settings"),
+ ::comphelper::ConfigurationHelper::E_READONLY );
+ if ( xConfig.is() )
+ {
+ bool bYesChecked = false;
+ uno::Any aAny = ::comphelper::ConfigurationHelper::
+ readRelativeKey( xConfig, C2S("Participation"), C2S("ShowedInvitation") );
+ if ( ( aAny >>= bYesChecked ) && bYesChecked )
+ {
+ bool bTemp = false;
+ aAny = ::comphelper::ConfigurationHelper::
+ readRelativeKey( xConfig, C2S("Participation"), C2S("InvitationAccepted") );
+ if ( aAny >>= bTemp )
+ {
+ bYesChecked &= bTemp;
+ if ( bYesChecked )
+ m_aYesRB.Check();
+ }
+ }
+
+ ::rtl::OUString sURL;
+ aAny = ::comphelper::ConfigurationHelper::
+ readRelativeKey( xConfig, C2S("Participation"), C2S("HelpUrl") );
+ if ( aAny >>= sURL )
+ m_aInfoFI.SetURL( sURL );
+
+ sal_Int32 nCount = 0;
+ aAny = ::comphelper::ConfigurationHelper::
+ readRelativeKey( xConfig, C2S("Counters"), C2S("UploadedReports") );
+ if ( aAny >>= nCount )
+ m_aNumberOfReportsValueFT.SetText( String::CreateFromInt32( nCount ) );
+ aAny = ::comphelper::ConfigurationHelper::
+ readRelativeKey( xConfig, C2S("Counters"), C2S("LoggedEvents") );
+ if ( aAny >>= nCount )
+ {
+ if ( xCore.is() )
+ nCount += xCore->getSessionLogEventCount();
+ m_aNumberOfActionsValueFT.SetText( String::CreateFromInt32( nCount ) );
+ }
+
+ ::rtl::OUString sPath;
+ aAny = ::comphelper::ConfigurationHelper::readDirectKey(
+ xSMGR, C2S("/org.openoffice.Office.Logging"), C2S("OOoImprovement"),
+ C2S("LogPath"), ::comphelper::ConfigurationHelper::E_READONLY );
+ if ( aAny >>= sPath )
+ {
+ uno::Reference< util::XStringSubstitution > xSubst(
+ xSMGR->createInstance( C2S("com.sun.star.util.PathSubstitution") ),
+ uno::UNO_QUERY );
+ if ( xSubst.is() )
+ sPath = xSubst->substituteVariables( sPath, sal_False );
+ m_sLogPath = sPath;
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+}
+
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
new file mode 100644
index 000000000000..b8d7fec16efc
--- /dev/null
+++ b/cui/source/options/optinet2.cxx
@@ -0,0 +1,2339 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optinet2.cxx,v $
+ * $Revision: 1.31 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <tools/config.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/intitem.hxx>
+#include <svl/stritem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/slstitm.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <sfx2/filedlghelper.hxx>
+#include <tools/inetdef.hxx>
+#include <svl/urihelper.hxx>
+#include <svl/cntwids.hrc>
+#include <unotools/inetoptions.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/objsh.hxx>
+#include <unotools/bootstrap.hxx>
+#include <vcl/help.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/pathoptions.hxx>
+#include <unotools/securityoptions.hxx>
+#include <unotools/javaoptions.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <unotools/extendedsecurityoptions.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#define _SVX_OPTINET2_CXX
+#include <dialmgr.hxx>
+#include "optinet2.hxx"
+#include <svx/svxdlg.hxx> //CHINA001
+#include <cuires.hrc>
+#include "optinet2.hrc"
+#include "helpid.hrc"
+#include <svx/ofaitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <svx/svxids.hrc> // slot ids, mostly for changetracking
+
+// for security TP
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+
+#ifdef UNX
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <pwd.h>
+#include <sys/types.h>
+#include <string.h>
+#include <rtl/textenc.h>
+#include <rtl/locale.h>
+#include <osl/nlsupport.h>
+#endif
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <osl/file.hxx>
+#include <osl/process.h>
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
+#include <comphelper/processfactory.hxx>
+
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include "com/sun/star/task/XMasterPasswordHandling2.hpp"
+#include "com/sun/star/task/XPasswordContainer.hpp"
+#include "securityoptions.hxx"
+#include "webconninfo.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::sfx2;
+using ::rtl::OUString;
+
+//CHINA001 copy from multipat.hxx begin
+// define ----------------------------------------------------------------
+
+// different delimiter for Unix (:) and Windows (;)
+
+#ifdef UNX
+#define CLASSPATH_DELIMITER ':'
+#else
+#define CLASSPATH_DELIMITER ';'
+#endif
+//CHINA001 copy from multipat.hxx end
+// static ----------------------------------------------------------------
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+
+#define INET_SEARCH_TOKEN '"'
+#define RET_ALL ((short)200)
+#define CFG_READONLY_DEFAULT FALSE
+
+#include <sal/config.h>
+
+SV_IMPL_PTRARR( SfxFilterPtrArr, SfxFilterPtr )
+
+const char* SEARCHENGINE_INI = "srcheng.ini";
+const char* SEARCHENGINE_GROUP = "SearchEngines-$(vlang)";
+
+// -----------------------------------------------------------------------
+
+String lcl_MakeTabEntry(const SfxFilter* pFilter)
+{
+ String sEntry(pFilter->GetMimeType());
+ sEntry += '\t';
+ sEntry += pFilter->GetWildcard().GetWildCard();
+ sEntry += '\t';
+ sEntry += pFilter->GetName();
+#if defined(OS2)
+ sEntry += '\t';
+ sEntry += pFilter->GetTypeName();
+#endif
+ return sEntry;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL IsJavaInstalled_Impl( /*!!!SfxIniManager* pIniMgr*/ )
+{
+ BOOL bRet = FALSE;
+/*!!! (pb) needs new implementation
+ String aIniEntry;
+ String aFullName = Config::GetConfigName( pIniMgr->Get( SFX_KEY_USERCONFIG_PATH ),
+ String::CreateFromAscii("java") );
+ INetURLObject aIniFileObj( aFullName, INET_PROT_FILE );
+ String aIniPath = aIniFileObj.getName();
+ if ( pIniMgr->SearchFile( aIniPath ) )
+ {
+ Config aJavaCfg( aIniPath );
+ aJavaCfg.SetGroup( "Java" );
+ ByteString sTemp = aJavaCfg.ReadKey( ByteString(::rtl::OUStringToOString(pIniMgr->GetKeyName( SFX_KEY_JAVA_SYSTEMCLASSPATH ),RTL_TEXTENCODING_UTF8)) );
+ String aJavaSystemClassPath = ::rtl::OStringToOUString(sTemp,RTL_TEXTENCODING_UTF8);
+ String aJavaRuntimeLib = ::rtl::OStringToOUString(aJavaCfg.ReadKey( "RuntimeLib" ),RTL_TEXTENCODING_UTF8);
+ if ( aJavaSystemClassPath.Len() && aJavaRuntimeLib.Len() )
+ bRet = TRUE;
+ }
+*/
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxNoSpaceEdit::KeyInput( const KeyEvent& rKEvent )
+{
+ if ( bOnlyNumeric )
+ {
+ const KeyCode& rKeyCode = rKEvent.GetKeyCode();
+ USHORT nGroup = rKeyCode.GetGroup();
+ USHORT nKey = rKeyCode.GetCode();
+ BOOL bValid = ( KEYGROUP_NUM == nGroup || KEYGROUP_CURSOR == nGroup ||
+ ( KEYGROUP_MISC == nGroup && ( nKey < KEY_ADD || nKey > KEY_EQUAL ) ) );
+ if ( !bValid && ( rKeyCode.IsMod1() && (
+ KEY_A == nKey || KEY_C == nKey || KEY_V == nKey || KEY_X == nKey || KEY_Z == nKey ) ) )
+ // Erase, Copy, Paste, Select All und Undo soll funktionieren
+ bValid = TRUE;
+
+ if ( bValid )
+ Edit::KeyInput(rKEvent);
+ }
+ else if( rKEvent.GetKeyCode().GetCode() != KEY_SPACE )
+ Edit::KeyInput(rKEvent);
+}
+
+// -----------------------------------------------------------------------
+
+void SvxNoSpaceEdit::Modify()
+{
+ Edit::Modify();
+
+ if ( bOnlyNumeric )
+ {
+ XubString aValue = GetText();
+
+ if ( !ByteString(::rtl::OUStringToOString(aValue,RTL_TEXTENCODING_UTF8)).IsNumericAscii() || (long)aValue.ToInt32() > USHRT_MAX )
+ // der H�chstwert einer Portnummer ist USHRT_MAX
+ ErrorBox( this, CUI_RES( RID_SVXERR_OPT_PROXYPORTS ) ).Execute();
+ }
+}
+
+/********************************************************************/
+/********************************************************************/
+/* */
+/* SvxProxyTabPage */
+/* */
+/* */
+/********************************************************************/
+/********************************************************************/
+
+SvxProxyTabPage::SvxProxyTabPage(Window* pParent, const SfxItemSet& rSet ) :
+ SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_INET_PROXY ), rSet ),
+ aOptionGB (this, CUI_RES(GB_SETTINGS)),
+
+ aProxyModeFT (this, CUI_RES(FT_PROXYMODE)),
+ aProxyModeLB (this, CUI_RES(LB_PROXYMODE)),
+
+ aHttpProxyFT (this, CUI_RES( FT_HTTP_PROXY )),
+ aHttpProxyED (this, CUI_RES( ED_HTTP_PROXY )),
+ aHttpPortFT (this, CUI_RES( FT_HTTP_PORT )),
+ aHttpPortED (this, CUI_RES( ED_HTTP_PORT ), TRUE),
+
+ aHttpsProxyFT (this, CUI_RES( FT_HTTPS_PROXY )),
+ aHttpsProxyED (this, CUI_RES( ED_HTTPS_PROXY )),
+ aHttpsPortFT (this, CUI_RES( FT_HTTPS_PORT )),
+ aHttpsPortED (this, CUI_RES( ED_HTTPS_PORT ), TRUE),
+
+ aFtpProxyFT (this, CUI_RES( FT_FTP_PROXY )),
+ aFtpProxyED (this, CUI_RES( ED_FTP_PROXY )),
+ aFtpPortFT (this, CUI_RES( FT_FTP_PORT )),
+ aFtpPortED (this, CUI_RES( ED_FTP_PORT ), TRUE),
+
+ aNoProxyForFT (this, CUI_RES( FT_NOPROXYFOR )),
+ aNoProxyForED (this, CUI_RES( ED_NOPROXYFOR )),
+ aNoProxyDescFT (this, CUI_RES( ED_NOPROXYDESC )),
+ sFromBrowser ( CUI_RES( ST_PROXY_FROM_BROWSER ) ),
+ aProxyModePN(RTL_CONSTASCII_USTRINGPARAM("ooInetProxyType")),
+ aHttpProxyPN(RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyName")),
+ aHttpPortPN(RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyPort")),
+ aHttpsProxyPN(RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyName")),
+ aHttpsPortPN(RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyPort")),
+ aFtpProxyPN(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyName")),
+ aFtpPortPN(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyPort")),
+ aNoProxyDescPN(RTL_CONSTASCII_USTRINGPARAM("ooInetNoProxy"))
+{
+ FreeResource();
+
+ aHttpPortED.SetMaxTextLen(5);
+ aHttpsPortED.SetMaxTextLen(5);
+ aFtpPortED.SetMaxTextLen(5);
+ Link aLink = LINK( this, SvxProxyTabPage, LoseFocusHdl_Impl );
+ aHttpPortED.SetLoseFocusHdl( aLink );
+ aHttpsPortED.SetLoseFocusHdl( aLink );
+ aFtpPortED.SetLoseFocusHdl( aLink );
+
+ aProxyModeLB.SetSelectHdl(LINK( this, SvxProxyTabPage, ProxyHdl_Impl ));
+
+ Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager(
+ ::comphelper::getProcessServiceFactory());
+
+ if( xServiceManager.is() )
+ {
+ try
+ {
+ Reference< com::sun::star::lang::XMultiServiceFactory > xConfigurationProvider =
+ Reference< com::sun::star::lang::XMultiServiceFactory > ( xServiceManager->createInstance( rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ) ),
+ UNO_QUERY_THROW);
+
+ OUString aConfigRoot(RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings" ) );
+
+ beans::PropertyValue aProperty;
+ aProperty.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
+ aProperty.Value = makeAny( aConfigRoot );
+
+ Sequence< Any > aArgumentList( 1 );
+ aArgumentList[0] = makeAny( aProperty );
+
+ m_xConfigurationUpdateAccess = xConfigurationProvider->createInstanceWithArguments( rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) ),
+ aArgumentList );
+ }
+ catch ( RuntimeException& )
+ {
+ }
+ }
+
+ ArrangeControls_Impl();
+}
+
+/*-----------------12.08.96 14.55-------------------
+
+--------------------------------------------------*/
+
+SvxProxyTabPage::~SvxProxyTabPage()
+{
+}
+
+/*-----------------12.08.96 14.55-------------------
+
+--------------------------------------------------*/
+
+SfxTabPage* SvxProxyTabPage::Create(Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new SvxProxyTabPage(pParent, rAttrSet);
+}
+
+/*-----------------02.09.04 14.55-------------------
+
+--------------------------------------------------*/
+
+void SvxProxyTabPage::ReadConfigData_Impl()
+{
+ try {
+ Reference< container::XNameAccess > xNameAccess(m_xConfigurationUpdateAccess, UNO_QUERY_THROW);
+
+ sal_Int32 nIntValue = 0;
+ OUString aStringValue;
+
+ if( xNameAccess->getByName(aProxyModePN) >>= nIntValue )
+ {
+ aProxyModeLB.SelectEntryPos( (USHORT) nIntValue );
+ }
+
+ if( xNameAccess->getByName(aHttpProxyPN) >>= aStringValue )
+ {
+ aHttpProxyED.SetText( aStringValue );
+ }
+
+ if( xNameAccess->getByName(aHttpPortPN) >>= nIntValue )
+ {
+ aHttpPortED.SetText( String::CreateFromInt32( nIntValue ));
+ }
+
+ if( xNameAccess->getByName(aHttpsProxyPN) >>= aStringValue )
+ {
+ aHttpsProxyED.SetText( aStringValue );
+ }
+
+ if( xNameAccess->getByName(aHttpsPortPN) >>= nIntValue )
+ {
+ aHttpsPortED.SetText( String::CreateFromInt32( nIntValue ));
+ }
+
+ if( xNameAccess->getByName(aFtpProxyPN) >>= aStringValue )
+ {
+ aFtpProxyED.SetText( aStringValue );
+ }
+
+ if( xNameAccess->getByName(aFtpPortPN) >>= nIntValue )
+ {
+ aFtpPortED.SetText( String::CreateFromInt32( nIntValue ));
+ }
+
+ if( xNameAccess->getByName(aNoProxyDescPN) >>= aStringValue )
+ {
+ aNoProxyForED.SetText( aStringValue );
+ }
+ }
+
+ catch(container::NoSuchElementException e) {
+ OSL_TRACE( "SvxProxyTabPage::ReadConfigData_Impl: NoSuchElementException caught" );
+ }
+
+ catch(com::sun::star::lang::WrappedTargetException e) {
+ OSL_TRACE( "SvxProxyTabPage::ReadConfigData_Impl: WrappedTargetException caught" );
+ }
+
+ catch(RuntimeException e) {
+ OSL_TRACE( "SvxProxyTabPage::ReadConfigData_Impl: RuntimeException caught" );
+ }
+
+}
+
+/*-----------------02.09.04 14.55-------------------
+
+--------------------------------------------------*/
+
+void SvxProxyTabPage::ReadConfigDefaults_Impl()
+{
+ try
+ {
+ Reference< beans::XPropertyState > xPropertyState(m_xConfigurationUpdateAccess, UNO_QUERY_THROW);
+
+ sal_Int32 nIntValue = 0;
+ OUString aStringValue;
+
+ if( xPropertyState->getPropertyDefault(aHttpProxyPN) >>= aStringValue )
+ {
+ aHttpProxyED.SetText( aStringValue );
+ }
+
+ if( xPropertyState->getPropertyDefault(aHttpPortPN) >>= nIntValue )
+ {
+ aHttpPortED.SetText( String::CreateFromInt32( nIntValue ));
+ }
+
+ if( xPropertyState->getPropertyDefault(aHttpsProxyPN) >>= aStringValue )
+ {
+ aHttpsProxyED.SetText( aStringValue );
+ }
+
+ if( xPropertyState->getPropertyDefault(aHttpsPortPN) >>= nIntValue )
+ {
+ aHttpsPortED.SetText( String::CreateFromInt32( nIntValue ));
+ }
+
+ if( xPropertyState->getPropertyDefault(aFtpProxyPN) >>= aStringValue )
+ {
+ aFtpProxyED.SetText( aStringValue );
+ }
+
+ if( xPropertyState->getPropertyDefault(aFtpPortPN) >>= nIntValue )
+ {
+ aFtpPortED.SetText( String::CreateFromInt32( nIntValue ));
+ }
+
+ if( xPropertyState->getPropertyDefault(aNoProxyDescPN) >>= aStringValue )
+ {
+ aNoProxyForED.SetText( aStringValue );
+ }
+ }
+ catch(beans::UnknownPropertyException e)
+ {
+ OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: UnknownPropertyException caught" );
+ }
+
+ catch(com::sun::star::lang::WrappedTargetException e) {
+ OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: WrappedTargetException caught" );
+ }
+
+ catch(RuntimeException e)
+ {
+ OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: RuntimeException caught" );
+ }
+}
+
+/*-----------------02.09.04 14.55-------------------
+
+--------------------------------------------------*/
+
+void SvxProxyTabPage::RestoreConfigDefaults_Impl()
+{
+ try
+ {
+ Reference< beans::XPropertyState > xPropertyState(m_xConfigurationUpdateAccess, UNO_QUERY_THROW);
+
+ xPropertyState->setPropertyToDefault(aProxyModePN);
+ xPropertyState->setPropertyToDefault(aHttpProxyPN);
+ xPropertyState->setPropertyToDefault(aHttpPortPN);
+ xPropertyState->setPropertyToDefault(aHttpsProxyPN);
+ xPropertyState->setPropertyToDefault(aHttpsPortPN);
+ xPropertyState->setPropertyToDefault(aFtpProxyPN);
+ xPropertyState->setPropertyToDefault(aFtpPortPN);
+ xPropertyState->setPropertyToDefault(aNoProxyDescPN);
+
+ Reference< util::XChangesBatch > xChangesBatch(m_xConfigurationUpdateAccess, UNO_QUERY_THROW);
+ xChangesBatch->commitChanges();
+ }
+
+ catch(beans::UnknownPropertyException e)
+ {
+ OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: UnknownPropertyException caught" );
+ }
+
+ catch(com::sun::star::lang::WrappedTargetException e) {
+ OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: WrappedTargetException caught" );
+ }
+
+ catch(RuntimeException e)
+ {
+ OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: RuntimeException caught" );
+ }
+}
+
+/*-----------------12.08.96 14.55-------------------
+
+--------------------------------------------------*/
+
+void SvxProxyTabPage::Reset(const SfxItemSet&)
+{
+ ReadConfigData_Impl();
+
+ aProxyModeLB.SaveValue();
+ aHttpProxyED.SaveValue();
+ aHttpPortED.SaveValue();
+ aHttpsProxyED.SaveValue();
+ aHttpsPortED.SaveValue();
+ aFtpProxyED.SaveValue();
+ aFtpPortED.SaveValue();
+ aNoProxyForED.SaveValue();
+
+ EnableControls_Impl( aProxyModeLB.GetSelectEntryPos() == 2 );
+}
+
+/*-----------------12.08.96 16.34-------------------
+
+--------------------------------------------------*/
+
+BOOL SvxProxyTabPage::FillItemSet(SfxItemSet& )
+{
+ BOOL bModified=FALSE;
+
+ try {
+ Reference< beans::XPropertySet > xPropertySet(m_xConfigurationUpdateAccess, UNO_QUERY_THROW );
+
+ USHORT nSelPos = aProxyModeLB.GetSelectEntryPos();
+ if(aProxyModeLB.GetSavedValue() != nSelPos)
+ {
+ if( nSelPos == 1 )
+ {
+ RestoreConfigDefaults_Impl();
+ return TRUE;
+ }
+
+ xPropertySet->setPropertyValue(aProxyModePN,
+ makeAny((sal_Int32) nSelPos));
+ bModified = TRUE;
+ }
+
+ if(aHttpProxyED.GetSavedValue() != aHttpProxyED.GetText())
+ {
+ xPropertySet->setPropertyValue( aHttpProxyPN,
+ makeAny(rtl::OUString(aHttpProxyED.GetText())));
+ bModified = TRUE;
+ }
+
+ if ( aHttpPortED.GetSavedValue() != aHttpPortED.GetText() )
+ {
+ xPropertySet->setPropertyValue( aHttpPortPN,
+ makeAny(aHttpPortED.GetText().ToInt32()));
+ bModified = TRUE;
+ }
+
+ if(aHttpsProxyED.GetSavedValue() != aHttpsProxyED.GetText())
+ {
+ xPropertySet->setPropertyValue( aHttpsProxyPN,
+ makeAny(rtl::OUString(aHttpsProxyED.GetText())));
+ bModified = TRUE;
+ }
+
+ if ( aHttpsPortED.GetSavedValue() != aHttpsPortED.GetText() )
+ {
+ xPropertySet->setPropertyValue( aHttpsPortPN,
+ makeAny(aHttpsPortED.GetText().ToInt32()));
+ bModified = TRUE;
+ }
+
+ if(aFtpProxyED.GetSavedValue() != aFtpProxyED.GetText())
+ {
+ xPropertySet->setPropertyValue( aFtpProxyPN,
+ makeAny( rtl::OUString(aFtpProxyED.GetText())));
+ bModified = TRUE;
+ }
+
+ if ( aFtpPortED.GetSavedValue() != aFtpPortED.GetText() )
+ {
+ xPropertySet->setPropertyValue( aFtpPortPN,
+ makeAny(aFtpPortED.GetText().ToInt32()));
+ bModified = TRUE;
+ }
+
+ if ( aNoProxyForED.GetSavedValue() != aNoProxyForED.GetText() )
+ {
+ xPropertySet->setPropertyValue( aNoProxyDescPN,
+ makeAny( rtl::OUString(aNoProxyForED.GetText())));
+ bModified = TRUE;
+ }
+
+ Reference< util::XChangesBatch > xChangesBatch(m_xConfigurationUpdateAccess, UNO_QUERY_THROW);
+ xChangesBatch->commitChanges();
+ }
+
+ catch(com::sun::star::lang::IllegalArgumentException e) {
+ OSL_TRACE( "SvxProxyTabPage::FillItemSet: IllegalArgumentException caught" );
+ }
+
+ catch(beans::UnknownPropertyException e) {
+ OSL_TRACE( "SvxProxyTabPage::FillItemSet: UnknownPropertyException caught" );
+ }
+
+ catch(beans::PropertyVetoException e) {
+ OSL_TRACE( "SvxProxyTabPage::FillItemSet: PropertyVetoException caught" );
+ }
+
+ catch(com::sun::star::lang::WrappedTargetException e) {
+ OSL_TRACE( "SvxProxyTabPage::FillItemSet: WrappedTargetException caught" );
+ }
+
+ catch(RuntimeException e) {
+ OSL_TRACE( "SvxProxyTabPage::FillItemSet: RuntimeException caught" );
+ }
+
+ return bModified;
+}
+
+void SvxProxyTabPage::ArrangeControls_Impl()
+{
+ //-->Calculate dynamical width of controls, add buy wuy for i71445 Time: 2007.02.27
+ long nWidth = aProxyModeFT.GetCtrlTextWidth( aProxyModeFT.GetText() );
+ long nTemp = aHttpProxyFT.GetCtrlTextWidth( aHttpProxyFT.GetText() );
+ if ( nTemp > nWidth )
+ nWidth = nTemp;
+ nTemp = aHttpsProxyFT.GetCtrlTextWidth( aHttpsProxyFT.GetText() );
+ if ( nTemp > nWidth )
+ nWidth = nTemp;
+ nTemp = aFtpProxyFT.GetCtrlTextWidth( aFtpProxyFT.GetText() );
+ if ( nTemp > nWidth )
+ nWidth = nTemp;
+ nTemp = aNoProxyForFT.GetCtrlTextWidth( aNoProxyForFT.GetText() );
+ if ( nTemp > nWidth )
+ nWidth = nTemp;
+
+ nWidth += 10; // To be sure the length of the FixedText is enough on all platforms
+ const long nFTWidth = aProxyModeFT.GetSizePixel().Width();
+ if ( nWidth > nFTWidth )
+ {
+ Size aNewSize = aProxyModeFT.GetSizePixel();
+ aNewSize.Width() = nWidth;
+
+ aProxyModeFT.SetSizePixel( aNewSize );
+ aHttpProxyFT.SetSizePixel( aNewSize );
+ aHttpsProxyFT.SetSizePixel( aNewSize );
+ aFtpProxyFT.SetSizePixel( aNewSize );
+ aNoProxyForFT.SetSizePixel( aNewSize );
+
+ const long nDelta = nWidth - nFTWidth;
+ Point aNewPos = aProxyModeLB.GetPosPixel();
+ aNewPos.X() += nDelta;
+
+ aProxyModeLB.SetPosPixel( aNewPos );
+
+ aNewSize = aHttpProxyED.GetSizePixel();
+ aNewSize.Width() -= nDelta;
+
+ aNewPos.Y() = aHttpProxyED.GetPosPixel().Y();
+ aHttpProxyED.SetPosSizePixel( aNewPos, aNewSize );
+ aNewPos.Y() = aHttpsProxyED.GetPosPixel().Y();
+ aHttpsProxyED.SetPosSizePixel( aNewPos, aNewSize );
+ aNewPos.Y() = aFtpProxyED.GetPosPixel().Y();
+ aFtpProxyED.SetPosSizePixel( aNewPos, aNewSize );
+ aNewPos.Y() = aNoProxyForED.GetPosPixel().Y();
+ aNoProxyForED.SetPosSizePixel( aNewPos, aNewSize );
+ }
+ //<--End buy wuy for i71445 Time: 2007.02.27
+}
+
+/*-----------------12.08.96 13.38-------------------
+
+--------------------------------------------------*/
+void SvxProxyTabPage::EnableControls_Impl(BOOL bEnable)
+{
+ aHttpProxyFT.Enable(bEnable);
+ aHttpProxyED.Enable(bEnable);
+ aHttpPortFT.Enable(bEnable);
+ aHttpPortED.Enable(bEnable);
+
+ aHttpsProxyFT.Enable(bEnable);
+ aHttpsProxyED.Enable(bEnable);
+ aHttpsPortFT.Enable(bEnable);
+ aHttpsPortED.Enable(bEnable);
+
+ aFtpProxyFT.Enable(bEnable);
+ aFtpProxyED.Enable(bEnable);
+ aFtpPortFT.Enable(bEnable);
+ aFtpPortED.Enable(bEnable);
+
+ aNoProxyForFT.Enable(bEnable);
+ aNoProxyForED.Enable(bEnable);
+ aNoProxyDescFT.Enable(bEnable);
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxProxyTabPage, ProxyHdl_Impl, ListBox *, pBox )
+{
+ USHORT nPos = pBox->GetSelectEntryPos();
+
+ // Restore original system values
+ if( nPos == 1 )
+ {
+ ReadConfigDefaults_Impl();
+ }
+
+ EnableControls_Impl(nPos == 2);
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxProxyTabPage, LoseFocusHdl_Impl, Edit *, pEdit )
+{
+ XubString aValue = pEdit->GetText();
+
+ if ( !ByteString(::rtl::OUStringToOString(aValue,RTL_TEXTENCODING_UTF8)).IsNumericAscii() || (long)aValue.ToInt32() > USHRT_MAX )
+ pEdit->SetText( '0' );
+ return 0;
+}
+
+
+/********************************************************************/
+/********************************************************************/
+/* */
+/* SvxSearchTabPage */
+/* */
+/* */
+/********************************************************************/
+/********************************************************************/
+
+SvxSearchTabPage::SvxSearchTabPage(Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_INET_SEARCH ), rSet ),
+
+ aSearchGB ( this, CUI_RES( GB_SEARCH ) ),
+ aSearchLB ( this, CUI_RES( LB_SEARCH ) ),
+ aSearchNameFT ( this, CUI_RES( FT_SEARCH_NAME ) ),
+ aSearchNameED ( this, CUI_RES( ED_SEARCH_NAME ) ),
+ aSearchFT ( this, CUI_RES( FT_SEARCH ) ),
+ aAndRB ( this, CUI_RES( RB_AND ) ),
+ aOrRB ( this, CUI_RES( RB_OR ) ),
+ aExactRB ( this, CUI_RES( RB_EXACT ) ),
+
+ aURLFT ( this, CUI_RES( FT_URL ) ),
+ aURLED ( this, CUI_RES( ED_URL ) ),
+
+ aPostFixFT ( this, CUI_RES( FT_POSTFIX ) ),
+ aPostFixED ( this, CUI_RES( ED_POSTFIX ) ),
+ aSeparatorFT ( this, CUI_RES( FT_SEPARATOR ) ),
+ aSeparatorED ( this, CUI_RES( ED_SEPARATOR ) ),
+ aCaseFT ( this, CUI_RES( FT_CASE ) ),
+ aCaseED ( this, CUI_RES( ED_CASE ) ),
+
+ aNewPB ( this, CUI_RES( PB_NEW ) ),
+ aAddPB ( this, CUI_RES( PB_ADD ) ),
+ aChangePB ( this, CUI_RES( PB_CHANGE ) ),
+ aDeletePB ( this, CUI_RES( PB_DELETE ) ),
+
+ sModifyMsg(CUI_RES(MSG_MODIFY))
+{
+ FreeResource();
+
+ SetExchangeSupport();
+ aCaseED.SelectEntryPos(0); // falls kein Eintrag vorhanden ist, kann es sonst "Arger geben
+
+ aNewPB.SetClickHdl(LINK( this, SvxSearchTabPage, NewSearchHdl_Impl ) );
+ aAddPB.SetClickHdl(LINK( this, SvxSearchTabPage, AddSearchHdl_Impl ) );
+ aChangePB.SetClickHdl(LINK( this, SvxSearchTabPage, ChangeSearchHdl_Impl ) );
+ aDeletePB.SetClickHdl(LINK( this, SvxSearchTabPage, DeleteSearchHdl_Impl ) );
+ aSearchLB.SetSelectHdl(LINK( this, SvxSearchTabPage, SearchEntryHdl_Impl ) );
+
+ Link aLink = LINK( this, SvxSearchTabPage, SearchModifyHdl_Impl );
+ aSearchNameED.SetModifyHdl( aLink );
+ aURLED.SetModifyHdl( aLink );
+ aSeparatorED.SetModifyHdl( aLink );
+ aPostFixED.SetModifyHdl( aLink );
+ aCaseED.SetSelectHdl( aLink );
+
+ aLink = LINK( this, SvxSearchTabPage, SearchPartHdl_Impl );
+ aAndRB.SetClickHdl( aLink );
+ aOrRB.SetClickHdl( aLink );
+ aExactRB.SetClickHdl( aLink );
+
+ InitControls_Impl();
+}
+
+// -----------------------------------------------------------------------
+SvxSearchTabPage::~SvxSearchTabPage()
+{
+}
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxSearchTabPage::Create(Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new SvxSearchTabPage(pParent, rAttrSet);
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchTabPage::Reset( const SfxItemSet& )
+{
+ //The two lines below are moved here from the last part of this method by BerryJia for fixing Bug102610 Time:2002-8-29 11:00 (China Standard Time GMT+08:00)
+ aChangePB.Disable();
+ aAddPB.Disable();
+
+ sal_uInt16 nCount = aSearchConfig.Count();
+ aSearchLB.Clear(); //add by BerryJia for fixing Bug102610 Time:2002-8-29 11:00 (China Standard Time GMT+08:00)
+ for(sal_uInt16 i = 0; i < nCount; i++)
+ {
+ const SvxSearchEngineData& rData = aSearchConfig.GetData(i);
+ aSearchLB.InsertEntry(rData.sEngineName);
+ }
+
+ if ( nCount )
+ {
+ aSearchLB.SelectEntryPos(0);
+ SearchEntryHdl_Impl( &aSearchLB );
+ }
+ else
+ aDeletePB.Disable();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxSearchTabPage::FillItemSet( SfxItemSet& )
+{
+ if(aSearchConfig.IsModified())
+ aSearchConfig.Commit();
+ return TRUE;
+}
+/*--------------------------------------------------------------------*/
+
+void SvxSearchTabPage::ActivatePage( const SfxItemSet& )
+{
+}
+
+/*--------------------------------------------------------------------*/
+
+int SvxSearchTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ //Modified by BerryJia for fixing Bug102610 Time:2002-8-29 11:00 (China Standard Time GMT+08:00)
+ if(!ConfirmLeave(String()))
+ return KEEP_PAGE;
+
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return LEAVE_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+//add by BerryJia for fixing Bug102610 Time:2002-8-29 11:00 (China Standard Time GMT+08:00)
+BOOL SvxSearchTabPage::ConfirmLeave( const String& rStringSelection)
+{
+ if(aChangePB.IsEnabled())
+ {
+ QueryBox aQuery(this, WB_YES_NO_CANCEL|WB_DEF_YES, sModifyMsg);
+ USHORT nRet = aQuery.Execute();
+ if(RET_CANCEL == nRet)
+ {
+ if(rStringSelection.Len())
+ aSearchLB.SelectEntry(sLastSelectedEntry);
+ return FALSE;
+ }
+ else if(RET_YES == nRet)
+ {
+ USHORT nEntryPos = aSearchLB.GetEntryPos( aSearchNameED.GetText() );
+ if ( nEntryPos != LISTBOX_ENTRY_NOTFOUND )
+ aSearchLB.SelectEntryPos(nEntryPos);
+ else
+ aSearchLB.SetNoSelection();
+ ChangeSearchHdl_Impl(0);
+ if(rStringSelection.Len())
+ aSearchLB.SelectEntry(rStringSelection);
+ }
+ else if(RET_NO == nRet)
+ {
+ aChangePB.Enable(FALSE);
+ aAddPB.Enable(FALSE);
+ SearchEntryHdl_Impl(&aSearchLB);
+ }
+ }
+ if(aAddPB.IsEnabled())
+ {
+ QueryBox aQuery(this, WB_YES_NO_CANCEL|WB_DEF_YES, sModifyMsg);
+ USHORT nRet = aQuery.Execute();
+ if(RET_CANCEL == nRet)
+ {
+ aSearchLB.SetNoSelection();
+ return FALSE;
+ }
+ else if(RET_YES == nRet)
+ {
+ aSearchLB.SetNoSelection();
+ AddSearchHdl_Impl(0);
+ if(rStringSelection.Len())
+ aSearchLB.SelectEntry(rStringSelection);
+ }
+ else if(RET_NO == nRet)
+ {
+ aAddPB.Enable(FALSE);
+ aChangePB.Enable(FALSE);
+ NewSearchHdl_Impl(0);
+ }
+
+ }
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchTabPage::InitControls_Impl()
+{
+ // detect longest label text
+ sal_Int32 i = 0;
+ long nLabelTextWidth = 0;
+ Window* pLabels[] = { &aSearchNameFT, &aSearchFT, &aURLFT, &aPostFixFT, &aSeparatorFT, &aCaseFT };
+ Window** pLabel = pLabels;
+ const sal_Int32 nLabelCount = sizeof( pLabels ) / sizeof( pLabels[0] );
+ for ( ; i < nLabelCount; ++i, ++pLabel )
+ {
+ long nTemp = (*pLabel)->GetCtrlTextWidth( (*pLabel)->GetText() );
+ if ( nTemp > nLabelTextWidth )
+ nLabelTextWidth = nTemp;
+ }
+
+ // resize all labels
+ nLabelTextWidth = nLabelTextWidth * 120 / 100; // additional space looks better
+ const long nLabelWidth = aSearchNameFT.GetSizePixel().Width();
+ const long nDelta = nLabelWidth - nLabelTextWidth;
+ pLabel = pLabels;
+ for ( i = 0; i < nLabelCount; ++i, ++pLabel )
+ {
+ Size aNewSize = (*pLabel)->GetSizePixel();
+ aNewSize.Width() += nDelta;
+ (*pLabel)->SetSizePixel( aNewSize );
+ }
+
+ // resize and move the edits
+ Window* pEdits[] = { &aSearchNameED, &aAndRB, &aOrRB,
+ &aExactRB, &aURLED, &aPostFixED, &aSeparatorED, &aCaseED };
+ Window** pEdit = pEdits;
+ const sal_Int32 nCCount = sizeof( pEdits ) / sizeof( pEdits[ 0 ] );
+ for ( i = 0; i < nCCount; ++i, ++pEdit )
+ {
+ Point aNewPos = (*pEdit)->GetPosPixel();
+ aNewPos.X() -= nDelta;
+ Size aNewSize = (*pEdit)->GetSizePixel();
+ if ( (*pEdit) != &aSeparatorED && (*pEdit) != &aCaseED )
+ aNewSize.Width() += nDelta;
+ (*pEdit)->SetPosSizePixel( aNewPos, aNewSize );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchTabPage, NewSearchHdl_Impl, PushButton *, EMPTYARG )
+{
+ //The 3 lines below is modified by BerryJia for fixing Bug102610 Time:2002-8-29 11:00 (China Standard Time GMT+08:00)
+ SearchEntryHdl_Impl(&aSearchLB);
+ if(aChangePB.IsEnabled() || aAddPB.IsEnabled())
+ return 0;
+ aSearchNameED.SetText( String() );
+ aSearchLB.SetNoSelection();
+ aCurrentSrchData = SvxSearchEngineData();
+ aAndRB.Check( TRUE );
+ SearchEntryHdl_Impl( &aSearchLB );
+ SearchPartHdl_Impl( &aAndRB );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchTabPage, AddSearchHdl_Impl, PushButton *, EMPTYARG )
+{
+ //The following two lines is added by BerryJia for fixing Bug102610 Time:2002-8-29 11:00 (China Standard Time GMT+08:00)
+ aAddPB.Enable(FALSE);
+ aChangePB.Enable(FALSE);
+ aCurrentSrchData.sEngineName = aSearchNameED.GetText();
+ aSearchConfig.SetData(aCurrentSrchData);
+ aSearchLB.InsertEntry( aCurrentSrchData.sEngineName );
+ aSearchLB.SelectEntry( aCurrentSrchData.sEngineName );
+ SearchEntryHdl_Impl( &aSearchLB );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchTabPage, ChangeSearchHdl_Impl, PushButton *, EMPTYARG )
+{
+ //The following two lines is added by BerryJia for fixing Bug102610 Time:2002-8-29 11:00 (China Standard Time GMT+08:00)
+ aChangePB.Enable(FALSE);
+ aAddPB.Enable(FALSE);
+ USHORT nPos = aSearchLB.GetSelectEntryPos();
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ String sEngine = aSearchLB.GetSelectEntry();
+ aCurrentSrchData.sEngineName = sEngine;
+ aSearchConfig.SetData(aCurrentSrchData);
+ aSearchLB.SelectEntry(sEngine);
+ SearchEntryHdl_Impl(&aSearchLB);
+ }
+ else
+ {
+ SetUpdateMode(FALSE);
+ String sEntry = aSearchNameED.GetText();
+ // im AddHdl wird sLastSelectedEntry umgesetzt
+ String sTemp(sLastSelectedEntry);
+ AddSearchHdl_Impl(0);
+ aSearchLB.SelectEntry(sTemp);
+ DeleteSearchHdl_Impl(0);
+ aSearchLB.SelectEntry(sEntry);
+ SearchEntryHdl_Impl(&aSearchLB);
+ SetUpdateMode(TRUE);
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchTabPage, DeleteSearchHdl_Impl, PushButton *, EMPTYARG)
+{
+ aChangePB.Enable(FALSE); //add by BerryJia for fixing Bug102610 Time:2002-8-29 11:00 (China Standard Time GMT+08:00)
+ USHORT nPos = aSearchLB.GetSelectEntryPos();
+ DBG_ASSERT(nPos != LISTBOX_ENTRY_NOTFOUND, "kein Eintrag selektiert!");
+ aSearchConfig.RemoveData(aSearchLB.GetSelectEntry());
+ aSearchLB.RemoveEntry(nPos);
+ aSearchLB.SelectEntryPos(0);
+ SearchEntryHdl_Impl(&aSearchLB);
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchTabPage, SearchEntryHdl_Impl, ListBox*, pBox )
+{
+ USHORT nEntryPos = pBox->GetSelectEntryPos();
+ if ( nEntryPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ String sSelection(pBox->GetSelectEntry());
+ //Modified by BerryJia for fixing Bug102610 Time:2002-8-29 11:00 (China Standard Time GMT+08:00)
+ if(!ConfirmLeave(sSelection))
+ return 0;
+
+ const SvxSearchEngineData* pData = aSearchConfig.GetData(sSelection);
+ DBG_ASSERT(pData, "SearchEngine not available");
+ if(pData)
+ {
+ aSearchNameED.SetText(sSelection);
+ sLastSelectedEntry = sSelection;
+ sal_Bool bAnd = aAndRB.IsChecked();
+ sal_Bool bOr = aOrRB.IsChecked();
+
+ aURLED.SetText(bAnd ? pData->sAndPrefix : bOr ? pData->sOrPrefix : pData->sExactPrefix);
+ aSeparatorED.SetText( bAnd ? pData->sAndSeparator : bOr ? pData->sOrSeparator : pData->sExactSeparator);
+ aPostFixED.SetText(bAnd ? pData->sAndSuffix : bOr ? pData->sOrSuffix : pData->sExactSuffix );
+ sal_Int32 nCase = bAnd ? pData->nAndCaseMatch : bOr ? pData->nOrCaseMatch : pData->nExactCaseMatch;
+ aCaseED.SelectEntryPos( (USHORT)nCase );
+ aCurrentSrchData = *pData;
+ }
+ aDeletePB.Enable();
+ }
+ else
+ {
+ aDeletePB.Enable(FALSE);
+ sLastSelectedEntry.Erase();
+ }
+ aChangePB.Enable(FALSE);
+ aAddPB.Enable(FALSE);
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchTabPage, SearchModifyHdl_Impl, SvxNoSpaceEdit*, pEdit )
+{
+ if ( pEdit == &aSearchNameED )
+ {
+ BOOL bTextLen = ( 0 != pEdit->GetText().Len() );
+ BOOL bFound = FALSE;
+ if ( bTextLen )
+ {
+ USHORT nEntryPos = aSearchLB.GetEntryPos( pEdit->GetText() );
+ bFound = ( nEntryPos != LISTBOX_ENTRY_NOTFOUND );
+ if ( bFound )
+ aSearchLB.SelectEntryPos(nEntryPos);
+ else
+ aSearchLB.SetNoSelection();
+ }
+ aChangePB.Enable( sLastSelectedEntry.Len() > 0 );
+ aDeletePB.Enable(bFound);
+ aAddPB.Enable(bTextLen && !bFound);
+ }
+ else
+ {
+ if ( aSearchLB.GetSelectEntryCount() && sLastSelectedEntry.Len() > 0 )
+ aChangePB.Enable();
+
+ if(aAndRB.IsChecked())
+ {
+ aCurrentSrchData.sAndPrefix = aURLED.GetText();
+ aCurrentSrchData.sAndSeparator = aSeparatorED.GetText();
+ aCurrentSrchData.sAndSuffix = aPostFixED.GetText();
+ aCurrentSrchData.nAndCaseMatch = aCaseED.GetSelectEntryPos();
+ }
+ else if(aOrRB.IsChecked())
+ {
+ aCurrentSrchData.sOrPrefix = aURLED.GetText();
+ aCurrentSrchData.sOrSeparator = aSeparatorED.GetText();
+ aCurrentSrchData.sOrSuffix = aPostFixED.GetText();
+ aCurrentSrchData.nOrCaseMatch = aCaseED.GetSelectEntryPos();
+ }
+ else
+ {
+ aCurrentSrchData.sExactPrefix = aURLED.GetText();
+ aCurrentSrchData.sExactSeparator = aSeparatorED.GetText();
+ aCurrentSrchData.sExactSuffix = aPostFixED.GetText();
+ aCurrentSrchData.nExactCaseMatch = aCaseED.GetSelectEntryPos();
+ }
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchTabPage, SearchPartHdl_Impl, RadioButton *, EMPTYARG )
+{
+ sal_Bool bAnd = aAndRB.IsChecked();
+ sal_Bool bOr = aOrRB.IsChecked();
+
+ aURLED.SetText(bAnd ? aCurrentSrchData.sAndPrefix : bOr ? aCurrentSrchData.sOrPrefix : aCurrentSrchData.sExactPrefix);
+ aSeparatorED.SetText( bAnd ? aCurrentSrchData.sAndSeparator : bOr ? aCurrentSrchData.sOrSeparator : aCurrentSrchData.sExactSeparator);
+ aPostFixED.SetText(bAnd ? aCurrentSrchData.sAndSuffix : bOr ? aCurrentSrchData.sOrSuffix : aCurrentSrchData.sExactSuffix );
+ sal_Int32 nCase = bAnd ? aCurrentSrchData.nAndCaseMatch : bOr ? aCurrentSrchData.nOrCaseMatch : aCurrentSrchData.nExactCaseMatch;
+ aCaseED.SelectEntryPos( (USHORT)nCase );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+/********************************************************************/
+/********************************************************************/
+/* */
+/* SvxOtherTabPage */
+/* */
+/********************************************************************/
+/********************************************************************/
+
+/*-----------------15.05.97 09:51-------------------
+
+--------------------------------------------------*/
+/*
+SvxPatternField::SvxPatternField( Window* pParent, const ResId& rResId ) :
+
+ PatternField( pParent, rResId ),
+
+ sMsg233 ( ResId( ST_MSG_233 ) ),
+ sMsg255 ( ResId( ST_MSG_255 ) )
+
+{
+ FreeResource();
+ SelectFixedFont();
+} */
+
+/*-----------------15.05.97 09:51-------------------
+
+--------------------------------------------------*/
+
+/*void SvxPatternField::KeyInput( const KeyEvent& rKEvt )
+{
+ PatternField::KeyInput( rKEvt );
+ BOOL bDelete = ( rKEvt.GetKeyCode().GetCode() == KEY_DELETE );
+ String sEntry( GetText() );
+ sEntry[(USHORT)3] = '.';
+ sEntry[(USHORT)7] = '.';
+ sEntry[(USHORT)11] = '.';
+ Selection aSelection( GetSelection() );
+ String sPart( sEntry.GetToken( 0, '.' ) );
+ USHORT i, nPart( sPart.EraseLeadingChars() );
+ BOOL bSet = FALSE;
+
+ if ( sPart.Len() && ( !nPart || nPart > 255 ) )
+ {
+ // der erste Part darf nicht 0 und nicht gr"osser 255 sein
+ String sMsg( sPart );
+ sMsg += ' ';
+ sMsg += sMsg233;
+ InfoBox( this, sMsg ).Execute();
+
+ if ( nPart == 0 )
+ sPart = " 1";
+ else
+ sPart = "255";
+ sEntry.SetToken( 0, '.', sPart );
+ bSet = TRUE;
+ };
+
+ for ( i = 1; i < 4; i++ )
+ {
+ // die anderen Parts d"urfen nicht gr"osser 255 sein
+ sPart = sEntry.GetToken( i, '.' );
+ nPart = sPart.EraseLeadingChars();
+
+ if ( nPart > 255 )
+ {
+ String sMsg( sPart );
+ sMsg += ' ';
+ sMsg += sMsg255;
+ InfoBox( this, sMsg ).Execute();
+
+ if ( nPart == 0 )
+ sPart = " 1";
+ else
+ sPart = "255";
+ sEntry.SetToken( i, '.', sPart );
+ bSet = TRUE;
+ };
+ }
+
+ if ( bSet )
+ {
+ SetText( sEntry );
+ SetSelection( aSelection );
+ }
+}
+*/
+// -----------------------------------------------------------------------
+#if 0
+long SvxPatternField::Notify( NotifyEvent& rNEvt )
+{
+ return PatternField::Notify( rNEvt );
+/*! long nHandled = 0;
+
+ if ( rNEvt.GetType() == EVENT_KEYUP )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ KeyInput( *pKEvt );
+ nHandled = 1;
+ }
+ return nHandled;*/
+}
+#endif
+
+// class JavaScriptDisableQueryBox_Impl --------------------------------------
+
+class JavaScriptDisableQueryBox_Impl : public ModalDialog
+{
+private:
+ FixedImage aImage;
+ FixedText aWarningFT;
+ CheckBox aDisableCB;
+ OKButton aYesBtn;
+ CancelButton aNoBtn;
+
+public:
+ JavaScriptDisableQueryBox_Impl( Window* pParent );
+
+ BOOL IsWarningDisabled() const { return aDisableCB.IsChecked(); }
+};
+
+JavaScriptDisableQueryBox_Impl::JavaScriptDisableQueryBox_Impl( Window* pParent ) :
+
+ ModalDialog( pParent, CUI_RES( RID_SVXDLG_OPT_JAVASCRIPT_DISABLE ) ),
+
+ aImage ( this, CUI_RES( IMG_JSCPT_WARNING ) ),
+ aWarningFT ( this, CUI_RES( FT_JSCPT_WARNING ) ),
+ aDisableCB ( this, CUI_RES( CB_JSCPT_DISABLE ) ),
+ aYesBtn ( this, CUI_RES( BTN_JSCPT_YES ) ),
+ aNoBtn ( this, CUI_RES( BTN_JSCPT_NO ) )
+
+{
+ FreeResource();
+
+ aYesBtn.SetText( Button::GetStandardText( BUTTON_YES ) );
+ aNoBtn.SetText( Button::GetStandardText( BUTTON_NO ) );
+ aImage.SetImage( WarningBox::GetStandardImage() );
+}
+
+//#98647#----------------------------------------------
+void SvxScriptExecListBox::RequestHelp( const HelpEvent& rHEvt )
+{ // try to show tips just like as on toolbars
+ USHORT nPos=LISTBOX_ENTRY_NOTFOUND;
+ USHORT nTop = GetTopEntry();
+ USHORT nCount = GetDisplayLineCount(); // Attention: Not GetLineCount()
+ Point aPt = ScreenToOutputPixel( rHEvt.GetMousePosPixel() );
+ Rectangle aItemRect;
+ if( nCount > 0 ) // if there're some entries, find it.
+ for( nPos = nTop ; nPos <= nTop+nCount-1 ; nPos++ ) {
+ aItemRect = GetBoundingRectangle(nPos);
+ if( aPt.Y() < aItemRect.Top() || aPt.Y() > aItemRect.Bottom() )
+ continue;
+ else
+ break;
+ }
+ else // if not, nothing happens.
+ return;
+ String aHelpText;
+ if( nPos <= nTop+nCount-1 ) // if find the matching entry, get its content.
+ aHelpText = GetEntry(nPos);
+ if( aHelpText.Len() && GetTextWidth(aHelpText)<GetOutputSizePixel().Width() )
+ aHelpText.Erase(); // if the entry is quite short, clear the helping tip content.
+ aItemRect = Rectangle(Point(0,0),GetSizePixel());
+ aPt = Point(OutputToScreenPixel( aItemRect.TopLeft() ));
+ aItemRect.Left() = aPt.X();
+ aItemRect.Top() = aPt.Y();
+ aPt = OutputToScreenPixel( aItemRect.BottomRight() );
+ aItemRect.Right() = aPt.X();
+ aItemRect.Bottom() = aPt.Y();
+ if( rHEvt.GetMode() == HELPMODE_BALLOON )
+ Help::ShowBalloon( this, aItemRect.Center(), aItemRect, aHelpText);
+ else
+ Help::ShowQuickHelp( this, aItemRect, aHelpText );
+}
+
+/********************************************************************/
+/* */
+/* SvxSecurityTabPage */
+/* */
+/********************************************************************/
+
+SvxSecurityTabPage::SvxSecurityTabPage( Window* pParent, const SfxItemSet& rSet )
+ :SfxTabPage ( pParent, CUI_RES( RID_SVXPAGE_INET_SECURITY ), rSet )
+
+ ,maSecurityOptionsFL( this, CUI_RES( FL_SEC_SECURITYOPTIONS ) )
+ ,maSecurityOptionsFI( this, CUI_RES( FI_SEC_SECURITYOPTIONS ) )
+ ,maSecurityOptionsPB( this, CUI_RES( PB_SEC_SECURITYOPTIONS ) )
+
+ ,maPasswordsFL ( this, CUI_RES( FL_SEC_PASSWORDS ) )
+ ,maSavePasswordsCB ( this, CUI_RES( CB_SEC_SAVEPASSWORDS ) )
+ ,maShowConnectionsPB( this, CUI_RES( PB_SEC_CONNECTIONS ) )
+ ,maMasterPasswordCB ( this, CUI_RES( CB_SEC_MASTERPASSWORD ) )
+ ,maMasterPasswordFI ( this, CUI_RES( FI_SEC_MASTERPASSWORD ) )
+ ,maMasterPasswordPB ( this, CUI_RES( PB_SEC_MASTERPASSWORD ) )
+
+ ,maMacroSecFL ( this, CUI_RES( FL_SEC_MACROSEC ) )
+ ,maMacroSecFI ( this, CUI_RES( FI_SEC_MACROSEC ) )
+ ,maMacroSecPB ( this, CUI_RES( PB_SEC_MACROSEC ) )
+ ,maFilesharingFL ( this, CUI_RES( FL_SEC_FILESHARING ) )
+ ,maRecommReadOnlyCB ( this, CUI_RES( CB_SEC_RECOMMREADONLY ) )
+ ,maRecordChangesCB ( this, CUI_RES( CB_SEC_RECORDCHANGES ) )
+ ,maProtectRecordsPB ( this, CUI_RES( PB_SEC_PROTRECORDS ) )
+
+ ,mpSecOptions ( new SvtSecurityOptions )
+ ,mpSecOptDlg ( NULL )
+ ,meRedlingMode ( RL_NONE )
+
+ ,msProtectRecordsStr( CUI_RES( STR_SEC_PROTRECORDS ) )
+ ,msUnprotectRecordsStr( CUI_RES( STR_SEC_UNPROTRECORDS ) )
+ ,msPasswordStoringDeactivateStr( CUI_RES( STR_SEC_NOPASSWDSAVE ) )
+
+{
+ FreeResource();
+
+ InitControls();
+
+ maSecurityOptionsPB.SetClickHdl( LINK( this, SvxSecurityTabPage, SecurityOptionsHdl ) );
+ maSavePasswordsCB.SetClickHdl( LINK( this, SvxSecurityTabPage, SavePasswordHdl ) );
+ maMasterPasswordPB.SetClickHdl( LINK( this, SvxSecurityTabPage, MasterPasswordHdl ) );
+ maMasterPasswordCB.SetClickHdl( LINK( this, SvxSecurityTabPage, MasterPasswordCBHdl ) );
+ maShowConnectionsPB.SetClickHdl( LINK( this, SvxSecurityTabPage, ShowPasswordsHdl ) );
+ maMacroSecPB.SetClickHdl( LINK( this, SvxSecurityTabPage, MacroSecPBHdl ) );
+ maProtectRecordsPB.SetClickHdl( LINK( this, SvxSecurityTabPage, ProtectRecordsPBHdl ) );
+ maRecordChangesCB.SetClickHdl( LINK( this, SvxSecurityTabPage, RecordChangesCBHdl ) );
+
+ ActivatePage( rSet );
+}
+
+SvxSecurityTabPage::~SvxSecurityTabPage()
+{
+ delete mpSecOptions;
+ delete mpSecOptDlg;
+}
+
+IMPL_LINK( SvxSecurityTabPage, SecurityOptionsHdl, PushButton*, EMPTYARG )
+{
+ if ( !mpSecOptDlg )
+ mpSecOptDlg = new svx::SecurityOptionsDialog( this, mpSecOptions );
+ mpSecOptDlg->Execute();
+ return 0;
+}
+
+IMPL_LINK( SvxSecurityTabPage, SavePasswordHdl, void*, EMPTYARG )
+{
+ try
+ {
+ Reference< task::XMasterPasswordHandling > xMasterPasswd(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ),
+ UNO_QUERY_THROW );
+
+ if ( maSavePasswordsCB.IsChecked() )
+ {
+ sal_Bool bOldValue = xMasterPasswd->allowPersistentStoring( sal_True );
+ xMasterPasswd->removeMasterPassword();
+ if ( xMasterPasswd->changeMasterPassword( Reference< task::XInteractionHandler >() ) )
+ {
+ maMasterPasswordPB.Enable( TRUE );
+ maMasterPasswordCB.Check( TRUE );
+ maMasterPasswordCB.Enable( TRUE );
+ maMasterPasswordFI.Enable( TRUE );
+ maShowConnectionsPB.Enable( TRUE );
+ }
+ else
+ {
+ xMasterPasswd->allowPersistentStoring( bOldValue );
+ maSavePasswordsCB.Check( FALSE );
+ }
+ }
+ else
+ {
+ QueryBox aQuery( this, WB_YES_NO|WB_DEF_NO, msPasswordStoringDeactivateStr );
+ USHORT nRet = aQuery.Execute();
+
+ if( RET_YES == nRet )
+ {
+ xMasterPasswd->allowPersistentStoring( sal_False );
+ maMasterPasswordCB.Check( TRUE );
+ maMasterPasswordPB.Enable( FALSE );
+ maMasterPasswordCB.Enable( FALSE );
+ maMasterPasswordFI.Enable( FALSE );
+ maShowConnectionsPB.Enable( FALSE );
+ }
+ else
+ {
+ maSavePasswordsCB.Check( TRUE );
+ maMasterPasswordPB.Enable( TRUE );
+ maShowConnectionsPB.Enable( TRUE );
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ maSavePasswordsCB.Check( !maSavePasswordsCB.IsChecked() );
+ }
+
+ return 0;
+}
+
+IMPL_LINK( SvxSecurityTabPage, MasterPasswordHdl, PushButton*, EMPTYARG )
+{
+ try
+ {
+ Reference< task::XMasterPasswordHandling > xMasterPasswd(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ),
+ UNO_QUERY );
+
+ if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() )
+ xMasterPasswd->changeMasterPassword( Reference< task::XInteractionHandler >() );
+ }
+ catch( Exception& )
+ {}
+
+ return 0;
+}
+
+IMPL_LINK( SvxSecurityTabPage, MasterPasswordCBHdl, void*, EMPTYARG )
+{
+ try
+ {
+ Reference< task::XMasterPasswordHandling2 > xMasterPasswd(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ),
+ UNO_QUERY_THROW );
+
+ if ( maMasterPasswordCB.IsChecked() )
+ {
+ if ( xMasterPasswd->isPersistentStoringAllowed() && xMasterPasswd->changeMasterPassword( Reference< task::XInteractionHandler >() ) )
+ {
+ maMasterPasswordPB.Enable( TRUE );
+ maMasterPasswordFI.Enable( TRUE );
+ }
+ else
+ {
+ maMasterPasswordCB.Check( FALSE );
+ maMasterPasswordPB.Enable( TRUE );
+ maMasterPasswordFI.Enable( TRUE );
+ }
+ }
+ else
+ {
+ if ( xMasterPasswd->isPersistentStoringAllowed() && xMasterPasswd->useDefaultMasterPassword( Reference< task::XInteractionHandler >() ) )
+ {
+ maMasterPasswordPB.Enable( FALSE );
+ maMasterPasswordFI.Enable( FALSE );
+ }
+ else
+ {
+ maMasterPasswordCB.Check( TRUE );
+ maMasterPasswordPB.Enable( TRUE );
+ maShowConnectionsPB.Enable( TRUE );
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ maSavePasswordsCB.Check( !maSavePasswordsCB.IsChecked() );
+ }
+
+ return 0;
+}
+
+IMPL_LINK( SvxSecurityTabPage, ShowPasswordsHdl, PushButton*, EMPTYARG )
+{
+ try
+ {
+ Reference< task::XMasterPasswordHandling > xMasterPasswd(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ),
+ UNO_QUERY );
+
+ if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() && xMasterPasswd->authorizateWithMasterPassword( Reference< task::XInteractionHandler>() ) )
+ {
+ svx::WebConnectionInfoDialog aDlg( this );
+ aDlg.Execute();
+ }
+ }
+ catch( Exception& )
+ {}
+ return 0;
+}
+
+IMPL_LINK( SvxSecurityTabPage, MacroSecPBHdl, void*, EMPTYARG )
+{
+ Reference< security::XDocumentDigitalSignatures > xD(
+ comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ) ), UNO_QUERY );
+ if ( xD.is() )
+ xD->manageTrustedSources();
+
+ return 0;
+}
+
+namespace
+{
+ enum RedlineFunc { RF_ON, RF_PROTECT };
+
+ const SfxBoolItem* ExecuteRecordChangesFunc( SvxSecurityTabPage::RedliningMode _eMode, RedlineFunc _eFunc, BOOL _bVal, Window* _pParent = NULL )
+ {
+ const SfxBoolItem* pRet = NULL;
+
+ if( _eMode != SvxSecurityTabPage::RL_NONE )
+ {
+ USHORT nSlot;
+ if ( _eMode == SvxSecurityTabPage::RL_WRITER )
+ nSlot = ( _eFunc == RF_ON )? FN_REDLINE_ON : FN_REDLINE_PROTECT;
+ else
+ nSlot = ( _eFunc == RF_ON )? FID_CHG_RECORD : SID_CHG_PROTECT;
+
+ // execute
+ SfxViewShell* pViewSh = SfxViewShell::Current();
+ if( pViewSh )
+ {
+ bool bNeedItem = ( _eMode == SvxSecurityTabPage::RL_WRITER || _eFunc != RF_ON );
+ SfxBoolItem* pItem = bNeedItem ? new SfxBoolItem( nSlot, _bVal ) : NULL;
+ SfxDispatcher* pDisp = pViewSh->GetDispatcher();
+ if ( _pParent )
+ {
+ OfaPtrItem aParentItem( SID_ATTR_PARENTWINDOW, _pParent );
+ pRet = static_cast< const SfxBoolItem* >(
+ pDisp->Execute( nSlot, SFX_CALLMODE_SYNCHRON, &aParentItem, pItem, 0L ) );
+ }
+ else
+ pRet = static_cast< const SfxBoolItem* >(
+ pDisp->Execute( nSlot, SFX_CALLMODE_SYNCHRON, pItem, 0L ) );
+ delete pItem;
+ }
+ }
+
+ return pRet;
+ }
+
+ bool QueryState( USHORT _nSlot, bool& _rValue )
+ {
+ bool bRet = false;
+
+ SfxViewShell* pViewSh = SfxViewShell::Current();
+ if( pViewSh )
+ {
+ const SfxPoolItem* pItem;
+ SfxDispatcher* pDisp = pViewSh->GetDispatcher();
+ bRet = SFX_ITEM_AVAILABLE <= pDisp->QueryState( _nSlot, pItem );
+ if( bRet )
+ _rValue = ( static_cast< const SfxBoolItem* >( pItem ) )->GetValue();
+ }
+
+ return bRet;
+ }
+
+ bool QueryRecordChangesProtectionState( SvxSecurityTabPage::RedliningMode _eMode, bool& _rValue )
+ {
+ bool bRet = false;
+
+ if( _eMode != SvxSecurityTabPage::RL_NONE )
+ {
+ USHORT nSlot = ( _eMode == SvxSecurityTabPage::RL_WRITER )? FN_REDLINE_PROTECT : SID_CHG_PROTECT;
+ bRet = QueryState( nSlot, _rValue );
+ }
+
+ return bRet;
+ }
+
+ bool QueryRecordChangesState( SvxSecurityTabPage::RedliningMode _eMode, bool& _rValue )
+ {
+ bool bRet = false;
+
+ if( _eMode != SvxSecurityTabPage::RL_NONE )
+ {
+ USHORT nSlot = ( _eMode == SvxSecurityTabPage::RL_WRITER )? FN_REDLINE_ON : FID_CHG_RECORD;
+ bRet = QueryState( nSlot, _rValue );
+ }
+
+ return bRet;
+ }
+}
+
+IMPL_LINK( SvxSecurityTabPage, RecordChangesCBHdl, void*, EMPTYARG )
+{
+ ExecuteRecordChangesFunc( meRedlingMode, RF_ON, maRecordChangesCB.IsChecked(), this );
+ CheckRecordChangesState();
+ return 0;
+}
+
+IMPL_LINK( SvxSecurityTabPage, ProtectRecordsPBHdl, void*, EMPTYARG )
+{
+ bool bProt;
+ QueryRecordChangesProtectionState( meRedlingMode, bProt );
+ ExecuteRecordChangesFunc( meRedlingMode, RF_PROTECT, !bProt, this );
+ CheckRecordChangesState();
+
+ if ( QueryRecordChangesProtectionState( meRedlingMode, bProt ) )
+ {
+ // RecordChangesCB is enabled if protection is off
+ maRecordChangesCB.Enable( !bProt );
+ // toggle text of button "Protect" <-> "Unprotect"
+ String sNewText = bProt ? msUnprotectRecordsStr : msProtectRecordsStr;
+ maProtectRecordsPB.SetText( sNewText );
+ }
+ return 0;
+}
+
+void SvxSecurityTabPage::CheckRecordChangesState( void )
+{
+ bool bVal;
+ if( QueryRecordChangesState( meRedlingMode, bVal ) )
+ {
+ maRecordChangesCB.Enable();
+ maRecordChangesCB.Check( bVal );
+ }
+ else
+ maRecordChangesCB.Disable(); // because now we don't know the state!
+
+ maProtectRecordsPB.Enable( QueryRecordChangesProtectionState( meRedlingMode, bVal ) );
+}
+
+void SvxSecurityTabPage::InitControls()
+{
+ // Hide all controls which belong to the macro security button in case the macro
+ // security settings managed by the macro security dialog opened via the button
+ // are all readonly or if the macros are disabled in general.
+ // @@@ Better would be to query the dialog whether it is 'useful' or not. Exposing
+ // macro security dialog implementations here, which is bad.
+ if ( mpSecOptions->IsMacroDisabled()
+ || ( mpSecOptions->IsReadOnly( SvtSecurityOptions::E_MACRO_SECLEVEL )
+ && mpSecOptions->IsReadOnly( SvtSecurityOptions::E_MACRO_TRUSTEDAUTHORS )
+ && mpSecOptions->IsReadOnly( SvtSecurityOptions::E_SECUREURLS ) ) )
+ {
+ maMacroSecFL.Hide();
+ maMacroSecFI.Hide();
+ maMacroSecPB.Hide();
+
+ // rearrange the following controls
+ Point aNewPos = maFilesharingFL.GetPosPixel();
+ long nDelta = aNewPos.Y() - maMacroSecFL.GetPosPixel().Y();
+
+ Window* pWins[] =
+ {
+ &maFilesharingFL, &maRecommReadOnlyCB, &maRecordChangesCB, &maProtectRecordsPB
+ };
+ Window** pCurrent = pWins;
+ const sal_Int32 nCount = sizeof( pWins ) / sizeof( pWins[ 0 ] );
+ for ( sal_Int32 i = 0; i < nCount; ++i, ++pCurrent )
+ {
+ aNewPos = (*pCurrent)->GetPosPixel();
+ aNewPos.Y() -= nDelta;
+ (*pCurrent)->SetPosPixel( aNewPos );
+ }
+ }
+
+ // one button too small for its text?
+ sal_Int32 i = 0;
+ long nBtnTextWidth = 0;
+ Window* pButtons[] = { &maSecurityOptionsPB, &maMasterPasswordPB,
+ &maShowConnectionsPB, &maMacroSecPB, &maProtectRecordsPB };
+ Window** pButton = pButtons;
+ const sal_Int32 nBCount = sizeof( pButtons ) / sizeof( pButtons[ 0 ] );
+ for ( ; i < nBCount; ++i, ++pButton )
+ {
+ long nTemp = (*pButton)->GetCtrlTextWidth( (*pButton)->GetText() );
+ if ( nTemp > nBtnTextWidth )
+ nBtnTextWidth = nTemp;
+ }
+
+ nBtnTextWidth = nBtnTextWidth * 115 / 100; // a little offset
+ const long nButtonWidth = maSecurityOptionsPB.GetSizePixel().Width();
+ const long nMaxWidth = nButtonWidth * 140 / 100;
+ long nExtra = ( nBtnTextWidth > nMaxWidth ) ? nBtnTextWidth - nMaxWidth : 0;
+ nBtnTextWidth = std::min( nBtnTextWidth, nMaxWidth );
+
+ if ( nBtnTextWidth > nButtonWidth )
+ {
+ // so make the buttons broader and its control in front of it smaller
+ long nDelta = nBtnTextWidth - nButtonWidth;
+ pButton = pButtons;
+
+ if ( nExtra > 0 )
+ {
+ long nPos = (*pButton)->GetPosPixel().X() - nDelta;
+ long nWidth = (*pButton)->GetSizePixel().Width() + nDelta;
+ long nMaxExtra = GetOutputSizePixel().Width() - ( nPos + nWidth ) - 2;
+ nExtra = ( nExtra < nMaxExtra ) ? nExtra : nMaxExtra;
+ }
+
+ for ( i = 0; i < nBCount; ++i, ++pButton )
+ {
+ Point aNewPos = (*pButton)->GetPosPixel();
+ aNewPos.X() -= nDelta;
+ Size aNewSize = (*pButton)->GetSizePixel();
+ aNewSize.Width() += ( nDelta + nExtra );
+ (*pButton)->SetPosSizePixel( aNewPos, aNewSize );
+ }
+
+ Window* pControls[] = { &maSecurityOptionsFI, &maSavePasswordsCB,
+ &maMasterPasswordFI, &maMacroSecFI,
+ &maRecommReadOnlyCB, &maRecordChangesCB };
+ Window** pControl = pControls;
+ const sal_Int32 nCCount = sizeof( pControls ) / sizeof( pControls[ 0 ] );
+ for ( i = 0; i < nCCount; ++i, ++pControl )
+ {
+ Size aNewSize = (*pControl)->GetSizePixel();
+ aNewSize.Width() -= nDelta;
+ (*pControl)->SetSizePixel( aNewSize );
+ }
+ }
+
+ maMasterPasswordPB.Enable( FALSE );
+ maMasterPasswordCB.Enable( FALSE );
+ maMasterPasswordCB.Check( TRUE );
+ maMasterPasswordFI.Enable( FALSE );
+ maShowConnectionsPB.Enable( FALSE );
+
+ // initialize the password saving checkbox
+ try
+ {
+ Reference< task::XMasterPasswordHandling > xMasterPasswd(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ),
+ UNO_QUERY_THROW );
+
+ if ( xMasterPasswd->isPersistentStoringAllowed() )
+ {
+ maMasterPasswordCB.Enable( TRUE );
+ maShowConnectionsPB.Enable( TRUE );
+ maSavePasswordsCB.Check( TRUE );
+
+ Reference< task::XMasterPasswordHandling2 > xMasterPasswd2( xMasterPasswd, UNO_QUERY );
+ if ( xMasterPasswd2.is() && xMasterPasswd2->isDefaultMasterPasswordUsed() )
+ maMasterPasswordCB.Check( FALSE );
+ else
+ {
+ maMasterPasswordPB.Enable( TRUE );
+ maMasterPasswordCB.Check( TRUE );
+ maMasterPasswordFI.Enable( TRUE );
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ maSavePasswordsCB.Enable( FALSE );
+ }
+
+
+}
+
+SfxTabPage* SvxSecurityTabPage::Create(Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new SvxSecurityTabPage(pParent, rAttrSet);
+}
+
+void SvxSecurityTabPage::ActivatePage( const SfxItemSet& )
+{
+}
+
+int SvxSecurityTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if( _pSet )
+ FillItemSet( *_pSet );
+ return LEAVE_PAGE;
+}
+
+namespace
+{
+/* bool Enable( const SvtSecurityOptions& _rOpt, SvtSecurityOptions::EOption _eOpt, Control& _rCtrl, FixedImage& _rImg )
+ {
+ bool b = _rOpt.IsOptionEnabled( _eOpt );
+ _rCtrl.Enable( b );
+ _Img.Show( !b );
+ return b;
+ }
+*/
+ bool EnableAndSet( const SvtSecurityOptions& _rOpt, SvtSecurityOptions::EOption _eOpt,
+ CheckBox& _rCtrl, FixedImage& _rImg )
+ {
+// bool b = Enable( _rOpt, _eOpt, _rCtrl, _rImg );
+ bool b = _rOpt.IsOptionEnabled( _eOpt );
+ _rCtrl.Enable( b );
+ _rImg.Show( !b );
+ _rCtrl.Check( _rOpt.IsOptionSet( _eOpt ) );
+ return b;
+ }
+
+ bool CheckAndSave( SvtSecurityOptions& _rOpt, SvtSecurityOptions::EOption _eOpt, const bool _bIsChecked, bool& _rModfied )
+ {
+ bool bModified = false;
+ if ( _rOpt.IsOptionEnabled( _eOpt ) )
+ {
+ bModified = _rOpt.IsOptionSet( _eOpt ) != _bIsChecked;
+ if ( bModified )
+ {
+ _rOpt.SetOption( _eOpt, _bIsChecked );
+ _rModfied = true;
+ }
+ }
+
+ return bModified;
+ }
+}
+
+BOOL SvxSecurityTabPage::FillItemSet( SfxItemSet& )
+{
+ bool bModified = false;
+
+ if ( mpSecOptDlg )
+ {
+ CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_DOCWARN_SAVEORSEND, mpSecOptDlg->IsSaveOrSendDocsChecked(), bModified );
+ CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_DOCWARN_SIGNING, mpSecOptDlg->IsSignDocsChecked(), bModified );
+ CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_DOCWARN_PRINT, mpSecOptDlg->IsPrintDocsChecked(), bModified );
+ CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_DOCWARN_CREATEPDF, mpSecOptDlg->IsCreatePdfChecked(), bModified );
+ CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_DOCWARN_REMOVEPERSONALINFO, mpSecOptDlg->IsRemovePersInfoChecked(), bModified );
+ CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD, mpSecOptDlg->IsRecommPasswdChecked(), bModified );
+ CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_CTRLCLICK_HYPERLINK, mpSecOptDlg->IsCtrlHyperlinkChecked(), bModified );
+ }
+
+ // document options
+ SfxObjectShell* pCurDocShell = SfxObjectShell::Current();
+ if( pCurDocShell )
+ {
+ if( pCurDocShell->HasSecurityOptOpenReadOnly() )
+ pCurDocShell->SetSecurityOptOpenReadOnly( maRecommReadOnlyCB.IsChecked() );
+
+ }
+
+ return bModified;
+}
+
+/*--------------------------------------------------------------------*/
+
+void SvxSecurityTabPage::Reset( const SfxItemSet& )
+{
+ String sNewText = msProtectRecordsStr;
+ SfxObjectShell* pCurDocShell = SfxObjectShell::Current();
+ if( pCurDocShell )
+ {
+ bool bIsHTMLDoc = false;
+ SfxViewShell* pViewSh = SfxViewShell::Current();
+ if( pViewSh )
+ {
+ const SfxPoolItem* pItem;
+ SfxDispatcher* pDisp = pViewSh->GetDispatcher();
+ if ( SFX_ITEM_AVAILABLE <= pDisp->QueryState( SID_HTML_MODE, pItem ) )
+ {
+ USHORT nMode = static_cast< const SfxUInt16Item* >( pItem )->GetValue();
+ bIsHTMLDoc = ( ( nMode & HTMLMODE_ON ) != 0 );
+ }
+ }
+
+ sal_Bool bIsReadonly = pCurDocShell->IsReadOnly();
+ if( pCurDocShell->HasSecurityOptOpenReadOnly() && !bIsHTMLDoc )
+ {
+ maRecommReadOnlyCB.Check( pCurDocShell->IsSecurityOptOpenReadOnly() );
+ maRecommReadOnlyCB.Enable( !bIsReadonly );
+ }
+ else
+ maRecommReadOnlyCB.Disable();
+
+ bool bVal;
+ if ( QueryRecordChangesState( RL_WRITER, bVal ) && !bIsHTMLDoc )
+ meRedlingMode = RL_WRITER;
+ else if( QueryRecordChangesState( RL_CALC, bVal ) )
+ meRedlingMode = RL_CALC;
+ else
+ meRedlingMode = RL_NONE;
+
+ if ( meRedlingMode != RL_NONE )
+ {
+ maRecordChangesCB.Check( bVal );
+ maRecordChangesCB.Enable( !bVal && !bIsReadonly );
+ maProtectRecordsPB.Enable(
+ QueryRecordChangesProtectionState( meRedlingMode, bVal ) && !bIsReadonly );
+ // set the right text
+ if ( bVal )
+ sNewText = msUnprotectRecordsStr;
+ }
+ else
+ {
+ // only Writer and Calc support redlining
+ maRecordChangesCB.Disable();
+ maProtectRecordsPB.Disable();
+ }
+ }
+ else
+ { // no doc -> hide document settings
+ maRecommReadOnlyCB.Disable();
+ maRecordChangesCB.Disable();
+ maProtectRecordsPB.Disable();
+ }
+
+ maProtectRecordsPB.SetText( sNewText );
+}
+
+//added by jmeng begin
+MozPluginTabPage::MozPluginTabPage(Window* pParent, const SfxItemSet& rSet)
+ : SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_INET_MOZPLUGIN ), rSet ),
+ aMSWordGB ( this, CUI_RES( GB_MOZPLUGIN ) ),
+ aWBasicCodeCB ( this, CUI_RES( CB_MOZPLUGIN_CODE ) )
+{
+ FreeResource();
+}
+
+MozPluginTabPage::~MozPluginTabPage()
+{
+}
+
+SfxTabPage* MozPluginTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return new MozPluginTabPage( pParent, rAttrSet );
+}
+BOOL MozPluginTabPage::FillItemSet( SfxItemSet& )
+{
+ BOOL hasInstall = isInstalled();
+ BOOL hasChecked = aWBasicCodeCB.IsChecked();
+ if(hasInstall && (!hasChecked)){
+ //try to uninstall
+ uninstallPlugin();
+ }
+ else if((!hasInstall) && hasChecked){
+ //try to install
+ installPlugin();
+ }
+ else{
+ // do nothing
+ }
+ return TRUE;
+}
+void MozPluginTabPage::Reset( const SfxItemSet& )
+{
+ aWBasicCodeCB.Check( isInstalled());
+ aWBasicCodeCB.SaveValue();
+}
+
+#ifdef WNT
+extern "C" {
+ int lc_isInstalled(const char* realFilePath);
+ int lc_installPlugin(const char* realFilePath);
+ int lc_uninstallPlugin(const char* realFilePath);
+}
+#endif
+
+#define NPP_PATH_MAX 2048
+inline bool getDllURL(rtl::OString * path)
+{
+ OSL_ASSERT(path != NULL);
+ ::rtl::OUString dirPath/*dllPath, */;
+ if (osl_getExecutableFile(&dirPath.pData) != osl_Process_E_None) {
+ return false;
+ }
+ dirPath = dirPath.copy(0, dirPath.lastIndexOf('/'));
+// osl::FileBase::getAbsoluteFileURL(dirPath, libPath, dllPath);
+ ::rtl::OUString sysDirPath;
+ osl::FileBase::getSystemPathFromFileURL(dirPath, sysDirPath);
+ *path = OUStringToOString(sysDirPath, RTL_TEXTENCODING_ASCII_US);
+ return true;
+}
+
+BOOL MozPluginTabPage::isInstalled()
+{
+#ifdef UNIX
+ // get the real file referred by .so lnk file
+ char lnkFilePath[NPP_PATH_MAX] = {0};
+ char lnkReferFilePath[NPP_PATH_MAX] = {0};
+ char* pHome = getpwuid(getuid())->pw_dir;
+ strcat(lnkFilePath, pHome);
+ strcat(lnkFilePath, "/.mozilla/plugins/libnpsoplugin" SAL_DLLEXTENSION);
+
+ struct stat sBuf;
+ if (0 > lstat(lnkFilePath, &sBuf))
+ return false;
+ if (!S_ISLNK(sBuf.st_mode))
+ return false;
+ if (0 >= readlink(lnkFilePath, lnkReferFilePath, NPP_PATH_MAX))
+ return false;
+ // If the link is relative, then we regard it as non-standard
+ if (lnkReferFilePath[0] != '/')
+ return false;
+
+ // get the real file path
+ char realFilePath[NPP_PATH_MAX] = {0};
+ ::rtl::OString tempString;
+ if (!getDllURL(&tempString)) {
+ return false;
+ }
+ strncpy(realFilePath, tempString.getStr(), NPP_PATH_MAX);
+ strcat(realFilePath, "/libnpsoplugin" SAL_DLLEXTENSION);
+
+ if (0 != strcmp(lnkReferFilePath, realFilePath))
+ return false;
+ return true;
+#endif
+#ifdef WNT
+ // get the value from registry
+ BOOL ret = true;
+ ::rtl::OString tempString;
+ char realFilePath[NPP_PATH_MAX] = {0};
+ if (!getDllURL(&tempString)){
+ return false;
+ }
+ strncpy(realFilePath, tempString.getStr(), NPP_PATH_MAX);
+ if(! lc_isInstalled(realFilePath))
+ ret =true;
+ else
+ ret = false;
+ return ret;
+#endif
+}
+
+BOOL MozPluginTabPage::installPlugin()
+{
+#ifdef UNIX
+ // get the real file referred by .so lnk file
+ char lnkFilePath[NPP_PATH_MAX] = {0};
+ char* pHome = getpwuid(getuid())->pw_dir;
+ strcat(lnkFilePath, pHome);
+ strcat(lnkFilePath, "/.mozilla/plugins/libnpsoplugin" SAL_DLLEXTENSION);
+ remove(lnkFilePath);
+
+ // create the dirs if necessary
+ struct stat buf;
+ char tmpDir[NPP_PATH_MAX] = {0};
+ sprintf(tmpDir, "%s/.mozilla", pHome);
+ if (0 > stat(lnkFilePath, &buf))
+ {
+ mkdir(tmpDir, 0755);
+ strcat(tmpDir, "/plugins");
+ mkdir(tmpDir, 0755);
+ }
+
+ // get the real file path
+ char realFilePath[NPP_PATH_MAX] = {0};
+ ::rtl::OString tempString;
+ if (!getDllURL(&tempString)) {
+ return false;
+ }
+ strncpy(realFilePath, tempString.getStr(), NPP_PATH_MAX);
+ strcat(realFilePath, "/libnpsoplugin" SAL_DLLEXTENSION);
+
+ // create the link
+ if (0 != symlink(realFilePath, lnkFilePath))
+ return false;
+ return true;
+#endif
+#ifdef WNT
+ ::rtl::OString tempString;
+ char realFilePath[NPP_PATH_MAX] = {0};
+ if (!getDllURL(&tempString)) {
+ return false;
+ }
+ strncpy(realFilePath, tempString.getStr(), NPP_PATH_MAX);
+ if( !lc_installPlugin(realFilePath))
+ return true;
+ else
+ return false;
+#endif
+}
+
+BOOL MozPluginTabPage::uninstallPlugin()
+{
+#ifdef UNIX
+ // get the real file referred by .so lnk file
+ char lnkFilePath[NPP_PATH_MAX] = {0};
+ char* pHome = getpwuid(getuid())->pw_dir;
+ strcat(lnkFilePath, pHome);
+ strcat(lnkFilePath, "/.mozilla/plugins/libnpsoplugin" SAL_DLLEXTENSION);
+
+ if(0 > remove(lnkFilePath))
+ return false;
+ return true;
+#endif
+#ifdef WNT
+ ::rtl::OString tempString;
+ char realFilePath[NPP_PATH_MAX] = {0};
+ if (!getDllURL(&tempString)) {
+ return false;
+ }
+ strncpy(realFilePath, tempString.getStr(), NPP_PATH_MAX);
+ if(!lc_uninstallPlugin(realFilePath))
+ return true;
+ else
+ return false;
+#endif
+}
+//added by jmeng end
+
+/* -------------------------------------------------------------------------*/
+
+class MailerProgramCfg_Impl : public utl::ConfigItem
+{
+ friend class SvxEMailTabPage;
+ // variables
+ OUString sProgram;
+ // readonly states
+ sal_Bool bROProgram;
+
+ const Sequence<OUString> GetPropertyNames();
+public:
+ MailerProgramCfg_Impl();
+ virtual ~MailerProgramCfg_Impl();
+
+ virtual void Commit();
+ virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames);
+};
+
+/* -------------------------------------------------------------------------*/
+
+MailerProgramCfg_Impl::MailerProgramCfg_Impl() :
+ utl::ConfigItem(C2U("Office.Common/ExternalMailer")),
+ bROProgram(sal_False)
+{
+ const Sequence< OUString > aNames = GetPropertyNames();
+ const Sequence< Any > aValues = GetProperties(aNames);
+ const Sequence< sal_Bool > aROStates = GetReadOnlyStates(aNames);
+ const Any* pValues = aValues.getConstArray();
+ const sal_Bool* pROStates = aROStates.getConstArray();
+ for(sal_Int32 nProp = 0; nProp < aValues.getLength(); nProp++)
+ {
+ if(pValues[nProp].hasValue())
+ {
+ switch(nProp)
+ {
+ case 0 :
+ {
+ pValues[nProp] >>= sProgram;
+ bROProgram = pROStates[nProp];
+ }
+ break;
+ }
+ }
+ }
+}
+
+/* -------------------------------------------------------------------------*/
+
+MailerProgramCfg_Impl::~MailerProgramCfg_Impl()
+{
+}
+
+/* -------------------------------------------------------------------------*/
+
+const Sequence<OUString> MailerProgramCfg_Impl::GetPropertyNames()
+{
+ Sequence<OUString> aRet(1);
+ OUString* pRet = aRet.getArray();
+ pRet[0] = C2U("Program");
+ return aRet;
+}
+
+/* -------------------------------------------------------------------------*/
+
+void MailerProgramCfg_Impl::Commit()
+{
+ const Sequence< OUString > aOrgNames = GetPropertyNames();
+ sal_Int32 nOrgCount = aOrgNames.getLength();
+
+ Sequence< OUString > aNames(nOrgCount);
+ Sequence< Any > aValues(nOrgCount);
+ sal_Int32 nRealCount = 0;
+
+ for(int nProp = 0; nProp < nOrgCount; nProp++)
+ {
+ switch(nProp)
+ {
+ case 0:
+ {
+ if (!bROProgram)
+ {
+ aNames[nRealCount] = aOrgNames[nProp];
+ aValues[nRealCount] <<= sProgram;
+ ++nRealCount;
+ }
+ }
+ break;
+ }
+ }
+
+ aNames.realloc(nRealCount);
+ aValues.realloc(nRealCount);
+ PutProperties(aNames, aValues);
+}
+
+void MailerProgramCfg_Impl::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& )
+{
+}
+
+/* -------------------------------------------------------------------------*/
+
+struct SvxEMailTabPage_Impl
+{
+ MailerProgramCfg_Impl aMailConfig;
+};
+
+SvxEMailTabPage::SvxEMailTabPage(Window* pParent, const SfxItemSet& rSet) :
+ SfxTabPage(pParent, CUI_RES( RID_SVXPAGE_INET_MAIL ), rSet),
+ aMailFL(this, CUI_RES(FL_MAIL )),
+ aMailerURLFI(this, CUI_RES(FI_MAILERURL )),
+ aMailerURLFT(this, CUI_RES(FT_MAILERURL )),
+ aMailerURLED(this, CUI_RES(ED_MAILERURL )),
+ aMailerURLPB(this, CUI_RES(PB_MAILERURL )),
+ m_sDefaultFilterName( CUI_RES(STR_DEFAULT_FILENAME )),
+ pImpl(new SvxEMailTabPage_Impl)
+{
+ FreeResource();
+
+ aMailerURLPB.SetClickHdl( LINK( this, SvxEMailTabPage, FileDialogHdl_Impl ) );
+
+ // FixedText not wide enough?
+ long nTxtW = aMailerURLFT.GetCtrlTextWidth( aMailerURLFT.GetText() );
+ long nCtrlW = aMailerURLFT.GetSizePixel().Width();
+ if ( nTxtW >= nCtrlW )
+ {
+ long nDelta = Max( (long)10, nTxtW - nCtrlW );
+ // so FixedText wider
+ Size aNewSz = aMailerURLFT.GetSizePixel();
+ aNewSz.Width() += nDelta;
+ aMailerURLFT.SetSizePixel( aNewSz );
+ // and Edit smaller
+ aNewSz = aMailerURLED.GetSizePixel();
+ aNewSz.Width() -= nDelta;
+ Point aNewPt = aMailerURLED.GetPosPixel();
+ aNewPt.X() += nDelta;
+ aMailerURLED.SetPosSizePixel( aNewPt, aNewSz );
+ }
+}
+
+/* -------------------------------------------------------------------------*/
+
+SvxEMailTabPage::~SvxEMailTabPage()
+{
+ delete pImpl;
+}
+
+/* -------------------------------------------------------------------------*/
+
+SfxTabPage* SvxEMailTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new SvxEMailTabPage(pParent, rAttrSet);
+}
+
+/* -------------------------------------------------------------------------*/
+
+BOOL SvxEMailTabPage::FillItemSet( SfxItemSet& )
+{
+ BOOL bMailModified = FALSE;
+ if(!pImpl->aMailConfig.bROProgram && aMailerURLED.GetSavedValue() != aMailerURLED.GetText())
+ {
+ pImpl->aMailConfig.sProgram = aMailerURLED.GetText();
+ bMailModified = TRUE;
+ }
+ if ( bMailModified )
+ pImpl->aMailConfig.Commit();
+
+ return FALSE;
+}
+
+/* -------------------------------------------------------------------------*/
+
+void SvxEMailTabPage::Reset( const SfxItemSet& )
+{
+ aMailerURLED.Enable(TRUE );
+ aMailerURLPB.Enable(TRUE );
+
+ if(pImpl->aMailConfig.bROProgram)
+ aMailerURLFI.Show();
+
+ aMailerURLED.SetText(pImpl->aMailConfig.sProgram);
+ aMailerURLED.SaveValue();
+ aMailerURLED.Enable(!pImpl->aMailConfig.bROProgram);
+ aMailerURLPB.Enable(!pImpl->aMailConfig.bROProgram);
+ aMailerURLFT.Enable(!pImpl->aMailConfig.bROProgram);
+
+ aMailFL.Enable(aMailerURLFT.IsEnabled() ||
+ aMailerURLED.IsEnabled() ||
+ aMailerURLPB.IsEnabled());
+}
+
+/* -------------------------------------------------------------------------*/
+
+IMPL_LINK( SvxEMailTabPage, FileDialogHdl_Impl, PushButton*, pButton )
+{
+ if ( &aMailerURLPB == pButton && !pImpl->aMailConfig.bROProgram )
+ {
+ FileDialogHelper aHelper(
+ com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
+ WB_OPEN );
+ String sPath = aMailerURLED.GetText();
+ if ( !sPath.Len() )
+ sPath.AppendAscii("/usr/bin");
+
+ String sUrl;
+ ::utl::LocalFileHelper::ConvertPhysicalNameToURL(sPath,sUrl);
+ aHelper.SetDisplayDirectory(sUrl);
+ aHelper.AddFilter( m_sDefaultFilterName, String::CreateFromAscii("*"));
+
+ if ( ERRCODE_NONE == aHelper.Execute() )
+ {
+ sUrl = aHelper.GetPath();
+ ::utl::LocalFileHelper::ConvertURLToPhysicalName(sUrl,sPath);
+ aMailerURLED.SetText(sPath);
+ }
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/cui/source/options/optinet2.hrc b/cui/source/options/optinet2.hrc
new file mode 100644
index 000000000000..1e9a3f65efeb
--- /dev/null
+++ b/cui/source/options/optinet2.hrc
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optinet2.hrc,v $
+ * $Revision: 1.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTINET_HRC
+#define _SVX_OPTINET_HRC
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+// Proxy ------------------------------------------------------------------
+#define GB_SETTINGS 1
+#define FT_PROXYMODE 2
+#define LB_PROXYMODE 2
+#define FT_HTTP_PROXY 3
+#define ED_HTTP_PROXY 3
+#define FT_HTTP_PORT 4
+#define ED_HTTP_PORT 4
+#define FT_FTP_PROXY 5
+#define ED_FTP_PROXY 5
+#define FT_FTP_PORT 6
+#define ED_FTP_PORT 6
+#define FT_SOCKS_PROXY 7
+#define ED_SOCKS_PROXY 7
+#define FT_SOCKS_PORT 8
+#define ED_SOCKS_PORT 8
+#define FT_NOPROXYFOR 11
+#define ED_NOPROXYFOR 11
+#define ED_NOPROXYDESC 12
+#define ST_PROXY_FROM_BROWSER 13
+#define FT_HTTPS_PROXY 14
+#define ED_HTTPS_PROXY 14
+#define FT_HTTPS_PORT 15
+#define ED_HTTPS_PORT 15
+
+// Search ------------------------------------------------------------------
+#define GB_SEARCH 40
+#define LB_SEARCH 40
+#define FT_SEARCH_NAME 41
+#define ED_SEARCH_NAME 41
+#define FT_SEARCH 42
+#define RB_AND 43
+#define RB_OR 44
+#define RB_EXACT 45
+#define FT_URL 46
+#define ED_URL 46
+#define FT_POSTFIX 47
+#define ED_POSTFIX 47
+#define FT_SEPARATOR 48
+#define ED_SEPARATOR 48
+#define FT_CASE 49
+#define ED_CASE 49
+#define PB_CHANGE 53
+#define PB_DELETE 54
+#define PB_ADD 55
+#define PB_NEW 56
+#define MSG_MODIFY 57
+
+// Protocols --------------------------------------------------------------
+#define GB_DNS 105
+#define RB_DNS_AUTO 106
+#define RB_DNS_MANUAL 107
+#define ED_DNS 107
+
+#define ST_MSG_255_0 111
+#define ST_MSG_255_1 112
+
+// Site Certificate --------------------------------------------------------
+#define GB_SITECERT 120
+#define LB_SITECERT 121
+#define LB_FILTERCERT 122
+#define PB_EDIT_CERT 123
+#define PB_DELETE_CERT 124
+
+// personal Certificate ----------------------------------------------------
+#define GB_PERSCERT 130
+#define LB_PERSCERT 131
+#define PB_NEW_PERSCERT 132
+#define PB_INFO_PERSCERT 133
+#define PB_DELETE_PERSCERT 134
+
+// Security -------------------------------------------------------------
+
+#define FL_SEC_SECURITYOPTIONS 10
+#define FI_SEC_SECURITYOPTIONS 11
+#define PB_SEC_SECURITYOPTIONS 12
+#define FL_SEC_PASSWORDS 13
+#define CB_SEC_SAVEPASSWORDS 14
+#define PB_SEC_CONNECTIONS 15
+#define CB_SEC_MASTERPASSWORD 16
+#define FI_SEC_MASTERPASSWORD 17
+#define PB_SEC_MASTERPASSWORD 18
+#define FL_SEC_MACROSEC 19
+#define FI_SEC_MACROSEC 20
+#define PB_SEC_MACROSEC 21
+#define FL_SEC_FILESHARING 22
+#define CB_SEC_RECOMMREADONLY 23
+#define CB_SEC_RECORDCHANGES 24
+#define PB_SEC_PROTRECORDS 25
+
+#define STR_SEC_PROTRECORDS 10
+#define STR_SEC_UNPROTRECORDS 11
+#define STR_SEC_NOPASSWDSAVE 12
+
+#define TP_WIDTH 260
+#define TP_HEIGHT 185
+#define OFFS_BUTTON_Y (-6)
+#define BORDER_OFFSET 8
+#define COL_0 (RSC_SP_TBPG_INNERBORDER_LEFT)
+#define COL_1 (COL_0+RSC_SP_FLGR_SPACE_X)
+#define COL_1a (COL_1+RSC_SP_CHK_TEXTINDENT)
+#define COL_4 (TP_WIDTH-RSC_SP_TBPG_INNERBORDER_RIGHT)
+#define COL_3 (COL_4-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_2 (COL_3-RSC_SP_CTRL_DESC_X)
+
+#define ROW_0 (RSC_SP_FLGR_INNERBORDER_TOP)
+#define ROW_1 (ROW_0+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_2 (ROW_1+3*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_2a (ROW_2-RSC_SP_FLGR_SPACE_Y-RSC_CD_PUSHBUTTON_HEIGHT)
+#define ROW_3 (ROW_2+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_4 (ROW_3+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_DESC_Y-1)
+#define ROW_4a (ROW_4+RSC_CD_CHECKBOX_HEIGHT+1)
+#define ROW_5 (ROW_4a+4*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_6 (ROW_5+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_7 (ROW_6+2*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_8 (ROW_7+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_9 (ROW_8+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_DESC_Y)
+
+// Defines - JavaScriptDisableQueryBox_Impl -------------------------------
+
+#define IMG_JSCPT_WARNING 220
+#define FT_JSCPT_WARNING 221
+#define CB_JSCPT_DISABLE 222
+#define GB_JSCPT_WARNING 223
+#define BTN_JSCPT_YES 224
+#define BTN_JSCPT_NO 225
+
+// Defines - SvxEMailTabPage_Impl
+#define FL_MAIL 1
+#define FT_MAILERURL 2
+#define FI_MAILERURL 3
+#define ED_MAILERURL 4
+#define PB_MAILERURL 5
+#define STR_DEFAULT_FILENAME 6
+
+// plugin
+#define GB_MOZPLUGIN 1
+#define CB_MOZPLUGIN_CODE 2
+
+
+#endif // #ifndef _SVX_OPTINET_HRC
+
+// ******************************************************************* EOF
+
diff --git a/cui/source/options/optinet2.hxx b/cui/source/options/optinet2.hxx
new file mode 100644
index 000000000000..00d1aaadc4fc
--- /dev/null
+++ b/cui/source/options/optinet2.hxx
@@ -0,0 +1,355 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optinet2.hxx,v $
+ * $Revision: 1.16 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTINET_HXX
+#define _SVX_OPTINET_HXX
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <vcl/lstbox.hxx>
+#include <vcl/group.hxx>
+#include <vcl/field.hxx>
+#include <svl/svarray.hxx>
+#include <svtools/stdctrl.hxx>
+#include <svtools/svtabbx.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svx/srchcfg.hxx>
+
+#ifdef _SVX_OPTINET2_CXX
+#include <svtools/headbar.hxx>
+#else
+class HeaderBar;
+#endif
+#include <readonlyimage.hxx>
+
+class SfxFilter;
+class SvtInetOptions;
+
+#ifndef SV_NODIALOG
+#define PROXY_CONTROLS 23
+#define CACHE_CONTROLS 20
+#define INET_SEARCH 19
+
+#if defined(OS2)
+#define TYPE_CONTROLS 20
+#else
+#define TYPE_CONTROLS 18
+#endif
+
+namespace svx {
+ class SecurityOptionsDialog;
+}
+
+namespace lang = ::com::sun::star::lang;
+namespace uno = ::com::sun::star::uno;
+
+// class SvxNoSpaceEdit --------------------------------------------------
+
+class SvxNoSpaceEdit : public Edit
+{
+private:
+ BOOL bOnlyNumeric;
+
+public:
+ SvxNoSpaceEdit(Window* pParent, ResId rResId, BOOL bNum = FALSE ) :
+ Edit( pParent, rResId ), bOnlyNumeric( bNum ) {}
+
+ virtual void KeyInput( const KeyEvent& rKEvent );
+ virtual void Modify();
+};
+
+typedef SfxFilter* SfxFilterPtr;
+SV_DECL_PTRARR( SfxFilterPtrArr, SfxFilterPtr, 0, 4 )
+
+// class SvxProxyTabPage -------------------------------------------------
+
+class SvxProxyTabPage : public SfxTabPage
+{
+private:
+ FixedLine aOptionGB;
+
+ FixedText aProxyModeFT;
+ ListBox aProxyModeLB;
+
+ FixedText aHttpProxyFT;
+ SvxNoSpaceEdit aHttpProxyED;
+ FixedText aHttpPortFT;
+ SvxNoSpaceEdit aHttpPortED;
+
+ FixedText aHttpsProxyFT;
+ SvxNoSpaceEdit aHttpsProxyED;
+ FixedText aHttpsPortFT;
+ SvxNoSpaceEdit aHttpsPortED;
+
+
+ FixedText aFtpProxyFT;
+ SvxNoSpaceEdit aFtpProxyED;
+ FixedText aFtpPortFT;
+ SvxNoSpaceEdit aFtpPortED;
+
+ FixedText aNoProxyForFT;
+ Edit aNoProxyForED;
+ FixedText aNoProxyDescFT;
+
+ String sFromBrowser;
+
+ const rtl::OUString aProxyModePN;
+ const rtl::OUString aHttpProxyPN;
+ const rtl::OUString aHttpPortPN;
+ const rtl::OUString aHttpsProxyPN;
+ const rtl::OUString aHttpsPortPN;
+ const rtl::OUString aFtpProxyPN;
+ const rtl::OUString aFtpPortPN;
+ const rtl::OUString aNoProxyDescPN;
+
+ uno::Reference< uno::XInterface > m_xConfigurationUpdateAccess;
+
+#ifdef _SVX_OPTINET2_CXX
+ void ArrangeControls_Impl();
+ void EnableControls_Impl(BOOL bEnable);
+ void ReadConfigData_Impl();
+ void ReadConfigDefaults_Impl();
+ void RestoreConfigDefaults_Impl();
+
+ DECL_LINK( ProxyHdl_Impl, ListBox * );
+ DECL_LINK( LoseFocusHdl_Impl, Edit * );
+#endif
+
+ SvxProxyTabPage( Window* pParent, const SfxItemSet& rSet );
+ virtual ~SvxProxyTabPage();
+
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+// class SvxSearchTabPage ------------------------------------------------
+class SvxSearchConfig;
+class SvxSearchTabPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+private:
+ FixedLine aSearchGB;
+ ListBox aSearchLB;
+ FixedText aSearchNameFT;
+ SvxNoSpaceEdit aSearchNameED;
+
+ FixedText aSearchFT;
+ RadioButton aAndRB;
+ RadioButton aOrRB;
+ RadioButton aExactRB;
+
+ FixedText aURLFT;
+ SvxNoSpaceEdit aURLED;
+
+ FixedText aPostFixFT;
+ SvxNoSpaceEdit aPostFixED;
+ FixedText aSeparatorFT;
+ SvxNoSpaceEdit aSeparatorED;
+ FixedText aCaseFT;
+ ListBox aCaseED;
+
+ PushButton aNewPB;
+ PushButton aAddPB;
+ PushButton aChangePB;
+ PushButton aDeletePB;
+
+ String sLastSelectedEntry;
+ String sModifyMsg;
+
+ SvxSearchConfig aSearchConfig;
+ SvxSearchEngineData aCurrentSrchData;
+
+#ifdef _SVX_OPTINET2_CXX
+ void InitControls_Impl();
+
+ DECL_LINK( NewSearchHdl_Impl, PushButton * );
+ DECL_LINK( AddSearchHdl_Impl, PushButton * );
+ DECL_LINK( ChangeSearchHdl_Impl, PushButton * );
+ DECL_LINK( DeleteSearchHdl_Impl, PushButton * );
+ DECL_LINK( SearchEntryHdl_Impl, ListBox * );
+ DECL_LINK( SearchModifyHdl_Impl, SvxNoSpaceEdit * );
+ DECL_LINK( SearchPartHdl_Impl, RadioButton * );
+#endif
+
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+ BOOL ConfirmLeave( const String& rStringSelection ); //add by BerryJia for fixing Bug102610 Time:2002-8-29 11:00 (China Standard Time GMT+08:00)
+
+ SvxSearchTabPage( Window* pParent, const SfxItemSet& rSet );
+ virtual ~SvxSearchTabPage();
+
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+// #98647# class SvxScriptExecListBox ------------------------------------
+class SvxScriptExecListBox : public ListBox
+{ // for adding tooltips to ListBox
+public:
+ SvxScriptExecListBox( Window* pParent, WinBits nStyle = WB_BORDER )
+ :ListBox(pParent, nStyle) {}
+ SvxScriptExecListBox( Window* pParent, const ResId& rResId )
+ :ListBox(pParent, rResId) {}
+
+protected:
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+};
+
+// class SvxSecurityTabPage ---------------------------------------------
+
+class SvtJavaOptions;
+class SvtSecurityOptions;
+
+class SvxSecurityTabPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+public:
+ enum RedliningMode { RL_NONE, RL_WRITER, RL_CALC };
+
+private:
+ FixedLine maSecurityOptionsFL;
+ FixedInfo maSecurityOptionsFI;
+ PushButton maSecurityOptionsPB;
+
+ FixedLine maPasswordsFL;
+ CheckBox maSavePasswordsCB;
+ PushButton maShowConnectionsPB;
+ CheckBox maMasterPasswordCB;
+ FixedInfo maMasterPasswordFI;
+ PushButton maMasterPasswordPB;
+
+ FixedLine maMacroSecFL;
+ FixedInfo maMacroSecFI;
+ PushButton maMacroSecPB;
+
+ FixedLine maFilesharingFL;
+ CheckBox maRecommReadOnlyCB;
+ CheckBox maRecordChangesCB;
+ PushButton maProtectRecordsPB;
+
+ SvtSecurityOptions* mpSecOptions;
+ svx::SecurityOptionsDialog* mpSecOptDlg;
+
+ RedliningMode meRedlingMode;
+ String msProtectRecordsStr;
+ String msUnprotectRecordsStr;
+ String msPasswordStoringDeactivateStr;
+
+ DECL_LINK( SecurityOptionsHdl, PushButton* );
+ DECL_LINK( SavePasswordHdl, void* );
+ DECL_LINK( MasterPasswordHdl, PushButton* );
+ DECL_LINK( MasterPasswordCBHdl, void* );
+ DECL_LINK( ShowPasswordsHdl, PushButton* );
+ DECL_LINK( MacroSecPBHdl, void* );
+ DECL_LINK( RecordChangesCBHdl, void* );
+ DECL_LINK( ProtectRecordsPBHdl, void* );
+
+ void CheckRecordChangesState( void );
+ void InitControls();
+
+ SvxSecurityTabPage( Window* pParent, const SfxItemSet& rSet );
+ virtual ~SvxSecurityTabPage();
+
+protected:
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+//added by jmeng begin
+class MozPluginTabPage : public SfxTabPage
+{
+ FixedLine aMSWordGB;
+ CheckBox aWBasicCodeCB;
+
+ BOOL isInstalled(void);
+ BOOL installPlugin(void);
+ BOOL uninstallPlugin(void);
+
+ MozPluginTabPage( Window* pParent, const SfxItemSet& rSet );
+ virtual ~MozPluginTabPage();
+
+public:
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+};
+//added by jmeng end
+#endif
+
+/* -----------------------------20.06.01 16:32--------------------------------
+
+ ---------------------------------------------------------------------------*/
+#ifdef WNT
+#else
+#define HELPER_PAGE_COMPLETE
+#endif
+
+struct SvxEMailTabPage_Impl;
+class SvxEMailTabPage : public SfxTabPage
+{
+ FixedLine aMailFL;
+ ReadOnlyImage aMailerURLFI;
+ FixedText aMailerURLFT;
+ Edit aMailerURLED;
+ PushButton aMailerURLPB;
+
+ String m_sDefaultFilterName;
+
+ SvxEMailTabPage_Impl* pImpl;
+
+ DECL_LINK( FileDialogHdl_Impl, PushButton* ) ;
+
+public:
+ SvxEMailTabPage( Window* pParent, const SfxItemSet& rSet );
+ ~SvxEMailTabPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+#endif // #ifndef _SVX_OPTINET_HXX
+
+
diff --git a/cui/source/options/optinet2.src b/cui/source/options/optinet2.src
new file mode 100644
index 000000000000..e7bdc9eff17c
--- /dev/null
+++ b/cui/source/options/optinet2.src
@@ -0,0 +1,647 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optinet2.src,v $
+ * $Revision: 1.97 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ------------------------------------------------------------------
+#include <sfx2/sfx.hrc>
+#include "helpid.hrc"
+#include <cuires.hrc>
+#include "optinet2.hrc"
+ // pragma -------------------------------------------------------------------
+
+/************************************************************************/
+/* */
+/* Proxy server */
+/* */
+/************************************************************************/
+
+// added by jmeng begin
+
+TabPage RID_SVXPAGE_INET_MOZPLUGIN
+{
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+
+ FixedLine GB_MOZPLUGIN
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text[ en-US ] = "Browser Plug-in";
+ };
+ CheckBox CB_MOZPLUGIN_CODE
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Display documents in browser" ;
+ };
+};
+
+//added by jmeng end
+
+TabPage RID_SVXPAGE_INET_PROXY
+{
+ HelpId = HID_OPTIONS_PROXY ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Proxy" ;
+ #define GB_TYPES_TOP 3
+ #define GB_TYPES_LEFT 6
+ FixedLine GB_SETTINGS
+ {
+ Pos = MAP_APPFONT ( GB_TYPES_LEFT , GB_TYPES_TOP ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Settings" ;
+ };
+ FixedText FT_PROXYMODE
+ {
+ Pos = MAP_APPFONT ( 12 , GB_TYPES_TOP + 13 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "Proxy s~erver" ;
+ };
+ ListBox LB_PROXYMODE
+ {
+ Pos = MAP_APPFONT ( 65 , GB_TYPES_TOP + 11 ) ;
+ Size = MAP_APPFONT ( 49 , 48 ) ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "None" ; > ;
+ < "System" ; > ;
+ < "Manual" ; > ;
+ };
+ };
+ String ST_PROXY_FROM_BROWSER
+ {
+ Text [ en-US ] = "Use browser settings";
+ };
+ FixedText FT_HTTP_PROXY
+ {
+ Pos = MAP_APPFONT ( 12 , GB_TYPES_TOP + 29 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "HT~TP proxy" ;
+ };
+ Edit ED_HTTP_PROXY
+ {
+ Pos = MAP_APPFONT ( 65 , GB_TYPES_TOP + 27 ) ;
+ Size = MAP_APPFONT ( 123 , 12 ) ;
+ Border = TRUE ;
+ };
+
+ #define FT_PORT_WIDTH 37
+ #define ED_PORT_WIDTH 20
+ #define ED_PORT_COL 229
+
+ FixedText FT_HTTP_PORT
+ {
+ Pos = MAP_APPFONT ( 190 , GB_TYPES_TOP + 29 ) ;
+ Size = MAP_APPFONT ( FT_PORT_WIDTH , 8 ) ;
+ Right = TRUE;
+ Text [ en-US ] = "~Port" ;
+ };
+ Edit ED_HTTP_PORT
+ {
+ Pos = MAP_APPFONT ( ED_PORT_COL , GB_TYPES_TOP + 27 ) ;
+ Size = MAP_APPFONT ( ED_PORT_WIDTH , 12 ) ;
+ Border = TRUE ;
+ };
+
+ FixedText FT_HTTPS_PROXY
+ {
+ Pos = MAP_APPFONT ( 12 , GB_TYPES_TOP + 45 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "HTTP~S proxy" ;
+ };
+ Edit ED_HTTPS_PROXY
+ {
+ Pos = MAP_APPFONT ( 65 , GB_TYPES_TOP + 43 ) ;
+ Size = MAP_APPFONT ( 123 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_HTTPS_PORT
+ {
+ Pos = MAP_APPFONT ( 190 , GB_TYPES_TOP + 45 ) ;
+ Size = MAP_APPFONT ( FT_PORT_WIDTH , 8 ) ;
+ Right = TRUE;
+ Text [ en-US ] = "P~ort" ;
+ };
+ Edit ED_HTTPS_PORT
+ {
+ Pos = MAP_APPFONT ( ED_PORT_COL , GB_TYPES_TOP + 43 ) ;
+ Size = MAP_APPFONT ( ED_PORT_WIDTH , 12 ) ;
+ Border = TRUE ;
+ };
+
+ FixedText FT_FTP_PROXY
+ {
+ Pos = MAP_APPFONT ( 12 , GB_TYPES_TOP + 61 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~FTP proxy" ;
+ };
+ Edit ED_FTP_PROXY
+ {
+ Pos = MAP_APPFONT ( 65 , GB_TYPES_TOP + 59 ) ;
+ Size = MAP_APPFONT ( 123 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_FTP_PORT
+ {
+ Pos = MAP_APPFONT ( 190 , GB_TYPES_TOP + 61 ) ;
+ Size = MAP_APPFONT ( FT_PORT_WIDTH , 8 ) ;
+ Right = TRUE;
+ Text [ en-US ] = "P~ort" ;
+ };
+ Edit ED_FTP_PORT
+ {
+ Pos = MAP_APPFONT ( ED_PORT_COL , GB_TYPES_TOP + 59 ) ;
+ Size = MAP_APPFONT ( ED_PORT_WIDTH , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_SOCKS_PROXY
+ {
+ Pos = MAP_APPFONT ( 12 , GB_TYPES_TOP + 77 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text [ en-US ] = "~SOCKS proxy" ;
+ };
+ Edit ED_SOCKS_PROXY
+ {
+ Pos = MAP_APPFONT ( 65 , GB_TYPES_TOP + 75 ) ;
+ Size = MAP_APPFONT ( 123 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_SOCKS_PORT
+ {
+ Pos = MAP_APPFONT ( 190 , GB_TYPES_TOP + 77 ) ;
+ Size = MAP_APPFONT ( FT_PORT_WIDTH , 8 ) ;
+ Right = TRUE;
+ Text [ en-US ] = "Po~rt" ;
+ };
+ Edit ED_SOCKS_PORT
+ {
+ Pos = MAP_APPFONT ( ED_PORT_COL , GB_TYPES_TOP + 75 ) ;
+ Size = MAP_APPFONT ( ED_PORT_WIDTH , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_NOPROXYFOR
+ {
+ Pos = MAP_APPFONT ( 12 , GB_TYPES_TOP + 93 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~No proxy for:" ;
+ };
+ Edit ED_NOPROXYFOR
+ {
+ Pos = MAP_APPFONT ( 65 , GB_TYPES_TOP + 91 ) ;
+ Size = MAP_APPFONT ( 123 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText ED_NOPROXYDESC
+ {
+ Pos = MAP_APPFONT ( 190 , GB_TYPES_TOP + 93 ) ;
+ Size = MAP_APPFONT ( 56 , 8 ) ;
+ Text [ en-US ] = "Separator ;" ;
+ };
+ FixedLine GB_DNS
+ {
+ Pos = MAP_APPFONT( 6, 100 );
+ Size = MAP_APPFONT( 248, 8 );
+ Text [ en-US ] = "DNS server" ;
+ };
+ RadioButton RB_DNS_AUTO
+ {
+ Pos = MAP_APPFONT( 12, 111 );
+ Size = MAP_APPFONT( 236, 10 );
+ Text [ en-US ] = "~Automatic" ;
+ };
+ RadioButton RB_DNS_MANUAL
+ {
+ Pos = MAP_APPFONT( 12, 124 );
+ Size = MAP_APPFONT( 75, 10 );
+ Text [ en-US ] = "~Manual" ;
+ };
+ PatternField ED_DNS
+ {
+ Pos = MAP_APPFONT( 90, 126 );
+ Size = MAP_APPFONT( 66, 12 );
+ Border = TRUE ;
+ LiteralMask = " . . . " ;
+ EditMask = "nnnLnnnLnnnLnnn" ;
+ StrictFormat = TRUE ;
+ };
+ String ST_MSG_255_0
+ {
+ Text [ en-US ] = "is not a valid entry for this field. Please specify a value between 0 and 255." ;
+ };
+ String ST_MSG_255_1
+ {
+ Text [ en-US ] = "is not a valid entry for this field. Please specify a value between 1 and 255." ;
+ };
+};
+/************************************************************************/
+/* */
+/* Suche */
+/* */
+/************************************************************************/
+TabPage RID_SVXPAGE_INET_SEARCH
+{
+ HelpId = HID_OPTIONS_SEARCH ;
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Search" ;
+
+ #define GB_SEARCH_LEFT 6
+ #define GB_SEARCH_TOP 3
+ FixedLine GB_SEARCH
+ {
+ Pos = MAP_APPFONT ( GB_SEARCH_LEFT , GB_SEARCH_TOP ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Search in" ;
+ };
+ ListBox LB_SEARCH
+ {
+ Pos = MAP_APPFONT ( 12 , GB_SEARCH_TOP + 11 ) ;
+ Size = MAP_APPFONT ( 39 , 120 ) ;
+ Border = TRUE ;
+ AutoHScroll = TRUE;
+ };
+ #define LABEL_START_XPOS (GB_SEARCH_LEFT + 6 + 39 + 5 )
+ #define LABEL_LEN 64
+ #define EDIT_START_XPOS (LABEL_START_XPOS + LABEL_LEN + 3)
+ FixedText FT_SEARCH_NAME
+ {
+ Pos = MAP_APPFONT ( LABEL_START_XPOS , GB_SEARCH_TOP + 13 ) ;
+ Size = MAP_APPFONT ( LABEL_LEN , 8 ) ;
+ Text [ en-US ] = "~Name" ;
+ };
+ Edit ED_SEARCH_NAME
+ {
+ Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 11 ) ;
+ Size = MAP_APPFONT ( 125 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_SEARCH
+ {
+ Pos = MAP_APPFONT ( LABEL_START_XPOS , GB_SEARCH_TOP + 27 ) ;
+ Size = MAP_APPFONT ( LABEL_LEN , 8 ) ;
+ Text [ en-US ] = "Type" ;
+ };
+ RadioButton RB_AND
+ {
+ Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 26 ) ;
+ Size = MAP_APPFONT ( 125 , 10 ) ;
+ Check = TRUE ;
+ Text [ en-US ] = "And" ;
+ };
+ RadioButton RB_OR
+ {
+ Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 39 ) ;
+ Size = MAP_APPFONT ( 125 , 10 ) ;
+ Text [ en-US ] = "~Or" ;
+ };
+ RadioButton RB_EXACT
+ {
+ Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 52 ) ;
+ Size = MAP_APPFONT ( 125 , 10 ) ;
+ Text [ en-US ] = "E~xact" ;
+ };
+ FixedText FT_URL
+ {
+ Pos = MAP_APPFONT ( LABEL_START_XPOS , GB_SEARCH_TOP + 67 ) ;
+ Size = MAP_APPFONT ( LABEL_LEN , 8 ) ;
+ Text [ en-US ] = "~Prefix" ;
+ };
+ Edit ED_URL
+ {
+ Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 65 ) ;
+ Size = MAP_APPFONT ( 125 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_POSTFIX
+ {
+ Pos = MAP_APPFONT ( LABEL_START_XPOS , GB_SEARCH_TOP + 82 ) ;
+ Size = MAP_APPFONT ( LABEL_LEN , 8 ) ;
+ Text [ en-US ] = "Su~ffix" ;
+ };
+ Edit ED_POSTFIX
+ {
+ Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 80 ) ;
+ Size = MAP_APPFONT ( 125 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( LABEL_START_XPOS , GB_SEARCH_TOP + 97 ) ;
+ Size = MAP_APPFONT ( LABEL_LEN , 8 ) ;
+ Text [ en-US ] = "~Separator" ;
+ };
+ Edit ED_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( EDIT_START_XPOS , GB_SEARCH_TOP + 95 ) ;
+ Size = MAP_APPFONT ( 42 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_CASE
+ {
+ Pos = MAP_APPFONT ( LABEL_START_XPOS, GB_SEARCH_TOP + 112 ) ;
+ Size = MAP_APPFONT ( LABEL_LEN , 8 ) ;
+ Text [ en-US ] = "~Case match" ;
+ };
+ ListBox ED_CASE
+ {
+ Pos = MAP_APPFONT ( EDIT_START_XPOS, GB_SEARCH_TOP + 110 ) ;
+ Size = MAP_APPFONT ( 42 , 48 ) ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "None" ; > ;
+ < "Upper" ; > ;
+ < "Lower" ; > ;
+ };
+ };
+ PushButton PB_NEW
+ {
+ Pos = MAP_APPFONT ( 39 , GB_SEARCH_TOP + 131 + 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "N~ew";
+ };
+ PushButton PB_ADD
+ {
+ Pos = MAP_APPFONT ( 92 , GB_SEARCH_TOP + 131 + 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Add" ;
+ };
+ PushButton PB_CHANGE
+ {
+ Pos = MAP_APPFONT ( 145 , GB_SEARCH_TOP + 131 + 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Modify" ;
+ };
+ PushButton PB_DELETE
+ {
+ Pos = MAP_APPFONT ( 198 , GB_SEARCH_TOP + 131 + 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Delete" ;
+ };
+ String MSG_MODIFY
+ {
+ Text [ en-US ] = "Do you want to accept the current modification?";
+ };
+};
+
+
+/************************************************************************/
+/* */
+/* Scripting */
+/* */
+/************************************************************************/
+
+TabPage RID_SVXPAGE_INET_SECURITY
+{
+ OutputSize = TRUE ;
+ Size = MAP_APPFONT( TP_WIDTH , TP_HEIGHT );
+ SVLook = TRUE;
+ Hide = TRUE;
+ Text [ en-US ] = "Security";
+ FixedLine FL_SEC_SECURITYOPTIONS
+ {
+ Pos = MAP_APPFONT( COL_0, ROW_0 );
+ Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Security options and warnings";
+ };
+ FixedText FI_SEC_SECURITYOPTIONS
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_1 );
+ Size = MAP_APPFONT( COL_2-COL_1, 3*RSC_CD_FIXEDLINE_HEIGHT );
+ Wordbreak = TRUE;
+ Text [ en-US ] = "Adjust security related options and define warnings for hidden information in documents.";
+ };
+ PushButton PB_SEC_SECURITYOPTIONS
+ {
+ Pos = MAP_APPFONT( COL_3, ROW_2a );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text [ en-US ] = "Options...";
+ };
+ FixedLine FL_SEC_PASSWORDS
+ {
+ Pos = MAP_APPFONT( COL_0, ROW_2 - 2 );
+ Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Passwords for web connections";
+ };
+ CheckBox CB_SEC_SAVEPASSWORDS
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_3 - 4 );
+ Size = MAP_APPFONT( COL_2-COL_1, 16 );
+ Wordbreak = TRUE;
+ Text [ en-US ] = "Persistently save passwords for web connections";
+ };
+ PushButton PB_SEC_CONNECTIONS
+ {
+ Pos = MAP_APPFONT( COL_3, ROW_3-1 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text [ en-US ] = "Connections...";
+ };
+ CheckBox CB_SEC_MASTERPASSWORD
+ {
+ Pos = MAP_APPFONT( COL_1a, ROW_4 );
+ Size = MAP_APPFONT( COL_2-COL_1a, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Protected by a master password (recommended)";
+ };
+ FixedText FI_SEC_MASTERPASSWORD
+ {
+ Pos = MAP_APPFONT( COL_1a, ROW_4a );
+ Size = MAP_APPFONT( COL_2-COL_1a, 4*RSC_CD_FIXEDLINE_HEIGHT );
+ Wordbreak = TRUE;
+ Text [ en-US ] = "Passwords are protected by a master password. You will be asked to enter it once per session, if %PRODUCTNAME retrieves a password from the protected password list.";
+ };
+ PushButton PB_SEC_MASTERPASSWORD
+ {
+ Pos = MAP_APPFONT( COL_3, ROW_4a );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text [ en-US ] = "Master Password...";
+ };
+ FixedLine FL_SEC_MACROSEC
+ {
+ Pos = MAP_APPFONT( COL_0, ROW_5 );
+ Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Macro security";
+ };
+ FixedText FI_SEC_MACROSEC
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_6 );
+ Size = MAP_APPFONT( COL_2-COL_1, 3*RSC_CD_FIXEDLINE_HEIGHT );
+ Wordbreak = TRUE;
+ Text [ en-US ] = "Adjust the security level for executing macros and specify trusted macro developers.";
+ };
+ PushButton PB_SEC_MACROSEC
+ {
+ Pos = MAP_APPFONT( COL_3, ROW_6-2 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text [ en-US ] = "Macro Security...";
+ };
+ FixedLine FL_SEC_FILESHARING
+ {
+ Pos = MAP_APPFONT( COL_0, ROW_7 );
+ Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "File sharing options for this document";
+ };
+ CheckBox CB_SEC_RECOMMREADONLY
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_8 );
+ Size = MAP_APPFONT( COL_2-COL_1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Open this document in read-only mode";
+ };
+ CheckBox CB_SEC_RECORDCHANGES
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_9 );
+ Size = MAP_APPFONT( COL_2-COL_1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Record changes";
+ };
+ PushButton PB_SEC_PROTRECORDS
+ {
+ Pos = MAP_APPFONT( COL_3, ROW_9-2 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ };
+ String STR_SEC_PROTRECORDS
+ {
+ Text [ en-US ] = "Protect...";
+ };
+ String STR_SEC_UNPROTRECORDS
+ {
+ Text [ en-US ] = "Unprotect...";
+ };
+ String STR_SEC_NOPASSWDSAVE
+ {
+ Text [ en-US ] = "Disabling the function to persistently store passwords deletes the list of passwords stored and resets the master password.\n\nDo you want to delete password list and reset master password?";
+ };
+};
+
+ErrorBox RID_SVXERR_OPT_PROXYPORTS
+{
+ BUTTONS = WB_OK ;
+ Message [ en-US ] = "Invalid value!\n\nThe maximum value for a port number is 65535.";
+};
+
+// RID_SVXDLG_OPT_JAVASCRIPT_DISABLE -----------------------------------------
+
+ModalDialog RID_SVXDLG_OPT_JAVASCRIPT_DISABLE
+{
+ OutputSize = TRUE;
+ Size = MAP_APPFONT( 150, 81 );
+ Moveable = TRUE;
+ Closeable = TRUE;
+ FixedImage IMG_JSCPT_WARNING
+ {
+ Pos = MAP_APPFONT( 6, 6 );
+ Size = MAP_APPFONT( 30, 30 );
+ };
+ FixedText FT_JSCPT_WARNING
+ {
+ Pos = MAP_APPFONT( 39, 6 );
+ Size = MAP_APPFONT( 195, 36 );
+ WordBreak = TRUE;
+ Text [ en-US ] = "Please note that with Java\nyou disable Javascript as well.\n\nDo you still want to disable Java?";
+ };
+ CheckBox CB_JSCPT_DISABLE
+ {
+ Pos = MAP_APPFONT( 39, 45 );
+ Size = MAP_APPFONT( 195, 12 );
+ Hide = TRUE;
+ Text [ en-US ] = "~Don't show warning again";
+ };
+ OKButton BTN_JSCPT_YES
+ {
+ Pos = MAP_APPFONT( 41, 61 );
+ Size = MAP_APPFONT( 50, 14 );
+ };
+ CancelButton BTN_JSCPT_NO
+ {
+ Pos = MAP_APPFONT( 94, 61 );
+ Size = MAP_APPFONT( 50, 14 );
+ DefButton = TRUE;
+ };
+};
+
+// *******************************************************************
+
+TabPage RID_SVXPAGE_INET_MAIL
+{
+ HelpID = HID_OPTIONS_MAIL ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+
+ FixedLine FL_MAIL
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Sending documents as e-mail attachments";
+ };
+
+ FixedImage FI_MAILERURL
+ {
+ Pos = MAP_APPFONT ( 5 , 21 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+
+ FixedText FT_MAILERURL
+ {
+ Pos = MAP_APPFONT ( 14 , 20 ) ;
+ Size = MAP_APPFONT ( 43 , 8 ) ;
+ Text [ en-US ] = "~E-mail program";
+ };
+
+ Edit ED_MAILERURL
+ {
+ Pos = MAP_APPFONT ( 60 , 18 ) ;
+ Size = MAP_APPFONT ( 171 , 12 ) ;
+ Border = TRUE;
+ };
+
+ PushButton PB_MAILERURL
+ {
+ Pos = MAP_APPFONT ( 234 , 17 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ Text = "..." ;
+ };
+
+ String STR_DEFAULT_FILENAME
+ {
+ Text [ en-US ] = "All files (*.*)" ;
+ };
+};
+
+ // ******************************************************************* EOF
+
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
new file mode 100644
index 000000000000..fdc36dadbbb7
--- /dev/null
+++ b/cui/source/options/optjava.cxx
@@ -0,0 +1,1138 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optjava.cxx,v $
+ * $Revision: 1.21 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include "optjava.hxx"
+#include <dialmgr.hxx>
+
+#include "optjava.hrc"
+#include <cuires.hrc>
+#include "helpid.hrc"
+#include <vcl/svapp.hxx>
+#include <vcl/help.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/waitobj.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svtools/imagemgr.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <ucbhelper/contentbroker.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#include <jvmfwk/framework.h>
+
+// define ----------------------------------------------------------------
+
+#define CLASSPATH_DELIMITER SAL_PATHSEPARATOR
+#define STRIM( s ) s.EraseLeadingChars().EraseTrailingChars()
+#define BUTTON_BORDER 2
+#define RESET_TIMEOUT 300
+
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::ucb;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star::uno;
+
+// class SvxJavaTable ----------------------------------------------------
+
+SvxJavaTable::SvxJavaTable( Window* _pParent, const ResId& _rId ) :
+
+ SvxSimpleTable( _pParent, _rId )
+
+{
+}
+
+SvxJavaTable::~SvxJavaTable()
+{
+}
+
+void SvxJavaTable::SetTabs()
+{
+ SvxSimpleTable::SetTabs();
+/*
+ USHORT nAdjust = SV_LBOXTAB_ADJUST_RIGHT | SV_LBOXTAB_ADJUST_LEFT |
+ SV_LBOXTAB_ADJUST_CENTER | SV_LBOXTAB_ADJUST_NUMERIC | SV_LBOXTAB_FORCE;
+ if ( aTabs.Count() > 0 )
+ {
+ SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(0);
+ pTab->nFlags &= ~nAdjust;
+ pTab->nFlags |= SV_LBOXTAB_PUSHABLE | SV_LBOXTAB_ADJUST_CENTER | SV_LBOXTAB_FORCE;
+ }
+*/
+}
+
+void SvxJavaTable::MouseButtonUp( const MouseEvent& _rMEvt )
+{
+ m_aCurMousePoint = _rMEvt.GetPosPixel();
+ SvxSimpleTable::MouseButtonUp( _rMEvt );
+}
+
+void SvxJavaTable::KeyInput( const KeyEvent& rKEvt )
+{
+ if ( !rKEvt.GetKeyCode().GetModifier() && KEY_SPACE == rKEvt.GetKeyCode().GetCode() )
+ {
+ SvLBoxEntry* pEntry = FirstSelected();
+ if ( GetCheckButtonState( pEntry ) == SV_BUTTON_UNCHECKED )
+ {
+ SetCheckButtonState( pEntry, SV_BUTTON_CHECKED );
+ GetCheckButtonHdl().Call( NULL );
+ return ;
+ }
+ }
+
+ SvxSimpleTable::KeyInput( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+bool areListsEqual( const Sequence< ::rtl::OUString >& rListA, const Sequence< ::rtl::OUString >& rListB )
+{
+ bool bRet = true;
+ const sal_Int32 nLen = rListA.getLength();
+
+ if ( rListB.getLength() != nLen )
+ bRet = false;
+ else
+ {
+ const ::rtl::OUString* pStringA = rListA.getConstArray();
+ const ::rtl::OUString* pStringB = rListB.getConstArray();
+
+ for ( sal_Int32 i = 0; i < nLen; ++i )
+ {
+ if ( *pStringA++ != *pStringB++ )
+ {
+ bRet = false;
+ break;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// class SvxJavaOptionsPage ----------------------------------------------
+
+SvxJavaOptionsPage::SvxJavaOptionsPage( Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_OPTIONS_JAVA ), rSet ),
+
+ m_aJavaLine ( this, CUI_RES( FL_JAVA ) ),
+ m_aJavaEnableCB ( this, CUI_RES( CB_JAVA_ENABLE ) ),
+ m_aJavaFoundLabel ( this, CUI_RES( FT_JAVA_FOUND ) ),
+ m_aJavaList ( this, CUI_RES( LB_JAVA ) ),
+ m_aJavaPathText ( this, CUI_RES( FT_JAVA_PATH ) ),
+ m_aAddBtn ( this, CUI_RES( PB_ADD ) ),
+ m_aParameterBtn ( this, CUI_RES( PB_PARAMETER ) ),
+ m_aClassPathBtn ( this, CUI_RES( PB_CLASSPATH ) ),
+
+ m_pParamDlg ( NULL ),
+ m_pPathDlg ( NULL ),
+ m_parJavaInfo ( NULL ),
+ m_parParameters ( NULL ),
+ m_pClassPath ( NULL ),
+ m_nInfoSize ( 0 ),
+ m_nParamSize ( 0 ),
+ m_sInstallText ( CUI_RES( STR_INSTALLED_IN ) ),
+ m_sAccessibilityText( CUI_RES( STR_ACCESSIBILITY ) ),
+ m_sAddDialogText ( CUI_RES( STR_ADDDLGTEXT ) ),
+
+ xDialogListener ( new ::svt::DialogClosedListener() )
+
+{
+ m_aJavaEnableCB.SetClickHdl( LINK( this, SvxJavaOptionsPage, EnableHdl_Impl ) );
+ m_aJavaList.SetCheckButtonHdl( LINK( this, SvxJavaOptionsPage, CheckHdl_Impl ) );
+ m_aJavaList.SetSelectHdl( LINK( this, SvxJavaOptionsPage, SelectHdl_Impl ) );
+ m_aAddBtn.SetClickHdl( LINK( this, SvxJavaOptionsPage, AddHdl_Impl ) );
+ m_aParameterBtn.SetClickHdl( LINK( this, SvxJavaOptionsPage, ParameterHdl_Impl ) );
+ m_aClassPathBtn.SetClickHdl( LINK( this, SvxJavaOptionsPage, ClassPathHdl_Impl ) );
+ m_aResetTimer.SetTimeoutHdl( LINK( this, SvxJavaOptionsPage, ResetHdl_Impl ) );
+ m_aResetTimer.SetTimeout( RESET_TIMEOUT );
+
+//! m_aJavaList.EnableCheckButton( new SvLBoxButtonData( &m_aJavaList, true ) );
+
+ static long aStaticTabs[]=
+ {
+ 5, 0, 15, 90, 130, 300
+ };
+
+ m_aJavaList.SvxSimpleTable::SetTabs( aStaticTabs );
+ String sHeader( '\t' );
+ sHeader += String( CUI_RES( STR_HEADER_VENDOR ) );
+ sHeader += '\t';
+ sHeader += String( CUI_RES( STR_HEADER_VERSION ) );
+ sHeader += '\t';
+ sHeader += String( CUI_RES( STR_HEADER_FEATURES ) );
+ sHeader += '\t';
+ m_aJavaList.InsertHeaderEntry( sHeader, HEADERBAR_APPEND, HIB_LEFT );
+
+ m_aJavaList.SetHelpId( HID_OPTIONS_JAVA_LIST );
+
+ FreeResource();
+
+ xDialogListener->SetDialogClosedLink( LINK( this, SvxJavaOptionsPage, DialogClosedHdl ) );
+
+ EnableHdl_Impl( &m_aJavaEnableCB );
+ jfw_lock();
+
+ //check if the text fits into the class path button
+ Size aButtonSize = m_aClassPathBtn.GetOutputSizePixel();
+ sal_Int32 nTextWidth = m_aClassPathBtn.GetTextWidth(m_aClassPathBtn.GetText());
+ //add some additional space
+ sal_Int32 nDiff = nTextWidth + 4 - aButtonSize.Width();
+ if( nDiff > 0)
+ {
+ Point aPos(m_aClassPathBtn.GetPosPixel());
+ aPos.X() -= nDiff;
+ aButtonSize.Width() += nDiff;
+ m_aClassPathBtn.SetPosSizePixel(aPos, aButtonSize);
+ aPos = m_aAddBtn.GetPosPixel();
+ aPos.X() -= nDiff;
+ m_aAddBtn.SetPosSizePixel(aPos, aButtonSize);
+ aPos = m_aParameterBtn.GetPosPixel();
+ aPos.X() -= nDiff;
+ m_aParameterBtn.SetPosSizePixel(aPos, aButtonSize);
+ Size aSize = m_aJavaList.GetSizePixel();
+ aSize.Width() -= nDiff;
+ m_aJavaList.SetSizePixel(aSize);
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SvxJavaOptionsPage::~SvxJavaOptionsPage()
+{
+ delete m_pParamDlg;
+ delete m_pPathDlg;
+ ClearJavaInfo();
+ std::vector< JavaInfo* >::iterator pIter;
+ for ( pIter = m_aAddedInfos.begin(); pIter != m_aAddedInfos.end(); ++pIter )
+ {
+ JavaInfo* pInfo = *pIter;
+ jfw_freeJavaInfo( pInfo );
+ }
+/*
+ rtl_uString** pParamArr = m_parParameters;
+ for ( sal_Int32 i = 0; i < m_nParamSize; ++i )
+ rtl_uString_release( *pParamArr++ );
+ rtl_freeMemory( m_parParameters );
+ rtl_uString_release( m_pClassPath );
+*/
+ jfw_unlock();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaOptionsPage, EnableHdl_Impl, CheckBox *, EMPTYARG )
+{
+ BOOL bEnable = m_aJavaEnableCB.IsChecked();
+ m_aJavaFoundLabel.Enable( bEnable );
+ m_aJavaPathText.Enable( bEnable );
+ m_aAddBtn.Enable( bEnable );
+ m_aParameterBtn.Enable( bEnable );
+ m_aClassPathBtn.Enable( bEnable );
+
+ bEnable ? m_aJavaList.EnableTable() : m_aJavaList.DisableTable();
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaOptionsPage, CheckHdl_Impl, SvxSimpleTable *, pList )
+{
+ SvLBoxEntry* pEntry = pList ? m_aJavaList.GetEntry( m_aJavaList.GetCurMousePoint() )
+ : m_aJavaList.FirstSelected();
+ if ( pEntry )
+ m_aJavaList.HandleEntryChecked( pEntry );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaOptionsPage, SelectHdl_Impl, SvxSimpleTable *, EMPTYARG )
+{
+ // set installation directory info
+ SvLBoxEntry* pEntry = m_aJavaList.FirstSelected();
+ DBG_ASSERT( pEntry, "SvxJavaOptionsPage::SelectHdl_Impl(): no entry" );
+ String* pLocation = static_cast< String* >( pEntry->GetUserData() );
+ DBG_ASSERT( pLocation, "invalid location string" );
+ String sInfo = m_sInstallText;
+ if ( pLocation )
+ sInfo += *pLocation;
+ m_aJavaPathText.SetText( sInfo );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaOptionsPage, AddHdl_Impl, PushButton *, EMPTYARG )
+{
+ try
+ {
+ Reference < XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ xFolderPicker = Reference< XFolderPicker >(
+ xMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.FolderPicker" ) ), UNO_QUERY );
+
+ String sWorkFolder = SvtPathOptions().GetWorkPath();
+ xFolderPicker->setDisplayDirectory( sWorkFolder );
+ xFolderPicker->setDescription( m_sAddDialogText );
+
+ Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY );
+ if ( xAsyncDlg.is() )
+ xAsyncDlg->startExecuteModal( xDialogListener.get() );
+ else if ( xFolderPicker.is() && xFolderPicker->execute() == ExecutableDialogResults::OK )
+ AddFolder( xFolderPicker->getDirectory() );
+ }
+ catch ( Exception& )
+ {
+#ifdef DBG_UTIL
+ DBG_ERRORFILE( "SvxJavaOptionsPage::AddHdl_Impl(): caught exception" );
+#endif
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaOptionsPage, ParameterHdl_Impl, PushButton *, EMPTYARG )
+{
+ Sequence< ::rtl::OUString > aParameterList;
+ if ( !m_pParamDlg )
+ {
+ m_pParamDlg = new SvxJavaParameterDlg( this );
+ javaFrameworkError eErr = jfw_getVMParameters( &m_parParameters, &m_nParamSize );
+ if ( JFW_E_NONE == eErr && m_parParameters && m_nParamSize > 0 )
+ {
+ rtl_uString** pParamArr = m_parParameters;
+ aParameterList.realloc( m_nParamSize );
+ ::rtl::OUString* pParams = aParameterList.getArray();
+ for ( sal_Int32 i = 0; i < m_nParamSize; ++i )
+ {
+ rtl_uString* pParam = *pParamArr++;
+ pParams[i] = ::rtl::OUString( pParam );
+ }
+ m_pParamDlg->SetParameters( aParameterList );
+ }
+ }
+ else
+ aParameterList = m_pParamDlg->GetParameters();
+
+ if ( m_pParamDlg->Execute() == RET_OK )
+ {
+ if ( !areListsEqual( aParameterList, m_pParamDlg->GetParameters() ) )
+ {
+ aParameterList = m_pParamDlg->GetParameters();
+ sal_Bool bRunning = sal_False;
+ javaFrameworkError eErr = jfw_isVMRunning( &bRunning );
+ DBG_ASSERT( JFW_E_NONE == eErr,
+ "SvxJavaOptionsPage::ParameterHdl_Impl(): error in jfw_isVMRunning" );
+ (void)eErr;
+ if ( bRunning )
+ {
+ WarningBox aWarnBox( this, CUI_RES( RID_SVX_MSGBOX_JAVA_RESTART2 ) );
+ aWarnBox.Execute();
+ }
+ }
+ }
+ else
+ m_pParamDlg->SetParameters( aParameterList );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaOptionsPage, ClassPathHdl_Impl, PushButton *, EMPTYARG )
+{
+ String sClassPath;
+
+ if ( !m_pPathDlg )
+ {
+ m_pPathDlg = new SvxJavaClassPathDlg( this );
+ javaFrameworkError eErr = jfw_getUserClassPath( &m_pClassPath );
+ if ( JFW_E_NONE == eErr && m_pClassPath )
+ {
+ sClassPath = String( ::rtl::OUString( m_pClassPath ) );
+ m_pPathDlg->SetClassPath( sClassPath );
+ }
+ }
+ else
+ sClassPath = m_pPathDlg->GetClassPath();
+
+ m_pPathDlg->SetFocus();
+ if ( m_pPathDlg->Execute() == RET_OK )
+ {
+
+ if ( m_pPathDlg->GetClassPath() != sClassPath )
+ {
+ sClassPath = m_pPathDlg->GetClassPath();
+ sal_Bool bRunning = sal_False;
+ javaFrameworkError eErr = jfw_isVMRunning( &bRunning );
+ DBG_ASSERT( JFW_E_NONE == eErr,
+ "SvxJavaOptionsPage::ParameterHdl_Impl(): error in jfw_isVMRunning" );
+ (void)eErr;
+ if ( bRunning )
+ {
+ WarningBox aWarnBox( this, CUI_RES( RID_SVX_MSGBOX_JAVA_RESTART2 ) );
+ aWarnBox.Execute();
+ }
+ }
+ }
+ else
+ m_pPathDlg->SetClassPath( sClassPath );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaOptionsPage, ResetHdl_Impl, Timer *, EMPTYARG )
+{
+ LoadJREs();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaOptionsPage, StartFolderPickerHdl, void*, EMPTYARG )
+{
+ try
+ {
+ Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY );
+ if ( xAsyncDlg.is() )
+ xAsyncDlg->startExecuteModal( xDialogListener.get() );
+ else if ( xFolderPicker.is() && xFolderPicker->execute() == ExecutableDialogResults::OK )
+ AddFolder( xFolderPicker->getDirectory() );
+ }
+ catch ( Exception& )
+ {
+#ifdef DBG_UTIL
+ DBG_ERRORFILE( "SvxJavaOptionsPage::StartFolderPickerHdl(): caught exception" );
+#endif
+ }
+
+ return 0L;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaOptionsPage, DialogClosedHdl, DialogClosedEvent*, pEvt )
+{
+ if ( RET_OK == pEvt->DialogResult )
+ {
+ DBG_ASSERT( xFolderPicker.is() == sal_True, "SvxJavaOptionsPage::DialogClosedHdl(): no folder picker" );
+
+ AddFolder( xFolderPicker->getDirectory() );
+ }
+ return 0L;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxJavaOptionsPage::ClearJavaInfo()
+{
+ if ( m_parJavaInfo )
+ {
+ JavaInfo** parInfo = m_parJavaInfo;
+ for ( sal_Int32 i = 0; i < m_nInfoSize; ++i )
+ {
+ JavaInfo* pInfo = *parInfo++;
+ jfw_freeJavaInfo( pInfo );
+ }
+
+ rtl_freeMemory( m_parJavaInfo );
+ m_parJavaInfo = NULL;
+ m_nInfoSize = 0;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxJavaOptionsPage::ClearJavaList()
+{
+ SvLBoxEntry* pEntry = m_aJavaList.First();
+ while ( pEntry )
+ {
+ String* pLocation = static_cast< String* >( pEntry->GetUserData() );
+ delete pLocation;
+ pEntry = m_aJavaList.Next( pEntry );
+ }
+ m_aJavaList.Clear();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxJavaOptionsPage::LoadJREs()
+{
+ WaitObject aWaitObj( &m_aJavaList );
+ javaFrameworkError eErr = jfw_findAllJREs( &m_parJavaInfo, &m_nInfoSize );
+ if ( JFW_E_NONE == eErr && m_parJavaInfo )
+ {
+ JavaInfo** parInfo = m_parJavaInfo;
+ for ( sal_Int32 i = 0; i < m_nInfoSize; ++i )
+ {
+ JavaInfo* pInfo = *parInfo++;
+ AddJRE( pInfo );
+ }
+ }
+
+ std::vector< JavaInfo* >::iterator pIter;
+ for ( pIter = m_aAddedInfos.begin(); pIter != m_aAddedInfos.end(); ++pIter )
+ {
+ JavaInfo* pInfo = *pIter;
+ AddJRE( pInfo );
+ }
+
+ JavaInfo* pSelectedJava = NULL;
+ eErr = jfw_getSelectedJRE( &pSelectedJava );
+ if ( JFW_E_NONE == eErr && pSelectedJava )
+ {
+ JavaInfo** parInfo = m_parJavaInfo;
+ for ( sal_Int32 i = 0; i < m_nInfoSize; ++i )
+ {
+ JavaInfo* pCmpInfo = *parInfo++;
+ if ( jfw_areEqualJavaInfo( pCmpInfo, pSelectedJava ) )
+ {
+ SvLBoxEntry* pEntry = m_aJavaList.GetEntry(i);
+ if ( pEntry )
+ m_aJavaList.HandleEntryChecked( pEntry );
+ break;
+ }
+ }
+ }
+
+ jfw_freeJavaInfo( pSelectedJava );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxJavaOptionsPage::AddJRE( JavaInfo* _pInfo )
+{
+ String sEntry( '\t' );
+ sEntry += String( ::rtl::OUString( _pInfo->sVendor ) );
+ sEntry += '\t';
+ sEntry += String( ::rtl::OUString( _pInfo->sVersion ) );
+ sEntry += '\t';
+ if ( ( _pInfo->nFeatures & JFW_FEATURE_ACCESSBRIDGE ) == JFW_FEATURE_ACCESSBRIDGE )
+ sEntry += m_sAccessibilityText;
+ SvLBoxEntry* pEntry = m_aJavaList.InsertEntry( sEntry );
+ INetURLObject aLocObj( ::rtl::OUString( _pInfo->sLocation ) );
+ String* pLocation = new String( aLocObj.getFSysPath( INetURLObject::FSYS_DETECT ) );
+ pEntry->SetUserData( pLocation );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxJavaOptionsPage::HandleCheckEntry( SvLBoxEntry* _pEntry )
+{
+ m_aJavaList.Select( _pEntry, TRUE );
+ SvButtonState eState = m_aJavaList.GetCheckButtonState( _pEntry );
+
+ if ( SV_BUTTON_CHECKED == eState )
+ {
+ // we have radio button behavior -> so uncheck the other entries
+ SvLBoxEntry* pEntry = m_aJavaList.First();
+ while ( pEntry )
+ {
+ if ( pEntry != _pEntry )
+ m_aJavaList.SetCheckButtonState( pEntry, SV_BUTTON_UNCHECKED );
+ pEntry = m_aJavaList.Next( pEntry );
+ }
+ }
+ else
+ m_aJavaList.SetCheckButtonState( _pEntry, SV_BUTTON_CHECKED );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxJavaOptionsPage::AddFolder( const ::rtl::OUString& _rFolder )
+{
+ bool bStartAgain = true;
+ sal_Int32 nPos = 0;
+ JavaInfo* pInfo = NULL;
+ javaFrameworkError eErr = jfw_getJavaInfoByPath( _rFolder.pData, &pInfo );
+ if ( JFW_E_NONE == eErr && pInfo )
+ {
+ bool bFound = false;
+ JavaInfo** parInfo = m_parJavaInfo;
+ for ( sal_Int32 i = 0; i < m_nInfoSize; ++i )
+ {
+ JavaInfo* pCmpInfo = *parInfo++;
+ if ( jfw_areEqualJavaInfo( pCmpInfo, pInfo ) )
+ {
+ bFound = true;
+ nPos = i;
+ break;
+ }
+ }
+
+ if ( !bFound )
+ {
+ std::vector< JavaInfo* >::iterator pIter;
+ for ( pIter = m_aAddedInfos.begin(); pIter != m_aAddedInfos.end(); ++pIter )
+ {
+ JavaInfo* pCmpInfo = *pIter;
+ if ( jfw_areEqualJavaInfo( pCmpInfo, pInfo ) )
+ {
+ bFound = true;
+ break;
+ }
+ }
+ }
+
+ if ( !bFound )
+ {
+ jfw_addJRELocation( pInfo->sLocation );
+ AddJRE( pInfo );
+ m_aAddedInfos.push_back( pInfo );
+ nPos = m_aJavaList.GetEntryCount() - 1;
+ }
+ else
+ jfw_freeJavaInfo( pInfo );
+
+ SvLBoxEntry* pEntry = m_aJavaList.GetEntry( nPos );
+ m_aJavaList.Select( pEntry );
+ m_aJavaList.SetCheckButtonState( pEntry, SV_BUTTON_CHECKED );
+ HandleCheckEntry( pEntry );
+ bStartAgain = false;
+ }
+ else if ( JFW_E_NOT_RECOGNIZED == eErr )
+ {
+ ErrorBox aErrBox( this, CUI_RES( RID_SVXERR_JRE_NOT_RECOGNIZED ) );
+ aErrBox.Execute();
+ }
+ else if ( JFW_E_FAILED_VERSION == eErr )
+ {
+ ErrorBox aErrBox( this, CUI_RES( RID_SVXERR_JRE_FAILED_VERSION ) );
+ aErrBox.Execute();
+ }
+
+ if ( bStartAgain )
+ {
+ xFolderPicker->setDisplayDirectory( _rFolder );
+ Application::PostUserEvent( LINK( this, SvxJavaOptionsPage, StartFolderPickerHdl ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxJavaOptionsPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return ( new SvxJavaOptionsPage( pParent, rAttrSet ) );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxJavaOptionsPage::FillItemSet( SfxItemSet& /*rCoreSet*/ )
+{
+ BOOL bModified = FALSE;
+ javaFrameworkError eErr = JFW_E_NONE;
+ if ( m_pParamDlg )
+ {
+ Sequence< ::rtl::OUString > aParamList = m_pParamDlg->GetParameters();
+ sal_Int32 i, nSize = aParamList.getLength();
+ rtl_uString** pParamArr = (rtl_uString**)rtl_allocateMemory( sizeof(rtl_uString*) * nSize );
+ rtl_uString** pParamArrIter = pParamArr;
+ const ::rtl::OUString* pList = aParamList.getConstArray();
+ for ( i = 0; i < nSize; ++i )
+ pParamArr[i] = pList[i].pData;
+ eErr = jfw_setVMParameters( pParamArrIter, nSize );
+ DBG_ASSERT( JFW_E_NONE == eErr,
+ "SvxJavaOptionsPage::FillItemSet(): error in jfw_setVMParameters" );
+ pParamArrIter = pParamArr;
+ rtl_freeMemory( pParamArr );
+ bModified = TRUE;
+ }
+
+ if ( m_pPathDlg )
+ {
+ ::rtl::OUString sPath( m_pPathDlg->GetClassPath() );
+ if ( m_pPathDlg->GetOldPath() != String( sPath ) )
+ {
+ eErr = jfw_setUserClassPath( sPath.pData );
+ DBG_ASSERT( JFW_E_NONE == eErr,
+ "SvxJavaOptionsPage::FillItemSet(): error in jfw_setUserClassPath" );
+ bModified = TRUE;
+ }
+ }
+
+ ULONG nCount = m_aJavaList.GetEntryCount();
+ for ( ULONG i = 0; i < nCount; ++i )
+ {
+ if ( m_aJavaList.GetCheckButtonState( m_aJavaList.GetEntry(i) ) == SV_BUTTON_CHECKED )
+ {
+ JavaInfo* pInfo = NULL;
+ if ( i < static_cast< ULONG >( m_nInfoSize ) )
+ pInfo = m_parJavaInfo[i];
+ else
+ pInfo = m_aAddedInfos[ i - m_nInfoSize ];
+
+ JavaInfo* pSelectedJava = NULL;
+ eErr = jfw_getSelectedJRE( &pSelectedJava );
+ if ( JFW_E_NONE == eErr || JFW_E_INVALID_SETTINGS == eErr )
+ {
+ if (pSelectedJava == NULL || !jfw_areEqualJavaInfo( pInfo, pSelectedJava ) )
+ {
+ sal_Bool bRunning = sal_False;
+ eErr = jfw_isVMRunning( &bRunning );
+ DBG_ASSERT( JFW_E_NONE == eErr,
+ "SvxJavaOptionsPage::FillItemSet(): error in jfw_isVMRunning" );
+ if ( bRunning ||
+ ( ( pInfo->nRequirements & JFW_REQUIRE_NEEDRESTART ) == JFW_REQUIRE_NEEDRESTART ) )
+ {
+ WarningBox aWarnBox( this, CUI_RES( RID_SVX_MSGBOX_JAVA_RESTART ) );
+ aWarnBox.Execute();
+ }
+
+ eErr = jfw_setSelectedJRE( pInfo );
+ DBG_ASSERT( JFW_E_NONE == eErr,
+ "SvxJavaOptionsPage::FillItemSet(): error in jfw_setSelectedJRE" );
+ bModified = TRUE;
+ }
+ }
+ jfw_freeJavaInfo( pSelectedJava );
+ break;
+ }
+ }
+
+ sal_Bool bEnabled = sal_False;
+ eErr = jfw_getEnabled( &bEnabled );
+ DBG_ASSERT( JFW_E_NONE == eErr,
+ "SvxJavaOptionsPage::FillItemSet(): error in jfw_getEnabled" );
+ if ( bEnabled != m_aJavaEnableCB.IsChecked() )
+ {
+ eErr = jfw_setEnabled( m_aJavaEnableCB.IsChecked() );
+ DBG_ASSERT( JFW_E_NONE == eErr,
+ "SvxJavaOptionsPage::FillItemSet(): error in jfw_setEnabled" );
+ bModified = TRUE;
+ }
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxJavaOptionsPage::Reset( const SfxItemSet& /*rSet*/ )
+{
+ ClearJavaInfo();
+ ClearJavaList();
+
+ sal_Bool bEnabled = sal_False;
+ javaFrameworkError eErr = jfw_getEnabled( &bEnabled );
+ if ( eErr != JFW_E_NONE )
+ bEnabled = sal_False;
+ m_aJavaEnableCB.Check( bEnabled );
+ EnableHdl_Impl( &m_aJavaEnableCB );
+
+ m_aResetTimer.Start();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxJavaOptionsPage::FillUserData()
+{
+ String aUserData;
+ SetUserData( aUserData );
+}
+
+// class SvxJavaParameterDlg ---------------------------------------------
+
+SvxJavaParameterDlg::SvxJavaParameterDlg( Window* pParent ) :
+
+ ModalDialog( pParent, CUI_RES( RID_SVXDLG_JAVA_PARAMETER ) ),
+
+ m_aParameterLabel ( this, CUI_RES( FT_PARAMETER ) ),
+ m_aParameterEdit ( this, CUI_RES( ED_PARAMETER ) ),
+ m_aAssignBtn ( this, CUI_RES( PB_ASSIGN ) ),
+ m_aAssignedLabel ( this, CUI_RES( FT_ASSIGNED ) ),
+ m_aAssignedList ( this, CUI_RES( LB_ASSIGNED ) ),
+ m_aExampleText ( this, CUI_RES( FT_EXAMPLE ) ),
+ m_aRemoveBtn ( this, CUI_RES( PB_REMOVE ) ),
+ m_aButtonsLine ( this, CUI_RES( FL_BUTTONS ) ),
+ m_aOKBtn ( this, CUI_RES( PB_PARAMETER_OK ) ),
+ m_aCancelBtn ( this, CUI_RES( PB_PARAMETER_ESC ) ),
+ m_aHelpBtn ( this, CUI_RES( PB_PARAMETER_HLP ) )
+
+{
+ FreeResource();
+
+ m_aParameterEdit.SetModifyHdl( LINK( this, SvxJavaParameterDlg, ModifyHdl_Impl ) );
+ m_aAssignBtn.SetClickHdl( LINK( this, SvxJavaParameterDlg, AssignHdl_Impl ) );
+ m_aRemoveBtn.SetClickHdl( LINK( this, SvxJavaParameterDlg, RemoveHdl_Impl ) );
+ m_aAssignedList.SetSelectHdl( LINK( this, SvxJavaParameterDlg, SelectHdl_Impl ) );
+ m_aAssignedList.SetDoubleClickHdl( LINK( this, SvxJavaParameterDlg, DblClickHdl_Impl ) );
+
+ ModifyHdl_Impl( &m_aParameterEdit );
+ EnableRemoveButton();
+}
+
+// -----------------------------------------------------------------------
+
+SvxJavaParameterDlg::~SvxJavaParameterDlg()
+{
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaParameterDlg, ModifyHdl_Impl, Edit *, EMPTYARG )
+{
+ String sParam = STRIM( m_aParameterEdit.GetText() );
+ m_aAssignBtn.Enable( sParam.Len() > 0 );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaParameterDlg, AssignHdl_Impl, PushButton *, EMPTYARG )
+{
+ String sParam = STRIM( m_aParameterEdit.GetText() );
+ if ( sParam.Len() > 0 )
+ {
+ USHORT nPos = m_aAssignedList.GetEntryPos( sParam );
+ if ( LISTBOX_ENTRY_NOTFOUND == nPos )
+ nPos = m_aAssignedList.InsertEntry( sParam );
+ m_aAssignedList.SelectEntryPos( nPos );
+ m_aParameterEdit.SetText( String() );
+ ModifyHdl_Impl( &m_aParameterEdit );
+ EnableRemoveButton();
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaParameterDlg, SelectHdl_Impl, ListBox *, EMPTYARG )
+{
+ EnableRemoveButton();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaParameterDlg, DblClickHdl_Impl, ListBox *, EMPTYARG )
+{
+ USHORT nPos = m_aAssignedList.GetSelectEntryPos();
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ m_aParameterEdit.SetText( m_aAssignedList.GetEntry( nPos ) );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaParameterDlg, RemoveHdl_Impl, PushButton *, EMPTYARG )
+{
+ USHORT nPos = m_aAssignedList.GetSelectEntryPos();
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ m_aAssignedList.RemoveEntry( nPos );
+ USHORT nCount = m_aAssignedList.GetEntryCount();
+ if ( nCount )
+ {
+ if ( nPos >= nCount )
+ nPos = ( nCount - 1 );
+ m_aAssignedList.SelectEntryPos( nPos );
+ }
+ }
+ EnableRemoveButton();
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+short SvxJavaParameterDlg::Execute()
+{
+ m_aParameterEdit.GrabFocus();
+ m_aAssignedList.SetNoSelection();
+ return ModalDialog::Execute();
+}
+
+// -----------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > SvxJavaParameterDlg::GetParameters() const
+{
+ USHORT nCount = m_aAssignedList.GetEntryCount();
+ Sequence< ::rtl::OUString > aParamList( nCount );
+ ::rtl::OUString* pArray = aParamList.getArray();
+ for ( USHORT i = 0; i < nCount; ++i )
+ pArray[i] = ::rtl::OUString( m_aAssignedList.GetEntry(i) );
+ return aParamList;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxJavaParameterDlg::SetParameters( Sequence< ::rtl::OUString >& rParams )
+{
+ m_aAssignedList.Clear();
+ ULONG i, nCount = rParams.getLength();
+ const ::rtl::OUString* pArray = rParams.getConstArray();
+ for ( i = 0; i < nCount; ++i )
+ {
+ String sParam = String( *pArray++ );
+ m_aAssignedList.InsertEntry( sParam );
+ }
+}
+
+// class SvxJavaClassPathDlg ---------------------------------------------
+
+SvxJavaClassPathDlg::SvxJavaClassPathDlg( Window* pParent ) :
+
+ ModalDialog( pParent, CUI_RES( RID_SVXDLG_JAVA_CLASSPATH ) ),
+
+ m_aPathLabel ( this, CUI_RES( FT_PATH ) ),
+ m_aPathList ( this, CUI_RES( LB_PATH ) ),
+ m_aAddArchiveBtn ( this, CUI_RES( PB_ADDARCHIVE ) ),
+ m_aAddPathBtn ( this, CUI_RES( PB_ADDPATH ) ),
+ m_aRemoveBtn ( this, CUI_RES( PB_REMOVE_PATH ) ),
+ m_aButtonsLine ( this, CUI_RES( FL_PATH_BUTTONS ) ),
+ m_aOKBtn ( this, CUI_RES( PB_PATH_OK ) ),
+ m_aCancelBtn ( this, CUI_RES( PB_PATH_ESC ) ),
+ m_aHelpBtn ( this, CUI_RES( PB_PATH_HLP ) )
+
+{
+ FreeResource();
+
+ m_aAddArchiveBtn.SetClickHdl( LINK( this, SvxJavaClassPathDlg, AddArchiveHdl_Impl ) );
+ m_aAddPathBtn.SetClickHdl( LINK( this, SvxJavaClassPathDlg, AddPathHdl_Impl ) );
+ m_aRemoveBtn.SetClickHdl( LINK( this, SvxJavaClassPathDlg, RemoveHdl_Impl ) );
+ m_aPathList.SetSelectHdl( LINK( this, SvxJavaClassPathDlg, SelectHdl_Impl ) );
+
+ // check if the buttons text are not too wide otherwise we have to stretch the buttons
+ // and shrink the listbox
+ long nTxtWidth1 = m_aAddArchiveBtn.GetTextWidth( m_aAddArchiveBtn.GetText() );
+ long nTxtWidth2 = m_aAddPathBtn.GetTextWidth( m_aAddPathBtn.GetText() );
+ Size aBtnSz = m_aAddArchiveBtn.GetSizePixel();
+ if ( nTxtWidth1 > aBtnSz.Width() || nTxtWidth2 > aBtnSz.Width() )
+ {
+ long nW = ( nTxtWidth1 > aBtnSz.Width() ) ? nTxtWidth1 : nTxtWidth2;
+ long nDelta = nW - aBtnSz.Width() + 2 * BUTTON_BORDER;
+ aBtnSz.Width() += nDelta;
+ Point aBtnPnt = m_aAddArchiveBtn.GetPosPixel();
+ aBtnPnt.X() -= nDelta;
+ m_aAddArchiveBtn.SetPosSizePixel( aBtnPnt, aBtnSz );
+ aBtnPnt = m_aAddPathBtn.GetPosPixel();
+ aBtnPnt.X() -= nDelta;
+ m_aAddPathBtn.SetPosSizePixel( aBtnPnt, aBtnSz );
+ aBtnPnt = m_aRemoveBtn.GetPosPixel();
+ aBtnPnt.X() -= nDelta;
+ m_aRemoveBtn.SetPosSizePixel( aBtnPnt, aBtnSz );
+ Size aBoxSz = m_aPathList.GetSizePixel();
+ aBoxSz.Width() -= nDelta;
+ m_aPathList.SetSizePixel( aBoxSz );
+ }
+
+ // set initial focus to path list
+ m_aPathList.GrabFocus();
+}
+
+// -----------------------------------------------------------------------
+
+SvxJavaClassPathDlg::~SvxJavaClassPathDlg()
+{
+ USHORT i, nCount = m_aPathList.GetEntryCount();
+ for ( i = 0; i < nCount; ++i )
+ delete static_cast< String* >( m_aPathList.GetEntryData(i) );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaClassPathDlg, AddArchiveHdl_Impl, PushButton *, EMPTYARG )
+{
+ sfx2::FileDialogHelper aDlg( TemplateDescription::FILEOPEN_SIMPLE, 0 );
+ aDlg.SetTitle( CUI_RES( RID_SVXSTR_ARCHIVE_TITLE ) );
+ aDlg.AddFilter( CUI_RES( RID_SVXSTR_ARCHIVE_HEADLINE ), String::CreateFromAscii("*.jar;*.zip") );
+ String sFolder;
+ if ( m_aPathList.GetSelectEntryCount() > 0 )
+ {
+ INetURLObject aObj( m_aPathList.GetSelectEntry(), INetURLObject::FSYS_DETECT );
+ sFolder = aObj.GetMainURL( INetURLObject::NO_DECODE );
+ }
+ else
+ sFolder = SvtPathOptions().GetWorkPath();
+ aDlg.SetDisplayDirectory( sFolder );
+ if ( aDlg.Execute() == ERRCODE_NONE )
+ {
+ String sURL = aDlg.GetPath();
+ INetURLObject aURL( sURL );
+ String sFile = aURL.getFSysPath( INetURLObject::FSYS_DETECT );
+ if ( !IsPathDuplicate( sURL ) )
+ {
+ USHORT nPos = m_aPathList.InsertEntry( sFile, SvFileInformationManager::GetImage( aURL ) );
+ m_aPathList.SelectEntryPos( nPos );
+ }
+ else
+ {
+ String sMsg( CUI_RES( RID_SVXSTR_MULTIFILE_DBL_ERR ) );
+ sMsg.SearchAndReplaceAscii( "%1", sFile );
+ ErrorBox( this, WB_OK, sMsg ).Execute();
+ }
+ }
+ EnableRemoveButton();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaClassPathDlg, AddPathHdl_Impl, PushButton *, EMPTYARG )
+{
+ rtl::OUString sService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FolderPicker" ) );
+ Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ Reference < XFolderPicker > xFolderPicker( xFactory->createInstance( sService ), UNO_QUERY );
+
+ String sOldFolder;
+ if ( m_aPathList.GetSelectEntryCount() > 0 )
+ {
+ INetURLObject aObj( m_aPathList.GetSelectEntry(), INetURLObject::FSYS_DETECT );
+ sOldFolder = aObj.GetMainURL( INetURLObject::NO_DECODE );
+ }
+ else
+ sOldFolder = SvtPathOptions().GetWorkPath();
+ xFolderPicker->setDisplayDirectory( sOldFolder );
+ if ( xFolderPicker->execute() == ExecutableDialogResults::OK )
+ {
+ String sFolderURL( xFolderPicker->getDirectory() );
+ INetURLObject aURL( sFolderURL );
+ String sNewFolder = aURL.getFSysPath( INetURLObject::FSYS_DETECT );
+ if ( !IsPathDuplicate( sFolderURL ) )
+ {
+ USHORT nPos = m_aPathList.InsertEntry( sNewFolder, SvFileInformationManager::GetImage( aURL ) );
+ m_aPathList.SelectEntryPos( nPos );
+ }
+ else
+ {
+ String sMsg( CUI_RES( RID_SVXSTR_MULTIFILE_DBL_ERR ) );
+ sMsg.SearchAndReplaceAscii( "%1", sNewFolder );
+ ErrorBox( this, WB_OK, sMsg ).Execute();
+ }
+ }
+ EnableRemoveButton();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaClassPathDlg, RemoveHdl_Impl, PushButton *, EMPTYARG )
+{
+ USHORT nPos = m_aPathList.GetSelectEntryPos();
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ m_aPathList.RemoveEntry( nPos );
+ USHORT nCount = m_aPathList.GetEntryCount();
+ if ( nCount )
+ {
+ if ( nPos >= nCount )
+ nPos = ( nCount - 1 );
+ m_aPathList.SelectEntryPos( nPos );
+ }
+ }
+
+ EnableRemoveButton();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxJavaClassPathDlg, SelectHdl_Impl, ListBox *, EMPTYARG )
+{
+ EnableRemoveButton();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+bool SvxJavaClassPathDlg::IsPathDuplicate( const String& _rPath )
+{
+ bool bRet = false;
+ INetURLObject aFileObj( _rPath );
+ USHORT nCount = m_aPathList.GetEntryCount();
+ for ( USHORT i = 0; i < nCount; ++i )
+ {
+ INetURLObject aOtherObj( m_aPathList.GetEntry(i), INetURLObject::FSYS_DETECT );
+ if ( aOtherObj == aFileObj )
+ {
+ bRet = true;
+ break;
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+String SvxJavaClassPathDlg::GetClassPath() const
+{
+ String sPath;
+ USHORT nCount = m_aPathList.GetEntryCount();
+ for ( USHORT i = 0; i < nCount; ++i )
+ {
+ if ( sPath.Len() > 0 )
+ sPath += CLASSPATH_DELIMITER;
+ String* pFullPath = static_cast< String* >( m_aPathList.GetEntryData(i) );
+ if ( pFullPath )
+ sPath += *pFullPath;
+ else
+ sPath += m_aPathList.GetEntry(i);
+ }
+ return sPath;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxJavaClassPathDlg::SetClassPath( const String& _rPath )
+{
+ if ( m_sOldPath.Len() == 0 )
+ m_sOldPath = _rPath;
+ m_aPathList.Clear();
+ xub_StrLen i, nIdx = 0;
+ xub_StrLen nCount = _rPath.GetTokenCount( CLASSPATH_DELIMITER );
+ for ( i = 0; i < nCount; ++i )
+ {
+ String sToken = _rPath.GetToken( 0, CLASSPATH_DELIMITER, nIdx );
+ INetURLObject aURL( sToken, INetURLObject::FSYS_DETECT );
+ String sPath = aURL.getFSysPath( INetURLObject::FSYS_DETECT );
+ m_aPathList.InsertEntry( sPath, SvFileInformationManager::GetImage( aURL ) );
+ }
+ // select first entry
+ m_aPathList.SelectEntryPos(0);
+ SelectHdl_Impl( NULL );
+}
+
diff --git a/cui/source/options/optjava.hrc b/cui/source/options/optjava.hrc
new file mode 100644
index 000000000000..ac4b0108cc47
--- /dev/null
+++ b/cui/source/options/optjava.hrc
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optjava.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTJAVA_HRC
+#define _SVX_OPTJAVA_HRC
+
+// defines ---------------------------------------------------------------
+
+// class SvxJavaOptionsPage ----------------------------------------------
+
+#define FL_JAVA 10
+#define CB_JAVA_ENABLE 11
+#define FT_JAVA_FOUND 12
+#define LB_JAVA 13
+#define FT_JAVA_PATH 14
+
+#define PB_ADD 20
+#define PB_PARAMETER 21
+#define PB_CLASSPATH 22
+
+#define STR_INSTALLED_IN 30
+#define STR_ACCESSIBILITY 31
+#define STR_ADDDLGTEXT 32
+
+#define STR_HEADER_VENDOR 40
+#define STR_HEADER_VERSION 41
+#define STR_HEADER_FEATURES 42
+
+// class SvxJavaParameterDlg ---------------------------------------------
+
+#define FT_PARAMETER 10
+#define ED_PARAMETER 11
+#define PB_ASSIGN 12
+
+#define FT_ASSIGNED 20
+#define LB_ASSIGNED 21
+#define FT_EXAMPLE 22
+#define PB_REMOVE 23
+
+#define FL_BUTTONS 30
+#define PB_PARAMETER_OK 31
+#define PB_PARAMETER_ESC 32
+#define PB_PARAMETER_HLP 33
+
+// class SvxJavaClassPathDlg ---------------------------------------------
+
+#define FT_PATH 10
+#define LB_PATH 11
+
+#define PB_ADDARCHIVE 20
+#define PB_ADDPATH 21
+#define PB_REMOVE_PATH 22
+
+#define FL_PATH_BUTTONS 30
+#define PB_PATH_OK 31
+#define PB_PATH_ESC 32
+#define PB_PATH_HLP 33
+
+#endif // #ifndef _SVX_OPTJAVA_HRC
+
diff --git a/cui/source/options/optjava.hxx b/cui/source/options/optjava.hxx
new file mode 100644
index 000000000000..2b2ac090ca07
--- /dev/null
+++ b/cui/source/options/optjava.hxx
@@ -0,0 +1,217 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optjava.hxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTJAVA_HXX
+#define _SVX_OPTJAVA_HXX
+
+// include ---------------------------------------------------------------
+
+#include <vector>
+#include <ucbhelper/content.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/timer.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svx/simptabl.hxx>
+#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
+#include <svtools/dialogclosedlistener.hxx>
+#include "radiobtnbox.hxx"
+
+// forward ---------------------------------------------------------------
+
+typedef struct _JavaInfo JavaInfo;
+
+class SvxJavaParameterDlg;
+class SvxJavaClassPathDlg;
+
+// class SvxJavaTable ----------------------------------------------------
+
+class SvxJavaTable : public SvxSimpleTable
+{
+ using SvxSimpleTable::SetTabs;
+private:
+ Point m_aCurMousePoint;
+
+protected:
+ virtual void SetTabs();
+ virtual void MouseButtonUp( const MouseEvent& _rMEvt );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+public:
+ SvxJavaTable( Window* _pParent, const ResId& _rId );
+ ~SvxJavaTable();
+
+
+ inline Point GetCurMousePoint() { return m_aCurMousePoint; }
+};
+
+// class SvxJavaOptionsPage ----------------------------------------------
+
+class SvxJavaOptionsPage : public SfxTabPage
+{
+private:
+ FixedLine m_aJavaLine;
+ CheckBox m_aJavaEnableCB;
+ FixedText m_aJavaFoundLabel;
+ svx::SvxRadioButtonListBox m_aJavaList;
+ FixedText m_aJavaPathText;
+ PushButton m_aAddBtn;
+ PushButton m_aParameterBtn;
+ PushButton m_aClassPathBtn;
+
+ SvxJavaParameterDlg* m_pParamDlg;
+ SvxJavaClassPathDlg* m_pPathDlg;
+
+ JavaInfo** m_parJavaInfo;
+ rtl_uString** m_parParameters;
+ rtl_uString* m_pClassPath;
+ sal_Int32 m_nInfoSize;
+ sal_Int32 m_nParamSize;
+ String m_sInstallText;
+ String m_sAccessibilityText;
+ String m_sAddDialogText;
+ Timer m_aResetTimer;
+
+ ::std::vector< JavaInfo* >
+ m_aAddedInfos;
+
+ ::com::sun::star::uno::Reference< ::svt::DialogClosedListener > xDialogListener;
+ ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker > xFolderPicker;
+
+ DECL_LINK( EnableHdl_Impl, CheckBox * );
+ DECL_LINK( CheckHdl_Impl, SvxSimpleTable * );
+ DECL_LINK( SelectHdl_Impl, SvxSimpleTable * );
+ DECL_LINK( AddHdl_Impl, PushButton * );
+ DECL_LINK( ParameterHdl_Impl, PushButton * );
+ DECL_LINK( ClassPathHdl_Impl, PushButton * );
+ DECL_LINK( ResetHdl_Impl, Timer * );
+
+ DECL_LINK( StartFolderPickerHdl, void * );
+ DECL_LINK( DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent* );
+
+ void ClearJavaInfo();
+ void ClearJavaList();
+ void LoadJREs();
+ void AddJRE( JavaInfo* _pInfo );
+ void HandleCheckEntry( SvLBoxEntry* _pEntry );
+ void AddFolder( const ::rtl::OUString& _rFolder );
+
+public:
+ SvxJavaOptionsPage( Window* pParent, const SfxItemSet& rSet );
+ ~SvxJavaOptionsPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual void FillUserData();
+};
+
+// class SvxJavaParameterDlg ---------------------------------------------
+
+class SvxJavaParameterDlg : public ModalDialog
+{
+private:
+ FixedText m_aParameterLabel;
+ Edit m_aParameterEdit;
+ PushButton m_aAssignBtn;
+
+ FixedText m_aAssignedLabel;
+ ListBox m_aAssignedList;
+ FixedText m_aExampleText;
+ PushButton m_aRemoveBtn;
+
+ FixedLine m_aButtonsLine;
+ OKButton m_aOKBtn;
+ CancelButton m_aCancelBtn;
+ HelpButton m_aHelpBtn;
+
+ DECL_LINK( ModifyHdl_Impl, Edit * );
+ DECL_LINK( AssignHdl_Impl, PushButton * );
+ DECL_LINK( SelectHdl_Impl, ListBox * );
+ DECL_LINK( DblClickHdl_Impl, ListBox * );
+ DECL_LINK( RemoveHdl_Impl, PushButton * );
+
+ inline void EnableRemoveButton()
+ { m_aRemoveBtn.Enable(
+ m_aAssignedList.GetSelectEntryPos()
+ != LISTBOX_ENTRY_NOTFOUND ); }
+
+
+public:
+ SvxJavaParameterDlg( Window* pParent );
+ ~SvxJavaParameterDlg();
+
+ virtual short Execute();
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > GetParameters() const;
+ void SetParameters( ::com::sun::star::uno::Sequence< ::rtl::OUString >& rParams );
+};
+
+// class SvxJavaClassPathDlg ---------------------------------------------
+
+class SvxJavaClassPathDlg : public ModalDialog
+{
+private:
+ FixedText m_aPathLabel;
+ ListBox m_aPathList;
+ PushButton m_aAddArchiveBtn;
+ PushButton m_aAddPathBtn;
+ PushButton m_aRemoveBtn;
+
+ FixedLine m_aButtonsLine;
+ OKButton m_aOKBtn;
+ CancelButton m_aCancelBtn;
+ HelpButton m_aHelpBtn;
+
+ String m_sOldPath;
+
+ DECL_LINK( AddArchiveHdl_Impl, PushButton * );
+ DECL_LINK( AddPathHdl_Impl, PushButton * );
+ DECL_LINK( RemoveHdl_Impl, PushButton * );
+ DECL_LINK( SelectHdl_Impl, ListBox * );
+
+ bool IsPathDuplicate( const String& _rPath );
+ inline void EnableRemoveButton()
+ { m_aRemoveBtn.Enable(
+ m_aPathList.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ); }
+
+public:
+ SvxJavaClassPathDlg( Window* pParent );
+ ~SvxJavaClassPathDlg();
+
+ inline const String& GetOldPath() const { return m_sOldPath; }
+ inline void SetFocus() { m_aPathList.GrabFocus(); }
+
+ String GetClassPath() const;
+ void SetClassPath( const String& _rPath );
+};
+
+#endif // #ifndef _SVX_OPTJAVA_HXX
+
diff --git a/cui/source/options/optjava.src b/cui/source/options/optjava.src
new file mode 100644
index 000000000000..b1cce0a3e50b
--- /dev/null
+++ b/cui/source/options/optjava.src
@@ -0,0 +1,290 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optjava.src,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // include --------------------------------------------------------------
+
+#include "optjava.hrc"
+#include <cuires.hrc>
+#include "helpid.hrc"
+
+// RID_SVXPAGE_OPTIONS_JAVA ----------------------------------------------
+
+TabPage RID_SVXPAGE_OPTIONS_JAVA
+{
+ HelpId = HID_OPTIONS_JAVA ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "Java" ;
+
+ FixedLine FL_JAVA
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Java options" ;
+ };
+ CheckBox CB_JAVA_ENABLE
+ {
+ Pos = MAP_APPFONT ( 12, 14 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ en-US ] = "~Use a Java runtime environment" ;
+ };
+ FixedText FT_JAVA_FOUND
+ {
+ Pos = MAP_APPFONT ( 21 , 27 ) ;
+ Size = MAP_APPFONT ( 233 , 8 ) ;
+ Text [ en-US ] = "~Java runtime environments (JRE) already installed:" ;
+ };
+ Control LB_JAVA
+ {
+ Pos = MAP_APPFONT ( 21 , 38 ) ;
+ Size = MAP_APPFONT ( 177 , 130 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_JAVA_PATH
+ {
+ Pos = MAP_APPFONT ( 21 , 171 ) ;
+ Size = MAP_APPFONT ( 233 , 8 ) ;
+ NoLabel = TRUE ;
+ };
+ PushButton PB_ADD
+ {
+ Pos = MAP_APPFONT ( 204 , 38 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Add..." ;
+ };
+ PushButton PB_PARAMETER
+ {
+ Pos = MAP_APPFONT ( 204 , 55 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Parameters..." ;
+ };
+ PushButton PB_CLASSPATH
+ {
+ Pos = MAP_APPFONT ( 204 , 72 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Class Path..." ;
+ };
+ String STR_INSTALLED_IN
+ {
+ Text [ en-US ] = "Location: " ;
+ };
+ String STR_ACCESSIBILITY
+ {
+ Text [ en-US ] = "with accessibility support" ;
+ };
+ String STR_ADDDLGTEXT
+ {
+ Text [ en-US ] = "Select a Java Runtime Environment" ;
+ };
+ String STR_HEADER_VENDOR
+ {
+ Text [ en-US ] = "Vendor" ;
+ };
+ String STR_HEADER_VERSION
+ {
+ Text [ en-US ] = "Version" ;
+ };
+ String STR_HEADER_FEATURES
+ {
+ Text [ en-US ] = "Features" ;
+ };
+};
+
+// RID_SVXDLG_JAVA_PARAMETER ---------------------------------------------
+
+ModalDialog RID_SVXDLG_JAVA_PARAMETER
+{
+ HelpId = HID_OPTIONS_JAVA_PARAMETER ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 270 , 140 ) ;
+ Text [ en-US ] = "Java Start Parameters" ;
+ Moveable = TRUE ;
+ FixedText FT_PARAMETER
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 202 , 8 ) ;
+ Text [ en-US ] = "Java start ~parameter" ;
+ };
+ Edit ED_PARAMETER
+ {
+ Pos = MAP_APPFONT ( 6 , 15 ) ;
+ Size = MAP_APPFONT ( 202 , 12 ) ;
+ Border = TRUE ;
+ };
+ PushButton PB_ASSIGN
+ {
+ Pos = MAP_APPFONT ( 214 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Assign" ;
+ };
+ FixedText FT_ASSIGNED
+ {
+ Pos = MAP_APPFONT ( 6 , 31 ) ;
+ Size = MAP_APPFONT ( 202 , 8 ) ;
+ Text [ en-US ] = "Assig~ned start parameters" ;
+ };
+ ListBox LB_ASSIGNED
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 42 ) ;
+ Size = MAP_APPFONT ( 202 , 53 ) ;
+ AutoHScroll = TRUE ;
+ };
+ FixedText FT_EXAMPLE
+ {
+ Pos = MAP_APPFONT ( 6 , 98 ) ;
+ Size = MAP_APPFONT ( 202 , 8 ) ;
+ Text [ en-US ] = "For example: -Dmyprop=c:\\program files\\java" ;
+ };
+ PushButton PB_REMOVE
+ {
+ Pos = MAP_APPFONT ( 214 , 42 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Remove" ;
+ };
+ FixedLine FL_BUTTONS
+ {
+ Pos = MAP_APPFONT ( 3 , 109 ) ;
+ Size = MAP_APPFONT ( 264 , 8 ) ;
+ };
+ OKButton PB_PARAMETER_OK
+ {
+ Pos = MAP_APPFONT ( 105 , 120 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_PARAMETER_ESC
+ {
+ Pos = MAP_APPFONT ( 158 , 120 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton PB_PARAMETER_HLP
+ {
+ Pos = MAP_APPFONT ( 214 , 120 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+
+// RID_SVXDLG_JAVA_CLASSPATH ---------------------------------------------
+
+ModalDialog RID_SVXDLG_JAVA_CLASSPATH
+{
+ HelpId = HID_OPTIONS_JAVA_CLASSPATH ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 240 , 120 ) ;
+ Text [ en-US ] = "Class Path" ;
+ Moveable = TRUE ;
+ FixedText FT_PATH
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 172 , 8 ) ;
+ Text [ en-US ] = "A~ssigned folders and archives" ;
+ };
+ ListBox LB_PATH
+ {
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 172 , 72 ) ;
+ Border = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+ PushButton PB_ADDARCHIVE
+ {
+ Pos = MAP_APPFONT ( 184 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Add Archive..." ;
+ };
+ PushButton PB_ADDPATH
+ {
+ Pos = MAP_APPFONT ( 184 , 31 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Add ~Folder" ;
+ };
+ PushButton PB_REMOVE_PATH
+ {
+ Pos = MAP_APPFONT ( 184 , 48 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Remove" ;
+ };
+ FixedLine FL_PATH_BUTTONS
+ {
+ Pos = MAP_APPFONT ( 3 , 89 ) ;
+ Size = MAP_APPFONT ( 236 , 8 ) ;
+ };
+ OKButton PB_PATH_OK
+ {
+ Pos = MAP_APPFONT ( 75 , 100 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_PATH_ESC
+ {
+ Pos = MAP_APPFONT ( 128 , 100 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton PB_PATH_HLP
+ {
+ Pos = MAP_APPFONT ( 186 , 100 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+
+ErrorBox RID_SVXERR_JRE_NOT_RECOGNIZED
+{
+ BUTTONS = WB_OK ;
+ DEFBUTTON = WB_DEF_OK ;
+ Message [ en-US ] = "The folder you selected does not contain a Java runtime environment.\nPlease select a different folder." ;
+};
+
+ErrorBox RID_SVXERR_JRE_FAILED_VERSION
+{
+ BUTTONS = WB_OK ;
+ DEFBUTTON = WB_DEF_OK ;
+ Message [ en-US ] = "The Java runtime environment you selected is not the required version.\nPlease select a different folder." ;
+};
+
+WarningBox RID_SVX_MSGBOX_JAVA_RESTART
+{
+ BUTTONS = WB_OK ;
+ DEFBUTTON = WB_DEF_OK ;
+ Message [ en-US ] = "For the selected Java runtime environment to work properly, %PRODUCTNAME must be restarted.\nPlease restart %PRODUCTNAME now." ;
+};
+
+WarningBox RID_SVX_MSGBOX_JAVA_RESTART2
+{
+ BUTTONS = WB_OK ;
+ DEFBUTTON = WB_DEF_OK ;
+ Message [ en-US ] = "You have to restart %PRODUCTNAME so the new or modified values can take effect.\nPlease restart %PRODUCTNAME now." ;
+};
+
diff --git a/cui/source/options/optjsearch.cxx b/cui/source/options/optjsearch.cxx
new file mode 100644
index 000000000000..ab08478e6caa
--- /dev/null
+++ b/cui/source/options/optjsearch.cxx
@@ -0,0 +1,385 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optjsearch.cxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <tools/shl.hxx>
+#include <unotools/searchopt.hxx>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <cuires.hrc>
+#include <dialmgr.hxx>
+#include <optjsearch.hxx>
+#include "optjsearch.hrc"
+
+using namespace com::sun::star::i18n;
+
+//////////////////////////////////////////////////////////////////////
+
+SvxJSearchOptionsPage::SvxJSearchOptionsPage( Window* pParent, const SfxItemSet& rSet ) :
+ SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_JSEARCH_OPTIONS ), rSet ),
+
+ aTreatAsEqual ( this, CUI_RES( FL_TREAT_AS_EQUAL ) ),
+ aMatchCase ( this, CUI_RES( CB_MATCH_CASE ) ),
+ aMatchFullHalfWidth ( this, CUI_RES( CB_MATCH_FULL_HALF_WIDTH ) ),
+ aMatchHiraganaKatakana ( this, CUI_RES( CB_MATCH_HIRAGANA_KATAKANA ) ),
+ aMatchContractions ( this, CUI_RES( CB_MATCH_CONTRACTIONS ) ),
+ aMatchMinusDashChoon ( this, CUI_RES( CB_MATCH_MINUS_DASH_CHOON ) ),
+ aMatchRepeatCharMarks ( this, CUI_RES( CB_MATCH_REPEAT_CHAR_MARKS ) ),
+ aMatchVariantFormKanji ( this, CUI_RES( CB_MATCH_VARIANT_FORM_KANJI ) ),
+ aMatchOldKanaForms ( this, CUI_RES( CB_MATCH_OLD_KANA_FORMS ) ),
+ aMatchDiziDuzu ( this, CUI_RES( CB_MATCH_DIZI_DUZU ) ),
+ aMatchBavaHafa ( this, CUI_RES( CB_MATCH_BAVA_HAFA ) ),
+ aMatchTsithichiDhizi ( this, CUI_RES( CB_MATCH_TSITHICHI_DHIZI ) ),
+ aMatchHyuiyuByuvyu ( this, CUI_RES( CB_MATCH_HYUFYU_BYUVYU ) ),
+ aMatchSesheZeje ( this, CUI_RES( CB_MATCH_SESHE_ZEJE ) ),
+ aMatchIaiya ( this, CUI_RES( CB_MATCH_IAIYA ) ),
+ aMatchKiku ( this, CUI_RES( CB_MATCH_KIKU ) ),
+ aMatchProlongedSoundMark ( this, CUI_RES( CB_MATCH_PROLONGED_SOUNDMARK ) ),
+ aIgnore ( this, CUI_RES( FL_IGNORE ) ),
+ aIgnorePunctuation ( this, CUI_RES( CB_IGNORE_PUNCTUATION ) ),
+ aIgnoreWhitespace ( this, CUI_RES( CB_IGNORE_WHITESPACES ) ),
+ aIgnoreMiddleDot ( this, CUI_RES( CB_IGNORE_MIDDLE_DOT ) )
+{
+ FreeResource();
+ bSaveOptions = TRUE;
+ nTransliterationFlags = 0x00000000;
+}
+
+
+SvxJSearchOptionsPage::~SvxJSearchOptionsPage()
+{
+}
+
+
+SfxTabPage* SvxJSearchOptionsPage::Create( Window* pParent, const SfxItemSet& rSet )
+{
+ return new SvxJSearchOptionsPage( pParent, rSet );
+}
+
+
+void SvxJSearchOptionsPage::SetTransliterationFlags( INT32 nSettings )
+{
+ BOOL bVal = 0 != (nSettings & TransliterationModules_IGNORE_CASE);
+ aMatchCase .Check( bVal ); //! treat as equal uppercase/lowercase
+ bVal = 0 != (nSettings & TransliterationModules_IGNORE_WIDTH);
+ aMatchFullHalfWidth .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_IGNORE_KANA);
+ aMatchHiraganaKatakana .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreSize_ja_JP);
+ aMatchContractions .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreMinusSign_ja_JP);
+ aMatchMinusDashChoon .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreIterationMark_ja_JP);
+ aMatchRepeatCharMarks .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreTraditionalKanji_ja_JP);
+ aMatchVariantFormKanji .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreTraditionalKana_ja_JP);
+ aMatchOldKanaForms .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreZiZu_ja_JP);
+ aMatchDiziDuzu .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreBaFa_ja_JP);
+ aMatchBavaHafa .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreTiJi_ja_JP);
+ aMatchTsithichiDhizi .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreHyuByu_ja_JP);
+ aMatchHyuiyuByuvyu .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreSeZe_ja_JP);
+ aMatchSesheZeje .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreIandEfollowedByYa_ja_JP);
+ aMatchIaiya .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreKiKuFollowedBySa_ja_JP);
+ aMatchKiku .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreSeparator_ja_JP);
+ aIgnorePunctuation .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreSpace_ja_JP);
+ aIgnoreWhitespace .Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreProlongedSoundMark_ja_JP);
+ aMatchProlongedSoundMark.Check( bVal );
+ bVal = 0 != (nSettings & TransliterationModules_ignoreMiddleDot_ja_JP);
+ aIgnoreMiddleDot .Check( bVal );
+
+ nTransliterationFlags = nSettings;
+}
+
+
+INT32 SvxJSearchOptionsPage::GetTransliterationFlags_Impl()
+{
+ INT32 nTmp = 0;
+ if (aMatchCase.IsChecked()) //! treat as equal uppercase/lowercase
+ nTmp |= TransliterationModules_IGNORE_CASE;
+ if (aMatchFullHalfWidth.IsChecked())
+ nTmp |= TransliterationModules_IGNORE_WIDTH;
+ if (aMatchHiraganaKatakana.IsChecked())
+ nTmp |= TransliterationModules_IGNORE_KANA;
+ if (aMatchContractions.IsChecked())
+ nTmp |= TransliterationModules_ignoreSize_ja_JP;
+ if (aMatchMinusDashChoon.IsChecked())
+ nTmp |= TransliterationModules_ignoreMinusSign_ja_JP;
+ if (aMatchRepeatCharMarks.IsChecked())
+ nTmp |= TransliterationModules_ignoreIterationMark_ja_JP;
+ if (aMatchVariantFormKanji.IsChecked())
+ nTmp |= TransliterationModules_ignoreTraditionalKanji_ja_JP;
+ if (aMatchOldKanaForms.IsChecked())
+ nTmp |= TransliterationModules_ignoreTraditionalKana_ja_JP;
+ if (aMatchDiziDuzu.IsChecked())
+ nTmp |= TransliterationModules_ignoreZiZu_ja_JP;
+ if (aMatchBavaHafa.IsChecked())
+ nTmp |= TransliterationModules_ignoreBaFa_ja_JP;
+ if (aMatchTsithichiDhizi.IsChecked())
+ nTmp |= TransliterationModules_ignoreTiJi_ja_JP;
+ if (aMatchHyuiyuByuvyu.IsChecked())
+ nTmp |= TransliterationModules_ignoreHyuByu_ja_JP;
+ if (aMatchSesheZeje.IsChecked())
+ nTmp |= TransliterationModules_ignoreSeZe_ja_JP;
+ if (aMatchIaiya.IsChecked())
+ nTmp |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP;
+ if (aMatchKiku.IsChecked())
+ nTmp |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP;
+ if (aIgnorePunctuation.IsChecked())
+ nTmp |= TransliterationModules_ignoreSeparator_ja_JP;
+ if (aIgnoreWhitespace.IsChecked())
+ nTmp |= TransliterationModules_ignoreSpace_ja_JP;
+ if (aMatchProlongedSoundMark.IsChecked())
+ nTmp |= TransliterationModules_ignoreProlongedSoundMark_ja_JP;
+ if (aIgnoreMiddleDot.IsChecked())
+ nTmp |= TransliterationModules_ignoreMiddleDot_ja_JP;
+
+ nTransliterationFlags = nTmp;
+ return nTransliterationFlags;
+}
+
+
+void SvxJSearchOptionsPage::Reset( const SfxItemSet& )
+{
+ SvtSearchOptions aOpt;
+
+ // read settings from configuration
+ aMatchCase .Check(!aOpt.IsMatchCase() ); //! treat as equal uppercase/lowercase
+ aMatchFullHalfWidth .Check( aOpt.IsMatchFullHalfWidthForms() );
+ aMatchHiraganaKatakana .Check( aOpt.IsMatchHiraganaKatakana() );
+ aMatchContractions .Check( aOpt.IsMatchContractions() );
+ aMatchMinusDashChoon .Check( aOpt.IsMatchMinusDashChoon() );
+ aMatchRepeatCharMarks .Check( aOpt.IsMatchRepeatCharMarks() );
+ aMatchVariantFormKanji .Check( aOpt.IsMatchVariantFormKanji() );
+ aMatchOldKanaForms .Check( aOpt.IsMatchOldKanaForms() );
+ aMatchDiziDuzu .Check( aOpt.IsMatchDiziDuzu() );
+ aMatchBavaHafa .Check( aOpt.IsMatchBavaHafa() );
+ aMatchTsithichiDhizi .Check( aOpt.IsMatchTsithichiDhizi() );
+ aMatchHyuiyuByuvyu .Check( aOpt.IsMatchHyuiyuByuvyu() );
+ aMatchSesheZeje .Check( aOpt.IsMatchSesheZeje() );
+ aMatchIaiya .Check( aOpt.IsMatchIaiya() );
+ aMatchKiku .Check( aOpt.IsMatchKiku() );
+ aIgnorePunctuation .Check( aOpt.IsIgnorePunctuation() );
+ aIgnoreWhitespace .Check( aOpt.IsIgnoreWhitespace() );
+ aMatchProlongedSoundMark .Check( aOpt.IsIgnoreProlongedSoundMark() );
+ aIgnoreMiddleDot .Check( aOpt.IsIgnoreMiddleDot() );
+
+ nTransliterationFlags = GetTransliterationFlags_Impl();
+ DBG_ASSERT( nTransliterationFlags == aOpt.GetTransliterationFlags(),
+ "Transliteration settings different" );
+
+ aMatchCase .SaveValue();
+ aMatchFullHalfWidth .SaveValue();
+ aMatchHiraganaKatakana .SaveValue();
+ aMatchContractions .SaveValue();
+ aMatchMinusDashChoon .SaveValue();
+ aMatchRepeatCharMarks .SaveValue();
+ aMatchVariantFormKanji .SaveValue();
+ aMatchOldKanaForms .SaveValue();
+ aMatchDiziDuzu .SaveValue();
+ aMatchBavaHafa .SaveValue();
+ aMatchTsithichiDhizi .SaveValue();
+ aMatchHyuiyuByuvyu .SaveValue();
+ aMatchSesheZeje .SaveValue();
+ aMatchIaiya .SaveValue();
+ aMatchKiku .SaveValue();
+ aIgnorePunctuation .SaveValue();
+ aIgnoreWhitespace .SaveValue();
+ aMatchProlongedSoundMark .SaveValue();
+ aIgnoreMiddleDot .SaveValue();
+}
+
+
+BOOL SvxJSearchOptionsPage::FillItemSet( SfxItemSet& )
+{
+ BOOL bModified = FALSE;
+
+ INT32 nOldVal = nTransliterationFlags;
+ nTransliterationFlags = GetTransliterationFlags_Impl();
+ bModified = nOldVal != nTransliterationFlags;
+
+ if (!IsSaveOptions())
+ return bModified;
+
+ bModified = FALSE;
+ SvtSearchOptions aOpt;
+ BOOL bNewVal, bChanged;
+
+ bNewVal = aMatchCase.IsChecked(); //! treat as equal uppercase/lowercase
+ bChanged = bNewVal != aMatchCase.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchCase(!bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchFullHalfWidth.IsChecked();
+ bChanged = bNewVal != aMatchFullHalfWidth.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchFullHalfWidthForms( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchHiraganaKatakana.IsChecked();
+ bChanged = bNewVal != aMatchHiraganaKatakana.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchHiraganaKatakana( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchContractions.IsChecked();
+ bChanged = bNewVal != aMatchContractions.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchContractions( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchMinusDashChoon.IsChecked();
+ bChanged = bNewVal != aMatchMinusDashChoon.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchMinusDashChoon( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchRepeatCharMarks.IsChecked();
+ bChanged = bNewVal != aMatchRepeatCharMarks.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchRepeatCharMarks( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchVariantFormKanji.IsChecked();
+ bChanged = bNewVal != aMatchVariantFormKanji.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchVariantFormKanji( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchOldKanaForms.IsChecked();
+ bChanged = bNewVal != aMatchOldKanaForms.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchOldKanaForms( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchDiziDuzu.IsChecked();
+ bChanged = bNewVal != aMatchDiziDuzu.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchDiziDuzu( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchBavaHafa.IsChecked();
+ bChanged = bNewVal != aMatchBavaHafa.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchBavaHafa( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchTsithichiDhizi.IsChecked();
+ bChanged = bNewVal != aMatchTsithichiDhizi.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchTsithichiDhizi( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchHyuiyuByuvyu.IsChecked();
+ bChanged = bNewVal != aMatchHyuiyuByuvyu.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchHyuiyuByuvyu( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchSesheZeje.IsChecked();
+ bChanged = bNewVal != aMatchSesheZeje.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchSesheZeje( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchIaiya.IsChecked();
+ bChanged = bNewVal != aMatchIaiya.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchIaiya( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchKiku.IsChecked();
+ bChanged = bNewVal != aMatchKiku.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetMatchKiku( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aIgnorePunctuation.IsChecked();
+ bChanged = bNewVal != aIgnorePunctuation.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetIgnorePunctuation( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aIgnoreWhitespace.IsChecked();
+ bChanged = bNewVal != aIgnoreWhitespace.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetIgnoreWhitespace( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aMatchProlongedSoundMark.IsChecked();
+ bChanged = bNewVal != aMatchProlongedSoundMark.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetIgnoreProlongedSoundMark( bNewVal );
+ bModified = TRUE;
+ }
+ bNewVal = aIgnoreMiddleDot.IsChecked();
+ bChanged = bNewVal != aIgnoreMiddleDot.GetSavedValue();
+ if (bChanged)
+ {
+ aOpt.SetIgnoreMiddleDot( bNewVal );
+ bModified = TRUE;
+ }
+
+ return bModified;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+
diff --git a/cui/source/options/optjsearch.hrc b/cui/source/options/optjsearch.hrc
new file mode 100644
index 000000000000..dfe6b7bdb07a
--- /dev/null
+++ b/cui/source/options/optjsearch.hrc
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optjsearch.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define FL_TREAT_AS_EQUAL 100
+#define CB_MATCH_CASE 101
+#define CB_MATCH_FULL_HALF_WIDTH 102
+#define CB_MATCH_HIRAGANA_KATAKANA 103
+#define CB_MATCH_CONTRACTIONS 104
+#define CB_MATCH_MINUS_DASH_CHOON 105
+#define CB_MATCH_REPEAT_CHAR_MARKS 106
+#define CB_MATCH_VARIANT_FORM_KANJI 107
+#define CB_MATCH_OLD_KANA_FORMS 108
+#define CB_MATCH_DIZI_DUZU 109
+#define CB_MATCH_BAVA_HAFA 110
+#define CB_MATCH_TSITHICHI_DHIZI 111
+#define CB_MATCH_HYUFYU_BYUVYU 112
+#define CB_MATCH_SESHE_ZEJE 113
+#define CB_MATCH_IAIYA 114
+#define CB_MATCH_KIKU 115
+
+#define FL_IGNORE 200
+#define CB_IGNORE_PUNCTUATION 201
+#define CB_IGNORE_WHITESPACES 202
+#define CB_MATCH_PROLONGED_SOUNDMARK 203
+#define CB_IGNORE_MIDDLE_DOT 204
+
diff --git a/cui/source/options/optjsearch.hxx b/cui/source/options/optjsearch.hxx
new file mode 100644
index 000000000000..e1d1de79ae2e
--- /dev/null
+++ b/cui/source/options/optjsearch.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optjsearch.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_OPTJSEARCH_HXX_
+#define _SVX_OPTJSEARCH_HXX_
+
+#include <vcl/fixed.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <sfx2/tabdlg.hxx>
+
+class Window;
+class SfxItemSet;
+
+//////////////////////////////////////////////////////////////////////
+
+class SvxJSearchOptionsPage : public SfxTabPage
+{
+private:
+ FixedLine aTreatAsEqual;
+ CheckBox aMatchCase;
+ CheckBox aMatchFullHalfWidth;
+ CheckBox aMatchHiraganaKatakana;
+ CheckBox aMatchContractions;
+ CheckBox aMatchMinusDashChoon;
+ CheckBox aMatchRepeatCharMarks;
+ CheckBox aMatchVariantFormKanji;
+ CheckBox aMatchOldKanaForms;
+ CheckBox aMatchDiziDuzu;
+ CheckBox aMatchBavaHafa;
+ CheckBox aMatchTsithichiDhizi;
+ CheckBox aMatchHyuiyuByuvyu;
+ CheckBox aMatchSesheZeje;
+ CheckBox aMatchIaiya;
+ CheckBox aMatchKiku;
+ CheckBox aMatchProlongedSoundMark;
+ FixedLine aIgnore;
+ CheckBox aIgnorePunctuation;
+ CheckBox aIgnoreWhitespace;
+ CheckBox aIgnoreMiddleDot;
+
+ INT32 nTransliterationFlags;
+ BOOL bSaveOptions;
+
+ INT32 GetTransliterationFlags_Impl();
+
+protected:
+ SvxJSearchOptionsPage( Window* pParent, const SfxItemSet& rSet );
+
+public:
+ ~SvxJSearchOptionsPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+
+ BOOL IsSaveOptions() const { return bSaveOptions; }
+ void EnableSaveOptions( BOOL bVal ) { bSaveOptions = bVal; }
+
+ INT32 GetTransliterationFlags() const { return nTransliterationFlags; }
+ void SetTransliterationFlags( INT32 nSettings );
+};
+
+//////////////////////////////////////////////////////////////////////
+
+#endif
+
diff --git a/cui/source/options/optjsearch.src b/cui/source/options/optjsearch.src
new file mode 100644
index 000000000000..00496ecf8d6b
--- /dev/null
+++ b/cui/source/options/optjsearch.src
@@ -0,0 +1,223 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optjsearch.src,v $
+ * $Revision: 1.40 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <helpid.hrc>
+#include <cuires.hrc>
+
+#include "optjsearch.hrc"
+
+
+TabPage RID_SVXPAGE_JSEARCH_OPTIONS
+{
+ HelpId = HID_SVXPAGE_JSEARCH_OPTIONS ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine FL_TREAT_AS_EQUAL
+ {
+ Pos = MAP_APPFONT( 6, 3 );
+ Size = MAP_APPFONT( 248, 8 );
+ Text [ en-US ] = "Treat as equal";
+ };
+ CheckBox CB_MATCH_CASE
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~uppercase/lowercase";
+ };
+ CheckBox CB_MATCH_FULL_HALF_WIDTH
+ {
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~full-width/half-width forms";
+ };
+ CheckBox CB_MATCH_HIRAGANA_KATAKANA
+ {
+ Pos = MAP_APPFONT ( 12 , 42 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~hiragana/katakana";
+ };
+ CheckBox CB_MATCH_CONTRACTIONS
+ {
+ Pos = MAP_APPFONT ( 12 , 56 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~contractions (yo-on, sokuon)";
+ };
+ CheckBox CB_MATCH_MINUS_DASH_CHOON
+ {
+ Pos = MAP_APPFONT ( 12 , 70 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~minus/dash/cho-on";
+ };
+ CheckBox CB_MATCH_REPEAT_CHAR_MARKS
+ {
+ Pos = MAP_APPFONT ( 12 , 84 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "'re~peat character' marks";
+ };
+ CheckBox CB_MATCH_VARIANT_FORM_KANJI
+ {
+ Pos = MAP_APPFONT ( 12 , 98 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~variant-form kanji (itaiji)";
+ };
+ CheckBox CB_MATCH_OLD_KANA_FORMS
+ {
+ Pos = MAP_APPFONT ( 12 , 112) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~old Kana forms";
+ };
+ CheckBox CB_MATCH_DIZI_DUZU
+ {
+ Pos = MAP_APPFONT ( 136 , 14 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~di/zi, du/zu";
+ };
+ CheckBox CB_MATCH_BAVA_HAFA
+ {
+ Pos = MAP_APPFONT ( 136 , 28 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~ba/va, ha/fa";
+ };
+ CheckBox CB_MATCH_TSITHICHI_DHIZI
+ {
+ Pos = MAP_APPFONT ( 136 , 42 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~tsi/thi/chi, dhi/zi";
+ };
+ CheckBox CB_MATCH_HYUFYU_BYUVYU
+ {
+ Pos = MAP_APPFONT ( 136 , 56 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "h~yu/fyu, byu/vyu";
+ };
+ CheckBox CB_MATCH_SESHE_ZEJE
+ {
+ Pos = MAP_APPFONT ( 136 , 70 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~se/she, ze/je";
+ };
+ CheckBox CB_MATCH_IAIYA
+ {
+ Pos = MAP_APPFONT ( 136 , 84 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~ia/iya (piano/piyano)";
+ };
+ CheckBox CB_MATCH_KIKU
+ {
+ Pos = MAP_APPFONT ( 136 , 98 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~ki/ku (tekisuto/tekusuto)";
+ };
+ CheckBox CB_MATCH_PROLONGED_SOUNDMARK
+ {
+ Pos = MAP_APPFONT ( 136 , 112 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "Prolon~ged vowels (ka-/kaa)";
+ };
+ FixedLine FL_IGNORE
+ {
+ Pos = MAP_APPFONT( 6, 128 );
+ Size = MAP_APPFONT( 248, 8 );
+ Text [ en-US ] = "Ignore";
+ };
+ CheckBox CB_IGNORE_PUNCTUATION
+ {
+ Pos = MAP_APPFONT ( 12 , 139 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "Pu~nctuation characters";
+ };
+ CheckBox CB_IGNORE_WHITESPACES
+ {
+ Pos = MAP_APPFONT ( 12 , 153 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~Whitespace characters";
+ };
+ CheckBox CB_IGNORE_MIDDLE_DOT
+ {
+ Pos = MAP_APPFONT ( 136 , 139 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "Midd~le dots";
+ };
+ Text [ en-US ] = "Searching in Japanese";
+};
+// end TabPage
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
new file mode 100644
index 000000000000..7ca67a553278
--- /dev/null
+++ b/cui/source/options/optlingu.cxx
@@ -0,0 +1,2555 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optlingu.cxx,v $
+ * $Revision: 1.68 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <vcl/msgbox.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <tools/shl.hxx>
+#include <tools/dynary.hxx>
+#include <i18npool/mslangid.hxx>
+#include <unotools/lingucfg.hxx>
+#include <svx/unolingu.hxx>
+#include <svx/dlgutil.hxx>
+#include <linguistic/lngprops.hxx>
+#include <linguistic/misc.hxx>
+#include <sfx2/sfxuno.hxx>
+#include <sfx2/dispatch.hxx>
+#include <tools/urlobj.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/linguistic2/XSpellChecker.hpp>
+#include <com/sun/star/linguistic2/XProofreader.hpp>
+#include <com/sun/star/linguistic2/XHyphenator.hpp>
+#include <com/sun/star/linguistic2/XThesaurus.hpp>
+#include <com/sun/star/linguistic2/XAvailableLocales.hpp>
+#include <com/sun/star/lang/XServiceDisplayName.hpp>
+#include <com/sun/star/linguistic2/DictionaryListEventFlags.hpp>
+#include <com/sun/star/linguistic2/DictionaryListEvent.hpp>
+#include <com/sun/star/linguistic2/XDictionaryListEventListener.hpp>
+#include <com/sun/star/linguistic2/XDictionaryList.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/ucb/CommandAbortedException.hpp>
+#include <com/sun/star/system/XSystemShellExecute.hpp>
+#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
+#include <unotools/extendedsecurityoptions.hxx>
+#include <svtools/svlbox.hxx>
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <vcl/svapp.hxx>
+#define _SVX_OPTLINGU_CXX
+#include "optlingu.hrc"
+
+#include <svx/svxdlg.hxx>
+#include <svx/optitems.hxx>
+#include "optlingu.hxx"
+#include <dialmgr.hxx>
+#include <cuires.hrc>
+#include "helpid.hrc"
+
+#include <ucbhelper/content.hxx>
+
+#include <vector>
+#include <map>
+
+
+using namespace ::ucbhelper;
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::linguistic2;
+using namespace ::com::sun::star::beans;
+namespace css = com::sun::star;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+#define SVX_MAX_USERDICTS 20
+#define CBCOL_FIRST 0
+#define CBCOL_SECOND 1
+#define CBCOL_BOTH 2
+
+static const sal_Char cSpell[] = SN_SPELLCHECKER;
+static const sal_Char cGrammar[] = SN_GRAMMARCHECKER;
+static const sal_Char cHyph[] = SN_HYPHENATOR;
+static const sal_Char cThes[] = SN_THESAURUS;
+
+// static ----------------------------------------------------------------
+
+static Sequence< INT16 > lcl_LocaleSeqToLangSeq( const Sequence< Locale > &rSeq )
+{
+ INT32 nLen = rSeq.getLength();
+ Sequence< INT16 > aRes( nLen );
+ INT16 *pRes = aRes.getArray();
+ const Locale *pSeq = rSeq.getConstArray();
+ for (INT32 i = 0; i < nLen; ++i)
+ {
+ pRes[i] = SvxLocaleToLanguage( pSeq[i] );
+ }
+ return aRes;
+}
+
+
+static BOOL lcl_SeqHasLang( const Sequence< INT16 > &rSeq, INT16 nLang )
+{
+ INT32 nLen = rSeq.getLength();
+ const INT16 *pLang = rSeq.getConstArray();
+ INT32 nPos = -1;
+ for (INT32 i = 0; i < nLen && nPos < 0; ++i)
+ {
+ if (nLang == pLang[i])
+ nPos = i;
+ }
+ return nPos < 0 ? FALSE : TRUE;
+}
+
+
+static INT32 lcl_SeqGetEntryPos(
+ const Sequence< OUString > &rSeq, const OUString &rEntry )
+{
+ INT32 i;
+ INT32 nLen = rSeq.getLength();
+ const OUString *pItem = rSeq.getConstArray();
+ for (i = 0; i < nLen; ++i)
+ {
+ if (rEntry == pItem[i])
+ break;
+ }
+ return i < nLen ? i : -1;
+}
+
+static void lcl_OpenURL( const ::rtl::OUString& rURL )
+{
+ if ( rURL.getLength() > 0 )
+ {
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xSMGR =
+ ::comphelper::getProcessServiceFactory();
+ uno::Reference< css::system::XSystemShellExecute > xSystemShell(
+ xSMGR->createInstance( ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ),
+ uno::UNO_QUERY_THROW );
+ if ( xSystemShell.is() )
+ xSystemShell->execute( rURL, ::rtl::OUString(), css::system::SystemShellExecuteFlags::DEFAULTS );
+ }
+ catch( const uno::Exception& e )
+ {
+ OSL_TRACE( "Caught exception: %s\n thread terminated.\n",
+ rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
+ }
+ }
+}
+
+/*--------------------------------------------------
+--------------------------------------------------*/
+
+static const sal_uInt16 nNameLen = 8;
+
+static sal_uInt16 pRanges[] =
+{
+ SID_ATTR_SPELL,
+ SID_ATTR_SPELL,
+ 0
+};
+
+sal_Bool KillFile_Impl( const String& rURL )
+{
+ sal_Bool bRet = sal_True;
+ try
+ {
+ Content aCnt( rURL, uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > () );
+ aCnt.executeCommand( OUString::createFromAscii( "delete" ), makeAny( sal_Bool( sal_True ) ) );
+ }
+ catch( ::com::sun::star::ucb::CommandAbortedException& )
+ {
+ DBG_ERRORFILE( "KillFile: CommandAbortedException" );
+ bRet = sal_False;
+ }
+ catch( ... )
+ {
+ DBG_ERRORFILE( "KillFile: Any other exception" );
+ bRet = sal_False;
+ }
+
+ return bRet;
+}
+/* -----------------------------27.11.00 14:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+// 0x 0p 0t 0c nn
+// p: 1 -> parent
+// t: 1 -> spell, 2 -> hyph, 3 -> thes, 4 -> grammar
+// c: 1 -> checked 0 -> unchecked
+// n: index
+
+#define TYPE_SPELL (BYTE)1
+#define TYPE_GRAMMAR (BYTE)2
+#define TYPE_HYPH (BYTE)3
+#define TYPE_THES (BYTE)4
+
+class ModuleUserData_Impl
+{
+ BOOL bParent;
+ BOOL bIsChecked;
+ BYTE nType;
+ BYTE nIndex;
+ String sImplName;
+
+public:
+ ModuleUserData_Impl( String sImpName, BOOL bIsParent, BOOL bChecked, BYTE nSetType, BYTE nSetIndex ) :
+ bParent(bIsParent),
+ bIsChecked(bChecked),
+ nType(nSetType),
+ nIndex(nSetIndex),
+ sImplName(sImpName)
+ {
+ }
+ BOOL IsParent() const {return bParent;}
+ BYTE GetType() const {return nType;}
+ BOOL IsChecked() const {return bIsChecked;}
+ BYTE GetIndex() const {return nIndex;}
+ void SetIndex(BYTE nSet) {nIndex = nSet;}
+ const String& GetImplName() const {return sImplName;}
+
+};
+
+/*--------------------------------------------------
+--------------------------------------------------*/
+//
+// User for user-dictionaries (XDictionary interface)
+//
+class DicUserData
+{
+ ULONG nVal;
+
+public:
+ DicUserData( ULONG nUserData ) : nVal( nUserData ) {}
+ DicUserData( USHORT nEID,
+ BOOL bChecked, BOOL bEditable, BOOL bDeletable );
+
+ ULONG GetUserData() const { return nVal; }
+ USHORT GetEntryId() const { return (USHORT)(nVal >> 16); }
+ BOOL IsChecked() const { return (BOOL)(nVal >> 8) & 0x01; }
+ BOOL IsEditable() const { return (BOOL)(nVal >> 9) & 0x01; }
+ BOOL IsDeletable() const { return (BOOL)(nVal >> 10) & 0x01; }
+
+ void SetChecked( BOOL bVal );
+};
+
+
+DicUserData::DicUserData(
+ USHORT nEID,
+ BOOL bChecked, BOOL bEditable, BOOL bDeletable )
+{
+ DBG_ASSERT( nEID < 65000, "Entry Id out of range" );
+ nVal = ((ULONG)(0xFFFF & nEID) << 16) |
+ ((ULONG)(bChecked ? 1 : 0) << 8) |
+ ((ULONG)(bEditable ? 1 : 0) << 9) |
+ ((ULONG)(bDeletable ? 1 : 0) << 10);
+}
+
+
+void DicUserData::SetChecked( BOOL bVal )
+{
+ nVal &= ~(1UL << 8);
+ nVal |= (ULONG)(bVal ? 1 : 0) << 8;
+}
+
+
+// class BrwString_Impl -------------------------------------------------
+
+void lcl_SetCheckButton( SvLBoxEntry* pEntry, BOOL bCheck )
+{
+ SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXBUTTON));
+
+ DBG_ASSERT(pItem,"SetCheckButton:Item not found");
+ if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON)
+ {
+ if (bCheck)
+ pItem->SetStateChecked();
+ else
+ pItem->SetStateUnchecked();
+ //InvalidateEntry( pEntry );
+ }
+}
+
+
+class BrwStringDic_Impl : public SvLBoxString
+{
+public:
+
+ BrwStringDic_Impl( SvLBoxEntry* pEntry, USHORT nFlags,
+ const String& rStr ) : SvLBoxString( pEntry, nFlags, rStr ) {}
+
+ virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags,
+ SvLBoxEntry* pEntry);
+};
+
+void BrwStringDic_Impl::Paint( const Point& rPos, SvLBox& rDev, USHORT,
+ SvLBoxEntry* pEntry )
+{
+ ModuleUserData_Impl* pData = (ModuleUserData_Impl*)pEntry->GetUserData();
+ Point aPos(rPos);
+ Font aOldFont( rDev.GetFont());
+ if(pData->IsParent())
+ {
+ Font aFont( aOldFont );
+ aFont.SetWeight( WEIGHT_BOLD );
+ rDev.SetFont( aFont );
+ aPos.X() = 0;
+ }
+ else
+ aPos.X() += 5;
+ rDev.DrawText( aPos, GetText() );
+ rDev.SetFont( aOldFont );
+}
+
+
+/*--------------------------------------------------
+--------------------------------------------------*/
+
+class OptionsBreakSet : public ModalDialog
+{
+ OKButton aOKPB;
+ CancelButton aCancelPB;
+ FixedLine aValFL;
+ NumericField aValNF;
+
+public:
+ OptionsBreakSet(Window* pParent, int nRID) :
+ ModalDialog(pParent, CUI_RES(RID_SVXDLG_LNG_ED_NUM_PREBREAK )),
+ aOKPB (this, CUI_RES(BT_OK_PREBREAK)),
+ aCancelPB (this, CUI_RES(BT_CANCEL_PREBREAK)),
+ aValFL (this, CUI_RES(FL_NUMVAL_PREBREAK)),
+ aValNF (this, CUI_RES(ED_PREBREAK))
+ {
+ DBG_ASSERT( STR_NUM_PRE_BREAK_DLG == nRID ||
+ STR_NUM_POST_BREAK_DLG == nRID ||
+ STR_NUM_MIN_WORDLEN_DLG == nRID, "unexpected RID" );
+
+ if (nRID != -1)
+ aValFL.SetText( String( CUI_RES(nRID) ) );
+ FreeResource();
+ }
+
+ NumericField& GetNumericFld() { return aValNF; }
+};
+
+
+/*--------------------------------------------------
+ Entry IDs for options listbox of dialog
+--------------------------------------------------*/
+
+enum EID_OPTIONS
+{
+ EID_SPELL_AUTO,
+ EID_GRAMMAR_AUTO,
+ EID_CAPITAL_WORDS,
+ EID_WORDS_WITH_DIGITS,
+ EID_CAPITALIZATION,
+ EID_SPELL_SPECIAL,
+ EID_NUM_MIN_WORDLEN,
+ EID_NUM_PRE_BREAK,
+ EID_NUM_POST_BREAK,
+ EID_HYPH_AUTO,
+ EID_HYPH_SPECIAL
+};
+
+//! this array must have an entry for every value of EID_OPTIONS.
+// It is used to get the respective property name.
+static const char * aEidToPropName[] =
+{
+ UPN_IS_SPELL_AUTO, // EID_SPELL_AUTO
+ UPN_IS_GRAMMAR_AUTO, // EID_GRAMMAR_AUTO
+ UPN_IS_SPELL_UPPER_CASE, // EID_CAPITAL_WORDS
+ UPN_IS_SPELL_WITH_DIGITS, // EID_WORDS_WITH_DIGITS
+ UPN_IS_SPELL_CAPITALIZATION, // EID_CAPITALIZATION
+ UPN_IS_SPELL_SPECIAL, // EID_SPELL_SPECIAL
+ UPN_HYPH_MIN_WORD_LENGTH, // EID_NUM_MIN_WORDLEN,
+ UPN_HYPH_MIN_LEADING, // EID_NUM_PRE_BREAK
+ UPN_HYPH_MIN_TRAILING, // EID_NUM_POST_BREAK
+ UPN_IS_HYPH_AUTO, // EID_HYPH_AUTO
+ UPN_IS_HYPH_SPECIAL // EID_HYPH_SPECIAL
+};
+
+
+static inline String lcl_GetPropertyName( EID_OPTIONS eEntryId )
+{
+ DBG_ASSERT( (unsigned int) eEntryId < sizeof(aEidToPropName) / sizeof(aEidToPropName[0]), "index out of range" );
+ return String::CreateFromAscii( aEidToPropName[ (int) eEntryId ] );
+}
+
+// class OptionsUserData -------------------------------------------------
+
+class OptionsUserData
+{
+ ULONG nVal;
+
+ void SetModified();
+
+public:
+ OptionsUserData( ULONG nUserData ) : nVal( nUserData ) {}
+ OptionsUserData( USHORT nEID,
+ BOOL bHasNV, USHORT nNumVal,
+ BOOL bCheckable, BOOL bChecked );
+
+ ULONG GetUserData() const { return nVal; }
+ USHORT GetEntryId() const { return (USHORT)(nVal >> 16); }
+ BOOL HasNumericValue() const { return (BOOL)(nVal >> 10) & 0x01; }
+ USHORT GetNumericValue() const { return (USHORT)(nVal & 0xFF); }
+ BOOL IsChecked() const { return (BOOL)(nVal >> 8) & 0x01; }
+ BOOL IsCheckable() const { return (BOOL)(nVal >> 9) & 0x01; }
+ BOOL IsModified() const { return (BOOL)(nVal >> 11) & 0x01; }
+
+ void SetChecked( BOOL bVal );
+ void SetNumericValue( BYTE nNumVal );
+};
+
+OptionsUserData::OptionsUserData( USHORT nEID,
+ BOOL bHasNV, USHORT nNumVal,
+ BOOL bCheckable, BOOL bChecked )
+{
+ DBG_ASSERT( nEID < 65000, "Entry Id out of range" );
+ DBG_ASSERT( nNumVal < 256, "value out of range" );
+ nVal = ((ULONG)(0xFFFF & nEID) << 16) |
+ ((ULONG)(bHasNV ? 1 : 0) << 10) |
+ ((ULONG)(bCheckable ? 1 : 0) << 9) |
+ ((ULONG)(bChecked ? 1 : 0) << 8) |
+ ((ULONG)(0xFF & nNumVal));
+}
+
+void OptionsUserData::SetChecked( BOOL bVal )
+{
+ if (IsCheckable() && (IsChecked() != bVal))
+ {
+ nVal &= ~(1UL << 8);
+ nVal |= (ULONG)(bVal ? 1 : 0) << 8;
+ SetModified();
+ }
+}
+
+void OptionsUserData::SetNumericValue( BYTE nNumVal )
+{
+// DBG_ASSERT( nNumVal < 256, "value out of range" );
+ if (HasNumericValue() && (GetNumericValue() != nNumVal))
+ {
+ nVal &= 0xffffff00;
+ nVal |= (nNumVal);
+ SetModified();
+ }
+}
+
+void OptionsUserData::SetModified()
+{
+ nVal |= (ULONG)1 << 11;
+}
+
+// class BrwString_Impl -------------------------------------------------
+
+class BrwString_Impl : public SvLBoxString
+{
+public:
+
+ BrwString_Impl( SvLBoxEntry* pEntry, USHORT nFlags,
+ const String& rStr ) : SvLBoxString( pEntry, nFlags, rStr ) {}
+
+ virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags,
+ SvLBoxEntry* pEntry);
+};
+
+void BrwString_Impl::Paint( const Point& rPos, SvLBox& rDev, USHORT,
+ SvLBoxEntry* pEntry )
+{
+ Point aPos(rPos);
+ aPos.X() += 20;
+ rDev.DrawText( aPos, GetText() );
+ if(pEntry->GetUserData())
+ {
+ Point aNewPos(aPos);
+ aNewPos.X() += rDev.GetTextWidth(GetText());
+ Font aOldFont( rDev.GetFont());
+ Font aFont( aOldFont );
+ aFont.SetWeight( WEIGHT_BOLD );
+
+// BOOL bFett = TRUE;
+// USHORT nPos = 0;
+ //??? das untere byte aus dem user data in string wandeln
+ OptionsUserData aData( (ULONG) pEntry->GetUserData() );
+ if(aData.HasNumericValue())
+ {
+ String sTxt( ' ' );
+ sTxt += String::CreateFromInt32( aData.GetNumericValue() );
+ rDev.SetFont( aFont );
+ rDev.DrawText( aNewPos, sTxt );
+ }
+
+// if( STRING_NOTFOUND != nPos )
+// aNewPos.X() += rDev.GetTextWidth( sTxt );
+
+ rDev.SetFont( aOldFont );
+ }
+}
+
+// ServiceInfo_Impl ----------------------------------------------------
+
+struct ServiceInfo_Impl
+{
+ OUString sDisplayName;
+ OUString sSpellImplName;
+ OUString sHyphImplName;
+ OUString sThesImplName;
+ OUString sGrammarImplName;
+ uno::Reference< XSpellChecker > xSpell;
+ uno::Reference< XHyphenator > xHyph;
+ uno::Reference< XThesaurus > xThes;
+ uno::Reference< XProofreader > xGrammar;
+ BOOL bConfigured;
+
+ ServiceInfo_Impl() : bConfigured(sal_False) {}
+};
+
+typedef std::vector< ServiceInfo_Impl > ServiceInfoArr;
+typedef std::map< INT16 /*LanguageType*/, Sequence< OUString > > LangImplNameTable;
+
+
+// SvxLinguData_Impl ----------------------------------------------------
+
+class SvxLinguData_Impl
+{
+ //contains services and implementation names sorted by implementation names
+ ServiceInfoArr aDisplayServiceArr;
+ ULONG nDisplayServices;
+
+ Sequence< Locale > aAllServiceLocales;
+ LangImplNameTable aCfgSpellTable;
+ LangImplNameTable aCfgHyphTable;
+ LangImplNameTable aCfgThesTable;
+ LangImplNameTable aCfgGrammarTable;
+ uno::Reference< XMultiServiceFactory > xMSF;
+ uno::Reference< XLinguServiceManager > xLinguSrvcMgr;
+
+
+ sal_Bool AddRemove( Sequence< OUString > &rConfigured,
+ const OUString &rImplName, BOOL bAdd );
+
+public:
+ SvxLinguData_Impl();
+ SvxLinguData_Impl( const SvxLinguData_Impl &rData );
+ ~SvxLinguData_Impl();
+
+ SvxLinguData_Impl & operator = (const SvxLinguData_Impl &rData);
+
+ uno::Reference<XLinguServiceManager> & GetManager() { return xLinguSrvcMgr; }
+
+ void SetChecked( const Sequence< OUString > &rConfiguredServices );
+ void Reconfigure( const OUString &rDisplayName, BOOL bEnable );
+
+ const Sequence<Locale> & GetAllSupportedLocales() { return aAllServiceLocales; }
+
+ const LangImplNameTable & GetSpellTable() const { return aCfgSpellTable; }
+ LangImplNameTable & GetSpellTable() { return aCfgSpellTable; }
+ const LangImplNameTable & GetHyphTable() const { return aCfgHyphTable; }
+ LangImplNameTable & GetHyphTable() { return aCfgHyphTable; }
+ const LangImplNameTable & GetThesTable() const { return aCfgThesTable; }
+ LangImplNameTable & GetThesTable() { return aCfgThesTable; }
+ const LangImplNameTable & GetGrammarTable() const { return aCfgGrammarTable; }
+ LangImplNameTable & GetGrammarTable() { return aCfgGrammarTable; }
+
+ const ServiceInfoArr & GetDisplayServiceArray() const { return aDisplayServiceArr; }
+ ServiceInfoArr & GetDisplayServiceArray() { return aDisplayServiceArr; }
+
+ const ULONG & GetDisplayServiceCount() const { return nDisplayServices; }
+ void SetDisplayServiceCount( ULONG nVal ) { nDisplayServices = nVal; }
+
+ // returns the list of service implementation names for the specified
+ // language and service (TYPE_SPELL, TYPE_HYPH, TYPE_THES) sorted in
+ // the proper order for the SvxEditModulesDlg (the ones from the
+ // configuration (keeping that order!) first and then the other ones.
+ // I.e. the ones available but not configured in arbitrary order).
+ // They available ones may contain names that do not(!) support that
+ // language.
+ Sequence< OUString > GetSortedImplNames( INT16 nLang, BYTE nType );
+
+ ServiceInfo_Impl * GetInfoByImplName( const OUString &rSvcImplName );
+};
+
+
+INT32 lcl_SeqGetIndex( const Sequence< OUString > &rSeq, const OUString &rTxt )
+{
+ INT32 nRes = -1;
+ INT32 nLen = rSeq.getLength();
+ const OUString *pString = rSeq.getConstArray();
+ for (INT32 i = 0; i < nLen && nRes == -1; ++i)
+ {
+ if (pString[i] == rTxt)
+ nRes = i;
+ }
+ return nRes;
+}
+
+
+Sequence< OUString > SvxLinguData_Impl::GetSortedImplNames( INT16 nLang, BYTE nType )
+{
+ LangImplNameTable *pTable = 0;
+ switch (nType)
+ {
+ case TYPE_SPELL : pTable = &aCfgSpellTable; break;
+ case TYPE_HYPH : pTable = &aCfgHyphTable; break;
+ case TYPE_THES : pTable = &aCfgThesTable; break;
+ case TYPE_GRAMMAR : pTable = &aCfgGrammarTable; break;
+ }
+ Sequence< OUString > aRes;
+ if (pTable->count( nLang ))
+ aRes = (*pTable)[ nLang ]; // add configured services
+ INT32 nIdx = aRes.getLength();
+ DBG_ASSERT( (INT32) nDisplayServices >= nIdx, "size mismatch" );
+ aRes.realloc( nDisplayServices );
+ OUString *pRes = aRes.getArray();
+
+ // add not configured services
+ for (INT32 i = 0; i < (INT32) nDisplayServices; ++i)
+ {
+ const ServiceInfo_Impl &rInfo = aDisplayServiceArr[ i ];
+ OUString aImplName;
+ switch (nType)
+ {
+ case TYPE_SPELL : aImplName = rInfo.sSpellImplName; break;
+ case TYPE_HYPH : aImplName = rInfo.sHyphImplName; break;
+ case TYPE_THES : aImplName = rInfo.sThesImplName; break;
+ case TYPE_GRAMMAR : aImplName = rInfo.sGrammarImplName; break;
+ }
+
+ if (aImplName.getLength() && (lcl_SeqGetIndex( aRes, aImplName) == -1)) // name not yet added
+ {
+ DBG_ASSERT( nIdx < aRes.getLength(), "index out of range" );
+ if (nIdx < aRes.getLength())
+ pRes[ nIdx++ ] = aImplName;
+ }
+ }
+ // don't forget to put aRes back to its actual size just in case you allocated too much
+ // since all of the names may have already been added
+ // otherwise you get duplicate entries in the edit dialog
+ aRes.realloc( nIdx );
+ return aRes;
+}
+
+
+ServiceInfo_Impl * SvxLinguData_Impl::GetInfoByImplName( const OUString &rSvcImplName )
+{
+ ServiceInfo_Impl* pInfo = 0;
+ for (ULONG i = 0; i < nDisplayServices && !pInfo; ++i)
+ {
+ ServiceInfo_Impl &rTmp = aDisplayServiceArr[ i ];
+ if (rTmp.sSpellImplName == rSvcImplName ||
+ rTmp.sHyphImplName == rSvcImplName ||
+ rTmp.sThesImplName == rSvcImplName ||
+ rTmp.sGrammarImplName == rSvcImplName)
+ pInfo = &rTmp;
+ }
+ return pInfo;
+}
+
+
+//-----------------------------------------------------------------------------
+
+void lcl_MergeLocales(Sequence< Locale >& aAllLocales, const Sequence< Locale >& rAdd)
+{
+ const Locale* pAdd = rAdd.getConstArray();
+ Sequence<Locale> aLocToAdd(rAdd.getLength());
+ const Locale* pAllLocales = aAllLocales.getConstArray();
+ Locale* pLocToAdd = aLocToAdd.getArray();
+ sal_Int32 nFound = 0;
+ sal_Int32 i;
+ for(i = 0; i < rAdd.getLength(); i++)
+ {
+ sal_Bool bFound = sal_False;
+ for(sal_Int32 j = 0; j < aAllLocales.getLength() && !bFound; j++)
+ {
+ bFound = pAdd[i].Language == pAllLocales[j].Language &&
+ pAdd[i].Country == pAllLocales[j].Country;
+ }
+ if(!bFound)
+ {
+ pLocToAdd[nFound++] = pAdd[i];
+ }
+ }
+ sal_Int32 nLength = aAllLocales.getLength();
+ aAllLocales.realloc( nLength + nFound);
+ Locale* pAllLocales2 = aAllLocales.getArray();
+ for(i = 0; i < nFound; i++)
+ pAllLocales2[nLength++] = pLocToAdd[i];
+}
+/* -----------------------------27.11.00 16:48--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void lcl_MergeDisplayArray(
+ SvxLinguData_Impl &rData,
+ const ServiceInfo_Impl &rToAdd )
+{
+ ULONG nCnt = 0;
+
+ ServiceInfoArr &rSvcInfoArr = rData.GetDisplayServiceArray();
+ ULONG nEntries = rData.GetDisplayServiceCount();
+
+ ServiceInfo_Impl* pEntry;
+ for (ULONG i = 0; i < nEntries; ++i)
+ {
+ pEntry = &rSvcInfoArr[i];
+ if (pEntry && pEntry->sDisplayName == rToAdd.sDisplayName)
+ {
+ if(rToAdd.xSpell.is())
+ {
+ DBG_ASSERT( !pEntry->xSpell.is() &&
+ pEntry->sSpellImplName.getLength() == 0,
+ "merge conflict" );
+ pEntry->sSpellImplName = rToAdd.sSpellImplName;
+ pEntry->xSpell = rToAdd.xSpell;
+ }
+ if(rToAdd.xGrammar.is())
+ {
+ DBG_ASSERT( !pEntry->xGrammar.is() &&
+ pEntry->sGrammarImplName.getLength() == 0,
+ "merge conflict" );
+ pEntry->sGrammarImplName = rToAdd.sGrammarImplName;
+ pEntry->xGrammar = rToAdd.xGrammar;
+ }
+ if(rToAdd.xHyph.is())
+ {
+ DBG_ASSERT( !pEntry->xHyph.is() &&
+ pEntry->sHyphImplName.getLength() == 0,
+ "merge conflict" );
+ pEntry->sHyphImplName = rToAdd.sHyphImplName;
+ pEntry->xHyph = rToAdd.xHyph;
+ }
+ if(rToAdd.xThes.is())
+ {
+ DBG_ASSERT( !pEntry->xThes.is() &&
+ pEntry->sThesImplName.getLength() == 0,
+ "merge conflict" );
+ pEntry->sThesImplName = rToAdd.sThesImplName;
+ pEntry->xThes = rToAdd.xThes;
+ }
+ return ;
+ }
+ ++nCnt;
+ }
+ rData.GetDisplayServiceArray().push_back( rToAdd );
+ rData.SetDisplayServiceCount( nCnt + 1 );
+}
+/* -----------------------------26.11.00 18:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxLinguData_Impl::SvxLinguData_Impl() :
+ nDisplayServices (0)
+{
+ xMSF = ::comphelper::getProcessServiceFactory();
+ uno::Reference < XInterface > xI = xMSF->createInstance(
+ C2U( "com.sun.star.linguistic2.LinguServiceManager" ) );
+ xLinguSrvcMgr = uno::Reference<XLinguServiceManager>(xI, UNO_QUERY);
+ DBG_ASSERT(xLinguSrvcMgr.is(), "No linguistic service available!");
+ if(xLinguSrvcMgr.is())
+ {
+ Locale aCurrentLocale;
+ LanguageType eLang = Application::GetSettings().GetLanguage();
+ SvxLanguageToLocale(aCurrentLocale, eLang);
+ Sequence<Any> aArgs(2);//second arguments has to be empty!
+ aArgs.getArray()[0] <<= SvxGetLinguPropertySet();
+
+ //read spell checker
+ Sequence< OUString > aSpellNames = xLinguSrvcMgr->getAvailableServices(
+ C2U(cSpell), Locale() );
+ const OUString* pSpellNames = aSpellNames.getConstArray();
+
+ sal_Int32 nIdx;
+ for(nIdx = 0; nIdx < aSpellNames.getLength(); nIdx++)
+ {
+ ServiceInfo_Impl aInfo;
+ aInfo.sSpellImplName = pSpellNames[nIdx];
+ aInfo.xSpell = uno::Reference<XSpellChecker>(
+ xMSF->createInstanceWithArguments(aInfo.sSpellImplName, aArgs), UNO_QUERY);
+
+ uno::Reference<XServiceDisplayName> xDispName(aInfo.xSpell, UNO_QUERY);
+ if(xDispName.is())
+ aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale );
+
+ const Sequence< Locale > aLocales( aInfo.xSpell->getLocales() );
+ //! suppress display of entries with no supported languages (see feature 110994)
+ if (aLocales.getLength())
+ {
+ lcl_MergeLocales( aAllServiceLocales, aLocales );
+ lcl_MergeDisplayArray( *this, aInfo );
+ }
+ }
+
+ //read grammar checker
+ Sequence< OUString > aGrammarNames = xLinguSrvcMgr->getAvailableServices(
+ C2U(cGrammar), Locale() );
+ const OUString* pGrammarNames = aGrammarNames.getConstArray();
+ for(nIdx = 0; nIdx < aGrammarNames.getLength(); nIdx++)
+ {
+ ServiceInfo_Impl aInfo;
+ aInfo.sGrammarImplName = pGrammarNames[nIdx];
+ aInfo.xGrammar = uno::Reference<XProofreader>(
+ xMSF->createInstanceWithArguments(aInfo.sGrammarImplName, aArgs), UNO_QUERY);
+
+ uno::Reference<XServiceDisplayName> xDispName(aInfo.xGrammar, UNO_QUERY);
+ if(xDispName.is())
+ aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale );
+
+ const Sequence< Locale > aLocales( aInfo.xGrammar->getLocales() );
+ //! suppress display of entries with no supported languages (see feature 110994)
+ if (aLocales.getLength())
+ {
+ lcl_MergeLocales( aAllServiceLocales, aLocales );
+ lcl_MergeDisplayArray( *this, aInfo );
+ }
+ }
+
+ //read hyphenator
+ Sequence< OUString > aHyphNames = xLinguSrvcMgr->getAvailableServices(
+ C2U(cHyph), Locale() );
+ const OUString* pHyphNames = aHyphNames.getConstArray();
+ for(nIdx = 0; nIdx < aHyphNames.getLength(); nIdx++)
+ {
+ ServiceInfo_Impl aInfo;
+ aInfo.sHyphImplName = pHyphNames[nIdx];
+ aInfo.xHyph = uno::Reference<XHyphenator>(
+ xMSF->createInstanceWithArguments(aInfo.sHyphImplName, aArgs), UNO_QUERY);
+
+ uno::Reference<XServiceDisplayName> xDispName(aInfo.xHyph, UNO_QUERY);
+ if(xDispName.is())
+ aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale );
+
+ const Sequence< Locale > aLocales( aInfo.xHyph->getLocales() );
+ //! suppress display of entries with no supported languages (see feature 110994)
+ if (aLocales.getLength())
+ {
+ lcl_MergeLocales( aAllServiceLocales, aLocales );
+ lcl_MergeDisplayArray( *this, aInfo );
+ }
+ }
+
+ //read thesauri
+ Sequence< OUString > aThesNames = xLinguSrvcMgr->getAvailableServices(
+ C2U(cThes), Locale() );
+ const OUString* pThesNames = aThesNames.getConstArray();
+ for(nIdx = 0; nIdx < aThesNames.getLength(); nIdx++)
+ {
+ ServiceInfo_Impl aInfo;
+ aInfo.sThesImplName = pThesNames[nIdx];
+ aInfo.xThes = uno::Reference<XThesaurus>(
+ xMSF->createInstanceWithArguments(aInfo.sThesImplName, aArgs), UNO_QUERY);
+
+ uno::Reference<XServiceDisplayName> xDispName(aInfo.xThes, UNO_QUERY);
+ if(xDispName.is())
+ aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale );
+
+ const Sequence< Locale > aLocales( aInfo.xThes->getLocales() );
+ //! suppress display of entries with no supported languages (see feature 110994)
+ if (aLocales.getLength())
+ {
+ lcl_MergeLocales( aAllServiceLocales, aLocales );
+ lcl_MergeDisplayArray( *this, aInfo );
+ }
+ }
+
+ Sequence< OUString > aCfgSvcs;
+ const Locale* pAllLocales = aAllServiceLocales.getConstArray();
+ for(sal_Int32 nLocale = 0; nLocale < aAllServiceLocales.getLength(); nLocale++)
+ {
+ INT16 nLang = SvxLocaleToLanguage( pAllLocales[nLocale] );
+
+ aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(C2U(cSpell), pAllLocales[nLocale]);
+ SetChecked( aCfgSvcs );
+ if (aCfgSvcs.getLength())
+ aCfgSpellTable[ nLang ] = aCfgSvcs;
+
+ aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(C2U(cGrammar), pAllLocales[nLocale]);
+ SetChecked( aCfgSvcs );
+ if (aCfgSvcs.getLength())
+ aCfgGrammarTable[ nLang ] = aCfgSvcs;
+
+ aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(C2U(cHyph), pAllLocales[nLocale]);
+ SetChecked( aCfgSvcs );
+ if (aCfgSvcs.getLength())
+ aCfgHyphTable[ nLang ] = aCfgSvcs;
+
+ aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(C2U(cThes), pAllLocales[nLocale]);
+ SetChecked( aCfgSvcs );
+ if (aCfgSvcs.getLength())
+ aCfgThesTable[ nLang ] = aCfgSvcs;
+ }
+ }
+}
+/* -----------------------------22.05.01 10:43--------------------------------
+
+---------------------------------------------------------------------------*/
+SvxLinguData_Impl::SvxLinguData_Impl( const SvxLinguData_Impl &rData ) :
+ aDisplayServiceArr (rData.aDisplayServiceArr),
+ nDisplayServices (rData.nDisplayServices),
+ aAllServiceLocales (rData.aAllServiceLocales),
+ aCfgSpellTable (rData.aCfgSpellTable),
+ aCfgHyphTable (rData.aCfgHyphTable),
+ aCfgThesTable (rData.aCfgThesTable),
+ aCfgGrammarTable (rData.aCfgGrammarTable),
+ xMSF (rData.xMSF),
+ xLinguSrvcMgr (rData.xLinguSrvcMgr)
+{
+}
+/* -----------------------------22.05.01 10:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxLinguData_Impl & SvxLinguData_Impl::operator = (const SvxLinguData_Impl &rData)
+{
+ xMSF = rData.xMSF;
+ xLinguSrvcMgr = rData.xLinguSrvcMgr;
+ aAllServiceLocales = rData.aAllServiceLocales;
+ aCfgSpellTable = rData.aCfgSpellTable;
+ aCfgHyphTable = rData.aCfgHyphTable;
+ aCfgThesTable = rData.aCfgThesTable;
+ aCfgGrammarTable = rData.aCfgGrammarTable;
+ aDisplayServiceArr = rData.aDisplayServiceArr;
+ nDisplayServices = rData.nDisplayServices;
+ return *this;
+}
+/* -----------------------------26.11.00 18:08--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxLinguData_Impl::~SvxLinguData_Impl()
+{
+}
+/* -----------------------------26.11.00 19:42--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxLinguData_Impl::SetChecked(const Sequence<OUString>& rConfiguredServices)
+{
+ const OUString* pConfiguredServices = rConfiguredServices.getConstArray();
+ for(sal_Int32 n = 0; n < rConfiguredServices.getLength(); n++)
+ {
+ ServiceInfo_Impl* pEntry;
+ for (ULONG i = 0; i < nDisplayServices; ++i)
+ {
+ pEntry = &aDisplayServiceArr[i];
+ if (pEntry && !pEntry->bConfigured)
+ {
+ const OUString &rSrvcImplName = pConfiguredServices[n];
+ if (rSrvcImplName.getLength() &&
+ (pEntry->sSpellImplName == rSrvcImplName ||
+ pEntry->sGrammarImplName == rSrvcImplName ||
+ pEntry->sHyphImplName == rSrvcImplName ||
+ pEntry->sThesImplName == rSrvcImplName))
+ {
+ pEntry->bConfigured = sal_True;
+ break;
+ }
+ }
+ }
+ }
+}
+/* -----------------------------26.11.00 20:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+sal_Bool SvxLinguData_Impl::AddRemove(
+ Sequence< OUString > &rConfigured,
+ const OUString &rImplName, BOOL bAdd )
+{
+ sal_Bool bRet = sal_False; // modified?
+
+ INT32 nEntries = rConfigured.getLength();
+ INT32 nPos = lcl_SeqGetEntryPos(rConfigured, rImplName);
+ if (bAdd && nPos < 0) // add new entry
+ {
+ rConfigured.realloc( ++nEntries );
+ OUString *pConfigured = rConfigured.getArray();
+ pConfigured = rConfigured.getArray();
+ pConfigured[nEntries - 1] = rImplName;
+ bRet = sal_True;
+ }
+ else if (!bAdd && nPos >= 0) // remove existing entry
+ {
+ OUString *pConfigured = rConfigured.getArray();
+ for (INT32 i = nPos; i < nEntries - 1; ++i)
+ pConfigured[i] = pConfigured[i + 1];
+ rConfigured.realloc(--nEntries);
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+
+void SvxLinguData_Impl::Reconfigure( const OUString &rDisplayName, BOOL bEnable )
+{
+ DBG_ASSERT( rDisplayName.getLength(), "empty DisplayName" );
+
+ ServiceInfo_Impl *pInfo = 0;
+ ServiceInfo_Impl *pTmp = 0;
+ for (ULONG i = 0; i < nDisplayServices; ++i)
+ {
+ pTmp = &aDisplayServiceArr[i];
+ if (pTmp && pTmp->sDisplayName == rDisplayName)
+ {
+ pInfo = pTmp;
+ break;
+ }
+ }
+ DBG_ASSERT( pInfo, "DisplayName entry not found" );
+ if (pInfo)
+ {
+ pInfo->bConfigured = bEnable;
+
+ Sequence< Locale > aLocales;
+ const Locale *pLocale = 0;
+ INT32 nLocales = 0;
+ INT32 i;
+
+ // update configured spellchecker entries
+ if (pInfo->xSpell.is())
+ {
+ aLocales = pInfo->xSpell->getLocales();
+ pLocale = aLocales.getConstArray();
+ nLocales = aLocales.getLength();
+ for (i = 0; i < nLocales; ++i)
+ {
+ INT16 nLang = SvxLocaleToLanguage( pLocale[i] );
+ if (!aCfgSpellTable.count( nLang ) && bEnable)
+ aCfgSpellTable[ nLang ] = Sequence< OUString >();
+ if (aCfgSpellTable.count( nLang ))
+ AddRemove( aCfgSpellTable[ nLang ], pInfo->sSpellImplName, bEnable );
+ }
+ }
+
+ // update configured grammar checker entries
+ if (pInfo->xGrammar.is())
+ {
+ aLocales = pInfo->xGrammar->getLocales();
+ pLocale = aLocales.getConstArray();
+ nLocales = aLocales.getLength();
+ for (i = 0; i < nLocales; ++i)
+ {
+ INT16 nLang = SvxLocaleToLanguage( pLocale[i] );
+ if (!aCfgGrammarTable.count( nLang ) && bEnable)
+ aCfgGrammarTable[ nLang ] = Sequence< OUString >();
+ if (aCfgGrammarTable.count( nLang ))
+ AddRemove( aCfgGrammarTable[ nLang ], pInfo->sGrammarImplName, bEnable );
+ }
+ }
+
+ // update configured hyphenator entries
+ if (pInfo->xHyph.is())
+ {
+ aLocales = pInfo->xHyph->getLocales();
+ pLocale = aLocales.getConstArray();
+ nLocales = aLocales.getLength();
+ for (i = 0; i < nLocales; ++i)
+ {
+ INT16 nLang = SvxLocaleToLanguage( pLocale[i] );
+ if (!aCfgHyphTable.count( nLang ) && bEnable)
+ aCfgHyphTable[ nLang ] = Sequence< OUString >();
+ if (aCfgHyphTable.count( nLang ))
+ AddRemove( aCfgHyphTable[ nLang ], pInfo->sHyphImplName, bEnable );
+ }
+ }
+
+ // update configured spellchecker entries
+ if (pInfo->xThes.is())
+ {
+ aLocales = pInfo->xThes->getLocales();
+ pLocale = aLocales.getConstArray();
+ nLocales = aLocales.getLength();
+ for (i = 0; i < nLocales; ++i)
+ {
+ INT16 nLang = SvxLocaleToLanguage( pLocale[i] );
+ if (!aCfgThesTable.count( nLang ) && bEnable)
+ aCfgThesTable[ nLang ] = Sequence< OUString >();
+ if (aCfgThesTable.count( nLang ))
+ AddRemove( aCfgThesTable[ nLang ], pInfo->sThesImplName, bEnable );
+ }
+ }
+ }
+}
+
+
+// class SvxLinguTabPage -------------------------------------------------
+
+#define CBCOL_FIRST 0
+#define CBCOL_SECOND 1
+#define CBCOL_BOTH 2
+
+SvxLinguTabPage::SvxLinguTabPage( Window* pParent,
+ const SfxItemSet& rSet ):
+
+ SfxTabPage( pParent, CUI_RES( RID_SFXPAGE_LINGU ), rSet ),
+
+ aLinguisticFL ( this, CUI_RES( FL_LINGUISTIC ) ),
+ aLinguModulesFT ( this, CUI_RES( FT_LINGU_MODULES ) ),
+ aLinguModulesCLB ( this, CUI_RES( CLB_LINGU_MODULES ) ),
+ aLinguModulesEditPB ( this, CUI_RES( PB_LINGU_MODULES_EDIT ) ),
+ aLinguDicsFT ( this, CUI_RES( FT_LINGU_DICS ) ),
+ aLinguDicsCLB ( this, CUI_RES( CLB_LINGU_DICS ) ),
+ aLinguDicsNewPB ( this, CUI_RES( PB_LINGU_DICS_NEW_DIC ) ),
+ aLinguDicsEditPB ( this, CUI_RES( PB_LINGU_DICS_EDIT_DIC ) ),
+ aLinguDicsDelPB ( this, CUI_RES( PB_LINGU_DICS_DEL_DIC ) ),
+ aLinguOptionsFT ( this, CUI_RES( FT_LINGU_OPTIONS ) ),
+ aLinguOptionsCLB ( this, CUI_RES( CLB_LINGU_OPTIONS ) ),
+ aLinguOptionsEditPB ( this, CUI_RES( PB_LINGU_OPTIONS_EDIT ) ),
+ aMoreDictsLink ( this, CUI_RES( FT_LINGU_OPTIONS_MOREDICTS ) ),
+ sCapitalWords ( CUI_RES( STR_CAPITAL_WORDS ) ),
+ sWordsWithDigits ( CUI_RES( STR_WORDS_WITH_DIGITS ) ),
+ sCapitalization ( CUI_RES( STR_CAPITALIZATION ) ),
+ sSpellSpecial ( CUI_RES( STR_SPELL_SPECIAL ) ),
+ sSpellAuto ( CUI_RES( STR_SPELL_AUTO ) ),
+ sGrammarAuto ( CUI_RES( STR_GRAMMAR_AUTO ) ),
+ sNumMinWordlen ( CUI_RES( STR_NUM_MIN_WORDLEN ) ),
+ sNumPreBreak ( CUI_RES( STR_NUM_PRE_BREAK ) ),
+ sNumPostBreak ( CUI_RES( STR_NUM_POST_BREAK ) ),
+ sHyphAuto ( CUI_RES( STR_HYPH_AUTO ) ),
+ sHyphSpecial ( CUI_RES( STR_HYPH_SPECIAL ) ),
+
+ pLinguData ( NULL )
+{
+ pCheckButtonData = NULL;
+
+ aLinguModulesCLB.SetWindowBits( WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE );
+ aLinguModulesCLB.SetHelpId(HID_CLB_LINGU_MODULES );
+ aLinguModulesCLB.SetHighlightRange();
+ aLinguModulesCLB.SetSelectHdl( LINK( this, SvxLinguTabPage, SelectHdl_Impl ));
+ aLinguModulesCLB.SetDoubleClickHdl(LINK(this, SvxLinguTabPage, BoxDoubleClickHdl_Impl));
+ aLinguModulesCLB.SetCheckButtonHdl(LINK(this, SvxLinguTabPage, BoxCheckButtonHdl_Impl));
+
+ aLinguModulesEditPB.SetClickHdl( LINK( this, SvxLinguTabPage, ClickHdl_Impl ));
+ aLinguOptionsEditPB.SetClickHdl( LINK( this, SvxLinguTabPage, ClickHdl_Impl ));
+
+ aLinguDicsCLB.SetWindowBits( WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE );
+ aLinguDicsCLB.SetHelpId(HID_CLB_EDIT_MODULES_DICS );
+ aLinguDicsCLB.SetHighlightRange();
+ aLinguDicsCLB.SetSelectHdl( LINK( this, SvxLinguTabPage, SelectHdl_Impl ));
+ aLinguDicsCLB.SetCheckButtonHdl(LINK(this, SvxLinguTabPage, BoxCheckButtonHdl_Impl));
+
+ aLinguDicsNewPB.SetClickHdl( LINK( this, SvxLinguTabPage, ClickHdl_Impl ));
+ aLinguDicsEditPB.SetClickHdl( LINK( this, SvxLinguTabPage, ClickHdl_Impl ));
+ aLinguDicsDelPB.SetClickHdl( LINK( this, SvxLinguTabPage, ClickHdl_Impl ));
+
+ aLinguOptionsCLB.SetWindowBits( WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE );
+ aLinguOptionsCLB.SetHelpId(HID_CLB_LINGU_OPTIONS );
+ aLinguOptionsCLB.SetHighlightRange();
+ aLinguOptionsCLB.SetSelectHdl( LINK( this, SvxLinguTabPage, SelectHdl_Impl ));
+ aLinguOptionsCLB.SetDoubleClickHdl(LINK(this, SvxLinguTabPage, BoxDoubleClickHdl_Impl));
+
+ if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode()
+ != SvtExtendedSecurityOptions::OPEN_NEVER )
+ {
+ aMoreDictsLink.SetURL( String(
+ RTL_CONSTASCII_STRINGPARAM( "http://extensions.services.openoffice.org/dictionary?cid=926386" ) ) );
+ aMoreDictsLink.SetClickHdl( LINK( this, SvxLinguTabPage, OpenURLHdl_Impl ) );
+ }
+ else
+ aMoreDictsLink.Hide();
+
+
+ // force recalculation of hash value used for checking the need of updating
+ // because new dictionaries might be installed / downloaded.
+ //! Thus it needs to be called now since it may infuence the supported languages
+ //! to be reported AND the found user-dictionaries(!) as well.
+ SvxLinguConfigUpdate::UpdateAll( sal_True );
+
+ xProp = uno::Reference< XPropertySet >( SvxGetLinguPropertySet(), UNO_QUERY );
+ xDicList = uno::Reference< XDictionaryList >( SvxGetDictionaryList(), UNO_QUERY );
+ if (xDicList.is())
+ {
+ // keep references to all **currently** available dictionaries,
+ // since the diclist may get changed meanwhile (e.g. through the API).
+ // We want the dialog to operate on the same set of dictionaries it
+ // was started with.
+ // Also we have to take care to not loose the last reference when
+ // someone else removes a dictionary from the list.
+ // removed dics will be replaced by NULL new entries be added to the end
+ // Thus we may use indizes as consistent references.
+ aDics = xDicList->getDictionaries();
+
+ UpdateDicBox_Impl();
+ }
+ else
+ {
+ aLinguDicsFT.Disable();
+ aLinguDicsCLB.Disable();
+ aLinguDicsNewPB.Disable();
+ aLinguDicsEditPB.Disable();
+ aLinguDicsDelPB.Disable();
+ }
+
+ const SfxSpellCheckItem* pItem = 0;
+ SfxItemState eItemState = SFX_ITEM_UNKNOWN;
+
+ eItemState = rSet.GetItemState( GetWhich( SID_ATTR_SPELL ),
+ sal_False, (const SfxPoolItem**)&pItem );
+
+ // handelt es sich um ein Default-Item?
+ if ( eItemState == SFX_ITEM_DEFAULT )
+ pItem = (const SfxSpellCheckItem*)&(rSet.Get( GetWhich( SID_ATTR_SPELL ) ) );
+ else if ( eItemState == SFX_ITEM_DONTCARE )
+ pItem = NULL;
+
+ FreeResource();
+}
+
+// -----------------------------------------------------------------------
+
+SvxLinguTabPage::~SvxLinguTabPage()
+{
+ if (pLinguData)
+ delete pLinguData;
+}
+
+//------------------------------------------------------------------------
+
+//nicht �berladen wegschmeissen
+sal_uInt16* SvxLinguTabPage::GetRanges()
+{
+ //TL???
+ return pRanges;
+}
+
+//------------------------------------------------------------------------
+
+SfxTabPage* SvxLinguTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SvxLinguTabPage( pParent, rAttrSet ) );
+}
+
+//------------------------------------------------------------------------
+
+Any lcl_Bool2Any(BOOL bVal)
+{
+ Any aRet(&bVal, ::getBooleanCppuType());
+ return aRet;
+}
+
+
+sal_Bool lcl_Bool2Any(Any& rVal)
+{
+ return *(sal_Bool*)rVal.getValue();
+}
+
+
+sal_Bool SvxLinguTabPage::FillItemSet( SfxItemSet& rCoreSet )
+{
+ sal_Bool bModified = sal_True; // !!!!
+
+ // if not HideGroups was called with GROUP_MODULES...
+ if (aLinguModulesCLB.IsVisible())
+ {
+ DBG_ASSERT( pLinguData, "pLinguData not yet initialized" );
+ if (!pLinguData)
+ pLinguData = new SvxLinguData_Impl;
+
+ LangImplNameTable::const_iterator aIt;
+
+ // update spellchecker configuration entries
+ const LangImplNameTable *pTable = &pLinguData->GetSpellTable();
+ for (aIt = pTable->begin(); aIt != pTable->end(); ++aIt)
+ {
+ INT16 nLang = aIt->first;
+ const Sequence< OUString > aImplNames( aIt->second );
+#if OSL_DEBUG_LEVEL > 1
+ const OUString *pTmpStr;
+ pTmpStr = aImplNames.getConstArray();
+#endif
+ uno::Reference< XLinguServiceManager > xMgr( pLinguData->GetManager() );
+ Locale aLocale( SvxCreateLocale(nLang) );
+ if (xMgr.is())
+ xMgr->setConfiguredServices( C2U(cSpell), aLocale, aImplNames );
+ }
+
+ // update grammar checker configuration entries
+ pTable = &pLinguData->GetGrammarTable();
+ for (aIt = pTable->begin(); aIt != pTable->end(); ++aIt)
+ {
+ INT16 nLang = aIt->first;
+ const Sequence< OUString > aImplNames( aIt->second );
+#if OSL_DEBUG_LEVEL > 1
+ const OUString *pTmpStr;
+ pTmpStr = aImplNames.getConstArray();
+#endif
+ uno::Reference< XLinguServiceManager > xMgr( pLinguData->GetManager() );
+ Locale aLocale( SvxCreateLocale(nLang) );
+ if (xMgr.is())
+ xMgr->setConfiguredServices( C2U(cGrammar), aLocale, aImplNames );
+ }
+
+ // update hyphenator configuration entries
+ pTable = &pLinguData->GetHyphTable();
+ for (aIt = pTable->begin(); aIt != pTable->end(); ++aIt)
+ {
+ INT16 nLang = aIt->first;
+ const Sequence< OUString > aImplNames( aIt->second );
+#if OSL_DEBUG_LEVEL > 1
+ const OUString *pTmpStr;
+ pTmpStr = aImplNames.getConstArray();
+#endif
+ uno::Reference< XLinguServiceManager > xMgr( pLinguData->GetManager() );
+ Locale aLocale( SvxCreateLocale(nLang) );
+ if (xMgr.is())
+ xMgr->setConfiguredServices( C2U(cHyph), aLocale, aImplNames );
+ }
+
+ // update thesaurus configuration entries
+ pTable = &pLinguData->GetThesTable();
+ for (aIt = pTable->begin(); aIt != pTable->end(); ++aIt)
+ {
+ INT16 nLang = aIt->first;
+ const Sequence< OUString > aImplNames( aIt->second );
+#if OSL_DEBUG_LEVEL > 1
+ const OUString *pTmpStr;
+ pTmpStr = aImplNames.getConstArray();
+#endif
+ uno::Reference< XLinguServiceManager > xMgr( pLinguData->GetManager() );
+ Locale aLocale( SvxCreateLocale(nLang) );
+ if (xMgr.is())
+ xMgr->setConfiguredServices( C2U(cThes), aLocale, aImplNames );
+ }
+ }
+
+
+ //
+ // activate dictionaries according to checkbox state
+ //
+ Sequence< OUString > aActiveDics;
+ INT32 nActiveDics = 0;
+ ULONG nEntries = aLinguDicsCLB.GetEntryCount();
+ for (ULONG i = 0; i < nEntries; ++i)
+ {
+ INT32 nDics = aDics.getLength();
+// const uno::Reference< XDictionary > *pDic = aDics.getConstArray();
+
+ aActiveDics.realloc( nDics );
+ OUString *pActiveDic = aActiveDics.getArray();
+
+ SvLBoxEntry *pEntry = aLinguDicsCLB.GetEntry( i );
+ if (pEntry)
+ {
+ DicUserData aData( (ULONG)pEntry->GetUserData() );
+ if (aData.GetEntryId() < nDics)
+ {
+ BOOL bChecked = aLinguDicsCLB.IsChecked( (USHORT) i );
+ uno::Reference< XDictionary > xDic( aDics.getConstArray()[ i ] );
+ if (xDic.is())
+ {
+ if (SvxGetIgnoreAllList() == xDic)
+ bChecked = TRUE;
+ xDic->setActive( bChecked );
+
+ if (bChecked)
+ {
+ String aDicName( xDic->getName() );
+ pActiveDic[ nActiveDics++ ] = aDicName;
+ }
+ }
+ }
+ }
+ }
+ //
+ aActiveDics.realloc( nActiveDics );
+ Any aTmp;
+ aTmp <<= aActiveDics;
+ SvtLinguConfig aLngCfg;
+ aLngCfg.SetProperty( UPH_ACTIVE_DICTIONARIES, aTmp );
+
+
+ nEntries = aLinguOptionsCLB.GetEntryCount();
+ for (USHORT j = 0; j < nEntries; ++j)
+ {
+ SvLBoxEntry *pEntry = aLinguOptionsCLB.GetEntry( j );
+
+ OptionsUserData aData( (ULONG)pEntry->GetUserData() );
+ String aPropName( lcl_GetPropertyName( (EID_OPTIONS) aData.GetEntryId() ) );
+
+ Any aAny;
+ if (aData.IsCheckable())
+ {
+ BOOL bChecked = aLinguOptionsCLB.IsChecked( j );
+ aAny <<= bChecked;
+ }
+ else if (aData.HasNumericValue())
+ {
+ INT16 nVal = aData.GetNumericValue();
+ aAny <<= nVal;
+ }
+
+ if (xProp.is())
+ xProp->setPropertyValue( aPropName, aAny );
+ aLngCfg.SetProperty( aPropName, aAny );
+ }
+
+ SvLBoxEntry *pPreBreakEntry = aLinguOptionsCLB.GetEntry( (USHORT) EID_NUM_PRE_BREAK );
+ SvLBoxEntry *pPostBreakEntry = aLinguOptionsCLB.GetEntry( (USHORT) EID_NUM_POST_BREAK );
+ DBG_ASSERT( pPreBreakEntry, "NULL Pointer" );
+ DBG_ASSERT( pPostBreakEntry, "NULL Pointer" );
+ if (pPreBreakEntry && pPostBreakEntry)
+ {
+ OptionsUserData aPreBreakData( (ULONG)pPreBreakEntry->GetUserData() );
+ OptionsUserData aPostBreakData( (ULONG)pPostBreakEntry->GetUserData() );
+ if ( aPreBreakData.IsModified() || aPostBreakData.IsModified() )
+ {
+ SfxHyphenRegionItem aHyp( GetWhich( SID_ATTR_HYPHENREGION ) );
+ aHyp.GetMinLead() = (UINT8) aPreBreakData.GetNumericValue();
+ aHyp.GetMinTrail() = (UINT8) aPostBreakData.GetNumericValue();
+ rCoreSet.Put( aHyp );
+ }
+ }
+
+
+ // automatic spell checking
+ BOOL bNewAutoCheck = aLinguOptionsCLB.IsChecked( (USHORT) EID_SPELL_AUTO );
+ const SfxPoolItem* pOld = GetOldItem( rCoreSet, SID_AUTOSPELL_CHECK );
+ if ( !pOld || ( (SfxBoolItem*)pOld )->GetValue() != bNewAutoCheck )
+ {
+ rCoreSet.Put( SfxBoolItem( GetWhich( SID_AUTOSPELL_CHECK ),
+ bNewAutoCheck ) );
+ bModified |= sal_True;
+ }
+
+ return bModified;
+}
+
+// ----------------------------------------------------------------------
+
+ULONG SvxLinguTabPage::GetDicUserData( const uno::Reference< XDictionary > &rxDic, USHORT nIdx )
+{
+ ULONG nRes = 0;
+ DBG_ASSERT( rxDic.is(), "dictionary not supplied" );
+ if (rxDic.is())
+ {
+ uno::Reference< frame::XStorable > xStor( rxDic, UNO_QUERY );
+
+// ULONG nUserData = 0;
+ BOOL bChecked = rxDic->isActive();
+ BOOL bEditable = !xStor.is() || !xStor->isReadonly();
+ BOOL bDeletable = bEditable;
+// BOOL bNegativ = rxDic->getDictionaryType() == DictionaryType_NEGATIVE;
+
+ nRes = DicUserData( nIdx,
+ bChecked, bEditable, bDeletable ).GetUserData();
+ }
+ return nRes;
+}
+
+
+void SvxLinguTabPage::AddDicBoxEntry(
+ const uno::Reference< XDictionary > &rxDic,
+ USHORT nIdx )
+{
+ aLinguDicsCLB.SetUpdateMode(FALSE);
+
+ String aTxt( ::GetDicInfoStr( rxDic->getName(),
+ SvxLocaleToLanguage( rxDic->getLocale() ),
+ DictionaryType_NEGATIVE == rxDic->getDictionaryType() ) );
+ aLinguDicsCLB.InsertEntry( aTxt, (USHORT)LISTBOX_APPEND ); // append at end
+ SvLBoxEntry* pEntry = aLinguDicsCLB.GetEntry( aLinguDicsCLB.GetEntryCount() - 1 );
+ DBG_ASSERT( pEntry, "failed to add entry" );
+ if (pEntry)
+ {
+ DicUserData aData( GetDicUserData( rxDic, nIdx ) );
+ pEntry->SetUserData( (void *) aData.GetUserData() );
+ lcl_SetCheckButton( pEntry, aData.IsChecked() );
+ }
+
+ aLinguDicsCLB.SetUpdateMode(TRUE);
+}
+
+// ----------------------------------------------------------------------
+
+void SvxLinguTabPage::UpdateDicBox_Impl()
+{
+ aLinguDicsCLB.SetUpdateMode(FALSE);
+ aLinguDicsCLB.Clear();
+
+ INT32 nDics = aDics.getLength();
+ const uno::Reference< XDictionary > *pDic = aDics.getConstArray();
+ for (INT32 i = 0; i < nDics; ++i)
+ {
+ const uno::Reference< XDictionary > &rDic = pDic[i];
+ if (rDic.is())
+ AddDicBoxEntry( rDic, (USHORT)i );
+ }
+
+ aLinguDicsCLB.SetUpdateMode(TRUE);
+}
+
+// ----------------------------------------------------------------------
+
+void SvxLinguTabPage::UpdateModulesBox_Impl()
+{
+ if (pLinguData)
+ {
+ const ServiceInfoArr &rAllDispSrvcArr = pLinguData->GetDisplayServiceArray();
+ const ULONG nDispSrvcCount = pLinguData->GetDisplayServiceCount();
+
+ aLinguModulesCLB.Clear();
+
+ for (USHORT i = 0; i < nDispSrvcCount; ++i)
+ {
+ const ServiceInfo_Impl &rInfo = rAllDispSrvcArr[i];
+ aLinguModulesCLB.InsertEntry( rInfo.sDisplayName, (USHORT)LISTBOX_APPEND );
+ SvLBoxEntry* pEntry = aLinguModulesCLB.GetEntry(i);
+ pEntry->SetUserData( (void *) &rInfo );
+ aLinguModulesCLB.CheckEntryPos( i, rInfo.bConfigured );
+ }
+ aLinguModulesEditPB.Enable( nDispSrvcCount > 0 );
+ }
+}
+
+//------------------------------------------------------------------------
+
+void SvxLinguTabPage::Reset( const SfxItemSet& rSet )
+{
+ // if not HideGroups was called with GROUP_MODULES...
+ if (aLinguModulesCLB.IsVisible())
+ {
+ if (!pLinguData)
+ pLinguData = new SvxLinguData_Impl;
+ UpdateModulesBox_Impl();
+ }
+
+
+ //
+ // get data from configuration
+ //
+
+ SvtLinguConfig aLngCfg;
+
+ aLinguOptionsCLB.SetUpdateMode(FALSE);
+ aLinguOptionsCLB.Clear();
+
+ SvLBoxTreeList *pModel = aLinguOptionsCLB.GetModel();
+ SvLBoxEntry* pEntry = NULL;
+
+ INT16 nVal = 0;
+ BOOL bVal = FALSE;
+ ULONG nUserData = 0;
+
+ pEntry = CreateEntry( sSpellAuto, CBCOL_FIRST );
+ aLngCfg.GetProperty( C2U(UPN_IS_SPELL_AUTO) ) >>= bVal;
+ const SfxPoolItem* pItem = GetItem( rSet, SID_AUTOSPELL_CHECK );
+ if (pItem)
+ bVal = ((SfxBoolItem *) pItem)->GetValue();
+ nUserData = OptionsUserData( EID_SPELL_AUTO, FALSE, 0, TRUE, bVal).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+ lcl_SetCheckButton( pEntry, bVal );
+
+ pEntry = CreateEntry( sGrammarAuto, CBCOL_FIRST );
+ aLngCfg.GetProperty( C2U(UPN_IS_GRAMMAR_AUTO) ) >>= bVal;
+// const SfxPoolItem* pItem = GetItem( rSet, SID_AUTOSPELL_CHECK );
+// if (pItem)
+// bVal = ((SfxBoolItem *) pItem)->GetValue();
+ nUserData = OptionsUserData( EID_GRAMMAR_AUTO, FALSE, 0, TRUE, bVal).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+ lcl_SetCheckButton( pEntry, bVal );
+
+ pEntry = CreateEntry( sCapitalWords, CBCOL_FIRST );
+ aLngCfg.GetProperty( C2U(UPN_IS_SPELL_UPPER_CASE) ) >>= bVal;
+ nUserData = OptionsUserData( EID_CAPITAL_WORDS, FALSE, 0, TRUE, bVal).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+ lcl_SetCheckButton( pEntry, bVal );
+
+ pEntry = CreateEntry( sWordsWithDigits, CBCOL_FIRST );
+ aLngCfg.GetProperty( C2U(UPN_IS_SPELL_WITH_DIGITS) ) >>= bVal;
+ nUserData = OptionsUserData( EID_WORDS_WITH_DIGITS, FALSE, 0, TRUE, bVal).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+ lcl_SetCheckButton( pEntry, bVal );
+
+ pEntry = CreateEntry( sCapitalization, CBCOL_FIRST );
+ aLngCfg.GetProperty( C2U(UPN_IS_SPELL_CAPITALIZATION) ) >>= bVal;
+ nUserData = OptionsUserData( EID_CAPITALIZATION, FALSE, 0, TRUE, bVal).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+ lcl_SetCheckButton( pEntry, bVal );
+
+ pEntry = CreateEntry( sSpellSpecial, CBCOL_FIRST );
+ aLngCfg.GetProperty( C2U(UPN_IS_SPELL_SPECIAL) ) >>= bVal;
+ nUserData = OptionsUserData( EID_SPELL_SPECIAL, FALSE, 0, TRUE, bVal).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+ lcl_SetCheckButton( pEntry, bVal );
+
+ pEntry = CreateEntry( sNumMinWordlen, CBCOL_SECOND );
+ aLngCfg.GetProperty( C2U(UPN_HYPH_MIN_WORD_LENGTH) ) >>= nVal;
+ nUserData = OptionsUserData( EID_NUM_MIN_WORDLEN, TRUE, (USHORT)nVal, FALSE, FALSE).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+
+ const SfxHyphenRegionItem *pHyp = NULL;
+ USHORT nWhich = GetWhich( SID_ATTR_HYPHENREGION );
+ if ( rSet.GetItemState( nWhich, FALSE ) == SFX_ITEM_SET )
+ pHyp = &( (const SfxHyphenRegionItem &) rSet.Get( nWhich ) );
+
+ pEntry = CreateEntry( sNumPreBreak, CBCOL_SECOND );
+ aLngCfg.GetProperty( C2U(UPN_HYPH_MIN_LEADING) ) >>= nVal;
+ if (pHyp)
+ nVal = (INT16) pHyp->GetMinLead();
+ nUserData = OptionsUserData( EID_NUM_PRE_BREAK, TRUE, (USHORT)nVal, FALSE, FALSE).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+
+ pEntry = CreateEntry( sNumPostBreak, CBCOL_SECOND );
+ aLngCfg.GetProperty( C2U(UPN_HYPH_MIN_TRAILING) ) >>= nVal;
+ if (pHyp)
+ nVal = (INT16) pHyp->GetMinTrail();
+ nUserData = OptionsUserData( EID_NUM_POST_BREAK, TRUE, (USHORT)nVal, FALSE, FALSE).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+
+ pEntry = CreateEntry( sHyphAuto, CBCOL_FIRST );
+ aLngCfg.GetProperty( C2U(UPN_IS_HYPH_AUTO) ) >>= bVal;
+ nUserData = OptionsUserData( EID_HYPH_AUTO, FALSE, 0, TRUE, bVal).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+ lcl_SetCheckButton( pEntry, bVal );
+
+ pEntry = CreateEntry( sHyphSpecial, CBCOL_FIRST );
+ aLngCfg.GetProperty( C2U(UPN_IS_HYPH_SPECIAL) ) >>= bVal;
+ nUserData = OptionsUserData( EID_HYPH_SPECIAL, FALSE, 0, TRUE, bVal).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+ lcl_SetCheckButton( pEntry, bVal );
+
+ aLinguOptionsCLB.SetUpdateMode(TRUE);
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxLinguTabPage, BoxDoubleClickHdl_Impl, SvTreeListBox *, pBox )
+{
+ if (pBox == &aLinguModulesCLB)
+ {
+ //! in order to avoid a bug causing a GPF when double clicking
+ //! on a module entry and exiting the "Edit Modules" dialog
+ //! after that.
+ Application::PostUserEvent( LINK(
+ this, SvxLinguTabPage, PostDblClickHdl_Impl ) );
+ }
+ else if (pBox == &aLinguOptionsCLB)
+ {
+ ClickHdl_Impl(&aLinguOptionsEditPB);
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxLinguTabPage, PostDblClickHdl_Impl, SvTreeListBox *, EMPTYARG )
+{
+ ClickHdl_Impl(&aLinguModulesEditPB);
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxLinguTabPage, OpenURLHdl_Impl, svt::FixedHyperlink *, EMPTYARG )
+{
+ ::rtl::OUString sURL( aMoreDictsLink.GetURL() );
+ lcl_OpenURL( sURL );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxLinguTabPage, BoxCheckButtonHdl_Impl, SvTreeListBox *, pBox )
+{
+ if (pBox == &aLinguModulesCLB)
+ {
+ DBG_ASSERT( pLinguData, "NULL pointer, LinguData missing" );
+ USHORT nPos = aLinguModulesCLB.GetSelectEntryPos();
+ if (nPos != LISTBOX_ENTRY_NOTFOUND && pLinguData)
+ {
+ pLinguData->Reconfigure( aLinguModulesCLB.GetText( nPos ),
+ aLinguModulesCLB.IsChecked( nPos ) );
+ }
+ }
+ else if (pBox == &aLinguDicsCLB)
+ {
+ USHORT nPos = aLinguDicsCLB.GetSelectEntryPos();
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ const uno::Reference< XDictionary > &rDic = aDics.getConstArray()[ nPos ];
+ if (SvxGetIgnoreAllList() == rDic)
+ {
+ SvLBoxEntry* pEntry = aLinguDicsCLB.GetEntry( nPos );
+ if (pEntry)
+ lcl_SetCheckButton( pEntry, TRUE );
+ }
+ }
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, PushButton *, pBtn )
+{
+ if (&aLinguModulesEditPB == pBtn)
+ {
+ if (!pLinguData)
+ pLinguData = new SvxLinguData_Impl;
+
+ SvxLinguData_Impl aOldLinguData( *pLinguData );
+ SvxEditModulesDlg aDlg( this, *pLinguData );
+ if (aDlg.Execute() != RET_OK)
+ *pLinguData = aOldLinguData;
+
+ // evaluate new status of 'bConfigured' flag
+ ULONG nLen = pLinguData->GetDisplayServiceCount();
+ for (ULONG i = 0; i < nLen; ++i)
+ pLinguData->GetDisplayServiceArray()[i].bConfigured = FALSE;
+ const Locale* pAllLocales = pLinguData->GetAllSupportedLocales().getConstArray();
+ INT32 nLocales = pLinguData->GetAllSupportedLocales().getLength();
+ for (INT32 k = 0; k < nLocales; ++k)
+ {
+ INT16 nLang = SvxLocaleToLanguage( pAllLocales[k] );
+ if (pLinguData->GetSpellTable().count( nLang ))
+ pLinguData->SetChecked( pLinguData->GetSpellTable()[ nLang ] );
+ if (pLinguData->GetGrammarTable().count( nLang ))
+ pLinguData->SetChecked( pLinguData->GetGrammarTable()[ nLang ] );
+ if (pLinguData->GetHyphTable().count( nLang ))
+ pLinguData->SetChecked( pLinguData->GetHyphTable()[ nLang ] );
+ if (pLinguData->GetThesTable().count( nLang ))
+ pLinguData->SetChecked( pLinguData->GetThesTable()[ nLang ] );
+ }
+
+ // show new status of modules
+ UpdateModulesBox_Impl();
+ }
+ else if (&aLinguDicsNewPB == pBtn)
+ {
+ uno::Reference< XSpellChecker1 > xSpellChecker1;
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractSvxNewDictionaryDialog* aDlg = pFact->CreateSvxNewDictionaryDialog( this, xSpellChecker1, RID_SFXDLG_NEWDICT );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");
+ uno::Reference< XDictionary > xNewDic;
+ if ( aDlg->Execute() == RET_OK )
+ xNewDic = uno::Reference< XDictionary >( aDlg->GetNewDictionary(), UNO_QUERY );
+ if ( xNewDic.is() )
+ {
+ // add new dics to the end
+ INT32 nLen = aDics.getLength();
+ aDics.realloc( nLen + 1 );
+
+ aDics.getArray()[ nLen ] = xNewDic;
+
+ AddDicBoxEntry( xNewDic, (USHORT) nLen );
+ }
+ delete aDlg; //add by CHINA001
+ }
+ }
+ else if (&aLinguDicsEditPB == pBtn)
+ {
+ SvLBoxEntry *pEntry = aLinguDicsCLB.GetCurEntry();
+ if (pEntry)
+ {
+ DicUserData aData( (ULONG) pEntry->GetUserData() );
+ USHORT nDicPos = aData.GetEntryId();
+ INT32 nDics = aDics.getLength();
+ if (nDicPos < nDics)
+ {
+ uno::Reference< XDictionary > xDic;
+ xDic = aDics.getConstArray()[ nDicPos ];
+ if (xDic.is())
+ {
+ uno::Reference< XSpellChecker1 > xSpellChecker1;
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ VclAbstractDialog* aDlg = pFact->CreateSvxEditDictionaryDialog( this, xDic->getName(), xSpellChecker1, RID_SFXDLG_EDITDICT );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");
+ aDlg->Execute();
+ delete aDlg;
+ }
+ }
+ }
+ }
+ }
+ else if (&aLinguDicsDelPB == pBtn)
+ {
+ if ( RET_NO ==
+ QueryBox( this, CUI_RES( RID_SFXQB_DELDICT ) ).Execute() )
+ return 0;
+
+ SvLBoxEntry *pEntry = aLinguDicsCLB.GetCurEntry();
+ if (pEntry)
+ {
+ DicUserData aData( (ULONG) pEntry->GetUserData() );
+ USHORT nDicPos = aData.GetEntryId();
+ INT32 nDics = aDics.getLength();
+ if (nDicPos < nDics)
+ {
+ uno::Reference< XDictionary > xDic;
+ xDic = aDics.getConstArray()[ nDicPos ];
+ if (xDic.is())
+ {
+ if (SvxGetIgnoreAllList() == xDic)
+ xDic->clear();
+ else
+ {
+ if (xDicList.is())
+ xDicList->removeDictionary( xDic );
+
+ uno::Reference< frame::XStorable > xStor( xDic, UNO_QUERY );
+ if ( xStor->hasLocation() && !xStor->isReadonly() )
+ {
+ String sURL = xStor->getLocation();
+ INetURLObject aObj(sURL);
+ DBG_ASSERT( aObj.GetProtocol() == INET_PROT_FILE,
+ "non-file URLs cannot be deleted" );
+ if ( aObj.GetProtocol() == INET_PROT_FILE )
+ {
+ KillFile_Impl( aObj.GetMainURL( INetURLObject::NO_DECODE ) );
+ }
+ }
+
+ aDics.getArray()[ nDicPos ] = 0;
+
+ // remove entry from checklistbox
+ ULONG nCnt = aLinguDicsCLB.GetEntryCount();
+ for (ULONG i = 0; i < nCnt; ++i)
+ {
+ SvLBoxEntry *pDicEntry = aLinguDicsCLB.GetEntry( i );
+ DBG_ASSERT( pDicEntry, "missing entry" );
+ if (pDicEntry)
+ {
+ DicUserData aDicData( (ULONG) pDicEntry->GetUserData() );
+ if (aDicData.GetEntryId() == nDicPos )
+ {
+ aLinguDicsCLB.RemoveEntry( (USHORT) i );
+ break;
+ }
+ }
+ }
+ DBG_ASSERT( nCnt > aLinguDicsCLB.GetEntryCount(),
+ "remove failed ?");
+ }
+ }
+ }
+ }
+ }
+ else if (&aLinguOptionsEditPB == pBtn)
+ {
+ SvLBoxEntry *pEntry = aLinguOptionsCLB.GetCurEntry();
+ DBG_ASSERT( pEntry, "no entry selected" );
+ if (pEntry)
+ {
+ long nVal = -1;
+ OptionsUserData aData( (ULONG)pEntry->GetUserData() );
+ if(aData.HasNumericValue())
+ {
+ int nRID = -1;
+ switch (aData.GetEntryId())
+ {
+ case EID_NUM_PRE_BREAK : nRID = STR_NUM_PRE_BREAK_DLG; break;
+ case EID_NUM_POST_BREAK : nRID = STR_NUM_POST_BREAK_DLG; break;
+ case EID_NUM_MIN_WORDLEN: nRID = STR_NUM_MIN_WORDLEN_DLG; break;
+ default:
+ DBG_ERROR( "unexpected case" );
+ }
+
+ OptionsBreakSet aDlg( this, nRID );
+ aDlg.GetNumericFld().SetValue( aData.GetNumericValue() );
+ if (RET_OK == aDlg.Execute() )
+ {
+ nVal = static_cast<long>(aDlg.GetNumericFld().GetValue());
+ if (-1 != nVal && aData.GetNumericValue() != nVal)
+ {
+ aData.SetNumericValue( (BYTE)nVal ); //! sets IsModified !
+ pEntry->SetUserData( (void *) aData.GetUserData() );
+ aLinguOptionsCLB.Invalidate();
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ DBG_ERROR( "pBtn unexpected value" );
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxLinguTabPage, SelectHdl_Impl, SvxCheckListBox *, pBox )
+{
+ if (&aLinguModulesCLB == pBox)
+ {
+ }
+ else if (&aLinguDicsCLB == pBox)
+ {
+ SvLBoxEntry *pEntry = pBox->GetCurEntry();
+ if (pEntry)
+ {
+ DicUserData aData( (ULONG) pEntry->GetUserData() );
+
+ // always allow to edit (i.e. at least view the content of the dictionary)
+ aLinguDicsEditPB.Enable( true/*aData.IsEditable()*/ );
+ aLinguDicsDelPB .Enable( aData.IsDeletable() );
+ }
+ }
+ else if (&aLinguOptionsCLB == pBox)
+ {
+ SvLBoxEntry *pEntry = pBox->GetCurEntry();
+ if (pEntry)
+ {
+ OptionsUserData aData( (ULONG) pEntry->GetUserData() );
+ aLinguOptionsEditPB.Enable( aData.HasNumericValue() );
+ }
+ }
+ else
+ {
+ DBG_ERROR( "pBox unexpected value" );
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SvLBoxEntry* SvxLinguTabPage::CreateEntry( String& rTxt, USHORT nCol )
+{
+ SvLBoxEntry* pEntry = new SvLBoxEntry;
+
+ if( !pCheckButtonData )
+ pCheckButtonData = new SvLBoxButtonData( &aLinguOptionsCLB );
+
+ String sEmpty;
+ if (CBCOL_FIRST == nCol)
+ pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) );
+ if (CBCOL_SECOND == nCol)
+ pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte
+ pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff!
+ pEntry->AddItem( new BrwString_Impl( pEntry, 0, rTxt ) );
+
+ return pEntry;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLinguTabPage::HideGroups( sal_uInt16 nGrp )
+{
+ if ( 0 != ( GROUP_MODULES & nGrp ) )
+ {
+ aLinguModulesFT.Hide();
+ aLinguModulesCLB.Hide();
+ aLinguModulesEditPB.Hide();
+
+ // reposition / resize remaining controls
+ long nDeltaY = aLinguDicsFT.GetPosPixel().Y() -
+ aLinguModulesFT.GetPosPixel().Y();
+ DBG_ASSERT( nDeltaY >= 0, "move/resize value is negative" );
+ Point aPos;
+ //
+ aPos = aLinguDicsFT.GetPosPixel();
+ aPos.Y() -= nDeltaY;
+ aLinguDicsFT.SetPosPixel( aPos );
+ aPos = aLinguDicsCLB.GetPosPixel();
+ aPos.Y() -= nDeltaY;
+ aLinguDicsCLB.SetPosPixel( aPos );
+ aPos = aLinguDicsNewPB.GetPosPixel();
+ aPos.Y() -= nDeltaY;
+ aLinguDicsNewPB.SetPosPixel( aPos );
+ aPos = aLinguDicsEditPB.GetPosPixel();
+ aPos.Y() -= nDeltaY;
+ aLinguDicsEditPB.SetPosPixel( aPos );
+ aPos = aLinguDicsDelPB.GetPosPixel();
+ aPos.Y() -= nDeltaY;
+ aLinguDicsDelPB.SetPosPixel( aPos );
+ //
+ aPos = aLinguOptionsFT.GetPosPixel();
+ aPos.Y() -= nDeltaY;
+ aLinguOptionsFT.SetPosPixel( aPos );
+ aPos = aLinguOptionsCLB.GetPosPixel();
+ aPos.Y() -= nDeltaY;
+ aLinguOptionsCLB.SetPosPixel( aPos );
+ aPos = aLinguOptionsEditPB.GetPosPixel();
+ aPos.Y() -= nDeltaY;
+ aLinguOptionsEditPB.SetPosPixel( aPos );
+ //
+ Size aSize( aLinguOptionsCLB.GetSizePixel() );
+ aSize.Height() += nDeltaY;
+ aLinguOptionsCLB.SetSizePixel( aSize );
+
+ if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode()
+ != SvtExtendedSecurityOptions::OPEN_NEVER )
+ {
+ aSize = GetOutputSizePixel();
+ aSize.Height() += ( aMoreDictsLink.GetSizePixel().Height() * 11 / 8 );
+ SetSizePixel( aSize );
+ aMoreDictsLink.Show();
+ }
+ }
+}
+/*--------------------------------------------------
+--------------------------------------------------*/
+
+SvxEditModulesDlg::SvxEditModulesDlg(Window* pParent, SvxLinguData_Impl& rData) :
+ ModalDialog( pParent, CUI_RES(RID_SVXDLG_EDIT_MODULES ) ),
+ aModulesFL ( this, CUI_RES( FL_EDIT_MODULES_OPTIONS ) ),
+ aLanguageFT ( this, CUI_RES( FT_EDIT_MODULES_LANGUAGE ) ),
+ aLanguageLB ( this, CUI_RES( LB_EDIT_MODULES_LANGUAGE ), FALSE ),
+ aModulesCLB ( this, CUI_RES( CLB_EDIT_MODULES_MODULES ) ),
+ aPrioUpPB ( this, CUI_RES( PB_EDIT_MODULES_PRIO_UP ) ),
+ aPrioDownPB ( this, CUI_RES( PB_EDIT_MODULES_PRIO_DOWN ) ),
+ aBackPB ( this, CUI_RES( PB_EDIT_MODULES_PRIO_BACK ) ),
+ aMoreDictsLink ( this, CUI_RES( FT_EDIT_MODULES_NEWDICTSLINK ) ),
+ aButtonsFL ( this, CUI_RES( FL_EDIT_MODULES_BUTTONS ) ),
+ aHelpPB ( this, CUI_RES( PB_HELP ) ),
+ aClosePB ( this, CUI_RES( PB_OK ) ),
+ sSpell ( CUI_RES( ST_SPELL ) ),
+ sHyph ( CUI_RES( ST_HYPH ) ),
+ sThes ( CUI_RES( ST_THES ) ),
+ sGrammar ( CUI_RES( ST_GRAMMAR ) ),
+ rLinguData ( rData )
+{
+ pCheckButtonData = NULL;
+ FreeResource();
+
+ pDefaultLinguData = new SvxLinguData_Impl( rLinguData );
+
+ aModulesCLB.SetWindowBits( WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE );
+ aModulesCLB.SetHighlightRange();
+ aModulesCLB.SetHelpId(HID_CLB_EDIT_MODULES_MODULES );
+ aModulesCLB.SetSelectHdl( LINK( this, SvxEditModulesDlg, SelectHdl_Impl ));
+ aModulesCLB.SetCheckButtonHdl( LINK( this, SvxEditModulesDlg, BoxCheckButtonHdl_Impl) );
+
+ aClosePB .SetClickHdl( LINK( this, SvxEditModulesDlg, ClickHdl_Impl ));
+ aPrioUpPB .SetClickHdl( LINK( this, SvxEditModulesDlg, UpDownHdl_Impl ));
+ aPrioDownPB.SetClickHdl( LINK( this, SvxEditModulesDlg, UpDownHdl_Impl ));
+ aBackPB .SetClickHdl( LINK( this, SvxEditModulesDlg, BackHdl_Impl ));
+ // in case of not installed language modules
+ aPrioUpPB .Enable( FALSE );
+ aPrioDownPB.Enable( FALSE );
+
+ if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode()
+ != SvtExtendedSecurityOptions::OPEN_NEVER )
+ {
+ aMoreDictsLink.SetURL( String(
+ RTL_CONSTASCII_STRINGPARAM( "http://extensions.services.openoffice.org/dictionary?cid=926386" ) ) );
+ aMoreDictsLink.SetClickHdl( LINK( this, SvxEditModulesDlg, OpenURLHdl_Impl ) );
+ }
+ else
+ {
+ aMoreDictsLink.Hide();
+ long nPos = aMoreDictsLink.GetPosPixel().Y() + aMoreDictsLink.GetSizePixel().Height();
+ Size aSize = aModulesCLB.GetSizePixel();
+ aSize.Height() += ( nPos - ( aModulesCLB.GetPosPixel().Y() + aSize.Height() ) );
+ aModulesCLB.SetSizePixel( aSize );
+ }
+
+ //
+ //fill language box
+ //
+ Sequence< INT16 > aAvailLang;
+ uno::Reference< XAvailableLocales > xAvail( rLinguData.GetManager(), UNO_QUERY );
+ if (xAvail.is())
+ {
+ aAvailLang = lcl_LocaleSeqToLangSeq(
+ xAvail->getAvailableLocales( C2U(cSpell) ) );
+ }
+ const Sequence< Locale >& rLoc = rLinguData.GetAllSupportedLocales();
+ const Locale* pLocales = rLoc.getConstArray();
+ aLanguageLB.Clear();
+ for(long i = 0; i < rLoc.getLength(); i++)
+ {
+ INT16 nLang = SvxLocaleToLanguage( pLocales[i] );
+ aLanguageLB.InsertLanguage( nLang, lcl_SeqHasLang( aAvailLang, nLang ) );
+ }
+ LanguageType eSysLang = MsLangId::getSystemLanguage();
+ aLanguageLB.SelectLanguage( eSysLang );
+ if(!aLanguageLB.IsLanguageSelected( eSysLang ) )
+ aLanguageLB.SelectEntryPos(0);
+
+ aLanguageLB.SetSelectHdl( LINK( this, SvxEditModulesDlg, LangSelectHdl_Impl ));
+ LangSelectHdl_Impl(&aLanguageLB);
+}
+
+
+SvxEditModulesDlg::~SvxEditModulesDlg()
+{
+ delete pDefaultLinguData;
+}
+
+
+SvLBoxEntry* SvxEditModulesDlg::CreateEntry( String& rTxt, USHORT nCol )
+{
+ SvLBoxEntry* pEntry = new SvLBoxEntry;
+ if( !pCheckButtonData )
+ {
+ pCheckButtonData = new SvLBoxButtonData( &aModulesCLB );
+ pCheckButtonData->SetLink( aModulesCLB.GetCheckButtonHdl() );
+ }
+
+ String sEmpty;
+ if (CBCOL_FIRST == nCol)
+ pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) );
+ if (CBCOL_SECOND == nCol)
+ pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte
+ pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff!
+ pEntry->AddItem( new BrwStringDic_Impl( pEntry, 0, rTxt ) );
+
+ return pEntry;
+}
+
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SvxEditModulesDlg, SelectHdl_Impl, SvxCheckListBox *, pBox )
+{
+ if (&aModulesCLB == pBox)
+ {
+ sal_Bool bDisableUp = sal_True;
+ sal_Bool bDisableDown = sal_True;
+ SvLBoxEntry *pEntry = pBox->GetCurEntry();
+ if (pEntry)
+ {
+ ModuleUserData_Impl* pData = (ModuleUserData_Impl*)pEntry->GetUserData();
+ if(!pData->IsParent() && pData->GetType() != TYPE_HYPH)
+ {
+ USHORT nCurPos = pBox->GetSelectEntryPos();
+ if(nCurPos < pBox->GetEntryCount() - 1)
+ {
+ bDisableDown = ((ModuleUserData_Impl*)pBox->
+ GetEntry(nCurPos + 1)->GetUserData())->IsParent();
+ }
+ if(nCurPos > 1)
+ {
+ bDisableUp = ((ModuleUserData_Impl*)pBox->
+ GetEntry(nCurPos - 1)->GetUserData())->IsParent();
+ }
+ }
+ aPrioUpPB.Enable(!bDisableUp);
+ aPrioDownPB.Enable(!bDisableDown);
+ }
+ }
+ else
+ {
+ DBG_ERROR( "pBox unexpected value" );
+ }
+
+ return 0;
+}
+/* -----------------------------28.05.01 11:00--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SvxEditModulesDlg, BoxCheckButtonHdl_Impl, SvTreeListBox *, pBox )
+{
+// if (pBox == (SvTreeListBox *) &aModulesCLB)
+// {
+ pBox = &aModulesCLB;
+ SvLBoxEntry *pCurEntry = pBox->GetCurEntry();
+ if (pCurEntry)
+ {
+ ModuleUserData_Impl* pData = (ModuleUserData_Impl *)
+ pCurEntry->GetUserData();
+ if (!pData->IsParent() && pData->GetType() == TYPE_HYPH)
+ {
+ // make hyphenator checkboxes function as radio-buttons
+ // (at most one box may be checked)
+ SvLBoxEntry *pEntry = pBox->First();
+ while (pEntry)
+ {
+ pData = (ModuleUserData_Impl *) pEntry->GetUserData();
+ if (!pData->IsParent() &&
+ pData->GetType() == TYPE_HYPH &&
+ pEntry != pCurEntry)
+ {
+ lcl_SetCheckButton( pEntry, FALSE );
+ pBox->InvalidateEntry( pEntry );
+ }
+ pEntry = pBox->Next( pEntry );
+ }
+ }
+ }
+// }
+ return 0;
+}
+/* -----------------------------27.11.00 14:00--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString lcl_GetServiceName(BYTE nType)
+{
+ switch(nType)
+ {
+ case TYPE_SPELL : return C2U(cSpell);
+ case TYPE_GRAMMAR : return C2U(cGrammar);
+ case TYPE_HYPH : return C2U(cHyph);
+ case TYPE_THES : return C2U(cThes);
+ }
+ return OUString();
+}
+
+
+IMPL_LINK( SvxEditModulesDlg, LangSelectHdl_Impl, ListBox *, pBox )
+{
+ LanguageType eCurLanguage = aLanguageLB.GetSelectLanguage();
+ static Locale aLastLocale;
+ Locale aCurLocale;
+ SvxLanguageToLocale(aCurLocale, eCurLanguage);
+ SvLBoxTreeList *pModel = aModulesCLB.GetModel();
+// uno::Reference<XLinguServiceManager>& xMgr = rLinguData.GetManager();
+
+ if (pBox)
+ {
+ // save old probably changed settings
+ // before switching to new language entries
+
+ INT16 nLang = SvxLocaleToLanguage( aLastLocale );
+
+ sal_Int32 nStart = 0, nLocalIndex = 0;
+ Sequence< OUString > aChange;
+ sal_Bool bChanged = FALSE;
+ for(USHORT i = 0; i < aModulesCLB.GetEntryCount(); i++)
+ {
+ SvLBoxEntry *pEntry = aModulesCLB.GetEntry(i);
+ ModuleUserData_Impl* pData = (ModuleUserData_Impl*)pEntry->GetUserData();
+ if(pData->IsParent())
+ {
+ if(bChanged)
+ {
+ LangImplNameTable *pTable = 0;
+ BYTE nType = pData->GetType();
+ switch (nType - 1)
+ {
+ case TYPE_SPELL : pTable = &rLinguData.GetSpellTable(); break;
+ case TYPE_GRAMMAR : pTable = &rLinguData.GetGrammarTable(); break;
+ case TYPE_HYPH : pTable = &rLinguData.GetHyphTable(); break;
+ case TYPE_THES : pTable = &rLinguData.GetThesTable(); break;
+ }
+ if (pTable)
+ {
+ aChange.realloc(nStart);
+ (*pTable)[ nLang ] = aChange;
+ }
+ }
+ nLocalIndex = nStart = 0;
+ aChange.realloc(aModulesCLB.GetEntryCount());
+ bChanged = FALSE;
+ }
+ else
+ {
+ OUString* pChange = aChange.getArray();
+ pChange[nStart] = pData->GetImplName();
+ bChanged |= pData->GetIndex() != nLocalIndex ||
+ pData->IsChecked() != aModulesCLB.IsChecked(i);
+ if(aModulesCLB.IsChecked(i))
+ nStart++;
+ ++nLocalIndex;
+ }
+ }
+ if(bChanged)
+ {
+ aChange.realloc(nStart);
+ rLinguData.GetThesTable()[ nLang ] = aChange;
+ }
+ }
+
+ for(ULONG i = 0; i < aModulesCLB.GetEntryCount(); i++)
+ delete (ModuleUserData_Impl*)aModulesCLB.GetEntry(i)->GetUserData();
+
+ //
+ // display entries for new selected language
+ //
+ aModulesCLB.Clear();
+ if(LANGUAGE_DONTKNOW != eCurLanguage)
+ {
+// sal_Int32 nEntryPos = 1;
+
+ ULONG n;
+ ServiceInfo_Impl* pInfo;
+
+ //
+ // spellchecker entries
+ //
+ SvLBoxEntry* pEntry = CreateEntry( sSpell, CBCOL_SECOND );
+ ModuleUserData_Impl* pUserData = new ModuleUserData_Impl(
+ String(), TRUE, FALSE, TYPE_SPELL, 0 );
+ pEntry->SetUserData( (void *)pUserData );
+ pModel->Insert( pEntry );
+ //
+ Sequence< OUString > aNames( rLinguData.GetSortedImplNames( eCurLanguage, TYPE_SPELL ) );
+ const OUString *pName = aNames.getConstArray();
+ ULONG nNames = (ULONG) aNames.getLength();
+ sal_Int32 nLocalIndex = 0; // index relative to parent
+ for (n = 0; n < nNames; ++n)
+ {
+ OUString aImplName;
+ BOOL bIsSuppLang = FALSE;
+
+ pInfo = rLinguData.GetInfoByImplName( pName[n] );
+ if (pInfo)
+ {
+ bIsSuppLang = pInfo->xSpell.is() &&
+ pInfo->xSpell->hasLocale( aCurLocale );
+ aImplName = pInfo->sSpellImplName;
+ }
+ if (aImplName.getLength() && bIsSuppLang)
+ {
+ String aTxt( pInfo->sDisplayName );
+ SvLBoxEntry* pNewEntry = CreateEntry( aTxt, CBCOL_FIRST );
+
+ LangImplNameTable &rTable = rLinguData.GetSpellTable();
+ const bool bHasLang = rTable.count( eCurLanguage );
+ if (!bHasLang)
+ {
+ DBG_WARNING( "language entry missing" ); // only relevant if all languages found should be supported
+ }
+ const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0;
+ lcl_SetCheckButton( pNewEntry, bCheck );
+ pUserData = new ModuleUserData_Impl( aImplName, FALSE,
+ bCheck, TYPE_SPELL, (BYTE)nLocalIndex++ );
+ pNewEntry->SetUserData( (void *)pUserData );
+ pModel->Insert( pNewEntry );
+ }
+ }
+
+ //
+ // grammar checker entries
+ //
+ pEntry = CreateEntry( sGrammar, CBCOL_SECOND );
+ pUserData = new ModuleUserData_Impl( String(), TRUE, FALSE, TYPE_GRAMMAR, 0 );
+ pEntry->SetUserData( (void *)pUserData );
+ pModel->Insert( pEntry );
+ //
+ aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_GRAMMAR );
+ pName = aNames.getConstArray();
+ nNames = (ULONG) aNames.getLength();
+ nLocalIndex = 0;
+ for (n = 0; n < nNames; ++n)
+ {
+ OUString aImplName;
+ BOOL bIsSuppLang = FALSE;
+
+ pInfo = rLinguData.GetInfoByImplName( pName[n] );
+ if (pInfo)
+ {
+ bIsSuppLang = pInfo->xGrammar.is() &&
+ pInfo->xGrammar->hasLocale( aCurLocale );
+ aImplName = pInfo->sGrammarImplName;
+ }
+ if (aImplName.getLength() && bIsSuppLang)
+ {
+ String aTxt( pInfo->sDisplayName );
+ SvLBoxEntry* pNewEntry = CreateEntry( aTxt, CBCOL_FIRST );
+
+ LangImplNameTable &rTable = rLinguData.GetGrammarTable();
+ const bool bHasLang = rTable.count( eCurLanguage );
+ if (!bHasLang)
+ {
+ DBG_WARNING( "language entry missing" ); // only relevant if all languages found should be supported
+ }
+ const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0;
+ lcl_SetCheckButton( pNewEntry, bCheck );
+ pUserData = new ModuleUserData_Impl( aImplName, FALSE,
+ bCheck, TYPE_GRAMMAR, (BYTE)nLocalIndex++ );
+ pNewEntry->SetUserData( (void *)pUserData );
+ pModel->Insert( pNewEntry );
+ }
+ }
+
+ //
+ // hyphenator entries
+ //
+ pEntry = CreateEntry( sHyph, CBCOL_SECOND );
+ pUserData = new ModuleUserData_Impl( String(), TRUE, FALSE, TYPE_HYPH, 0 );
+ pEntry->SetUserData( (void *)pUserData );
+ pModel->Insert( pEntry );
+ //
+ aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_HYPH );
+ pName = aNames.getConstArray();
+ nNames = (ULONG) aNames.getLength();
+ nLocalIndex = 0;
+ for (n = 0; n < nNames; ++n)
+ {
+ OUString aImplName;
+ BOOL bIsSuppLang = FALSE;
+
+ pInfo = rLinguData.GetInfoByImplName( pName[n] );
+ if (pInfo)
+ {
+ bIsSuppLang = pInfo->xHyph.is() &&
+ pInfo->xHyph->hasLocale( aCurLocale );
+ aImplName = pInfo->sHyphImplName;
+ }
+ if (aImplName.getLength() && bIsSuppLang)
+ {
+ String aTxt( pInfo->sDisplayName );
+ SvLBoxEntry* pNewEntry = CreateEntry( aTxt, CBCOL_FIRST );
+
+ LangImplNameTable &rTable = rLinguData.GetHyphTable();
+ const bool bHasLang = rTable.count( eCurLanguage );
+ if (!bHasLang)
+ {
+ DBG_WARNING( "language entry missing" ); // only relevant if all languages found should be supported
+ }
+ const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0;
+ lcl_SetCheckButton( pNewEntry, bCheck );
+ pUserData = new ModuleUserData_Impl( aImplName, FALSE,
+ bCheck, TYPE_HYPH, (BYTE)nLocalIndex++ );
+ pNewEntry->SetUserData( (void *)pUserData );
+ pModel->Insert( pNewEntry );
+ }
+ }
+
+ //
+ // thesaurus entries
+ //
+ pEntry = CreateEntry( sThes, CBCOL_SECOND );
+ pUserData = new ModuleUserData_Impl( String(), TRUE, FALSE, TYPE_THES, 0 );
+ pEntry->SetUserData( (void *)pUserData );
+ pModel->Insert( pEntry );
+ //
+ aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_THES );
+ pName = aNames.getConstArray();
+ nNames = (ULONG) aNames.getLength();
+ nLocalIndex = 0;
+ for (n = 0; n < nNames; ++n)
+ {
+ OUString aImplName;
+ BOOL bIsSuppLang = FALSE;
+
+ pInfo = rLinguData.GetInfoByImplName( pName[n] );
+ if (pInfo)
+ {
+ bIsSuppLang = pInfo->xThes.is() &&
+ pInfo->xThes->hasLocale( aCurLocale );
+ aImplName = pInfo->sThesImplName;
+ }
+ if (aImplName.getLength() && bIsSuppLang)
+ {
+ String aTxt( pInfo->sDisplayName );
+ SvLBoxEntry* pNewEntry = CreateEntry( aTxt, CBCOL_FIRST );
+
+ LangImplNameTable &rTable = rLinguData.GetThesTable();
+ const bool bHasLang = rTable.count( eCurLanguage );
+ if (!bHasLang)
+ {
+ DBG_WARNING( "language entry missing" ); // only relevant if all languages found should be supported
+ }
+ const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0;
+ lcl_SetCheckButton( pNewEntry, bCheck );
+ pUserData = new ModuleUserData_Impl( aImplName, FALSE,
+ bCheck, TYPE_THES, (BYTE)nLocalIndex++ );
+ pNewEntry->SetUserData( (void *)pUserData );
+ pModel->Insert( pNewEntry );
+ }
+ }
+ }
+ aLastLocale.Language = aCurLocale.Language;
+ aLastLocale.Country = aCurLocale.Country;
+ return 0;
+}
+/* -----------------------------27.11.00 19:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SvxEditModulesDlg, UpDownHdl_Impl, PushButton *, pBtn )
+{
+ sal_Bool bUp = &aPrioUpPB == pBtn;
+ USHORT nCurPos = aModulesCLB.GetSelectEntryPos();
+ SvLBoxEntry* pEntry;
+ if (nCurPos != LISTBOX_ENTRY_NOTFOUND &&
+ 0 != (pEntry = aModulesCLB.GetEntry(nCurPos)))
+ {
+ aModulesCLB.SetUpdateMode(FALSE);
+ SvLBoxTreeList *pModel = aModulesCLB.GetModel();
+
+ ModuleUserData_Impl* pData = (ModuleUserData_Impl*)pEntry->GetUserData();
+ String aStr(aModulesCLB.GetEntryText(pEntry));
+ SvLBoxEntry* pToInsert = CreateEntry( aStr, CBCOL_FIRST );
+ pToInsert->SetUserData( (void *)pData);
+ BOOL bIsChecked = aModulesCLB.IsChecked(nCurPos);
+
+ pModel->Remove(pEntry);
+
+ USHORT nDestPos = bUp ? nCurPos - 1 : nCurPos + 1;
+ pModel->Insert(pToInsert, nDestPos);
+ aModulesCLB.CheckEntryPos(nDestPos, bIsChecked );
+ aModulesCLB.SelectEntryPos(nDestPos );
+ SelectHdl_Impl(&aModulesCLB);
+ aModulesCLB.SetUpdateMode(TRUE);
+ }
+ return 0;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SvxEditModulesDlg, ClickHdl_Impl, PushButton *, pBtn )
+{
+ if (&aClosePB == pBtn)
+ {
+ // store language config
+ LangSelectHdl_Impl(&aLanguageLB);
+ EndDialog( RET_OK );
+ }
+ else
+ {
+ DBG_ERROR( "pBtn unexpected value" );
+ }
+
+ return 0;
+}
+/* -----------------------------27.11.00 20:31--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SvxEditModulesDlg, BackHdl_Impl, PushButton *, EMPTYARG )
+{
+ rLinguData = *pDefaultLinguData;
+ LangSelectHdl_Impl(0);
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxEditModulesDlg, OpenURLHdl_Impl, svt::FixedHyperlink *, EMPTYARG )
+{
+ ::rtl::OUString sURL( aMoreDictsLink.GetURL() );
+ lcl_OpenURL( sURL );
+ return 0;
+}
+
diff --git a/cui/source/options/optlingu.hrc b/cui/source/options/optlingu.hrc
new file mode 100644
index 000000000000..73b481cbb6a3
--- /dev/null
+++ b/cui/source/options/optlingu.hrc
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optlingu.hrc,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// defines ---------------------------------------------------------------
+
+#define FL_LINGUISTIC 101
+
+#define FT_LINGU_MODULES 111
+#define CLB_LINGU_MODULES 112
+#define PB_LINGU_MODULES_EDIT 113
+
+#define FT_LINGU_OPTIONS 121
+#define CLB_LINGU_OPTIONS 122
+#define PB_LINGU_OPTIONS_EDIT 123
+#define FT_LINGU_OPTIONS_MOREDICTS 124
+
+#define STR_CAPITAL_WORDS 201
+#define STR_WORDS_WITH_DIGITS 202
+#define STR_CAPITALIZATION 203
+#define STR_SPELL_SPECIAL 204
+#define STR_SPELL_AUTO 206
+#define STR_NUM_PRE_BREAK 209
+#define STR_NUM_POST_BREAK 210
+#define STR_HYPH_AUTO 211
+#define STR_HYPH_SPECIAL 212
+#define STR_NUM_MIN_WORDLEN 213
+
+#define STR_NUM_PRE_BREAK_DLG 214
+#define STR_NUM_POST_BREAK_DLG 215
+#define STR_NUM_MIN_WORDLEN_DLG 216
+
+#define STR_GRAMMAR_AUTO 217
+
+#define STR_WARNING 63
+
+#define PB_OK 70
+#define PB_HELP 72
+
+#define ST_SPELL 82
+#define ST_HYPH 83
+#define ST_THES 84
+#define ST_GRAMMAR 85
+
+#define FL_NUMVAL_PREBREAK 305
+#define BT_OK_PREBREAK 306
+#define BT_CANCEL_PREBREAK 307
+#define ED_PREBREAK 308
+#define PB_EDIT_MODULES_PRIO_UP 309
+#define PB_EDIT_MODULES_PRIO_DOWN 310
+#define PB_EDIT_MODULES_PRIO_BACK 311
+
+#define FT_LINGU_DICS 312
+#define CLB_LINGU_DICS 313
+#define PB_LINGU_DICS_NEW_DIC 314
+#define PB_LINGU_DICS_EDIT_DIC 315
+#define PB_LINGU_DICS_DEL_DIC 316
+
+#define FL_EDIT_MODULES_OPTIONS 317
+#define FT_EDIT_MODULES_LANGUAGE 318
+#define LB_EDIT_MODULES_LANGUAGE 319
+#define CLB_EDIT_MODULES_MODULES 320
+#define FT_EDIT_MODULES_NEWDICTSLINK 321
+#define FL_EDIT_MODULES_BUTTONS 322
+
diff --git a/cui/source/options/optlingu.src b/cui/source/options/optlingu.src
new file mode 100644
index 000000000000..c0cb4489cd59
--- /dev/null
+++ b/cui/source/options/optlingu.src
@@ -0,0 +1,357 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optlingu.src,v $
+ * $Revision: 1.51 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// include ------------------------------------------------------------------
+
+#include "optlingu.hrc"
+#include "helpid.hrc"
+
+#include <svtools/controldims.hrc>
+#include <sfx2/sfx.hrc>
+#include <cuires.hrc>
+
+// RID_SVXDLG_EDIT_MODULES ---------------------------------------------------
+
+ModalDialog RID_SVXDLG_EDIT_MODULES
+{
+ HelpID = HID_EDIT_MODULES ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Size = MAP_APPFONT ( 240 , 197 ) ;
+ Text [ en-US ] = "Edit Modules";
+
+ FixedLine FL_EDIT_MODULES_OPTIONS
+ {
+ Pos = MAP_APPFONT ( RSC_SP_FLGR_INNERBORDER_LEFT , RSC_SP_FLGR_INNERBORDER_TOP ) ;
+ Size = MAP_APPFONT ( 240 - 2*RSC_SP_FLGR_INNERBORDER_LEFT , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Options";
+ };
+ FixedText FT_EDIT_MODULES_LANGUAGE
+ {
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 68 , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Language";
+ };
+ ListBox LB_EDIT_MODULES_LANGUAGE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 83 , 14 ) ;
+ Size = MAP_APPFONT ( 95 , 80 ) ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ Control CLB_EDIT_MODULES_MODULES
+ {
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 166 , 120 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_EDIT_MODULES_PRIO_UP
+ {
+ Pos = MAP_APPFONT ( 184 , 32 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Move Up";
+ };
+ PushButton PB_EDIT_MODULES_PRIO_DOWN
+ {
+ Pos = MAP_APPFONT ( 184 , 49 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Move Down";
+ };
+ PushButton PB_EDIT_MODULES_PRIO_BACK
+ {
+ Pos = MAP_APPFONT ( 184 , 66 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Back";
+ };
+ FixedText FT_EDIT_MODULES_NEWDICTSLINK
+ {
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 155 ) ;
+ Size = MAP_APPFONT ( 169 , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "~Get more dictionaries online...";
+ };
+ FixedLine FL_EDIT_MODULES_BUTTONS
+ {
+ Pos = MAP_APPFONT ( 0 , 166 ) ;
+ Size = MAP_APPFONT ( 240 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 12, 177 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 184 , 177 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ Text [ en-US ] = "Close";
+ };
+
+ String ST_SPELL
+ {
+ Text [ en-US ] = "Spelling";
+ };
+ String ST_HYPH
+ {
+ Text [ en-US ] = "Hyphenation";
+ };
+ String ST_THES
+ {
+ Text [ en-US ] = "Thesaurus";
+ };
+ String ST_GRAMMAR
+ {
+ Text [ en-US ] = "Grammar";
+ };
+};
+
+// RID_SVXDLG_LNG_ED_NUM_PREBREAK -------------------------------------------
+
+ModalDialog RID_SVXDLG_LNG_ED_NUM_PREBREAK
+{
+ HelpID = HID_LNGDLG_NUM_PREBREAK ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Size = MAP_APPFONT ( 155 , 43 ) ;
+ Text [ en-US ] = "Hyphenation";
+ FixedLine FL_NUMVAL_PREBREAK
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 87 , 8 ) ;
+ };
+ OKButton BT_OK_PREBREAK
+ {
+ Pos = MAP_APPFONT ( 99 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL_PREBREAK
+ {
+ Pos = MAP_APPFONT ( 99 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ NumericField ED_PREBREAK
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 56 , 14 ) ;
+ Size = MAP_APPFONT ( 31 , 12 ) ;
+ Left = TRUE ;
+ Minimum = 2 ;
+ Maximum = 9 ;
+ Last = 9 ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ SpinSize = 1;
+ };
+ String STR_NUM_PRE_BREAK_DLG
+ {
+ Text [ en-US ] = "Characters before break";
+ };
+ String STR_NUM_POST_BREAK_DLG
+ {
+ Text [ en-US ] = "Characters after break";
+ };
+ String STR_NUM_MIN_WORDLEN_DLG
+ {
+ Text [ en-US ] = "Minimal word length";
+ };
+};
+
+// RID_SFXPAGE_LINGU --------------------------------------------------------
+
+TabPage RID_SFXPAGE_LINGU
+{
+ HelpId = HID_OPTIONS_LINGU ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "Options";
+ FixedLine FL_LINGUISTIC
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Writing aids";
+ };
+ FixedText FT_LINGU_MODULES
+ {
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 175 , 8 ) ;
+ Text [ en-US ] = "Available language modules";
+ };
+ Control CLB_LINGU_MODULES
+ {
+ Pos = MAP_APPFONT ( 12 , 25 ) ;
+ Size = MAP_APPFONT ( 182 , 30 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_LINGU_MODULES_EDIT
+ {
+ Pos = MAP_APPFONT ( 198 , 25 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Edit...";
+ };
+ FixedText FT_LINGU_DICS
+ {
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 59 ) ;
+ Size = MAP_APPFONT ( 175 , 8 ) ;
+ Text [ en-US ] = "User-defined dictionaries";
+ };
+ Control CLB_LINGU_DICS
+ {
+ Pos = MAP_APPFONT ( 12 , 70 ) ;
+ Size = MAP_APPFONT ( 182 , 48 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_LINGU_DICS_NEW_DIC
+ {
+ Pos = MAP_APPFONT ( 198 , 70 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~New...";
+ };
+ PushButton PB_LINGU_DICS_EDIT_DIC
+ {
+ Pos = MAP_APPFONT ( 198 , 87 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Ed~it...";
+ };
+ PushButton PB_LINGU_DICS_DEL_DIC
+ {
+ Pos = MAP_APPFONT ( 198 , 104 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Delete";
+ };
+ FixedText FT_LINGU_OPTIONS
+ {
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 122 ) ;
+ Size = MAP_APPFONT ( 175 , 8 ) ;
+ Text [ en-US ] = "~Options";
+ };
+ Control CLB_LINGU_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 12 , 133 ) ;
+ Size = MAP_APPFONT ( 182 , 46 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_LINGU_OPTIONS_EDIT
+ {
+ Pos = MAP_APPFONT ( 198 , 133 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Edi~t...";
+ };
+ FixedText FT_LINGU_OPTIONS_MOREDICTS
+ {
+ Left = TRUE ;
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 182 ) ;
+ Size = MAP_APPFONT ( 182 , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "~Get more dictionaries online...";
+ };
+
+ String STR_CAPITAL_WORDS
+ {
+ Text [ en-US ] = "Check uppercase words";
+ };
+ String STR_WORDS_WITH_DIGITS
+ {
+ Text [ en-US ] = "Check words with numbers ";
+ };
+ String STR_CAPITALIZATION
+ {
+ Text [ en-US ] = "Check capitalization";
+ };
+ String STR_SPELL_SPECIAL
+ {
+ Text [ en-US ] = "Check special regions";
+ };
+ String STR_SPELL_AUTO
+ {
+ Text [ en-US ] = "Check spelling as you type";
+ };
+ String STR_GRAMMAR_AUTO
+ {
+ Text [ en-US ] = "Check grammar as you type";
+ };
+ String STR_NUM_MIN_WORDLEN
+ {
+ Text [ en-US ] = "Minimal number of characters for hyphenation: ";
+ };
+ String STR_NUM_PRE_BREAK
+ {
+ Text [ en-US ] = "Characters before line break: ";
+ };
+ String STR_NUM_POST_BREAK
+ {
+ Text [ en-US ] = "Characters after line break: ";
+ };
+ String STR_HYPH_AUTO
+ {
+ Text [ en-US ] = "Hyphenate without inquiry";
+ };
+ String STR_HYPH_SPECIAL
+ {
+ Text [ en-US ] = "Hyphenate special regions";
+ };
+};
+// end: TabPage RID_SFXPAGE_LINGU
+
+ // RID_SFXQB_DELDICT --------------------------------------------------------
+QueryBox RID_SFXQB_DELDICT
+{
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_NO ;
+ Message [ en-US ] = "Do you want to delete the dictionary?" ;
+};
+ // RID_SFXQB_DEL_IGNORELIST ----------------------------------------------
+QueryBox RID_SFXQB_DEL_IGNORELIST
+{
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_NO ;
+ Message [ en-US ] = "Do you want to delete the ignore list?" ;
+};
+ // ******************************************************************* EOF
diff --git a/cui/source/options/optmemory.cxx b/cui/source/options/optmemory.cxx
new file mode 100644
index 000000000000..a72660ba2e0f
--- /dev/null
+++ b/cui/source/options/optmemory.cxx
@@ -0,0 +1,274 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optmemory.cxx,v $
+ * $Revision: 1.21 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include <svtools/langtab.hxx>
+#include <svl/zforlist.hxx>
+#include <goodies/grfmgr.hxx>
+#include <svl/flagitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <unotools/lingucfg.hxx>
+#include <svl/szitem.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <vcl/msgbox.hxx>
+#include <rtl/math.hxx>
+#include <unotools/undoopt.hxx>
+#include <unotools/useroptions.hxx>
+#include <unotools/cacheoptions.hxx>
+#include <unotools/fontoptions.hxx>
+#include <svtools/menuoptions.hxx>
+#include <unotools/startoptions.hxx>
+#include <svl/cjkoptions.hxx>
+#include <svtools/miscopt.hxx>
+#include <unotools/syslocaleoptions.hxx>
+#include <svtools/helpopt.hxx>
+#include <unotools/configitem.hxx>
+#include <sfx2/objsh.hxx>
+#include <comphelper/types.hxx>
+#include <svx/unolingu.hxx>
+#include <svx/langitem.hxx>
+#include "cuioptgenrl.hxx"
+#include "optpath.hxx"
+#include "optsave.hxx"
+#include "optlingu.hxx"
+#include <svx/xpool.hxx>
+#include <svx/dlgutil.hxx>
+#include "cuitabarea.hxx"
+#include <cuires.hrc>
+#include "optmemory.hrc"
+#include "optmemory.hxx"
+#include <svx/ofaitem.hxx>
+#include <cuires.hrc>
+#include "helpid.hrc"
+#include <dialmgr.hxx>
+
+#define CONFIG_LANGUAGES "OfficeLanguages"
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::utl;
+using namespace ::rtl;
+using namespace ::sfx2;
+
+
+#define NF2BYTES 104857.6 // 2^20/10, used for aNfGraphicObjectCache-unit -> Byte
+#define BYTES2NF (1.0/NF2BYTES) // 10/2^20
+
+
+inline long OfaMemoryOptionsPage::GetNfGraphicCacheVal( void ) const
+{
+ return static_cast<long>(aNfGraphicCache.GetValue() << 20);
+}
+
+inline void OfaMemoryOptionsPage::SetNfGraphicCacheVal( long nSizeInBytes )
+{
+ aNfGraphicCache.SetValue( nSizeInBytes >> 20 );
+}
+
+long OfaMemoryOptionsPage::GetNfGraphicObjectCacheVal( void ) const
+{
+ return long( ::rtl::math::round( double( aNfGraphicObjectCache.GetValue() ) * NF2BYTES ) );
+}
+
+void OfaMemoryOptionsPage::SetNfGraphicObjectCacheVal( long nSizeInBytes )
+{
+ aNfGraphicObjectCache.SetValue( long( ::rtl::math::round( double( nSizeInBytes ) * BYTES2NF ) ) );
+}
+
+inline void OfaMemoryOptionsPage::SetNfGraphicObjectCacheMax( long nSizeInBytes )
+{
+ aNfGraphicObjectCache.SetMax( long( double( nSizeInBytes ) * BYTES2NF ) );
+}
+
+inline void OfaMemoryOptionsPage::SetNfGraphicObjectCacheLast( long nSizeInBytes )
+{
+ aNfGraphicObjectCache.SetLast( long( double( nSizeInBytes ) * BYTES2NF ) );
+}
+
+int OfaMemoryOptionsPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return LEAVE_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+OfaMemoryOptionsPage::OfaMemoryOptionsPage(Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, CUI_RES( OFA_TP_MEMORY ), rSet ),
+
+ aUndoBox ( this, CUI_RES( GB_UNDO ) ),
+ aUndoText ( this, CUI_RES( FT_UNDO ) ),
+ aUndoEdit ( this, CUI_RES( ED_UNDO ) ),
+ aGbGraphicCache ( this, CUI_RES( GB_GRAPHICCACHE ) ),
+ aFtGraphicCache ( this, CUI_RES( FT_GRAPHICCACHE ) ),
+ aNfGraphicCache ( this, CUI_RES( NF_GRAPHICCACHE ) ),
+ aFtGraphicCacheUnit ( this, CUI_RES( FT_GRAPHICCACHE_UNIT ) ),
+ aFtGraphicObjectCache ( this, CUI_RES( FT_GRAPHICOBJECTCACHE ) ),
+ aNfGraphicObjectCache ( this, CUI_RES( NF_GRAPHICOBJECTCACHE ) ),
+ aFtGraphicObjectCacheUnit(this, CUI_RES( FT_GRAPHICOBJECTCACHE_UNIT ) ),
+ aFtGraphicObjectTime ( this, CUI_RES( FT_GRAPHICOBJECTTIME ) ),
+ aTfGraphicObjectTime ( this, CUI_RES( TF_GRAPHICOBJECTTIME ) ),
+ aFtGraphicObjectTimeUnit( this, CUI_RES( FT_GRAPHICOBJECTTIME_UNIT ) ),
+
+ aGbOLECache ( this, CUI_RES( GB_OLECACHE ) ),
+ aFtOLECache ( this, CUI_RES( FT_OLECACHE ) ),
+ aNfOLECache ( this, CUI_RES( NF_OLECACHE ) ),
+ aQuickLaunchFL ( this, CUI_RES( FL_QUICKLAUNCH ) ),
+ aQuickLaunchCB ( this, CUI_RES( CB_QUICKLAUNCH ) )//,
+{
+#if defined(UNX)
+ aQuickLaunchCB.SetText( CUI_RES( STR_QUICKLAUNCH_UNX ) );
+#endif
+ FreeResource();
+
+ //quick launch only available in Win and OS/2
+#if !defined(WNT) && !defined(OS2) && !defined(ENABLE_GTK)
+ aQuickLaunchFL.Hide();
+ aQuickLaunchCB.Hide();
+#endif
+
+ aTfGraphicObjectTime.SetExtFormat( EXTTIMEF_24H_SHORT );
+
+ SetExchangeSupport();
+
+ aNfGraphicCache.SetModifyHdl( LINK( this, OfaMemoryOptionsPage, GraphicCacheConfigHdl ) );
+}
+
+// -----------------------------------------------------------------------
+
+OfaMemoryOptionsPage::~OfaMemoryOptionsPage()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* OfaMemoryOptionsPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new OfaMemoryOptionsPage( pParent, rAttrSet );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL OfaMemoryOptionsPage::FillItemSet( SfxItemSet& rSet )
+{
+ BOOL bModified = FALSE;
+
+ SvtCacheOptions aCacheOptions;
+
+ // Undo-Schritte
+ if ( aUndoEdit.GetText() != aUndoEdit.GetSavedValue() )
+ SvtUndoOptions().SetUndoCount((UINT16)aUndoEdit.GetValue());
+
+ // GraphicCache
+ aCacheOptions.SetGraphicManagerTotalCacheSize( GetNfGraphicCacheVal() );
+ aCacheOptions.SetGraphicManagerObjectCacheSize( GetNfGraphicObjectCacheVal() );
+
+ const Time aTime( aTfGraphicObjectTime.GetTime() );
+ aCacheOptions.SetGraphicManagerObjectReleaseTime( aTime.GetSec() + aTime.GetMin() * 60 + aTime.GetHour() * 3600 );
+
+ // create a dummy graphic object to get access to the common GraphicManager
+ GraphicObject aDummyObject;
+ GraphicManager& rGrfMgr = aDummyObject.GetGraphicManager();
+
+ rGrfMgr.SetMaxCacheSize( aCacheOptions.GetGraphicManagerTotalCacheSize() );
+ rGrfMgr.SetMaxObjCacheSize( aCacheOptions.GetGraphicManagerObjectCacheSize(), TRUE );
+ rGrfMgr.SetCacheTimeout( aCacheOptions.GetGraphicManagerObjectReleaseTime() );
+
+ // OLECache
+ aCacheOptions.SetWriterOLE_Objects( static_cast<long>(aNfOLECache.GetValue()) );
+ aCacheOptions.SetDrawingEngineOLE_Objects( static_cast<long>(aNfOLECache.GetValue()) );
+
+ if( aQuickLaunchCB.IsChecked() != aQuickLaunchCB.GetSavedValue())
+ {
+ rSet.Put(SfxBoolItem(SID_ATTR_QUICKLAUNCHER, aQuickLaunchCB.IsChecked()));
+ bModified = TRUE;
+ }
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+void OfaMemoryOptionsPage::Reset( const SfxItemSet& rSet )
+{
+ SvtCacheOptions aCacheOptions;
+ const SfxPoolItem* pItem;
+
+ // Undo-Schritte
+ aUndoEdit.SetValue( SvtUndoOptions().GetUndoCount() );
+ aUndoEdit.SaveValue();
+
+ // GraphicCache
+ long n = aCacheOptions.GetGraphicManagerTotalCacheSize();
+ SetNfGraphicCacheVal( n );
+ SetNfGraphicObjectCacheVal( Min( static_cast<sal_Int32>(GetNfGraphicCacheVal()), aCacheOptions.GetGraphicManagerObjectCacheSize() ) );
+
+ sal_Int32 nTime = aCacheOptions.GetGraphicManagerObjectReleaseTime();
+ Time aTime( (USHORT)( nTime / 3600 ), (USHORT)( ( nTime % 3600 ) / 60 ), (USHORT)( ( nTime % 3600 ) % 60 ) );
+ aTfGraphicObjectTime.SetTime( aTime );
+
+ GraphicCacheConfigHdl( &aNfGraphicCache );
+
+ // OLECache
+ aNfOLECache.SetValue( Max( aCacheOptions.GetWriterOLE_Objects(), aCacheOptions.GetDrawingEngineOLE_Objects() ) );
+
+ SfxItemState eState = rSet.GetItemState( SID_ATTR_QUICKLAUNCHER, FALSE, &pItem );
+ if ( SFX_ITEM_SET == eState )
+ aQuickLaunchCB.Check( ( (SfxBoolItem*)pItem )->GetValue() );
+ else if ( SFX_ITEM_DISABLED == eState )
+ {
+ // quickstart not installed
+ aQuickLaunchFL.Hide();
+ aQuickLaunchCB.Hide();
+ }
+
+ aQuickLaunchCB.SaveValue();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( OfaMemoryOptionsPage, GraphicCacheConfigHdl, NumericField*, EMPTYARG )
+{
+ long n = GetNfGraphicCacheVal();
+ SetNfGraphicObjectCacheMax( n );
+ SetNfGraphicObjectCacheLast( n );
+
+ if( GetNfGraphicObjectCacheVal() > n )
+ SetNfGraphicObjectCacheVal( n );
+
+ return 0;
+}
+
diff --git a/cui/source/options/optmemory.hrc b/cui/source/options/optmemory.hrc
new file mode 100644
index 000000000000..0ba3f833d2e7
--- /dev/null
+++ b/cui/source/options/optmemory.hrc
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optmemory.hrc,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _OFA_OPTMEMORY_HRC
+#define _OFA_OPTMEMORY_HRC
+
+#include <svtools/controldims.hrc>
+
+// defines for positions and sizes ---------------------------------------
+
+#define WHOLE_WIDTH 248
+
+#define COLSPACE RSC_SP_CTRL_DESC_X
+#define COL0 6
+#define COL1 (COL0+6)
+#define COL2 (COL1+140) // width text before control
+#define COL3 (COL2+COLSPACE)
+#define COL4 (COL3+30) // width control
+#define COL5 (COL4+COLSPACE)
+#define COL6 (WHOLE_WIDTH) // width text after control (unit)
+
+#define ROWSPACE RSC_SP_CTRL_DESC_Y
+#define ROW0 3
+#define ROW1 ( ROW0+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE )
+#define ROW2 ( ROW1+RSC_CD_TEXTBOX_HEIGHT+ROWSPACE )
+#define ROW3 ( ROW2+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE )
+#define ROW4 ( ROW3+RSC_CD_TEXTBOX_HEIGHT+ROWSPACE )
+#define ROW5 ( ROW4+RSC_CD_TEXTBOX_HEIGHT+ROWSPACE )
+#define ROW6 ( ROW5+RSC_CD_TEXTBOX_HEIGHT+ROWSPACE )
+#define ROW7 ( ROW6+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE )
+#define ROW8 ( ROW7+RSC_CD_TEXTBOX_HEIGHT+ROWSPACE )
+#define ROW9 ( ROW8+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE )
+
+#define DIFF(v1,v2) (v2-v1)
+#define OFFS_TEXTBOX_FIXEDTEXT(base) (base+(RSC_CD_TEXTBOX_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)
+
+#define WIDTH1 DIFF( COL1, COL2 )
+#define WIDTH2 DIFF( COL3, COL4 )
+#define WIDTH3 DIFF( COL5, COL6 )
+// tabpage memory --------------------------------------------------------
+
+#define GB_UNDO 10
+#define FT_UNDO 11
+#define ED_UNDO 12
+#define GB_GRAPHICCACHE 13
+#define FT_GRAPHICCACHE 14
+#define FT_GRAPHICCACHE_UNIT 15
+#define FT_GRAPHICOBJECTCACHE_UNIT 16
+#define FT_GRAPHICOBJECTTIME_UNIT 17
+#define NF_GRAPHICCACHE 18
+#define FT_GRAPHICOBJECTCACHE 19
+#define NF_GRAPHICOBJECTCACHE 20
+#define FT_GRAPHICOBJECTTIME 21
+#define TF_GRAPHICOBJECTTIME 22
+#define GB_OLECACHE 23
+#define FT_OLECACHE 24
+#define NF_OLECACHE 25
+#define FL_QUICKLAUNCH 26
+#define CB_QUICKLAUNCH 27
+#define STR_QUICKLAUNCH_UNX 28
+
+#endif // #ifndef _OFA_OPTMEMORY_HRC
+
diff --git a/cui/source/options/optmemory.hxx b/cui/source/options/optmemory.hxx
new file mode 100644
index 000000000000..f385dd60875f
--- /dev/null
+++ b/cui/source/options/optmemory.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optmemory.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _OFA_OPTMEMORY_HXX
+#define _OFA_OPTMEMORY_HXX
+
+#include <vcl/lstbox.hxx>
+#include <vcl/group.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svx/langbox.hxx>
+#define FOLDERWEBVIEW_DEFAULTFILE "folder.so"
+
+// class OfaMiscTabPage --------------------------------------------------
+
+class OfaMemoryOptionsPage : public SfxTabPage
+{
+ using SfxTabPage::DeactivatePage;
+private:
+ FixedLine aUndoBox;
+ FixedText aUndoText;
+ NumericField aUndoEdit;
+
+ FixedLine aGbGraphicCache;
+ FixedText aFtGraphicCache;
+ NumericField aNfGraphicCache;
+ FixedText aFtGraphicCacheUnit;
+ FixedText aFtGraphicObjectCache;
+ NumericField aNfGraphicObjectCache;
+ FixedText aFtGraphicObjectCacheUnit;
+ FixedText aFtGraphicObjectTime;
+ TimeField aTfGraphicObjectTime;
+ FixedText aFtGraphicObjectTimeUnit;
+
+ FixedLine aGbOLECache;
+ FixedText aFtOLECache;
+ NumericField aNfOLECache;
+
+ FixedLine aQuickLaunchFL;
+ CheckBox aQuickLaunchCB;
+
+ DECL_LINK( GraphicCacheConfigHdl, NumericField* );
+
+ inline long GetNfGraphicCacheVal( void ) const; // returns # of Bytes
+ inline void SetNfGraphicCacheVal( long nSizeInBytes );
+
+ long GetNfGraphicObjectCacheVal( void ) const; // returns # of Bytes
+ void SetNfGraphicObjectCacheVal( long nSizeInBytes );
+ inline void SetNfGraphicObjectCacheMax( long nSizeInBytes );
+ inline void SetNfGraphicObjectCacheLast( long nSizeInBytes );
+protected:
+ virtual int DeactivatePage( SfxItemSet* pSet = NULL );
+
+public:
+ OfaMemoryOptionsPage( Window* pParent, const SfxItemSet& rSet );
+ ~OfaMemoryOptionsPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+
+#endif
diff --git a/cui/source/options/optmemory.src b/cui/source/options/optmemory.src
new file mode 100644
index 000000000000..e54dbde11eb7
--- /dev/null
+++ b/cui/source/options/optmemory.src
@@ -0,0 +1,210 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optmemory.src,v $
+ * $Revision: 1.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // include ---------------------------------------------------------------
+
+#include <cuires.hrc>
+#include "optmemory.hrc"
+#include "helpid.hrc"
+
+TabPage OFA_TP_MEMORY
+{
+ HelpID = HID_OFA_TP_MEMORY ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine GB_UNDO
+ {
+ Pos = MAP_APPFONT( COL0, ROW0 );
+ Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Undo" ;
+ };
+ FixedText FT_UNDO
+ {
+ Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT( ROW1 ) );
+ Size = MAP_APPFONT( WIDTH1, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Number of steps";
+ };
+ NumericField ED_UNDO
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT( COL3, ROW1 );
+ Size = MAP_APPFONT( WIDTH2, RSC_CD_TEXTBOX_HEIGHT );
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ First = 1 ;
+ Maximum = 1000 ;
+ Value = 100 ;
+ Last = 100 ;
+ SpinSize = 1 ;
+ MaxTextLength = 4;
+ };
+ FixedLine GB_GRAPHICCACHE
+ {
+ Pos = MAP_APPFONT( COL0, ROW2 );
+ Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Graphics cache";
+ };
+ FixedText FT_GRAPHICCACHE
+ {
+ Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT( ROW3 ) );
+ Size = MAP_APPFONT( WIDTH1, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Use for %PRODUCTNAME";
+ };
+ NumericField NF_GRAPHICCACHE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT( COL3, ROW3 );
+ Size = MAP_APPFONT( WIDTH2, RSC_CD_TEXTBOX_HEIGHT );
+ Minimum = 1;
+ Maximum = 256;
+ SpinSize = 1;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ };
+ FixedText FT_GRAPHICCACHE_UNIT
+ {
+ Pos = MAP_APPFONT( COL5, OFFS_TEXTBOX_FIXEDTEXT( ROW3 ) );
+ Size = MAP_APPFONT( WIDTH3, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "MB";
+ };
+ FixedText FT_GRAPHICOBJECTCACHE
+ {
+ Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT( ROW4 ) );
+ Size = MAP_APPFONT( WIDTH1, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Memory per object" ;
+ };
+ NumericField NF_GRAPHICOBJECTCACHE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT( COL3, ROW4 );
+ Size = MAP_APPFONT( WIDTH2, RSC_CD_TEXTBOX_HEIGHT );
+ Minimum = 10;
+ Maximum = 2560;
+ SpinSize = 1;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ DecimalDigits = 1;
+ };
+ FixedText FT_GRAPHICOBJECTCACHE_UNIT
+ {
+ Pos = MAP_APPFONT( COL5, OFFS_TEXTBOX_FIXEDTEXT( ROW4 ) );
+ Size = MAP_APPFONT( WIDTH3, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "MB";
+ };
+ FixedText FT_GRAPHICOBJECTTIME
+ {
+ Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT( ROW5 ) );
+ Size = MAP_APPFONT( WIDTH1, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Remove from memory after";
+ };
+ TimeField TF_GRAPHICOBJECTTIME
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT( COL3, ROW5 );
+ Size = MAP_APPFONT( WIDTH2, RSC_CD_TEXTBOX_HEIGHT );
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Value = Time
+ {
+ Minute = 10;
+ };
+ Minimum = Time
+ {
+ Minute = 1;
+ };
+ Maximum = Time
+ {
+ Hour = 23 ;
+ Minute = 59 ;
+ };
+ First = Time
+ {
+ Minute = 10;
+ };
+ Last = Time
+ {
+ Hour = 23 ;
+ Minute = 59 ;
+ };
+ Format = TIMEF_NONE ;
+ Duration = TRUE ;
+ StrictFormat = TRUE ;
+ };
+ FixedText FT_GRAPHICOBJECTTIME_UNIT
+ {
+ Pos = MAP_APPFONT( COL5, OFFS_TEXTBOX_FIXEDTEXT( ROW5 ) );
+ Size = MAP_APPFONT( WIDTH3, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "hh:mm";
+ };
+ FixedLine GB_OLECACHE
+ {
+ Pos = MAP_APPFONT( COL0, ROW6 );
+ Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Cache for inserted objects";
+ };
+ FixedText FT_OLECACHE
+ {
+ Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT( ROW7 ) );
+ Size = MAP_APPFONT( WIDTH1, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Number of objects";
+ };
+ NumericField NF_OLECACHE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT( COL3, ROW7 );
+ Size = MAP_APPFONT( WIDTH2, RSC_CD_TEXTBOX_HEIGHT );
+ Minimum = 1;
+ Maximum = 1024;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ };
+ FixedLine FL_QUICKLAUNCH
+ {
+ Pos = MAP_APPFONT( COL0, ROW8 );
+ Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "%PRODUCTNAME Quickstarter";
+ };
+ CheckBox CB_QUICKLAUNCH
+ {
+ Pos = MAP_APPFONT( COL1, ROW9 );
+ Size = MAP_APPFONT( WHOLE_WIDTH - COL1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Load %PRODUCTNAME during system start-up";
+ };
+ String STR_QUICKLAUNCH_UNX
+ {
+ Text[ en-US ] = "Enable systray Quickstarter";
+ };
+};
+
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
new file mode 100644
index 000000000000..8e004b54b018
--- /dev/null
+++ b/cui/source/options/optpath.cxx
@@ -0,0 +1,866 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optpath.cxx,v $
+ * $Revision: 1.25 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <svx/svxdlg.hxx>
+#include <tools/shl.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <sfx2/app.hxx>
+#include <svl/pickerhelper.hxx>
+#include <svl/aeitem.hxx>
+#include <svtools/svtabbx.hxx>
+#include <svtools/filedlg.hxx>
+#include <tools/config.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/svapp.hxx>
+#include <unotools/defaultoptions.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <unotools/pathoptions.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <unotools/viewoptions.hxx>
+
+#define _SVX_OPTPATH_CXX
+
+#include "optpath.hxx"
+#include <dialmgr.hxx>
+#include "optpath.hrc"
+#include <cuires.hrc>
+#include "helpid.hrc"
+#include <comphelper/processfactory.hxx>
+#include <comphelper/configurationhelper.hxx>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
+#include "optHeaderTabListbox.hxx"
+#include <readonlyimage.hxx>
+#include <vcl/help.hxx>
+
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star::uno;
+using namespace svx;
+
+// define ----------------------------------------------------------------
+
+#define TAB_WIDTH1 80
+#define TAB_WIDTH_MIN 10
+#define TAB_WIDTH2 1000
+#define ITEMID_TYPE 1
+#define ITEMID_PATH 2
+
+#define POSTFIX_INTERNAL String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_internal" ) )
+#define POSTFIX_USER String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_user" ) )
+#define POSTFIX_WRITABLE String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_writable" ) )
+#define POSTFIX_READONLY String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_readonly" ) )
+#define VAR_ONE String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "%1" ) )
+#define IODLG_CONFIGNAME String(DEFINE_CONST_UNICODE("FilePicker_Save"))
+
+// struct OptPath_Impl ---------------------------------------------------
+
+struct OptPath_Impl
+{
+ SvtDefaultOptions m_aDefOpt;
+ Image m_aLockImage;
+ Image m_aLockImageHC;
+ String m_sMultiPathDlg;
+ Reference< XPropertySet > m_xPathSettings;
+
+ OptPath_Impl(const ResId& rLockRes, const ResId& rLockResHC) :
+ m_aLockImage(rLockRes),
+ m_aLockImageHC(rLockResHC){}
+};
+
+// struct PathUserData_Impl ----------------------------------------------
+
+struct PathUserData_Impl
+{
+ USHORT nRealId;
+ SfxItemState eState;
+ String sUserPath;
+ String sWritablePath;
+
+ PathUserData_Impl( USHORT nId ) :
+ nRealId( nId ), eState( SFX_ITEM_UNKNOWN ) {}
+};
+
+struct Handle2CfgNameMapping_Impl
+{
+ USHORT m_nHandle;
+ const char* m_pCfgName;
+};
+
+static Handle2CfgNameMapping_Impl __READONLY_DATA Hdl2CfgMap_Impl[] =
+{
+ { SvtPathOptions::PATH_AUTOCORRECT, "AutoCorrect" },
+ { SvtPathOptions::PATH_AUTOTEXT, "AutoText" },
+ { SvtPathOptions::PATH_BACKUP, "Backup" },
+ { SvtPathOptions::PATH_GALLERY, "Gallery" },
+ { SvtPathOptions::PATH_GRAPHIC, "Graphic" },
+ { SvtPathOptions::PATH_TEMP, "Temp" },
+ { SvtPathOptions::PATH_TEMPLATE, "Template" },
+ { SvtPathOptions::PATH_WORK, "Work" },
+#if OSL_DEBUG_LEVEL > 1
+ { SvtPathOptions::PATH_LINGUISTIC, "Linguistic" },
+ { SvtPathOptions::PATH_DICTIONARY, "Dictionary" },
+#endif
+ { USHRT_MAX, NULL }
+};
+
+static String getCfgName_Impl( USHORT _nHandle )
+{
+ String sCfgName;
+ USHORT nIndex = 0;
+ while ( Hdl2CfgMap_Impl[ nIndex ].m_nHandle != USHRT_MAX )
+ {
+ if ( Hdl2CfgMap_Impl[ nIndex ].m_nHandle == _nHandle )
+ {
+ // config name found
+ sCfgName = String::CreateFromAscii( Hdl2CfgMap_Impl[ nIndex ].m_pCfgName );
+ break;
+ }
+ ++nIndex;
+ }
+
+ return sCfgName;
+}
+
+#define MULTIPATH_DELIMITER ';'
+
+String Convert_Impl( const String& rValue )
+{
+ char cDelim = MULTIPATH_DELIMITER;
+ USHORT nCount = rValue.GetTokenCount( cDelim );
+ String aReturn;
+ for ( USHORT i=0; i<nCount ; ++i )
+ {
+ String aValue = rValue.GetToken( i, cDelim );
+ INetURLObject aObj( aValue );
+ if ( aObj.GetProtocol() == INET_PROT_FILE )
+ aReturn += String(aObj.PathToFileName());
+ else if ( ::utl::LocalFileHelper::IsFileContent( aValue ) )
+ aReturn += String(aObj.GetURLPath( INetURLObject::DECODE_WITH_CHARSET ));
+ if ( i+1 < nCount)
+ aReturn += MULTIPATH_DELIMITER;
+ }
+
+ return aReturn;
+}
+
+// class SvxControlFocusHelper ---------------------------------------------
+
+long SvxControlFocusHelper::Notify( NotifyEvent& rNEvt )
+{
+ long nRet = Control::Notify( rNEvt );
+
+ if ( m_pFocusCtrl && rNEvt.GetWindow() != m_pFocusCtrl && rNEvt.GetType() == EVENT_GETFOCUS )
+ m_pFocusCtrl->GrabFocus();
+ return nRet;
+}
+
+// functions -------------------------------------------------------------
+
+BOOL IsMultiPath_Impl( const USHORT nIndex )
+{
+#if OSL_DEBUG_LEVEL > 1
+ return ( SvtPathOptions::PATH_AUTOCORRECT == nIndex ||
+ SvtPathOptions::PATH_AUTOTEXT == nIndex ||
+ SvtPathOptions::PATH_BASIC == nIndex ||
+ SvtPathOptions::PATH_GALLERY == nIndex ||
+ SvtPathOptions::PATH_TEMPLATE == nIndex );
+#else
+ return ( SvtPathOptions::PATH_AUTOCORRECT == nIndex ||
+ SvtPathOptions::PATH_AUTOTEXT == nIndex ||
+ SvtPathOptions::PATH_BASIC == nIndex ||
+ SvtPathOptions::PATH_GALLERY == nIndex ||
+ SvtPathOptions::PATH_TEMPLATE == nIndex ||
+ SvtPathOptions::PATH_LINGUISTIC == nIndex ||
+ SvtPathOptions::PATH_DICTIONARY == nIndex );
+#endif
+}
+
+// class SvxPathTabPage --------------------------------------------------
+
+SvxPathTabPage::SvxPathTabPage( Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, CUI_RES( RID_SFXPAGE_PATH ), rSet ),
+
+ aTypeText ( this, CUI_RES( FT_TYPE ) ),
+ aPathText ( this, CUI_RES( FT_PATH ) ),
+ aPathCtrl ( this, CUI_RES( LB_PATH ) ),
+ aStandardBtn ( this, CUI_RES( BTN_STANDARD ) ),
+ aPathBtn ( this, CUI_RES( BTN_PATH ) ),
+ aStdBox ( this, CUI_RES( GB_STD ) ),
+
+ pHeaderBar ( NULL ),
+ pPathBox ( NULL ),
+ pImpl ( new OptPath_Impl( CUI_RES(IMG_LOCK), CUI_RES(IMG_LOCK_HC) ) ),
+ xDialogListener ( new ::svt::DialogClosedListener() )
+
+{
+ pImpl->m_sMultiPathDlg = String( CUI_RES( STR_MULTIPATHDLG ) );
+ aStandardBtn.SetClickHdl( LINK( this, SvxPathTabPage, StandardHdl_Impl ) );
+ Link aLink = LINK( this, SvxPathTabPage, PathHdl_Impl );
+ aPathBtn.SetClickHdl( aLink );
+ Size aBoxSize = aPathCtrl.GetOutputSizePixel();
+ pHeaderBar = new HeaderBar( &aPathCtrl, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
+ pHeaderBar->SetPosSizePixel( Point( 0, 0 ), Size( aBoxSize.Width(), 16 ) );
+ pHeaderBar->SetSelectHdl( LINK( this, SvxPathTabPage, HeaderSelect_Impl ) );
+ pHeaderBar->SetEndDragHdl( LINK( this, SvxPathTabPage, HeaderEndDrag_Impl ) );
+ Size aSz;
+ aSz.Width() = TAB_WIDTH1;
+ pHeaderBar->InsertItem( ITEMID_TYPE, aTypeText.GetText(),
+ LogicToPixel( aSz, MapMode( MAP_APPFONT ) ).Width(),
+ HIB_LEFT | HIB_VCENTER | HIB_CLICKABLE | HIB_UPARROW );
+ aSz.Width() = TAB_WIDTH2;
+ pHeaderBar->InsertItem( ITEMID_PATH, aPathText.GetText(),
+ LogicToPixel( aSz, MapMode( MAP_APPFONT ) ).Width(),
+ HIB_LEFT | HIB_VCENTER );
+
+ static long nTabs[] = {3, 0, TAB_WIDTH1, TAB_WIDTH1 + TAB_WIDTH2 };
+ Size aHeadSize = pHeaderBar->GetSizePixel();
+
+ WinBits nBits = WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP;
+ pPathBox = new OptHeaderTabListBox( &aPathCtrl, nBits );
+ aPathCtrl.SetFocusControl( pPathBox );
+ pPathBox->SetWindowBits( nBits );
+ pPathBox->SetDoubleClickHdl( aLink );
+ pPathBox->SetSelectHdl( LINK( this, SvxPathTabPage, PathSelect_Impl ) );
+ pPathBox->SetSelectionMode( MULTIPLE_SELECTION );
+ pPathBox->SetPosSizePixel( Point( 0, aHeadSize.Height() ),
+ Size( aBoxSize.Width(), aBoxSize.Height() - aHeadSize.Height() ) );
+ pPathBox->SetTabs( &nTabs[0], MAP_APPFONT );
+ pPathBox->InitHeaderBar( pHeaderBar );
+ pPathBox->SetHighlightRange();
+ pPathBox->SetHelpId( HID_OPTPATH_CTL_PATH );
+ pHeaderBar->SetHelpId( HID_OPTPATH_HEADERBAR );
+ pPathBox->Show();
+ pHeaderBar->Show();
+
+ FreeResource();
+
+ xDialogListener->SetDialogClosedLink( LINK( this, SvxPathTabPage, DialogClosedHdl ) );
+}
+
+// -----------------------------------------------------------------------
+
+SvxPathTabPage::~SvxPathTabPage()
+{
+ // #110603# do not grab focus to a destroyed window !!!
+ aPathCtrl.SetFocusControl( NULL );
+
+ pHeaderBar->Hide();
+ for ( USHORT i = 0; i < pPathBox->GetEntryCount(); ++i )
+ delete (PathUserData_Impl*)pPathBox->GetEntry(i)->GetUserData();
+ delete pPathBox;
+ delete pHeaderBar;
+ delete pImpl;
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxPathTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SvxPathTabPage( pParent, rAttrSet ) );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SvxPathTabPage::FillItemSet( SfxItemSet& )
+{
+ SvtPathOptions aPathOpt;
+ for ( USHORT i = 0; i < pPathBox->GetEntryCount(); ++i )
+ {
+ PathUserData_Impl* pPathImpl = (PathUserData_Impl*)pPathBox->GetEntry(i)->GetUserData();
+ USHORT nRealId = pPathImpl->nRealId;
+ if ( pPathImpl->eState == SFX_ITEM_SET )
+ SetPathList( nRealId, pPathImpl->sUserPath, pPathImpl->sWritablePath );
+ }
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPathTabPage::Reset( const SfxItemSet& )
+{
+ pPathBox->Clear();
+ SvtPathOptions aPathOpt; //! deprecated
+
+ for( USHORT i = 0; i <= (USHORT)SvtPathOptions::PATH_WORK; ++i )
+ {
+ // only writer uses autotext
+ if ( i == SvtPathOptions::PATH_AUTOTEXT
+ && !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SWRITER ) )
+ continue;
+
+ switch (i)
+ {
+ case SvtPathOptions::PATH_AUTOCORRECT:
+ case SvtPathOptions::PATH_AUTOTEXT:
+ case SvtPathOptions::PATH_BACKUP:
+ case SvtPathOptions::PATH_GALLERY:
+ case SvtPathOptions::PATH_GRAPHIC:
+ case SvtPathOptions::PATH_TEMP:
+ case SvtPathOptions::PATH_TEMPLATE:
+#if OSL_DEBUG_LEVEL > 1
+ case SvtPathOptions::PATH_LINGUISTIC:
+ case SvtPathOptions::PATH_DICTIONARY:
+#endif
+ case SvtPathOptions::PATH_WORK:
+ {
+ String aStr( CUI_RES( RID_SVXSTR_PATH_NAME_START + i ) );
+ String sInternal, sUser, sWritable;
+ sal_Bool bReadOnly = sal_False;
+ GetPathList( i, sInternal, sUser, sWritable, bReadOnly );
+ String sTmpPath = sUser;
+ if ( sTmpPath.Len() > 0 && sWritable.Len() > 0 )
+ sTmpPath += MULTIPATH_DELIMITER;
+ sTmpPath += sWritable;
+ String aValue( sTmpPath );
+ aStr += '\t';
+ aStr += Convert_Impl( aValue );
+ SvLBoxEntry* pEntry = pPathBox->InsertEntry( aStr );
+ if ( bReadOnly )
+ {
+ pPathBox->SetCollapsedEntryBmp( pEntry, pImpl->m_aLockImage, BMP_COLOR_NORMAL );
+ pPathBox->SetCollapsedEntryBmp( pEntry, pImpl->m_aLockImageHC, BMP_COLOR_HIGHCONTRAST );
+ }
+ PathUserData_Impl* pPathImpl = new PathUserData_Impl(i);
+ pPathImpl->sUserPath = sUser;
+ pPathImpl->sWritablePath = sWritable;
+ pEntry->SetUserData( pPathImpl );
+ }
+ }
+ }
+
+ String aUserData = GetUserData();
+ if ( aUserData.Len() )
+ {
+ // Spaltenbreite restaurieren
+ pHeaderBar->SetItemSize( ITEMID_TYPE, aUserData.GetToken(0).ToInt32() );
+ HeaderEndDrag_Impl( NULL );
+ // Sortierrichtung restaurieren
+ BOOL bUp = (BOOL)(USHORT)aUserData.GetToken(1).ToInt32();
+ HeaderBarItemBits nBits = pHeaderBar->GetItemBits(ITEMID_TYPE);
+
+ if ( bUp )
+ {
+ nBits &= ~HIB_UPARROW;
+ nBits |= HIB_DOWNARROW;
+ }
+ else
+ {
+ nBits &= ~HIB_DOWNARROW;
+ nBits |= HIB_UPARROW;
+ }
+ pHeaderBar->SetItemBits( ITEMID_TYPE, nBits );
+ HeaderSelect_Impl( NULL );
+ }
+ PathSelect_Impl( NULL );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPathTabPage::FillUserData()
+{
+ String aUserData = String::CreateFromInt32( pHeaderBar->GetItemSize( ITEMID_TYPE ) );
+ aUserData += ';';
+ HeaderBarItemBits nBits = pHeaderBar->GetItemBits( ITEMID_TYPE );
+ BOOL bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
+ aUserData += bUp ? '1' : '0';
+ SetUserData( aUserData );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPathTabPage, PathSelect_Impl, OptHeaderTabListBox *, EMPTYARG )
+
+/* [Beschreibung]
+
+*/
+
+{
+ USHORT nSelCount = 0;
+ SvLBoxEntry* pEntry = pPathBox->FirstSelected();
+
+ //the entry image indicates whether the path is write protected
+ Image aEntryImage;
+ if(pEntry)
+ aEntryImage = pPathBox->GetCollapsedEntryBmp( pEntry );
+ BOOL bEnable = !aEntryImage;
+ while ( pEntry && ( nSelCount < 2 ) )
+ {
+ nSelCount++;
+ pEntry = pPathBox->NextSelected( pEntry );
+ }
+
+ aPathBtn.Enable( 1 == nSelCount && bEnable);
+ aStandardBtn.Enable( nSelCount > 0 && bEnable);
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPathTabPage, StandardHdl_Impl, PushButton *, EMPTYARG )
+{
+ SvLBoxEntry* pEntry = pPathBox->FirstSelected();
+ while ( pEntry )
+ {
+ PathUserData_Impl* pPathImpl = (PathUserData_Impl*)pEntry->GetUserData();
+ String aOldPath = pImpl->m_aDefOpt.GetDefaultPath( pPathImpl->nRealId );
+
+ if ( aOldPath.Len() )
+ {
+ String sInternal, sUser, sWritable, sTemp;
+ sal_Bool bReadOnly = sal_False;
+ GetPathList( pPathImpl->nRealId, sInternal, sUser, sWritable, bReadOnly );
+
+ USHORT i;
+ USHORT nOldCount = aOldPath.GetTokenCount( MULTIPATH_DELIMITER );
+ USHORT nIntCount = sInternal.GetTokenCount( MULTIPATH_DELIMITER );
+ for ( i = 0; i < nOldCount; ++i )
+ {
+ bool bFound = false;
+ String sOnePath = aOldPath.GetToken( i, MULTIPATH_DELIMITER );
+ for ( USHORT j = 0; !bFound && j < nIntCount; ++j )
+ {
+ if ( sInternal.GetToken( i, MULTIPATH_DELIMITER ) == sOnePath )
+ bFound = true;
+ }
+ if ( !bFound )
+ {
+ if ( sTemp.Len() > 0 )
+ sTemp += MULTIPATH_DELIMITER;
+ sTemp += sOnePath;
+ }
+ }
+
+ String sUserPath, sWritablePath;
+ nOldCount = sTemp.GetTokenCount( MULTIPATH_DELIMITER );
+ for ( i = 0; nOldCount > 0 && i < nOldCount - 1; ++i )
+ {
+ if ( sUserPath.Len() > 0 )
+ sUserPath += MULTIPATH_DELIMITER;
+ sUserPath += sTemp.GetToken( i, MULTIPATH_DELIMITER );
+ }
+ sWritablePath = sTemp.GetToken( nOldCount - 1, MULTIPATH_DELIMITER );
+
+ pPathBox->SetEntryText( Convert_Impl( sTemp ), pEntry, 1 );
+ pPathImpl->eState = SFX_ITEM_SET;
+ pPathImpl->sUserPath = sUserPath;
+ pPathImpl->sWritablePath = sWritablePath;
+ }
+ pEntry = pPathBox->NextSelected( pEntry );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPathTabPage::ChangeCurrentEntry( const String& _rFolder )
+{
+ SvLBoxEntry* pEntry = pPathBox->GetCurEntry();
+ if ( !pEntry )
+ {
+ DBG_ERRORFILE( "SvxPathTabPage::ChangeCurrentEntry(): no entry" );
+ return;
+ }
+
+ String sInternal, sUser, sWritable;
+ PathUserData_Impl* pPathImpl = (PathUserData_Impl*)pEntry->GetUserData();
+ sal_Bool bReadOnly = sal_False;
+ GetPathList( pPathImpl->nRealId, sInternal, sUser, sWritable, bReadOnly );
+ sUser = pPathImpl->sUserPath;
+ sWritable = pPathImpl->sWritablePath;
+ USHORT nPos = pPathImpl->nRealId;
+
+ // old path is an URL?
+ INetURLObject aObj( sWritable );
+ FASTBOOL bURL = ( aObj.GetProtocol() != INET_PROT_NOT_VALID );
+ rtl::OUString aPathStr( _rFolder );
+ INetURLObject aNewObj( aPathStr );
+ aNewObj.removeFinalSlash();
+
+ // then the new path also an URL else system path
+ String sNewPathStr = bURL ? aPathStr : aNewObj.getFSysPath( INetURLObject::FSYS_DETECT );
+
+ FASTBOOL bChanged =
+#ifdef UNX
+// Unix is case sensitive
+ ( sNewPathStr != sWritable );
+#else
+ ( sNewPathStr.CompareIgnoreCaseToAscii( sWritable ) != COMPARE_EQUAL );
+#endif
+
+ if ( bChanged )
+ {
+ pPathBox->SetEntryText( Convert_Impl( sNewPathStr ), pEntry, 1 );
+ nPos = (USHORT)pPathBox->GetModel()->GetAbsPos( pEntry );
+ pPathImpl = (PathUserData_Impl*)pPathBox->GetEntry(nPos)->GetUserData();
+ pPathImpl->eState = SFX_ITEM_SET;
+ pPathImpl->sWritablePath = sNewPathStr;
+ if ( SvtPathOptions::PATH_WORK == pPathImpl->nRealId )
+ {
+ // Remove view options entry so the new work path
+ // will be used for the next open dialog.
+ SvtViewOptions aDlgOpt( E_DIALOG, IODLG_CONFIGNAME );
+ aDlgOpt.Delete();
+ // Reset also last used dir in the sfx application instance
+ SfxApplication *pSfxApp = SFX_APP();
+ pSfxApp->ResetLastDir();
+
+ // Set configuration flag to notify file picker that it's necessary
+ // to take over the path provided.
+ Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ ::comphelper::ConfigurationHelper::writeDirectKey(xFactory,
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/")),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Path/Info")),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkPathChanged")),
+ ::com::sun::star::uno::makeAny(true),
+ ::comphelper::ConfigurationHelper::E_STANDARD);
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPathTabPage, PathHdl_Impl, PushButton *, EMPTYARG )
+{
+ SvLBoxEntry* pEntry = pPathBox->GetCurEntry();
+ USHORT nPos = ( pEntry != NULL ) ? ( (PathUserData_Impl*)pEntry->GetUserData() )->nRealId : 0;
+ String sInternal, sUser, sWritable;
+ if ( pEntry )
+ {
+ PathUserData_Impl* pPathImpl = (PathUserData_Impl*)pEntry->GetUserData();
+ sal_Bool bReadOnly = sal_False;
+ GetPathList( pPathImpl->nRealId, sInternal, sUser, sWritable, bReadOnly );
+ sUser = pPathImpl->sUserPath;
+ sWritable = pPathImpl->sWritablePath;
+ }
+
+ if(pEntry && !(!((OptHeaderTabListBox*)pPathBox)->GetCollapsedEntryBmp(pEntry)))
+ return 0;
+
+ if ( IsMultiPath_Impl( nPos ) )
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ AbstractSvxMultiPathDialog* pMultiDlg =
+ pFact->CreateSvxMultiPathDialog( this );
+ DBG_ASSERT( pMultiDlg, "Dialogdiet fail!" );
+ pMultiDlg->EnableRadioButtonMode();
+
+ String sPath( sUser );
+ if ( sPath.Len() > 0 )
+ sPath += MULTIPATH_DELIMITER;
+ sPath += sWritable;
+ pMultiDlg->SetPath( sPath );
+
+ String sPathName = pPathBox->GetEntryText( pEntry, 0 );
+ String sNewTitle( pImpl->m_sMultiPathDlg );
+ sNewTitle.SearchAndReplace( VAR_ONE, sPathName );
+ pMultiDlg->SetTitle( sNewTitle );
+
+ if ( pMultiDlg->Execute() == RET_OK && pEntry )
+ {
+ sUser.Erase();
+ sWritable.Erase();
+ String sFullPath;
+ String sNewPath = pMultiDlg->GetPath();
+ char cDelim = MULTIPATH_DELIMITER;
+ USHORT nCount = sNewPath.GetTokenCount( cDelim );
+ if ( nCount > 0 )
+ {
+ USHORT i = 0;
+ for ( ; i < nCount - 1; ++i )
+ {
+ if ( sUser.Len() > 0 )
+ sUser += cDelim;
+ sUser += sNewPath.GetToken( i, cDelim );
+ }
+ if ( sFullPath.Len() > 0 )
+ sFullPath += cDelim;
+ sFullPath += sUser;
+ sWritable += sNewPath.GetToken( i, cDelim );
+ if ( sFullPath.Len() > 0 )
+ sFullPath += cDelim;
+ sFullPath += sWritable;
+ }
+
+ pPathBox->SetEntryText( Convert_Impl( sFullPath ), pEntry, 1 );
+ // save modified flag
+ PathUserData_Impl* pPathImpl = (PathUserData_Impl*)pEntry->GetUserData();
+ pPathImpl->eState = SFX_ITEM_SET;
+ pPathImpl->sUserPath = sUser;
+ pPathImpl->sWritablePath = sWritable;
+ }
+ delete pMultiDlg;
+ }
+ }
+ else if ( pEntry )
+ {
+ try
+ {
+ rtl::OUString aService( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) );
+ Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ xFolderPicker = ::com::sun::star::uno::Reference< XFolderPicker >(
+ xFactory->createInstance( aService ), UNO_QUERY );
+
+// svt::SetDialogHelpId( xFolderPicker, HID_OPTIONS_PATHS_SELECTFOLDER );
+
+ INetURLObject aURL( sWritable, INET_PROT_FILE );
+ xFolderPicker->setDisplayDirectory( aURL.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY );
+ if ( xAsyncDlg.is() )
+ xAsyncDlg->startExecuteModal( xDialogListener.get() );
+ else
+ {
+ short nRet = xFolderPicker->execute();
+ if ( ExecutableDialogResults::OK != nRet )
+ return 0;
+
+ String sFolder( xFolderPicker->getDirectory() );
+ ChangeCurrentEntry( sFolder );
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERRORFILE( "SvxPathTabPage::PathHdl_Impl: exception from folder picker" );
+ }
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPathTabPage, HeaderSelect_Impl, HeaderBar*, pBar )
+{
+ if ( pBar && pBar->GetCurItemId() != ITEMID_TYPE )
+ return 0;
+
+ HeaderBarItemBits nBits = pHeaderBar->GetItemBits(ITEMID_TYPE);
+ BOOL bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
+ SvSortMode eMode = SortAscending;
+
+ if ( bUp )
+ {
+ nBits &= ~HIB_UPARROW;
+ nBits |= HIB_DOWNARROW;
+ eMode = SortDescending;
+ }
+ else
+ {
+ nBits &= ~HIB_DOWNARROW;
+ nBits |= HIB_UPARROW;
+ }
+ pHeaderBar->SetItemBits( ITEMID_TYPE, nBits );
+ SvTreeList* pModel = pPathBox->GetModel();
+ pModel->SetSortMode( eMode );
+ pModel->Resort();
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPathTabPage, HeaderEndDrag_Impl, HeaderBar*, pBar )
+{
+ if ( pBar && !pBar->GetCurItemId() )
+ return 0;
+
+ if ( !pHeaderBar->IsItemMode() )
+ {
+ Size aSz;
+ USHORT nTabs = pHeaderBar->GetItemCount();
+ long nTmpSz = 0;
+ long nWidth = pHeaderBar->GetItemSize(ITEMID_TYPE);
+ long nBarWidth = pHeaderBar->GetSizePixel().Width();
+
+ if(nWidth < TAB_WIDTH_MIN)
+ pHeaderBar->SetItemSize( ITEMID_TYPE, TAB_WIDTH_MIN);
+ else if ( ( nBarWidth - nWidth ) < TAB_WIDTH_MIN )
+ pHeaderBar->SetItemSize( ITEMID_TYPE, nBarWidth - TAB_WIDTH_MIN );
+
+ for ( USHORT i = 1; i <= nTabs; ++i )
+ {
+ long _nWidth = pHeaderBar->GetItemSize(i);
+ aSz.Width() = _nWidth + nTmpSz;
+ nTmpSz += _nWidth;
+ pPathBox->SetTab( i, PixelToLogic( aSz, MapMode(MAP_APPFONT) ).Width(), MAP_APPFONT );
+ }
+ }
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPathTabPage, DialogClosedHdl, DialogClosedEvent*, pEvt )
+{
+ if ( RET_OK == pEvt->DialogResult )
+ {
+ DBG_ASSERT( xFolderPicker.is() == sal_True, "SvxPathTabPage::DialogClosedHdl(): no folder picker" );
+
+ String sURL = String( xFolderPicker->getDirectory() );
+ ChangeCurrentEntry( sURL );
+ }
+ return 0L;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPathTabPage::GetPathList(
+ USHORT _nPathHandle, String& _rInternalPath,
+ String& _rUserPath, String& _rWritablePath, sal_Bool& _rReadOnly )
+{
+ String sCfgName = getCfgName_Impl( _nPathHandle );
+
+ // load PathSettings service if necessary
+ if ( !pImpl->m_xPathSettings.is() )
+ {
+ Reference< XMultiServiceFactory > xSMgr = comphelper::getProcessServiceFactory();
+ pImpl->m_xPathSettings = Reference< XPropertySet >( xSMgr->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.util.PathSettings") ) ), UNO_QUERY );
+ }
+
+ try
+ {
+ if ( pImpl->m_xPathSettings.is() )
+ {
+ // load internal paths
+ String sProp( sCfgName );
+ sProp = sCfgName;
+ sProp += POSTFIX_INTERNAL;
+ Any aAny = pImpl->m_xPathSettings->getPropertyValue( sProp );
+ Sequence< ::rtl::OUString > aPathSeq;
+ if ( aAny >>= aPathSeq )
+ {
+ long i, nCount = aPathSeq.getLength();
+ const ::rtl::OUString* pPaths = aPathSeq.getConstArray();
+
+ for ( i = 0; i < nCount; ++i )
+ {
+ if ( _rInternalPath.Len() > 0 )
+ _rInternalPath += ';';
+ _rInternalPath += String( pPaths[i] );
+ }
+ }
+ // load user paths
+ sProp = sCfgName;
+ sProp += POSTFIX_USER;
+ aAny = pImpl->m_xPathSettings->getPropertyValue( sProp );
+ if ( aAny >>= aPathSeq )
+ {
+ long i, nCount = aPathSeq.getLength();
+ const ::rtl::OUString* pPaths = aPathSeq.getConstArray();
+
+ for ( i = 0; i < nCount; ++i )
+ {
+ if ( _rUserPath.Len() > 0 )
+ _rUserPath += ';';
+ _rUserPath += String( pPaths[i] );
+ }
+ }
+ // then the writable path
+ sProp = sCfgName;
+ sProp += POSTFIX_WRITABLE;
+ aAny = pImpl->m_xPathSettings->getPropertyValue( sProp );
+ ::rtl::OUString sWritablePath;
+ if ( aAny >>= sWritablePath )
+ _rWritablePath = String( sWritablePath );
+
+ // and the readonly flag
+ sProp = sCfgName;
+ Reference< XPropertySetInfo > xInfo = pImpl->m_xPathSettings->getPropertySetInfo();
+ Property aProp = xInfo->getPropertyByName( sProp );
+ _rReadOnly = ( ( aProp.Attributes & PropertyAttribute::READONLY ) == PropertyAttribute::READONLY );
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "SvxPathTabPage::GetPathList(): caught an exception!" );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPathTabPage::SetPathList(
+ USHORT _nPathHandle, const String& _rUserPath, const String& _rWritablePath )
+{
+ String sCfgName = getCfgName_Impl( _nPathHandle );
+
+ // load PathSettings service if necessary
+ if ( !pImpl->m_xPathSettings.is() )
+ {
+ Reference< XMultiServiceFactory > xSMgr = comphelper::getProcessServiceFactory();
+ pImpl->m_xPathSettings = Reference< XPropertySet >( xSMgr->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.util.PathSettings") ) ), UNO_QUERY );
+ }
+
+ try
+ {
+ if ( pImpl->m_xPathSettings.is() )
+ {
+ // save user paths
+ char cDelim = MULTIPATH_DELIMITER;
+ USHORT nCount = _rUserPath.GetTokenCount( cDelim );
+ Sequence< ::rtl::OUString > aPathSeq( nCount );
+ ::rtl::OUString* pArray = aPathSeq.getArray();
+ for ( USHORT i = 0; i < nCount; ++i )
+ pArray[i] = ::rtl::OUString( _rUserPath.GetToken( i, cDelim ) );
+ String sProp( sCfgName );
+ sProp += POSTFIX_USER;
+ Any aValue = makeAny( aPathSeq );
+ pImpl->m_xPathSettings->setPropertyValue( sProp, aValue );
+
+ // then the writable path
+ aValue = makeAny( ::rtl::OUString( _rWritablePath ) );
+ sProp = sCfgName;
+ sProp += POSTFIX_WRITABLE;
+ pImpl->m_xPathSettings->setPropertyValue( sProp, aValue );
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "SvxPathTabPage::SetPathList(): caught an exception!" );
+ }
+}
+
diff --git a/cui/source/options/optpath.hrc b/cui/source/options/optpath.hrc
new file mode 100644
index 000000000000..0fcef57dcf4c
--- /dev/null
+++ b/cui/source/options/optpath.hrc
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optpath.hrc,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTPATH_HRC
+#define _SVX_OPTPATH_HRC
+
+// defines ---------------------------------------------------------------
+
+#define FT_TYPE 10
+#define FT_PATH 11
+#define LB_PATH 12
+#define BTN_PATH 13
+#define BTN_STANDARD 14
+#define GB_STD 15
+#define IMG_LOCK 16
+#define IMG_LOCK_HC 17
+#define STR_MULTIPATHDLG 18
+
+#endif
+
diff --git a/cui/source/options/optpath.src b/cui/source/options/optpath.src
new file mode 100644
index 000000000000..7d0c3425636d
--- /dev/null
+++ b/cui/source/options/optpath.src
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optpath.src,v $
+ * $Revision: 1.35 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include --------------------------------------------------------------
+#include "optpath.hrc"
+#include <cuires.hrc>
+#ifndef _SFX_HRC
+#include <sfx2/sfx.hrc>
+#endif
+#include "helpid.hrc"
+
+ // RID_SFXPAGE_PATH -----------------------------------------------------
+#define STD_MASKCOLOR Color { Red=0xffff; Green=0x0000; Blue=0xffff; }
+TabPage RID_SFXPAGE_PATH
+{
+ HelpId = HID_OPTIONS_PATH ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "Paths" ;
+ FixedText FT_TYPE
+ {
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "Type" ;
+ };
+ FixedText FT_PATH
+ {
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( 110 , 14 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ Text [ en-US ] = "Path" ;
+ };
+ Control LB_PATH
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 236 , 147 ) ;
+ Border = TRUE ;
+ TabStop = TRUE;
+ };
+ PushButton BTN_PATH
+ {
+ Pos = MAP_APPFONT ( 183 , 165 ) ;
+ Size = MAP_APPFONT ( 65 , 14 ) ;
+ Text [ en-US ] = "~Edit..." ;
+ };
+ PushButton BTN_STANDARD
+ {
+ Pos = MAP_APPFONT ( 115 , 165 ) ;
+ Size = MAP_APPFONT ( 65 , 14 ) ;
+ Text [ en-US ] = "~Default" ;
+ };
+ FixedLine GB_STD
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Paths used by %PRODUCTNAME" ;
+ };
+ Image IMG_LOCK
+ {
+ ImageBitmap = Bitmap { File = "lock.bmp"; };
+ MaskColor = STD_MASKCOLOR;
+ };
+ Image IMG_LOCK_HC
+ {
+ ImageBitmap = Bitmap { File = "lock_hc.bmp"; };
+ MaskColor = STD_MASKCOLOR;
+ };
+ String STR_MULTIPATHDLG
+ {
+ Text [ en-US ] = "Edit Paths: %1" ;
+ };
+};
+ErrorBox RID_SVXERR_OPT_DOUBLEPATHS
+{
+ BUTTONS = WB_OK ;
+ DEFBUTTON = WB_DEF_OK ;
+ Message [ en-US ] = "The configuration and mail directories must be specified as separate directories.\nPlease choose a new path." ;
+};
+ // ******************************************************************* EOF
+String RID_SVXSTR_KEY_CONFIG_DIR
+{
+ Text [ en-US ] = "Configuration" ;
+};
+String RID_SVXSTR_KEY_WORK_PATH
+{
+ Text [ en-US ] = "My Documents" ;
+};
+String RID_SVXSTR_KEY_GRAPHICS_PATH
+{
+ Text [ en-US ] = "Graphics" ;
+};
+String RID_SVXSTR_KEY_BITMAP_PATH
+{
+ Text [ en-US ] = "Icons" ;
+};
+String RID_SVXSTR_KEY_BASIC_PATH
+{
+ Text = "BASIC" ;
+};
+
+String RID_SVXSTR_KEY_PALETTE_PATH
+{
+ Text [ en-US ] = "Palettes" ;
+};
+String RID_SVXSTR_KEY_BACKUP_PATH
+{
+ Text [ en-US ] = "Backups" ;
+};
+String RID_SVXSTR_KEY_MODULES_PATH
+{
+ Text [ en-US ] = "Modules" ;
+};
+String RID_SVXSTR_KEY_TEMPLATE_PATH
+{
+ Text [ en-US ] = "Templates" ;
+};
+String RID_SVXSTR_KEY_GLOSSARY_PATH
+{
+ Text [ en-US ] = "AutoText";
+};
+String RID_SVXSTR_KEY_DICTIONARY_PATH
+{
+ Text [ en-US ] = "Dictionaries" ;
+};
+String RID_SVXSTR_KEY_HELP_DIR
+{
+ Text [ en-US ] = "Help" ;
+};
+String RID_SVXSTR_KEY_GALLERY_DIR
+{
+ Text [ en-US ] = "Gallery" ;
+};
+
+String RID_SVXSTR_KEY_STORAGE_DIR
+{
+ Text [ en-US ] = "Message Storage" ;
+};
+String RID_SVXSTR_KEY_TEMP_PATH
+{
+ Text [ en-US ] = "Temporary files";
+};
+String RID_SVXSTR_KEY_PLUGINS_PATH
+{
+ Text [ en-US ] = "Plug-ins";
+};
+String RID_SVXSTR_KEY_FAVORITES_DIR
+{
+ Text [ en-US ] = "Folder Bookmarks";
+};
+String RID_SVXSTR_KEY_FILTER_PATH
+{
+ Text [ en-US ] = "Filters";
+};
+String RID_SVXSTR_KEY_ADDINS_PATH
+{
+ Text [ en-US ] = "Add-ins";
+};
+String RID_SVXSTR_KEY_USERCONFIG_PATH
+{
+ Text [ en-US ] = "User Configuration";
+};
+String RID_SVXSTR_KEY_USERDICTIONARY_DIR
+{
+ Text [ en-US ] = "User-defined dictionaries";
+};
+String RID_SVXSTR_KEY_AUTOCORRECT_DIR
+{
+ Text [ en-US ] = "AutoCorrect";
+};
+String RID_SVXSTR_KEY_LINGUISTIC_DIR
+{
+ Text [ en-US ] = "Writing aids";
+};
+
diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
new file mode 100644
index 000000000000..caf332fb4048
--- /dev/null
+++ b/cui/source/options/optsave.cxx
@@ -0,0 +1,822 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optsave.cxx,v $
+ * $Revision: 1.21 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
+#define _SVX_OPTSAVE_CXX
+
+#include "optsave.hrc"
+#include <cuires.hrc>
+
+#include "optsave.hxx"
+#include <dialmgr.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/sequenceasvector.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <unotools/saveopt.hxx>
+#include <comphelper/sequenceasvector.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include <com/sun/star/container/XContainerQuery.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XContainerQuery.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/util/XFlushable.hpp>
+#include <sfx2/docfilt.hxx>
+#include <svtools/stdctrl.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/msgbox.hxx>
+#include <unotools/configitem.hxx>
+#include <unotools/optionsdlg.hxx>
+
+#include <vcl/msgbox.hxx>
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::util;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::container;
+using namespace comphelper;
+using rtl::OUString;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+#define C2S(cChar) String( RTL_CONSTASCII_STRINGPARAM(cChar) )
+#define CFG_PAGE_AND_GROUP C2S("General"), C2S("LoadSave")
+// !! you have to update these index, if you changed the list of the child windows !!
+#define WININDEX_AUTOSAVE ((USHORT)6)
+#define WININDEX_SAVEURL_RELFSYS ((USHORT)9)
+
+// -------------------- --------------------------------------------------
+class FilterWarningDialog_Impl : public ModalDialog
+{
+ OKButton aOk;
+ CancelButton aCancel;
+ FixedImage aImage;
+ FixedInfo aFilterWarningFT;
+
+ public:
+ FilterWarningDialog_Impl(Window* pParent);
+
+ void SetFilterName(const String& rFilterUIName);
+};
+// ----------------------------------------------------------------------
+FilterWarningDialog_Impl::FilterWarningDialog_Impl(Window* pParent) :
+ ModalDialog(pParent, CUI_RES( RID_SVXDLG_FILTER_WARNING ) ),
+ aOk( this, CUI_RES(PB_OK )),
+ aCancel( this, CUI_RES(PB_CANCEL )),
+ aImage( this, CUI_RES(IMG_WARNING )),
+ aFilterWarningFT( this, CUI_RES(FT_FILTER_WARNING ))
+{
+ FreeResource();
+ aImage.SetImage(WarningBox::GetStandardImage());
+}
+// ----------------------------------------------------------------------
+void FilterWarningDialog_Impl::SetFilterName(const String& rFilterUIName)
+{
+ String sTmp(aFilterWarningFT.GetText());
+ sTmp.SearchAndReplaceAscii("%1", rFilterUIName);
+ aFilterWarningFT.SetText(sTmp);
+}
+// ----------------------------------------------------------------------
+#ifdef FILTER_WARNING_ENABLED
+class SvxAlienFilterWarningConfig_Impl : public utl::ConfigItem
+{
+ sal_Bool bWarning;
+ com::sun::star::uno::Sequence< OUString > aPropNames;
+
+ public:
+ SvxAlienFilterWarningConfig_Impl();
+ ~SvxAlienFilterWarningConfig_Impl();
+
+ virtual void Commit();
+
+ void ResetWarning()
+ {
+ if(bWarning)
+ {
+ bWarning = sal_False;
+ ConfigItem::SetModified();
+ }
+
+ }
+ sal_Bool IsWarning()const{return bWarning;}
+};
+// ----------------------------------------------------------------------
+SvxAlienFilterWarningConfig_Impl::SvxAlienFilterWarningConfig_Impl() :
+ ConfigItem(C2U("TypeDetection.Misc/Defaults"),
+ CONFIG_MODE_IMMEDIATE_UPDATE),
+ aPropNames(1),
+ bWarning(sal_True)
+{
+ aPropNames.getArray()[0] = C2U("ShowAlienFilterWarning");
+ Sequence<Any> aValues = GetProperties(aPropNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == aPropNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == aPropNames.getLength() &&
+ pValues[0].hasValue() &&
+ pValues[0].getValueType() == ::getBooleanCppuType())
+ bWarning = *(sal_Bool*)pValues[0].getValue();
+}
+// ----------------------------------------------------------------------
+SvxAlienFilterWarningConfig_Impl::~SvxAlienFilterWarningConfig_Impl()
+{
+ if(IsModified())
+ Commit();
+}
+// ----------------------------------------------------------------------
+void SvxAlienFilterWarningConfig_Impl::Commit()
+{
+ Sequence<Any> aValues(aPropNames.getLength());
+ Any* pValues = aValues.getArray();
+ pValues[0].setValue(&bWarning, ::getBooleanCppuType());
+ PutProperties(aPropNames, aValues);
+}
+#endif // FILTER_WARNING_ENABLED
+// ----------------------------------------------------------------------
+// ----------------------------------------------------------------------
+
+struct SvxSaveTabPage_Impl
+{
+ Reference< XNameContainer > xFact;
+ Sequence< OUString > aFilterArr[APP_COUNT];
+ Sequence< sal_Bool > aAlienArr[APP_COUNT];
+ Sequence< sal_Bool > aODFArr[APP_COUNT];
+ Sequence< OUString > aUIFilterArr[APP_COUNT];
+ OUString aDefaultArr[APP_COUNT];
+ sal_Bool aDefaultReadonlyArr[APP_COUNT];
+ sal_Bool bInitialized;
+
+ SvxSaveTabPage_Impl();
+ ~SvxSaveTabPage_Impl();
+};
+
+SvxSaveTabPage_Impl::SvxSaveTabPage_Impl() : bInitialized( sal_False )
+{
+}
+
+SvxSaveTabPage_Impl::~SvxSaveTabPage_Impl()
+{
+}
+
+// class SvxSaveTabPage --------------------------------------------------
+
+SfxSaveTabPage::SfxSaveTabPage( Window* pParent, const SfxItemSet& rCoreSet ) :
+
+ SfxTabPage( pParent, CUI_RES( RID_SFXPAGE_SAVE ), rCoreSet ),
+
+ aLoadFL ( this, CUI_RES( LB_LOAD ) ),
+ aLoadUserSettingsCB ( this, CUI_RES( CB_LOAD_SETTINGS ) ),
+ aLoadDocPrinterCB ( this, CUI_RES( CB_LOAD_DOCPRINTER ) ),
+
+ aSaveFL ( this, CUI_RES( GB_SAVE ) ),
+ aDocInfoCB ( this, CUI_RES( BTN_DOCINFO ) ),
+ aBackupFI ( this, CUI_RES( FI_BACKUP ) ),
+ aBackupCB ( this, CUI_RES( BTN_BACKUP ) ),
+ aAutoSaveCB ( this, CUI_RES( BTN_AUTOSAVE ) ),
+ aAutoSaveEdit ( this, CUI_RES( ED_AUTOSAVE ) ),
+ aMinuteFT ( this, CUI_RES( FT_MINUTE ) ),
+ aRelativeFsysCB ( this, CUI_RES( BTN_RELATIVE_FSYS ) ),
+ aRelativeInetCB ( this, CUI_RES( BTN_RELATIVE_INET ) ),
+
+ aDefaultFormatFL ( this, CUI_RES( FL_FILTER ) ),
+ aODFVersionFT ( this, CUI_RES( FT_ODF_VERSION ) ),
+ aODFVersionLB ( this, CUI_RES( LB_ODF_VERSION ) ),
+ aSizeOptimizationCB ( this, CUI_RES( BTN_NOPRETTYPRINTING ) ),
+ aWarnAlienFormatCB ( this, CUI_RES( BTN_WARNALIENFORMAT ) ),
+ aDocTypeFT ( this, CUI_RES( FT_APP ) ),
+ aDocTypeLB ( this, CUI_RES( LB_APP ) ),
+ aSaveAsFT ( this, CUI_RES( FT_FILTER ) ),
+ aSaveAsFI ( this, CUI_RES( FI_FILTER ) ),
+ aSaveAsLB ( this, CUI_RES( LB_FILTER ) ),
+ aODFWarningFI ( this, CUI_RES( FI_ODF_WARNING ) ),
+ aODFWarningFT ( this, CUI_RES( FT_WARN ) ),
+
+ pImpl ( new SvxSaveTabPage_Impl )
+
+{
+ sal_Bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+ aODFWarningFI.SetImage(
+ Image( CUI_RES( bHighContrast ? IMG_ODF_WARNING_HC : IMG_ODF_WARNING ) ) );
+
+ FreeResource();
+
+ Link aLink = LINK( this, SfxSaveTabPage, AutoClickHdl_Impl );
+ aAutoSaveCB.SetClickHdl( aLink );
+ aAutoSaveEdit.SetMaxTextLen( 2 );
+
+ SvtModuleOptions aModuleOpt;
+ if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SMATH ) )
+ {
+ aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_MATH ));
+ aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_MATH ));
+ }
+ else
+ {
+ pImpl->aDefaultArr[APP_MATH] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_MATH);
+ pImpl->aDefaultReadonlyArr[APP_MATH] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_MATH);
+ }
+
+ if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) )
+ {
+ aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_DRAW ));
+ aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_DRAW ));
+ }
+ else
+ {
+ pImpl->aDefaultArr[APP_DRAW] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_DRAW);
+ pImpl->aDefaultReadonlyArr[APP_DRAW] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_DRAW);
+ }
+
+ if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) )
+ {
+ aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_IMPRESS ));
+ aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_IMPRESS ));
+ }
+ else
+ {
+ pImpl->aDefaultArr[APP_IMPRESS] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_IMPRESS);
+ pImpl->aDefaultReadonlyArr[APP_IMPRESS] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_IMPRESS);
+ }
+
+ if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) )
+ {
+ aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_CALC ));
+ aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_CALC ));
+ }
+ else
+ {
+ pImpl->aDefaultArr[APP_CALC] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_CALC);
+ pImpl->aDefaultReadonlyArr[APP_CALC] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_CALC);
+ }
+
+ if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) )
+ {
+ aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_WRITER ));
+ aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_WRITER_WEB ));
+ aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_WRITER_GLOBAL ));
+ aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_WRITER ));
+ aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_WRITER_WEB ));
+ aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_WRITER_GLOBAL ));
+ }
+ else
+ {
+ pImpl->aDefaultArr[APP_WRITER] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITER);
+ pImpl->aDefaultArr[APP_WRITER_WEB] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITERWEB);
+ pImpl->aDefaultArr[APP_WRITER_GLOBAL] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITERGLOBAL);
+ pImpl->aDefaultReadonlyArr[APP_WRITER] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_WRITER);
+ pImpl->aDefaultReadonlyArr[APP_WRITER_WEB] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_WRITERWEB);
+ pImpl->aDefaultReadonlyArr[APP_WRITER_GLOBAL] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_WRITERGLOBAL);
+ }
+
+ aLink = LINK( this, SfxSaveTabPage, ODFVersionHdl_Impl );
+ aODFVersionLB.SetSelectHdl( aLink );
+ aLink = LINK( this, SfxSaveTabPage, FilterHdl_Impl );
+ aDocTypeLB.SetSelectHdl( aLink );
+ aSaveAsLB.SetSelectHdl( aLink );
+
+ DetectHiddenControls();
+}
+
+// -----------------------------------------------------------------------
+
+SfxSaveTabPage::~SfxSaveTabPage()
+{
+ delete pImpl;
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SfxSaveTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SfxSaveTabPage( pParent, rAttrSet ) );
+}
+
+/* -----------------------------05.04.01 13:10--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString lcl_ExtractUIName(const Sequence<PropertyValue> rProperties)
+{
+ OUString sRet;
+ const PropertyValue* pProperties = rProperties.getConstArray();
+ for(int nProp = 0; nProp < rProperties.getLength(); nProp++)
+ {
+ if(!pProperties[nProp].Name.compareToAscii("UIName"))
+ {
+ pProperties[nProp].Value >>= sRet;
+ break;
+ }
+ }
+ return sRet;
+}
+// -----------------------------------------------------------------------
+bool SfxSaveTabPage::AcceptFilter( USHORT nPos )
+{
+ const OUString* pFilters = pImpl->aFilterArr[nPos].getConstArray();
+ sal_Bool bAlien = sal_False, bODF = sal_False;
+ OUString* pUIFilters = pImpl->aUIFilterArr[nPos].getArray();
+ OUString sUIName;
+ for(int nFilter = 0; nFilter < pImpl->aFilterArr[nPos].getLength(); nFilter++)
+ {
+ if( pImpl->aDefaultArr[nPos] == pFilters[nFilter] )
+ {
+ bAlien = pImpl->aAlienArr[nPos][nFilter];
+ bODF = pImpl->aODFArr[nPos][nFilter];
+ sUIName = pUIFilters[nFilter];;
+ break;
+ }
+ }
+ bool bSet = true;
+ return bSet;
+}
+// -----------------------------------------------------------------------
+void SfxSaveTabPage::DetectHiddenControls()
+{
+ long nDelta = 0;
+ // the index of the first child window which perhaps have to move upwards
+ USHORT nWinIndex = WININDEX_SAVEURL_RELFSYS;
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+
+ if ( aOptionsDlgOpt.IsOptionHidden( C2S("Backup"), CFG_PAGE_AND_GROUP ) )
+ {
+ // hide controls of "Backup"
+ aBackupFI.Hide();
+ aBackupCB.Hide();
+ // the other controls have to move upwards the height of checkbox + space
+ nDelta = aAutoSaveCB.GetPosPixel().Y() - aBackupCB.GetPosPixel().Y();
+ }
+
+ if ( aOptionsDlgOpt.IsOptionHidden( C2S("AutoSave"), CFG_PAGE_AND_GROUP ) )
+ {
+ // hide controls of "AutoSave"
+ aAutoSaveCB.Hide();
+ aAutoSaveEdit.Hide();
+ aMinuteFT.Hide();
+ // the other controls have to move upwards the height of checkbox + space
+ nDelta += aRelativeFsysCB.GetPosPixel().Y() - aAutoSaveCB.GetPosPixel().Y();
+ }
+ else if ( nDelta > 0 )
+ // the "AutoSave" controls have to move upwards too
+ nWinIndex = WININDEX_AUTOSAVE;
+
+ if ( nDelta > 0 )
+ {
+ USHORT i, nChildCount = GetChildCount();
+ for ( i = nWinIndex; i < nChildCount; ++i )
+ {
+ Window* pWin = GetChild(i);
+ Point aPos = pWin->GetPosPixel();
+ aPos.Y() -= nDelta;
+ pWin->SetPosPixel( aPos );
+ }
+ }
+}
+// -----------------------------------------------------------------------
+BOOL SfxSaveTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ BOOL bModified = FALSE;
+ SvtSaveOptions aSaveOpt;
+ if(aLoadUserSettingsCB.IsChecked() != aLoadUserSettingsCB.GetSavedValue())
+ {
+ aSaveOpt.SetLoadUserSettings(aLoadUserSettingsCB.IsChecked());
+ }
+
+ if ( aLoadDocPrinterCB.IsChecked() != aLoadDocPrinterCB.GetSavedValue() )
+ aSaveOpt.SetLoadDocumentPrinter( aLoadDocPrinterCB.IsChecked() );
+
+ if ( aODFVersionLB.GetSelectEntryPos() != aODFVersionLB.GetSavedValue() )
+ {
+ long nVersion = long( aODFVersionLB.GetEntryData( aODFVersionLB.GetSelectEntryPos() ) );
+ aSaveOpt.SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion( nVersion ) );
+ }
+
+ if ( aDocInfoCB.IsChecked() != aDocInfoCB.GetSavedValue() )
+ {
+ rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_DOCINFO ),
+ aDocInfoCB.IsChecked() ) );
+ bModified |= TRUE;
+ }
+
+ if ( aBackupCB.IsEnabled() && aBackupCB.IsChecked() != aBackupCB.GetSavedValue() )
+ {
+ rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_BACKUP ),
+ aBackupCB.IsChecked() ) );
+ bModified |= TRUE;
+ }
+
+ if ( aSizeOptimizationCB.IsChecked() != aSizeOptimizationCB.GetSavedValue() )
+ {
+ rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_PRETTYPRINTING ), !aSizeOptimizationCB.IsChecked() ) );
+ bModified |= TRUE;
+ }
+
+ if ( aAutoSaveCB.IsChecked() != aAutoSaveCB.GetSavedValue() )
+ {
+ rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_AUTOSAVE ),
+ aAutoSaveCB.IsChecked() ) );
+ bModified |= TRUE;
+ }
+ if ( aWarnAlienFormatCB.IsChecked() != aWarnAlienFormatCB.GetSavedValue() )
+ {
+ rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_WARNALIENFORMAT ),
+ aWarnAlienFormatCB.IsChecked() ) );
+ bModified |= TRUE;
+ }
+
+ if ( aAutoSaveEdit.GetText() != aAutoSaveEdit.GetSavedValue() )
+ {
+ rSet.Put( SfxUInt16Item( GetWhich( SID_ATTR_AUTOSAVEMINUTE ),
+ (UINT16)aAutoSaveEdit.GetValue() ) );
+ bModified |= TRUE;
+ }
+ // relativ speichern
+ if ( aRelativeFsysCB.IsChecked() != aRelativeFsysCB.GetSavedValue() )
+ {
+ rSet.Put( SfxBoolItem( GetWhich( SID_SAVEREL_FSYS ),
+ aRelativeFsysCB.IsChecked() ) );
+ bModified |= TRUE;
+ }
+
+ if ( aRelativeInetCB.IsChecked() != aRelativeInetCB.GetSavedValue() )
+ {
+ rSet.Put( SfxBoolItem( GetWhich( SID_SAVEREL_INET ),
+ aRelativeInetCB.IsChecked() ) );
+ bModified |= TRUE;
+ }
+
+ SvtModuleOptions aModuleOpt;
+ if(pImpl->aDefaultArr[APP_MATH].getLength() &&
+ pImpl->aDefaultArr[APP_MATH] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_MATH) &&
+ AcceptFilter( APP_MATH ))
+ aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_MATH, pImpl->aDefaultArr[APP_MATH]);
+
+ if( pImpl->aDefaultArr[APP_DRAW].getLength() &&
+ pImpl->aDefaultArr[APP_DRAW] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_DRAW) &&
+ AcceptFilter( APP_DRAW ))
+ aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_DRAW, pImpl->aDefaultArr[APP_DRAW]);
+
+ if(pImpl->aDefaultArr[APP_IMPRESS].getLength() &&
+ pImpl->aDefaultArr[APP_IMPRESS] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_IMPRESS)&&
+ AcceptFilter( APP_IMPRESS ))
+ aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_IMPRESS, pImpl->aDefaultArr[APP_IMPRESS]);
+
+ if(pImpl->aDefaultArr[APP_CALC].getLength() &&
+ pImpl->aDefaultArr[APP_CALC] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_CALC)&&
+ AcceptFilter( APP_CALC ))
+ aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_CALC, pImpl->aDefaultArr[APP_CALC]);
+
+ if(pImpl->aDefaultArr[APP_WRITER].getLength() &&
+ pImpl->aDefaultArr[APP_WRITER] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITER)&&
+ AcceptFilter( APP_WRITER))
+ aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_WRITER, pImpl->aDefaultArr[APP_WRITER]);
+
+ if(pImpl->aDefaultArr[APP_WRITER_WEB].getLength() &&
+ pImpl->aDefaultArr[APP_WRITER_WEB] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITERWEB)&&
+ AcceptFilter( APP_WRITER_WEB ))
+ aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_WRITERWEB, pImpl->aDefaultArr[APP_WRITER_WEB]);
+
+ if(pImpl->aDefaultArr[APP_WRITER_GLOBAL].getLength() &&
+ pImpl->aDefaultArr[APP_WRITER_GLOBAL] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITERGLOBAL)&&
+ AcceptFilter( APP_WRITER_GLOBAL ))
+ aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_WRITERGLOBAL, pImpl->aDefaultArr[APP_WRITER_GLOBAL]);
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool isODFFormat( OUString sFilter )
+{
+ static const char* aODFFormats[] =
+ {
+ "writer8",
+ "writer8_template",
+ "writerglobal8",
+ "writerglobal8_writer",
+ "calc8",
+ "calc8_template",
+ "draw8",
+ "draw8_template",
+ "impress8",
+ "impress8_template",
+ "impress8_draw",
+ "chart8",
+ "math8",
+ NULL
+ };
+
+ sal_Bool bRet = sal_False;
+ int i = 0;
+ while ( aODFFormats[i] != NULL )
+ {
+ if ( sFilter.equalsAscii( aODFFormats[i++] ) )
+ {
+ bRet = sal_True;
+ break;
+ }
+ }
+
+ return bRet;
+}
+
+void SfxSaveTabPage::Reset( const SfxItemSet& )
+{
+ SvtSaveOptions aSaveOpt;
+ aLoadUserSettingsCB.Check(aSaveOpt.IsLoadUserSettings());
+ aLoadUserSettingsCB.SaveValue();
+ aLoadDocPrinterCB.Check( aSaveOpt.IsLoadDocumentPrinter() );
+ aLoadDocPrinterCB.SaveValue();
+
+ if ( !pImpl->bInitialized )
+ {
+ try
+ {
+ Reference< XMultiServiceFactory > xMSF = comphelper::getProcessServiceFactory();
+ pImpl->xFact = Reference<XNameContainer>(
+ xMSF->createInstance(C2U("com.sun.star.document.FilterFactory")), UNO_QUERY);
+
+ DBG_ASSERT(pImpl->xFact.is(), "service com.sun.star.document.FilterFactory unavailable");
+ Reference< XContainerQuery > xQuery(pImpl->xFact, UNO_QUERY);
+ if(xQuery.is())
+ {
+ for(USHORT n = 0; n < aDocTypeLB.GetEntryCount(); n++)
+ {
+ long nData = (long) aDocTypeLB.GetEntryData(n);
+ OUString sCommand;
+ sCommand = C2U("matchByDocumentService=%1:iflags=");
+ sCommand += String::CreateFromInt32(SFX_FILTER_IMPORT|SFX_FILTER_EXPORT);
+ sCommand += C2U(":eflags=");
+ sCommand += String::CreateFromInt32(SFX_FILTER_NOTINFILEDLG);
+ sCommand += C2U(":default_first");
+ String sReplace;
+ switch(nData)
+ {
+ case APP_WRITER : sReplace = C2U("com.sun.star.text.TextDocument"); break;
+ case APP_WRITER_WEB : sReplace = C2U("com.sun.star.text.WebDocument"); break;
+ case APP_WRITER_GLOBAL : sReplace = C2U("com.sun.star.text.GlobalDocument"); break;
+ case APP_CALC : sReplace = C2U("com.sun.star.sheet.SpreadsheetDocument");break;
+ case APP_IMPRESS : sReplace = C2U("com.sun.star.presentation.PresentationDocument");break;
+ case APP_DRAW : sReplace = C2U("com.sun.star.drawing.DrawingDocument");break;
+ case APP_MATH : sReplace = C2U("com.sun.star.formula.FormulaProperties");break;
+ default: DBG_ERROR("illegal user data");
+ }
+ String sTmp(sCommand);
+ sTmp.SearchAndReplaceAscii("%1", sReplace);
+ sCommand = sTmp;
+ Reference< XEnumeration > xList = xQuery->createSubSetEnumerationByQuery(sCommand);
+ SequenceAsVector< OUString > lList;
+ SequenceAsVector< sal_Bool > lAlienList;
+ SequenceAsVector< sal_Bool > lODFList;
+ while(xList->hasMoreElements())
+ {
+ SequenceAsHashMap aFilter(xList->nextElement());
+ OUString sFilter = aFilter.getUnpackedValueOrDefault(OUString::createFromAscii("Name"),OUString());
+ if (sFilter.getLength())
+ {
+ sal_Int32 nFlags = aFilter.getUnpackedValueOrDefault(OUString::createFromAscii("Flags"),sal_Int32());
+ lList.push_back(sFilter);
+ lAlienList.push_back(0 != (nFlags & SFX_FILTER_ALIEN));
+ lODFList.push_back( isODFFormat( sFilter ) );
+ }
+ }
+ pImpl->aFilterArr[nData] = lList.getAsConstList();
+ pImpl->aAlienArr[nData] = lAlienList.getAsConstList();
+ pImpl->aODFArr[nData] = lODFList.getAsConstList();
+ }
+ }
+ aDocTypeLB.SelectEntryPos(0);
+ FilterHdl_Impl(&aDocTypeLB);
+ }
+ catch(Exception& )
+ {
+ DBG_ERROR("exception in FilterFactory access");
+ }
+
+ pImpl->bInitialized = sal_True;
+ }
+
+ aDocInfoCB.Check(aSaveOpt.IsDocInfoSave());
+// aDocInfoCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_DOCINFSAVE));
+
+ aBackupCB.Check(aSaveOpt.IsBackup());
+ BOOL bBackupRO = aSaveOpt.IsReadOnly(SvtSaveOptions::E_BACKUP);
+ aBackupCB.Enable(!bBackupRO);
+ aBackupFI.Show(bBackupRO);
+
+ aAutoSaveCB.Check(aSaveOpt.IsAutoSave());
+ aWarnAlienFormatCB.Check(aSaveOpt.IsWarnAlienFormat());
+ aWarnAlienFormatCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_WARNALIENFORMAT));
+// aAutoSaveCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_AUTOSAVE));
+
+ // the pretty printing
+ aSizeOptimizationCB.Check( !aSaveOpt.IsPrettyPrinting());
+// aSizeOptimizationCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_DOPRETTYPRINTING ));
+
+
+ aAutoSaveEdit.SetValue( aSaveOpt.GetAutoSaveTime() );
+// aAutoSaveEdit.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_AUTOSAVETIME));
+
+ // relativ speichern
+ aRelativeFsysCB.Check( aSaveOpt.IsSaveRelFSys() );
+// aRelativeFsysCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_SAVERELFSYS));
+
+ aRelativeInetCB.Check( aSaveOpt.IsSaveRelINet() );
+// aRelativeInetCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_SAVERELINET));
+
+ void* pDefaultVersion = (void*)long( aSaveOpt.GetODFDefaultVersion() );
+ aODFVersionLB.SelectEntryPos( aODFVersionLB.GetEntryPos( pDefaultVersion ) );
+
+ AutoClickHdl_Impl( &aAutoSaveCB );
+ ODFVersionHdl_Impl( &aODFVersionLB );
+
+ aDocInfoCB.SaveValue();
+ aBackupCB.SaveValue();
+ aWarnAlienFormatCB.SaveValue();
+ aSizeOptimizationCB.SaveValue();
+ aAutoSaveCB.SaveValue();
+ aAutoSaveEdit.SaveValue();
+// aAutoSavePromptBtn.SaveValue();
+
+ aRelativeFsysCB.SaveValue();
+ aRelativeInetCB.SaveValue();
+ aODFVersionLB.SaveValue();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SfxSaveTabPage, AutoClickHdl_Impl, CheckBox *, pBox )
+{
+ if ( pBox == &aAutoSaveCB )
+ {
+ if ( aAutoSaveCB.IsChecked() )
+ {
+ aAutoSaveEdit.Enable();
+ aMinuteFT.Enable();
+// aAutoSavePromptBtn.Enable();
+ aAutoSaveEdit.GrabFocus();
+ }
+ else
+ {
+ aAutoSaveEdit.Disable();
+ aMinuteFT.Disable();
+// aAutoSavePromptBtn.Disable();
+ }
+ }
+ return 0;
+}
+/* -----------------------------05.04.01 13:10--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString lcl_ExtracUIName(const Sequence<PropertyValue> rProperties)
+{
+ OUString sRet;
+ sal_Int32 nFlags;
+ const PropertyValue* pProperties = rProperties.getConstArray();
+ for(int nProp = 0; nProp < rProperties.getLength(); nProp++)
+ {
+ if(!pProperties[nProp].Name.compareToAscii("UIName"))
+ {
+ pProperties[nProp].Value >>= sRet;
+//! break;
+ }
+ else if(!pProperties[nProp].Name.compareToAscii("Flags"))
+ {
+ if ( pProperties[nProp].Value >>= nFlags )
+ {
+ nFlags &= 0x100;
+ }
+ }
+ else if(!pProperties[nProp].Name.compareToAscii("Name"))
+ {
+ pProperties[nProp].Value >>= sRet;
+ }
+ }
+ return sRet;
+}
+/* -----------------------------05.04.01 13:37--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SfxSaveTabPage, FilterHdl_Impl, ListBox *, pBox )
+{
+ USHORT nCurPos = aDocTypeLB.GetSelectEntryPos();
+
+ long nData = -1;
+ if(nCurPos < APP_COUNT)
+ nData = (long) aDocTypeLB.GetEntryData(nCurPos);
+
+ if ( nData >= 0 && nData < APP_COUNT )
+ {
+ if(&aDocTypeLB == pBox)
+ {
+ aSaveAsLB.Clear();
+ const OUString* pFilters = pImpl->aFilterArr[nData].getConstArray();
+ if(!pImpl->aUIFilterArr[nData].getLength())
+ {
+ pImpl->aUIFilterArr[nData].realloc(pImpl->aFilterArr[nData].getLength());
+ OUString* pUIFilters = pImpl->aUIFilterArr[nData].getArray();
+ for(int nFilter = 0; nFilter < pImpl->aFilterArr[nData].getLength(); nFilter++)
+ {
+ Any aProps = pImpl->xFact->getByName(pFilters[nFilter]);
+ Sequence<PropertyValue> aProperties;
+ aProps >>= aProperties;
+ pUIFilters[nFilter] = lcl_ExtracUIName(aProperties);
+ }
+ }
+ const OUString* pUIFilters = pImpl->aUIFilterArr[nData].getConstArray();
+ OUString sSelect;
+ for(int i = 0; i < pImpl->aUIFilterArr[nData].getLength(); i++)
+ {
+ USHORT nEntryPos = aSaveAsLB.InsertEntry(pUIFilters[i]);
+ if ( pImpl->aODFArr[nData][i] )
+ aSaveAsLB.SetEntryData( nEntryPos, (void*)pImpl );
+ if(pFilters[i] == pImpl->aDefaultArr[nData])
+ sSelect = pUIFilters[i];
+ }
+ if(sSelect.getLength())
+ aSaveAsLB.SelectEntry(sSelect);
+ aSaveAsFI.Show(pImpl->aDefaultReadonlyArr[nData]);
+ aSaveAsFT.Enable(!pImpl->aDefaultReadonlyArr[nData]);
+ aSaveAsLB.Enable(!pImpl->aDefaultReadonlyArr[nData]);
+ }
+ else
+ {
+ OUString sSelect = pBox->GetSelectEntry();
+ const OUString* pFilters = pImpl->aFilterArr[nData].getConstArray();
+ OUString* pUIFilters = pImpl->aUIFilterArr[nData].getArray();
+ for(int i = 0; i < pImpl->aUIFilterArr[nData].getLength(); i++)
+ if(pUIFilters[i] == sSelect)
+ {
+ sSelect = pFilters[i];
+ break;
+ }
+
+ pImpl->aDefaultArr[nData] = sSelect;
+ }
+ }
+
+ ODFVersionHdl_Impl( &aSaveAsLB );
+ return 0;
+};
+
+IMPL_LINK( SfxSaveTabPage, ODFVersionHdl_Impl, ListBox *, EMPTYARG )
+{
+ long nVersion = long( aODFVersionLB.GetEntryData( aODFVersionLB.GetSelectEntryPos() ) );
+ bool bShown = SvtSaveOptions::ODFDefaultVersion( nVersion ) != SvtSaveOptions::ODFVER_LATEST;
+ if ( bShown )
+ {
+ bool bHasODFFormat = false;
+ USHORT i = 0, nCount = aSaveAsLB.GetEntryCount();
+ for ( ; i < nCount; ++ i )
+ {
+ if ( aSaveAsLB.GetEntryData(i) != NULL )
+ {
+ bHasODFFormat = true;
+ break;
+ }
+ }
+
+ bShown = !bHasODFFormat
+ || ( aSaveAsLB.GetEntryData( aSaveAsLB.GetSelectEntryPos() ) != NULL );
+ }
+
+ aODFWarningFI.Show( bShown );
+ aODFWarningFT.Show( bShown );
+
+ return 0;
+}
+
diff --git a/cui/source/options/optsave.hrc b/cui/source/options/optsave.hrc
new file mode 100644
index 000000000000..c5b2ab5e765a
--- /dev/null
+++ b/cui/source/options/optsave.hrc
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optsave.hrc,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTSAVE_HRC
+#define _SVX_OPTSAVE_HRC
+
+// defines ------------------------------------------------------------------
+
+#define LB_LOAD 10
+#define CB_LOAD_SETTINGS 11
+#define CB_LOAD_DOCPRINTER 12
+#define GB_SAVE 13
+#define BTN_DOCINFO 14
+#define BTN_BACKUP 15
+#define BTN_AUTOSAVE 16
+#define ED_AUTOSAVE 17
+#define FT_MINUTE 18
+#define BTN_AUTOSAVEPROMPT 19
+#define BTN_NOPRETTYPRINTING 20
+#define FI_BACKUP 21
+#define BTN_WARNALIENFORMAT 22
+#define FT_ODF_VERSION 23
+#define LB_ODF_VERSION 24
+
+#define GB_RELATIVE 40
+#define BTN_RELATIVE_FSYS 41
+#define BTN_RELATIVE_INET 42
+
+#define FL_FILTER 43
+#define FT_APP 44
+#define LB_APP 45
+#define FT_FILTER 46
+#define LB_FILTER 47
+#define FI_FILTER 48
+#define FT_WARN 49
+#define FI_ODF_WARNING 50
+
+#define IMG_ODF_WARNING 1
+#define IMG_ODF_WARNING_HC 2
+
+#define APP_WRITER 0
+#define APP_WRITER_WEB 1
+#define APP_WRITER_GLOBAL 2
+#define APP_CALC 3
+#define APP_IMPRESS 4
+#define APP_DRAW 5
+#define APP_MATH 6
+#define APP_COUNT 7
+
+//Filter warning
+#define PB_OK 1
+#define FT_FILTER_WARNING 2
+#define CB_DONT_SHOW_AGAIN 3
+#define IMG_WARNING 4
+#define PB_CANCEL 5
+
+#endif // #ifndef _SVX_OPTSAVE_HRC
+
diff --git a/cui/source/options/optsave.hxx b/cui/source/options/optsave.hxx
new file mode 100644
index 000000000000..8c9fcbc75ac8
--- /dev/null
+++ b/cui/source/options/optsave.hxx
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optsave.hxx,v $
+ * $Revision: 1.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTSAVE_HXX
+#define _SVX_OPTSAVE_HXX
+
+// include ---------------------------------------------------------------
+
+#include <vcl/group.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <readonlyimage.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace beans {
+ struct PropertyValue;
+}}}}
+
+// define ----------------------------------------------------------------
+
+#define SfxSaveTabPage SvxSaveTabPage
+
+// class SvxSaveTabPage --------------------------------------------------
+
+struct SvxSaveTabPage_Impl;
+
+class SvxSaveTabPage : public SfxTabPage
+{
+private:
+ FixedLine aLoadFL;
+ CheckBox aLoadUserSettingsCB;
+ CheckBox aLoadDocPrinterCB;
+
+ FixedLine aSaveFL;
+ CheckBox aDocInfoCB;
+ ReadOnlyImage aBackupFI;
+ CheckBox aBackupCB;
+ CheckBox aAutoSaveCB;
+ NumericField aAutoSaveEdit;
+ FixedText aMinuteFT;
+ CheckBox aRelativeFsysCB;
+ CheckBox aRelativeInetCB;
+
+ FixedLine aDefaultFormatFL;
+ FixedText aODFVersionFT;
+ ListBox aODFVersionLB;
+ CheckBox aSizeOptimizationCB;
+ CheckBox aWarnAlienFormatCB;
+ FixedText aDocTypeFT;
+ ListBox aDocTypeLB;
+ FixedText aSaveAsFT;
+ ReadOnlyImage aSaveAsFI;
+ ListBox aSaveAsLB;
+ FixedImage aODFWarningFI;
+ FixedText aODFWarningFT;
+
+ SvxSaveTabPage_Impl* pImpl;
+
+#ifdef _SVX_OPTSAVE_CXX
+ DECL_LINK( AutoClickHdl_Impl, CheckBox * );
+ DECL_LINK( FilterHdl_Impl, ListBox * );
+ DECL_LINK( ODFVersionHdl_Impl, ListBox * );
+
+ bool AcceptFilter( USHORT nPos );
+ void DetectHiddenControls();
+#endif
+
+public:
+ SvxSaveTabPage( Window* pParent, const SfxItemSet& rSet );
+ virtual ~SvxSaveTabPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+#endif // #ifndef _SVX_OPTSAVE_HXX
+
diff --git a/cui/source/options/optsave.src b/cui/source/options/optsave.src
new file mode 100644
index 000000000000..cffff43cd23a
--- /dev/null
+++ b/cui/source/options/optsave.src
@@ -0,0 +1,325 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optsave.src,v $
+ * $Revision: 1.82 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // include ---------------------------------------------------------------
+#include <sfx2/sfx.hrc>
+#include <cuires.hrc>
+#include "helpid.hrc"
+#include "optsave.hrc"
+
+ // SID_SFXPAGE_SAVE ------------------------------------------------------
+#define TEXT_SAVEPAGE \
+ Text [ en-US ] = "Save" ;\
+
+TabPage RID_SFXPAGE_SAVE
+{
+ HelpId = HID_OPTIONS_SAVE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ TEXT_SAVEPAGE
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine LB_LOAD
+ {
+ Pos = MAP_APPFONT ( 6 , 2 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Load";
+ };
+ CheckBox CB_LOAD_SETTINGS
+ {
+ Pos = MAP_APPFONT ( 12 , 11 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "Load user-specific settings with the document";
+ };
+ CheckBox CB_LOAD_DOCPRINTER
+ {
+ Pos = MAP_APPFONT ( 12 , 22 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "Load printer settings with the document";
+ };
+ FixedLine GB_SAVE
+ {
+ Pos = MAP_APPFONT ( 6 , 32 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Save" ;
+ };
+ CheckBox BTN_DOCINFO
+ {
+ Pos = MAP_APPFONT ( 12 , 41 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "~Edit document properties before saving" ;
+ TabStop = TRUE ;
+ };
+ FixedImage FI_BACKUP
+ {
+ Pos = MAP_APPFONT ( 5, 53 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+ CheckBox BTN_BACKUP
+ {
+ Pos = MAP_APPFONT ( 12 , 52 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "Al~ways create backup copy" ;
+ };
+ CheckBox BTN_AUTOSAVE
+ {
+ Pos = MAP_APPFONT ( 12 , 63 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text [ en-US ] = "Save ~AutoRecovery information every" ;
+ };
+ NumericField ED_AUTOSAVE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 180 , 62 ) ;
+ Size = MAP_APPFONT ( 21 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 60 ;
+ StrictFormat = TRUE ;
+ First = 1 ;
+ Last = 60 ;
+ SpinSize = 1 ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_MINUTE
+ {
+ Pos = MAP_APPFONT ( 204 , 63 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "Minutes" ;
+ };
+ CheckBox BTN_RELATIVE_FSYS
+ {
+ Pos = MAP_APPFONT ( 12 , 74 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "Save URLs relative to file system" ;
+ };
+ CheckBox BTN_RELATIVE_INET
+ {
+ Pos = MAP_APPFONT ( 12 , 85 ) ;
+ Size = MAP_APPFONT ( 248 , 10 ) ;
+ Text [ en-US ] = "Save URLs relative to internet" ;
+ };
+ FixedLine FL_FILTER
+ {
+ Pos = MAP_APPFONT ( 6 , 97 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Default file format and ODF settings" ;
+ };
+ FixedText FT_ODF_VERSION
+ {
+ Pos = MAP_APPFONT ( 12 , 107 ) ;
+ Size = MAP_APPFONT ( 121 , 8 ) ;
+ Text [ en-US ] = "ODF format version" ;
+ };
+ ListBox LB_ODF_VERSION
+ {
+ Pos = MAP_APPFONT ( 136 , 105 ) ;
+ Size = MAP_APPFONT ( 108 , 58 ) ;
+ Border = TRUE;
+ DropDown = TRUE;
+ StringList [ en-US ] =
+ {
+ < "1.0/1.1" ; 2 ; > ;
+ < "1.2" ; 4 ; > ;
+ < "1.2 Extended (recommended)"; 0x7fffffff ; > ;
+ };
+ };
+ CheckBox BTN_NOPRETTYPRINTING
+ {
+ Pos = MAP_APPFONT ( 12 , 120 ) ;
+ Size = MAP_APPFONT ( 248 , 10 ) ;
+ Text [ en-US ] = "Size optimization for ODF format" ;
+ };
+ CheckBox BTN_WARNALIENFORMAT
+ {
+ Pos = MAP_APPFONT ( 12 , 131 ) ;
+ Size = MAP_APPFONT ( 248 , 10 ) ;
+ Text [ en-US ] = "Warn when not saving in ODF or default format" ;
+ };
+ FixedText FT_APP
+ {
+ Pos = MAP_APPFONT ( 12 , 142 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "D~ocument type";
+ };
+ FixedText FT_FILTER
+ {
+ Pos = MAP_APPFONT ( 136 , 142 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "Always sa~ve as";
+ };
+ ListBox LB_APP
+ {
+ Pos = MAP_APPFONT ( 12 , 153 ) ;
+ Size = MAP_APPFONT ( 108 , 58 ) ;
+ Border = TRUE;
+ DropDown = TRUE;
+ StringList [ en-US ] =
+ {
+ < "Text document" ; APP_WRITER ; > ;
+ < "HTML document" ; APP_WRITER_WEB; > ;
+ < "Master document" ; APP_WRITER_GLOBAL; > ;
+ < "Spreadsheet" ; APP_CALC ; > ;
+ < "Presentation" ; APP_IMPRESS ; > ;
+ < "Drawing" ; APP_DRAW ; > ;
+ < "Formula" ; APP_MATH ; > ;
+ };
+ };
+ FixedImage FI_FILTER
+ {
+ Pos = MAP_APPFONT ( 129, 154 ) ;
+ Size = MAP_APPFONT ( 6 , 6 ) ;
+ Hide = TRUE;
+ };
+ ListBox LB_FILTER
+ {
+ Pos = MAP_APPFONT ( 136 , 153 ) ;
+ Size = MAP_APPFONT ( 108 , 58 ) ;
+ Border = TRUE;
+ Sort = TRUE;
+ DropDown = TRUE;
+ };
+ FixedImage FI_ODF_WARNING
+ {
+ Pos = MAP_APPFONT ( 12, 169 ) ;
+ Size = MAP_APPFONT ( 8 , 8 ) ;
+ Hide = TRUE;
+ };
+ FixedText FT_WARN
+ {
+ Pos = MAP_APPFONT ( 23 , 169 ) ;
+ Size = MAP_APPFONT ( 239 , 8 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Not using ODF 1.2 Extended may cause infomation to be lost.";
+ Text [ x-comment ] = "EN-US, the term 'extended' must not be translated.";
+ };
+ Image IMG_ODF_WARNING
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "odfwarning.png";
+ };
+ MaskColor = Color { Red=0xffff; Green=0x0000; Blue=0xffff; };
+ };
+ Image IMG_ODF_WARNING_HC
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "odfwarning_h.png";
+ };
+ MaskColor = Color { Red=0xffff; Green=0x0000; Blue=0xffff; };
+ };
+};
+
+ModalDialog RID_SVXDLG_FILTER_WARNING
+{
+ HelpID = HID_SVXDLG_FILTER_WARNING;
+ OutputSize = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Sizeable = FALSE ;
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT( 175 + 39 + (3 * 6), (4 * 9)+ 12 + (3 * 12) + 6 - 21 );
+ Text = "%PRODUCTNAME %PRODUCTVERSION" ;
+ FixedImage IMG_WARNING
+ {
+ Pos = MAP_APPFONT( 6, 6 );
+ Size = MAP_APPFONT( 30, 30 );
+ };
+ FixedText FT_FILTER_WARNING
+ {
+ Pos = MAP_APPFONT( 39, 6 );
+ Size = MAP_APPFONT( 175, 4 * 9 );
+ Wordbreak = TRUE;
+ Text [ en-US ] = "Using \"%1\" as default file format may cause information loss.\n";
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT( 60, (4 * 9)/*+ 12*/ + 13 );
+ Size = MAP_APPFONT( 50, 14 );
+ DefButton = TRUE;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT( 120, (4 * 9)/*+ 12*/ + 13 );
+ Size = MAP_APPFONT( 50, 14 );
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/optspell.hrc b/cui/source/options/optspell.hrc
new file mode 100644
index 000000000000..e13ba3ea09a2
--- /dev/null
+++ b/cui/source/options/optspell.hrc
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optspell.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// defines ---------------------------------------------------------------
+
+#define BTN_OK 10
+#define BTN_CANCEL 11
+#define BTN_BOOK 12
+
+#define LB_BOOK 20
+#define GB_BOOK 21
+
+#define BTN_CAPS 30
+#define BTN_NUMS 31
+#define BTN_UPLOW 32
+#define GB_AUDIT 33
+
+
diff --git a/cui/source/options/optspell.src b/cui/source/options/optspell.src
new file mode 100644
index 000000000000..bc6f3ad37fce
--- /dev/null
+++ b/cui/source/options/optspell.src
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optspell.src,v $
+ * $Revision: 1.34 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ------------------------------------------------------------------
+#include <sfx2/sfx.hrc>
+#include "helpid.hrc"
+#include "optspell.hrc"
+ // pragma -------------------------------------------------------------------
+
+ // RID_SFXPAGE_SPELL --------------------------------------------------------
+TabPage RID_SFXPAGE_SPELL
+{
+ HelpId = HID_OPTIONS_SPELL ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 221 , 185 ) ;
+ Text [ en-US ] = "Spellcheck" ;
+ PushButton BTN_BOOK
+ {
+ Pos = MAP_APPFONT ( 128 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Edit..." ;
+ TabStop = TRUE ;
+ };
+ MultiListBox LB_BOOK
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 103 , 47 ) ;
+ TabStop = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+ FixedLine GB_BOOK
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 115 , 66 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Wörterbücher : W÷rterb³cher */
+ /* ### ACHTUNG: Neuer Text in Resource? Wörterbücher : W÷rterb³cher */
+ Text [ en-US ] = "Dictionaries" ;
+ };
+ CheckBox BTN_CAPS
+ {
+ Pos = MAP_APPFONT ( 12 , 82 ) ;
+ Size = MAP_APPFONT ( 103 , 10 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? ~Großgeschriebene Wörter : ~Gro˜geschriebene W÷rter */
+ /* ### ACHTUNG: Neuer Text in Resource? ~Großgeschriebene Wörter : ~Gro˜geschriebene W÷rter */
+ Text [ en-US ] = "~Capital words" ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_NUMS
+ {
+ Pos = MAP_APPFONT ( 12 , 95 ) ;
+ Size = MAP_APPFONT ( 103 , 10 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? ~Wörter mit Ziffern : ~W÷rter mit Ziffern */
+ /* ### ACHTUNG: Neuer Text in Resource? ~Wörter mit Ziffern : ~W÷rter mit Ziffern */
+ Text [ en-US ] = "~Words with numbers " ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_UPLOW
+ {
+ Pos = MAP_APPFONT ( 12 , 108 ) ;
+ Size = MAP_APPFONT ( 103 , 10 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Groß- u. ~Kleinschreibung : Gro˜- u. ~Kleinschreibung */
+ /* ### ACHTUNG: Neuer Text in Resource? Groß- u. ~Kleinschreibung : Gro˜- u. ~Kleinschreibung */
+ Text [ en-US ] = "~Case sensitive " ;
+ TabStop = TRUE ;
+ };
+ FixedLine GB_AUDIT
+ {
+ Pos = MAP_APPFONT ( 6 , 71 ) ;
+ Size = MAP_APPFONT ( 115 , 53 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Prüfen : Pr³fen */
+ /* ### ACHTUNG: Neuer Text in Resource? Prüfen : Pr³fen */
+ Text [ en-US ] = "Check" ;
+ };
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx
new file mode 100644
index 000000000000..0fb6e113c40d
--- /dev/null
+++ b/cui/source/options/optupdt.cxx
@@ -0,0 +1,415 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optupdt.cxx,v $
+ * $Revision: 1.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <vcl/svapp.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <svl/zforlist.hxx>
+#include "optupdt.hxx"
+#include "optupdt.hrc"
+#include <dialmgr.hxx>
+#include <cuires.hrc>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <osl/file.hxx>
+#include <osl/security.hxx>
+
+namespace beans = ::com::sun::star::beans;
+namespace container = ::com::sun::star::container;
+namespace dialogs = ::com::sun::star::ui::dialogs;
+namespace frame = ::com::sun::star::frame;
+namespace lang = ::com::sun::star::lang;
+namespace uno = ::com::sun::star::uno;
+namespace util = ::com::sun::star::util;
+
+// define ----------------------------------------------------------------
+
+#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
+
+// class SvxOnlineUpdateTabPage --------------------------------------------------
+
+SvxOnlineUpdateTabPage::SvxOnlineUpdateTabPage( Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_ONLINEUPDATE ), rSet ),
+ m_aOptionsLine( this, CUI_RES( FL_OPTIONS ) ),
+ m_aAutoCheckCheckBox( this, CUI_RES( CB_AUTOCHECK ) ),
+ m_aEveryDayButton( this, CUI_RES( RB_EVERYDAY ) ),
+ m_aEveryWeekButton( this, CUI_RES( RB_EVERYWEEK ) ),
+ m_aEveryMonthButton( this, CUI_RES( RB_EVERYMONTH ) ),
+ m_aCheckNowButton( this, CUI_RES( PB_CHECKNOW ) ),
+ m_aAutoDownloadCheckBox( this, CUI_RES( CB_AUTODOWNLOAD ) ),
+ m_aDestPathLabel( this, CUI_RES( FT_DESTPATHLABEL ) ),
+ m_aDestPath( this, CUI_RES( FT_DESTPATH ) ),
+ m_aChangePathButton( this, CUI_RES( PB_CHANGEPATH ) ),
+ m_aLastChecked( this, CUI_RES( FT_LASTCHECKED ) )
+{
+ m_aNeverChecked = String( CUI_RES( STR_NEVERCHECKED ) );
+ FreeResource();
+
+ m_aAutoCheckCheckBox.SetClickHdl( LINK( this, SvxOnlineUpdateTabPage, AutoCheckHdl_Impl ) );
+ m_aCheckNowButton.SetClickHdl( LINK( this, SvxOnlineUpdateTabPage, CheckNowHdl_Impl ) );
+ m_aChangePathButton.SetClickHdl( LINK( this, SvxOnlineUpdateTabPage, FileDialogHdl_Impl ) );
+
+ uno::Reference < lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+
+ m_xUpdateAccess = uno::Reference < container::XNameReplace >(
+ xFactory->createInstance( UNISTRING( "com.sun.star.setup.UpdateCheckConfig" ) ),
+ uno::UNO_QUERY_THROW );
+
+ sal_Bool bDownloadSupported = sal_False;
+ m_xUpdateAccess->getByName( UNISTRING( "DownloadSupported") ) >>= bDownloadSupported;
+
+ WinBits nStyle = m_aDestPath.GetStyle();
+ nStyle |= WB_PATHELLIPSIS;
+ m_aDestPath.SetStyle(nStyle);
+
+ m_aAutoDownloadCheckBox.Show(bDownloadSupported);
+ m_aDestPathLabel.Show(bDownloadSupported);
+ m_aDestPath.Show(bDownloadSupported);
+ m_aChangePathButton.Show(bDownloadSupported);
+
+ // dynamical length of the PushButtons
+ CalcButtonWidth();
+
+ m_aLastCheckedTemplate = m_aLastChecked.GetText();
+
+ UpdateLastCheckedText();
+}
+
+// -----------------------------------------------------------------------
+
+SvxOnlineUpdateTabPage::~SvxOnlineUpdateTabPage()
+{
+}
+
+// -----------------------------------------------------------------------
+void SvxOnlineUpdateTabPage::UpdateLastCheckedText()
+{
+ rtl::OUString aDateStr;
+ rtl::OUString aTimeStr;
+ rtl::OUString aText;
+ sal_Int64 lastChecked = 0;
+
+ m_xUpdateAccess->getByName( UNISTRING( "LastCheck") ) >>= lastChecked;
+
+ if( lastChecked == 0 ) // never checked
+ {
+ aText = m_aNeverChecked;
+ }
+ else
+ {
+ TimeValue lastCheckedTV;
+ oslDateTime lastCheckedDT;
+
+ Date aDate;
+ Time aTime;
+
+ lastCheckedTV.Seconds = (sal_uInt32) lastChecked;
+ osl_getLocalTimeFromSystemTime( &lastCheckedTV, &lastCheckedTV );
+
+ if ( osl_getDateTimeFromTimeValue( &lastCheckedTV, &lastCheckedDT ) )
+ {
+ aDate = Date( lastCheckedDT.Day, lastCheckedDT.Month, lastCheckedDT.Year );
+ aTime = Time( lastCheckedDT.Hours, lastCheckedDT.Minutes );
+ }
+
+ LanguageType eUILang = Application::GetSettings().GetUILanguage();
+ SvNumberFormatter *pNumberFormatter = new SvNumberFormatter( ::comphelper::getProcessServiceFactory(), eUILang );
+ String aTmpStr;
+ Color* pColor = NULL;
+ Date* pNullDate = pNumberFormatter->GetNullDate();
+ sal_uInt32 nFormat = pNumberFormatter->GetStandardFormat( NUMBERFORMAT_DATE, eUILang );
+
+ pNumberFormatter->GetOutputString( aDate - *pNullDate, nFormat, aTmpStr, &pColor );
+ aDateStr = aTmpStr;
+
+ nFormat = pNumberFormatter->GetStandardFormat( NUMBERFORMAT_TIME, eUILang );
+ pNumberFormatter->GetOutputString( aTime.GetTimeInDays(), nFormat, aTmpStr, &pColor );
+ aTimeStr = aTmpStr;
+
+ delete pColor;
+ delete pNumberFormatter;
+
+ aText = m_aLastCheckedTemplate;
+ sal_Int32 nIndex = aText.indexOf( UNISTRING( "%DATE%" ) );
+ if ( nIndex != -1 )
+ aText = aText.replaceAt( nIndex, 6, aDateStr );
+
+ nIndex = aText.indexOf( UNISTRING( "%TIME%" ) );
+ if ( nIndex != -1 )
+ aText = aText.replaceAt( nIndex, 6, aTimeStr );
+ }
+
+ m_aLastChecked.SetText( aText );
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage*
+SvxOnlineUpdateTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new SvxOnlineUpdateTabPage( pParent, rAttrSet );
+}
+
+// -----------------------------------------------------------------------
+
+
+BOOL SvxOnlineUpdateTabPage::FillItemSet( SfxItemSet& )
+{
+ BOOL bModified = FALSE;
+
+ sal_Bool bValue;
+ sal_Int64 nValue;
+
+ if( m_aAutoCheckCheckBox.GetSavedValue() != m_aAutoCheckCheckBox.IsChecked() )
+ {
+ bValue = (TRUE == m_aAutoCheckCheckBox.IsChecked());
+ m_xUpdateAccess->replaceByName( UNISTRING("AutoCheckEnabled"), uno::makeAny( bValue ) );
+ bModified = TRUE;
+ }
+
+ nValue = 0;
+ if( TRUE == m_aEveryDayButton.IsChecked() )
+ {
+ if( FALSE == m_aEveryDayButton.GetSavedValue() )
+ nValue = 86400;
+ }
+ else if( TRUE == m_aEveryWeekButton.IsChecked() )
+ {
+ if( FALSE == m_aEveryWeekButton.GetSavedValue() )
+ nValue = 604800;
+ }
+ else if( TRUE == m_aEveryMonthButton.IsChecked() )
+ {
+ if( FALSE == m_aEveryMonthButton.GetSavedValue() )
+ nValue = 2592000;
+ }
+
+ if( nValue > 0 )
+ {
+ m_xUpdateAccess->replaceByName( UNISTRING("CheckInterval"), uno::makeAny( nValue ) );
+ bModified = TRUE;
+ }
+
+ if( m_aAutoDownloadCheckBox.GetSavedValue() != m_aAutoDownloadCheckBox.IsChecked() )
+ {
+ bValue = (TRUE == m_aAutoDownloadCheckBox.IsChecked());
+ m_xUpdateAccess->replaceByName( UNISTRING("AutoDownloadEnabled"), uno::makeAny( bValue ) );
+ bModified = TRUE;
+ }
+
+ rtl::OUString sValue, aURL;
+ m_xUpdateAccess->getByName( UNISTRING("DownloadDestination") ) >>= sValue;
+
+ if( ( osl::FileBase::E_None == osl::FileBase::getFileURLFromSystemPath(m_aDestPath.GetText(), aURL) ) &&
+ ( ! aURL.equals( sValue ) ) )
+ {
+ m_xUpdateAccess->replaceByName( UNISTRING("DownloadDestination"), uno::makeAny( aURL ) );
+ bModified = TRUE;
+ }
+
+ uno::Reference< util::XChangesBatch > xChangesBatch(m_xUpdateAccess, uno::UNO_QUERY);
+ if( xChangesBatch.is() && xChangesBatch->hasPendingChanges() )
+ xChangesBatch->commitChanges();
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxOnlineUpdateTabPage::Reset( const SfxItemSet& )
+{
+ sal_Bool bValue = sal_Bool();
+ m_xUpdateAccess->getByName( UNISTRING("AutoCheckEnabled") ) >>= bValue;
+
+ m_aAutoCheckCheckBox.Check(bValue);
+ m_aEveryDayButton.Enable(bValue);
+ m_aEveryWeekButton.Enable(bValue);
+ m_aEveryMonthButton.Enable(bValue);
+
+ sal_Int64 nValue = 0;
+ m_xUpdateAccess->getByName( UNISTRING("CheckInterval") ) >>= nValue;
+
+ if( nValue == 86400 )
+ m_aEveryDayButton.Check();
+ else if( nValue == 604800 )
+ m_aEveryWeekButton.Check();
+ else
+ m_aEveryMonthButton.Check();
+
+ m_aAutoCheckCheckBox.SaveValue();
+ m_aEveryDayButton.SaveValue();
+ m_aEveryWeekButton.SaveValue();
+ m_aEveryMonthButton.SaveValue();
+
+ m_xUpdateAccess->getByName( UNISTRING("AutoDownloadEnabled") ) >>= bValue;
+ m_aAutoDownloadCheckBox.Check(bValue);
+ m_aDestPathLabel.Enable(TRUE);
+ m_aDestPath.Enable(TRUE);
+ m_aChangePathButton.Enable(TRUE);
+
+ rtl::OUString sValue, aPath;
+ m_xUpdateAccess->getByName( UNISTRING("DownloadDestination") ) >>= sValue;
+
+ if( osl::FileBase::E_None == osl::FileBase::getSystemPathFromFileURL(sValue, aPath) )
+ m_aDestPath.SetText(aPath);
+
+ m_aAutoDownloadCheckBox.SaveValue();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxOnlineUpdateTabPage::FillUserData()
+{
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxOnlineUpdateTabPage, AutoCheckHdl_Impl, CheckBox *, pBox )
+{
+ BOOL bEnabled = pBox->IsChecked();
+
+ m_aEveryDayButton.Enable(bEnabled);
+ m_aEveryWeekButton.Enable(bEnabled);
+ m_aEveryMonthButton.Enable(bEnabled);
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxOnlineUpdateTabPage, FileDialogHdl_Impl, PushButton *, EMPTYARG )
+{
+ uno::Reference < lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ uno::Reference < dialogs::XFolderPicker > xFolderPicker(
+ xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) ) ),
+ uno::UNO_QUERY );
+
+ rtl::OUString aURL;
+ if( osl::FileBase::E_None != osl::FileBase::getFileURLFromSystemPath(m_aDestPath.GetText(), aURL) )
+ osl::Security().getHomeDir(aURL);
+
+ xFolderPicker->setDisplayDirectory( aURL );
+ sal_Int16 nRet = xFolderPicker->execute();
+
+ if ( dialogs::ExecutableDialogResults::OK == nRet )
+ {
+ rtl::OUString aFolder;
+ if( osl::FileBase::E_None == osl::FileBase::getSystemPathFromFileURL(xFolderPicker->getDirectory(), aFolder))
+ m_aDestPath.SetText( aFolder );
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxOnlineUpdateTabPage, CheckNowHdl_Impl, PushButton *, EMPTYARG )
+{
+ uno::Reference < lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xConfigProvider(
+ xFactory->createInstance( UNISTRING( "com.sun.star.configuration.ConfigurationProvider" )),
+ uno::UNO_QUERY_THROW);
+
+ beans::PropertyValue aProperty;
+ aProperty.Name = UNISTRING( "nodepath" );
+ aProperty.Value = uno::makeAny( UNISTRING("org.openoffice.Office.Addons/AddonUI/OfficeHelp/UpdateCheckJob") );
+
+ uno::Sequence< uno::Any > aArgumentList( 1 );
+ aArgumentList[0] = uno::makeAny( aProperty );
+
+ uno::Reference< container::XNameAccess > xNameAccess(
+ xConfigProvider->createInstanceWithArguments(
+ UNISTRING("com.sun.star.configuration.ConfigurationAccess"), aArgumentList ),
+ uno::UNO_QUERY_THROW );
+
+ util::URL aURL;
+ xNameAccess->getByName(UNISTRING("URL")) >>= aURL.Complete;
+
+ uno::Reference < util::XURLTransformer > xTransformer(
+ xFactory->createInstance( UNISTRING( "com.sun.star.util.URLTransformer" ) ),
+ uno::UNO_QUERY_THROW );
+
+ xTransformer->parseStrict(aURL);
+
+ uno::Reference < frame::XDesktop > xDesktop(
+ xFactory->createInstance( UNISTRING( "com.sun.star.frame.Desktop" ) ),
+ uno::UNO_QUERY_THROW );
+
+ uno::Reference< frame::XDispatchProvider > xDispatchProvider(
+ xDesktop->getCurrentFrame(), uno::UNO_QUERY );
+
+ uno::Reference< frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch(aURL, rtl::OUString(), 0);
+
+ if( xDispatch.is() )
+ {
+ xDispatch->dispatch(aURL, uno::Sequence< beans::PropertyValue > ());
+ UpdateLastCheckedText();
+ }
+ }
+ catch( const uno::Exception& e )
+ {
+ OSL_TRACE( "Caught exception: %s\n thread terminated.\n",
+ rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
+ }
+
+ return 0;
+}
+
+void SvxOnlineUpdateTabPage::CalcButtonWidth()
+{
+ // detect the longest button text
+ long nTxtWidth = ::std::max( m_aCheckNowButton.GetCtrlTextWidth( m_aCheckNowButton.GetText() ),
+ m_aCheckNowButton.GetCtrlTextWidth( m_aChangePathButton.GetText() ) );
+ // add a little offset
+ nTxtWidth = nTxtWidth + 12;
+ // compare with the button width
+ Size aSize = m_aCheckNowButton.GetSizePixel();
+ // and change it if it's necessary
+ if ( nTxtWidth > aSize.Width() )
+ {
+ aSize.Width() = nTxtWidth;
+ m_aCheckNowButton.SetSizePixel( aSize );
+ m_aChangePathButton.SetSizePixel( aSize );
+ }
+}
+
diff --git a/cui/source/options/optupdt.hrc b/cui/source/options/optupdt.hrc
new file mode 100644
index 000000000000..d9e77f7f1403
--- /dev/null
+++ b/cui/source/options/optupdt.hrc
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optupdt.hrc,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTUPDT_HRC
+#define _SVX_OPTUPDT_HRC
+
+// defines ---------------------------------------------------------------
+
+// class SvxOnlineUpdateTabPage ----------------------------------------------
+
+#define FL_OPTIONS 10
+#define CB_AUTOCHECK 11
+#define RB_EVERYDAY 12
+#define RB_EVERYWEEK 13
+#define RB_EVERYMONTH 14
+#define PB_CHECKNOW 15
+#define CB_AUTODOWNLOAD 16
+#define FT_DESTPATHLABEL 17
+#define FT_DESTPATH 18
+#define PB_CHANGEPATH 19
+#define FT_LASTCHECKED 20
+#define STR_NEVERCHECKED 21
+
+
+#endif // #ifndef _SVX_OPTUPDT_HRC
+
diff --git a/cui/source/options/optupdt.hxx b/cui/source/options/optupdt.hxx
new file mode 100644
index 000000000000..4aa380844602
--- /dev/null
+++ b/cui/source/options/optupdt.hxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optupdt.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_OPTUPDT_HXX
+#define _SVX_OPTUPDT_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/tabdlg.hxx>
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#include <com/sun/star/container/XNameReplace.hpp>
+
+// class SvxPathTabPage --------------------------------------------------
+
+class SvxOnlineUpdateTabPage : public SfxTabPage
+{
+private:
+ FixedLine m_aOptionsLine;
+ CheckBox m_aAutoCheckCheckBox;
+ RadioButton m_aEveryDayButton;
+ RadioButton m_aEveryWeekButton;
+ RadioButton m_aEveryMonthButton;
+ PushButton m_aCheckNowButton;
+ CheckBox m_aAutoDownloadCheckBox;
+ FixedText m_aDestPathLabel;
+ FixedText m_aDestPath;
+ PushButton m_aChangePathButton;
+ FixedText m_aLastChecked;
+ rtl::OUString m_aNeverChecked;
+ rtl::OUString m_aLastCheckedTemplate;
+
+ DECL_LINK( FileDialogHdl_Impl, PushButton* ) ;
+ DECL_LINK( CheckNowHdl_Impl, PushButton* ) ;
+ DECL_LINK( AutoCheckHdl_Impl, CheckBox* ) ;
+
+ void CalcButtonWidth();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xUpdateAccess;
+
+ void UpdateLastCheckedText();
+
+public:
+ SvxOnlineUpdateTabPage( Window* pParent, const SfxItemSet& rSet );
+ ~SvxOnlineUpdateTabPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual void FillUserData();
+};
+
+
+#endif
+
diff --git a/cui/source/options/optupdt.src b/cui/source/options/optupdt.src
new file mode 100644
index 000000000000..55d213978672
--- /dev/null
+++ b/cui/source/options/optupdt.src
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: optupdt.src,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// include --------------------------------------------------------------
+#include "optupdt.hrc"
+#include <cuires.hrc>
+#include "helpid.hrc"
+
+ // RID_SVXPAGE_ONLINEUPDATE --------------------------------------------
+TabPage RID_SVXPAGE_ONLINEUPDATE
+{
+ HelpId = HID_SVX_OPTIONS_ONLINEUPDATE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "OnlineUpdate" ;
+ FixedLine FL_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Online Update Options" ;
+ };
+ CheckBox CB_AUTOCHECK
+ {
+ Pos = MAP_APPFONT ( 12, 14 ) ;
+ Size = MAP_APPFONT ( 210, 10 ) ;
+ Text [ en-US ] = "~Check for updates automatically" ;
+ };
+ RadioButton RB_EVERYDAY
+ {
+ Pos = MAP_APPFONT ( 18, 27 ) ;
+ Size = MAP_APPFONT ( 160, 10 ) ;
+ Text [ en-US ] = "Every Da~y" ;
+ };
+ RadioButton RB_EVERYWEEK
+ {
+ Pos = MAP_APPFONT ( 18, 40 ) ;
+ Size = MAP_APPFONT ( 160, 10 ) ;
+ Text [ en-US ] = "Every ~Week" ;
+ };
+ RadioButton RB_EVERYMONTH
+ {
+ Pos = MAP_APPFONT ( 18, 53 ) ;
+ Size = MAP_APPFONT ( 160, 10 ) ;
+ Text [ en-US ] = "Every ~Month" ;
+ };
+ FixedText FT_LASTCHECKED
+ {
+ Pos = MAP_APPFONT ( 12, 69 ) ;
+ Size = MAP_APPFONT ( 160, 10 ) ;
+ Text [ en-US ] = "Last checked: %DATE%, %TIME%" ;
+ };
+ PushButton PB_CHECKNOW
+ {
+ Pos = MAP_APPFONT ( 12, 82 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ Text [ en-US ] = "Check ~now" ;
+ };
+ CheckBox CB_AUTODOWNLOAD
+ {
+ Pos = MAP_APPFONT ( 12, 130 ) ;
+ Size = MAP_APPFONT ( 160, 10 ) ;
+ Text [ en-US ] = "~Download updates automatically" ;
+ };
+ FixedText FT_DESTPATHLABEL
+ {
+ Pos = MAP_APPFONT ( 22, 143 ) ;
+ Size = MAP_APPFONT ( 150, 8 ) ;
+ Text [ en-US ] = "Download destination:" ;
+ };
+ FixedText FT_DESTPATH
+ {
+ Pos = MAP_APPFONT ( 22, 154 ) ;
+ Size = MAP_APPFONT ( 138, 8 ) ;
+ };
+ PushButton PB_CHANGEPATH
+ {
+ Pos = MAP_APPFONT ( 162, 151 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ Text [ en-US ] = "Ch~ange..." ;
+ };
+ String STR_NEVERCHECKED
+ {
+ Text [ en-US ] = "Last checked: Not yet" ;
+ };
+};
diff --git a/cui/source/options/radiobtnbox.cxx b/cui/source/options/radiobtnbox.cxx
new file mode 100644
index 000000000000..a3cf9719bf59
--- /dev/null
+++ b/cui/source/options/radiobtnbox.cxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: radiobtnbox.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include "radiobtnbox.hxx"
+#include <dialmgr.hxx>
+
+namespace svx {
+
+// class SvxRadioButtonListBox ----------------------------------------------------
+
+SvxRadioButtonListBox::SvxRadioButtonListBox( Window* _pParent, const ResId& _rId ) :
+
+ SvxSimpleTable( _pParent, _rId )
+
+{
+ EnableCheckButton( new SvLBoxButtonData( this, true ) );
+}
+
+SvxRadioButtonListBox::~SvxRadioButtonListBox()
+{
+}
+
+void SvxRadioButtonListBox::SetTabs()
+{
+ SvxSimpleTable::SetTabs();
+/*
+ USHORT nAdjust = SV_LBOXTAB_ADJUST_RIGHT | SV_LBOXTAB_ADJUST_LEFT |
+ SV_LBOXTAB_ADJUST_CENTER | SV_LBOXTAB_ADJUST_NUMERIC | SV_LBOXTAB_FORCE;
+ if ( aTabs.Count() > 0 )
+ {
+ SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(0);
+ pTab->nFlags &= ~nAdjust;
+ pTab->nFlags |= SV_LBOXTAB_PUSHABLE | SV_LBOXTAB_ADJUST_CENTER | SV_LBOXTAB_FORCE;
+ }
+*/
+}
+
+void SvxRadioButtonListBox::MouseButtonUp( const MouseEvent& _rMEvt )
+{
+ m_aCurMousePoint = _rMEvt.GetPosPixel();
+ SvxSimpleTable::MouseButtonUp( _rMEvt );
+}
+
+void SvxRadioButtonListBox::KeyInput( const KeyEvent& rKEvt )
+{
+ if ( !rKEvt.GetKeyCode().GetModifier() && KEY_SPACE == rKEvt.GetKeyCode().GetCode() )
+ {
+ SvLBoxEntry* pEntry = FirstSelected();
+ if ( GetCheckButtonState( pEntry ) == SV_BUTTON_UNCHECKED )
+ {
+ SetCheckButtonState( pEntry, SV_BUTTON_CHECKED );
+ GetCheckButtonHdl().Call( NULL );
+ return ;
+ }
+ }
+
+ SvxSimpleTable::KeyInput( rKEvt );
+}
+
+void SvxRadioButtonListBox::HandleEntryChecked( SvLBoxEntry* _pEntry )
+{
+ Select( _pEntry, TRUE );
+ SvButtonState eState = GetCheckButtonState( _pEntry );
+
+ if ( SV_BUTTON_CHECKED == eState )
+ {
+ // we have radio button behavior -> so uncheck the other entries
+ SvLBoxEntry* pEntry = First();
+ while ( pEntry )
+ {
+ if ( pEntry != _pEntry )
+ SetCheckButtonState( pEntry, SV_BUTTON_UNCHECKED );
+ pEntry = Next( pEntry );
+ }
+ }
+ else
+ SetCheckButtonState( _pEntry, SV_BUTTON_CHECKED );
+}
+
+const Point& SvxRadioButtonListBox::GetCurMousePoint() const
+{
+ return m_aCurMousePoint;
+}
+
+} // end of namespace ::svx
+
diff --git a/cui/source/options/readonlyimage.cxx b/cui/source/options/readonlyimage.cxx
new file mode 100644
index 000000000000..508c4e6cfaec
--- /dev/null
+++ b/cui/source/options/readonlyimage.cxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: readonlyimage.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+#include <readonlyimage.hxx>
+#include <vcl/help.hxx>
+#include <dialmgr.hxx>
+#include <cuires.hrc>
+
+/*-- 26.02.2004 13:31:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+ReadOnlyImage::ReadOnlyImage(Window* pParent, const ResId rResId) :
+ FixedImage(pParent, rResId)
+{
+ sal_Bool bHighContrast = pParent->GetSettings().GetStyleSettings().GetHighContrastMode();
+ SetImage( Image(CUI_RES(bHighContrast ? RID_SVXBMP_LOCK_HC : RID_SVXBMP_LOCK )));
+}
+
+/*-- 26.02.2004 13:31:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+ReadOnlyImage::~ReadOnlyImage()
+{
+}
+/*-- 26.02.2004 13:31:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void ReadOnlyImage::RequestHelp( const HelpEvent& rHEvt )
+{
+ if( Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled() )
+ {
+ Rectangle aLogicPix( LogicToPixel( Rectangle( Point(), GetOutputSize() ) ) );
+ Rectangle aScreenRect( OutputToScreenPixel( aLogicPix.TopLeft() ),
+ OutputToScreenPixel( aLogicPix.BottomRight() ) );
+
+ String aStr(ReadOnlyImage::GetHelpTip());
+ if ( Help::IsBalloonHelpEnabled() )
+ Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), aScreenRect,
+ aStr );
+ else if ( Help::IsQuickHelpEnabled() )
+ Help::ShowQuickHelp( this, aScreenRect, aStr );
+ }
+ else
+ Window::RequestHelp( rHEvt );
+}
+
+/*-- 26.02.2004 14:20:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const String& ReadOnlyImage::GetHelpTip()
+{
+ static String aStr(CUI_RES(RID_SVXSTR_READONLY_CONFIG_TIP));
+ return aStr;
+}
diff --git a/cui/source/options/readonlyimage.hxx b/cui/source/options/readonlyimage.hxx
new file mode 100644
index 000000000000..10e44989e9e9
--- /dev/null
+++ b/cui/source/options/readonlyimage.hxx
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: readonlyimage.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_READONLYIMAGE_HXX
+#define _SVX_READONLYIMAGE_HXX
+
+#include <vcl/fixed.hxx>
+
+class ReadOnlyImage : public FixedImage
+{
+public:
+ ReadOnlyImage(Window* pParent, const ResId rResId);
+ ~ReadOnlyImage();
+
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ static const String& GetHelpTip();
+
+};
+#endif //
+
diff --git a/cui/source/options/readonlyimage.src b/cui/source/options/readonlyimage.src
new file mode 100644
index 000000000000..92b7d2b73fb3
--- /dev/null
+++ b/cui/source/options/readonlyimage.src
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: readonlyimage.src,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // include ---------------------------------------------------------------
+
+#include <cuires.hrc>
+
+String RID_SVXSTR_READONLY_CONFIG_TIP
+{
+ Text [ en-US ] = "This setting is protected by the Administrator";
+};
+Image RID_SVXBMP_LOCK
+{
+ ImageBitmap = Bitmap
+ {
+ File = "lock.bmp";
+ };
+ MaskColor = Color { Red=0xffff; Green=0x0000; Blue=0xffff; };
+};
+Image RID_SVXBMP_LOCK_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "lock_hc.bmp";
+ };
+ MaskColor = Color { Red=0xffff; Green=0x0000; Blue=0xffff; };
+};
+
diff --git a/cui/source/options/sdbcdriverenum.cxx b/cui/source/options/sdbcdriverenum.cxx
new file mode 100644
index 000000000000..5da5d649a969
--- /dev/null
+++ b/cui/source/options/sdbcdriverenum.cxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sdbcdriverenum.cxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include "sdbcdriverenum.hxx"
+#include <comphelper/stl_types.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+//........................................................................
+namespace offapp
+{
+//........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::container;
+
+ //====================================================================
+ //= ODriverEnumerationImpl
+ //====================================================================
+ class ODriverEnumerationImpl
+ {
+ protected:
+ ::std::vector< ::rtl::OUString > m_aImplNames;
+
+ public:
+ ODriverEnumerationImpl();
+
+ const ::std::vector< ::rtl::OUString >& getDriverImplNames() const { return m_aImplNames; }
+ };
+
+ //--------------------------------------------------------------------
+ ODriverEnumerationImpl::ODriverEnumerationImpl()
+ {
+ try
+ {
+ Reference< XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
+ Reference< XInterface > xDM = xORB->createInstance(::rtl::OUString::createFromAscii("com.sun.star.sdbc.DriverManager"));
+ OSL_ENSURE(xDM.is(), "ODriverEnumerationImpl::ODriverEnumerationImpl: no access to the SDBC driver manager!");
+
+ Reference< XEnumerationAccess > xEnumAccess(xDM, UNO_QUERY);
+ OSL_ENSURE(xEnumAccess.is() || !xDM.is(), "ODriverEnumerationImpl::ODriverEnumerationImpl: can't enumerate SDBC drivers (missing the interface)!");
+ if (xEnumAccess.is())
+ {
+ Reference< XEnumeration > xEnumDrivers = xEnumAccess->createEnumeration();
+ OSL_ENSURE(xEnumDrivers.is(), "ODriverEnumerationImpl::ODriverEnumerationImpl: invalid enumeration object!");
+
+ Reference< XServiceInfo > xDriverSI;
+ while (xEnumDrivers->hasMoreElements())
+ {
+ xEnumDrivers->nextElement() >>= xDriverSI;
+ OSL_ENSURE(xDriverSI.is(), "ODriverEnumerationImpl::ODriverEnumerationImpl: driver without service info!");
+ if (xDriverSI.is())
+ m_aImplNames.push_back(xDriverSI->getImplementationName());
+ }
+ }
+ }
+ catch(const Exception&)
+ {
+ OSL_ENSURE(sal_False, "ODriverEnumerationImpl::ODriverEnumerationImpl: caught an exception while enumerating the drivers!");
+ }
+ }
+
+ //====================================================================
+ //= ODriverEnumeration
+ //====================================================================
+ //--------------------------------------------------------------------
+ ODriverEnumeration::ODriverEnumeration() throw()
+ :m_pImpl(new ODriverEnumerationImpl)
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ODriverEnumeration::~ODriverEnumeration() throw()
+ {
+ delete m_pImpl;
+ }
+
+ //--------------------------------------------------------------------
+ ODriverEnumeration::const_iterator ODriverEnumeration::begin() const throw()
+ {
+ return m_pImpl->getDriverImplNames().begin();
+ }
+
+ //--------------------------------------------------------------------
+ ODriverEnumeration::const_iterator ODriverEnumeration::end() const throw()
+ {
+ return m_pImpl->getDriverImplNames().end();
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 ODriverEnumeration::size() const throw()
+ {
+ return m_pImpl->getDriverImplNames().size();
+ }
+
+//........................................................................
+} // namespace offapp
+//........................................................................
+
+
diff --git a/cui/source/options/sdbcdriverenum.hxx b/cui/source/options/sdbcdriverenum.hxx
new file mode 100644
index 000000000000..eaee591b22f3
--- /dev/null
+++ b/cui/source/options/sdbcdriverenum.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sdbcdriverenum.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _OFFMGR_SDBCDRIVERENUMERATION_HXX_
+#define _OFFMGR_SDBCDRIVERENUMERATION_HXX_
+
+
+#include <sal/types.h>
+
+#include <vector>
+
+namespace rtl
+{
+ class OUString;
+}
+
+//........................................................................
+namespace offapp
+{
+//........................................................................
+
+ //====================================================================
+ //= ODriverEnumeration
+ //====================================================================
+ class ODriverEnumerationImpl;
+ /** simple class for accessing SDBC drivers registered within the office
+ <p>Rather small, introduced to not contaminate other instances with the
+ exception handling (code-size-bloating) implementations here.
+ </p>
+ */
+ class ODriverEnumeration
+ {
+ private:
+ ODriverEnumerationImpl* m_pImpl;
+
+ public:
+ ODriverEnumeration() throw();
+ ~ODriverEnumeration() throw();
+ typedef ::std::vector< ::rtl::OUString >::const_iterator const_iterator;
+
+ const_iterator begin() const throw();
+ const_iterator end() const throw();
+ sal_Int32 size() const throw();
+ };
+
+//........................................................................
+} // namespace offapp
+//........................................................................
+
+#endif // _OFFMGR_SDBCDRIVERENUMERATION_HXX_
+
+
diff --git a/cui/source/options/securityoptions.cxx b/cui/source/options/securityoptions.cxx
new file mode 100644
index 000000000000..85afe1476d5b
--- /dev/null
+++ b/cui/source/options/securityoptions.cxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: securityoptions.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <unotools/securityoptions.hxx>
+#include <svtools/stdctrl.hxx>
+#include <dialmgr.hxx>
+#include <cuires.hrc>
+#include "securityoptions.hxx"
+#include "securityoptions.hrc"
+
+namespace
+{
+ bool enableAndSet( const SvtSecurityOptions& rOptions,
+ SvtSecurityOptions::EOption eOption,
+ CheckBox& rCheckBox, FixedImage& rFixedImage )
+ {
+ bool bEnable = rOptions.IsOptionEnabled( eOption );
+ rCheckBox.Enable( bEnable );
+ rFixedImage.Show( !bEnable );
+ rCheckBox.Check( rOptions.IsOptionSet( eOption ) );
+ return bEnable;
+ }
+}
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+SecurityOptionsDialog::SecurityOptionsDialog( Window* pParent, SvtSecurityOptions* pOptions ) :
+ ModalDialog( pParent, CUI_RES( RID_SVXDLG_SECURITY_OPTIONS ) )
+ ,m_aWarningsFL ( this, CUI_RES( FL_WARNINGS ) )
+ ,m_aWarningsFI ( this, CUI_RES( FI_WARNINGS ) )
+ ,m_aSaveOrSendDocsFI( this, CUI_RES( FI_SAVESENDDOCS ) )
+ ,m_aSaveOrSendDocsCB( this, CUI_RES( CB_SAVESENDDOCS ) )
+ ,m_aSignDocsFI ( this, CUI_RES( FI_SIGNDOCS ) )
+ ,m_aSignDocsCB ( this, CUI_RES( CB_SIGNDOCS ) )
+ ,m_aPrintDocsFI ( this, CUI_RES( FI_PRINTDOCS ) )
+ ,m_aPrintDocsCB ( this, CUI_RES( CB_PRINTDOCS ) )
+ ,m_aCreatePdfFI ( this, CUI_RES( FI_CREATEPDF ) )
+ ,m_aCreatePdfCB ( this, CUI_RES( CB_CREATEPDF ) )
+ ,m_aOptionsFL ( this, CUI_RES( FL_OPTIONS ) )
+ ,m_aRemovePersInfoFI( this, CUI_RES( FI_REMOVEINFO ) )
+ ,m_aRemovePersInfoCB( this, CUI_RES( CB_REMOVEINFO ) )
+ ,m_aRecommPasswdFI ( this, CUI_RES( FI_RECOMMENDPWD ) )
+ ,m_aRecommPasswdCB ( this, CUI_RES( CB_RECOMMENDPWD ) )
+ ,m_aCtrlHyperlinkFI ( this, CUI_RES( FI_CTRLHYPERLINK ) )
+ ,m_aCtrlHyperlinkCB ( this, CUI_RES( CB_CTRLHYPERLINK ) )
+
+ ,m_aButtonsFL ( this, CUI_RES( FL_BUTTONS ) )
+ ,m_aOKBtn ( this, CUI_RES( PB_OK ) )
+ ,m_aCancelBtn ( this, CUI_RES( PB_CANCEL ) )
+ ,m_aHelpBtn ( this, CUI_RES( PB_HELP ) )
+
+{
+ FreeResource();
+
+ DBG_ASSERT( pOptions, "SecurityOptionsDialog::SecurityOptionsDialog(): invalid SvtSecurityOptions" );
+ enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_SAVEORSEND, m_aSaveOrSendDocsCB, m_aSaveOrSendDocsFI );
+ enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_SIGNING, m_aSignDocsCB, m_aSignDocsFI );
+ enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_PRINT, m_aPrintDocsCB, m_aPrintDocsFI );
+ enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_CREATEPDF, m_aCreatePdfCB, m_aCreatePdfFI );
+ enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_REMOVEPERSONALINFO, m_aRemovePersInfoCB, m_aRemovePersInfoFI );
+ enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD, m_aRecommPasswdCB, m_aRecommPasswdFI );
+ enableAndSet( *pOptions, SvtSecurityOptions::E_CTRLCLICK_HYPERLINK, m_aCtrlHyperlinkCB, m_aCtrlHyperlinkFI );
+}
+
+SecurityOptionsDialog::~SecurityOptionsDialog()
+{
+}
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
diff --git a/cui/source/options/securityoptions.hrc b/cui/source/options/securityoptions.hrc
new file mode 100644
index 000000000000..c0358d5f151b
--- /dev/null
+++ b/cui/source/options/securityoptions.hrc
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: securityoptions.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_SECURITYOPTIONS_HRC
+#define _SVX_SECURITYOPTIONS_HRC
+
+#define FL_WARNINGS 10
+#define FI_WARNINGS 11
+#define FI_SAVESENDDOCS 12
+#define CB_SAVESENDDOCS 13
+#define FI_SIGNDOCS 14
+#define CB_SIGNDOCS 15
+#define FI_PRINTDOCS 16
+#define CB_PRINTDOCS 17
+#define FI_CREATEPDF 18
+#define CB_CREATEPDF 19
+#define FL_OPTIONS 20
+#define FI_REMOVEINFO 21
+#define CB_REMOVEINFO 22
+#define FI_RECOMMENDPWD 23
+#define CB_RECOMMENDPWD 24
+#define FI_CTRLHYPERLINK 25
+#define CB_CTRLHYPERLINK 26
+#define FL_BUTTONS 27
+#define PB_OK 28
+#define PB_CANCEL 29
+#define PB_HELP 30
+
+#define DLG_WIDTH 260
+
+#define COL_0 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define COL_1 (COL_0+RSC_SP_FLGR_SPACE_X)
+#define COL_2 (COL_1+RSC_SP_CHK_TEXTINDENT)
+#define COL_4 (DLG_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT)
+#define COL_3 (COL_4-RSC_SP_FLGR_SPACE_X)
+
+#define COL_C (COL_4-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_B (COL_C-RSC_SP_CTRL_X-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_A (COL_B-RSC_SP_CTRL_GROUP_X-RSC_CD_PUSHBUTTON_WIDTH)
+
+#define CHECKBOX_WIDTH ((COL_3-COL_2-RSC_SP_CTRL_X)/2)
+
+#define ROW_0 (RSC_SP_DLG_INNERBORDER_TOP)
+#define ROW_1 (ROW_0+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_2 (ROW_1+2*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_3 (ROW_2+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_4 (ROW_3+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_5 (ROW_4+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_6 (ROW_5+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_7 (ROW_6+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_8 (ROW_7+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_9 (ROW_8+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_10 (ROW_9+RSC_CD_PUSHBUTTON_HEIGHT+RSC_SP_DLG_INNERBORDER_BOTTOM)
+
+#endif // #ifndef _SVX_SECURITYOPTIONS_HRC
+
diff --git a/cui/source/options/securityoptions.hxx b/cui/source/options/securityoptions.hxx
new file mode 100644
index 000000000000..0e78e328edd8
--- /dev/null
+++ b/cui/source/options/securityoptions.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: securityoptions.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_SECURITYOPTIONS_HXX
+#define _SVX_SECURITYOPTIONS_HXX
+
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+
+#include "readonlyimage.hxx"
+
+class SvtSecurityOptions;
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= class SecurityOptionsDialog
+ //====================================================================
+ class SecurityOptionsDialog : public ModalDialog
+ {
+ private:
+ FixedLine m_aWarningsFL;
+ FixedInfo m_aWarningsFI;
+ ReadOnlyImage m_aSaveOrSendDocsFI;
+ CheckBox m_aSaveOrSendDocsCB;
+ ReadOnlyImage m_aSignDocsFI;
+ CheckBox m_aSignDocsCB;
+ ReadOnlyImage m_aPrintDocsFI;
+ CheckBox m_aPrintDocsCB;
+ ReadOnlyImage m_aCreatePdfFI;
+ CheckBox m_aCreatePdfCB;
+
+ FixedLine m_aOptionsFL;
+ ReadOnlyImage m_aRemovePersInfoFI;
+ CheckBox m_aRemovePersInfoCB;
+ ReadOnlyImage m_aRecommPasswdFI;
+ CheckBox m_aRecommPasswdCB;
+ ReadOnlyImage m_aCtrlHyperlinkFI;
+ CheckBox m_aCtrlHyperlinkCB;
+
+ FixedLine m_aButtonsFL;
+ OKButton m_aOKBtn;
+ CancelButton m_aCancelBtn;
+ HelpButton m_aHelpBtn;
+
+ public:
+ SecurityOptionsDialog( Window* pParent, SvtSecurityOptions* pOptions );
+ ~SecurityOptionsDialog();
+
+ inline bool IsSaveOrSendDocsChecked() const { return m_aSaveOrSendDocsCB.IsChecked() != FALSE; }
+ inline bool IsSignDocsChecked() const { return m_aSignDocsCB.IsChecked() != FALSE; }
+ inline bool IsPrintDocsChecked() const { return m_aPrintDocsCB.IsChecked() != FALSE; }
+ inline bool IsCreatePdfChecked() const { return m_aCreatePdfCB.IsChecked() != FALSE; }
+ inline bool IsRemovePersInfoChecked() const { return m_aRemovePersInfoCB.IsChecked() != FALSE; }
+ inline bool IsRecommPasswdChecked() const { return m_aRecommPasswdCB.IsChecked() != FALSE; }
+ inline bool IsCtrlHyperlinkChecked() const { return m_aCtrlHyperlinkCB.IsChecked() != FALSE; }
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // #ifndef _SVX_SECURITYOPTIONS_HXX
+
diff --git a/cui/source/options/securityoptions.src b/cui/source/options/securityoptions.src
new file mode 100644
index 000000000000..386f92a91fe3
--- /dev/null
+++ b/cui/source/options/securityoptions.src
@@ -0,0 +1,168 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: securityoptions.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// include --------------------------------------------------------------
+
+#include <svtools/controldims.hrc>
+#include "securityoptions.hrc"
+#include <cuires.hrc>
+#include "helpid.hrc"
+
+ModalDialog RID_SVXDLG_SECURITY_OPTIONS
+{
+ HelpID = HID_DLG_SECURITY_OPTIONS ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( DLG_WIDTH , ROW_10 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "Security options and warnings" ;
+ FixedLine FL_WARNINGS
+ {
+ Pos = MAP_APPFONT( COL_0, ROW_0 );
+ Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Security warnings";
+ };
+ FixedText FI_WARNINGS
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_1 );
+ Size = MAP_APPFONT( COL_3-COL_1, 2*RSC_CD_FIXEDLINE_HEIGHT );
+ Wordbreak = TRUE;
+ Text [ en-US ] = "Warn if document contains recorded changes, versions, hidden information or notes:";
+ };
+ FixedImage FI_SAVESENDDOCS
+ {
+ Pos = MAP_APPFONT( COL_2 - 7, ROW_2 + 2 );
+ Size = MAP_APPFONT( 6, 6 );
+ };
+ CheckBox CB_SAVESENDDOCS
+ {
+ Pos = MAP_APPFONT( COL_2, ROW_2 );
+ Size = MAP_APPFONT( CHECKBOX_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "When saving or sending";
+ };
+ FixedImage FI_SIGNDOCS
+ {
+ Pos = MAP_APPFONT( COL_2 + CHECKBOX_WIDTH + RSC_SP_CTRL_X - 7, ROW_2 + 2 );
+ Size = MAP_APPFONT( 6, 6 );
+ };
+ CheckBox CB_SIGNDOCS
+ {
+ Pos = MAP_APPFONT( COL_2 + CHECKBOX_WIDTH + RSC_SP_CTRL_X, ROW_2 );
+ Size = MAP_APPFONT( CHECKBOX_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "When signing";
+ };
+ FixedImage FI_PRINTDOCS
+ {
+ Pos = MAP_APPFONT( COL_2 - 7, ROW_3 + 2 );
+ Size = MAP_APPFONT( 6, 6 );
+ };
+ CheckBox CB_PRINTDOCS
+ {
+ Pos = MAP_APPFONT( COL_2, ROW_3 );
+ Size = MAP_APPFONT( CHECKBOX_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "When printing";
+ };
+ FixedImage FI_CREATEPDF
+ {
+ Pos = MAP_APPFONT( COL_2 + CHECKBOX_WIDTH + RSC_SP_CTRL_X - 7, ROW_3 + 2 );
+ Size = MAP_APPFONT( 6, 6 );
+ };
+ CheckBox CB_CREATEPDF
+ {
+ Pos = MAP_APPFONT( COL_2 + CHECKBOX_WIDTH + RSC_SP_CTRL_X, ROW_3 );
+ Size = MAP_APPFONT( CHECKBOX_WIDTH, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "When creating PDF files";
+ };
+ FixedLine FL_OPTIONS
+ {
+ Pos = MAP_APPFONT( COL_0, ROW_4 );
+ Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Security options";
+ };
+ FixedImage FI_REMOVEINFO
+ {
+ Pos = MAP_APPFONT( COL_1 - 7, ROW_5 + 2 );
+ Size = MAP_APPFONT( 6, 6 );
+ };
+ CheckBox CB_REMOVEINFO
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_5 );
+ Size = MAP_APPFONT( COL_3-COL_1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Remove personal information on saving";
+ };
+ FixedImage FI_RECOMMENDPWD
+ {
+ Pos = MAP_APPFONT( COL_1 - 7, ROW_6 + 2 );
+ Size = MAP_APPFONT( 6, 6 );
+ };
+ CheckBox CB_RECOMMENDPWD
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_6 );
+ Size = MAP_APPFONT( COL_3-COL_1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Recommend password protection on saving";
+ };
+ FixedImage FI_CTRLHYPERLINK
+ {
+ Pos = MAP_APPFONT( COL_1 - 7, ROW_6 + 2 );
+ Size = MAP_APPFONT( 6, 6 );
+ };
+ CheckBox CB_CTRLHYPERLINK
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_7 );
+ Size = MAP_APPFONT( COL_3-COL_1, RSC_CD_CHECKBOX_HEIGHT );
+ Text [ en-US ] = "Ctrl-click required to follow hyperlinks";
+ };
+ FixedLine FL_BUTTONS
+ {
+ Pos = MAP_APPFONT( 0, ROW_8 );
+ Size = MAP_APPFONT( DLG_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( COL_A , ROW_9 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( COL_B , ROW_9 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( COL_C , ROW_9 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+};
+
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
new file mode 100644
index 000000000000..b45a19af4a70
--- /dev/null
+++ b/cui/source/options/treeopt.cxx
@@ -0,0 +1,2850 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: treeopt.cxx,v $
+ * $Revision: 1.58 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/loader/CannotActivateFactoryException.hpp>
+#include <com/sun/star/linguistic2/XDictionaryList.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/util/XMacroExpander.hpp>
+#include <osl/module.hxx>
+#include <com/sun/star/util/XCloseable.hpp>
+#include <com/sun/star/frame/XLoadable.hpp>
+#include <tools/rcid.h>
+#include <tools/shl.hxx>
+#include <comphelper/processfactory.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/oooimprovement/XCoreController.hpp>
+#include <comphelper/configurationhelper.hxx>
+#include <com/sun/star/awt/XDialogProvider.hpp>
+#include <com/sun/star/awt/XDialogProvider2.hpp>
+#include <com/sun/star/awt/XContainerWindowProvider.hpp>
+#include <com/sun/star/awt/XDialogEventHandler.hpp>
+#include <com/sun/star/awt/XContainerWindowEventHandler.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/XTopWindow.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XTabController.hpp>
+#include <vcl/help.hxx>
+#include <linguistic/misc.hxx>
+#include <svtools/helpopt.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <svl/languageoptions.hxx>
+#include <unotools/optionsdlg.hxx>
+#include <sfx2/module.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/waitobj.hxx>
+#include <svl/slstitm.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <unotools/viewoptions.hxx>
+#include <sfx2/printopt.hxx>
+#include <osl/module.h>
+#include <osl/process.h>
+#include <rtl/bootstrap.hxx>
+#include <unotools/misccfg.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/tplpitem.hxx>
+#include <svtools/apearcfg.hxx>
+#include <unotools/linguprops.hxx>
+#include <sfx2/app.hxx>
+#include <svx/xdef.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xpool.hxx>
+#include "cuitabarea.hxx"
+#include <svx/ofaitem.hxx>
+#include "opthtml.hxx"
+#include "optcolor.hxx"
+#include "optctl.hxx"
+#include "optjava.hxx"
+#include "optsave.hxx"
+#include "optpath.hxx"
+#include "cuioptgenrl.hxx"
+#include "optlingu.hxx"
+#include "optinet2.hxx"
+#include "optasian.hxx"
+#include "optaccessibility.hxx"
+#include "optjsearch.hxx"
+#include "connpooloptions.hxx"
+#include "optupdt.hxx"
+#include <optimprove.hxx>
+#include "optchart.hxx"
+#include "optgdlg.hxx"
+#include "optmemory.hxx"
+#include "optfltr.hxx"
+#include <cuires.hrc>
+#include "helpid.hrc"
+#include <dialmgr.hxx>
+#include "treeopt.hxx"
+#include "treeopt.hrc"
+#include "fontsubs.hxx"
+#include <svx/unolingu.hxx>
+#include <svx/xtable.hxx>
+#include "connpoolconfig.hxx"
+#include "dbregister.hxx"
+#include "dbregisterednamesconfig.hxx"
+#include "cfgchart.hxx"
+#include <svx/dialogs.hrc>
+
+#ifndef _SVX_LANGITEM_HXX
+#define ITEMID_LANGUAGE SID_ATTR_CHAR_LANGUAGE
+#include <svx/langitem.hxx>
+#endif
+
+
+#include <svx/optitems.hxx>
+
+#include <svx/drawitem.hxx>
+#include <rtl/uri.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::linguistic2;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+
+#ifdef C2U
+ #error "Who define C2U before! I use it to create const ascii strings ..."
+#else
+ #define C2U(cChar) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( cChar ) )
+#endif
+
+#define HINT_TIMEOUT 200
+#define SELECT_FIRST_TIMEOUT 0
+#define SELECT_TIMEOUT 300
+#define COLORPAGE_UNKNOWN ((sal_uInt16)0xFFFF)
+#define EXPAND_PROTOCOL "vnd.sun.star.expand:"
+
+LastPageSaver* OfaTreeOptionsDialog::pLastPageSaver = NULL;
+
+// some stuff for easier changes for SvtViewOptions
+static const sal_Char* pViewOptDataName = "page data";
+#define VIEWOPT_DATANAME rtl::OUString::createFromAscii( pViewOptDataName )
+
+static XOutdevItemPool* mpStaticXOutdevItemPool = 0L;
+
+static inline void SetViewOptUserItem( SvtViewOptions& rOpt, const String& rData )
+{
+ rOpt.SetUserItem( VIEWOPT_DATANAME, makeAny( rtl::OUString( rData ) ) );
+}
+
+static inline String GetViewOptUserItem( const SvtViewOptions& rOpt )
+{
+ Any aAny( rOpt.GetUserItem( VIEWOPT_DATANAME ) );
+ rtl::OUString aUserData;
+ aAny >>= aUserData;
+
+ return String( aUserData );
+}
+
+struct ModuleToGroupNameMap_Impl
+{
+ const char* m_pModule;
+ String m_sGroupName;
+ USHORT m_nNodeId;
+};
+
+static OfaPageResource* pPageRes = NULL;
+
+static ModuleToGroupNameMap_Impl ModuleMap[] =
+{
+ { "ProductName", String::EmptyString(), SID_GENERAL_OPTIONS },
+ { "LanguageSettings", String::EmptyString(), SID_LANGUAGE_OPTIONS },
+ { "Internet", String::EmptyString(), SID_INET_DLG },
+ { "LoadSave", String::EmptyString(), SID_FILTER_DLG },
+ { "Writer", String::EmptyString(), SID_SW_EDITOPTIONS },
+ { "WriterWeb", String::EmptyString(), SID_SW_ONLINEOPTIONS },
+ { "Math", String::EmptyString(), SID_SM_EDITOPTIONS },
+ { "Calc", String::EmptyString(), SID_SC_EDITOPTIONS },
+ { "Impress", String::EmptyString(), SID_SD_EDITOPTIONS },
+ { "Draw", String::EmptyString(), SID_SD_GRAPHIC_OPTIONS },
+ { "Charts", String::EmptyString(), SID_SCH_EDITOPTIONS },
+ { "Base", String::EmptyString(), SID_SB_STARBASEOPTIONS },
+
+ { NULL, String::EmptyString(), 0xFFFF }
+};
+
+static void setGroupName( const rtl::OUString& rModule, const String& rGroupName )
+{
+ USHORT nIndex = 0;
+ while ( ModuleMap[ nIndex ].m_pModule )
+ {
+ rtl::OUString sTemp =
+ rtl::OUString::createFromAscii( ModuleMap[ nIndex ].m_pModule );
+ if ( sTemp == rModule )
+ {
+ ModuleMap[ nIndex ].m_sGroupName = rGroupName;
+ break;
+ }
+ ++nIndex;
+ }
+}
+
+static String getGroupName( const rtl::OUString& rModule, bool bForced )
+{
+ String sGroupName;
+ USHORT nIndex = 0;
+ while ( ModuleMap[ nIndex ].m_pModule )
+ {
+ rtl::OUString sTemp =
+ rtl::OUString::createFromAscii( ModuleMap[ nIndex ].m_pModule );
+ if ( sTemp == rModule )
+ {
+ sGroupName = ModuleMap[ nIndex ].m_sGroupName;
+ break;
+ }
+ ++nIndex;
+ }
+
+ if ( sGroupName.Len() == 0 && bForced )
+ {
+ if ( !pPageRes )
+ pPageRes = new OfaPageResource;
+
+ if ( rModule == C2U("Writer") )
+ sGroupName = pPageRes->GetTextArray().GetString(0);
+ else if ( rModule == C2U("WriterWeb") )
+ sGroupName = pPageRes->GetHTMLArray().GetString(0);
+ else if ( rModule == C2U("Calc") )
+ sGroupName = pPageRes->GetCalcArray().GetString(0);
+ else if ( rModule == C2U("Impress") )
+ sGroupName = pPageRes->GetImpressArray().GetString(0);
+ else if ( rModule == C2U("Draw") )
+ sGroupName = pPageRes->GetDrawArray().GetString(0);
+ else if ( rModule == C2U("Math") )
+ sGroupName = pPageRes->GetStarMathArray().GetString(0);
+ else if ( rModule == C2U("Base") )
+ sGroupName = pPageRes->GetDatasourcesArray().GetString(0);
+ }
+ return sGroupName;
+}
+
+static void deleteGroupNames()
+{
+ USHORT nIndex = 0;
+ while ( ModuleMap[ nIndex ].m_pModule )
+ ModuleMap[ nIndex++ ].m_sGroupName = String::EmptyString();
+}
+
+static USHORT getGroupNodeId( const rtl::OUString& rModule )
+{
+ USHORT nNodeId = 0xFFFF, nIndex = 0;
+ while ( ModuleMap[ nIndex ].m_pModule )
+ {
+ rtl::OUString sTemp =
+ rtl::OUString::createFromAscii( ModuleMap[ nIndex ].m_pModule );
+ if ( sTemp == rModule )
+ {
+ nNodeId = ModuleMap[ nIndex ].m_nNodeId;
+ break;
+ }
+ ++nIndex;
+ }
+
+ return nNodeId;
+}
+
+/*-- 29.10.2004 13:57:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class MailMergeCfg_Impl : public utl::ConfigItem
+{
+ friend class SvxEMailTabPage;
+ // variables
+ sal_Bool bIsEmailSupported;
+
+public:
+ MailMergeCfg_Impl();
+ virtual ~MailMergeCfg_Impl();
+
+ virtual void Commit();
+ virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames);
+
+ sal_Bool IsEmailSupported() const {return bIsEmailSupported;}
+
+};
+/*-- 29.10.2004 13:57:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+MailMergeCfg_Impl::MailMergeCfg_Impl() :
+ utl::ConfigItem(C2U("Office.Writer/MailMergeWizard")),
+ bIsEmailSupported(sal_False)
+{
+ Sequence<rtl::OUString> aNames(1);
+ aNames.getArray()[0] = C2U("EMailSupported");
+ const Sequence< Any > aValues = GetProperties(aNames);
+ const Any* pValues = aValues.getConstArray();
+ if(aValues.getLength() && pValues[0].hasValue())
+ pValues[0] >>= bIsEmailSupported;
+}
+/*-- 29.10.2004 13:57:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+MailMergeCfg_Impl::~MailMergeCfg_Impl()
+{
+}
+/* -------------------------------------------------------------------------*/
+void MailMergeCfg_Impl::Commit()
+{
+}
+
+void MailMergeCfg_Impl::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& )
+{
+}
+
+//typedef SfxTabPage* (*FNCreateTabPage)( Window *pParent, const SfxItemSet &rAttrSet );
+SfxTabPage* CreateGeneralTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet )
+{
+ CreateTabPage fnCreate = 0;
+ switch(nId)
+ {
+ case RID_SFXPAGE_SAVE: fnCreate = &SvxSaveTabPage::Create; break;
+ case RID_SFXPAGE_PATH: fnCreate = &SvxPathTabPage::Create; break;
+ case RID_SFXPAGE_GENERAL: fnCreate = &SvxGeneralTabPage::Create; break;
+ case RID_SFXPAGE_PRINTOPTIONS: fnCreate = &SfxCommonPrintOptionsTabPage::Create; break;
+ case OFA_TP_LANGUAGES: fnCreate = &OfaLanguagesTabPage::Create; break;
+ case RID_SFXPAGE_LINGU: fnCreate = &SvxLinguTabPage::Create; break;
+ case RID_SVXPAGE_COLOR: fnCreate = &SvxColorTabPage::Create; break;
+ case OFA_TP_VIEW: fnCreate = &OfaViewTabPage::Create; break;
+ case OFA_TP_MISC: fnCreate = &OfaMiscTabPage::Create; break;
+ case OFA_TP_MEMORY: fnCreate = &OfaMemoryOptionsPage::Create; break;
+ case RID_SVXPAGE_ASIAN_LAYOUT: fnCreate = &SvxAsianLayoutPage::Create; break;
+ case RID_SVX_FONT_SUBSTITUTION: fnCreate = &SvxFontSubstTabPage::Create; break;
+ case RID_SVXPAGE_INET_PROXY: fnCreate = &SvxProxyTabPage::Create; break;
+ case RID_SVXPAGE_INET_SEARCH: fnCreate = &SvxSearchTabPage::Create; break;
+ case RID_SVXPAGE_INET_SECURITY: fnCreate = &SvxSecurityTabPage::Create; break;
+ case RID_SVXPAGE_INET_MAIL: fnCreate = &SvxEMailTabPage::Create; break;
+ case RID_SVXPAGE_COLORCONFIG: fnCreate = &SvxColorOptionsTabPage::Create; break;
+ case RID_OFAPAGE_HTMLOPT: fnCreate = &OfaHtmlTabPage::Create; break;
+ case SID_OPTFILTER_MSOFFICE: fnCreate = &OfaMSFilterTabPage::Create; break;
+ case RID_OFAPAGE_MSFILTEROPT2: fnCreate = &OfaMSFilterTabPage2::Create; break;
+ case RID_SVXPAGE_JSEARCH_OPTIONS: fnCreate = &SvxJSearchOptionsPage::Create ; break;
+ case SID_SB_CONNECTIONPOOLING: fnCreate = &::offapp::ConnectionPoolOptionsPage::Create; break;
+ case SID_SB_DBREGISTEROPTIONS: fnCreate = &::svx::DbRegistrationOptionsPage::Create; break;
+ case RID_SVXPAGE_ACCESSIBILITYCONFIG: fnCreate = &SvxAccessibilityOptionsTabPage::Create; break;
+ case RID_SVXPAGE_SSO: fnCreate = GetSSOCreator(); break;
+ case RID_SVXPAGE_OPTIONS_CTL: fnCreate = &SvxCTLOptionsPage::Create ; break;
+ //added by jmeng begin
+ case RID_SVXPAGE_INET_MOZPLUGIN: fnCreate = &MozPluginTabPage::Create; break;
+ //added by jmeng end
+ case RID_SVXPAGE_OPTIONS_JAVA: fnCreate = &SvxJavaOptionsPage::Create ; break;
+ case RID_SVXPAGE_ONLINEUPDATE: fnCreate = &SvxOnlineUpdateTabPage::Create; break;
+ case RID_OPTPAGE_CHART_DEFCOLORS: fnCreate = &SvxDefaultColorOptPage::Create; break;
+ case RID_SVXPAGE_IMPROVEMENT: fnCreate = &SvxImprovementOptionsPage::Create; break;
+ }
+
+ SfxTabPage* pRet = fnCreate ? (*fnCreate)( pParent, rSet ) : NULL;
+ return pRet;
+}
+
+
+struct OptionsMapping_Impl
+{
+ const char* m_pGroupName;
+ const char* m_pPageName;
+ USHORT m_nPageId;
+};
+
+static OptionsMapping_Impl __READONLY_DATA OptionsMap_Impl[] =
+{
+// GROUP PAGE PAGE-ID
+ { "ProductName", NULL, SID_GENERAL_OPTIONS },
+ { "ProductName", "UserData", RID_SFXPAGE_GENERAL },
+ { "ProductName", "General", OFA_TP_MISC },
+ { "ProductName", "Memory", OFA_TP_MEMORY },
+ { "ProductName", "View", OFA_TP_VIEW },
+ { "ProductName", "Print", RID_SFXPAGE_PRINTOPTIONS },
+ { "ProductName", "Paths", RID_SFXPAGE_PATH },
+ { "ProductName", "Colors", RID_SVXPAGE_COLOR },
+ { "ProductName", "Fonts", RID_SVX_FONT_SUBSTITUTION },
+ { "ProductName", "Security", RID_SVXPAGE_INET_SECURITY },
+ { "ProductName", "Appearance", RID_SVXPAGE_COLORCONFIG },
+ { "ProductName", "Accessibility", RID_SVXPAGE_ACCESSIBILITYCONFIG },
+ { "ProductName", "Java", RID_SVXPAGE_OPTIONS_JAVA },
+ { "ProductName", "NetworkIdentity", RID_SVXPAGE_SSO },
+ { "ProductName", "OnlineUpdate", RID_SVXPAGE_ONLINEUPDATE },
+ { "ProductName", "ImprovementProgram", RID_SVXPAGE_IMPROVEMENT },
+ { "LanguageSettings", NULL, SID_LANGUAGE_OPTIONS },
+ { "LanguageSettings", "Languages", OFA_TP_LANGUAGES },
+ { "LanguageSettings", "WritingAids", RID_SFXPAGE_LINGU },
+ { "LanguageSettings", "SearchingInJapanese", RID_SVXPAGE_JSEARCH_OPTIONS },
+ { "LanguageSettings", "AsianLayout", RID_SVXPAGE_ASIAN_LAYOUT },
+ { "LanguageSettings", "ComplexTextLayout", RID_SVXPAGE_OPTIONS_CTL },
+ { "Internet", NULL, SID_INET_DLG },
+ { "Internet", "Proxy", RID_SVXPAGE_INET_PROXY },
+ { "Internet", "Search", RID_SVXPAGE_INET_SEARCH },
+ { "Internet", "Email", RID_SVXPAGE_INET_MAIL },
+ { "Internet", "MozillaPlugin", RID_SVXPAGE_INET_MOZPLUGIN },
+ { "LoadSave", NULL, SID_FILTER_DLG },
+ { "LoadSave", "General", RID_SFXPAGE_SAVE },
+ { "LoadSave", "VBAProperties", SID_OPTFILTER_MSOFFICE },
+ { "LoadSave", "MicrosoftOffice", RID_OFAPAGE_MSFILTEROPT2 },
+ { "LoadSave", "HTMLCompatibility", RID_OFAPAGE_HTMLOPT },
+ { "Writer", NULL, SID_SW_EDITOPTIONS },
+ { "Writer", "General", RID_SW_TP_OPTLOAD_PAGE },
+ { "Writer", "View", RID_SW_TP_CONTENT_OPT },
+ { "Writer", "FormattingAids", RID_SW_TP_OPTSHDWCRSR },
+ { "Writer", "Grid", RID_SVXPAGE_GRID },
+ { "Writer", "BasicFontsWestern", RID_SW_TP_STD_FONT },
+ { "Writer", "BasicFontsAsian", RID_SW_TP_STD_FONT_CJK },
+ { "Writer", "BasicFontsCTL", RID_SW_TP_STD_FONT_CTL },
+ { "Writer", "Print", RID_SW_TP_OPTPRINT_PAGE },
+ { "Writer", "Table", RID_SW_TP_OPTTABLE_PAGE },
+ { "Writer", "Changes", RID_SW_TP_REDLINE_OPT },
+ { "Writer", "Compatibility", RID_SW_TP_OPTCOMPATIBILITY_PAGE },
+ { "Writer", "AutoCaption", RID_SW_TP_OPTCAPTION_PAGE },
+ { "Writer", "MailMerge", RID_SW_TP_MAILCONFIG },
+ { "WriterWeb", NULL, SID_SW_ONLINEOPTIONS },
+ { "WriterWeb", "View", RID_SW_TP_HTML_CONTENT_OPT },
+ { "WriterWeb", "FormattingAids", RID_SW_TP_HTML_OPTSHDWCRSR },
+ { "WriterWeb", "Grid", RID_SW_TP_HTML_OPTGRID_PAGE },
+ { "WriterWeb", "Print", RID_SW_TP_HTML_OPTPRINT_PAGE },
+ { "WriterWeb", "Table", RID_SW_TP_HTML_OPTTABLE_PAGE },
+ { "WriterWeb", "Background", RID_SW_TP_BACKGROUND },
+ { "Math", NULL, SID_SM_EDITOPTIONS },
+ { "Math", "Settings", SID_SM_TP_PRINTOPTIONS },
+ { "Calc", NULL, SID_SC_EDITOPTIONS },
+ { "Calc", "General", SID_SC_TP_LAYOUT },
+ { "Calc", "View", SID_SC_TP_CONTENT },
+ { "Calc", "International", RID_OFA_TP_INTERNATIONAL },
+ { "Calc", "Calculate", SID_SC_TP_CALC },
+ { "Calc", "SortLists", SID_SC_TP_USERLISTS },
+ { "Calc", "Changes", SID_SC_TP_CHANGES },
+ { "Calc", "Grid", SID_SC_TP_GRID },
+ { "Calc", "Print", RID_SC_TP_PRINT },
+ { "Impress", NULL, SID_SD_EDITOPTIONS },
+ { "Impress", "General", SID_SI_TP_MISC },
+ { "Impress", "View", SID_SI_TP_CONTENTS },
+ { "Impress", "Grid", SID_SI_TP_SNAP },
+ { "Impress", "Print", SID_SI_TP_PRINT },
+ { "Draw", NULL, SID_SD_GRAPHIC_OPTIONS },
+ { "Draw", "General", SID_SD_TP_MISC },
+ { "Draw", "View", SID_SD_TP_CONTENTS },
+ { "Draw", "Grid", SID_SD_TP_SNAP },
+ { "Draw", "Print", SID_SD_TP_PRINT },
+ { "Charts", NULL, SID_SCH_EDITOPTIONS },
+ { "Charts", "DefaultColors", RID_OPTPAGE_CHART_DEFCOLORS },
+ { "Base", NULL, SID_SB_STARBASEOPTIONS },
+ { "Base", "Connections", SID_SB_CONNECTIONPOOLING },
+ { "Base", "Databases", SID_SB_DBREGISTEROPTIONS },
+ { NULL, NULL, 0 }
+};
+
+static sal_Bool lcl_getStringFromID( USHORT _nPageId, String& _rGroupName, String& _rPageName )
+{
+ sal_Bool bRet = sal_False;
+
+ USHORT nIdx = 0;
+ while ( OptionsMap_Impl[nIdx].m_pGroupName != NULL )
+ {
+ if ( _nPageId == OptionsMap_Impl[nIdx].m_nPageId )
+ {
+ bRet = sal_True;
+ _rGroupName = String( OptionsMap_Impl[nIdx].m_pGroupName, RTL_TEXTENCODING_ASCII_US );
+ if ( OptionsMap_Impl[nIdx].m_pPageName != NULL )
+ _rPageName = String( OptionsMap_Impl[nIdx].m_pPageName, RTL_TEXTENCODING_ASCII_US );
+ break;
+ }
+ ++nIdx;
+ }
+
+ return bRet;
+}
+
+static sal_Bool lcl_isOptionHidden( USHORT _nPageId, const SvtOptionsDialogOptions& _rOptOptions )
+{
+ sal_Bool bIsHidden = sal_False;
+ String sGroupName, sPageName;
+ if ( lcl_getStringFromID( _nPageId, sGroupName, sPageName ) )
+ {
+ if ( sPageName.Len() == 0 )
+ bIsHidden = _rOptOptions.IsGroupHidden( sGroupName );
+ else
+ bIsHidden = _rOptOptions.IsPageHidden( sPageName, sGroupName );
+ }
+ return bIsHidden;
+}
+
+/* -----------------11.02.99 09:56-------------------
+ *
+ * --------------------------------------------------*/
+struct OptionsPageInfo
+{
+ SfxTabPage* m_pPage;
+ sal_uInt16 m_nPageId;
+ rtl::OUString m_sPageURL;
+ rtl::OUString m_sEventHdl;
+ ExtensionsTabPage* m_pExtPage;
+
+ OptionsPageInfo( sal_uInt16 nId ) : m_pPage( NULL ), m_nPageId( nId ), m_pExtPage( NULL ) {}
+};
+
+struct OptionsGroupInfo
+{
+ SfxItemSet* m_pInItemSet;
+ SfxItemSet* m_pOutItemSet;
+ SfxShell* m_pShell; // used to create the page
+ SfxModule* m_pModule; // used to create the ItemSet
+ sal_uInt16 m_nDialogId; // Id of the former dialog
+ sal_Bool m_bLoadError; // load fails?
+ rtl::OUString m_sPageURL;
+ ExtensionsTabPage* m_pExtPage;
+
+ OptionsGroupInfo( SfxShell* pSh, SfxModule* pMod, sal_uInt16 nId ) :
+ m_pInItemSet( NULL ), m_pOutItemSet( NULL ), m_pShell( pSh ),
+ m_pModule( pMod ), m_nDialogId( nId ), m_bLoadError( sal_False ),
+ m_sPageURL( rtl::OUString() ), m_pExtPage( NULL ) {}
+ ~OptionsGroupInfo() { delete m_pInItemSet; delete m_pOutItemSet; }
+};
+
+/* -----------------04.05.99 15:51-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool OfaOptionsTreeListBox::Collapse( SvLBoxEntry* pParent )
+{
+ bInCollapse = sal_True;
+ sal_Bool bRet = SvTreeListBox::Collapse(pParent);
+ bInCollapse = sal_False;
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+#define INI_LIST() \
+ aOkPB ( this, CUI_RES( PB_OK ) ),\
+ aCancelPB ( this, CUI_RES( PB_CANCEL ) ),\
+ aHelpPB ( this, CUI_RES( PB_HELP ) ),\
+ aBackPB ( this, CUI_RES( PB_BACK ) ),\
+ aHiddenGB ( this, CUI_RES( FB_BORDER ) ),\
+ aPageTitleFT ( this, CUI_RES( FT_PAGE_TITLE ) ),\
+ aLine1FL ( this, CUI_RES( FL_LINE_1 ) ),\
+ aHelpFT ( this, CUI_RES( FT_HELPTEXT ) ),\
+ aHelpImg ( this, CUI_RES( IMG_HELP ) ),\
+ aHelpTextsArr ( CUI_RES( STR_HELPTEXTS ) ),\
+ aTreeLB ( this, CUI_RES( TLB_PAGES ) ),\
+ sTitle ( GetText() ),\
+ sNotLoadedError ( CUI_RES( ST_LOAD_ERROR ) ),\
+ pCurrentPageEntry ( NULL ),\
+ pColorPageItemSet ( NULL ),\
+ pColorTab ( NULL ),\
+ nChangeType ( CT_NONE ),\
+ nUnknownType ( COLORPAGE_UNKNOWN ),\
+ nUnknownPos ( COLORPAGE_UNKNOWN ),\
+ bIsAreaTP ( sal_False ),\
+ bForgetSelection ( sal_False ),\
+ bImageResized ( sal_False ),\
+ bInSelectHdl_Impl ( false ),\
+ bIsFromExtensionManager( false ), \
+ bIsForSetDocumentLanguage( false )
+
+// Ctor() with Frame -----------------------------------------------------
+using namespace ::com::sun::star;
+OfaTreeOptionsDialog::OfaTreeOptionsDialog(
+ Window* pParent,
+ const Reference< XFrame >& _xFrame,
+ bool bActivateLastSelection ) :
+
+ SfxModalDialog( pParent, CUI_RES( RID_OFADLG_OPTIONS_TREE ) ),
+ INI_LIST()
+{
+ FreeResource();
+
+ InitTreeAndHandler();
+ Initialize( _xFrame );
+ LoadExtensionOptions( rtl::OUString() );
+ ResizeTreeLB();
+ if (bActivateLastSelection)
+ ActivateLastSelection();
+}
+
+// Ctor() with ExtensionId -----------------------------------------------
+
+OfaTreeOptionsDialog::OfaTreeOptionsDialog( Window* pParent, const rtl::OUString& rExtensionId ) :
+
+ SfxModalDialog( pParent, CUI_RES( RID_OFADLG_OPTIONS_TREE ) ),
+
+ INI_LIST()
+
+{
+ FreeResource();
+
+ bIsFromExtensionManager = ( rExtensionId.getLength() > 0 );
+ InitTreeAndHandler();
+ LoadExtensionOptions( rExtensionId );
+ ResizeTreeLB();
+ ActivateLastSelection();
+}
+
+/* -----------------11.02.99 07:58-------------------
+ *
+ * --------------------------------------------------*/
+
+OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
+{
+ SvLBoxEntry* pEntry = aTreeLB.First();
+ // first children
+ while(pEntry)
+ {
+ // if Child (has parent), then OptionsPageInfo
+ if(aTreeLB.GetParent(pEntry))
+ {
+ OptionsPageInfo *pPageInfo = (OptionsPageInfo *)pEntry->GetUserData();
+ if(pPageInfo->m_pPage)
+ {
+ pPageInfo->m_pPage->FillUserData();
+ String aPageData(pPageInfo->m_pPage->GetUserData());
+ if ( aPageData.Len() )
+ {
+ SvtViewOptions aTabPageOpt( E_TABPAGE, String::CreateFromInt32( pPageInfo->m_nPageId ) );
+ SetViewOptUserItem( aTabPageOpt, aPageData );
+ }
+ delete pPageInfo->m_pPage;
+ }
+
+ if (pPageInfo->m_nPageId == RID_SFXPAGE_LINGU)
+ {
+ // write personal dictionaries
+ Reference< XDictionaryList > xDicList( SvxGetDictionaryList() );
+ if (xDicList.is())
+ {
+ linguistic::SaveDictionaries( xDicList );
+ }
+ }
+
+ if( pPageInfo->m_pExtPage )
+ delete pPageInfo->m_pExtPage;
+
+ delete pPageInfo;
+ }
+ pEntry = aTreeLB.Next(pEntry);
+ }
+
+ // and parents
+ pEntry = aTreeLB.First();
+ while(pEntry)
+ {
+ if(!aTreeLB.GetParent(pEntry))
+ {
+ OptionsGroupInfo* pGroupInfo = (OptionsGroupInfo*)pEntry->GetUserData();
+ if ( pGroupInfo && pGroupInfo->m_pExtPage )
+ delete pGroupInfo->m_pExtPage;
+ delete pGroupInfo;
+ }
+ pEntry = aTreeLB.Next(pEntry);
+ }
+ delete pColorPageItemSet;
+ deleteGroupNames();
+}
+
+/* -----------------11.02.99 08:21-------------------
+ *
+ * --------------------------------------------------*/
+OptionsPageInfo* OfaTreeOptionsDialog::AddTabPage(
+ sal_uInt16 nId, const String& rPageName, sal_uInt16 nGroup )
+{
+ OptionsPageInfo* pPageInfo = new OptionsPageInfo( nId );
+ SvLBoxEntry* pParent = aTreeLB.GetEntry( 0, nGroup );
+ DBG_ASSERT( pParent, "OfaTreeOptionsDialog::AddTabPage(): no group found" );
+ SvLBoxEntry* pEntry = aTreeLB.InsertEntry( rPageName, pParent );
+ pEntry->SetUserData( pPageInfo );
+ return pPageInfo;
+}
+
+/* -----------------11.02.99 10:02-------------------
+ * der ItemSet* geht in den Besitz des Dialogs
+ * --------------------------------------------------*/
+sal_uInt16 OfaTreeOptionsDialog::AddGroup(const String& rGroupName,
+ SfxShell* pCreateShell,
+ SfxModule* pCreateModule,
+ sal_uInt16 nDialogId )
+{
+ SvLBoxEntry* pEntry = aTreeLB.InsertEntry(rGroupName);
+ OptionsGroupInfo* pInfo =
+ new OptionsGroupInfo( pCreateShell, pCreateModule, nDialogId );
+ pEntry->SetUserData(pInfo);
+ sal_uInt16 nRet = 0;
+ pEntry = aTreeLB.First();
+ while(pEntry)
+ {
+ if(!aTreeLB.GetParent(pEntry))
+ nRet++;
+ pEntry = aTreeLB.Next(pEntry);
+ }
+ return nRet - 1;
+}
+
+/* -----------------11.02.99 10:31-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK(OfaTreeOptionsDialog, ShowPageHdl_Impl, SvTreeListBox*, EMPTYARG)
+{
+ if ( aSelectTimer.GetTimeout() == SELECT_FIRST_TIMEOUT )
+ {
+ aSelectTimer.SetTimeout( SELECT_TIMEOUT );
+ SelectHdl_Impl( NULL );
+ }
+ else if ( aSelectTimer.GetTimeout() == SELECT_TIMEOUT )
+ aSelectTimer.Start();
+
+ return 0;
+}
+/* -----------------11.02.99 10:49-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( OfaTreeOptionsDialog, BackHdl_Impl, PushButton*, EMPTYARG )
+{
+ if ( pCurrentPageEntry && aTreeLB.GetParent( pCurrentPageEntry ) )
+ {
+ OptionsPageInfo* pPageInfo = (OptionsPageInfo*)pCurrentPageEntry->GetUserData();
+ if ( pPageInfo->m_pPage )
+ {
+ OptionsGroupInfo* pGroupInfo =
+ (OptionsGroupInfo*)aTreeLB.GetParent( pCurrentPageEntry )->GetUserData();
+ if ( RID_SVXPAGE_COLOR == pPageInfo->m_nPageId )
+ pPageInfo->m_pPage->Reset( *pColorPageItemSet );
+ else
+ pPageInfo->m_pPage->Reset( *pGroupInfo->m_pInItemSet );
+ }
+ else if ( pPageInfo->m_pExtPage )
+ pPageInfo->m_pExtPage->ResetPage();
+ }
+ return 0;
+}
+/* -----------------11.02.99 16:45-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( OfaTreeOptionsDialog, OKHdl_Impl, Button *, EMPTYARG )
+{
+ aTreeLB.EndSelection();
+ if ( pCurrentPageEntry && aTreeLB.GetParent( pCurrentPageEntry ) )
+ {
+ OptionsPageInfo* pPageInfo = (OptionsPageInfo *)pCurrentPageEntry->GetUserData();
+ if ( pPageInfo->m_pPage )
+ {
+ OptionsGroupInfo* pGroupInfo =
+ (OptionsGroupInfo *)aTreeLB.GetParent(pCurrentPageEntry)->GetUserData();
+ if ( RID_SVXPAGE_COLOR != pPageInfo->m_nPageId
+ && pPageInfo->m_pPage->HasExchangeSupport() )
+ {
+ int nLeave = pPageInfo->m_pPage->DeactivatePage(pGroupInfo->m_pOutItemSet);
+ if ( nLeave == SfxTabPage::KEEP_PAGE )
+ {
+ //die Seite darf nicht verlassen werden!
+ aTreeLB.Select(pCurrentPageEntry);
+ return 0;
+ }
+ }
+ pPageInfo->m_pPage->Hide();
+ }
+ }
+
+ SvLBoxEntry* pEntry = aTreeLB.First();
+ while ( pEntry )
+ {
+ if ( aTreeLB.GetParent( pEntry ) )
+ {
+ OptionsPageInfo* pPageInfo = (OptionsPageInfo *)pEntry->GetUserData();
+ if ( pPageInfo->m_pPage && !pPageInfo->m_pPage->HasExchangeSupport() )
+ {
+ OptionsGroupInfo* pGroupInfo =
+ (OptionsGroupInfo*)aTreeLB.GetParent(pEntry)->GetUserData();
+ pPageInfo->m_pPage->FillItemSet(*pGroupInfo->m_pOutItemSet);
+ }
+
+ if ( pPageInfo->m_pExtPage )
+ {
+ pPageInfo->m_pExtPage->DeactivatePage();
+ pPageInfo->m_pExtPage->SavePage();
+ }
+ }
+ pEntry = aTreeLB.Next(pEntry);
+ }
+ EndDialog(RET_OK);
+ return 0;
+}
+
+/* -----------------17.02.99 09:15-------------------
+ * Eine aufgeklappte Gruppe soll vollstaendig sichtbar sein
+ * --------------------------------------------------*/
+IMPL_LINK(OfaTreeOptionsDialog, ExpandedHdl_Impl, SvTreeListBox*, pBox )
+{
+ pBox->Update();
+ pBox->InitStartEntry();
+ SvLBoxEntry* pEntry = pBox->GetHdlEntry();
+ if(pEntry && pBox->IsExpanded(pEntry))
+ {
+ sal_uInt32 nChildCount = pBox->GetChildCount( pEntry );
+
+ SvLBoxEntry* pNext = pEntry;
+ for(sal_uInt32 i = 0; i < nChildCount;i++)
+ {
+ pNext = pBox->GetNextEntryInView(pNext);
+ if(!pNext)
+ {
+ pBox->ScrollOutputArea( -(short)(nChildCount - i + 1) );
+ break;
+ }
+ else
+ {
+ Size aSz(pBox->GetOutputSizePixel());
+ int nHeight = pBox->GetEntryHeight();
+ Point aPos(pBox->GetEntryPosition(pNext));
+ if(aPos.Y()+nHeight > aSz.Height())
+ {
+ pBox->ScrollOutputArea( -(short)(nChildCount - i + 1) );
+ break;
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+/* -----------------11.02.99 10:49-------------------
+ *
+ * --------------------------------------------------*/
+void OfaTreeOptionsDialog::ApplyItemSets()
+{
+ SvLBoxEntry* pEntry = aTreeLB.First();
+ while(pEntry)
+ {
+ if(!aTreeLB.GetParent(pEntry))
+ {
+ OptionsGroupInfo* pGroupInfo = (OptionsGroupInfo *)pEntry->GetUserData();
+ if(pGroupInfo->m_pOutItemSet)
+ {
+ if(pGroupInfo->m_pShell)
+ pGroupInfo->m_pShell->ApplyItemSet( pGroupInfo->m_nDialogId, *pGroupInfo->m_pOutItemSet);
+ else
+ ApplyItemSet( pGroupInfo->m_nDialogId, *pGroupInfo->m_pOutItemSet);
+ }
+ }
+ pEntry = aTreeLB.Next(pEntry);
+ }
+}
+
+void OfaTreeOptionsDialog::InitTreeAndHandler()
+{
+ aTreeLB.SetNodeDefaultImages();
+
+ String sResName = String::CreateFromAscii( "iso" );
+ ResMgr* pIsoRes = ResMgr::CreateResMgr( ::rtl::OUStringToOString( sResName, RTL_TEXTENCODING_UTF8 ) );
+ if ( !pIsoRes )
+ {
+ // Fallback: Use ooo resource file
+ String sOOoName = String::CreateFromAscii( "ooo" );
+ pIsoRes = ResMgr::CreateResMgr( ::rtl::OUStringToOString( sOOoName, RTL_TEXTENCODING_UTF8 ) );
+ }
+
+ //! ResMgr* pIsoRes = SFX_APP()->GetLabelResManager();
+ ResId aImgLstRes( RID_IMGLIST_TREEOPT, *pIsoRes );
+ aImgLstRes.SetRT( RSC_IMAGELIST );
+ if ( pIsoRes->IsAvailable( aImgLstRes ) )
+ aPageImages = ImageList( ResId( RID_IMGLIST_TREEOPT, *pIsoRes ) );
+ ResId aImgLstHCRes( RID_IMGLIST_TREEOPT_HC, *pIsoRes );
+ aImgLstHCRes.SetRT( RSC_IMAGELIST );
+ if ( pIsoRes->IsAvailable( aImgLstHCRes ) )
+ aPageImagesHC = ImageList( ResId( RID_IMGLIST_TREEOPT_HC, *pIsoRes ) );
+ delete pIsoRes;
+
+ aTreeLB.SetHelpId( HID_OFADLG_TREELISTBOX );
+ aTreeLB.SetWindowBits( WB_HASBUTTONS | WB_HASBUTTONSATROOT |
+ WB_HASLINES | WB_HASLINESATROOT |
+ WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE );
+ aTreeLB.SetSpaceBetweenEntries( 0 );
+ aTreeLB.SetSelectionMode( SINGLE_SELECTION );
+ aTreeLB.SetSublistOpenWithLeftRight( TRUE );
+ aTreeLB.SetExpandedHdl( LINK( this, OfaTreeOptionsDialog, ExpandedHdl_Impl ) );
+ aTreeLB.SetSelectHdl( LINK( this, OfaTreeOptionsDialog, ShowPageHdl_Impl ) );
+ aBackPB.SetClickHdl( LINK( this, OfaTreeOptionsDialog, BackHdl_Impl ) );
+ aOkPB.SetClickHdl( LINK( this, OfaTreeOptionsDialog, OKHdl_Impl ) );
+
+ aHiddenGB.Show();
+ aSelectTimer.SetTimeout( SELECT_FIRST_TIMEOUT );
+ aSelectTimer.SetTimeoutHdl( LINK( this, OfaTreeOptionsDialog, SelectHdl_Impl ) );
+}
+
+/* -----------------17.02.99 09:51-------------------
+ *
+ * --------------------------------------------------*/
+void OfaTreeOptionsDialog::ActivatePage( sal_uInt16 nResId )
+{
+ bIsForSetDocumentLanguage = false;
+ if ( nResId == OFA_TP_LANGUAGES_FOR_SET_DOCUMENT_LANGUAGE )
+ {
+ bIsForSetDocumentLanguage = true;
+ nResId = OFA_TP_LANGUAGES;
+ }
+
+ DBG_ASSERT( !bIsFromExtensionManager, "OfaTreeOptionsDialog::ActivatePage(): call from extension manager" );
+ if ( !pLastPageSaver )
+ pLastPageSaver = new LastPageSaver;
+ bForgetSelection = sal_True;
+ sal_uInt16 nTemp = pLastPageSaver->m_nLastPageId;
+ pLastPageSaver->m_nLastPageId = nResId;
+ ActivateLastSelection();
+ pLastPageSaver->m_nLastPageId = nTemp;
+}
+
+void OfaTreeOptionsDialog::ActivatePage( const String& rPageURL )
+{
+ DBG_ASSERT( !bIsFromExtensionManager, "OfaTreeOptionsDialog::ActivatePage(): call from extension manager" );
+ if ( !pLastPageSaver )
+ pLastPageSaver = new LastPageSaver;
+ bForgetSelection = sal_True;
+ pLastPageSaver->m_nLastPageId = 0;
+ pLastPageSaver->m_sLastPageURL_Tools = rPageURL;
+ ActivateLastSelection();
+}
+
+/* -----------------16.02.99 13:17-------------------
+ *
+ * --------------------------------------------------*/
+void OfaTreeOptionsDialog::ActivateLastSelection()
+{
+ SvLBoxEntry* pEntry = NULL;
+ if ( pLastPageSaver )
+ {
+ String sExpand( RTL_CONSTASCII_STRINGPARAM( EXPAND_PROTOCOL ) );
+ String sLastURL = bIsFromExtensionManager ? pLastPageSaver->m_sLastPageURL_ExtMgr
+ : pLastPageSaver->m_sLastPageURL_Tools;
+ if ( sLastURL.Len() == 0 )
+ {
+ sLastURL = !bIsFromExtensionManager ? pLastPageSaver->m_sLastPageURL_ExtMgr
+ : pLastPageSaver->m_sLastPageURL_Tools;
+ }
+
+ // MacroExpander to convert "expand"-URL to "file"-URL
+ Reference< XMacroExpander > m_xMacroExpander;
+ bool bMustExpand = ( INetURLObject( sLastURL ).GetProtocol() == INET_PROT_FILE );
+
+ if ( bMustExpand )
+ {
+ Reference< XComponentContext > xContext;
+ Reference< XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
+ xProps->getPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ) >>= xContext;
+ if ( xContext.is() )
+ m_xMacroExpander = Reference< com::sun::star::util::XMacroExpander >(
+ xContext->getValueByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "/singletons/com.sun.star.util.theMacroExpander" ) ) ), UNO_QUERY );
+ }
+
+ SvLBoxEntry* pTemp = aTreeLB.First();
+ while( !pEntry && pTemp )
+ {
+ // restore only selection of a leaf
+ if ( aTreeLB.GetParent( pTemp ) && pTemp->GetUserData() )
+ {
+ OptionsPageInfo* pPageInfo = (OptionsPageInfo*)pTemp->GetUserData();
+ String sPageURL = pPageInfo->m_sPageURL;
+ if ( bMustExpand
+ && sPageURL.Len() > 0
+ && sExpand.Match( sPageURL ) == STRING_MATCH )
+ {
+ // cut protocol
+ ::rtl::OUString sTemp( sPageURL.Copy( sizeof( EXPAND_PROTOCOL ) -1 ) );
+ // decode uri class chars
+ sTemp = ::rtl::Uri::decode(
+ sTemp, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
+ // expand string
+ sPageURL = m_xMacroExpander->expandMacros( sTemp );
+ }
+
+ if ( ( !bIsFromExtensionManager
+ && pPageInfo->m_nPageId && pPageInfo->m_nPageId == pLastPageSaver->m_nLastPageId )
+ || ( !pPageInfo->m_nPageId && sLastURL == sPageURL ) )
+ pEntry = pTemp;
+ }
+ pTemp = aTreeLB.Next(pTemp);
+ }
+ }
+
+ if ( !pEntry )
+ {
+ pEntry = aTreeLB.First();
+ pEntry = aTreeLB.Next(pEntry);
+ }
+
+ SvLBoxEntry* pParent = aTreeLB.GetParent(pEntry);
+ aTreeLB.Expand(pParent);
+ aTreeLB.MakeVisible(pParent);
+ aTreeLB.MakeVisible(pEntry);
+ aTreeLB.Select(pEntry);
+ aTreeLB.GrabFocus();
+}
+
+/* -----------------22.02.99 08:52-------------------
+ *
+ * --------------------------------------------------*/
+long OfaTreeOptionsDialog::Notify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ const KeyCode aKeyCode = pKEvt->GetKeyCode();
+
+ if( aKeyCode.GetCode() == KEY_PAGEUP ||
+ aKeyCode.GetCode() == KEY_PAGEDOWN)
+ {
+ SvLBoxEntry* pCurEntry = aTreeLB.FirstSelected();
+ SvLBoxEntry* pTemp = 0;
+ if(aKeyCode.GetCode() == KEY_PAGEDOWN)
+ {
+ pTemp = aTreeLB.Next( pCurEntry ) ;
+ if(pTemp && !aTreeLB.GetParent(pTemp))
+ {
+ pTemp = aTreeLB.Next( pTemp ) ;
+ aTreeLB.Select(pTemp);
+ }
+ }
+ else
+ {
+ pTemp = aTreeLB.Prev( pCurEntry ) ;
+ if(pTemp && !aTreeLB.GetParent(pTemp))
+ {
+ pTemp = aTreeLB.Prev( pTemp ) ;
+ }
+ }
+ if(pTemp)
+ {
+ if(!aTreeLB.IsExpanded(aTreeLB.GetParent(pTemp)))
+ aTreeLB.Expand(aTreeLB.GetParent(pTemp));
+ aTreeLB.MakeVisible(pTemp);
+ aTreeLB.Select(pTemp);
+ }
+ }
+ }
+ return SfxModalDialog::Notify(rNEvt);
+}
+
+// --------------------------------------------------------------------
+
+void OfaTreeOptionsDialog::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxModalDialog::DataChanged( rDCEvt );
+
+ SvLBoxEntry* pEntry = aTreeLB.GetCurEntry();
+ if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) &&
+ !aTreeLB.GetParent(pEntry))
+ {
+ OptionsGroupInfo* pInfo = static_cast<OptionsGroupInfo*>(pEntry->GetUserData());
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+ ImageList* pImgLst = bHighContrast ? &aPageImagesHC : &aPageImages;
+ for ( sal_uInt16 i = 0; i < aHelpTextsArr.Count(); ++i )
+ {
+ if ( aHelpTextsArr.GetValue(i) == pInfo->m_nDialogId )
+ {
+ aHelpImg.SetImage( pImgLst->GetImage( pInfo->m_nDialogId ) );
+ break;
+ }
+ }
+ }
+}
+class FlagSet_Impl
+{
+ bool & rFlag;
+ public:
+ FlagSet_Impl(bool& bFlag) : rFlag(bFlag){rFlag = true;}
+ ~FlagSet_Impl(){rFlag = false;}
+};
+
+IMPL_LINK( OfaTreeOptionsDialog, SelectHdl_Impl, Timer*, EMPTYARG )
+{
+ SvTreeListBox* pBox = &aTreeLB;
+ SvLBoxEntry* pEntry = pBox->GetCurEntry();
+ SvLBoxEntry* pParent = pBox->GetParent(pEntry);
+ pBox->EndSelection();
+
+ DBG_ASSERT(!bInSelectHdl_Impl, "Timeout handler called twice");
+ if(bInSelectHdl_Impl || pCurrentPageEntry == pEntry)
+ return 0;
+ //#111938# lock the SelectHdl_Impl to prevent multiple executes
+ FlagSet_Impl aFlag(bInSelectHdl_Impl);
+ TabPage* pOldPage = NULL;
+ TabPage* pNewPage = NULL;
+ OptionsPageInfo* pOptPageInfo = ( pCurrentPageEntry && aTreeLB.GetParent( pCurrentPageEntry ) )
+ ? (OptionsPageInfo*)pCurrentPageEntry->GetUserData() : NULL;
+
+ if ( pOptPageInfo && pOptPageInfo->m_pPage && pOptPageInfo->m_pPage->IsVisible() )
+ {
+ pOldPage = pOptPageInfo->m_pPage;
+ OptionsGroupInfo* pGroupInfo = (OptionsGroupInfo*)aTreeLB.GetParent(pCurrentPageEntry)->GetUserData();
+ int nLeave = SfxTabPage::LEAVE_PAGE;
+ if ( RID_SVXPAGE_COLOR != pOptPageInfo->m_nPageId && pOptPageInfo->m_pPage->HasExchangeSupport() )
+ nLeave = pOptPageInfo->m_pPage->DeactivatePage( pGroupInfo->m_pOutItemSet );
+
+ if ( nLeave == SfxTabPage::KEEP_PAGE )
+ {
+ // we cannot leave this page
+ pBox->Select( pCurrentPageEntry );
+ return 0;
+ }
+ else
+ pOptPageInfo->m_pPage->Hide();
+ }
+ else if ( pOptPageInfo && pOptPageInfo->m_pExtPage )
+ {
+ pOptPageInfo->m_pExtPage->Hide();
+ pOptPageInfo->m_pExtPage->DeactivatePage();
+ }
+ else if ( pCurrentPageEntry && !aTreeLB.GetParent( pCurrentPageEntry ) )
+ {
+ OptionsGroupInfo* pGroupInfo = (OptionsGroupInfo*)pCurrentPageEntry->GetUserData();
+ if ( pGroupInfo && pGroupInfo->m_pExtPage )
+ {
+ pGroupInfo->m_pExtPage->Hide();
+ pGroupInfo->m_pExtPage->DeactivatePage();
+ }
+ }
+ if ( pParent )
+ {
+ aPageTitleFT.Hide();
+ aLine1FL.Hide();
+ aHelpFT.Hide();
+ aHelpImg.Hide();
+ OptionsPageInfo *pPageInfo = (OptionsPageInfo *)pEntry->GetUserData();
+ OptionsGroupInfo* pGroupInfo = (OptionsGroupInfo *)pParent->GetUserData();
+ if(!pPageInfo->m_pPage && pPageInfo->m_nPageId > 0)
+ {
+ if(pGroupInfo->m_bLoadError)
+ return 0;
+ if ( RID_SVXPAGE_COLOR == pPageInfo->m_nPageId )
+ {
+ if(!pColorPageItemSet)
+ {
+ // Move usage of a static XOutdevItemPool instance here
+ if(!mpStaticXOutdevItemPool)
+ {
+ mpStaticXOutdevItemPool = new XOutdevItemPool();
+ }
+ pColorPageItemSet = new SfxItemSet( *mpStaticXOutdevItemPool, XATTR_FILLSTYLE, XATTR_FILLCOLOR);
+ pColorPageItemSet->Put( XFillColorItem() );
+ }
+ }
+ else
+ {
+ if(pGroupInfo->m_pModule /*&& !pGroupInfo->pModule->IsLoaded()*/)
+ {
+ SfxModule* pOldModule = pGroupInfo->m_pModule;
+ sal_Bool bIdentical = pGroupInfo->m_pModule == pGroupInfo->m_pShell;
+
+ WaitObject aWait(this);
+ //pGroupInfo->pModule = pGroupInfo->pModule->Load();
+ if(!pGroupInfo->m_pModule)
+ {
+ pGroupInfo->m_bLoadError = sal_True;
+ InfoBox(pBox, sNotLoadedError).Execute();
+ return 0;
+ }
+ if(bIdentical)
+ pGroupInfo->m_pShell = pGroupInfo->m_pModule;
+ //jetzt noch testen, ob es auch in anderen Gruppen das gleiche Module gab (z.B. Text+HTML)
+ SvLBoxEntry* pTemp = aTreeLB.First();
+ while(pTemp)
+ {
+ if(!aTreeLB.GetParent(pTemp) && pTemp != pEntry)
+ {
+ OptionsGroupInfo* pTGInfo = (OptionsGroupInfo *)pTemp->GetUserData();
+ if(pTGInfo->m_pModule == pOldModule)
+ {
+ pTGInfo->m_pModule = pGroupInfo->m_pModule;
+ if(bIdentical)
+ pTGInfo->m_pShell = pGroupInfo->m_pModule;
+ }
+ }
+ pTemp = aTreeLB.Next(pTemp);
+ }
+ }
+
+// if ( pPageInfo->nPageId != RID_OPTPAGE_CHART_DEFCOLORS )
+ {
+ if(!pGroupInfo->m_pInItemSet)
+ pGroupInfo->m_pInItemSet = pGroupInfo->m_pShell
+ ? pGroupInfo->m_pShell->CreateItemSet( pGroupInfo->m_nDialogId )
+ : CreateItemSet( pGroupInfo->m_nDialogId );
+ if(!pGroupInfo->m_pOutItemSet)
+ pGroupInfo->m_pOutItemSet = new SfxItemSet(
+ *pGroupInfo->m_pInItemSet->GetPool(),
+ pGroupInfo->m_pInItemSet->GetRanges());
+ }
+ }
+
+ if(pGroupInfo->m_pModule)
+ {
+ pPageInfo->m_pPage = pGroupInfo->m_pModule->CreateTabPage(
+ pPageInfo->m_nPageId, this, *pGroupInfo->m_pInItemSet );
+ }
+ else if(RID_SVXPAGE_COLOR != pPageInfo->m_nPageId)
+ pPageInfo->m_pPage = ::CreateGeneralTabPage( pPageInfo->m_nPageId, this, *pGroupInfo->m_pInItemSet );
+ else
+ {
+ pPageInfo->m_pPage = ::CreateGeneralTabPage(
+ pPageInfo->m_nPageId, this, *pColorPageItemSet );
+ SvxColorTabPage& rColPage = *(SvxColorTabPage*)pPageInfo->m_pPage;
+ const OfaPtrItem* pPtr = NULL;
+ if ( SfxViewFrame::Current() && SfxViewFrame::Current()->GetDispatcher() )
+ pPtr = (const OfaPtrItem*)SfxViewFrame::Current()->
+ GetDispatcher()->Execute( SID_GET_COLORTABLE, SFX_CALLMODE_SYNCHRON );
+ pColorTab = pPtr ? (XColorTable*)pPtr->GetValue() : XColorTable::GetStdColorTable();
+
+ rColPage.SetColorTable( pColorTab );
+ rColPage.SetPageType( &nUnknownType );
+ rColPage.SetDlgType( &nUnknownType );
+ rColPage.SetPos( &nUnknownPos );
+ rColPage.SetAreaTP( &bIsAreaTP );
+ rColPage.SetColorChgd( (ChangeType*)&nChangeType );
+ rColPage.Construct();
+ }
+
+ DBG_ASSERT( pPageInfo->m_pPage, "tabpage could not created");
+ if ( pPageInfo->m_pPage )
+ {
+ SvtViewOptions aTabPageOpt( E_TABPAGE, String::CreateFromInt32( pPageInfo->m_nPageId ) );
+ pPageInfo->m_pPage->SetUserData( GetViewOptUserItem( aTabPageOpt ) );
+
+ Point aTreePos(aTreeLB.GetPosPixel());
+ Size aTreeSize(aTreeLB.GetSizePixel());
+ Point aGBPos(aHiddenGB.GetPosPixel());
+ Size aPageSize(pPageInfo->m_pPage->GetSizePixel());
+ Size aGBSize(aHiddenGB.GetSizePixel());
+ Point aPagePos( aGBPos.X() + ( aGBSize.Width() - aPageSize.Width() ) / 2,
+ aGBPos.Y() + ( aGBSize.Height() - aPageSize.Height() ) / 2 );
+ pPageInfo->m_pPage->SetPosPixel( aPagePos );
+ if ( RID_SVXPAGE_COLOR == pPageInfo->m_nPageId )
+ {
+ pPageInfo->m_pPage->Reset( *pColorPageItemSet );
+ pPageInfo->m_pPage->ActivatePage( *pColorPageItemSet );
+ }
+ else
+ {
+ pPageInfo->m_pPage->Reset( *pGroupInfo->m_pInItemSet );
+ }
+ }
+ }
+ else if ( 0 == pPageInfo->m_nPageId && !pPageInfo->m_pExtPage )
+ {
+ if ( !m_xContainerWinProvider.is() )
+ {
+ Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ m_xContainerWinProvider = Reference < awt::XContainerWindowProvider >(
+ xFactory->createInstance(
+ C2U("com.sun.star.awt.ContainerWindowProvider") ), UNO_QUERY );
+ DBG_ASSERT( m_xContainerWinProvider.is(), "service com.sun.star.awt.ContainerWindowProvider could not be loaded" );
+ }
+
+ pPageInfo->m_pExtPage = new ExtensionsTabPage(
+ this, 0, pPageInfo->m_sPageURL, pPageInfo->m_sEventHdl, m_xContainerWinProvider );
+ Size aSize = aHiddenGB.GetSizePixel();
+ aSize.Width() = aSize.Width() - 4;
+ aSize.Height() = aSize.Height() - 4;
+ Point aPos = aHiddenGB.GetPosPixel();
+ aPos.X() = aPos.X() + 2;
+ aPos.Y() = aPos.Y() + 2;
+ pPageInfo->m_pExtPage->SetPosSizePixel( aPos, aSize );
+ }
+
+ if ( pPageInfo->m_pPage )
+ {
+ if ( RID_SVXPAGE_COLOR != pPageInfo->m_nPageId &&
+ pPageInfo->m_pPage->HasExchangeSupport())
+ {
+ pPageInfo->m_pPage->ActivatePage(*pGroupInfo->m_pOutItemSet);
+ }
+ pPageInfo->m_pPage->Show();
+ }
+ else if ( pPageInfo->m_pExtPage )
+ {
+ pPageInfo->m_pExtPage->Show();
+ pPageInfo->m_pExtPage->ActivatePage();
+ }
+
+ String sTmpTitle = sTitle;
+ sTmpTitle += String::CreateFromAscii(" - ");
+ sTmpTitle += aTreeLB.GetEntryText(pParent);
+ sTmpTitle += String::CreateFromAscii(" - ");
+ sTmpTitle += aTreeLB.GetEntryText(pEntry);
+ SetText(sTmpTitle);
+ pCurrentPageEntry = pEntry;
+ if ( !bForgetSelection )
+ {
+ if ( !pLastPageSaver )
+ pLastPageSaver = new LastPageSaver;
+ if ( !bIsFromExtensionManager )
+ pLastPageSaver->m_nLastPageId = pPageInfo->m_nPageId;
+ if ( pPageInfo->m_pExtPage )
+ {
+ if ( bIsFromExtensionManager )
+ pLastPageSaver->m_sLastPageURL_ExtMgr = pPageInfo->m_sPageURL;
+ else
+ pLastPageSaver->m_sLastPageURL_Tools = pPageInfo->m_sPageURL;
+ }
+ }
+ pNewPage = pPageInfo->m_pPage;
+ }
+ else
+ {
+ OptionsGroupInfo* pTGInfo = (OptionsGroupInfo *)pEntry->GetUserData();
+ if ( pTGInfo->m_sPageURL.getLength() == 0 )
+ {
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+ ImageList* pImgLst = bHighContrast ? &aPageImagesHC : &aPageImages;
+ //hier den Hilfetext anzeigen
+ for ( sal_uInt16 i = 0; i < aHelpTextsArr.Count(); ++i )
+ {
+ if ( aHelpTextsArr.GetValue(i) == pTGInfo->m_nDialogId )
+ {
+ aHelpFT.SetText(aHelpTextsArr.GetString(i));
+ aHelpImg.SetImage(pImgLst->GetImage(pTGInfo->m_nDialogId));
+ break;
+ }
+ }
+
+ aPageTitleFT.Show();
+ aLine1FL.Show();
+ aHelpFT.Show();
+ aHelpImg.Show();
+
+ //auf die Groesse der Bitmap anpassen
+ if(!bImageResized)
+ {
+ const long nCtrlDist = 2;
+ bImageResized = sal_True;
+ Point aImgPos(aHelpImg.GetPosPixel());
+ Size aImgSize(aHelpImg.GetSizePixel());
+ Point aTitlePos(aPageTitleFT.GetPosPixel());
+ Point aLinePos(aLine1FL.GetPosPixel());
+ Point aHelpPos(aHelpFT.GetPosPixel());
+ Size aHelpSize(aHelpFT.GetSizePixel());
+ long nXDiff = 0;
+ long nYDiff = 0;
+ if(aTitlePos.X() <= (aImgPos.X() + aImgSize.Width() + nCtrlDist))
+ {
+ nXDiff = aImgPos.X() + aImgSize.Width() + nCtrlDist - aTitlePos.X();
+ }
+ if(aLinePos.Y() <= (aImgPos.Y() + aImgSize.Height() + nCtrlDist))
+ {
+ nYDiff = aImgPos.Y() + aImgSize.Height() + nCtrlDist - aLinePos.Y();
+ }
+ aLinePos.Y() += nYDiff;
+ aLine1FL.SetPosPixel(aLinePos);
+
+ aTitlePos.X() += nXDiff;
+ aPageTitleFT.SetPosPixel(aTitlePos);
+
+ aHelpPos.X() += nXDiff;
+ aHelpPos.Y() += nYDiff;
+ aHelpSize.Width() -= nXDiff;
+ aHelpSize.Height() -= nYDiff;
+ aHelpFT.SetPosSizePixel(aHelpPos, aHelpSize);
+
+ Font aFont = aHelpFT.GetFont();
+ Size aSz = aFont.GetSize();
+ aSz.Height() = (aSz.Height() * 14 ) / 10;
+ aFont.SetSize(aSz);
+ aPageTitleFT.SetFont(aFont);
+ }
+
+ String sTmpTitle = sTitle;
+ sTmpTitle += String::CreateFromAscii(" - ");
+ aPageTitleFT.SetText(aTreeLB.GetEntryText(pEntry));
+ sTmpTitle += aPageTitleFT.GetText();
+ SetText(sTmpTitle);
+ pCurrentPageEntry = NULL;
+ }
+ else
+ {
+ if ( !pTGInfo->m_pExtPage )
+ {
+ if ( !m_xContainerWinProvider.is() )
+ {
+ Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ m_xContainerWinProvider = Reference < awt::XContainerWindowProvider >(
+ xFactory->createInstance(
+ C2U("com.sun.star.awt.ContainerWindowProvider") ), UNO_QUERY );
+ DBG_ASSERT( m_xContainerWinProvider.is(), "service com.sun.star.awt.ContainerWindowProvider could not be loaded" );
+ }
+
+ pTGInfo->m_pExtPage =
+ new ExtensionsTabPage( this, 0, pTGInfo->m_sPageURL, rtl::OUString(), m_xContainerWinProvider );
+ Size aSize = aHiddenGB.GetSizePixel();
+ aSize.Width() = aSize.Width() - 4;
+ aSize.Height() = aSize.Height() - 4;
+ Point aPos = aHiddenGB.GetPosPixel();
+ aPos.X() = aPos.X() + 2;
+ aPos.Y() = aPos.Y() + 2;
+ pTGInfo->m_pExtPage->SetPosSizePixel( aPos, aSize );
+ }
+
+ if ( pTGInfo->m_pExtPage )
+ {
+ pTGInfo->m_pExtPage->Show();
+ pTGInfo->m_pExtPage->ActivatePage();
+ }
+
+ pCurrentPageEntry = pEntry;
+ }
+ }
+
+ // restore lost focus, if necessary
+ Window* pFocusWin = Application::GetFocusWindow();
+ // if the focused window is not the options treebox and the old page has the focus
+ if ( pFocusWin && pFocusWin != pBox && pOldPage && pOldPage->HasChildPathFocus() )
+ // then set the focus to the new page or if we are on a group set the focus to the options treebox
+ pNewPage ? pNewPage->GrabFocus() : pBox->GrabFocus();
+
+ return 0;
+}
+
+/* -----------------11.02.99 15:51-------------------
+ *
+ * --------------------------------------------------*/
+
+OfaPageResource::OfaPageResource() :
+ Resource(CUI_RES(RID_OFADLG_OPTIONS_TREE_PAGES)),
+ aGeneralDlgAry(CUI_RES(SID_GENERAL_OPTIONS)),
+ aInetDlgAry(CUI_RES(SID_INET_DLG)),
+ aLangDlgAry(CUI_RES(SID_LANGUAGE_OPTIONS)),
+ aTextDlgAry(CUI_RES(SID_SW_EDITOPTIONS)),
+ aHTMLDlgAry(CUI_RES(SID_SW_ONLINEOPTIONS)),
+ aCalcDlgAry(CUI_RES(SID_SC_EDITOPTIONS)),
+ aStarMathDlgAry(CUI_RES(SID_SM_EDITOPTIONS)),
+ aImpressDlgAry(CUI_RES(SID_SD_EDITOPTIONS)),
+ aDrawDlgAry(CUI_RES(SID_SD_GRAPHIC_OPTIONS)),
+ aChartDlgAry(CUI_RES(SID_SCH_EDITOPTIONS)),
+ aFilterDlgAry(CUI_RES(SID_FILTER_DLG)),
+ aDatasourcesDlgAry(CUI_RES(SID_SB_STARBASEOPTIONS))
+{
+ FreeResource();
+}
+
+BOOL EnableSSO( void )
+{
+ // SSO must be enabled if the configuration manager bootstrap settings
+ // are configured as follows ...
+ // CFG_Offline=false
+ // CFG_ServerType=uno ( or unspecified )
+ // CFG_BackendService=
+ // com.sun.star.comp.configuration.backend.LdapSingleBackend
+
+ rtl::OUString theIniFile;
+ osl_getExecutableFile( &theIniFile.pData );
+ theIniFile = theIniFile.copy( 0, theIniFile.lastIndexOf( '/' ) + 1 ) +
+ rtl::OUString::createFromAscii( SAL_CONFIGFILE( "configmgr" ) );
+ ::rtl::Bootstrap theBootstrap( theIniFile );
+
+ rtl::OUString theOfflineValue;
+ rtl::OUString theDefaultOfflineValue = rtl::OUString::createFromAscii( "false" );
+ theBootstrap.getFrom( rtl::OUString::createFromAscii( "CFG_Offline" ),
+ theOfflineValue,
+ theDefaultOfflineValue );
+
+ rtl::OUString theServerTypeValue;
+ theBootstrap.getFrom( rtl::OUString::createFromAscii( "CFG_ServerType" ),
+ theServerTypeValue );
+
+ rtl::OUString theBackendServiceTypeValue;
+ theBootstrap.getFrom( rtl::OUString::createFromAscii( "CFG_BackendService" ),
+ theBackendServiceTypeValue );
+
+ BOOL bSSOEnabled =
+ ( theOfflineValue == theDefaultOfflineValue &&
+ ( theServerTypeValue.getLength() == 0 ||
+ theServerTypeValue == rtl::OUString::createFromAscii( "uno" ) ) &&
+ theBackendServiceTypeValue ==
+ rtl::OUString::createFromAscii(
+ "com.sun.star.comp.configuration.backend.LdapSingleBackend" ) );
+ if ( bSSOEnabled && GetSSOCreator() == 0 )
+ {
+ bSSOEnabled = FALSE;
+ }
+ return bSSOEnabled;
+}
+
+extern "C" { static void SAL_CALL thisModule() {} }
+
+CreateTabPage GetSSOCreator( void )
+{
+ static CreateTabPage theSymbol = 0;
+ if ( theSymbol == 0 )
+ {
+ osl::Module aModule;
+ rtl::OUString theModuleName( RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "ssoopt" ) ) );
+ if( aModule.loadRelative(
+ &thisModule, theModuleName, SAL_LOADMODULE_DEFAULT ) )
+ {
+ rtl::OUString theSymbolName( rtl::OUString::createFromAscii( "CreateSSOTabPage" ) );
+ theSymbol = reinterpret_cast<CreateTabPage>(aModule.getFunctionSymbol( theSymbolName ));
+ }
+ }
+
+ return theSymbol;
+}
+
+SfxItemSet* OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId )
+{
+ Reference< XPropertySet > xProp( SvxGetLinguPropertySet() );
+ SfxItemSet* pRet = 0;
+ switch(nId)
+ {
+ case SID_GENERAL_OPTIONS:
+ {
+ pRet = new SfxItemSet(
+ SFX_APP()->GetPool(),
+ SID_ATTR_METRIC, SID_ATTR_SPELL,
+ SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK,
+ SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER,
+ SID_ATTR_YEAR2000, SID_ATTR_YEAR2000,
+ SID_HTML_MODE, SID_HTML_MODE,
+ 0 );
+
+ SfxItemSet aOptSet( SFX_APP()->GetPool(), SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER );
+ SFX_APP()->GetOptions(aOptSet);
+ pRet->Put(aOptSet);
+
+ utl::MiscCfg aMisc;
+ const SfxPoolItem* pItem;
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ if ( pViewFrame )
+ {
+ SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
+
+ // Sonstiges - Year2000
+ if( SFX_ITEM_AVAILABLE <= pDispatch->QueryState( SID_ATTR_YEAR2000, pItem ) )
+ pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, ((const SfxUInt16Item*)pItem)->GetValue() ) );
+ else
+ pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, (USHORT)aMisc.GetYear2000() ) );
+ }
+ else
+ pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, (USHORT)aMisc.GetYear2000() ) );
+
+
+ // Sonstiges - Tabulator
+ pRet->Put(SfxBoolItem(SID_PRINTER_NOTFOUND_WARN, aMisc.IsNotFoundWarning()));
+
+ sal_uInt16 nFlag = aMisc.IsPaperSizeWarning() ? SFX_PRINTER_CHG_SIZE : 0;
+ nFlag |= aMisc.IsPaperOrientationWarning() ? SFX_PRINTER_CHG_ORIENTATION : 0;
+ pRet->Put( SfxFlagItem( SID_PRINTER_CHANGESTODOC, nFlag ));
+
+ }
+ break;
+ case SID_LANGUAGE_OPTIONS :
+ {
+ pRet = new SfxItemSet(SFX_APP()->GetPool(),
+ SID_ATTR_LANGUAGE, SID_AUTOSPELL_CHECK,
+ SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE,
+ SID_OPT_LOCALE_CHANGED, SID_OPT_LOCALE_CHANGED,
+ SID_SET_DOCUMENT_LANGUAGE, SID_SET_DOCUMENT_LANGUAGE,
+ 0 );
+
+ // fuer die Linguistik
+
+ Reference< XSpellChecker1 > xSpell = SvxGetSpellChecker();
+ pRet->Put(SfxSpellCheckItem( xSpell, SID_ATTR_SPELL ));
+ SfxHyphenRegionItem aHyphen( SID_ATTR_HYPHENREGION );
+
+ sal_Int16 nMinLead = 2,
+ nMinTrail = 2;
+ if (xProp.is())
+ {
+ xProp->getPropertyValue( String::CreateFromAscii(
+ UPN_HYPH_MIN_LEADING) ) >>= nMinLead;
+ xProp->getPropertyValue( String::CreateFromAscii(
+ UPN_HYPH_MIN_TRAILING) ) >>= nMinTrail;
+ }
+ aHyphen.GetMinLead() = (sal_uInt8)nMinLead;
+ aHyphen.GetMinTrail() = (sal_uInt8)nMinTrail;
+
+ const SfxPoolItem* pItem;
+ SfxPoolItem* pClone;
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ if ( pViewFrame )
+ {
+ SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
+ if(SFX_ITEM_AVAILABLE <= pDispatch->QueryState(SID_ATTR_LANGUAGE, pItem))
+ pRet->Put(SfxUInt16Item(SID_ATTR_LANGUAGE, ((const SvxLanguageItem*)pItem)->GetLanguage()));
+ if(SFX_ITEM_AVAILABLE <= pDispatch->QueryState(SID_ATTR_CHAR_CJK_LANGUAGE, pItem))
+ pRet->Put(SfxUInt16Item(SID_ATTR_CHAR_CJK_LANGUAGE, ((const SvxLanguageItem*)pItem)->GetLanguage()));
+ if(SFX_ITEM_AVAILABLE <= pDispatch->QueryState(SID_ATTR_CHAR_CTL_LANGUAGE, pItem))
+ pRet->Put(SfxUInt16Item(SID_ATTR_CHAR_CTL_LANGUAGE, ((const SvxLanguageItem*)pItem)->GetLanguage()));
+
+ pRet->Put(aHyphen);
+ if(SFX_ITEM_AVAILABLE <= pDispatch->QueryState(SID_AUTOSPELL_CHECK, pItem))
+ {
+ pClone = pItem->Clone();
+ pRet->Put(*pClone);
+ delete pClone;
+ }
+ else
+ {
+ sal_Bool bVal = sal_False;
+ if (xProp.is())
+ {
+ xProp->getPropertyValue( String::CreateFromAscii( UPN_IS_SPELL_AUTO) ) >>= bVal;
+ }
+
+ pRet->Put(SfxBoolItem(SID_AUTOSPELL_CHECK, bVal));
+ }
+ }
+ pRet->Put( SfxBoolItem( SID_SET_DOCUMENT_LANGUAGE, bIsForSetDocumentLanguage ) );
+ }
+ break;
+ case SID_INET_DLG :
+ pRet = new SfxItemSet( SFX_APP()->GetPool(),
+ SID_BASIC_ENABLED, SID_BASIC_ENABLED,
+ //SID_OPTIONS_START - ..END
+ SID_OPTIONS_START, SID_INET_PROXY_PORT,
+ SID_SAVEREL_INET, SID_SAVEREL_FSYS,
+ SID_INET_SMTPSERVER, SID_INET_SMTPSERVER,
+ SID_INET_NOPROXY, SID_INET_SOCKS_PROXY_PORT,
+ SID_INET_DNS_AUTO, SID_INET_DNS_SERVER,
+ SID_SECURE_URL, SID_SECURE_URL,
+ 0L );
+ SFX_APP()->GetOptions(*pRet);
+ break;
+ case SID_FILTER_DLG:
+ pRet = new SfxItemSet( SFX_APP()->GetPool(),
+ SID_ATTR_DOCINFO, SID_ATTR_AUTOSAVEMINUTE,
+ SID_SAVEREL_INET, SID_SAVEREL_FSYS,
+ SID_ATTR_PRETTYPRINTING, SID_ATTR_PRETTYPRINTING,
+ SID_ATTR_WARNALIENFORMAT, SID_ATTR_WARNALIENFORMAT,
+ 0 );
+ SFX_APP()->GetOptions(*pRet);
+ break;
+
+ case SID_SB_STARBASEOPTIONS:
+ pRet = new SfxItemSet( SFX_APP()->GetPool(),
+ SID_SB_POOLING_ENABLED, SID_SB_DB_REGISTER,
+ 0 );
+ ::offapp::ConnectionPoolConfig::GetOptions(*pRet);
+ ::svx::DbRegisteredNamesConfig::GetOptions(*pRet);
+ break;
+
+ case SID_SCH_EDITOPTIONS:
+ {
+ SvxChartOptions aChartOpt;
+ pRet = new SfxItemSet( SFX_APP()->GetPool(), SID_SCH_EDITOPTIONS, SID_SCH_EDITOPTIONS );
+ pRet->Put( SvxChartColorTableItem( SID_SCH_EDITOPTIONS, aChartOpt.GetDefaultColors() ) );
+ break;
+ }
+ }
+ return pRet;
+}
+
+void OfaTreeOptionsDialog::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
+{
+ switch(nId)
+ {
+ case SID_GENERAL_OPTIONS:
+ {
+ utl::MiscCfg aMisc;
+ const SfxPoolItem* pItem;
+ SfxItemSet aOptSet(SFX_APP()->GetPool(), SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER );
+ aOptSet.Put(rSet);
+ if(aOptSet.Count())
+ SFX_APP()->SetOptions( aOptSet );
+ // Dispatcher neu holen, weil SetOptions() ggf. den Dispatcher zerst"ort hat
+ SfxViewFrame *pViewFrame = SfxViewFrame::Current();
+// -------------------------------------------------------------------------
+// Year2000 auswerten
+// -------------------------------------------------------------------------
+ USHORT nY2K = USHRT_MAX;
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_YEAR2000, sal_False, &pItem ) )
+ nY2K = ((const SfxUInt16Item*)pItem)->GetValue();
+ if( USHRT_MAX != nY2K )
+ {
+ if ( pViewFrame )
+ {
+ SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
+ pDispatch->Execute( SID_ATTR_YEAR2000, SFX_CALLMODE_ASYNCHRON, pItem, 0L);
+ }
+ aMisc.SetYear2000(nY2K);
+ }
+
+// -------------------------------------------------------------------------
+// Drucken auswerten
+// -------------------------------------------------------------------------
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_PRINTER_NOTFOUND_WARN, sal_False, &pItem))
+ aMisc.SetNotFoundWarning(((const SfxBoolItem*)pItem)->GetValue());
+
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_PRINTER_CHANGESTODOC, sal_False, &pItem))
+ {
+ const SfxFlagItem* pFlag = (const SfxFlagItem*)pItem;
+ aMisc.SetPaperSizeWarning(0 != (pFlag->GetValue() & SFX_PRINTER_CHG_SIZE ));
+ aMisc.SetPaperOrientationWarning(0 != (pFlag->GetValue() & SFX_PRINTER_CHG_ORIENTATION ));
+ }
+// -------------------------------------------------------------------------
+// evaluate help options
+// -------------------------------------------------------------------------
+ if ( SvtHelpOptions().IsHelpTips() != Help::IsQuickHelpEnabled() )
+ SvtHelpOptions().IsHelpTips() ? Help::EnableQuickHelp() : Help::DisableQuickHelp();
+ if ( SvtHelpOptions().IsExtendedHelp() != Help::IsBalloonHelpEnabled() )
+ SvtHelpOptions().IsExtendedHelp() ? Help::EnableBalloonHelp() : Help::DisableBalloonHelp();
+ }
+ break;
+ case SID_LANGUAGE_OPTIONS :
+ {
+ OfaTreeOptionsDialog::ApplyLanguageOptions(rSet);
+ }
+ break;
+ case SID_INET_DLG :
+ case SID_FILTER_DLG:
+ SFX_APP()->SetOptions( rSet );
+ break;
+
+ case SID_SB_STARBASEOPTIONS:
+ ::offapp::ConnectionPoolConfig::SetOptions( rSet );
+ ::svx::DbRegisteredNamesConfig::SetOptions(rSet);
+ break;
+
+ case SID_SCH_EDITOPTIONS:
+ // nothing to do. Chart options only apply to newly created charts
+ break;
+
+ default:
+ {
+ DBG_ERROR( "Unhandled option in ApplyItemSet" );
+ }
+ break;
+ }
+
+}
+void OfaTreeOptionsDialog::ApplyLanguageOptions(const SfxItemSet& rSet)
+{
+ sal_Bool bSaveSpellCheck = sal_False;
+ const SfxPoolItem* pItem;
+
+ if ( SFX_ITEM_SET == rSet.GetItemState( SID_SPELL_MODIFIED, sal_False, &pItem ) )
+ {
+ bSaveSpellCheck = ( (const SfxBoolItem*)pItem )->GetValue();
+ }
+ Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ Reference< XPropertySet > xProp(
+ xMgr->createInstance( ::rtl::OUString::createFromAscii(
+ "com.sun.star.linguistic2.LinguProperties") ),
+ UNO_QUERY );
+ if ( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_HYPHENREGION, sal_False, &pItem ) )
+ {
+ const SfxHyphenRegionItem* pHyphenItem = (const SfxHyphenRegionItem*)pItem;
+
+ if (xProp.is())
+ {
+ xProp->setPropertyValue(
+ String::CreateFromAscii(UPN_HYPH_MIN_LEADING),
+ makeAny((sal_Int16) pHyphenItem->GetMinLead()) );
+ xProp->setPropertyValue(
+ String::CreateFromAscii(UPN_HYPH_MIN_TRAILING),
+ makeAny((sal_Int16) pHyphenItem->GetMinTrail()) );
+ }
+ bSaveSpellCheck = sal_True;
+ }
+
+ SfxViewFrame *pViewFrame = SfxViewFrame::Current();
+ if ( pViewFrame )
+ {
+ SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
+ pItem = 0;
+ if(SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_LANGUAGE, sal_False, &pItem ))
+ {
+ pDispatch->Execute(pItem->Which(), SFX_CALLMODE_ASYNCHRON, pItem, 0L);
+ bSaveSpellCheck = sal_True;
+ }
+ if(SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_CHAR_CTL_LANGUAGE, sal_False, &pItem ))
+ {
+ pDispatch->Execute(pItem->Which(), SFX_CALLMODE_ASYNCHRON, pItem, 0L);
+ bSaveSpellCheck = sal_True;
+ }
+ if(SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_CHAR_CJK_LANGUAGE, sal_False, &pItem ))
+ {
+ pDispatch->Execute(pItem->Which(), SFX_CALLMODE_ASYNCHRON, pItem, 0L);
+ bSaveSpellCheck = sal_True;
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState(SID_AUTOSPELL_CHECK, sal_False, &pItem ))
+ {
+ sal_Bool bOnlineSpelling = ((const SfxBoolItem*)pItem)->GetValue();
+ pDispatch->Execute(SID_AUTOSPELL_CHECK,
+ SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD, pItem, 0L);
+
+ if (xProp.is())
+ {
+ xProp->setPropertyValue(
+ String::CreateFromAscii(UPN_IS_SPELL_AUTO),
+ makeAny(bOnlineSpelling) );
+ }
+ }
+
+ if( bSaveSpellCheck )
+ {
+ //! the config item has changed since we modified the
+ //! property set it uses
+ pDispatch->Execute(SID_SPELLCHECKER_CHANGED, SFX_CALLMODE_ASYNCHRON);
+ }
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState(SID_OPT_LOCALE_CHANGED, sal_False, &pItem ))
+ {
+ SfxViewFrame* _pViewFrame = SfxViewFrame::GetFirst();
+ while ( _pViewFrame )
+ {
+ _pViewFrame->GetDispatcher()->Execute(pItem->Which(), SFX_CALLMODE_ASYNCHRON, pItem, 0L);
+ _pViewFrame = SfxViewFrame::GetNext( *pViewFrame );
+ }
+ }
+}
+
+rtl::OUString getCurrentFactory_Impl( const Reference< XFrame >& _xFrame )
+{
+ rtl::OUString sIdentifier;
+ Reference < XFrame > xCurrentFrame( _xFrame );
+ Reference < XModuleManager > xModuleManager( ::comphelper::getProcessServiceFactory()->createInstance(
+ DEFINE_CONST_UNICODE("com.sun.star.frame.ModuleManager") ), UNO_QUERY );
+ if ( !xCurrentFrame.is() )
+ {
+ Reference< XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(
+ DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
+ if ( xDesktop.is() )
+ xCurrentFrame = xDesktop->getCurrentFrame();
+ }
+
+ if ( xCurrentFrame.is() && xModuleManager.is() )
+ {
+ try
+ {
+ sIdentifier = xModuleManager->identify( xCurrentFrame );
+ }
+ catch ( ::com::sun::star::frame::UnknownModuleException& )
+ {
+ DBG_WARNING( "getActiveModule_Impl(): unknown module" );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "getActiveModule_Impl(): exception of XModuleManager::identify()" );
+ }
+ }
+
+ return sIdentifier;
+}
+
+void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
+{
+ OfaPageResource aDlgResource;
+ sal_uInt16 nGroup = 0;
+
+ SvtOptionsDialogOptions aOptionsDlgOpt;
+ sal_uInt16 i, nPageId;
+
+ // %PRODUCTNAME options
+ BOOL isSSOEnabled = EnableSSO();
+ if ( !lcl_isOptionHidden( SID_GENERAL_OPTIONS, aOptionsDlgOpt ) )
+ {
+ ResStringArray& rGeneralArray = aDlgResource.GetGeneralArray();
+ setGroupName( C2U("ProductName"), rGeneralArray.GetString(0) );
+ nGroup = AddGroup( rGeneralArray.GetString(0), 0, 0, SID_GENERAL_OPTIONS );
+ sal_uInt16 nEnd = static_cast< sal_uInt16 >( rGeneralArray.Count() );
+ String sPageTitle;
+
+ for ( i = 1; i < nEnd; ++i )
+ {
+ String sNewTitle = rGeneralArray.GetString(i);
+ nPageId = (sal_uInt16)rGeneralArray.GetValue(i);
+ if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ continue;
+
+ // Disable Online Update page if service not installed
+ if( RID_SVXPAGE_ONLINEUPDATE == nPageId )
+ {
+ const ::rtl::OUString sService = C2U("com.sun.star.setup.UpdateCheck");
+
+ try
+ {
+ Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ Reference < XInterface > xService( xFactory->createInstance( sService ) );
+
+ if( ! xService.is() )
+ continue;
+ }
+ catch ( ::com::sun::star::loader::CannotActivateFactoryException& )
+ {
+ continue;
+ }
+ }
+ // Disable OOoImprovement page if not enabled
+ if( RID_SVXPAGE_IMPROVEMENT == nPageId )
+ {
+ continue;
+ }
+ if ( nPageId != RID_SVXPAGE_SSO || isSSOEnabled )
+ {
+ AddTabPage( nPageId, sNewTitle, nGroup );
+ }
+ }
+ // private iteration hack for Improvement Program
+ // hack for OOo 3.1
+ // should not be in found in any later release
+ for(bool bOnce = false; bOnce==false; bOnce=true)
+ {
+ String sNewTitle = C2U("Improvement Program");
+ {
+ SvxImprovementPage aTempTabPage(this);
+ sNewTitle = aTempTabPage.GetTitleText();
+ }
+ nPageId = RID_SVXPAGE_IMPROVEMENT;
+ if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ continue;
+ // Disable OOoImprovement page if not enabled
+ {
+ const ::rtl::OUString sService = C2U("com.sun.star.oooimprovement.CoreController");
+ try
+ {
+ Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ Reference < ::com::sun::star::oooimprovement::XCoreController > xService( xFactory->createInstance( sService ), UNO_QUERY );
+
+ if( ! xService.is() )
+ continue;
+ if( ! xService->showBuiltinOptionsPage(1))
+ continue;
+ }
+ catch ( ::com::sun::star::loader::CannotActivateFactoryException& )
+ {
+ continue;
+ }
+ }
+ if ( nPageId != RID_SVXPAGE_SSO || isSSOEnabled )
+ {
+ AddTabPage( nPageId, sNewTitle, nGroup );
+ }
+ }
+ }
+
+ // Load and Save options
+ if ( !lcl_isOptionHidden( SID_FILTER_DLG, aOptionsDlgOpt ) )
+ {
+ ResStringArray& rFilterArray = aDlgResource.GetFilterArray();
+ setGroupName( C2U("LoadSave"), rFilterArray.GetString(0) );
+ nGroup = AddGroup( rFilterArray.GetString(0), 0, 0, SID_FILTER_DLG );
+ for ( i = 1; i < rFilterArray.Count(); ++i )
+ {
+ nPageId = (sal_uInt16)rFilterArray.GetValue(i);
+ if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ AddTabPage( nPageId, rFilterArray.GetString(i), nGroup );
+ }
+ }
+
+ // Language options
+ SvtLanguageOptions aLanguageOptions;
+ if ( !lcl_isOptionHidden( SID_LANGUAGE_OPTIONS, aOptionsDlgOpt ) )
+ {
+ ResStringArray& rLangArray = aDlgResource.GetLangArray();
+ setGroupName( C2U("LanguageSettings"), rLangArray.GetString(0) );
+ nGroup = AddGroup( rLangArray.GetString(0), 0, 0, SID_LANGUAGE_OPTIONS );
+ for ( i = 1; i < rLangArray.Count(); ++i )
+ {
+ nPageId = (sal_uInt16)rLangArray.GetValue(i);
+ if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ continue;
+ if ( ( RID_SVXPAGE_JSEARCH_OPTIONS != nPageId || aLanguageOptions.IsJapaneseFindEnabled() ) &&
+ ( RID_SVXPAGE_ASIAN_LAYOUT != nPageId || aLanguageOptions.IsAsianTypographyEnabled() ) &&
+ ( RID_SVXPAGE_OPTIONS_CTL != nPageId || aLanguageOptions.IsCTLFontEnabled() ) )
+ AddTabPage( nPageId, rLangArray.GetString(i), nGroup );
+ }
+ }
+
+
+ rtl::OUString aFactory = getCurrentFactory_Impl( _xFrame );
+ rtl::OUString sTemp = GetModuleIdentifier( comphelper::getProcessServiceFactory(), _xFrame );
+ DBG_ASSERT( sTemp == aFactory, "S H I T!!!" );
+
+ // Writer and Writer/Web options
+ sal_Bool bHasAnyFilter = sal_False;
+ SvtModuleOptions aModuleOpt;
+ if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) )
+ {
+ // Textdokument
+ bHasAnyFilter = sal_True;
+ ResStringArray& rTextArray = aDlgResource.GetTextArray();
+ if ( aFactory.equalsAscii( "com.sun.star.text.TextDocument" )
+ || aFactory.equalsAscii( "com.sun.star.text.WebDocument" )
+ || aFactory.equalsAscii( "com.sun.star.text.GlobalDocument" ) )
+ {
+ SfxModule* pSwMod = (*(SfxModule**) GetAppData(SHL_WRITER));
+ if ( !lcl_isOptionHidden( SID_SW_EDITOPTIONS, aOptionsDlgOpt ) )
+ {
+ if ( aFactory.equalsAscii( "com.sun.star.text.WebDocument" ) )
+ setGroupName( C2U("WriterWeb"), rTextArray.GetString(0) );
+ else
+ setGroupName( C2U("Writer"), rTextArray.GetString(0) );
+ nGroup = AddGroup(rTextArray.GetString(0), pSwMod, pSwMod, SID_SW_EDITOPTIONS );
+ for ( i = 1; i < rTextArray.Count(); ++i )
+ {
+ nPageId = (sal_uInt16)rTextArray.GetValue(i);
+ if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ continue;
+ if ( ( RID_SW_TP_STD_FONT_CJK != nPageId || aLanguageOptions.IsCJKFontEnabled() ) &&
+ ( RID_SW_TP_STD_FONT_CTL != nPageId || aLanguageOptions.IsCTLFontEnabled() ) &&
+ ( RID_SW_TP_MAILCONFIG != nPageId || MailMergeCfg_Impl().IsEmailSupported() ) )
+ AddTabPage( nPageId, rTextArray.GetString(i), nGroup );
+ }
+#ifdef DBG_UTIL
+ AddTabPage( RID_SW_TP_OPTTEST_PAGE, String::CreateFromAscii("Interner Test"), nGroup );
+#endif
+ }
+
+ // HTML-Dokument
+ if ( !lcl_isOptionHidden( SID_SW_ONLINEOPTIONS, aOptionsDlgOpt ) )
+ {
+ ResStringArray& rHTMLArray = aDlgResource.GetHTMLArray();
+ nGroup = AddGroup(rHTMLArray.GetString(0), pSwMod, pSwMod, SID_SW_ONLINEOPTIONS );
+ for( i = 1; i < rHTMLArray.Count(); ++i )
+ {
+ nPageId = (sal_uInt16)rHTMLArray.GetValue(i);
+ if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ AddTabPage( nPageId, rHTMLArray.GetString(i), nGroup );
+ }
+#ifdef DBG_UTIL
+ AddTabPage( RID_SW_TP_OPTTEST_PAGE, String::CreateFromAscii("Interner Test"), nGroup );
+#endif
+ }
+ }
+ }
+
+ // Calc options
+ if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) )
+ {
+ bHasAnyFilter = sal_True;
+ if ( aFactory.equalsAscii( "com.sun.star.sheet.SpreadsheetDocument" ))
+ {
+ if ( !lcl_isOptionHidden( SID_SC_EDITOPTIONS, aOptionsDlgOpt ) )
+ {
+ ResStringArray& rCalcArray = aDlgResource.GetCalcArray();
+ SfxModule* pScMod = ( *( SfxModule** ) GetAppData( SHL_CALC ) );
+ setGroupName( C2U("Calc"), rCalcArray.GetString(0) );
+ nGroup = AddGroup( rCalcArray.GetString( 0 ), pScMod, pScMod, SID_SC_EDITOPTIONS );
+ const USHORT nCount = static_cast< const USHORT >( rCalcArray.Count() );
+ for ( i = 1; i < nCount; ++i )
+ {
+ nPageId = (sal_uInt16)rCalcArray.GetValue(i);
+ if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ continue;
+// if( bCTL || nId != RID_OFA_TP_INTERNATIONAL )
+// #103755# if an international tabpage is need one day, this should be used again... ;-)
+ if ( nPageId != RID_OFA_TP_INTERNATIONAL )
+ AddTabPage( nPageId, rCalcArray.GetString( i ), nGroup );
+ }
+ }
+ }
+ }
+
+ // Impress options
+ SfxModule* pSdMod = ( *( SfxModule** ) GetAppData( SHL_DRAW ) );
+ if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) )
+ {
+ bHasAnyFilter = sal_True;
+ if ( aFactory.equalsAscii( "com.sun.star.presentation.PresentationDocument" ))
+ {
+ if ( !lcl_isOptionHidden( SID_SD_EDITOPTIONS, aOptionsDlgOpt ) )
+ {
+ ResStringArray& rImpressArray = aDlgResource.GetImpressArray();
+ setGroupName( C2U("Impress"), rImpressArray.GetString(0) );
+ nGroup = AddGroup( rImpressArray.GetString( 0 ), pSdMod, pSdMod, SID_SD_EDITOPTIONS );
+ const sal_Bool bCTL = aLanguageOptions.IsCTLFontEnabled();
+ const USHORT nCount = static_cast< const USHORT >( rImpressArray.Count() );
+ for ( i = 1; i < nCount; ++i )
+ {
+ nPageId = (sal_uInt16)rImpressArray.GetValue(i);
+ if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ continue;
+ if ( bCTL || nPageId != RID_OFA_TP_INTERNATIONAL_IMPR )
+ AddTabPage( nPageId, rImpressArray.GetString(i), nGroup );
+ }
+ }
+ }
+ }
+
+ // Draw options
+ if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) )
+ {
+ if ( aFactory.equalsAscii( "com.sun.star.drawing.DrawingDocument" ))
+ {
+ if ( !lcl_isOptionHidden( SID_SD_GRAPHIC_OPTIONS, aOptionsDlgOpt ) )
+ {
+ ResStringArray& rDrawArray = aDlgResource.GetDrawArray();
+ setGroupName( C2U("Draw"), rDrawArray.GetString(0) );
+ nGroup = AddGroup( rDrawArray.GetString( 0 ), pSdMod, pSdMod, SID_SD_GRAPHIC_OPTIONS );
+ const sal_Bool bCTL = aLanguageOptions.IsCTLFontEnabled();
+ const USHORT nCount = static_cast< const USHORT >( rDrawArray.Count() );
+ for ( i = 1; i < nCount; ++i )
+ {
+ nPageId = (sal_uInt16)rDrawArray.GetValue(i);
+ if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ continue;
+ if ( bCTL || nPageId != RID_OFA_TP_INTERNATIONAL_SD )
+ AddTabPage( nPageId, rDrawArray.GetString(i), nGroup );
+ }
+ }
+ }
+ }
+
+ // Math options
+ if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SMATH ) )
+ {
+ if ( aFactory.equalsAscii( "com.sun.star.formula.FormulaProperties" ))
+ {
+ if ( !lcl_isOptionHidden( SID_SM_EDITOPTIONS, aOptionsDlgOpt ) )
+ {
+ ResStringArray& rStarMathArray = aDlgResource.GetStarMathArray();
+ SfxModule* pSmMod = (*(SfxModule**) GetAppData(SHL_SM));
+ setGroupName( C2U("Math"), rStarMathArray.GetString(0) );
+ nGroup = AddGroup(rStarMathArray.GetString(0), pSmMod, pSmMod, SID_SM_EDITOPTIONS );
+ for ( i = 1; i < rStarMathArray.Count(); ++i )
+ {
+ nPageId = (sal_uInt16)rStarMathArray.GetValue(i);
+ if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ AddTabPage( nPageId, rStarMathArray.GetString(i), nGroup );
+ }
+ }
+ }
+ }
+
+ // Database - needed only if there is an application which integrates with databases
+ if ( !lcl_isOptionHidden( SID_SB_STARBASEOPTIONS, aOptionsDlgOpt ) &&
+ ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SDATABASE )
+ || aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER )
+ || aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC )
+ ) )
+ {
+ ResStringArray& rDSArray = aDlgResource.GetDatasourcesArray();
+ setGroupName( C2U("Base"), rDSArray.GetString(0) );
+ nGroup = AddGroup( rDSArray.GetString(0), 0, NULL, SID_SB_STARBASEOPTIONS );
+ for ( i = 1; i < rDSArray.Count(); ++i )
+ {
+ nPageId = (sal_uInt16)rDSArray.GetValue(i);
+ if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ AddTabPage( nPageId, rDSArray.GetString(i), nGroup );
+ }
+ }
+
+ // Chart options (always installed and active)
+ if ( !lcl_isOptionHidden( SID_SCH_EDITOPTIONS, aOptionsDlgOpt ) )
+ {
+ ResStringArray& rChartArray = aDlgResource.GetChartArray();
+ setGroupName( C2U("Charts"), rChartArray.GetString(0) );
+ nGroup = AddGroup( rChartArray.GetString(0), 0, 0, SID_SCH_EDITOPTIONS );
+ for ( i = 1; i < rChartArray.Count(); ++i )
+ {
+ nPageId = (sal_uInt16)rChartArray.GetValue(i);
+ if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ AddTabPage( nPageId, rChartArray.GetString(i), nGroup );
+ }
+ }
+
+ // Internet options
+ if ( !lcl_isOptionHidden( SID_INET_DLG, aOptionsDlgOpt ) )
+ {
+ ResStringArray& rInetArray = aDlgResource.GetInetArray();
+ setGroupName( C2U("Internet"), rInetArray.GetString(0) );
+ nGroup = AddGroup(rInetArray.GetString(0), 0, 0, SID_INET_DLG );
+
+ for ( i = 1; i < rInetArray.Count(); ++i )
+ {
+ nPageId = (sal_uInt16)rInetArray.GetValue(i);
+ if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
+ continue;
+#if defined WNT
+ // Disable E-mail tab-page on Windows
+ if ( nPageId == RID_SVXPAGE_INET_MAIL )
+ continue;
+#endif
+#if defined MACOSX
+ // Disable Mozilla Plug-in tab-page on Mac
+ if ( nPageId == RID_SVXPAGE_INET_MOZPLUGIN )
+ continue;
+#endif
+ AddTabPage( nPageId, rInetArray.GetString(i), nGroup );
+ }
+ }
+
+/*!!!
+ ResizeTreeLB();
+ ActivateLastSelection();
+ */
+}
+
+namespace
+{
+ void MoveControl( Control& _rCtrl, long _nDeltaPixel )
+ {
+ Point aPt( _rCtrl.GetPosPixel() );
+ aPt.X() += _nDeltaPixel;
+ _rCtrl.SetPosPixel( aPt );
+ }
+}
+
+void OfaTreeOptionsDialog::ResizeTreeLB( void )
+{
+ const long nMax = aHiddenGB.GetSizePixel().Width() * 42 / 100;
+ // don't ask where 42 comes from... but it looks / feels ok ;-)
+ long nDelta = 50; // min.
+ USHORT nDepth = 0;
+ const long nIndent0 = PixelToLogic( Size( 28, 0 ) ).Width();
+ const long nIndent1 = PixelToLogic( Size( 52, 0 ) ).Width();
+
+ SvTreeList* pTreeList = aTreeLB.GetModel();
+ DBG_ASSERT( pTreeList, "-OfaTreeOptionsDialog::ResizeTreeLB(): no model, no cookies!" );
+
+ SvListEntry* pEntry = pTreeList->First();
+ while( pEntry )
+ {
+ long n = aTreeLB.GetTextWidth( aTreeLB.GetEntryText( static_cast< SvLBoxEntry* >( pEntry ) ) );
+ n += ( nDepth == 0 )? nIndent0 : nIndent1;
+
+ if( n > nDelta )
+ nDelta = n;
+
+ pEntry = pTreeList->Next( pEntry, &nDepth );
+ }
+
+ nDelta = LogicToPixel( Size( nDelta + 3, 0 ) ).Width(); // + extra space [logic]
+ nDelta += GetSettings().GetStyleSettings().GetScrollBarSize(); // + scroll bar, in case it's needed
+
+ if( nDelta > nMax )
+ nDelta = nMax;
+
+ // starting resizing with this
+ Size aSize( GetSizePixel() );
+ aSize.Width() += nDelta;
+ SetSizePixel( aSize );
+
+ // resize treelistbox
+ aSize = aTreeLB.GetSizePixel();
+ aSize.Width() += nDelta;
+ aTreeLB.SetSizePixel( aSize );
+
+ // ... and move depending controls
+ MoveControl( aOkPB, nDelta );
+ MoveControl( aCancelPB, nDelta );
+ MoveControl( aHelpPB, nDelta );
+ MoveControl( aBackPB, nDelta );
+ MoveControl( aHiddenGB, nDelta );
+ MoveControl( aPageTitleFT, nDelta );
+ MoveControl( aLine1FL, nDelta );
+ MoveControl( aHelpFT, nDelta );
+ MoveControl( aHelpImg, nDelta );
+}
+
+bool isNodeActive( OptionsNode* pNode, Module* pModule )
+{
+ if ( pNode )
+ {
+ // Node for all modules actine?
+ if ( pNode->m_bAllModules )
+ return true;
+
+ // OOo-Nodes (Writer, Calc, Impress...) are active if node is already inserted
+ if ( getGroupName( pNode->m_sId, false ).Len() > 0 )
+ return true;
+
+ // no module -> not active
+ if ( !pModule )
+ return false;
+
+ // search node in active module
+ if ( pModule->m_bActive )
+ {
+ for ( sal_uInt32 j = 0; j < pModule->m_aNodeList.size(); ++j )
+ if ( pModule->m_aNodeList[j]->m_sId == pNode->m_sId )
+ return true;
+ }
+ }
+ return false;
+}
+
+void OfaTreeOptionsDialog::LoadExtensionOptions( const rtl::OUString& rExtensionId )
+{
+ Module* pModule = NULL;
+ Reference< XMultiServiceFactory > xMSFac = comphelper::getProcessServiceFactory();
+ // open optionsdialog.xcu
+ Reference< XNameAccess > xRoot(
+ ::comphelper::ConfigurationHelper::openConfig(
+ xMSFac, C2U("org.openoffice.Office.OptionsDialog"),
+ ::comphelper::ConfigurationHelper::E_READONLY ), UNO_QUERY );
+ DBG_ASSERT( xRoot.is(), "OfaTreeOptionsDialog::LoadExtensionOptions(): no config" );
+ // when called by Tools - Options then load nodes of active module
+ if ( rExtensionId.getLength() == 0 )
+ pModule = LoadModule( GetModuleIdentifier( xMSFac, Reference< XFrame >() ), xRoot );
+
+ VectorOfNodes aNodeList;
+ LoadNodes( xRoot, pModule, rExtensionId, aNodeList );
+ InsertNodes( aNodeList );
+}
+
+rtl::OUString OfaTreeOptionsDialog::GetModuleIdentifier(
+ const Reference< XMultiServiceFactory >& xMFac, const Reference< XFrame >& rFrame )
+{
+ rtl::OUString sModule;
+ Reference < XFrame > xCurrentFrame( rFrame );
+ Reference < XModuleManager > xModuleManager( xMFac->createInstance(
+ C2U("com.sun.star.frame.ModuleManager") ), UNO_QUERY );
+
+ if ( !xCurrentFrame.is() )
+ {
+ Reference < XDesktop > xDesktop( xMFac->createInstance(
+ C2U("com.sun.star.frame.Desktop") ), UNO_QUERY );
+ if ( xDesktop.is() )
+ xCurrentFrame = xDesktop->getCurrentFrame();
+ }
+
+ if ( xCurrentFrame.is() && xModuleManager.is() )
+ {
+ try
+ {
+ sModule = xModuleManager->identify( xCurrentFrame );
+ }
+ catch ( ::com::sun::star::frame::UnknownModuleException& )
+ {
+ DBG_WARNING( "OfaTreeOptionsDialog::GetModuleIdentifier(): unknown module" );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "OfaTreeOptionsDialog::GetModuleIdentifier(): exception of XModuleManager::identify()" );
+ }
+ }
+ return sModule;
+}
+
+Module* OfaTreeOptionsDialog::LoadModule(
+ const rtl::OUString& rModuleIdentifier, const Reference< XNameAccess >& xRoot )
+{
+ Module* pModule = NULL;
+ Reference< XNameAccess > xSet;
+
+ if ( xRoot->hasByName( C2U("Modules") ) )
+ {
+ xRoot->getByName( C2U("Modules") ) >>= xSet;
+ if ( xSet.is() )
+ {
+ Sequence< rtl::OUString > seqNames = xSet->getElementNames();
+ for ( int i = 0; i < seqNames.getLength(); ++i )
+ {
+ rtl::OUString sModule( seqNames[i] );
+ if ( rModuleIdentifier == sModule )
+ {
+ // current active module found
+ pModule = new Module( sModule );
+ pModule->m_bActive = true;
+
+ Reference< XNameAccess > xModAccess;
+ xSet->getByName( seqNames[i] ) >>= xModAccess;
+ if ( xModAccess.is() )
+ {
+ // load the nodes of this module
+ Reference< XNameAccess > xNodeAccess;
+ xModAccess->getByName( C2U("Nodes") ) >>= xNodeAccess;
+ if ( xNodeAccess.is() )
+ {
+ Sequence< rtl::OUString > xTemp = xNodeAccess->getElementNames();
+ Reference< XNameAccess > xAccess;
+ sal_Int32 nIndex = -1;
+ for ( int x = 0; x < xTemp.getLength(); ++x )
+ {
+ xNodeAccess->getByName( xTemp[x] ) >>= xAccess;
+ if ( xAccess.is() )
+ {
+ xAccess->getByName( C2U("Index") ) >>= nIndex;
+ if ( nIndex < 0 )
+ // append nodes with index < 0
+ pModule->m_aNodeList.push_back(
+ new OrderedEntry( nIndex, xTemp[x] ) );
+ else
+ {
+ // search position of the node
+ sal_uInt32 y = 0;
+ for ( ; y < pModule->m_aNodeList.size(); ++y )
+ {
+ sal_Int32 nNodeIdx = pModule->m_aNodeList[y]->m_nIndex;
+ if ( nNodeIdx < 0 || nNodeIdx > nIndex )
+ break;
+ }
+ // and insert the node on this position
+ pModule->m_aNodeList.insert(
+ pModule->m_aNodeList.begin() + y,
+ new OrderedEntry( nIndex, xTemp[x] ) );
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return pModule;
+}
+
+void OfaTreeOptionsDialog::LoadNodes(
+ const Reference< XNameAccess >& xRoot, Module* pModule,
+ const rtl::OUString& rExtensionId, VectorOfNodes& rOutNodeList )
+{
+ Reference< XNameAccess > xSet;
+ if ( xRoot->hasByName( C2U("Nodes") ) )
+ {
+ xRoot->getByName( C2U("Nodes") ) >>= xSet;
+ if ( xSet.is() )
+ {
+ VectorOfNodes aNodeList;
+ Sequence< rtl::OUString > seqNames = xSet->getElementNames();
+
+ for ( int i = 0; i < seqNames.getLength(); ++i )
+ {
+ String sGroupName( seqNames[i] );
+ Reference< XNameAccess > xNodeAccess;
+ xSet->getByName( seqNames[i] ) >>= xNodeAccess;
+
+ if ( xNodeAccess.is() )
+ {
+ rtl::OUString sNodeId, sLabel, sPageURL, sGroupId;
+ bool bAllModules = false;
+ sal_Int32 nGroupIndex = 0;
+
+ sNodeId = seqNames[i];
+ xNodeAccess->getByName( C2U("Label") ) >>= sLabel;
+ xNodeAccess->getByName( C2U("OptionsPage") ) >>= sPageURL;
+ xNodeAccess->getByName( C2U("AllModules") ) >>= bAllModules;
+ xNodeAccess->getByName( C2U("GroupId") ) >>= sGroupId;
+ xNodeAccess->getByName( C2U("GroupIndex") ) >>= nGroupIndex;
+
+ if ( sLabel.getLength() == 0 )
+ sLabel = sGroupName;
+ String sTemp = getGroupName( sLabel, rExtensionId.getLength() > 0 );
+ if ( sTemp.Len() > 0 )
+ sLabel = sTemp;
+ OptionsNode* pNode =
+ new OptionsNode( sNodeId, sLabel, sPageURL, bAllModules, sGroupId, nGroupIndex );
+
+ if ( !rExtensionId.getLength() && !isNodeActive( pNode, pModule ) )
+ {
+ delete pNode;
+ continue;
+ }
+
+ Reference< XNameAccess > xLeavesSet;
+ xNodeAccess->getByName( C2U( "Leaves" ) ) >>= xLeavesSet;
+ if ( xLeavesSet.is() )
+ {
+ Sequence< rtl::OUString > seqLeaves = xLeavesSet->getElementNames();
+ for ( int j = 0; j < seqLeaves.getLength(); ++j )
+ {
+ Reference< XNameAccess > xLeaveAccess;
+ xLeavesSet->getByName( seqLeaves[j] ) >>= xLeaveAccess;
+
+ if ( xLeaveAccess.is() )
+ {
+ rtl::OUString sId, sLeafLabel, sEventHdl, sLeafURL, sLeafGrpId;
+ sal_Int32 nLeafGrpIdx = 0;
+
+ xLeaveAccess->getByName( C2U("Id") ) >>= sId;
+ xLeaveAccess->getByName( C2U("Label") ) >>= sLeafLabel;
+ xLeaveAccess->getByName( C2U("OptionsPage") ) >>= sLeafURL;
+ xLeaveAccess->getByName( C2U("EventHandlerService") ) >>= sEventHdl;
+ xLeaveAccess->getByName( C2U("GroupId") ) >>= sLeafGrpId;
+ xLeaveAccess->getByName( C2U("GroupIndex") ) >>= nLeafGrpIdx;
+
+ if ( !rExtensionId.getLength() || sId == rExtensionId )
+ {
+ OptionsLeaf* pLeaf = new OptionsLeaf(
+ sId, sLeafLabel, sLeafURL, sEventHdl, sLeafGrpId, nLeafGrpIdx );
+
+ if ( sLeafGrpId.getLength() > 0 )
+ {
+ bool bAlreadyOpened = false;
+ if ( pNode->m_aGroupedLeaves.size() > 0 )
+ {
+ for ( sal_uInt32 k = 0;
+ k < pNode->m_aGroupedLeaves.size(); ++k )
+ {
+ if ( pNode->m_aGroupedLeaves[k].size() > 0 &&
+ pNode->m_aGroupedLeaves[k][0]->m_sGroupId
+ == sLeafGrpId )
+ {
+ sal_uInt32 l = 0;
+ for ( ; l < pNode->m_aGroupedLeaves[k].size(); ++l )
+ {
+ if ( pNode->m_aGroupedLeaves[k][l]->
+ m_nGroupIndex >= nLeafGrpIdx )
+ break;
+ }
+ pNode->m_aGroupedLeaves[k].insert(
+ pNode->m_aGroupedLeaves[k].begin() + l, pLeaf );
+ bAlreadyOpened = true;
+ break;
+ }
+ }
+ }
+ if ( !bAlreadyOpened )
+ {
+ VectorOfLeaves aGroupedLeaves;
+ aGroupedLeaves.push_back( pLeaf );
+ pNode->m_aGroupedLeaves.push_back( aGroupedLeaves );
+ }
+ }
+ else
+ pNode->m_aLeaves.push_back(
+ new OptionsLeaf(
+ sId, sLeafLabel, sLeafURL,
+ sEventHdl, sLeafGrpId, nLeafGrpIdx ) );
+ }
+ }
+ }
+ }
+
+ // do not insert nodes without leaves
+ if ( pNode->m_aLeaves.size() > 0 || pNode->m_aGroupedLeaves.size() > 0 )
+ {
+ pModule ? aNodeList.push_back( pNode ) : rOutNodeList.push_back( pNode );
+ }
+ }
+ }
+
+ if ( pModule && aNodeList.size() > 0 )
+ {
+ sal_uInt32 i = 0, j = 0;
+ for ( ; i < pModule->m_aNodeList.size(); ++i )
+ {
+ rtl::OUString sNodeId = pModule->m_aNodeList[i]->m_sId;
+ for ( j = 0; j < aNodeList.size(); ++j )
+ {
+ OptionsNode* pNode = aNodeList[j];
+ if ( pNode->m_sId == sNodeId )
+ {
+ rOutNodeList.push_back( pNode );
+ aNodeList.erase( aNodeList.begin() + j );
+ break;
+ }
+ }
+ }
+
+ for ( i = 0; i < aNodeList.size(); ++i )
+ rOutNodeList.push_back( aNodeList[i] );
+ }
+ }
+ }
+}
+
+USHORT lcl_getGroupId( const rtl::OUString& rGroupName, const SvTreeListBox& rTreeLB )
+{
+ String sGroupName( rGroupName );
+ USHORT nRet = 0;
+ SvLBoxEntry* pEntry = rTreeLB.First();
+ while( pEntry )
+ {
+ if ( !rTreeLB.GetParent( pEntry ) )
+ {
+ String sTemp( rTreeLB.GetEntryText( pEntry ) );
+ if ( sTemp == sGroupName )
+ return nRet;
+ nRet++;
+ }
+ pEntry = rTreeLB.Next( pEntry );
+ }
+
+ return USHRT_MAX;
+}
+
+void lcl_insertLeaf(
+ OfaTreeOptionsDialog* pDlg, OptionsNode* pNode, OptionsLeaf* pLeaf, const SvTreeListBox& rTreeLB )
+{
+ USHORT nGrpId = lcl_getGroupId( pNode->m_sLabel, rTreeLB );
+ if ( USHRT_MAX == nGrpId )
+ {
+ USHORT nNodeGrpId = getGroupNodeId( pNode->m_sId );
+ nGrpId = pDlg->AddGroup( pNode->m_sLabel, NULL, NULL, nNodeGrpId );
+ if ( pNode->m_sPageURL.getLength() > 0 )
+ {
+ SvLBoxEntry* pGrpEntry = rTreeLB.GetEntry( 0, nGrpId );
+ DBG_ASSERT( pGrpEntry, "OfaTreeOptionsDialog::InsertNodes(): no group" );
+ if ( pGrpEntry )
+ {
+ OptionsGroupInfo* pGrpInfo =
+ static_cast<OptionsGroupInfo*>(pGrpEntry->GetUserData());
+ pGrpInfo->m_sPageURL = pNode->m_sPageURL;
+ }
+ }
+ }
+ OptionsPageInfo* pInfo = pDlg->AddTabPage( 0, pLeaf->m_sLabel, nGrpId );
+ pInfo->m_sPageURL = pLeaf->m_sPageURL;
+ pInfo->m_sEventHdl = pLeaf->m_sEventHdl;
+}
+
+void OfaTreeOptionsDialog::InsertNodes( const VectorOfNodes& rNodeList )
+{
+ for ( sal_uInt32 i = 0; i < rNodeList.size(); ++i )
+ {
+ OptionsNode* pNode = rNodeList[i];
+
+ if ( pNode->m_aLeaves.size() > 0 || pNode->m_aGroupedLeaves.size() > 0 )
+ {
+ sal_uInt32 j = 0;
+ for ( ; j < pNode->m_aGroupedLeaves.size(); ++j )
+ {
+ for ( sal_uInt32 k = 0; k < pNode->m_aGroupedLeaves[j].size(); ++k )
+ {
+ OptionsLeaf* pLeaf = pNode->m_aGroupedLeaves[j][k];
+ lcl_insertLeaf( this, pNode, pLeaf, aTreeLB );
+ }
+ }
+
+ for ( j = 0; j < pNode->m_aLeaves.size(); ++j )
+ {
+ OptionsLeaf* pLeaf = pNode->m_aLeaves[j];
+ lcl_insertLeaf( this, pNode, pLeaf, aTreeLB );
+ }
+ }
+ }
+}
+
+short OfaTreeOptionsDialog::Execute()
+{
+ ::std::auto_ptr< SvxDicListChgClamp > pClamp;
+ if ( !bIsFromExtensionManager )
+ {
+ // collect all DictionaryList Events while the dialog is executed
+ Reference<com::sun::star::linguistic2::XDictionaryList> xDictionaryList(SvxGetDictionaryList());
+ pClamp = ::std::auto_ptr< SvxDicListChgClamp >( new SvxDicListChgClamp( xDictionaryList ) );
+ }
+ short nRet = SfxModalDialog::Execute();
+
+ if( RET_OK == nRet )
+ {
+ ApplyItemSets();
+ if( GetColorTable() )
+ {
+ GetColorTable()->Save();
+
+ // notify current viewframe it it uses the same color table
+ if ( SfxViewFrame::Current() && SfxViewFrame::Current()->GetDispatcher() )
+ {
+ const OfaPtrItem* pPtr = (const OfaPtrItem*)SfxViewFrame::Current()->GetDispatcher()->Execute( SID_GET_COLORTABLE, SFX_CALLMODE_SYNCHRON );
+ if( pPtr )
+ {
+ XColorTable* _pColorTab = (XColorTable*)pPtr->GetValue();
+
+ if( _pColorTab &&
+ _pColorTab->GetPath() == GetColorTable()->GetPath() &&
+ _pColorTab->GetName() == GetColorTable()->GetName() )
+ SfxObjectShell::Current()->PutItem( SvxColorTableItem( GetColorTable(), SID_COLOR_TABLE ) );
+ }
+ }
+ }
+
+ utl::ConfigManager::GetConfigManager()->StoreConfigItems();
+ }
+
+ return nRet;
+}
+
+// class ExtensionsTabPage -----------------------------------------------
+
+ExtensionsTabPage::ExtensionsTabPage(
+ Window* pParent, const ResId& rResId, const rtl::OUString& rPageURL,
+ const rtl::OUString& rEvtHdl, const Reference< awt::XContainerWindowProvider >& rProvider ) :
+
+ TabPage( pParent, rResId ),
+
+ m_sPageURL ( rPageURL ),
+ m_sEventHdl ( rEvtHdl ),
+ m_xWinProvider ( rProvider ),
+ m_bIsWindowHidden ( false )
+
+{
+}
+
+// -----------------------------------------------------------------------
+
+ExtensionsTabPage::ExtensionsTabPage(
+ Window* pParent, WinBits nStyle, const rtl::OUString& rPageURL,
+ const rtl::OUString& rEvtHdl, const Reference< awt::XContainerWindowProvider >& rProvider ) :
+
+ TabPage( pParent, nStyle ),
+
+ m_sPageURL ( rPageURL ),
+ m_sEventHdl ( rEvtHdl ),
+ m_xWinProvider ( rProvider ),
+ m_bIsWindowHidden ( false )
+
+{
+}
+
+// -----------------------------------------------------------------------
+
+ExtensionsTabPage::~ExtensionsTabPage()
+{
+ Hide();
+ DeactivatePage();
+}
+
+// -----------------------------------------------------------------------
+
+void ExtensionsTabPage::CreateDialogWithHandler()
+{
+ try
+ {
+ bool bWithHandler = ( m_sEventHdl.getLength() > 0 );
+ if ( bWithHandler )
+ {
+ Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ m_xEventHdl = Reference< awt::XContainerWindowEventHandler >(
+ xFactory->createInstance( m_sEventHdl ), UNO_QUERY );
+ }
+
+ if ( !bWithHandler || m_xEventHdl.is() )
+ {
+ SetStyle( GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL );
+ Reference< awt::XWindowPeer > xParent( VCLUnoHelper::GetInterface( this ), UNO_QUERY );
+ m_xPage = Reference < awt::XWindow >(
+ m_xWinProvider->createContainerWindow(
+ m_sPageURL, rtl::OUString(), xParent, m_xEventHdl ), UNO_QUERY );
+
+ Reference< awt::XControl > xPageControl( m_xPage, UNO_QUERY );
+ if ( xPageControl.is() )
+ {
+ Reference< awt::XWindowPeer > xWinPeer( xPageControl->getPeer() );
+ if ( xWinPeer.is() )
+ {
+ Window* pWindow = VCLUnoHelper::GetWindow( xWinPeer );
+ if ( pWindow )
+ pWindow->SetStyle( pWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL );
+ }
+ }
+ }
+ }
+ catch ( ::com::sun::star::lang::IllegalArgumentException& )
+ {
+ DBG_ERRORFILE( "ExtensionsTabPage::CreateDialogWithHandler(): illegal argument" );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "ExtensionsTabPage::CreateDialogWithHandler(): exception of XDialogProvider2::createDialogWithHandler()" );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool ExtensionsTabPage::DispatchAction( const rtl::OUString& rAction )
+{
+ sal_Bool bRet = sal_False;
+ if ( m_xEventHdl.is() )
+ {
+ try
+ {
+ bRet = m_xEventHdl->callHandlerMethod( m_xPage, makeAny( rAction ), C2U("external_event") );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "ExtensionsTabPage::DispatchAction(): exception of XDialogEventHandler::callHandlerMethod()" );
+ }
+ }
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+void ExtensionsTabPage::ActivatePage()
+{
+ TabPage::ActivatePage();
+
+ if ( !m_xPage.is() )
+ {
+ CreateDialogWithHandler();
+
+ if ( m_xPage.is() )
+ {
+ Point aPos = Point();
+ Size aSize = GetSizePixel();
+ m_xPage->setPosSize( aPos.X() + 1, aPos.Y() + 1,
+ aSize.Width() - 2, aSize.Height() - 2, awt::PosSize::POSSIZE );
+ if ( m_sEventHdl.getLength() > 0 )
+ DispatchAction( C2U("initialize") );
+ }
+ }
+
+ if ( m_xPage.is() )
+ {
+ m_xPage->setVisible( sal_True );
+ m_bIsWindowHidden = false;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ExtensionsTabPage::DeactivatePage()
+{
+ TabPage::DeactivatePage();
+
+ if ( m_xPage.is() )
+ m_xPage->setVisible( sal_False );
+}
+
+// -----------------------------------------------------------------------
+
+void ExtensionsTabPage::ResetPage()
+{
+ DispatchAction( C2U("back") );
+ ActivatePage();
+}
+
+// -----------------------------------------------------------------------
+
+void ExtensionsTabPage::SavePage()
+{
+ DispatchAction( C2U("ok") );
+}
+
+// -----------------------------------------------------------------------
+
+void ExtensionsTabPage::HideWindow()
+{
+ if ( !m_bIsWindowHidden && m_xPage.is() )
+ {
+ m_xPage->setVisible( sal_False );
+ m_bIsWindowHidden = true;
+ }
+}
+
diff --git a/cui/source/options/treeopt.hrc b/cui/source/options/treeopt.hrc
new file mode 100644
index 000000000000..7f8fab812dc2
--- /dev/null
+++ b/cui/source/options/treeopt.hrc
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: treeopt.hrc,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svtools/controldims.hrc>
+
+#define PB_OK 1
+#define PB_CANCEL 2
+#define PB_HELP 3
+#define PB_BACK 4
+#define TLB_PAGES 5
+#define FT_HELPTEXT 6
+#define STR_HELPTEXTS 7
+#define IMG_LIST 8
+#define IMG_HELP 9
+#define FT_PAGE_TITLE 10
+#define FL_LINE_1 11
+
+#define BMP_ROOT_CLOSED 17
+#define BMP_ROOT_OPENED 18
+#define FB_BORDER 19
+
+#define IMG_HINT 20
+#define FT_HINT 21
+#define CB_DISABLE 22
+#define BTN_HINT 23
+#define ST_LOAD_ERROR 24
+
+#define STR_GENERAL_PAGES_START 1
+#define STR_GENERAL (STR_GENERAL_PAGES_START)
+#define STR_MISC_PAGE (STR_GENERAL_PAGES_START + 1)
+#define STR_DESKTOP_PAGE (STR_GENERAL_PAGES_START + 2)
+#define STR_VIEW_PAGE (STR_GENERAL_PAGES_START + 3)
+#define STR_FONT_PAGE (STR_GENERAL_PAGES_START + 4)
+#define STR_PRINT_PAGE (STR_GENERAL_PAGES_START + 5)
+#define STR_COLOR_PAGE (STR_GENERAL_PAGES_START + 6)
+#define STR_LING_PAGE (STR_GENERAL_PAGES_START + 7)
+#define STR_PATH_PAGE (STR_GENERAL_PAGES_START + 8)
+#define STR_SAVE_PAGE (STR_GENERAL_PAGES_START + 9)
+#define STR_USERDATA_PAGE (STR_GENERAL_PAGES_START + 10)
+
+#define FB_IMAGE 43
+
+
+// metrics
+
+#define WIDTH_PAGEFRAME 263
+#define HEIGHT_PAGEFRAME 191
+#define WIDTH_IMG_HELP 25
+#define HEIGHT_IMG_HELP 30
+
+#define COL_1 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define COL_2 (COL_1+0)
+#define COL_3 (COL_2+RSC_SP_GRP_SPACE_X)
+#define COL_11 (COL_3+WIDTH_PAGEFRAME)
+#define COL_12 (COL_11+RSC_SP_DLG_INNERBORDER_RIGHT)
+#define COL_10 (COL_11-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_9 (COL_10-RSC_SP_CTRL_GROUP_X)
+#define COL_8 (COL_9-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_7 (COL_8-RSC_SP_CTRL_GROUP_X)
+#define COL_6 (COL_7-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_5 (COL_6-RSC_SP_CTRL_GROUP_X)
+#define COL_4 (COL_5-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_3_1 (COL_3+RSC_SP_TBPG_INNERBORDER_LEFT)
+#define COL_3_3 (COL_3_1+WIDTH_IMG_HELP)
+#define COL_3_5 (COL_11-RSC_SP_TBPG_INNERBORDER_RIGHT)
+
+#define ROW_1 (RSC_SP_DLG_INNERBORDER_TOP)
+#define ROW_2 (ROW_1+HEIGHT_PAGEFRAME)
+#define ROW_3 (ROW_2+RSC_SP_CTRL_GROUP_Y)
+#define ROW_4 (ROW_3+RSC_CD_PUSHBUTTON_HEIGHT)
+#define ROW_5 (ROW_4+RSC_SP_DLG_INNERBORDER_BOTTOM)
+#define ROW_1_1 (ROW_1+2)
+#define ROW_1_2 (ROW_1+12)
+#define ROW_1_3 (ROW_1_1+HEIGHT_IMG_HELP+2)
+#define ROW_1_4 (ROW_1_3+8)
+
diff --git a/cui/source/options/treeopt.src b/cui/source/options/treeopt.src
new file mode 100644
index 000000000000..05a67948da04
--- /dev/null
+++ b/cui/source/options/treeopt.src
@@ -0,0 +1,387 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: treeopt.src,v $
+ * $Revision: 1.22 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "treeopt.hrc"
+#include <cuires.hrc>
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+
+#define IMAGE_STDBTN_COLOR Color { Red = 0xC000; Green = 0xC000; Blue = 0xC000; }
+
+ModalDialog RID_OFADLG_OPTIONS_TREE
+{
+ HelpID = HID_OFADLG_OPTIONS_TREE;
+ Moveable = TRUE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+
+ Size = MAP_APPFONT ( COL_12 , ROW_5 ) ;
+ Text [ en-US ] = "Options";
+
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( COL_4, ROW_3 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( COL_6, ROW_3 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( COL_8, ROW_3 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_BACK
+ {
+ Pos = MAP_APPFONT ( COL_10, ROW_3 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Back" ;
+ };
+ //TreeListBox
+ Control TLB_PAGES
+ {
+ Pos = MAP_APPFONT ( COL_1, ROW_1 ) ;
+ Size = MAP_APPFONT ( (COL_2-COL_1), (ROW_4-ROW_1) );
+ TabStop = TRUE ;
+ Border = TRUE;
+ };
+ Control FB_BORDER
+ {
+ Pos = MAP_APPFONT ( COL_3, ROW_1 ) ;
+ Size = MAP_APPFONT ( WIDTH_PAGEFRAME, HEIGHT_PAGEFRAME ) ;
+ Hide = TRUE;
+ };
+ FixedImage IMG_HELP
+ {
+ Pos = MAP_APPFONT ( COL_3_1, ROW_1_1 ) ;
+ Size = MAP_APPFONT ( WIDTH_IMG_HELP, HEIGHT_IMG_HELP ) ;
+ Hide = TRUE;
+ };
+ FixedText FT_PAGE_TITLE
+ {
+ Pos = MAP_APPFONT ( COL_3_3, ROW_1_2 ) ;
+ Size = MAP_APPFONT ( (COL_3_5-COL_3_3), 15 ) ;
+ Hide = TRUE;
+ };
+ FixedLine FL_LINE_1
+ {
+ Pos = MAP_APPFONT ( COL_3_1 , ROW_1_3 ) ;
+ Size = MAP_APPFONT ( (COL_3_5-COL_3_1), 1 ) ;
+ Comment = "Trennlinie" ;
+ Hide = TRUE;
+ };
+ FixedText FT_HELPTEXT
+ {
+ Pos = MAP_APPFONT ( COL_3_3, ROW_1_4 ) ;
+ Size = MAP_APPFONT ( (COL_3_5-COL_3_3), (HEIGHT_PAGEFRAME-ROW_1_4-1) ) ;
+ WordBreak = TRUE;
+ Hide = TRUE;
+ };
+ String ST_LOAD_ERROR
+ {
+ Text [ en-US ] = "The selected module could not be loaded.";
+ };
+ StringArray STR_HELPTEXTS
+ {
+ ItemList [ en-US ] =
+ {
+ < "This dialog is used to define general settings when working with %PRODUCTNAME. Enter your personal data, the defaults to be used when saving documents, and paths to important files. These settings will be saved automatically and used in later sessions as well."; SID_GENERAL_OPTIONS; > ;
+ < "This is where you make settings concerning language and writing aids for your work with %PRODUCTNAME."; SID_LANGUAGE_OPTIONS; > ;
+ < "This is where you configure %PRODUCTNAME for the Internet. You can define search engines or save your proxy settings." ; SID_INET_DLG; > ;
+ < "This is where you specify various settings for text documents. These settings determine how your text documents are handled in %PRODUCTNAME and are valid for all new %PRODUCTNAME Writer documents. You can also define a few settings for the active text document if you save it afterwards." ; SID_SW_EDITOPTIONS; > ;
+ < "This is where you define the basic settings for %PRODUCTNAME documents in HTML format. For example, you decide which contents should be displayed on the screen or printed, how the pages are scrolled on the screen, in which color keywords are highlighted in the source text and much more." ; SID_SW_ONLINEOPTIONS; > ;
+ < "This is where you define various global settings for spreadsheets. For example, you can define which contents should be displayed and in which direction the cursor will move after you enter data in a cell. You also define sort lists, the number of the decimal places displayed, etc." ; SID_SC_EDITOPTIONS; > ;
+ < "This is where you define the settings that apply to all newly saved presentations. Among other things, you decide which contents are displayed on the slides, which default unit of measure is used, if and how grid alignment is used, and if notes and handouts are always printed." ; SID_SD_EDITOPTIONS; > ;
+ < "This is where you define the settings for drawing documents. Among other things, you determine which contents are displayed on the pages, which scale is used, if and how grid alignment is used, and which contents are printed by default." ; SID_SD_GRAPHIC_OPTIONS; > ;
+ < "This is where you select the print format and print options for all newly saved formula documents. These options take effect when you want to print a formula directly from %PRODUCTNAME Math." ; SID_SM_EDITOPTIONS; > ;
+ < "This is where you specify general default settings for your %PRODUCTNAME Charts. Set the colors you want for all new charts." ; SID_SCH_EDITOPTIONS; > ;
+ < "This is where you define general settings for accessing external data sources."; SID_SB_STARBASEOPTIONS; > ;
+ < "This is where you define general settings for opening and saving documents in external formats. You can control the behavior of macros or OLE objects in Microsoft Office documents or define settings for HTML documents." ; SID_FILTER_DLG; > ;
+ };
+ };
+ Bitmap BMP_ROOT_CLOSED
+ {
+ File = "plus.bmp" ;
+ };
+ Bitmap BMP_ROOT_OPENED
+ {
+ File = "minus.bmp" ;
+ };
+};
+
+Resource RID_OFADLG_OPTIONS_TREE_PAGES
+{
+ StringArray SID_GENERAL_OPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "%PRODUCTNAME" ; 0; > ;
+ < "User Data" ; RID_SFXPAGE_GENERAL; > ;
+ < "General" ; OFA_TP_MISC; > ;
+ < "Memory" ; OFA_TP_MEMORY; > ;
+ < "View" ; OFA_TP_VIEW ; > ;
+ < "Print" ; RID_SFXPAGE_PRINTOPTIONS; > ;
+ < "Paths" ; RID_SFXPAGE_PATH; > ;
+ < "Colors" ; RID_SVXPAGE_COLOR; > ;
+ < "Fonts" ; RID_SVX_FONT_SUBSTITUTION ; > ;
+ < "Security" ; RID_SVXPAGE_INET_SECURITY ; > ;
+ < "Appearance" ; RID_SVXPAGE_COLORCONFIG ; > ;
+ < "Accessibility" ; RID_SVXPAGE_ACCESSIBILITYCONFIG ; > ;
+ < "Java" ; RID_SVXPAGE_OPTIONS_JAVA ; > ;
+ < "Network Identity" ; RID_SVXPAGE_SSO ; > ;
+ < "Online Update" ; RID_SVXPAGE_ONLINEUPDATE ; > ;
+ < "" ; RID_SVXPAGE_IMPROVEMENT ; > ;
+ };
+ };
+ StringArray SID_LANGUAGE_OPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "Language Settings" ; 0; > ;
+ < "Languages"; OFA_TP_LANGUAGES; > ;
+ < "Writing Aids" ; RID_SFXPAGE_LINGU; > ;
+ < "Searching in Japanese" ; RID_SVXPAGE_JSEARCH_OPTIONS; > ;
+ < "Asian Layout" ; RID_SVXPAGE_ASIAN_LAYOUT; > ;
+ < "Complex Text Layout" ; RID_SVXPAGE_OPTIONS_CTL; >;
+ };
+ };
+ StringArray SID_INET_DLG
+ {
+ //modified by jmeng begin
+ ItemList [ en-US ] =
+ {
+ < "Internet" ; 0; > ;
+ < "Proxy" ; RID_SVXPAGE_INET_PROXY; > ;
+ < "Search" ; RID_SVXPAGE_INET_SEARCH; > ;
+ < "E-mail" ; RID_SVXPAGE_INET_MAIL; > ;
+ < "Browser Plug-in" ; RID_SVXPAGE_INET_MOZPLUGIN; > ;
+ };
+ //modified by jmeng end
+ };
+ StringArray SID_SW_EDITOPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "%PRODUCTNAME Writer" ; 0; > ;
+ < "General" ; RID_SW_TP_OPTLOAD_PAGE ; > ;
+ < "View" ; RID_SW_TP_CONTENT_OPT ;> ;
+ < "Formatting Aids" ; RID_SW_TP_OPTSHDWCRSR ; > ;
+ < "Grid" ; RID_SVXPAGE_GRID ; > ;
+ < "Basic Fonts (Western)" ;RID_SW_TP_STD_FONT ; > ;
+ < "Basic Fonts (Asian)" ;RID_SW_TP_STD_FONT_CJK ; > ;
+ < "Basic Fonts (CTL)" ; RID_SW_TP_STD_FONT_CTL ; > ;
+ < "Print" ; RID_SW_TP_OPTPRINT_PAGE ; > ;
+ < "Table" ; RID_SW_TP_OPTTABLE_PAGE ; > ;
+ < "Changes" ; RID_SW_TP_REDLINE_OPT ; > ;
+ < "Compatibility" ; RID_SW_TP_OPTCOMPATIBILITY_PAGE ; > ;
+ < "AutoCaption" ; RID_SW_TP_OPTCAPTION_PAGE ; > ;
+ < "Mail Merge E-mail" ; RID_SW_TP_MAILCONFIG ; >;
+ };
+ };
+ StringArray SID_SW_ONLINEOPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "%PRODUCTNAME Writer/Web" ; 0; > ;
+ < "View" ; RID_SW_TP_HTML_CONTENT_OPT ;> ;
+ < "Formatting Aids" ; RID_SW_TP_HTML_OPTSHDWCRSR ; > ;
+ < "Grid" ; RID_SW_TP_HTML_OPTGRID_PAGE ; > ;
+ < "Print" ; RID_SW_TP_HTML_OPTPRINT_PAGE ; > ;
+ < "Table" ; RID_SW_TP_HTML_OPTTABLE_PAGE ; > ;
+ < "Background" ; RID_SW_TP_BACKGROUND ; > ;
+ };
+ };
+ StringArray SID_SM_EDITOPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "%PRODUCTNAME Math" ; 0; > ;
+ < "Settings" ; SID_SM_TP_PRINTOPTIONS;> ;
+ };
+ };
+ StringArray SID_SC_EDITOPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "%PRODUCTNAME Calc" ; 0; > ;
+ < "General" ; SID_SC_TP_LAYOUT ;> ;
+ < "View" ; SID_SC_TP_CONTENT ;> ;
+ < "International" ; RID_OFA_TP_INTERNATIONAL ;> ;
+ < "Calculate" ; SID_SC_TP_CALC ;> ;
+ < "Sort Lists" ; SID_SC_TP_USERLISTS ;> ;
+ < "Changes" ; SID_SC_TP_CHANGES ;> ;
+ < "Grid" ; SID_SC_TP_GRID ;> ;
+ < "Print" ; RID_SC_TP_PRINT ;> ;
+ };
+ };
+ StringArray SID_SD_EDITOPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "%PRODUCTNAME Impress" ; 0; > ;
+ < "General"; SID_SI_TP_MISC ; > ;
+ < "View" ; SID_SI_TP_CONTENTS ; > ;
+ < "Grid" ; SID_SI_TP_SNAP ; > ;
+ < "Print" ; SID_SI_TP_PRINT ; > ;
+ };
+ };
+ StringArray SID_SD_GRAPHIC_OPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "%PRODUCTNAME Draw" ; 0; > ;
+ < "General" ; SID_SD_TP_MISC ; > ;
+ < "View" ; SID_SD_TP_CONTENTS ; > ;
+ < "Grid" ; SID_SD_TP_SNAP ; > ;
+ < "Print" ; SID_SD_TP_PRINT ; > ;
+ };
+ };
+ StringArray SID_SCH_EDITOPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "Charts" ; 0; > ;
+ < "Default Colors" ; RID_OPTPAGE_CHART_DEFCOLORS ; > ;
+ };
+ };
+ StringArray SID_FILTER_DLG
+ {
+ ItemList [ en-US ] =
+ {
+ < "Load/Save" ; 0; > ;
+ < "General" ; RID_SFXPAGE_SAVE; > ;
+ < "VBA Properties" ; SID_OPTFILTER_MSOFFICE; > ;
+ < "Microsoft Office" ; RID_OFAPAGE_MSFILTEROPT2; > ;
+ < "HTML Compatibility" ; RID_OFAPAGE_HTMLOPT ; > ;
+ };
+ };
+ StringArray SID_SB_STARBASEOPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "%PRODUCTNAME Base" ; 0; > ;
+ < "Connections" ; SID_SB_CONNECTIONPOOLING; > ;
+ < "Databases" ; SID_SB_DBREGISTEROPTIONS; > ;
+ };
+ };
+};
+String RID_RIDER_SLL_SITE
+{
+ Text [ en-US ] = "Site certificates" ;
+};
+String RID_RIDER_SLL_PERSONAL
+{
+ Text [ en-US ] = "Personal certificates" ;
+};
+
+// RID_OFADLG_OPTIONS_TREE_WARNING ---------------------------------------
+
+ModalDialog RID_OFADLG_OPTIONS_TREE_HINT
+{
+ OutputSize = TRUE;
+ Size = MAP_APPFONT( 240, 105 );
+ Moveable = TRUE;
+ Closeable = TRUE;
+ FixedImage IMG_HINT
+ {
+ Pos = MAP_APPFONT( 6, 6 );
+ Size = MAP_APPFONT( 30, 30 );
+ };
+ FixedText FT_HINT
+ {
+ Pos = MAP_APPFONT( 39, 6 );
+ Size = MAP_APPFONT( 195, 60 );
+ WordBreak = TRUE;
+ Text [ en-US ] = "Please note: the settings displayed refer to the internal browser of %PRODUCTNAME (%PRODUCTNAME Writer/Web). In \"Tools - Options - Browser - External Browser\" the use of a different browser has been activated. In order to be able to use the same settings in other browsers you need to define these in the external browser settings.";
+ };
+ CheckBox CB_DISABLE
+ {
+ Pos = MAP_APPFONT( 39, 69 );
+ Size = MAP_APPFONT( 195, 12 );
+ Text [ en-US ] = "~Do not show information again";
+ };
+ OKButton BTN_HINT
+ {
+ Pos = MAP_APPFONT( 95, 85 );
+ Size = MAP_APPFONT( 50, 14 );
+ };
+};
+
+// ******************************************************************* EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx
new file mode 100644
index 000000000000..162758a524fe
--- /dev/null
+++ b/cui/source/options/webconninfo.cxx
@@ -0,0 +1,377 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: webconninfo.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+#include <dialmgr.hxx>
+#include <cuires.hrc>
+#include <com/sun/star/task/UrlRecord.hpp>
+#include <com/sun/star/task/XPasswordContainer.hpp>
+#include <com/sun/star/task/XMasterPasswordHandling.hpp>
+#include "com/sun/star/task/XUrlContainer.hpp"
+#include <comphelper/processfactory.hxx>
+#include <comphelper/docpasswordrequest.hxx>
+#include "webconninfo.hxx"
+#include "webconninfo.hrc"
+
+using namespace ::com::sun::star;
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+// class PasswordTable ---------------------------------------------------
+
+PasswordTable::PasswordTable( Window* pParent, const ResId& rResId ) :
+ SvxSimpleTable( pParent, rResId )
+{
+ SetWindowBits( GetStyle() | WB_NOINITIALSELECTION );
+}
+
+void PasswordTable::InsertHeaderItem( USHORT nColumn, const String& rText, HeaderBarItemBits nBits )
+{
+ GetTheHeaderBar()->InsertItem( nColumn, rText, 0, nBits );
+}
+
+void PasswordTable::ResetTabs()
+{
+ SetTabs();
+}
+
+void PasswordTable::Resort( bool bForced )
+{
+ USHORT nColumn = GetSelectedCol();
+ if ( 0 == nColumn || bForced ) // only the first column is sorted
+ {
+ HeaderBarItemBits nBits = GetTheHeaderBar()->GetItemBits(1);
+ BOOL bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
+ SvSortMode eMode = SortAscending;
+
+ if ( bUp )
+ {
+ nBits &= ~HIB_UPARROW;
+ nBits |= HIB_DOWNARROW;
+ eMode = SortDescending;
+ }
+ else
+ {
+ nBits &= ~HIB_DOWNARROW;
+ nBits |= HIB_UPARROW;
+ }
+ GetTheHeaderBar()->SetItemBits( 1, nBits );
+ SvTreeList* pListModel = GetModel();
+ pListModel->SetSortMode( eMode );
+ pListModel->Resort();
+ }
+}
+
+// class WebConnectionInfoDialog -----------------------------------------
+
+// -----------------------------------------------------------------------
+WebConnectionInfoDialog::WebConnectionInfoDialog( Window* pParent ) :
+ ModalDialog( pParent, CUI_RES( RID_SVXDLG_WEBCONNECTION_INFO ) )
+ ,m_aNeverShownFI ( this, CUI_RES( FI_NEVERSHOWN ) )
+ ,m_aPasswordsLB ( this, CUI_RES( LB_PASSWORDS ) )
+ ,m_aRemoveBtn ( this, CUI_RES( PB_REMOVE ) )
+ ,m_aRemoveAllBtn ( this, CUI_RES( PB_REMOVEALL ) )
+ ,m_aChangeBtn ( this, CUI_RES( PB_CHANGE ) )
+ ,m_aButtonsFL ( this, CUI_RES( FL_BUTTONS ) )
+ ,m_aCloseBtn ( this, CUI_RES( PB_CLOSE ) )
+ ,m_aHelpBtn ( this, CUI_RES( PB_HELP ) )
+ ,m_nPos ( -1 )
+{
+ static long aStaticTabs[]= { 3, 0, 150, 250 };
+ m_aPasswordsLB.SetTabs( aStaticTabs );
+ m_aPasswordsLB.InsertHeaderItem( 1, CUI_RESSTR( STR_WEBSITE ),
+ HIB_LEFT | HIB_VCENTER | HIB_FIXEDPOS | HIB_CLICKABLE | HIB_UPARROW );
+ m_aPasswordsLB.InsertHeaderItem( 2, CUI_RESSTR( STR_USERNAME ),
+ HIB_LEFT | HIB_VCENTER | HIB_FIXEDPOS );
+ m_aPasswordsLB.ResetTabs();
+
+ FreeResource();
+
+ m_aPasswordsLB.SetHeaderBarClickHdl( LINK( this, WebConnectionInfoDialog, HeaderBarClickedHdl ) );
+ m_aRemoveBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, RemovePasswordHdl ) );
+ m_aRemoveAllBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, RemoveAllPasswordsHdl ) );
+ m_aChangeBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, ChangePasswordHdl ) );
+
+ // one button too small for its text?
+ sal_Int32 i = 0;
+ long nBtnTextWidth = 0;
+ Window* pButtons[] = { &m_aRemoveBtn, &m_aRemoveAllBtn, &m_aChangeBtn };
+ Window** pButton = pButtons;
+ const sal_Int32 nBCount = sizeof( pButtons ) / sizeof( pButtons[ 0 ] );
+ for ( ; i < nBCount; ++i, ++pButton )
+ {
+ long nTemp = (*pButton)->GetCtrlTextWidth( (*pButton)->GetText() );
+ if ( nTemp > nBtnTextWidth )
+ nBtnTextWidth = nTemp;
+ }
+ nBtnTextWidth = nBtnTextWidth * 115 / 100; // a little offset
+ long nButtonWidth = m_aRemoveBtn.GetSizePixel().Width();
+ if ( nBtnTextWidth > nButtonWidth )
+ {
+ // so make the buttons broader and its control in front of it smaller
+ long nDelta = nBtnTextWidth - nButtonWidth;
+ pButton = pButtons;
+ for ( i = 0; i < nBCount; ++i, ++pButton )
+ {
+ Point aNewPos = (*pButton)->GetPosPixel();
+ if ( &m_aRemoveAllBtn == (*pButton) )
+ aNewPos.X() += nDelta;
+ else if ( &m_aChangeBtn == (*pButton) )
+ aNewPos.X() -= nDelta;
+ Size aNewSize = (*pButton)->GetSizePixel();
+ aNewSize.Width() += nDelta;
+ (*pButton)->SetPosSizePixel( aNewPos, aNewSize );
+ }
+ }
+
+ FillPasswordList();
+
+ m_aRemoveBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, RemovePasswordHdl ) );
+ m_aRemoveAllBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, RemoveAllPasswordsHdl ) );
+ m_aChangeBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, ChangePasswordHdl ) );
+ m_aPasswordsLB.SetSelectHdl( LINK( this, WebConnectionInfoDialog, EntrySelectedHdl ) );
+
+ m_aRemoveBtn.Enable( FALSE );
+ m_aChangeBtn.Enable( FALSE );
+
+ HeaderBarClickedHdl( NULL );
+}
+
+// -----------------------------------------------------------------------
+WebConnectionInfoDialog::~WebConnectionInfoDialog()
+{
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( WebConnectionInfoDialog, HeaderBarClickedHdl, SvxSimpleTable*, pTable )
+{
+ m_aPasswordsLB.Resort( NULL == pTable );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+void WebConnectionInfoDialog::FillPasswordList()
+{
+ try
+ {
+ uno::Reference< task::XMasterPasswordHandling > xMasterPasswd(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ),
+ uno::UNO_QUERY );
+
+ if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() )
+ {
+ uno::Reference< task::XPasswordContainer > xPasswdContainer( xMasterPasswd, uno::UNO_QUERY_THROW );
+ uno::Reference< task::XInteractionHandler > xInteractionHandler(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.InteractionHandler" ) ) ),
+ uno::UNO_QUERY_THROW );
+
+ uno::Sequence< task::UrlRecord > aURLEntries = xPasswdContainer->getAllPersistent( xInteractionHandler );
+ sal_Int32 nCount = 0;
+ for ( sal_Int32 nURLInd = 0; nURLInd < aURLEntries.getLength(); nURLInd++ )
+ {
+ for ( sal_Int32 nUserInd = 0; nUserInd < aURLEntries[nURLInd].UserList.getLength(); nUserInd++ )
+ {
+ ::rtl::OUString aUIEntry( aURLEntries[nURLInd].Url );
+ aUIEntry += ::rtl::OUString::valueOf( (sal_Unicode)'\t' );
+ aUIEntry += aURLEntries[nURLInd].UserList[nUserInd].UserName;
+ SvLBoxEntry* pEntry = m_aPasswordsLB.InsertEntry( aUIEntry );
+ pEntry->SetUserData( (void*)(nCount++) );
+ }
+ }
+
+ // remember pos of first url container entry.
+ m_nPos = nCount;
+
+ uno::Reference< task::XUrlContainer > xUrlContainer(
+ xPasswdContainer, uno::UNO_QUERY_THROW );
+
+ uno::Sequence< rtl::OUString > aUrls
+ = xUrlContainer->getUrls( sal_True /* OnlyPersistent */ );
+
+ for ( sal_Int32 nURLIdx = 0; nURLIdx < aUrls.getLength(); nURLIdx++ )
+ {
+ ::rtl::OUString aUIEntry( aUrls[ nURLIdx ] );
+ aUIEntry += ::rtl::OUString::valueOf( (sal_Unicode)'\t' );
+ aUIEntry += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*" ) );
+ SvLBoxEntry* pEntry = m_aPasswordsLB.InsertEntry( aUIEntry );
+ pEntry->SetUserData( (void*)(nCount++) );
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {}
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( WebConnectionInfoDialog, RemovePasswordHdl, PushButton*, EMPTYARG )
+{
+ try
+ {
+ SvLBoxEntry* pEntry = m_aPasswordsLB.GetCurEntry();
+ if ( pEntry )
+ {
+ ::rtl::OUString aURL = m_aPasswordsLB.GetEntryText( pEntry, 0 );
+ ::rtl::OUString aUserName = m_aPasswordsLB.GetEntryText( pEntry, 1 );
+
+ uno::Reference< task::XPasswordContainer > xPasswdContainer(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.task.PasswordContainer" ) ) ),
+ uno::UNO_QUERY_THROW );
+
+ sal_Int32 nPos = (sal_Int32)(sal_IntPtr)pEntry->GetUserData();
+ if ( nPos < m_nPos )
+ {
+ xPasswdContainer->removePersistent( aURL, aUserName );
+ }
+ else
+ {
+ uno::Reference< task::XUrlContainer > xUrlContainer(
+ xPasswdContainer, uno::UNO_QUERY_THROW );
+ xUrlContainer->removeUrl( aURL );
+ }
+ m_aPasswordsLB.RemoveEntry( pEntry );
+ }
+ }
+ catch( uno::Exception& )
+ {}
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( WebConnectionInfoDialog, RemoveAllPasswordsHdl, PushButton*, EMPTYARG )
+{
+ try
+ {
+ uno::Reference< task::XPasswordContainer > xPasswdContainer(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.task.PasswordContainer" ) ) ),
+ uno::UNO_QUERY_THROW );
+
+ // should the master password be requested before?
+ xPasswdContainer->removeAllPersistent();
+
+ uno::Reference< task::XUrlContainer > xUrlContainer(
+ xPasswdContainer, uno::UNO_QUERY_THROW );
+ uno::Sequence< rtl::OUString > aUrls
+ = xUrlContainer->getUrls( sal_True /* OnlyPersistent */ );
+ for ( sal_Int32 nURLIdx = 0; nURLIdx < aUrls.getLength(); nURLIdx++ )
+ xUrlContainer->removeUrl( aUrls[ nURLIdx ] );
+
+ m_aPasswordsLB.Clear();
+ }
+ catch( uno::Exception& )
+ {}
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( WebConnectionInfoDialog, ChangePasswordHdl, PushButton*, EMPTYARG )
+{
+ try
+ {
+ SvLBoxEntry* pEntry = m_aPasswordsLB.GetCurEntry();
+ if ( pEntry )
+ {
+ ::rtl::OUString aURL = m_aPasswordsLB.GetEntryText( pEntry, 0 );
+ ::rtl::OUString aUserName = m_aPasswordsLB.GetEntryText( pEntry, 1 );
+
+ ::comphelper::DocPasswordRequest* pPasswordRequest
+ = new ::comphelper::DocPasswordRequest(
+ ::comphelper::DocPasswordRequestType_STANDARD,
+ task::PasswordRequestMode_PASSWORD_CREATE, aURL );
+ uno::Reference< task::XInteractionRequest > rRequest( pPasswordRequest );
+
+ uno::Reference< task::XInteractionHandler > xInteractionHandler(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.task.InteractionHandler" ) ) ),
+ uno::UNO_QUERY_THROW );
+ xInteractionHandler->handle( rRequest );
+
+ if ( pPasswordRequest->isPassword() )
+ {
+ String aNewPass = pPasswordRequest->getPassword();
+ uno::Sequence< ::rtl::OUString > aPasswd( 1 );
+ aPasswd[0] = aNewPass;
+
+ uno::Reference< task::XPasswordContainer > xPasswdContainer(
+ comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.task.PasswordContainer" ) ) ),
+ uno::UNO_QUERY_THROW );
+ xPasswdContainer->addPersistent(
+ aURL, aUserName, aPasswd, xInteractionHandler );
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {}
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( WebConnectionInfoDialog, EntrySelectedHdl, void*, EMPTYARG )
+{
+ SvLBoxEntry* pEntry = m_aPasswordsLB.GetCurEntry();
+ if ( !pEntry )
+ {
+ m_aRemoveBtn.Enable( FALSE );
+ m_aChangeBtn.Enable( FALSE );
+ }
+ else
+ {
+ m_aRemoveBtn.Enable( TRUE );
+
+ // url container entries (-> use system credentials) have
+ // no password
+ sal_Int32 nPos = (sal_Int32)(sal_IntPtr)pEntry->GetUserData();
+ m_aChangeBtn.Enable( nPos < m_nPos );
+ }
+
+ return 0;
+}
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
diff --git a/cui/source/options/webconninfo.hrc b/cui/source/options/webconninfo.hrc
new file mode 100644
index 000000000000..de040b302d89
--- /dev/null
+++ b/cui/source/options/webconninfo.hrc
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: webconninfo.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_WEBCONNINFO_HRC
+#define _SVX_WEBCONNINFO_HRC
+
+#define FI_NEVERSHOWN 10
+#define LB_PASSWORDS 11
+#define PB_REMOVE 12
+#define PB_REMOVEALL 13
+#define PB_CHANGE 14
+#define FL_BUTTONS 15
+// #define PB_OK 16
+#define PB_CLOSE 17
+#define PB_HELP 18
+
+#define STR_WEBSITE 10
+#define STR_USERNAME 11
+
+#define DLG_WIDTH 260
+#define DLG_HEIGHT 150
+
+#define COL_0 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define COL_1 (COL_0+RSC_CD_PUSHBUTTON_WIDTH+RSC_SP_CTRL_GROUP_X)
+#define COL_2 (DLG_WIDTH-RSC_SP_DLG_INNERBORDER_LEFT)
+#define COL_C (COL_2-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_B (COL_C-RSC_SP_CTRL_X-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_A (COL_B-RSC_SP_CTRL_GROUP_X-RSC_CD_PUSHBUTTON_WIDTH)
+
+#define ROW_0 (RSC_SP_DLG_INNERBORDER_TOP)
+#define ROW_1 (ROW_0+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_5 (DLG_HEIGHT-RSC_SP_DLG_INNERBORDER_BOTTOM-RSC_CD_PUSHBUTTON_HEIGHT)
+#define ROW_4 (ROW_5-RSC_SP_FLGR_SPACE_Y-RSC_CD_FIXEDLINE_HEIGHT)
+#define ROW_3 (ROW_4-RSC_SP_FLGR_SPACE_Y-RSC_CD_PUSHBUTTON_HEIGHT)
+#define ROW_2 (ROW_3-RSC_SP_GRP_SPACE_Y)
+
+#endif // #ifndef _SVX_WEBCONNINFO_HRC
+
diff --git a/cui/source/options/webconninfo.hxx b/cui/source/options/webconninfo.hxx
new file mode 100644
index 000000000000..f24b9f0dd4c8
--- /dev/null
+++ b/cui/source/options/webconninfo.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: webconninfo.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_WEBCONNINFO_HXX
+#define _SVX_WEBCONNINFO_HXX
+
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <svtools/stdctrl.hxx>
+#include <svx/simptabl.hxx>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ class PasswordTable : public SvxSimpleTable
+ {
+ public:
+ PasswordTable( Window* pParent, const ResId& rResId );
+
+ void InsertHeaderItem( USHORT nColumn, const String& rText, HeaderBarItemBits nBits );
+ void ResetTabs();
+ void Resort( bool bForced );
+ };
+
+ //====================================================================
+ //= class WebConnectionIfoDialog
+ //====================================================================
+ class WebConnectionInfoDialog : public ModalDialog
+ {
+ private:
+ FixedInfo m_aNeverShownFI;
+ PasswordTable m_aPasswordsLB;
+ PushButton m_aRemoveBtn;
+ PushButton m_aRemoveAllBtn;
+ PushButton m_aChangeBtn;
+ FixedLine m_aButtonsFL;
+ CancelButton m_aCloseBtn;
+ HelpButton m_aHelpBtn;
+ sal_Int32 m_nPos;
+
+ DECL_LINK( HeaderBarClickedHdl, SvxSimpleTable* );
+ DECL_LINK( RemovePasswordHdl, PushButton* );
+ DECL_LINK( RemoveAllPasswordsHdl, PushButton* );
+ DECL_LINK( ChangePasswordHdl, PushButton* );
+ DECL_LINK( EntrySelectedHdl, void* );
+
+ void FillPasswordList();
+
+ public:
+ WebConnectionInfoDialog( Window* pParent );
+ ~WebConnectionInfoDialog();
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // #ifndef _SVX_WEBCONNINFO_HXX
+
diff --git a/cui/source/options/webconninfo.src b/cui/source/options/webconninfo.src
new file mode 100644
index 000000000000..9252a698b29c
--- /dev/null
+++ b/cui/source/options/webconninfo.src
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: webconninfo.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// include --------------------------------------------------------------
+
+#include <svtools/controldims.hrc>
+#include "webconninfo.hrc"
+#include <cuires.hrc>
+#include "helpid.hrc"
+
+ModalDialog RID_SVXDLG_WEBCONNECTION_INFO
+{
+ HelpID = HID_DLG_WEBCONNECTION_INFO ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( DLG_WIDTH , DLG_HEIGHT ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "Stored Web Connection Information" ;
+ FixedText FI_NEVERSHOWN
+ {
+ Pos = MAP_APPFONT( COL_0, ROW_0 );
+ Size = MAP_APPFONT( COL_2-COL_0, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text [ en-US ] = "Web login information (passwords are never shown)";
+ };
+ Control LB_PASSWORDS
+ {
+ Pos = MAP_APPFONT ( COL_0 , ROW_1 ) ;
+ Size = MAP_APPFONT ( COL_2-COL_0 , ROW_2-ROW_1 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_REMOVE
+ {
+ Pos = MAP_APPFONT ( COL_0 , ROW_3 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ Text [ en-US ] = "Remove";
+ };
+ PushButton PB_REMOVEALL
+ {
+ Pos = MAP_APPFONT ( COL_1 , ROW_3 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ Text [ en-US ] = "Remove All";
+ };
+ PushButton PB_CHANGE
+ {
+ Pos = MAP_APPFONT ( COL_C , ROW_3 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ Text [ en-US ] = "Change Password...";
+ };
+ FixedLine FL_BUTTONS
+ {
+ Pos = MAP_APPFONT( 0, ROW_4 );
+ Size = MAP_APPFONT( DLG_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+ CancelButton PB_CLOSE
+ {
+ Pos = MAP_APPFONT ( COL_B , ROW_5 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ Text [ en-US ] = "Close";
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( COL_C , ROW_5 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+ String STR_WEBSITE
+ {
+ Text [ en-US ] = "Website";
+ };
+ String STR_USERNAME
+ {
+ Text [ en-US ] = "User name";
+ };
+};
+