diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2007-08-03 08:58:50 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2007-08-03 08:58:50 +0000 |
commit | f708f395d15fdf17ce4b30c8a90442c854e1e389 (patch) | |
tree | da9c200205357c06440ada0b01cc86988d5747b3 /basctl | |
parent | 8f00bc64dacc738915a9e6f4bdb84101f47e3cd7 (diff) |
INTEGRATION: CWS ab34 (1.5.16); FILE MERGED
2007/07/24 14:00:23 ab 1.5.16.5: RESYNC: (1.6-1.7); FILE MERGED
Solved conflict
2007/07/24 13:04:58 ab 1.5.16.4: #i77072# Removed conflicts with m222
2007/07/24 11:03:17 ab 1.5.16.3: #i77072# Drag & Drop support in Dialog Organizer
2007/04/24 10:13:44 ab 1.5.16.2: RESYNC: (1.5-1.6); FILE MERGED
2007/03/13 10:51:47 ab 1.5.16.1: #i74083# Modified patch code
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/localizationmgr.cxx | 79 |
1 files changed, 66 insertions, 13 deletions
diff --git a/basctl/source/basicide/localizationmgr.cxx b/basctl/source/basicide/localizationmgr.cxx index 4c6986f0cd53..e75e66a2e6d6 100644 --- a/basctl/source/basicide/localizationmgr.cxx +++ b/basctl/source/basicide/localizationmgr.cxx @@ -4,9 +4,9 @@ * * $RCSfile: localizationmgr.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: hr $ $Date: 2007-06-26 16:52:14 $ + * last change: $Author: hr $ $Date: 2007-08-03 09:58:50 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -209,6 +209,9 @@ void LocalizationMgr::implEnableDisableResourceForAllLibraryDialogs( HandleResou return aPureIdStr; } +extern bool localesAreEqual( const ::com::sun::star::lang::Locale& rLocaleLeft, + const ::com::sun::star::lang::Locale& rLocaleRight ); + // Works on xStringResourceManager's current language for SET_IDS/RESET_IDS, // anyway only one language should exist when calling this method then, // either the first one for mode SET_IDS or the last one for mode RESET_IDS @@ -670,6 +673,7 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties return nChangedCount; } +/* void TEST_simulateDialogAddRemoveLocale( bool bAdd ) { Sequence< Locale > aLocaleSeq( 1 ); @@ -712,6 +716,7 @@ void TEST_simulateDialogRemoveLocale( void ) { TEST_simulateDialogAddRemoveLocale( false ); } +*/ void LocalizationMgr::handleAddLocales( Sequence< Locale > aLocaleSeq ) { @@ -745,6 +750,7 @@ void LocalizationMgr::handleAddLocales( Sequence< Locale > aLocaleSeq ) handleTranslationbar(); } + void LocalizationMgr::handleRemoveLocales( Sequence< Locale > aLocaleSeq ) { const Locale* pLocales = aLocaleSeq.getConstArray(); @@ -762,9 +768,7 @@ void LocalizationMgr::handleRemoveLocales( Sequence< Locale > aLocaleSeq ) if( aResLocaleSeq.getLength() == 1 ) { const Locale& rLastResLocale = aResLocaleSeq.getConstArray()[ 0 ]; - if( rLocale.Language == rLastResLocale.Language && - rLocale.Country == rLastResLocale.Country && - rLocale.Variant == rLastResLocale.Variant ) + if( localesAreEqual( rLocale, rLastResLocale ) ) { disableResourceForAllLibraryDialogs(); } @@ -952,14 +956,9 @@ void LocalizationMgr::renameControlResourceIDsForEditorObject( DlgEditor* pEdito ::rtl::OUString aDialogName = pDlgWin->GetName(); Reference< XStringResourceResolver > xDummyStringResolver; - sal_Int32 nChangedCount = implHandleControlResourceProperties + implHandleControlResourceProperties ( aControlAny, aDialogName, aNewCtrlName, xStringResourceManager, xDummyStringResolver, RENAME_CONTROL_IDS ); - // HACK to make code warning free - // What did you really use nChangedCount for? - if( nChangedCount ) - nChangedCount ++; - } @@ -1110,7 +1109,34 @@ void LocalizationMgr::resetResourceForDialog( Reference< container::XNameContain } } -void LocalizationMgr::moveResourcesForPastedEditorObject( DlgEditor* pEditor, +void LocalizationMgr::setResourceIDsForDialog( Reference< container::XNameContainer > xDialogModel, + Reference< XStringResourceManager > xStringResourceManager ) +{ + if( !xStringResourceManager.is() ) + return; + + // Dialog as control + ::rtl::OUString aDummyName; + Any aDialogCtrl; + aDialogCtrl <<= xDialogModel; + Reference< XStringResourceResolver > xDummyStringResolver; + implHandleControlResourceProperties( aDialogCtrl, aDummyName, + aDummyName, xStringResourceManager, xDummyStringResolver, SET_IDS ); + + // 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, + aCtrlName, xStringResourceManager, xDummyStringResolver, SET_IDS ); + } +} + +void LocalizationMgr::copyResourcesForPastedEditorObject( DlgEditor* pEditor, Any aControlAny, const ::rtl::OUString& aCtrlName, Reference< XStringResourceResolver > xSourceStringResolver ) { @@ -1119,7 +1145,7 @@ void LocalizationMgr::moveResourcesForPastedEditorObject( DlgEditor* pEditor, if( !pDlgWin ) return; ScriptDocument aDocument( pDlgWin->GetDocument() ); - DBG_ASSERT( aDocument.isValid(), "LocalizationMgr::moveResourcesForPastedEditorObject: invalid document!" ); + DBG_ASSERT( aDocument.isValid(), "LocalizationMgr::copyResourcesForPastedEditorObject: invalid document!" ); if ( !aDocument.isValid() ) return; const String& rLibName = pDlgWin->GetLibName(); @@ -1137,6 +1163,33 @@ void LocalizationMgr::moveResourcesForPastedEditorObject( DlgEditor* pEditor, xSourceStringResolver, MOVE_RESOURCES ); } +void LocalizationMgr::copyResourceForDroppedDialog( Reference< container::XNameContainer > xDialogModel, + const ::rtl::OUString& aDialogName, Reference< XStringResourceManager > xStringResourceManager, + Reference< XStringResourceResolver > xSourceStringResolver ) +{ + if( !xStringResourceManager.is() ) + return; + + // Dialog as control + ::rtl::OUString aDummyName; + Any aDialogCtrl; + aDialogCtrl <<= xDialogModel; + implHandleControlResourceProperties( aDialogCtrl, aDialogName, + aDummyName, xStringResourceManager, xSourceStringResolver, MOVE_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, aDialogName, + aCtrlName, xStringResourceManager, xSourceStringResolver, MOVE_RESOURCES ); + } +} + void LocalizationMgr::copyResourceForDialog( const Reference< container::XNameContainer >& xDialogModel, const Reference< XStringResourceResolver >& xSourceStringResolver, |