summaryrefslogtreecommitdiff
path: root/svx/source/unodialogs
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/unodialogs')
-rw-r--r--svx/source/unodialogs/inc/buttongroup.hrc65
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx895
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hrc53
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx201
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.src184
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_direction_ids.hrc34
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_direction_tmpl.hrc51
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx285
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx143
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx201
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hrc44
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx90
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src117
-rw-r--r--svx/source/unodialogs/textconversiondlgs/export.map8
-rw-r--r--svx/source/unodialogs/textconversiondlgs/makefile.mk90
-rw-r--r--svx/source/unodialogs/textconversiondlgs/resid.cxx52
-rw-r--r--svx/source/unodialogs/textconversiondlgs/resid.hxx50
-rw-r--r--svx/source/unodialogs/textconversiondlgs/resids.hrc33
-rw-r--r--svx/source/unodialogs/textconversiondlgs/services.cxx70
19 files changed, 2666 insertions, 0 deletions
diff --git a/svx/source/unodialogs/inc/buttongroup.hrc b/svx/source/unodialogs/inc/buttongroup.hrc
new file mode 100644
index 000000000000..b99403b57e1f
--- /dev/null
+++ b/svx/source/unodialogs/inc/buttongroup.hrc
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _UNODIALOGS_BUTTONGROUP_HRC
+#define _UNODIALOGS_BUTTONGROUP_HRC
+
+#include "resids.hrc"
+
+#define PB_OK 1
+#define PB_CANCEL 1
+#define PB_HELP 1
+
+#define BUTTONGROUP_BUTTONWIDTH 40
+
+#define BUTTONS_OK_CANCEL_HELP( xRightPos, yTopPos, xOffset, yOffset ) \
+OKButton PB_OK \
+{ \
+ Pos = MAP_APPFONT ( xRightPos-BUTTONGROUP_BUTTONWIDTH-xOffset-xOffset , yTopPos ) ; \
+ Size = MAP_APPFONT ( BUTTONGROUP_BUTTONWIDTH , 14 ) ; \
+ TabStop = TRUE ; \
+ DefButton = TRUE ; \
+}; \
+CancelButton PB_CANCEL \
+{ \
+ Pos = MAP_APPFONT ( xRightPos-BUTTONGROUP_BUTTONWIDTH-xOffset , yTopPos+yOffset ) ; \
+ Size = MAP_APPFONT ( BUTTONGROUP_BUTTONWIDTH , 14 ) ; \
+ TabStop = TRUE ; \
+}; \
+HelpButton PB_HELP \
+{ \
+ Pos = MAP_APPFONT ( xRightPos-BUTTONGROUP_BUTTONWIDTH , yTopPos+yOffset+yOffset ) ; \
+ Size = MAP_APPFONT ( BUTTONGROUP_BUTTONWIDTH , 14 ) ; \
+ TabStop = TRUE ; \
+};
+
+#define BUTTONS_OK_CANCEL_HELP_STACKED( xRightPos ) \
+BUTTONS_OK_CANCEL_HELP( xRightPos, 6, 0, 17 )
+
+#define BUTTONS_OK_CANCEL_HELP_ABREAST( xRightPos, yTopPos ) \
+BUTTONS_OK_CANCEL_HELP( xRightPos, yTopPos, (BUTTONGROUP_BUTTONWIDTH+3), 0 )
+
+#endif
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
new file mode 100644
index 000000000000..dda324cb98d1
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
@@ -0,0 +1,895 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_svx.hxx"
+
+#include "chinese_dictionarydialog.hxx"
+#include "chinese_dictionarydialog.hrc"
+#include "resid.hxx"
+#include <cppuhelper/bootstrap.hxx>
+#include <com/sun/star/i18n/TextConversionOption.hpp>
+#include <com/sun/star/linguistic2/ConversionDictionaryType.hpp>
+#include <com/sun/star/linguistic2/ConversionPropertyType.hpp>
+#include <com/sun/star/linguistic2/XConversionDictionaryList.hpp>
+#include <com/sun/star/linguistic2/XConversionPropertyType.hpp>
+#include <com/sun/star/util/XFlushable.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+// header for class HeaderBar
+#include <svtools/headbar.hxx>
+// header for define RET_OK
+#include <vcl/msgbox.hxx>
+// header for class SvtLinguConfigItem
+#include <unotools/lingucfg.hxx>
+#include <unotools/linguprops.hxx>
+// header for class IntlWrapper
+#include <unotools/intlwrapper.hxx>
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
+#include <comphelper/processfactory.hxx>
+#endif
+// header for class Application
+#include <vcl/svapp.hxx>
+#ifndef _SVX_HELPID_HRC
+#include "helpid.hrc"
+#endif
+
+//disable compiler warning C4355: 'this' : used in base member initializer list
+#ifdef _MSC_VER
+# pragma warning (disable : 4355)
+#endif
+
+//.............................................................................
+namespace textconversiondlgs
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+#define HEADER_BAR_BITS ( HIB_LEFT | HIB_VCENTER | HIB_CLICKABLE | HIB_FIXED | HIB_FIXEDPOS )
+
+DictionaryList::DictionaryList( Window* pParent, const ResId& rResId)
+ : SvHeaderTabListBox( pParent, rResId )
+ , m_xDictionary(0)
+ , m_pHeaderBar(0)
+ , m_pPropertyTypeNameListBox(0)
+ , m_aToBeDeleted()
+ , m_nSortColumnIndex(0)
+{
+}
+
+DictionaryList::DictionaryList( Window* pParent )
+ : SvHeaderTabListBox( pParent, 0 )
+ , m_xDictionary(0)
+ , m_pHeaderBar(0)
+ , m_pPropertyTypeNameListBox(0)
+ , m_aToBeDeleted()
+ , m_nSortColumnIndex(0)
+{
+}
+
+String DictionaryList::getPropertyTypeName( sal_Int16 nConversionPropertyType ) const
+{
+ if(!m_pPropertyTypeNameListBox || !m_pPropertyTypeNameListBox->GetEntryCount())
+ return String();
+
+ USHORT nPos = static_cast<USHORT>( nConversionPropertyType )-1;
+ if(nPos<m_pPropertyTypeNameListBox->GetEntryCount())
+ return m_pPropertyTypeNameListBox->GetEntry(nPos);
+ return m_pPropertyTypeNameListBox->GetEntry(0);
+}
+
+String DictionaryList::makeTabString( const DictionaryEntry& rEntry ) const
+{
+ String aStr( rEntry.m_aTerm );
+ aStr += '\t';
+ aStr += String( rEntry.m_aMapping );
+ aStr += '\t';
+ aStr += getPropertyTypeName( rEntry.m_nConversionPropertyType );
+ return aStr;
+}
+
+void DictionaryList::initDictionaryControl( const Reference< linguistic2::XConversionDictionary>& xDictionary
+ , ListBox* pPropertyTypeNameListBox )
+{
+ SetWindowBits( WB_VSCROLL );
+ SetSelectionMode( SINGLE_SELECTION );
+ SetBorderStyle( WINDOW_BORDER_MONO );
+ SetHighlightRange();
+
+ if(m_xDictionary.is())
+ return;
+
+ m_xDictionary = xDictionary;
+ m_pPropertyTypeNameListBox = pPropertyTypeNameListBox;
+}
+
+void DictionaryList::save()
+{
+ if( !m_xDictionary.is() )
+ return;
+
+ Reference< linguistic2::XConversionPropertyType > xPropertyType( m_xDictionary, uno::UNO_QUERY );
+
+ sal_Int32 nN;
+ DictionaryEntry* pE;
+
+ for( nN = m_aToBeDeleted.size(); nN--; )
+ {
+ pE = m_aToBeDeleted[nN];
+ m_xDictionary->removeEntry( pE->m_aTerm, pE->m_aMapping );
+ }
+ for( nN = GetRowCount(); nN--; )
+ {
+ pE = getEntryOnPos( nN );
+ if(pE->m_bNewEntry)
+ {
+ try
+ {
+ m_xDictionary->addEntry( pE->m_aTerm, pE->m_aMapping );
+ xPropertyType->setPropertyType( pE->m_aTerm, pE->m_aMapping, pE->m_nConversionPropertyType );
+ }
+ catch( uno::Exception& )
+ {
+
+ }
+ }
+ }
+ Reference< util::XFlushable > xFlush( m_xDictionary, uno::UNO_QUERY );
+ if( xFlush.is() )
+ xFlush->flush();
+}
+
+void DictionaryList::deleteAll()
+{
+ sal_Int32 nN;
+ for( nN = GetRowCount(); nN--; )
+ deleteEntryOnPos( nN );
+ for( nN = m_aToBeDeleted.size(); nN--; )
+ {
+ DictionaryEntry* pE = m_aToBeDeleted[nN];
+ delete pE;
+ }
+ m_aToBeDeleted.clear();
+}
+
+void DictionaryList::refillFromDictionary( sal_Int32 nTextConversionOptions )
+{
+ deleteAll();
+
+ if(!m_xDictionary.is())
+ return;
+
+ Sequence< rtl::OUString > aLeftList( m_xDictionary->getConversionEntries( linguistic2::ConversionDirection_FROM_LEFT ) );
+ sal_Int32 nCount = aLeftList.getLength();
+
+ Reference< linguistic2::XConversionPropertyType > xPropertyType( m_xDictionary, uno::UNO_QUERY );
+
+ rtl::OUString aLeft, aRight;
+ sal_Int16 nConversionPropertyType;
+
+ for(sal_Int32 nN=0; nN<nCount; nN++)
+ {
+ aLeft = aLeftList[nN];
+ Sequence< rtl::OUString > aRightList( m_xDictionary->getConversions(
+ aLeft, 0, aLeft.getLength()
+ , linguistic2::ConversionDirection_FROM_LEFT, nTextConversionOptions ) );
+
+ if(aRightList.getLength()!=1)
+ {
+ OSL_ASSERT("The Chinese Translation Dictionary should have exactly one Mapping for each term.");
+ continue;
+ }
+
+ aRight = aRightList[0];
+ nConversionPropertyType = linguistic2::ConversionPropertyType::OTHER;
+ if(xPropertyType.is())
+ nConversionPropertyType = xPropertyType->getPropertyType(aLeft, aRight);
+
+ DictionaryEntry* pEntry = new DictionaryEntry( aLeft, aRight, nConversionPropertyType );
+ SvLBoxEntry* pLBEntry = InsertEntry( makeTabString( *pEntry ) );
+ pLBEntry->SetUserData( pEntry );
+ }
+
+ if( GetEntryCount() > 0 )
+ SelectRow( 0 );
+}
+
+DictionaryEntry* DictionaryList::getFirstSelectedEntry() const
+{
+ DictionaryEntry* pRet=0;
+ for( sal_Int32 nN=GetRowCount(); nN--; )
+ {
+ if( IsRowSelected( nN ) )
+ {
+ pRet = getEntryOnPos( nN );
+ break;
+ }
+ }
+ return pRet;
+}
+
+DictionaryEntry* DictionaryList::getEntryOnPos( sal_Int32 nPos ) const
+{
+ DictionaryEntry* pEntry=0;
+ SvLBoxEntry* pLBEntry = GetEntryOnPos( nPos );
+ if(pLBEntry)
+ pEntry = (DictionaryEntry*)pLBEntry->GetUserData();
+ return pEntry;
+}
+
+DictionaryEntry* DictionaryList::getTermEntry( const rtl::OUString& rTerm ) const
+{
+ DictionaryEntry* pE = 0;
+ for( sal_Int32 nN=GetRowCount(); nN--; )
+ {
+ pE = getEntryOnPos( nN );
+ if( pE && rTerm.equals( pE->m_aTerm ) )
+ return pE;
+ }
+ return 0;
+}
+
+bool DictionaryList::hasTerm( const rtl::OUString& rTerm ) const
+{
+ return getTermEntry(rTerm) !=0 ;
+}
+
+void DictionaryList::addEntry( const rtl::OUString& rTerm, const rtl::OUString& rMapping
+ , sal_Int16 nConversionPropertyType, ULONG nPos )
+{
+ if( hasTerm( rTerm ) )
+ return;
+
+ DictionaryEntry* pEntry = new DictionaryEntry( rTerm, rMapping, nConversionPropertyType, sal_True );
+ SvLBoxEntry* pLBEntry = InsertEntryToColumn( makeTabString( *pEntry ), nPos );
+ pLBEntry->SetUserData( pEntry );
+ SelectRow( GetEntryPos( pLBEntry ) );
+}
+
+void DictionaryList::deleteEntryOnPos( sal_Int32 nPos )
+{
+ SvLBoxEntry* pLBEntry = GetEntryOnPos( nPos );
+ DictionaryEntry* pEntry = getEntryOnPos( nPos );
+ if( pLBEntry )
+ RemoveParentKeepChilds( pLBEntry );
+ if( pEntry )
+ {
+ if( pEntry->m_bNewEntry )
+ delete pEntry;
+ else
+ m_aToBeDeleted.push_back( pEntry );
+ }
+}
+
+ULONG DictionaryList::deleteEntries( const rtl::OUString& rTerm )
+{
+ ULONG nPos = LIST_APPEND;
+ for( sal_Int32 nN=GetRowCount(); nN--; )
+ {
+ DictionaryEntry* pCurEntry = getEntryOnPos( nN );
+ if( rTerm.equals( pCurEntry->m_aTerm ) )
+ {
+ nPos = nN;
+ SvLBoxEntry* pCurLBEntry = GetEntryOnPos( nN );
+ RemoveParentKeepChilds( pCurLBEntry );
+ if( pCurEntry->m_bNewEntry )
+ delete pCurEntry;
+ else
+ m_aToBeDeleted.push_back( pCurEntry );
+ }
+ }
+ return nPos;
+}
+
+DictionaryList::~DictionaryList()
+{
+}
+
+void DictionaryList::activate( HeaderBar* pHeaderBar )
+{
+ if(!m_pHeaderBar)
+ {
+ m_pHeaderBar = pHeaderBar;
+
+ Point aPos = GetPosPixel();
+ Size aSize = GetSizePixel();
+ Size aHeadSize = pHeaderBar->GetSizePixel();
+
+ aPos.Y() += aHeadSize.Height();
+ SetPosSizePixel( aPos, Size( aSize.Width(), aSize.Height() - aHeadSize.Height() ) );
+ InitHeaderBar( pHeaderBar );
+ }
+ Show();
+}
+
+HeaderBar* DictionaryList::createHeaderBar( const String& rColumn1, const String& rColumn2, const String& rColumn3
+ , long nWidth1, long nWidth2, long nWidth3 )
+{
+ HeaderBar* pHeaderBar = new HeaderBar( Control::GetParent(), WB_BUTTONSTYLE | WB_BOTTOMBORDER );
+ pHeaderBar->SetPosSizePixel( GetPosPixel(), pHeaderBar->CalcWindowSizePixel() );
+
+ HeaderBarItemBits nBits = HEADER_BAR_BITS;
+ pHeaderBar->InsertItem( 1, rColumn1, nWidth1, nBits | HIB_UPARROW );
+ pHeaderBar->InsertItem( 2, rColumn2, nWidth2, nBits );
+ pHeaderBar->InsertItem( 3, rColumn3, nWidth3, nBits );
+
+ pHeaderBar->Show();
+ return pHeaderBar;
+}
+
+void DictionaryList::Resize()
+{
+ SvHeaderTabListBox::Resize();
+ Size aBoxSize = GetOutputSizePixel();
+
+ if ( !aBoxSize.Width() )
+ return;
+
+ Size aBarSize = m_pHeaderBar->GetSizePixel();
+ aBarSize.Width() = GetSizePixel().Width();
+ m_pHeaderBar->SetSizePixel( aBarSize );
+}
+
+void DictionaryList::sortByColumn( USHORT nSortColumnIndex, bool bSortAtoZ )
+{
+ m_nSortColumnIndex=nSortColumnIndex;
+ if( nSortColumnIndex<3 )
+ {
+ if(bSortAtoZ)
+ GetModel()->SetSortMode(SortAscending);
+ else
+ GetModel()->SetSortMode(SortDescending);
+
+ GetModel()->SetCompareHdl( LINK( this, DictionaryList, CompareHdl));
+ GetModel()->Resort();
+ }
+ else
+ GetModel()->SetSortMode(SortNone);
+}
+
+USHORT DictionaryList::getSortColumn() const
+{
+ return m_nSortColumnIndex;
+}
+
+IMPL_LINK( DictionaryList, CompareHdl, SvSortData*, pData )
+{
+ SvLBoxEntry* pLeft = (SvLBoxEntry*)(pData->pLeft );
+ SvLBoxEntry* pRight = (SvLBoxEntry*)(pData->pRight );
+ return (long) ColumnCompare(pLeft,pRight);
+}
+
+StringCompare DictionaryList::ColumnCompare( SvLBoxEntry* pLeft, SvLBoxEntry* pRight )
+{
+ StringCompare eCompare=COMPARE_EQUAL;
+
+ SvLBoxItem* pLeftItem = getItemAtColumn( pLeft, m_nSortColumnIndex );
+ SvLBoxItem* pRightItem = getItemAtColumn( pRight, m_nSortColumnIndex );
+
+ if(pLeftItem != NULL && pRightItem != NULL)
+ {
+ USHORT nLeftKind=pLeftItem->IsA();
+ USHORT nRightKind=pRightItem->IsA();
+
+ if(nRightKind == SV_ITEM_ID_LBOXSTRING &&
+ nLeftKind == SV_ITEM_ID_LBOXSTRING )
+ {
+ IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
+ const CollatorWrapper* pCollator = aIntlWrapper.getCaseCollator();
+
+ eCompare=(StringCompare)pCollator->compareString( ((SvLBoxString*)pLeftItem)->GetText(),
+ ((SvLBoxString*)pRightItem)->GetText());
+
+ if(eCompare==COMPARE_EQUAL)
+ eCompare=COMPARE_LESS;
+ }
+ }
+ return eCompare;
+}
+
+SvLBoxItem* DictionaryList::getItemAtColumn( SvLBoxEntry* pEntry, USHORT nColumn ) const
+{
+ SvLBoxItem* pItem = NULL;
+ if( pEntry )
+ {
+ USHORT nCount = pEntry->ItemCount();
+ nColumn++;
+ if( nTreeFlags & TREEFLAG_CHKBTN )
+ nColumn++;
+ if( nColumn < nCount )
+ pItem = pEntry->GetItem( nColumn );
+ }
+ return pItem;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+DictionaryEntry::DictionaryEntry( const rtl::OUString& rTerm, const rtl::OUString& rMapping
+ , sal_Int16 nConversionPropertyType
+ , sal_Bool bNewEntry )
+ : m_aTerm( rTerm )
+ , m_aMapping( rMapping )
+ , m_nConversionPropertyType( nConversionPropertyType )
+ , m_bNewEntry( bNewEntry )
+{
+ if( m_nConversionPropertyType == 0 )
+ m_nConversionPropertyType = 1;
+}
+
+DictionaryEntry::~DictionaryEntry()
+{
+}
+
+bool DictionaryEntry::operator==( const DictionaryEntry& rE ) const
+{
+ return m_aTerm == rE.m_aTerm
+ && m_aMapping == rE.m_aMapping
+ && m_nConversionPropertyType == rE.m_nConversionPropertyType;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+ChineseDictionaryDialog::ChineseDictionaryDialog( Window* pParent )
+ : ModalDialog( pParent, TextConversionDlgs_ResId( DLG_CHINESEDICTIONARY ) )
+ , m_nTextConversionOptions( i18n::TextConversionOption::NONE )
+ , m_aRB_To_Simplified( this, TextConversionDlgs_ResId( RB_TO_SIMPLIFIED ) )
+ , m_aRB_To_Traditional( this, TextConversionDlgs_ResId( RB_TO_TRADITIONAL ) )
+ , m_aCB_Reverse( this, TextConversionDlgs_ResId( CB_REVERSE ) )
+ , m_aFT_Term( this, TextConversionDlgs_ResId( FT_TERM ) )
+ , m_aED_Term( this, TextConversionDlgs_ResId( ED_TERM ) )
+ , m_aFT_Mapping( this, TextConversionDlgs_ResId( FT_MAPPING ) )
+ , m_aED_Mapping( this, TextConversionDlgs_ResId( ED_MAPPING ) )
+ , m_aFT_Property( this, TextConversionDlgs_ResId( FT_PROPERTY ) )
+ , m_aLB_Property( this, TextConversionDlgs_ResId( LB_PROPERTY ) )
+ , m_pHeaderBar( 0 )
+ , m_aCT_DictionaryToSimplified( this, TextConversionDlgs_ResId( CT_MAPPINGLIST ) )
+ , m_aCT_DictionaryToTraditional( this )
+ , m_aPB_Add( this, TextConversionDlgs_ResId( PB_ADD ) )
+ , m_aPB_Modify( this, TextConversionDlgs_ResId( PB_MODIFY ) )
+ , m_aPB_Delete( this, TextConversionDlgs_ResId( PB_DELETE ) )
+ , m_aFL_Bottomline( this, TextConversionDlgs_ResId( FL_BOTTOMLINE ) )
+ , m_aBP_OK( this, TextConversionDlgs_ResId( PB_OK ) )
+ , m_aBP_Cancel( this, TextConversionDlgs_ResId( PB_CANCEL ) )
+ , m_aBP_Help( this, TextConversionDlgs_ResId( PB_HELP ) )
+ , m_xContext( 0 )
+ , m_xFactory( 0 )
+{
+ FreeResource();
+
+ m_aRB_To_Simplified.SetHelpId( HID_SVX_CHINESE_DICTIONARY_RB_CONVERSION_TO_SIMPLIFIED );
+ m_aRB_To_Traditional.SetHelpId( HID_SVX_CHINESE_DICTIONARY_RB_CONVERSION_TO_TRADITIONAL );
+
+ m_aCB_Reverse.SetHelpId( HID_SVX_CHINESE_DICTIONARY_CB_REVERSE );
+
+ m_aCT_DictionaryToSimplified.SetHelpId( HID_SVX_CHINESE_DICTIONARY_LB_TO_SIMPLIFIED );
+ m_aCT_DictionaryToTraditional.SetHelpId( HID_SVX_CHINESE_DICTIONARY_LB_TO_TRADITIONAL );
+
+ SvtLinguConfig aLngCfg;
+ sal_Bool bValue = sal_Bool();
+ Any aAny( aLngCfg.GetProperty( rtl::OUString::createFromAscii( UPN_IS_REVERSE_MAPPING ) ) );
+ if( aAny >>= bValue )
+ m_aCB_Reverse.Check( bValue );
+
+ m_aLB_Property.SetDropDownLineCount( m_aLB_Property.GetEntryCount() );
+ m_aLB_Property.SelectEntryPos(0);
+
+ Reference< linguistic2::XConversionDictionary > xDictionary_To_Simplified(0);
+ Reference< linguistic2::XConversionDictionary > xDictionary_To_Traditional(0);
+ //get dictionaries
+ {
+ if(!m_xContext.is())
+ m_xContext = Reference< XComponentContext >( ::cppu::defaultBootstrap_InitialComponentContext() );
+ if(m_xContext.is())
+ m_xFactory = Reference< lang::XMultiComponentFactory >( m_xContext->getServiceManager() );
+ if(m_xFactory.is())
+ {
+ Reference< linguistic2::XConversionDictionaryList > xDictionaryList(
+ m_xFactory->createInstanceWithContext(
+ rtl::OUString::createFromAscii("com.sun.star.linguistic2.ConversionDictionaryList")
+ , m_xContext), uno::UNO_QUERY);
+ if( xDictionaryList.is() )
+ {
+ Reference< container::XNameContainer > xContainer( xDictionaryList->getDictionaryContainer() );
+ if(xContainer.is())
+ {
+ try
+ {
+ rtl::OUString aNameTo_Simplified( rtl::OUString::createFromAscii("ChineseT2S") );
+ rtl::OUString aNameTo_Traditional( rtl::OUString::createFromAscii("ChineseS2T") );
+ lang::Locale aLocale;
+ aLocale.Language = rtl::OUString::createFromAscii("zh");
+
+ if( xContainer->hasByName( aNameTo_Simplified ) )
+ xDictionary_To_Simplified = Reference< linguistic2::XConversionDictionary >(
+ xContainer->getByName( aNameTo_Simplified ), UNO_QUERY );
+ else
+ {
+ aLocale.Country = rtl::OUString::createFromAscii("TW");
+ xDictionary_To_Simplified = Reference< linguistic2::XConversionDictionary >(
+ xDictionaryList->addNewDictionary( aNameTo_Simplified
+ , aLocale, linguistic2::ConversionDictionaryType::SCHINESE_TCHINESE
+ ), UNO_QUERY );
+ }
+ if (xDictionary_To_Simplified.is())
+ xDictionary_To_Simplified->setActive( sal_True );
+
+
+ if( xContainer->hasByName( aNameTo_Traditional ) )
+ xDictionary_To_Traditional = Reference< linguistic2::XConversionDictionary >(
+ xContainer->getByName( aNameTo_Traditional ), UNO_QUERY );
+ else
+ {
+ aLocale.Country = rtl::OUString::createFromAscii("CN");
+ xDictionary_To_Traditional = Reference< linguistic2::XConversionDictionary >(
+ xDictionaryList->addNewDictionary( aNameTo_Traditional
+ , aLocale, linguistic2::ConversionDictionaryType::SCHINESE_TCHINESE
+ ), UNO_QUERY );
+ }
+ if (xDictionary_To_Traditional.is())
+ xDictionary_To_Traditional->setActive( sal_True );
+
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+ }
+ }
+ }
+
+ //init HeaderBar and set tabs
+ {
+ String aColumn1( OutputDevice::GetNonMnemonicString( m_aFT_Term.GetText() ) );
+ String aColumn2( OutputDevice::GetNonMnemonicString( m_aFT_Mapping.GetText() ) );
+ String aColumn3( OutputDevice::GetNonMnemonicString( m_aFT_Property.GetText() ) );
+
+ long nWidth1 = m_aED_Mapping.GetPosPixel().X() - m_aED_Term.GetPosPixel().X();
+ long nWidth2 = m_aLB_Property.GetPosPixel().X() - m_aED_Mapping.GetPosPixel().X();
+ long nWidth3 = m_aLB_Property.GetSizePixel().Width();
+
+ m_pHeaderBar = m_aCT_DictionaryToSimplified.createHeaderBar( aColumn1, aColumn2, aColumn3, nWidth1, nWidth2, nWidth3 );
+ if(m_pHeaderBar)
+ m_pHeaderBar->SetHelpId( HID_SVX_CHINESE_DICTIONARY_LB_HEADER );
+
+ long pTabs[] = { 3, 0, nWidth1, nWidth1 + nWidth2 };
+ m_aCT_DictionaryToSimplified.SetTabs( &pTabs[0], MAP_PIXEL );
+ m_aCT_DictionaryToTraditional.SetTabs( &pTabs[0], MAP_PIXEL );
+ }
+
+ //init dictionary controls
+ m_aCT_DictionaryToTraditional.SetPosPixel( m_aCT_DictionaryToSimplified.GetPosPixel() );
+ m_aCT_DictionaryToTraditional.SetSizePixel( m_aCT_DictionaryToSimplified.GetSizePixel() );
+
+ m_aCT_DictionaryToSimplified.initDictionaryControl( xDictionary_To_Simplified, &m_aLB_Property );
+ m_aCT_DictionaryToTraditional.initDictionaryControl( xDictionary_To_Traditional, &m_aLB_Property );
+
+ //
+ updateAfterDirectionChange();
+
+ //set hdl
+ if(m_pHeaderBar)
+ m_pHeaderBar->SetSelectHdl( LINK( this, ChineseDictionaryDialog, HeaderBarClick ) );
+
+ m_aED_Term.SetModifyHdl( LINK( this, ChineseDictionaryDialog, EditFieldsHdl ) );
+ m_aED_Mapping.SetModifyHdl( LINK( this, ChineseDictionaryDialog, EditFieldsHdl ) );
+ m_aLB_Property.SetSelectHdl( LINK( this, ChineseDictionaryDialog, EditFieldsHdl ) );
+
+ m_aRB_To_Simplified.SetClickHdl( LINK( this, ChineseDictionaryDialog, DirectionHdl ) );
+ m_aRB_To_Traditional.SetClickHdl( LINK( this, ChineseDictionaryDialog, DirectionHdl ) );
+
+ m_aCT_DictionaryToSimplified.SetSelectHdl( LINK( this, ChineseDictionaryDialog, MappingSelectHdl ));
+ m_aCT_DictionaryToTraditional.SetSelectHdl( LINK( this, ChineseDictionaryDialog, MappingSelectHdl ));
+
+ m_aPB_Add.SetClickHdl( LINK( this, ChineseDictionaryDialog, AddHdl ) );
+ m_aPB_Modify.SetClickHdl( LINK( this, ChineseDictionaryDialog, ModifyHdl ) );
+ m_aPB_Delete.SetClickHdl( LINK( this, ChineseDictionaryDialog, DeleteHdl ) );
+}
+
+ChineseDictionaryDialog::~ChineseDictionaryDialog()
+{
+ m_xContext=0;
+ m_xFactory=0;
+ delete m_pHeaderBar;
+}
+
+void ChineseDictionaryDialog::setDirectionAndTextConversionOptions( bool bDirectionToSimplified, sal_Int32 nTextConversionOptions /*i18n::TextConversionOption*/ )
+{
+ if( bDirectionToSimplified == bool(m_aRB_To_Simplified.IsChecked())
+ && nTextConversionOptions == m_nTextConversionOptions )
+ return;
+
+ m_nTextConversionOptions = nTextConversionOptions;
+
+ if( bDirectionToSimplified )
+ m_aRB_To_Simplified.Check();
+ else
+ m_aRB_To_Traditional.Check();
+ updateAfterDirectionChange();
+}
+
+IMPL_LINK( ChineseDictionaryDialog, DirectionHdl, void*, EMPTYARG )
+{
+ updateAfterDirectionChange();
+ return 0;
+}
+
+void ChineseDictionaryDialog::updateAfterDirectionChange()
+{
+ Reference< linguistic2::XConversionDictionary > xDictionary(0);
+
+ if( m_aRB_To_Simplified.IsChecked() )
+ {
+ m_aCT_DictionaryToSimplified.activate( m_pHeaderBar );
+ m_aCT_DictionaryToTraditional.Hide();
+ xDictionary = m_aCT_DictionaryToSimplified.m_xDictionary;
+ }
+ else
+ {
+ m_aCT_DictionaryToTraditional.activate( m_pHeaderBar );
+ m_aCT_DictionaryToSimplified.Hide();
+ xDictionary = m_aCT_DictionaryToTraditional.m_xDictionary;
+ }
+
+ updateButtons();
+}
+
+IMPL_LINK( ChineseDictionaryDialog, EditFieldsHdl, Control*, EMPTYARG )
+{
+ updateButtons();
+ return 0;
+}
+IMPL_LINK( ChineseDictionaryDialog, MappingSelectHdl, void*, EMPTYARG )
+{
+ DictionaryEntry* pE = getActiveDictionary().getFirstSelectedEntry();
+ if(pE)
+ {
+ m_aED_Term.SetText( pE->m_aTerm );
+ m_aED_Mapping.SetText( pE->m_aMapping );
+ sal_Int16 nPos = pE->m_nConversionPropertyType-1;
+ if( nPos<0 || nPos>=m_aLB_Property.GetEntryCount() )
+ nPos=0;
+ if( m_aLB_Property.GetEntryCount() )
+ m_aLB_Property.SelectEntryPos(nPos);
+ }
+
+ updateButtons();
+ return 0;
+}
+
+bool ChineseDictionaryDialog::isEditFieldsHaveContent() const
+{
+ return m_aED_Term.GetText().Len() && m_aED_Mapping.GetText().Len();
+}
+
+bool ChineseDictionaryDialog::isEditFieldsContentEqualsSelectedListContent() const
+{
+ DictionaryEntry* pE = getActiveDictionary().getFirstSelectedEntry();
+ if( pE )
+ {
+ if( pE->m_aTerm != rtl::OUString( m_aED_Term.GetText() ) )
+ return false;
+ if( pE->m_aMapping != rtl::OUString( m_aED_Mapping.GetText() ) )
+ return false;
+ if( pE->m_nConversionPropertyType != m_aLB_Property.GetSelectEntryPos()+1 )
+ return false;
+ return true;
+ }
+ return false;
+}
+
+const DictionaryList& ChineseDictionaryDialog::getActiveDictionary() const
+{
+ if( m_aRB_To_Traditional.IsChecked() )
+ return m_aCT_DictionaryToTraditional;
+ return m_aCT_DictionaryToSimplified;
+}
+
+DictionaryList& ChineseDictionaryDialog::getActiveDictionary()
+{
+ if( m_aRB_To_Traditional.IsChecked() )
+ return m_aCT_DictionaryToTraditional;
+ return m_aCT_DictionaryToSimplified;
+}
+
+const DictionaryList& ChineseDictionaryDialog::getReverseDictionary() const
+{
+ if( m_aRB_To_Traditional.IsChecked() )
+ return m_aCT_DictionaryToSimplified;
+ return m_aCT_DictionaryToTraditional;
+}
+
+DictionaryList& ChineseDictionaryDialog::getReverseDictionary()
+{
+ if( m_aRB_To_Traditional.IsChecked() )
+ return m_aCT_DictionaryToSimplified;
+ return m_aCT_DictionaryToTraditional;
+}
+
+void ChineseDictionaryDialog::updateButtons()
+{
+ bool bAdd = isEditFieldsHaveContent() && !getActiveDictionary().hasTerm( m_aED_Term.GetText() );
+ m_aPB_Add.Enable( bAdd );
+
+ m_aPB_Delete.Enable( !bAdd && getActiveDictionary().GetSelectedRowCount()>0 );
+
+// DictionaryEntry* pFirstSelectedEntry = getActiveDictionary().getFirstSelectedEntry();
+
+ bool bModify = false;
+ {
+ DictionaryEntry* pFirstSelectedEntry = getActiveDictionary().getFirstSelectedEntry();
+ bModify = !bAdd && getActiveDictionary().GetSelectedRowCount()==1
+ && pFirstSelectedEntry && pFirstSelectedEntry->m_aTerm.equals( m_aED_Term.GetText() );
+ if( bModify && isEditFieldsContentEqualsSelectedListContent() )
+ bModify = false;
+ }
+ m_aPB_Modify.Enable( bModify );
+}
+
+IMPL_LINK( ChineseDictionaryDialog, AddHdl, void*, EMPTYARG )
+{
+ if( !isEditFieldsHaveContent() )
+ return 0;
+
+ sal_Int16 nConversionPropertyType = m_aLB_Property.GetSelectEntryPos()+1;
+
+ getActiveDictionary().addEntry( m_aED_Term.GetText(), m_aED_Mapping.GetText(), nConversionPropertyType );
+
+ if( m_aCB_Reverse.IsChecked() )
+ {
+ getReverseDictionary().deleteEntries( m_aED_Mapping.GetText() );
+ getReverseDictionary().addEntry( m_aED_Mapping.GetText(), m_aED_Term.GetText(), nConversionPropertyType );
+ }
+
+ updateButtons();
+ return 0;
+}
+IMPL_LINK( ChineseDictionaryDialog, ModifyHdl, void*, EMPTYARG )
+{
+ rtl::OUString aTerm( m_aED_Term.GetText() );
+ rtl::OUString aMapping( m_aED_Mapping.GetText() );
+ sal_Int16 nConversionPropertyType = m_aLB_Property.GetSelectEntryPos()+1;
+
+ DictionaryList& rActive = getActiveDictionary();
+ DictionaryList& rReverse = getReverseDictionary();
+
+ DictionaryEntry* pE = rActive.getFirstSelectedEntry();
+ if( pE->m_aTerm != aTerm )
+ return 0;
+
+ if( pE )
+ {
+ if( pE->m_aMapping != aMapping || pE->m_nConversionPropertyType != nConversionPropertyType )
+ {
+ if( m_aCB_Reverse.IsChecked() )
+ {
+ ULONG nPos = rReverse.deleteEntries( pE->m_aMapping );
+ nPos = rReverse.deleteEntries( aMapping );
+ rReverse.addEntry( aMapping, aTerm, nConversionPropertyType, nPos );
+ }
+
+ ULONG nPos = rActive.deleteEntries( aTerm );
+ rActive.addEntry( aTerm, aMapping, nConversionPropertyType, nPos );
+ }
+ }
+
+ updateButtons();
+ return 0;
+}
+
+IMPL_LINK( ChineseDictionaryDialog, DeleteHdl, void*, EMPTYARG )
+{
+ DictionaryList& rActive = getActiveDictionary();
+ DictionaryList& rReverse = getReverseDictionary();
+
+ if( rActive.GetSelectedRowCount()>0)
+ {
+ DictionaryEntry* pEntry;
+
+ rtl::OUString aMapping;
+ for( sal_Int32 nN=rActive.GetRowCount(); nN--; )
+ {
+ if( rActive.IsRowSelected( nN ) )
+ {
+ pEntry = rActive.getEntryOnPos( nN );
+ if(pEntry)
+ {
+ aMapping = pEntry->m_aMapping;
+ rActive.deleteEntryOnPos( nN );
+ if( m_aCB_Reverse.IsChecked() )
+ rReverse.deleteEntries( aMapping );
+ }
+ break;
+ }
+ }
+ }
+
+ updateButtons();
+ return 0;
+}
+
+short ChineseDictionaryDialog::Execute()
+{
+ sal_Int32 nTextConversionOptions = m_nTextConversionOptions;
+ if(m_nTextConversionOptions | i18n::TextConversionOption::USE_CHARACTER_VARIANTS )
+ nTextConversionOptions = nTextConversionOptions^i18n::TextConversionOption::USE_CHARACTER_VARIANTS ;
+
+ m_aCT_DictionaryToSimplified.refillFromDictionary( nTextConversionOptions );
+ m_aCT_DictionaryToTraditional.refillFromDictionary( m_nTextConversionOptions );
+
+ short nRet = ModalDialog::Execute();
+
+ if( nRet == RET_OK )
+ {
+ //save settings to configuration
+ SvtLinguConfig aLngCfg;
+ Any aAny;
+ aAny <<= sal_Bool( !!m_aCB_Reverse.IsChecked() );
+ aLngCfg.SetProperty( rtl::OUString::createFromAscii( UPN_IS_REVERSE_MAPPING ), aAny );
+
+ m_aCT_DictionaryToSimplified.save();
+ m_aCT_DictionaryToTraditional.save();
+ }
+
+ m_aCT_DictionaryToSimplified.deleteAll();
+ m_aCT_DictionaryToTraditional.deleteAll();
+
+ return nRet;
+}
+
+IMPL_LINK( ChineseDictionaryDialog, HeaderBarClick, void*, EMPTYARG )
+{
+ if(m_pHeaderBar)
+ {
+ USHORT nId = m_pHeaderBar->GetCurItemId();
+ HeaderBarItemBits nBits = m_pHeaderBar->GetItemBits(nId);
+ if( nBits & HIB_CLICKABLE )
+ {
+ //set new arrow positions in headerbar
+ m_pHeaderBar->SetItemBits( getActiveDictionary().getSortColumn()+1, HEADER_BAR_BITS );
+ if( nBits & HIB_UPARROW )
+ m_pHeaderBar->SetItemBits( nId, HEADER_BAR_BITS | HIB_DOWNARROW );
+ else
+ m_pHeaderBar->SetItemBits( nId, HEADER_BAR_BITS | HIB_UPARROW );
+
+ //sort lists
+ nBits = m_pHeaderBar->GetItemBits(nId);
+ bool bSortAtoZ = nBits & HIB_UPARROW;
+ getActiveDictionary().sortByColumn(nId-1,bSortAtoZ);
+ getReverseDictionary().sortByColumn(nId-1,bSortAtoZ);
+ }
+ }
+ return 0;
+}
+
+//.............................................................................
+} //end namespace
+//.............................................................................
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hrc b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hrc
new file mode 100644
index 000000000000..5c4c8e2bf049
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hrc
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _TEXTCONVERSIONDLGS_CHINESE_DICTIONARYDLG_HRC
+#define _TEXTCONVERSIONDLGS_CHINESE_DICTIONARYDLG_HRC
+
+#include "resids.hrc"
+#include "buttongroup.hrc"
+#include "chinese_direction_ids.hrc"
+
+#define ED_TERM 1
+#define ED_MAPPING 2
+
+#define LB_PROPERTY 1
+
+#define CB_REVERSE 1
+
+#define FT_TERM 1
+#define FT_MAPPING 2
+#define FT_PROPERTY 3
+
+#define CT_MAPPINGLIST 1
+
+#define PB_ADD 1
+#define PB_MODIFY 2
+#define PB_DELETE 3
+
+#define FL_BOTTOMLINE 1
+
+#endif
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx
new file mode 100644
index 000000000000..afe573330fe8
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx
@@ -0,0 +1,201 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _TEXTCONVERSIONDLGS_CHINESE_DICTIONARYDLG_HXX
+#define _TEXTCONVERSIONDLGS_CHINESE_DICTIONARYDLG_HXX
+
+#include <vcl/dialog.hxx>
+// header for class FixedLine
+#include <vcl/fixed.hxx>
+// header for class RadioButton
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+// header for class Edit
+#include <vcl/edit.hxx>
+// header for class ListBox
+#include <vcl/lstbox.hxx>
+// header for class SvHeaderTabListBox
+#include <svtools/svtabbx.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+#include <com/sun/star/linguistic2/XConversionDictionary.hpp>
+
+#include <vector>
+
+//.............................................................................
+namespace textconversiondlgs
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+struct DictionaryEntry
+{
+ DictionaryEntry( const rtl::OUString& rTerm, const rtl::OUString& rMapping
+ , sal_Int16 nConversionPropertyType //linguistic2::ConversionPropertyType
+ , sal_Bool bNewEntry = sal_False );
+
+ virtual ~DictionaryEntry();
+
+ bool operator==( const DictionaryEntry& rE ) const;
+
+ rtl::OUString m_aTerm;
+ rtl::OUString m_aMapping;
+ sal_Int16 m_nConversionPropertyType; //linguistic2::ConversionPropertyType
+
+ sal_Bool m_bNewEntry;
+};
+
+class DictionaryList : public SvHeaderTabListBox
+{
+public:
+ DictionaryList( Window* pParent, const ResId& );
+ DictionaryList( Window* pParent );
+ virtual ~DictionaryList();
+
+ HeaderBar* createHeaderBar( const String& rColumn1, const String& rColumn2, const String& rColumn3
+ , long nWidth1, long nWidth2, long nWidth3 );
+
+ void initDictionaryControl( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XConversionDictionary>& xDictionary
+ , ListBox* pPropertyTypeNameListBox );
+ void activate( HeaderBar* pHeaderBar );
+ void deleteAll();
+ void refillFromDictionary( sal_Int32 nTextConversionOptions /*i18n::TextConversionOption*/ );
+ void save();
+
+ DictionaryEntry* getTermEntry( const rtl::OUString& rTerm ) const;
+ bool hasTerm( const rtl::OUString& rTerm ) const;
+
+ void addEntry( const rtl::OUString& rTerm, const rtl::OUString& rMapping
+ , sal_Int16 nConversionPropertyType /*linguistic2::ConversionPropertyType*/, ULONG nPos = LIST_APPEND );
+ ULONG deleteEntries( const rtl::OUString& rTerm ); //return lowest position of deleted entries or LIST_APPEND if no entry was deleted
+ void deleteEntryOnPos( sal_Int32 nPos );
+ DictionaryEntry* getEntryOnPos( sal_Int32 nPos ) const;
+ DictionaryEntry* getFirstSelectedEntry() const;
+
+ void sortByColumn( USHORT nSortColumnIndex, bool bSortAtoZ );
+ USHORT getSortColumn() const;
+
+ virtual void Resize();
+
+private:
+ String getPropertyTypeName( sal_Int16 nConversionPropertyType /*linguistic2::ConversionPropertyType*/ ) const;
+ String makeTabString( const DictionaryEntry& rEntry ) const;
+
+ DECL_LINK( CompareHdl, SvSortData* );
+ StringCompare ColumnCompare( SvLBoxEntry* pLeft, SvLBoxEntry* pRight );
+ SvLBoxItem* getItemAtColumn( SvLBoxEntry* pEntry, USHORT nColumn ) const;
+
+public:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XConversionDictionary> m_xDictionary;
+
+private:
+ HeaderBar* m_pHeaderBar;
+ ListBox* m_pPropertyTypeNameListBox;
+
+ std::vector< DictionaryEntry* > m_aToBeDeleted;
+
+ USHORT m_nSortColumnIndex;
+};
+
+class ChineseDictionaryDialog : public ModalDialog
+{
+public:
+ ChineseDictionaryDialog( Window* pParent );
+ virtual ~ChineseDictionaryDialog();
+
+ //this method should be called once before calling execute
+ void setDirectionAndTextConversionOptions( bool bDirectionToSimplified, sal_Int32 nTextConversionOptions /*i18n::TextConversionOption*/ );
+
+ virtual short Execute();
+
+private:
+ DECL_LINK( DirectionHdl, void* );
+ DECL_LINK( EditFieldsHdl, Control* );
+ DECL_LINK( MappingSelectHdl, void* );
+ DECL_LINK( AddHdl, void* );
+ DECL_LINK( ModifyHdl, void* );
+ DECL_LINK( DeleteHdl, void* );
+ DECL_LINK( HeaderBarClick, void* );
+
+ void updateAfterDirectionChange();
+ void updateButtons();
+
+ bool isEditFieldsHaveContent() const;
+ bool isEditFieldsContentEqualsSelectedListContent() const;
+
+ DictionaryList& getActiveDictionary();
+ DictionaryList& getReverseDictionary();
+
+ const DictionaryList& getActiveDictionary() const;
+ const DictionaryList& getReverseDictionary() const;
+
+private:
+ sal_Int32 m_nTextConversionOptions; //i18n::TextConversionOption
+
+ RadioButton m_aRB_To_Simplified;
+ RadioButton m_aRB_To_Traditional;
+
+ CheckBox m_aCB_Reverse;
+
+ FixedText m_aFT_Term;
+ Edit m_aED_Term;
+
+ FixedText m_aFT_Mapping;
+ Edit m_aED_Mapping;
+
+ FixedText m_aFT_Property;
+ ListBox m_aLB_Property;
+
+ HeaderBar* m_pHeaderBar;
+ DictionaryList m_aCT_DictionaryToSimplified;
+ DictionaryList m_aCT_DictionaryToTraditional;
+
+ PushButton m_aPB_Add;
+ PushButton m_aPB_Modify;
+ PushButton m_aPB_Delete;
+
+ FixedLine m_aFL_Bottomline;
+
+ OKButton m_aBP_OK;
+ CancelButton m_aBP_Cancel;
+ HelpButton m_aBP_Help;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiComponentFactory> m_xFactory;
+};
+
+//.............................................................................
+} //end namespace
+//.............................................................................
+#endif
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.src b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.src
new file mode 100644
index 000000000000..76ec3f39eb43
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.src
@@ -0,0 +1,184 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 "chinese_dictionarydialog.hrc"
+#include "chinese_direction.hrc"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+//-----------------------------------------------------------------------------
+//defines for positions and sizes:
+
+#define FULL_WIDTH (245)
+#define FULL_HEIGHT (165)
+
+#define ROW_1 (RSC_SP_DLG_INNERBORDER_TOP)
+#define ROW_2 (ROW_1+RSC_CD_RADIOBUTTON_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define ROW_3 (ROW_2+RSC_CD_RADIOBUTTON_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define ROW_4 (ROW_3+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define ROW_5 (ROW_4+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_6 (ROW_5+RSC_CD_TEXTBOX_HEIGHT+RSC_SP_CTRL_DESC_Y)
+
+#define ROW_5a (ROW_5+RSC_CD_PUSHBUTTON_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_5b (ROW_5a+RSC_CD_PUSHBUTTON_HEIGHT+RSC_SP_CTRL_DESC_Y)
+
+#define ROW_8 (FULL_HEIGHT-RSC_SP_DLG_INNERBORDER_BOTTOM-RSC_CD_PUSHBUTTON_HEIGHT)
+#define ROW_7 (ROW_8-RSC_CD_FIXEDLINE_HEIGHT-2)
+
+#define LIST_HEIGHT (ROW_7-RSC_SP_CTRL_Y-ROW_6)
+
+#define COL_WIDTH 60
+#define BUTTONCOL_WIDTH 40
+#define COL_1 (RSC_SP_DLG_INNERBORDER_LEFT+RSC_SP_FLGR_SPACE_X)
+#define COL_2 (COL_1+COL_WIDTH+1)
+#define COL_3 (COL_2+COL_WIDTH+1)
+#define COL_4 (FULL_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT-BUTTONCOL_WIDTH)
+
+#define REST_COL_WIDTH (COL_4-COL_3-RSC_SP_CTRL_GROUP_X)
+
+//-----------------------------------------------------------------------------
+
+ModalDialog DLG_CHINESEDICTIONARY
+{
+ //HelpId = ;
+ Size = MAP_APPFONT( FULL_WIDTH, FULL_HEIGHT );
+ OutputSize = TRUE;
+ Closeable = TRUE ;
+ Moveable = TRUE ;
+ SVLook = TRUE;
+
+ Text [ en-US ] = "Edit Dictionary";
+
+ DIRECTION_RADIOBUTTONS( COL_1, ROW_1, FULL_WIDTH - COL_1 - RSC_SP_DLG_INNERBORDER_RIGHT )
+
+ CheckBox CB_REVERSE
+ {
+ Pos = MAP_APPFONT ( COL_1, ROW_3 ) ;
+ Size = MAP_APPFONT ( FULL_WIDTH - COL_1 - RSC_SP_DLG_INNERBORDER_RIGHT , RSC_CD_CHECKBOX_HEIGHT ) ;
+
+ Text [ en-US ] = "Reverse mapping";
+ };
+
+ FixedText FT_TERM
+ {
+ Pos = MAP_APPFONT ( COL_1 , ROW_4 ) ;
+ Size = MAP_APPFONT ( COL_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Term";
+ };
+ Edit ED_TERM
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_1 , ROW_5 ) ;
+ Size = MAP_APPFONT ( COL_WIDTH , RSC_CD_TEXTBOX_HEIGHT ) ;
+ };
+
+
+ FixedText FT_MAPPING
+ {
+ Pos = MAP_APPFONT ( COL_2 , ROW_4 ) ;
+ Size = MAP_APPFONT ( COL_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Mapping";
+ };
+ Edit ED_MAPPING
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , ROW_5 ) ;
+ Size = MAP_APPFONT ( COL_WIDTH , RSC_CD_TEXTBOX_HEIGHT ) ;
+ };
+
+ FixedText FT_PROPERTY
+ {
+ Pos = MAP_APPFONT ( COL_3 , ROW_4 ) ;
+ Size = MAP_APPFONT ( REST_COL_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Property";
+ };
+ ListBox LB_PROPERTY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_3 , ROW_5 ) ;
+ Size = MAP_APPFONT ( REST_COL_WIDTH , RSC_CD_TEXTBOX_HEIGHT ) ;
+ DropDown = TRUE ;
+
+ stringlist [ en-US ] =
+ {
+ < "Other" ; Default ; > ;
+ < "Foreign" ; > ;
+ < "First name" ; > ;
+ < "Last name" ; > ;
+ < "Title" ; > ;
+ < "Status" ; > ;
+ < "Place name" ; > ;
+ < "Business" ; > ;
+ < "Adjective" ; > ;
+ < "Idiom" ; > ;
+ < "Abbreviation" ; > ;
+ < "Numerical" ; > ;
+ < "Noun" ; > ;
+ < "Verb" ; > ;
+ < "Brand name" ; > ;
+ };
+ };
+
+ Control CT_MAPPINGLIST
+ {
+ Pos = MAP_APPFONT ( COL_1, ROW_6 ) ;
+ Size = MAP_APPFONT ( COL_4 - COL_1 - RSC_SP_CTRL_GROUP_X, LIST_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+
+ PushButton PB_ADD
+ {
+ Pos = MAP_APPFONT( COL_4, ROW_5 );
+ Size = MAP_APPFONT( BUTTONCOL_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT );
+
+ Text [ en-US ] = "~Add";
+ };
+ PushButton PB_MODIFY
+ {
+ Pos = MAP_APPFONT( COL_4, ROW_5a );
+ Size = MAP_APPFONT( BUTTONCOL_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT );
+
+ Text [ en-US ] = "~Modify";
+ };
+ PushButton PB_DELETE
+ {
+ Pos = MAP_APPFONT( COL_4, ROW_5b );
+ Size = MAP_APPFONT( BUTTONCOL_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT );
+
+ Text [ en-US ] = "~Delete";
+ };
+
+ FixedLine FL_BOTTOMLINE
+ {
+ Pos = MAP_APPFONT ( 0 , ROW_7 ) ;
+ Size = MAP_APPFONT ( FULL_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ) ;
+ };
+
+ BUTTONS_OK_CANCEL_HELP_ABREAST( FULL_WIDTH - RSC_SP_DLG_INNERBORDER_RIGHT, ROW_8 )
+};
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_direction_ids.hrc b/svx/source/unodialogs/textconversiondlgs/chinese_direction_ids.hrc
new file mode 100644
index 000000000000..4545ef26fc5b
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_direction_ids.hrc
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _TEXTCONVERSIONDLGS_CHINESE_DIRECTION_IDS_HXX
+#define _TEXTCONVERSIONDLGS_CHINESE_DIRECTION_IDS_HXX
+
+#define RB_TO_SIMPLIFIED 1
+#define RB_TO_TRADITIONAL 2
+
+#endif
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_direction_tmpl.hrc b/svx/source/unodialogs/textconversiondlgs/chinese_direction_tmpl.hrc
new file mode 100644
index 000000000000..e2b67ab7df9f
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_direction_tmpl.hrc
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _TEXTCONVERSIONDLGS_CHINESE_DIRECTION_HRC
+#define _TEXTCONVERSIONDLGS_CHINESE_DIRECTION_HRC
+
+#include "chinese_direction_ids.hrc"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+#define DIRECTION_RADIOBUTTONS( D_XPOS, D_YPOS, D_FULLWIDTH ) \
+RadioButton RB_TO_SIMPLIFIED \
+{ \
+ Pos = MAP_APPFONT( D_XPOS, D_YPOS ); \
+ Size = MAP_APPFONT ( D_FULLWIDTH, RSC_CD_RADIOBUTTON_HEIGHT ) ; \
+ Text [ en-US ] = "~Traditional Chinese to simplified Chinese"; \
+}; \
+RadioButton RB_TO_TRADITIONAL \
+{ \
+ Pos = MAP_APPFONT( D_XPOS, D_YPOS + RSC_CD_RADIOBUTTON_HEIGHT+RSC_SP_CTRL_GROUP_Y ); \
+ Size = MAP_APPFONT ( D_FULLWIDTH, RSC_CD_RADIOBUTTON_HEIGHT ) ; \
+ Text [ en-US ] = "~Simplified Chinese to traditional Chinese"; \
+};
+
+#endif
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
new file mode 100644
index 000000000000..68a5b59974fc
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
@@ -0,0 +1,285 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_svx.hxx"
+
+#include "chinese_translation_unodialog.hxx"
+#include "chinese_translationdialog.hxx"
+#include <osl/mutex.hxx>
+#include <vos/mutex.hxx>
+// header for class Application
+#include <vcl/svapp.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+// header for define RET_CANCEL
+#include <vcl/msgbox.hxx>
+
+// header for class OImplementationId
+#include <cppuhelper/typeprovider.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+
+//.............................................................................
+namespace textconversiondlgs
+{
+//.............................................................................
+using namespace ::com::sun::star;
+
+#define SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.linguistic2.ChineseTranslationDialog")
+#define SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.linguistic2.ChineseTranslationDialog")
+
+#define C2U(cChar) rtl::OUString::createFromAscii(cChar)
+
+ChineseTranslation_UnoDialog::ChineseTranslation_UnoDialog( const uno::Reference< uno::XComponentContext >& xContext )
+ : m_xCC( xContext )
+ , m_xParentWindow( 0 )
+ , m_pDialog( 0 )
+ , m_bDisposed(sal_False)
+ , m_bInDispose(sal_False)
+ , m_aContainerMutex()
+ , m_aDisposeEventListeners(m_aContainerMutex)
+{
+}
+
+ChineseTranslation_UnoDialog::~ChineseTranslation_UnoDialog()
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ impl_DeleteDialog();
+}
+
+void ChineseTranslation_UnoDialog::impl_DeleteDialog()
+{
+ if( m_pDialog )
+ {
+ if(m_pDialog->IsInExecute())
+ m_pDialog->EndDialog(RET_CANCEL);
+ delete m_pDialog;
+ m_pDialog = 0;
+ }
+}
+//-------------------------------------------------------------------------
+// lang::XServiceInfo
+
+::rtl::OUString SAL_CALL ChineseTranslation_UnoDialog::getImplementationName() throw( uno::RuntimeException )
+{
+ return getImplementationName_Static();
+}
+
+::rtl::OUString ChineseTranslation_UnoDialog::getImplementationName_Static()
+{
+ return SERVICE_IMPLEMENTATION_NAME;
+}
+
+sal_Bool SAL_CALL ChineseTranslation_UnoDialog::supportsService( const ::rtl::OUString& ServiceName ) throw( uno::RuntimeException )
+{
+ uno::Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames();
+ const ::rtl::OUString* pArray = aSNL.getArray();
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ {
+ if( pArray[ i ] == ServiceName )
+ return sal_True;
+ }
+ return sal_False;
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL ChineseTranslation_UnoDialog::getSupportedServiceNames() throw( uno::RuntimeException )
+{
+ return getSupportedServiceNames_Static();
+}
+
+uno::Sequence< rtl::OUString > ChineseTranslation_UnoDialog::getSupportedServiceNames_Static()
+{
+ uno::Sequence< rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[ 0 ] = SERVICE_NAME;
+ return aSNS;
+}
+
+//-------------------------------------------------------------------------
+// ui::dialogs::XExecutableDialog
+
+void SAL_CALL ChineseTranslation_UnoDialog::setTitle( const ::rtl::OUString& ) throw(uno::RuntimeException)
+{
+ //not implemented - fell free to do so, if you do need this
+}
+
+//-------------------------------------------------------------------------
+void SAL_CALL ChineseTranslation_UnoDialog::initialize( const uno::Sequence< uno::Any >& aArguments ) throw(uno::Exception, uno::RuntimeException)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ if( m_bDisposed || m_bInDispose )
+ return;
+
+ const uno::Any* pArguments = aArguments.getConstArray();
+ for(sal_Int32 i=0; i<aArguments.getLength(); ++i, ++pArguments)
+ {
+ beans::PropertyValue aProperty;
+ if(*pArguments >>= aProperty)
+ {
+ if( aProperty.Name.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "ParentWindow" ) ) == 0 )
+ {
+ aProperty.Value >>= m_xParentWindow;
+ }
+ }
+ }
+}
+
+//-------------------------------------------------------------------------
+sal_Int16 SAL_CALL ChineseTranslation_UnoDialog::execute() throw(uno::RuntimeException)
+{
+ sal_Int16 nRet = ui::dialogs::ExecutableDialogResults::CANCEL;
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ if( m_bDisposed || m_bInDispose )
+ return nRet;
+
+ if( !m_pDialog )
+ {
+ Window* pParent = NULL;
+ if( m_xParentWindow.is() )
+ {
+ VCLXWindow* pImplementation = VCLXWindow::GetImplementation(m_xParentWindow);
+ if (pImplementation)
+ pParent = pImplementation->GetWindow();
+ }
+ uno::Reference< XComponent > xComp( this );
+ m_pDialog = new ChineseTranslationDialog( pParent );
+ }
+ if( !m_pDialog )
+ return nRet;
+ nRet = m_pDialog->Execute();
+ if(nRet==RET_OK)
+ nRet=ui::dialogs::ExecutableDialogResults::OK;
+ }
+ return nRet;
+}
+
+//-------------------------------------------------------------------------
+// lang::XComponent
+
+void SAL_CALL ChineseTranslation_UnoDialog::dispose() throw (uno::RuntimeException)
+{
+ lang::EventObject aEvt;
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ if( m_bDisposed || m_bInDispose )
+ return;
+ m_bInDispose = true;
+
+ impl_DeleteDialog();
+ m_xParentWindow = 0;
+ m_bDisposed = true;
+
+ aEvt.Source = static_cast< XComponent * >( this );
+ }
+ if( m_aDisposeEventListeners.getLength() )
+ m_aDisposeEventListeners.disposeAndClear( aEvt );
+}
+
+void SAL_CALL ChineseTranslation_UnoDialog::addEventListener( const uno::Reference< lang::XEventListener > & xListener ) throw (uno::RuntimeException)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ if( m_bDisposed || m_bInDispose )
+ return;
+ m_aDisposeEventListeners.addInterface( xListener );
+}
+
+void SAL_CALL ChineseTranslation_UnoDialog::removeEventListener( const uno::Reference< lang::XEventListener > & xListener ) throw (uno::RuntimeException)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ if( m_bDisposed || m_bInDispose )
+ return;
+ m_aDisposeEventListeners.removeInterface( xListener );
+}
+
+//-------------------------------------------------------------------------
+// XPropertySet
+
+uno::Reference< beans::XPropertySetInfo > SAL_CALL ChineseTranslation_UnoDialog::getPropertySetInfo( ) throw (uno::RuntimeException)
+{
+ return 0;
+}
+void SAL_CALL ChineseTranslation_UnoDialog::setPropertyValue( const ::rtl::OUString&, const uno::Any& ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ //only read only properties
+ throw beans::PropertyVetoException();
+}
+uno::Any SAL_CALL ChineseTranslation_UnoDialog::getPropertyValue( const ::rtl::OUString& rPropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ uno::Any aRet;
+
+ sal_Bool bDirectionToSimplified = sal_True;
+ sal_Bool bUseCharacterVariants = sal_False;
+ sal_Bool bTranslateCommonTerms = sal_False;
+
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ if( m_bDisposed || m_bInDispose || !m_pDialog )
+ return aRet;
+ m_pDialog->getSettings( bDirectionToSimplified, bUseCharacterVariants, bTranslateCommonTerms );
+ }
+
+ if( rPropertyName.equals( C2U("IsDirectionToSimplified") ) )
+ {
+ aRet <<= bDirectionToSimplified;
+ }
+ else if( rPropertyName.equals( C2U("IsUseCharacterVariants") ) )
+ {
+ aRet <<= bUseCharacterVariants;
+ }
+ else if( rPropertyName.equals( C2U("IsTranslateCommonTerms") ) )
+ {
+ aRet <<= bTranslateCommonTerms;
+ }
+ else
+ {
+ throw beans::UnknownPropertyException();
+ }
+ return aRet;
+
+}
+void SAL_CALL ChineseTranslation_UnoDialog::addPropertyChangeListener( const ::rtl::OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ //only not bound properties -> ignore listener
+}
+void SAL_CALL ChineseTranslation_UnoDialog::removePropertyChangeListener( const ::rtl::OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ //only not bound properties -> ignore listener
+}
+void SAL_CALL ChineseTranslation_UnoDialog::addVetoableChangeListener( const ::rtl::OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ //only not bound properties -> ignore listener
+}
+void SAL_CALL ChineseTranslation_UnoDialog::removeVetoableChangeListener( const ::rtl::OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ //only not bound properties -> ignore listener
+}
+
+//.............................................................................
+} //end namespace
+//.............................................................................
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx
new file mode 100644
index 000000000000..f6811c4e0160
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _TEXTCONVERSIONDLGS_CHINESE_TRANSLATION_UNODIALOG_HXX
+#define _TEXTCONVERSIONDLGS_CHINESE_TRANSLATION_UNODIALOG_HXX
+
+#include <cppuhelper/component.hxx>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <cppuhelper/implbase5.hxx>
+
+//.............................................................................
+namespace textconversiondlgs
+{
+//.............................................................................
+
+//-------------------------------------------------------------------------
+/** This class provides the chinese translation dialog as an uno component.
+
+It can be created via lang::XMultiComponentFactory::createInstanceWithContext
+with servicename "com.sun.star.linguistic2.ChineseTranslationDialog"
+or implemenation name "com.sun.star.comp.linguistic2.ChineseTranslationDialog"
+
+It can be initialized via the XInitialization interface with the following single parameter:
+PropertyValue-Parameter: Name="ParentWindow" Type="awt::XWindow".
+
+It can be executed via the ui::dialogs::XExecutableDialog interface.
+
+Made settings can be retrieved via beans::XPropertySet interface.
+Following properties are available (read only and not bound):
+1) Name="IsDirectionToSimplified" Type="sal_Bool"
+2) Name="IsUseCharacterVariants" Type="sal_Bool"
+3) Name="IsTranslateCommonTerms" Type="sal_Bool"
+
+The dialog gets this information from the registry on execute and writes it back to the registry if ended with OK.
+*/
+
+class ChineseTranslationDialog;
+
+class ChineseTranslation_UnoDialog : public ::cppu::WeakImplHelper5 <
+ ::com::sun::star::ui::dialogs::XExecutableDialog
+ , ::com::sun::star::lang::XInitialization
+ , ::com::sun::star::beans::XPropertySet
+ , ::com::sun::star::lang::XComponent
+ , ::com::sun::star::lang::XServiceInfo
+ >
+ // ,public ::com::sun::star::uno::XWeak // implemented by WeakImplHelper(optional interface)
+ // ,public ::com::sun::star::uno::XInterface // implemented by WeakImplHelper(optional interface)
+ // ,public ::com::sun::star::lang::XTypeProvider // implemented by WeakImplHelper
+{
+public:
+ ChineseTranslation_UnoDialog( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext );
+ virtual ~ChineseTranslation_UnoDialog();
+
+ // lang::XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+ static ::rtl::OUString getImplementationName_Static();
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static();
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ create( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext) throw(::com::sun::star::uno::Exception)
+ {
+ return (::cppu::OWeakObject *)new ChineseTranslation_UnoDialog( xContext );
+ }
+
+ // lang::XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // ui::dialogs::XExecutableDialog
+ virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL execute( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // beans::XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // lang::XComponent
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ //no default constructor
+ ChineseTranslation_UnoDialog();
+
+ void impl_DeleteDialog();
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext> m_xCC;
+ com::sun::star::uno::Reference<
+ com::sun::star::awt::XWindow > m_xParentWindow;
+
+ ChineseTranslationDialog* m_pDialog;
+
+ sal_Bool m_bDisposed; ///Dispose call ready.
+ sal_Bool m_bInDispose;///In dispose call
+ osl::Mutex m_aContainerMutex;
+ cppu::OInterfaceContainerHelper m_aDisposeEventListeners;
+};
+
+//.............................................................................
+} //end namespace
+//.............................................................................
+#endif
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx
new file mode 100644
index 000000000000..213ddc22bace
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx
@@ -0,0 +1,201 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_svx.hxx"
+
+#include "chinese_translationdialog.hxx"
+#include "chinese_translationdialog.hrc"
+#include "resid.hxx"
+#include "chinese_dictionarydialog.hxx"
+#include <com/sun/star/i18n/TextConversionOption.hpp>
+// header for define RET_OK
+#include <vcl/msgbox.hxx>
+// header for class SvtLinguConfigItem
+#include <unotools/lingucfg.hxx>
+#include <unotools/linguprops.hxx>
+#ifndef _SVX_HELPID_HRC
+#include "helpid.hrc"
+#endif
+
+//disable compiler warning C4355: 'this' : used in base member initializer list
+#ifdef _MSC_VER
+# pragma warning (disable : 4355)
+#endif
+
+//.............................................................................
+namespace textconversiondlgs
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+ChineseTranslationDialog::ChineseTranslationDialog( Window* pParent )
+ : ModalDialog( pParent, TextConversionDlgs_ResId( DLG_CHINESETRANSLATION ) )
+ , m_aFL_Direction( this, TextConversionDlgs_ResId( FL_DIRECTION ) )
+ , m_aRB_To_Simplified( this, TextConversionDlgs_ResId( RB_TO_SIMPLIFIED ) )
+ , m_aRB_To_Traditional( this, TextConversionDlgs_ResId( RB_TO_TRADITIONAL ) )
+ , m_aCB_Use_Variants( this, TextConversionDlgs_ResId( CB_USE_VARIANTS ) )
+ , m_aFL_Commonterms( this, TextConversionDlgs_ResId( FL_COMMONTERMS ) )
+ , m_aCB_Translate_Commonterms( this, TextConversionDlgs_ResId( CB_TRANSLATE_COMMONTERMS ) )
+ , m_aPB_Editterms( this, TextConversionDlgs_ResId( PB_EDITTERMS ) )
+ , m_aFL_Bottomline( this, TextConversionDlgs_ResId( FL_BOTTOMLINE ) )
+ , m_aBP_OK( this, TextConversionDlgs_ResId( PB_OK ) )
+ , m_aBP_Cancel( this, TextConversionDlgs_ResId( PB_CANCEL ) )
+ , m_aBP_Help( this, TextConversionDlgs_ResId( PB_HELP ) )
+ , m_pDictionaryDialog(0)
+{
+ FreeResource();
+
+ m_aRB_To_Simplified.SetHelpId( HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_SIMPLIFIED );
+ m_aRB_To_Traditional.SetHelpId( HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_TRADITIONAL );
+ m_aCB_Use_Variants.SetHelpId( HID_SVX_CHINESE_TRANSLATION_CB_USE_VARIANTS );
+
+ SvtLinguConfig aLngCfg;
+ sal_Bool bValue = sal_Bool();
+ Any aAny( aLngCfg.GetProperty( rtl::OUString::createFromAscii( UPN_IS_DIRECTION_TO_SIMPLIFIED ) ) );
+ aAny >>= bValue;
+ if( bValue )
+ m_aRB_To_Simplified.Check();
+ else
+ m_aRB_To_Traditional.Check();
+
+ aAny = aLngCfg.GetProperty( rtl::OUString::createFromAscii( UPN_IS_USE_CHARACTER_VARIANTS ) );
+ if( aAny >>= bValue )
+ m_aCB_Use_Variants.Check( bValue );
+
+ // #117820# (search for other occurences!)
+ // disable and hide that checkbox until it is decided if it is needed or not.
+ // If it is to be removed later the respective code needs to be removed as
+ // well, otherwise we just have to remove the next lines again.
+ m_aCB_Use_Variants.Check( sal_False );
+ m_aCB_Use_Variants.Enable( sal_False );
+ m_aCB_Use_Variants.Show( sal_False );
+
+ aAny = aLngCfg.GetProperty( rtl::OUString::createFromAscii( UPN_IS_TRANSLATE_COMMON_TERMS ) );
+ if( aAny >>= bValue )
+ m_aCB_Translate_Commonterms.Check( bValue );
+
+ m_aPB_Editterms.SetClickHdl( LINK( this, ChineseTranslationDialog, DictionaryHdl ) );
+ m_aRB_To_Simplified.SetClickHdl( LINK( this, ChineseTranslationDialog, DirectionHdl ) );
+ m_aRB_To_Traditional.SetClickHdl( LINK( this, ChineseTranslationDialog, DirectionHdl ) );
+ m_aCB_Translate_Commonterms.SetClickHdl( LINK( this, ChineseTranslationDialog, CommonTermsHdl ) );
+ m_aBP_OK.SetClickHdl( LINK( this, ChineseTranslationDialog, OkHdl ) );
+
+ impl_UpdateVariantsCheckBox();
+}
+
+ChineseTranslationDialog::~ChineseTranslationDialog()
+{
+ if(m_pDictionaryDialog)
+ {
+ if(m_pDictionaryDialog->IsInExecute())
+ m_pDictionaryDialog->EndDialog();
+ delete m_pDictionaryDialog;
+ }
+}
+
+void ChineseTranslationDialog::getSettings( sal_Bool& rbDirectionToSimplified
+ , sal_Bool& rbUseCharacterVariants
+ , sal_Bool& rbTranslateCommonTerms ) const
+{
+ rbDirectionToSimplified = m_aRB_To_Simplified.IsChecked();
+ rbUseCharacterVariants = m_aCB_Use_Variants.IsChecked();
+ rbTranslateCommonTerms = m_aCB_Translate_Commonterms.IsChecked();
+}
+
+void ChineseTranslationDialog::impl_UpdateVariantsCheckBox()
+{
+// #117820# (search for other occurences!)
+// m_aCB_Use_Variants.Enable( m_aRB_To_Traditional.IsChecked() );
+}
+
+IMPL_LINK( ChineseTranslationDialog, DirectionHdl, void*, EMPTYARG )
+{
+ impl_UpdateVariantsCheckBox();
+ return 0;
+}
+
+IMPL_LINK( ChineseTranslationDialog, CommonTermsHdl, void*, EMPTYARG )
+{
+// #117820# (search for other occurences!)
+// if( m_aCB_Translate_Commonterms.IsChecked() && m_aRB_To_Traditional.IsChecked() )
+// m_aCB_Use_Variants.Check( true );
+ return 0;
+}
+
+IMPL_LINK( ChineseTranslationDialog, OkHdl, void*, EMPTYARG )
+{
+ //save settings to configuration
+ SvtLinguConfig aLngCfg;
+ Any aAny;
+ aAny <<= sal_Bool( !!m_aRB_To_Simplified.IsChecked() );
+ aLngCfg.SetProperty( rtl::OUString::createFromAscii( UPN_IS_DIRECTION_TO_SIMPLIFIED ), aAny );
+ aAny <<= sal_Bool( !!m_aCB_Use_Variants.IsChecked() );
+ aLngCfg.SetProperty( rtl::OUString::createFromAscii( UPN_IS_USE_CHARACTER_VARIANTS ), aAny );
+ aAny <<= sal_Bool( !!m_aCB_Translate_Commonterms.IsChecked() );
+ aLngCfg.SetProperty( rtl::OUString::createFromAscii( UPN_IS_TRANSLATE_COMMON_TERMS ), aAny );
+
+ EndDialog( RET_OK );
+ return 0;
+}
+
+IMPL_LINK( ChineseTranslationDialog, DictionaryHdl, void*, EMPTYARG )
+{
+ if( !m_pDictionaryDialog )
+ {
+ m_pDictionaryDialog = new ChineseDictionaryDialog(this);
+ }
+ if( m_pDictionaryDialog )
+ {
+ if( m_pDictionaryDialog->IsInExecute() )
+ {
+ if( !m_pDictionaryDialog->IsReallyVisible() )
+ {
+ m_pDictionaryDialog->ToTop();
+ m_pDictionaryDialog->GrabFocusToFirstControl();
+ }
+ }
+ else
+ {
+ sal_Int32 nTextConversionOptions = i18n::TextConversionOption::NONE;
+ if( !m_aCB_Translate_Commonterms.IsChecked() )
+ nTextConversionOptions = nTextConversionOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
+ if( m_aCB_Use_Variants.IsChecked() )
+ nTextConversionOptions = nTextConversionOptions | i18n::TextConversionOption::USE_CHARACTER_VARIANTS;
+
+ m_pDictionaryDialog->setDirectionAndTextConversionOptions( m_aRB_To_Simplified.IsChecked(), nTextConversionOptions );
+ m_pDictionaryDialog->Execute();
+ }
+ }
+ return 0;
+}
+
+//.............................................................................
+} //end namespace
+//.............................................................................
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hrc b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hrc
new file mode 100644
index 000000000000..5e593ef467a3
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hrc
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _TEXTCONVERSIONDLGS_CHINESE_TRANSLATIONDLG_HRC
+#define _TEXTCONVERSIONDLGS_CHINESE_TRANSLATIONDLG_HRC
+
+#include "resids.hrc"
+#include "buttongroup.hrc"
+#include "chinese_direction_ids.hrc"
+
+#define PB_EDITTERMS 1
+
+#define CB_USE_VARIANTS 1
+#define CB_TRANSLATE_COMMONTERMS 2
+#define CB_REVERSE 3
+
+#define FL_DIRECTION 1
+#define FL_COMMONTERMS 2
+#define FL_BOTTOMLINE 3
+
+#endif
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx
new file mode 100644
index 000000000000..9d046d120e68
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _TEXTCONVERSIONDLGS_CHINESE_TRANSLATIONDLG_HXX
+#define _TEXTCONVERSIONDLGS_CHINESE_TRANSLATIONDLG_HXX
+
+#include <vcl/dialog.hxx>
+// header for class FixedLine
+#include <vcl/fixed.hxx>
+// header for class RadioButton
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+
+//.............................................................................
+namespace textconversiondlgs
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class ChineseDictionaryDialog;
+
+class ChineseTranslationDialog : public ModalDialog
+{
+public:
+ ChineseTranslationDialog( Window* pParent );
+ virtual ~ChineseTranslationDialog();
+
+ void getSettings( sal_Bool& rbDirectionToSimplified
+ , sal_Bool& rbUseCharacterVariants
+ , sal_Bool& rbTranslateCommonTerms ) const;
+
+private:
+ DECL_LINK( DictionaryHdl, void* );
+ DECL_LINK( DirectionHdl, void* );
+ DECL_LINK( CommonTermsHdl, void* );
+ DECL_LINK( OkHdl, void* );
+ void impl_UpdateVariantsCheckBox();
+
+private:
+ FixedLine m_aFL_Direction;
+
+ RadioButton m_aRB_To_Simplified;
+ RadioButton m_aRB_To_Traditional;
+ CheckBox m_aCB_Use_Variants;
+
+ FixedLine m_aFL_Commonterms;
+
+ CheckBox m_aCB_Translate_Commonterms;
+ PushButton m_aPB_Editterms;
+
+ FixedLine m_aFL_Bottomline;
+
+ OKButton m_aBP_OK;
+ CancelButton m_aBP_Cancel;
+ HelpButton m_aBP_Help;
+
+ ChineseDictionaryDialog* m_pDictionaryDialog;
+};
+
+//.............................................................................
+} //end namespace
+//.............................................................................
+#endif
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src
new file mode 100644
index 000000000000..397466a7dc68
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 "chinese_translationdialog.hrc"
+#include "chinese_direction.hrc"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+//-----------------------------------------------------------------------------
+//defines for positions and sizes:
+
+#define FULL_WIDTH (220)
+#define FULL_HEIGHT (120)
+#define EDITBUTTON_WIDTH (75)
+
+#define COL_1 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define COL_2 (COL_1+RSC_SP_FLGR_SPACE_X)
+#define COL_3 (COL_2+RSC_SP_CHK_TEXTINDENT)
+#define COL_4 (FULL_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT-EDITBUTTON_WIDTH)
+
+#define ROW_1 (RSC_SP_DLG_INNERBORDER_TOP)
+#define ROW_2 (ROW_1+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define ROW_3 (ROW_2+RSC_CD_RADIOBUTTON_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define ROW_4 (ROW_3+RSC_CD_RADIOBUTTON_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_5 (ROW_4+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_Y)
+#define ROW_6 (ROW_5+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+
+#define ROW_8 (FULL_HEIGHT-RSC_SP_DLG_INNERBORDER_BOTTOM-RSC_CD_PUSHBUTTON_HEIGHT)
+#define ROW_7 (ROW_8-RSC_CD_FIXEDLINE_HEIGHT-2)
+
+//-----------------------------------------------------------------------------
+
+ModalDialog DLG_CHINESETRANSLATION
+{
+ //HelpId = ;
+ Size = MAP_APPFONT( FULL_WIDTH, FULL_HEIGHT );
+ OutputSize = TRUE;
+ Closeable = TRUE ;
+ Moveable = TRUE ;
+ SVLook = TRUE;
+
+ Text [ en-US ] = "Chinese Conversion";
+
+ FixedLine FL_DIRECTION
+ {
+ Pos = MAP_APPFONT ( COL_1 , ROW_1 ) ;
+ Size = MAP_APPFONT ( FULL_WIDTH - COL_1 - RSC_SP_DLG_INNERBORDER_RIGHT, RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Conversion direction";
+ };
+
+ DIRECTION_RADIOBUTTONS( COL_2, ROW_2, (FULL_WIDTH - COL_2 - RSC_SP_DLG_INNERBORDER_RIGHT) )
+
+ CheckBox CB_USE_VARIANTS
+ {
+ Pos = MAP_APPFONT( COL_3, ROW_4 );
+ Size = MAP_APPFONT ( FULL_WIDTH - COL_3 - RSC_SP_DLG_INNERBORDER_RIGHT, RSC_CD_CHECKBOX_HEIGHT ) ;
+
+ Text [ en-US ] = "~Use Taiwan, Hong Kong SAR, and Macao SAR character variants";
+ };
+
+ FixedLine FL_COMMONTERMS
+ {
+ Pos = MAP_APPFONT ( COL_1 , ROW_5 ) ;
+ Size = MAP_APPFONT ( FULL_WIDTH - COL_1 - RSC_SP_DLG_INNERBORDER_RIGHT, RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Common terms";
+ };
+
+ CheckBox CB_TRANSLATE_COMMONTERMS
+ {
+ Pos = MAP_APPFONT( COL_2, ROW_6 );
+ Size = MAP_APPFONT ( COL_4 - COL_2, RSC_CD_CHECKBOX_HEIGHT ) ;
+
+ Text [ en-US ] = "Translate ~common terms";
+ };
+
+ PushButton PB_EDITTERMS
+ {
+ Pos = MAP_APPFONT( COL_4, ROW_6-(RSC_CD_PUSHBUTTON_HEIGHT-RSC_CD_CHECKBOX_HEIGHT)/2 );
+ Size = MAP_APPFONT( EDITBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+
+ Text [ en-US ] = "~Edit Terms...";
+ };
+
+ FixedLine FL_BOTTOMLINE
+ {
+ Pos = MAP_APPFONT ( 0 , ROW_7 ) ;
+ Size = MAP_APPFONT ( FULL_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ) ;
+ };
+
+ BUTTONS_OK_CANCEL_HELP_ABREAST( FULL_WIDTH - RSC_SP_DLG_INNERBORDER_RIGHT, ROW_8 )
+};
diff --git a/svx/source/unodialogs/textconversiondlgs/export.map b/svx/source/unodialogs/textconversiondlgs/export.map
new file mode 100644
index 000000000000..ff4971857d69
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/export.map
@@ -0,0 +1,8 @@
+EXTDBI_1_0 {
+ global:
+ component_getImplementationEnvironment;
+ component_writeInfo;
+ component_getFactory;
+ local:
+ *;
+};
diff --git a/svx/source/unodialogs/textconversiondlgs/makefile.mk b/svx/source/unodialogs/textconversiondlgs/makefile.mk
new file mode 100644
index 000000000000..6cdec3906c9a
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/makefile.mk
@@ -0,0 +1,90 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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=svx
+TARGET=textconversiondlgs
+ENABLE_EXCEPTIONS=TRUE
+USE_DEFFILE=TRUE
+
+LOCALIZE_ME=chinese_direction_tmpl.hrc
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/services.obj\
+ $(SLO)$/resid.obj\
+ $(SLO)$/chinese_dictionarydialog.obj\
+ $(SLO)$/chinese_translationdialog.obj\
+ $(SLO)$/chinese_translation_unodialog.obj
+
+SRS1NAME=$(TARGET)
+SRC1FILES= \
+ chinese_translationdialog.src\
+ chinese_dictionarydialog.src
+
+RESLIB1NAME=$(TARGET)
+RESLIB1SRSFILES= $(SRS)$/$(TARGET).srs
+
+.IF "$(GUI)" == "OS2"
+SHL1TARGET= txcnvdlg
+.ELSE
+SHL1TARGET= $(TARGET)$(DLLPOSTFIX)
+.ENDIF
+SHL1VERSIONMAP= export.map
+
+SHL1STDLIBS= \
+ $(CPPULIB) \
+ $(SALLIB) \
+ $(CPPUHELPERLIB) \
+ $(UNOTOOLSLIB) \
+ $(COMPHELPERLIB) \
+ $(TOOLSLIB) \
+ $(TKLIB) \
+ $(SVTOOLLIB) \
+ $(SVLLIB) \
+ $(VCLLIB)
+
+SHL1LIBS= $(SLB)$/$(TARGET).lib
+SHL1IMPLIB= i$(TARGET)
+SHL1DEPN= $(SHL1LIBS)
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME= $(SHL1TARGET)
+
+
+# --- Targets ------------------------------------------------------
+.INCLUDE : target.mk
+
+$(SRS)$/$(TARGET).srs: $(INCCOM)$/chinese_direction.hrc
+$(SLO)$/chinese_dictionarydialog.obj: $(INCCOM)$/chinese_direction.hrc
+$(SLO)$/chinese_translationdialog.obj: $(INCCOM)$/chinese_direction.hrc
+
diff --git a/svx/source/unodialogs/textconversiondlgs/resid.cxx b/svx/source/unodialogs/textconversiondlgs/resid.cxx
new file mode 100644
index 000000000000..d4779aad151f
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/resid.cxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_svx.hxx"
+#include "resid.hxx"
+#include <tools/resmgr.hxx>
+
+//.............................................................................
+namespace textconversiondlgs
+{
+//.............................................................................
+
+static ResMgr* getTextConversionResMgr()
+{
+ static ResMgr* pMgr = NULL;
+ if( ! pMgr )
+ pMgr = ResMgr::CreateResMgr( "textconversiondlgs" );
+ return pMgr;
+}
+TextConversionDlgs_ResId::TextConversionDlgs_ResId(USHORT nId)
+ : ResId( nId, *getTextConversionResMgr() )
+{
+}
+
+//.............................................................................
+} //end namespace
+//.............................................................................
diff --git a/svx/source/unodialogs/textconversiondlgs/resid.hxx b/svx/source/unodialogs/textconversiondlgs/resid.hxx
new file mode 100644
index 000000000000..ed474b59c32d
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/resid.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _TEXTCONVERSIONDLGS_RESID_HXX
+#define _TEXTCONVERSIONDLGS_RESID_HXX
+
+#include <tools/resid.hxx>
+
+//.............................................................................
+namespace textconversiondlgs
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class TextConversionDlgs_ResId : public ResId
+{
+ public:
+ TextConversionDlgs_ResId(USHORT nId);
+};
+
+//.............................................................................
+} //end namespace
+//.............................................................................
+#endif
diff --git a/svx/source/unodialogs/textconversiondlgs/resids.hrc b/svx/source/unodialogs/textconversiondlgs/resids.hrc
new file mode 100644
index 000000000000..0c2e3965295d
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/resids.hrc
@@ -0,0 +1,33 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _TEXTCONVERSIONDLGS_RESID_HRC
+#define _TEXTCONVERSIONDLGS_RESID_HRC
+
+#define DLG_CHINESETRANSLATION 300
+#define DLG_CHINESEDICTIONARY 301
+
+#endif
diff --git a/svx/source/unodialogs/textconversiondlgs/services.cxx b/svx/source/unodialogs/textconversiondlgs/services.cxx
new file mode 100644
index 000000000000..e397ba9e5860
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/services.cxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_svx.hxx"
+#include "chinese_translation_unodialog.hxx"
+#include <cppuhelper/implementationentry.hxx>
+
+static struct ::cppu::ImplementationEntry g_entries_unodialogs_chinesetranslation[] =
+{
+ {
+ ::textconversiondlgs::ChineseTranslation_UnoDialog::create
+ , ::textconversiondlgs::ChineseTranslation_UnoDialog::getImplementationName_Static
+ , ::textconversiondlgs::ChineseTranslation_UnoDialog::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{ 0, 0, 0, 0, 0, 0 }
+};
+
+// component exports
+extern "C"
+{
+//==================================================================================================
+void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+//==================================================================================================
+sal_Bool SAL_CALL component_writeInfo(
+ void * pServiceManager, void * pRegistryKey )
+{
+ return ::cppu::component_writeInfoHelper(
+ pServiceManager, pRegistryKey, g_entries_unodialogs_chinesetranslation );
+}
+//==================================================================================================
+void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
+{
+ return ::cppu::component_getFactoryHelper(
+ pImplName, pServiceManager, pRegistryKey , g_entries_unodialogs_chinesetranslation );
+}
+}
+//=========================================================================