diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2007-06-26 15:52:14 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2007-06-26 15:52:14 +0000 |
commit | 6f0e8de04d4cabd021bc3d725134d552f55bf3e0 (patch) | |
tree | 9151584db69b18ae7245d54d54c03235e717d058 /basctl/source/basicide | |
parent | fc96af3fea7057ed6e42500d92d6db4c405799a1 (diff) |
INTEGRATION: CWS ab35 (1.6.8); FILE MERGED
2007/05/25 11:58:43 ab 1.6.8.2: #i77640# Fixed bug in new COPY_RESOURCES functionality
2007/05/21 09:38:13 ab 1.6.8.1: #i77640# Single Dialog Export
Diffstat (limited to 'basctl/source/basicide')
-rw-r--r-- | basctl/source/basicide/localizationmgr.cxx | 90 |
1 files changed, 88 insertions, 2 deletions
diff --git a/basctl/source/basicide/localizationmgr.cxx b/basctl/source/basicide/localizationmgr.cxx index dd468da1a165..4c6986f0cd53 100644 --- a/basctl/source/basicide/localizationmgr.cxx +++ b/basctl/source/basicide/localizationmgr.cxx @@ -4,9 +4,9 @@ * * $RCSfile: localizationmgr.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: obo $ $Date: 2007-03-15 15:56:41 $ + * last change: $Author: hr $ $Date: 2007-06-26 16:52:14 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -391,6 +391,33 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties aPropAny <<= aPropIdStr; xPropertySet->setPropertyValue( aPropName, aPropAny ); } + // Copy string from source to target resource + else if( eMode == COPY_RESOURCES && xSourceStringResolver.is() ) + { + ::rtl::OUString aSourceIdStr = aPropStr; + ::rtl::OUString aPureSourceIdStr = aSourceIdStr.copy( 1 ); + + const Locale& rDefaultLocale = xSourceStringResolver->getDefaultLocale(); + + // Copy Id for all locales + const Locale* pLocales = aLocaleSeq.getConstArray(); + for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ ) + { + const Locale& rLocale = pLocales[ i ]; + ::rtl::OUString aResStr; + try + { + aResStr = xSourceStringResolver->resolveStringForLocale + ( aPureSourceIdStr, rLocale ); + } + catch(MissingResourceException&) + { + aResStr = xSourceStringResolver->resolveStringForLocale + ( aPureSourceIdStr, rDefaultLocale ); + } + xStringResourceManager->setStringForLocale( aPureSourceIdStr, aResStr, rLocale ); + } + } nChangedCount++; } @@ -603,6 +630,38 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties aPropAny <<= aIdStrings; xPropertySet->setPropertyValue( aPropName, aPropAny ); } + // Copy string from source to target resource + else if( eMode == COPY_RESOURCES && xSourceStringResolver.is() ) + { + const Locale& rDefaultLocale = xSourceStringResolver->getDefaultLocale(); + + const Locale* pLocales = aLocaleSeq.getConstArray(); + sal_Int32 i; + for ( i = 0; i < nPropStringCount; ++i ) + { + ::rtl::OUString aSourceIdStr = pPropStrings[i]; + ::rtl::OUString aPureSourceIdStr = aSourceIdStr.copy( 1 ); + + // Set Id for all locales + for( sal_Int32 iLocale = 0 ; iLocale < nLocaleCount ; iLocale++ ) + { + const Locale& rLocale = pLocales[ iLocale ]; + + ::rtl::OUString aResStr; + try + { + aResStr = xSourceStringResolver->resolveStringForLocale + ( aPureSourceIdStr, rLocale ); + } + catch(MissingResourceException&) + { + aResStr = xSourceStringResolver->resolveStringForLocale + ( aPureSourceIdStr, rDefaultLocale ); + } + xStringResourceManager->setStringForLocale( aPureSourceIdStr, aResStr, rLocale ); + } + } + } nChangedCount++; } } @@ -1078,6 +1137,33 @@ void LocalizationMgr::moveResourcesForPastedEditorObject( DlgEditor* pEditor, xSourceStringResolver, MOVE_RESOURCES ); } +void LocalizationMgr::copyResourceForDialog( + const Reference< container::XNameContainer >& xDialogModel, + const Reference< XStringResourceResolver >& xSourceStringResolver, + const Reference< XStringResourceManager >& xTargetStringResourceManager ) +{ + if( !xDialogModel.is() || !xSourceStringResolver.is() || !xTargetStringResourceManager.is() ) + return; + + ::rtl::OUString aDummyName; + Any aDialogCtrl; + aDialogCtrl <<= xDialogModel; + implHandleControlResourceProperties + ( aDialogCtrl, aDummyName, aDummyName, xTargetStringResourceManager, + xSourceStringResolver, COPY_RESOURCES ); + + // Handle all controls + Sequence< ::rtl::OUString > aNames = xDialogModel->getElementNames(); + const ::rtl::OUString* pNames = aNames.getConstArray(); + sal_Int32 nCtrls = aNames.getLength(); + for( sal_Int32 i = 0 ; i < nCtrls ; ++i ) + { + ::rtl::OUString aCtrlName( pNames[i] ); + Any aCtrl = xDialogModel->getByName( aCtrlName ); + implHandleControlResourceProperties( aCtrl, aDummyName, aDummyName, + xTargetStringResourceManager, xSourceStringResolver, COPY_RESOURCES ); + } +} Reference< XStringResourceManager > LocalizationMgr::getStringResourceFromDialogLibrary ( Reference< container::XNameContainer > xDialogLib ) |