summaryrefslogtreecommitdiff
path: root/basctl/source/basicide/baside3.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'basctl/source/basicide/baside3.cxx')
-rw-r--r--basctl/source/basicide/baside3.cxx50
1 files changed, 7 insertions, 43 deletions
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index 2643400dcc01..a6b87743f4f0 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -35,6 +35,7 @@
#include "objdlg.hxx"
#include <basic/basmgr.hxx>
+#include <com/sun/star/awt/UnoControlDialogModel.hpp>
#include <com/sun/star/resource/StringResourceWithLocation.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
@@ -944,8 +945,7 @@ bool implImportDialog( Window* pWin, const OUString& rCurPath, const ScriptDocum
{
bool bDone = false;
- Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
- Reference< XComponentContext > xContext( comphelper::getComponentContext( xMSF ) );
+ Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
Reference < XFilePicker3 > xFP = FilePicker::createWithMode(xContext, TemplateDescription::FILEOPEN_SIMPLE);
Reference< XFilePickerControlAccess > xFPControl(xFP, UNO_QUERY);
@@ -977,10 +977,9 @@ bool implImportDialog( Window* pWin, const OUString& rCurPath, const ScriptDocum
try
{
// create dialog model
- Reference< container::XNameContainer > xDialogModel( xMSF->createInstance
- ( "com.sun.star.awt.UnoControlDialogModel" ), UNO_QUERY_THROW );
+ Reference< awt::XUnoControlDialogModel > xDialogModel = awt::UnoControlDialogModel::create( xContext );
- Reference< XSimpleFileAccess3 > xSFI( SimpleFileAccess::create(comphelper::getProcessComponentContext()) );
+ Reference< XSimpleFileAccess3 > xSFI( SimpleFileAccess::create(xContext) );
Reference< XInputStream > xInput;
if( xSFI->exists( aCurPath ) )
@@ -988,20 +987,7 @@ bool implImportDialog( Window* pWin, const OUString& rCurPath, const ScriptDocum
::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
- OUString aXmlDlgName;
- Reference< beans::XPropertySet > xDialogModelPropSet( xDialogModel, UNO_QUERY );
- if( xDialogModelPropSet.is() )
- {
- try
- {
- Any aXmlDialogNameAny = xDialogModelPropSet->getPropertyValue( DLGED_PROP_NAME );
- OUString aOUXmlDialogName;
- aXmlDialogNameAny >>= aOUXmlDialogName;
- aXmlDlgName = aOUXmlDialogName;
- }
- catch(const beans::UnknownPropertyException& )
- {}
- }
+ OUString aXmlDlgName = xDialogModel->getName();
bool bValidName = !aXmlDlgName.isEmpty();
OSL_ASSERT( bValidName );
if( !bValidName )
@@ -1186,30 +1172,8 @@ bool implImportDialog( Window* pWin, const OUString& rCurPath, const ScriptDocum
if( eNameClashMode == CLASH_RENAME_DIALOG )
{
- bool bRenamed = false;
- if( xDialogModelPropSet.is() )
- {
- try
- {
- Any aXmlDialogNameAny;
- aXmlDialogNameAny <<= OUString( aNewDlgName );
- xDialogModelPropSet->setPropertyValue( DLGED_PROP_NAME, aXmlDialogNameAny );
- bRenamed = true;
- }
- catch(const beans::UnknownPropertyException& )
- {}
- }
-
-
- if( bRenamed )
- {
- LocalizationMgr::renameStringResourceIDs( rDocument, aLibName, aNewDlgName, xDialogModel );
- }
- else
- {
- // TODO: Assertion?
- return bDone;
- }
+ xDialogModel->setName( aNewDlgName );
+ LocalizationMgr::renameStringResourceIDs( rDocument, aLibName, aNewDlgName, xDialogModel );
}
Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );