INTEGRATION: CWS ab32 (1.37.6); FILE MERGED
2007/01/18 13:55:46 ab 1.37.6.1: #i73077# Rename Resource IDs according to renamed dialog/control
This commit is contained in:
@@ -4,9 +4,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: basobj3.cxx,v $
|
* $RCSfile: basobj3.cxx,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.38 $
|
* $Revision: 1.39 $
|
||||||
*
|
*
|
||||||
* last change: $Author: vg $ $Date: 2007-01-16 16:30:16 $
|
* last change: $Author: rt $ $Date: 2007-01-29 16:44:37 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to
|
* The Contents of this file are made available subject to
|
||||||
* the terms of GNU Lesser General Public License Version 2.1.
|
* the terms of GNU Lesser General Public License Version 2.1.
|
||||||
@@ -477,6 +477,9 @@ void BasicIDE::RenameDialog( SfxObjectShell* pShell, const String& rLibName, con
|
|||||||
Reference< container::XNameContainer > xLib = GetDialogLibrary( pShell, rLibName, TRUE );
|
Reference< container::XNameContainer > xLib = GetDialogLibrary( pShell, rLibName, TRUE );
|
||||||
|
|
||||||
// rename dialog
|
// rename dialog
|
||||||
|
BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
|
||||||
|
IDEBaseWindow* pWin = NULL;
|
||||||
|
Reference< container::XNameContainer > xEditorDialogModel;
|
||||||
if( xLib.is() && xLib->hasByName( aOUOldName ) )
|
if( xLib.is() && xLib->hasByName( aOUOldName ) )
|
||||||
{
|
{
|
||||||
if ( xLib->hasByName( aOUNewName ) )
|
if ( xLib->hasByName( aOUNewName ) )
|
||||||
@@ -486,28 +489,46 @@ void BasicIDE::RenameDialog( SfxObjectShell* pShell, const String& rLibName, con
|
|||||||
Reference<XInterface>() );
|
Reference<XInterface>() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( pIDEShell )
|
||||||
|
{
|
||||||
|
pWin = pIDEShell->FindWindow( pShell, rLibName, rOldName, BASICIDE_TYPE_DIALOG, FALSE );
|
||||||
|
if ( pWin )
|
||||||
|
xEditorDialogModel = ((DialogWindow*)pWin)->GetEditor()->GetDialog();
|
||||||
|
}
|
||||||
|
|
||||||
// get dialog
|
// get dialog
|
||||||
Any aElement = xLib->getByName( aOUOldName );
|
Any aElement = xLib->getByName( aOUOldName );
|
||||||
|
|
||||||
// remove dialog from dialog container
|
// remove dialog from dialog container
|
||||||
xLib->removeByName( aOUOldName );
|
xLib->removeByName( aOUOldName );
|
||||||
|
|
||||||
// create dialog model
|
// create or take existing dialog model
|
||||||
Reference< lang::XMultiServiceFactory > xMSF = getProcessServiceFactory();
|
Reference< lang::XMultiServiceFactory > xMSF = getProcessServiceFactory();
|
||||||
Reference< container::XNameContainer > xDialogModel( xMSF->createInstance
|
Reference< container::XNameContainer > xDialogModel;
|
||||||
|
if( xEditorDialogModel.is() )
|
||||||
|
{
|
||||||
|
xDialogModel = xEditorDialogModel;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xDialogModel = Reference< container::XNameContainer >( xMSF->createInstance
|
||||||
( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY );
|
( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY );
|
||||||
|
}
|
||||||
|
|
||||||
Reference< io::XInputStreamProvider > xISP;
|
Reference< io::XInputStreamProvider > xISP;
|
||||||
aElement >>= xISP;
|
aElement >>= xISP;
|
||||||
if( xISP.is() )
|
if( xISP.is() )
|
||||||
{
|
{
|
||||||
// import dialog model
|
|
||||||
Reference< XComponentContext > xContext;
|
Reference< XComponentContext > xContext;
|
||||||
Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
|
Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
|
||||||
OSL_ASSERT( xProps.is() );
|
OSL_ASSERT( xProps.is() );
|
||||||
OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
|
OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
|
||||||
|
if( !xEditorDialogModel.is() )
|
||||||
|
{
|
||||||
|
// import dialog model
|
||||||
Reference< io::XInputStream > xInput( xISP->createInputStream() );
|
Reference< io::XInputStream > xInput( xISP->createInputStream() );
|
||||||
::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
|
::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
|
||||||
|
}
|
||||||
|
|
||||||
// set new name as property
|
// set new name as property
|
||||||
Reference< beans::XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY );
|
Reference< beans::XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY );
|
||||||
@@ -515,6 +536,8 @@ void BasicIDE::RenameDialog( SfxObjectShell* pShell, const String& rLibName, con
|
|||||||
aName <<= aOUNewName;
|
aName <<= aOUNewName;
|
||||||
xDlgPSet->setPropertyValue( DLGED_PROP_NAME, aName );
|
xDlgPSet->setPropertyValue( DLGED_PROP_NAME, aName );
|
||||||
|
|
||||||
|
LocalizationMgr::renameStringResourceIDs( pShell, rLibName, aOUNewName, xDialogModel );
|
||||||
|
|
||||||
// export dialog model
|
// export dialog model
|
||||||
xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
|
xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
|
||||||
aElement <<= xISP;
|
aElement <<= xISP;
|
||||||
@@ -530,25 +553,11 @@ void BasicIDE::RenameDialog( SfxObjectShell* pShell, const String& rLibName, con
|
|||||||
Reference<XInterface>() );
|
Reference<XInterface>() );
|
||||||
}
|
}
|
||||||
|
|
||||||
BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
|
|
||||||
if ( pIDEShell )
|
|
||||||
{
|
|
||||||
IDEBaseWindow* pWin = pIDEShell->FindWindow( pShell, rLibName, rOldName, BASICIDE_TYPE_DIALOG, FALSE );
|
|
||||||
if ( pWin )
|
if ( pWin )
|
||||||
{
|
{
|
||||||
// set new name in window
|
// set new name in window
|
||||||
pWin->SetName( rNewName );
|
pWin->SetName( rNewName );
|
||||||
|
|
||||||
// get dialog model from dialog editor and set new name as property
|
|
||||||
Reference< container::XNameContainer > xDlgModel = ((DialogWindow*)pWin)->GetEditor()->GetDialog();
|
|
||||||
if( xDlgModel.is() )
|
|
||||||
{
|
|
||||||
Reference< beans::XPropertySet > xPSet( xDlgModel, UNO_QUERY );
|
|
||||||
Any aName;
|
|
||||||
aName <<= aOUNewName;
|
|
||||||
xPSet->setPropertyValue( DLGED_PROP_NAME, aName );
|
|
||||||
}
|
|
||||||
|
|
||||||
// update property browser
|
// update property browser
|
||||||
((DialogWindow*)pWin)->UpdateBrowser();
|
((DialogWindow*)pWin)->UpdateBrowser();
|
||||||
|
|
||||||
@@ -564,7 +573,6 @@ void BasicIDE::RenameDialog( SfxObjectShell* pShell, const String& rLibName, con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user