diff options
author | Mathias Bauer <mba@openoffice.org> | 2010-07-13 14:38:37 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2010-07-13 14:38:37 +0200 |
commit | ca851f72310bf83c0e6e7cb98fd58e6271fa0f01 (patch) | |
tree | 7f1d1b1461d41b823a7a91464b1874c21b25d2a3 /unotools/source | |
parent | 22e9afcab567030e0b1d029400dd85851b2d86e3 (diff) | |
parent | be588658ea127a6a05390435126f1d739a477b58 (diff) |
CWS changehid: resync to m84
Diffstat (limited to 'unotools/source')
-rw-r--r-- | unotools/source/config/configmgr.cxx | 15 | ||||
-rw-r--r-- | unotools/source/config/confignode.cxx | 262 | ||||
-rw-r--r-- | unotools/source/config/configvaluecontainer.cxx | 2 | ||||
-rw-r--r-- | unotools/source/config/lingucfg.cxx | 71 | ||||
-rw-r--r-- | unotools/source/i18n/transliterationwrapper.cxx | 40 | ||||
-rw-r--r-- | unotools/source/misc/fontcvt.cxx | 16 | ||||
-rw-r--r-- | unotools/source/misc/fontdefs.cxx | 8 |
7 files changed, 237 insertions, 177 deletions
diff --git a/unotools/source/config/configmgr.cxx b/unotools/source/config/configmgr.cxx index 5f16733b5249..0df6d49afe59 100644 --- a/unotools/source/config/configmgr.cxx +++ b/unotools/source/config/configmgr.cxx @@ -70,6 +70,8 @@ namespace : public rtl::Static< ::rtl::OUString, ProductVersion > {}; struct AboutBoxProductVersion : public rtl::Static< ::rtl::OUString, AboutBoxProductVersion > {}; + struct OOOVendor + : public rtl::Static< ::rtl::OUString, OOOVendor > {}; struct ProductExtension : public rtl::Static< ::rtl::OUString, ProductExtension > {}; struct XMLFileFormatName @@ -433,6 +435,14 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp) return aRet; } + rtl::OUString &rOOOVendor = OOOVendor::get(); + if ( eProp == OOOVENDOR && rOOOVendor.getLength() ) + { + aRet <<= rOOOVendor; + return aRet; + } + + rtl::OUString &rProductExtension = ProductExtension::get(); if ( eProp == PRODUCTEXTENSION && rProductExtension.getLength() ) { @@ -493,6 +503,7 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp) case PRODUCTXMLFILEFORMATNAME : case PRODUCTXMLFILEFORMATVERSION: case OPENSOURCECONTEXT: + case OOOVENDOR: case ABOUTBOXPRODUCTVERSION: sPath += C2U("Setup/Product"); break; case DEFAULTCURRENCY: sPath += C2U("Setup/L10N"); break; @@ -526,6 +537,7 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp) case PRODUCTNAME: sProperty = C2U("ooName"); break; case PRODUCTVERSION: sProperty = C2U("ooSetupVersion"); break; case ABOUTBOXPRODUCTVERSION: sProperty = C2U("ooSetupVersionAboutBox"); break; + case OOOVENDOR: sProperty = C2U("ooVendor"); break; case PRODUCTEXTENSION: sProperty = C2U("ooSetupExtension"); break; case PRODUCTXMLFILEFORMATNAME: sProperty = C2U("ooXMLFileFormatName"); break; case PRODUCTXMLFILEFORMATVERSION: sProperty = C2U("ooXMLFileFormatVersion"); break; @@ -565,6 +577,9 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp) if ( eProp == PRODUCTVERSION ) aRet >>= rProductVersion; + if( eProp == OOOVENDOR ) + aRet >>= rOOOVendor; + if ( eProp == ABOUTBOXPRODUCTVERSION ) { aRet >>= rAboutBoxProductVersion; diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx index 802a63782cf9..181c7ca46c8f 100644 --- a/unotools/source/config/confignode.cxx +++ b/unotools/source/config/confignode.cxx @@ -40,6 +40,8 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/container/XNamed.hpp> #include <comphelper/extract.hxx> +#include <comphelper/componentcontext.hxx> +#include <comphelper/namedvaluecollection.hxx> #include <rtl/string.hxx> #if OSL_DEBUG_LEVEL > 0 #include <rtl/strbuf.hxx> @@ -60,9 +62,8 @@ namespace utl //= OConfigurationNode //======================================================================== //------------------------------------------------------------------------ - OConfigurationNode::OConfigurationNode(const Reference< XInterface >& _rxNode, const Reference< XMultiServiceFactory >& _rxProvider) - :m_xProvider(_rxProvider) - ,m_bEscapeNames(sal_False) + OConfigurationNode::OConfigurationNode(const Reference< XInterface >& _rxNode ) + :m_bEscapeNames(sal_False) { OSL_ENSURE(_rxNode.is(), "OConfigurationNode::OConfigurationNode: invalid node interface!"); if (_rxNode.is()) @@ -98,7 +99,6 @@ namespace utl ,m_xDirectAccess(_rSource.m_xDirectAccess) ,m_xReplaceAccess(_rSource.m_xReplaceAccess) ,m_xContainerAccess(_rSource.m_xContainerAccess) - ,m_xProvider(_rSource.m_xProvider) ,m_bEscapeNames(_rSource.m_bEscapeNames) ,m_sCompletePath(_rSource.m_sCompletePath) { @@ -116,7 +116,6 @@ namespace utl m_xDirectAccess = _rSource.m_xDirectAccess; m_xContainerAccess = _rSource.m_xContainerAccess; m_xReplaceAccess = _rSource.m_xReplaceAccess; - m_xProvider = _rSource.m_xProvider; m_bEscapeNames = _rSource.m_bEscapeNames; m_sCompletePath = _rSource.m_sCompletePath; @@ -153,6 +152,22 @@ namespace utl } //------------------------------------------------------------------------ + ::rtl::OUString OConfigurationNode::getNodePath() const + { + ::rtl::OUString sNodePath; + try + { + Reference< XHierarchicalName > xNamed( m_xDirectAccess, UNO_QUERY_THROW ); + sNodePath = xNamed->getHierarchicalName(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return sNodePath; + } + + //------------------------------------------------------------------------ ::rtl::OUString OConfigurationNode::normalizeName(const ::rtl::OUString& _rName, NAMEORIGIN _eOrigin) const { ::rtl::OUString sName(_rName); @@ -244,7 +259,7 @@ namespace utl ::rtl::OUString sName = normalizeName(_rName, NO_CALLER); m_xContainerAccess->insertByName(sName, makeAny(_xNode)); // if we're here, all was ok ... - return OConfigurationNode(_xNode, m_xProvider); + return OConfigurationNode( _xNode ); } catch(const Exception&) { @@ -308,7 +323,7 @@ namespace utl OSL_ENSURE(sal_False, "OConfigurationNode::openNode: could not open the node!"); } if (xNode.is()) - return OConfigurationNode(xNode, m_xProvider); + return OConfigurationNode( xNode ); } catch(NoSuchElementException& e) { @@ -470,60 +485,112 @@ namespace utl } //------------------------------------------------------------------------ - OConfigurationTreeRoot OConfigurationNode::cloneAsRoot() const throw() + void OConfigurationNode::clear() throw() { - OSL_ENSURE(m_xHierarchyAccess.is(), "OConfigurationNode::cloneAsRoot: object is invalid!"); - if (m_xHierarchyAccess.is()) + m_xHierarchyAccess.clear(); + m_xDirectAccess.clear(); + m_xReplaceAccess.clear(); + m_xContainerAccess.clear(); + } + + //======================================================================== + //= helper + //======================================================================== + namespace + { + //-------------------------------------------------------------------- + static const ::rtl::OUString& lcl_getProviderServiceName( ) { - // first get the complete path of the node we represent - ::rtl::OUString sCompletePath; - Reference< XHierarchicalName > xNodeNameAccess(m_xHierarchyAccess, UNO_QUERY); - if (xNodeNameAccess.is()) + static ::rtl::OUString s_sProviderServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ); + return s_sProviderServiceName; + } + + //-------------------------------------------------------------------- + Reference< XMultiServiceFactory > lcl_getConfigProvider( const ::comphelper::ComponentContext& i_rContext ) + { + try { - try - { - sCompletePath = xNodeNameAccess->getHierarchicalName(); - OSL_ENSURE(sCompletePath.getLength(), "OConfigurationNode::cloneAsRoot: invalid path retrieved!"); - } - catch(Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } + Reference< XMultiServiceFactory > xProvider( i_rContext.createComponent( lcl_getProviderServiceName() ), UNO_QUERY_THROW ); + return xProvider; + } + catch ( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); } + return NULL; + } - // then create a new tree root object with that path and our provider - OSL_ENSURE(m_xProvider.is(), "OConfigurationNode::cloneAsRoot: have an invalid provider!"); - if (sCompletePath.getLength() && m_xProvider.is()) + //-------------------------------------------------------------------- + Reference< XInterface > lcl_createConfigurationRoot( const Reference< XMultiServiceFactory >& i_rxConfigProvider, + const ::rtl::OUString& i_rNodePath, const bool i_bUpdatable, const sal_Int32 i_nDepth, const bool i_bLazyWrite ) + { + ENSURE_OR_RETURN( i_rxConfigProvider.is(), "invalid provider", NULL ); + try { - return OConfigurationTreeRoot::createWithProvider(m_xProvider, sCompletePath, -1, isReadonly() ? OConfigurationTreeRoot::CM_READONLY : OConfigurationTreeRoot::CM_PREFER_UPDATABLE); + ::comphelper::NamedValueCollection aArgs; + aArgs.put( "nodepath", i_rNodePath ); + aArgs.put( "lazywrite", i_bLazyWrite ); + aArgs.put( "depth", i_nDepth ); + + ::rtl::OUString sAccessService = ::rtl::OUString::createFromAscii( + i_bUpdatable + ? "com.sun.star.configuration.ConfigurationUpdateAccess" + : "com.sun.star.configuration.ConfigurationAccess" ); + + Reference< XInterface > xRoot( + i_rxConfigProvider->createInstanceWithArguments( sAccessService, aArgs.getWrappedPropertyValues() ), + UNO_SET_THROW + ); + return xRoot; } + catch ( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return NULL; } - return OConfigurationTreeRoot(); + } + //======================================================================== + //= OConfigurationTreeRoot + //======================================================================== + //------------------------------------------------------------------------ + OConfigurationTreeRoot::OConfigurationTreeRoot( const Reference< XChangesBatch >& _rxRootNode ) + :OConfigurationNode( _rxRootNode.get() ) + ,m_xCommitter(_rxRootNode) + { } //------------------------------------------------------------------------ - void OConfigurationNode::clear() throw() + OConfigurationTreeRoot::OConfigurationTreeRoot( const Reference< XInterface >& _rxRootNode ) + :OConfigurationNode( _rxRootNode ) + ,m_xCommitter( _rxRootNode, UNO_QUERY ) { - m_xHierarchyAccess.clear(); - m_xDirectAccess.clear(); - m_xReplaceAccess.clear(); - m_xContainerAccess.clear(); } - //======================================================================== - //= OConfigurationTreeRoot - //======================================================================== //------------------------------------------------------------------------ - OConfigurationTreeRoot::OConfigurationTreeRoot(const Reference< XChangesBatch >& _rxRootNode, const Reference< XMultiServiceFactory >& _rxProvider) - :OConfigurationNode(_rxRootNode.get(), _rxProvider) - ,m_xCommitter(_rxRootNode) + OConfigurationTreeRoot::OConfigurationTreeRoot( const ::comphelper::ComponentContext& i_rContext, const sal_Char* i_pAsciiNodePath, const bool i_bUpdatable ) + :OConfigurationNode( lcl_createConfigurationRoot( lcl_getConfigProvider( i_rContext.getLegacyServiceFactory() ), + ::rtl::OUString::createFromAscii( i_pAsciiNodePath ), i_bUpdatable, -1, false ).get() ) + ,m_xCommitter() { + if ( i_bUpdatable ) + { + m_xCommitter.set( getUNONode(), UNO_QUERY ); + OSL_ENSURE( m_xCommitter.is(), "OConfigurationTreeRoot::OConfigurationTreeRoot: could not create an updatable node!" ); + } } //------------------------------------------------------------------------ - OConfigurationTreeRoot::OConfigurationTreeRoot(const Reference< XInterface >& _rxRootNode, const Reference< XMultiServiceFactory >& _rxProvider) - :OConfigurationNode(_rxRootNode.get(), _rxProvider) + OConfigurationTreeRoot::OConfigurationTreeRoot( const ::comphelper::ComponentContext& i_rContext, const ::rtl::OUString& i_rNodePath, const bool i_bUpdatable ) + :OConfigurationNode( lcl_createConfigurationRoot( lcl_getConfigProvider( i_rContext.getLegacyServiceFactory() ), + i_rNodePath, i_bUpdatable, -1, false ).get() ) + ,m_xCommitter() { + if ( i_bUpdatable ) + { + m_xCommitter.set( getUNONode(), UNO_QUERY ); + OSL_ENSURE( m_xCommitter.is(), "OConfigurationTreeRoot::OConfigurationTreeRoot: could not create an updatable node!" ); + } } //------------------------------------------------------------------------ @@ -555,117 +622,20 @@ namespace utl return sal_False; } - namespace - { - static const ::rtl::OUString& lcl_getProviderServiceName( ) - { - static ::rtl::OUString s_sProviderServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ); - return s_sProviderServiceName; - } - } - //------------------------------------------------------------------------ OConfigurationTreeRoot OConfigurationTreeRoot::createWithProvider(const Reference< XMultiServiceFactory >& _rxConfProvider, const ::rtl::OUString& _rPath, sal_Int32 _nDepth, CREATION_MODE _eMode, sal_Bool _bLazyWrite) { - OSL_ENSURE(_rxConfProvider.is(), "OConfigurationTreeRoot::createWithProvider: invalid provider!"); - -#ifdef DBG_UTIL - if (_rxConfProvider.is()) - { - try - { - Reference< XServiceInfo > xSI(_rxConfProvider, UNO_QUERY); - if (!xSI.is()) - { - OSL_ENSURE(sal_False, "OConfigurationTreeRoot::createWithProvider: no XServiceInfo interface on the provider!"); - } - else - { - OSL_ENSURE(xSI->supportsService( lcl_getProviderServiceName( ) ), - "OConfigurationTreeRoot::createWithProvider: sure this is a provider? Missing the ConfigurationProvider service!"); - } - } - catch(const Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - } -#endif - - sal_Bool bTryAgain(sal_False); - do - { - if (_rxConfProvider.is()) - { - try - { - Sequence< Any > aCreationArgs(3); - aCreationArgs[0] = makeAny(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), 0, makeAny(_rPath), PropertyState_DIRECT_VALUE)); - aCreationArgs[1] = makeAny(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("depth")), 0, makeAny((sal_Int32)_nDepth), PropertyState_DIRECT_VALUE)); - aCreationArgs[2] = makeAny(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("lazywrite")), 0, ::cppu::bool2any(_bLazyWrite), PropertyState_DIRECT_VALUE)); - - ::rtl::OUString sAccessService = ::rtl::OUString::createFromAscii(CM_READONLY == _eMode - ? "com.sun.star.configuration.ConfigurationAccess" - : "com.sun.star.configuration.ConfigurationUpdateAccess"); - - Reference< XInterface > xRoot = _rxConfProvider->createInstanceWithArguments(sAccessService, aCreationArgs); - if (!xRoot.is()) - { - OSL_ENSURE(sal_False, "OConfigurationTreeRoot::createWithProvider: could not create the node access!"); - } - else if (CM_READONLY == _eMode) - { - return OConfigurationTreeRoot(xRoot, _rxConfProvider); - } - else - { // get the changes batch interface - Reference< XChangesBatch > xCommitter(xRoot, UNO_QUERY); - if (xCommitter.is()) - return OConfigurationTreeRoot(xCommitter, _rxConfProvider); - else - OSL_ENSURE(sal_False, "OConfigurationTreeRoot::createWithProvider: invalid root object (missing interface XChangesBatch)!"); - - // dispose the object if it is already created, but unusable - Reference< XComponent > xComp(xRoot, UNO_QUERY); - if (xComp.is()) - try { xComp->dispose(); } catch(Exception&) { } - } - } - catch(const Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - bTryAgain = CM_PREFER_UPDATABLE == _eMode; - if (bTryAgain) - _eMode = CM_READONLY; - } - while (bTryAgain); - + Reference< XInterface > xRoot( lcl_createConfigurationRoot( + _rxConfProvider, _rPath, _eMode != CM_READONLY, _nDepth, _bLazyWrite ) ); + if ( xRoot.is() ) + return OConfigurationTreeRoot( xRoot ); return OConfigurationTreeRoot(); } //------------------------------------------------------------------------ - OConfigurationTreeRoot OConfigurationTreeRoot::createWithServiceFactory(const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rPath, sal_Int32 _nDepth, CREATION_MODE _eMode, sal_Bool _bLazyWrite) + OConfigurationTreeRoot OConfigurationTreeRoot::createWithServiceFactory( const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rPath, sal_Int32 _nDepth, CREATION_MODE _eMode, sal_Bool _bLazyWrite ) { - OSL_ENSURE(_rxORB.is(), "OConfigurationTreeRoot::createWithServiceFactory: invalid service factory!"); - if (_rxORB.is()) - { - try - { - Reference< XInterface > xProvider = _rxORB->createInstance( lcl_getProviderServiceName( ) ); - OSL_ENSURE(xProvider.is(), "OConfigurationTreeRoot::createWithServiceFactory: could not instantiate the config provider service!"); - Reference< XMultiServiceFactory > xProviderAsFac(xProvider, UNO_QUERY); - OSL_ENSURE(xProviderAsFac.is() || !xProvider.is(), "OConfigurationTreeRoot::createWithServiceFactory: the provider is missing an interface!"); - if (xProviderAsFac.is()) - return createWithProvider(xProviderAsFac, _rPath, _nDepth, _eMode, _bLazyWrite); - } - catch(const Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - return OConfigurationTreeRoot(); + return createWithProvider( lcl_getConfigProvider( _rxORB ), _rPath, _nDepth, _eMode, _bLazyWrite ); } //------------------------------------------------------------------------ @@ -681,9 +651,9 @@ namespace utl if ( xConfigFactory.is() ) return createWithProvider( xConfigFactory, _rPath, _nDepth, _eMode, _bLazyWrite ); } - catch(Exception&) + catch(const Exception&) { - // silent this, 'cause the contract of this method states "no assertions" + // silence this, 'cause the contract of this method states "no assertions" } } return OConfigurationTreeRoot(); diff --git a/unotools/source/config/configvaluecontainer.cxx b/unotools/source/config/configvaluecontainer.cxx index c04f29428bf5..653305f92f74 100644 --- a/unotools/source/config/configvaluecontainer.cxx +++ b/unotools/source/config/configvaluecontainer.cxx @@ -331,7 +331,7 @@ namespace utl m_pImpl->xORB, _rConfigLocation, _nLevels, - ( _nAccessFlags & CVC_UPDATE_ACCESS ) ? OConfigurationTreeRoot::CM_PREFER_UPDATABLE : OConfigurationTreeRoot::CM_READONLY, + ( _nAccessFlags & CVC_UPDATE_ACCESS ) ? OConfigurationTreeRoot::CM_UPDATABLE : OConfigurationTreeRoot::CM_READONLY, ( _nAccessFlags & CVC_IMMEDIATE_UPDATE ) ? sal_False : sal_True ); #ifdef DBG_UTIL diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index 35e0fb8af223..39233f022534 100644 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -1406,21 +1406,72 @@ rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextDictionaryImage( } -bool SvtLinguConfig::HasAnyVendorImages() const +::rtl::OUString SvtLinguConfig::GetThesaurusDialogImage( + const ::rtl::OUString &rServiceImplName, + bool bHighContrast ) const { - bool bRes = false; - try + rtl::OUString aRes; + if (rServiceImplName.getLength() > 0) { - uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW ); + rtl::OUString aImageName( A2OU( bHighContrast ? "ThesaurusDialogImage_HC" : "ThesaurusDialogImage" )); + rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); + aRes = aPath; + } + return aRes; +} - uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() ); - bRes = aElementNames.getLength() > 0; + +::rtl::OUString SvtLinguConfig::GetSynonymsContextImage( + const ::rtl::OUString &rServiceImplName, + bool bHighContrast ) const +{ + rtl::OUString aRes; + if (rServiceImplName.getLength() > 0) + { + rtl::OUString aImageName( A2OU( bHighContrast ? "SynonymsContextMenuImage_HC" : "SynonymsContextMenuImage" )); + rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); + aRes = aPath; } - catch (uno::Exception &) + return aRes; +} + + +bool SvtLinguConfig::HasVendorImages( const char *pImageName ) const +{ + bool bRes = false; + if (pImageName) { - DBG_ASSERT( 0, "exception caught. HasAnyVendorImages failed" ); + try + { + uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW ); + + uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() ); + sal_Int32 nVendors = aElementNames.getLength(); + const rtl::OUString *pVendor = aElementNames.getConstArray(); + for (sal_Int32 i = 0; i < nVendors; ++i) + { + uno::Reference< container::XNameAccess > xNA2( xNA->getByName( pVendor[i] ), uno::UNO_QUERY_THROW ); + uno::Sequence< rtl::OUString > aPropNames( xNA2->getElementNames() ); + sal_Int32 nProps = aPropNames.getLength(); + const rtl::OUString *pPropNames = aPropNames.getConstArray(); + for (sal_Int32 k = 0; k < nProps; ++k) + { + // for a quicker check we ignore the HC image names here + const OUString &rName = pPropNames[k]; + if (rName.equalsAscii( pImageName )) + { + bRes = true; + break; + } + } + } + } + catch (uno::Exception &) + { + DBG_ASSERT( 0, "exception caught. HasVendorImages failed" ); + } } return bRes; } diff --git a/unotools/source/i18n/transliterationwrapper.cxx b/unotools/source/i18n/transliterationwrapper.cxx index 062e34286d4b..a10a52802e19 100644 --- a/unotools/source/i18n/transliterationwrapper.cxx +++ b/unotools/source/i18n/transliterationwrapper.cxx @@ -31,11 +31,12 @@ #include <unotools/transliterationwrapper.hxx> #include <tools/debug.hxx> #include <i18npool/mslangid.hxx> -#ifndef _COMPHELPER_COMPONENTFACTORY_HXX_ #include <comphelper/componentfactory.hxx> -#endif + #include <com/sun/star/uno/XInterface.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> #define TRANSLIT_LIBRARYNAME "i18n" #define TRANSLIT_SERVICENAME "com.sun.star.i18n.Transliteration" @@ -147,7 +148,10 @@ sal_Bool TransliterationWrapper::needLanguageForTheMode() const { return TransliterationModules_UPPERCASE_LOWERCASE == nType || TransliterationModules_LOWERCASE_UPPERCASE == nType || - TransliterationModules_IGNORE_CASE == nType; + TransliterationModules_IGNORE_CASE == nType || + (sal_uInt32) TransliterationModulesExtra::SENTENCE_CASE == (sal_uInt32) nType || + (sal_uInt32) TransliterationModulesExtra::TITLE_CASE == (sal_uInt32) nType || + (sal_uInt32) TransliterationModulesExtra::TOGGLE_CASE == (sal_uInt32) nType; } @@ -165,14 +169,32 @@ void TransliterationWrapper::loadModuleIfNeeded( sal_uInt16 nLang ) sal_Bool bLoad = bFirstCall; bFirstCall = sal_False; - if( nLanguage != nLang ) + if( static_cast< sal_Int32 >(nType) == TransliterationModulesExtra::SENTENCE_CASE ) { - setLanguageLocaleImpl( nLang ); - if( !bLoad ) - bLoad = needLanguageForTheMode(); + if( bLoad ) + loadModuleByImplName(String::CreateFromAscii("SENTENCE_CASE"), nLang); + } + else if( static_cast< sal_Int32 >(nType) == TransliterationModulesExtra::TITLE_CASE ) + { + if( bLoad ) + loadModuleByImplName(String::CreateFromAscii("TITLE_CASE"), nLang); + } + else if( static_cast< sal_Int32 >(nType) == TransliterationModulesExtra::TOGGLE_CASE ) + { + if( bLoad ) + loadModuleByImplName(String::CreateFromAscii("TOGGLE_CASE"), nLang); + } + else + { + if( nLanguage != nLang ) + { + setLanguageLocaleImpl( nLang ); + if( !bLoad ) + bLoad = needLanguageForTheMode(); + } + if( bLoad ) + loadModuleImpl(); } - if( bLoad ) - loadModuleImpl(); } diff --git a/unotools/source/misc/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx index 1a31272a483c..2bb682e4915b 100644 --- a/unotools/source/misc/fontcvt.cxx +++ b/unotools/source/misc/fontcvt.cxx @@ -295,18 +295,18 @@ static const sal_Unicode aWingDings2Tab[224] = // F050 0xe52f, 0xe530, 0xe531, 0xe532, 0xe533, 0xe534, 0xe535, 0xe536, - 0xe537, 0xe538, 0xe539, 0xe53a, + 0xe537, 0x203D, 0x203D, 0x203D, 0xe53b, 0xe53c, 0xe53d, 0xe53e, // F060 0xe53f, 0xe540, 0xe541, 0xe542, 0xe543, 0xe544, 0xe545, 0xe546, - 0xe547, 0xe548, 0xe549, 0xe54a, - 0xe54b, 0xe54c, 0xe54d, 0xe54e, + 0xe547, 0x24EA, 0x2460, 0x2461, + 0x2462, 0x2463, 0x2464, 0x2465, // F070 - 0xe54e, 0xe54f, 0xe550, 0xe551, - 0xe552, 0xe553, 0xe554, 0xe555, - 0xe556, 0xe557, 0xe558, 0xe559, - 0xe55a, 0xe55b, 0xe55c, 0, + 0x2466, 0x2467, 0x2468, 0x2469, + 0xE453, 0x278A, 0x278B, 0x278C, + 0x278D, 0x278E, 0x278F, 0x2790, + 0x2791, 0x2792, 0x2793, 0, // F080 0x2609, 0x25cb, 0x263d, 0x263e, 0xe55d, 0xe55e, 0xe55f, 0xe560, @@ -343,7 +343,7 @@ static const sal_Unicode aWingDings2Tab[224] = 0xe5c1, 0xe5c2, 0xe5c3, 0xe5c4, 0xe5c5, 0xe5c6, 0xe5c7, 0xe5c8, // F0f0 - 0xe5c9, 0xe5ca, 0xe5cb, 0xe5cc, + 0xe5c9, 0x2022, 0xe5cb, 0xe5cc, 0xe5cd, 0xe5ce, 0xe5cf, 0xe5d0, 0x203b, 0x2042, 0, 0, 0, 0, 0, 0 diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx index 4a3532b44659..c1c222755599 100644 --- a/unotools/source/misc/fontdefs.cxx +++ b/unotools/source/misc/fontdefs.cxx @@ -37,6 +37,7 @@ struct ImplLocalizedFontName const sal_Unicode* mpLocalizedNames; }; +// TODO: where did the 0,0 delimiters come from? A single 0 should suffice... static sal_Unicode const aBatang[] = { 0xBC14, 0xD0D5, 0, 0 }; static sal_Unicode const aBatangChe[] = { 0xBC14, 0xD0D5, 0xCCB4, 0, 0 }; static sal_Unicode const aGungsuh[] = { 0xAD81, 0xC11C, 0, 0 }; @@ -72,6 +73,8 @@ static sal_Unicode const aMSGothic[] = { 'm','s', 0x30B4, 0x30B7, 0x30C3, static sal_Unicode const aMSPGothic[] = { 'm','s','p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; static sal_Unicode const aMSMincho[] = { 'm', 's', 0x660E, 0x671D, 0 }; static sal_Unicode const aMSPMincho[] = { 'm','s','p', 0x660E, 0x671D, 0 }; +static sal_Unicode const aMSYaHei[] = { 0x5FAE, 0x8F6F, 0x96C5, 0x9ED1, 0 }; +static sal_Unicode const aMSJhengHei[] = { 0x5FAE, 0x8EDF, 0x6B63, 0x9ED1, 0x9AD4, 0 }; static sal_Unicode const aMeiryo[] = { 0x30e1, 0x30a4, 0x30ea, 0x30aa, 0 }; static sal_Unicode const aHGMinchoL[] = { 'h','g', 0x660E, 0x671D, 'l', 0, 0 }; static sal_Unicode const aHGGothicB[] = { 'h','g', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 0 }; @@ -180,7 +183,6 @@ static sal_Unicode const aHiraginoKakuGothicProN[] = { 0x30D2, 0x30E9, 0x30AE, static sal_Unicode const aHiraginoMaruGothicPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o',0}; static sal_Unicode const aHiraginoMaruGothicProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o','n',0}; - static ImplLocalizedFontName aImplLocalizedNamesList[] = { { "batang", aBatang }, @@ -216,6 +218,8 @@ static ImplLocalizedFontName aImplLocalizedNamesList[] = { "mspgothic", aMSPGothic }, { "msmincho", aMSMincho }, { "mspmincho", aMSPMincho }, +{ "microsoftjhenghei", aMSJhengHei }, +{ "microsoftyahei", aMSYaHei }, { "meiryo", aMeiryo }, { "hgminchol", aHGMinchoL }, { "hggothicb", aHGGothicB }, @@ -513,8 +517,6 @@ void AddTokenFontName( String& rName, const String& rNewToken ) ImplAppendFontToken( rName, rNewToken ); } - - // ======================================================================= String GetSubsFontName( const String& rName, ULONG nFlags ) |