diff options
29 files changed, 647 insertions, 815 deletions
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index 6a0a688652d8..2eb27e302d42 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -35,7 +35,6 @@ #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> @@ -943,7 +942,8 @@ bool implImportDialog( Window* pWin, const OUString& rCurPath, const ScriptDocum { bool bDone = false; - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); + Reference< XComponentContext > xContext( comphelper::getComponentContext( xMSF ) ); Reference < XFilePicker3 > xFP = FilePicker::createWithMode(xContext, TemplateDescription::FILEOPEN_SIMPLE); Reference< XFilePickerControlAccess > xFPControl(xFP, UNO_QUERY); @@ -975,9 +975,10 @@ bool implImportDialog( Window* pWin, const OUString& rCurPath, const ScriptDocum try { // create dialog model - Reference< awt::XUnoControlDialogModel > xDialogModel = awt::UnoControlDialogModel::create( xContext ); + Reference< container::XNameContainer > xDialogModel( xMSF->createInstance + ( "com.sun.star.awt.UnoControlDialogModel" ), UNO_QUERY_THROW ); - Reference< XSimpleFileAccess3 > xSFI( SimpleFileAccess::create(xContext) ); + Reference< XSimpleFileAccess3 > xSFI( SimpleFileAccess::create(comphelper::getProcessComponentContext()) ); Reference< XInputStream > xInput; if( xSFI->exists( aCurPath ) ) @@ -985,7 +986,20 @@ bool implImportDialog( Window* pWin, const OUString& rCurPath, const ScriptDocum ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() ); - OUString aXmlDlgName = xDialogModel->getName(); + 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& ) + {} + } bool bValidName = !aXmlDlgName.isEmpty(); OSL_ASSERT( bValidName ); if( !bValidName ) @@ -1170,8 +1184,30 @@ bool implImportDialog( Window* pWin, const OUString& rCurPath, const ScriptDocum if( eNameClashMode == CLASH_RENAME_DIALOG ) { - xDialogModel->setName( aNewDlgName ); - LocalizationMgr::renameStringResourceIDs( rDocument, aLibName, aNewDlgName, xDialogModel ); + 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; + } } Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() ); diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx index 271282e5f445..8d0b70dbb251 100644 --- a/basctl/source/basicide/basides3.cxx +++ b/basctl/source/basicide/basides3.cxx @@ -26,9 +26,8 @@ #include <localizationmgr.hxx> #include <dlgedview.hxx> #include <comphelper/processfactory.hxx> -#include <com/sun/star/awt/UnoControlDialogModel.hpp> -#include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/script/XLibraryContainer.hpp> +#include <com/sun/star/container/XNameContainer.hpp> #include <xmlscript/xmldlg_imexp.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/docfac.hxx> @@ -76,9 +75,12 @@ DialogWindow* Shell::CreateDlgWin( const ScriptDocument& rDocument, const OUStri if ( xISP.is() ) { // create dialog model - Reference< uno::XComponentContext > xContext = getProcessComponentContext(); - Reference< awt::XUnoControlDialogModel > xDialogModel = awt::UnoControlDialogModel::create( xContext ); + Reference< lang::XMultiServiceFactory > xMSF = getProcessServiceFactory(); + Reference< container::XNameContainer > xDialogModel( xMSF->createInstance + ( "com.sun.star.awt.UnoControlDialogModel" ), UNO_QUERY ); Reference< XInputStream > xInput( xISP->createInputStream() ); + Reference< XComponentContext > xContext( + comphelper::getComponentContext( xMSF ) ); ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() ); LocalizationMgr::setStringResourceAtDialog( rDocument, rLibName, aDlgName, xDialogModel ); diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx index 84a25a9910b8..49c58a31af09 100644 --- a/basctl/source/basicide/moduldlg.cxx +++ b/basctl/source/basicide/moduldlg.cxx @@ -28,7 +28,6 @@ #include "iderdll.hxx" #include <basic/basmgr.hxx> -#include <com/sun/star/awt/UnoControlDialogModel.hpp> #include <com/sun/star/script/XLibraryContainerPassword.hpp> #include <comphelper/processfactory.hxx> #include <sfx2/app.hxx> @@ -285,25 +284,31 @@ void Shell::CopyDialogResources( return; // create dialog model - Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - Reference< awt::XUnoControlDialogModel > xDialogModel = awt::UnoControlDialogModel::create( xContext ); + Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + Reference< container::XNameContainer > xDialogModel = Reference< container::XNameContainer >( xMSF->createInstance + ( "com.sun.star.awt.UnoControlDialogModel" ), UNO_QUERY ); Reference< io::XInputStream > xInput( io_xISP->createInputStream() ); + Reference< XComponentContext > xContext( + comphelper::getComponentContext( xMSF ) ); ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rSourceDoc.isDocument() ? rSourceDoc.getDocument() : Reference< frame::XModel >() ); - if( bSourceLocalized && bDestLocalized ) + if( xDialogModel.is() ) { - Reference< resource::XStringResourceResolver > xSourceStringResolver( xSourceMgr, UNO_QUERY ); - LocalizationMgr::copyResourceForDroppedDialog( xDialogModel, rDlgName, xDestMgr, xSourceStringResolver ); - } - else if( bSourceLocalized ) - { - LocalizationMgr::resetResourceForDialog( xDialogModel, xSourceMgr ); - } - else if( bDestLocalized ) - { - LocalizationMgr::setResourceIDsForDialog( xDialogModel, xDestMgr ); + if( bSourceLocalized && bDestLocalized ) + { + Reference< resource::XStringResourceResolver > xSourceStringResolver( xSourceMgr, UNO_QUERY ); + LocalizationMgr::copyResourceForDroppedDialog( xDialogModel, rDlgName, xDestMgr, xSourceStringResolver ); + } + else if( bSourceLocalized ) + { + LocalizationMgr::resetResourceForDialog( xDialogModel, xSourceMgr ); + } + else if( bDestLocalized ) + { + LocalizationMgr::setResourceIDsForDialog( xDialogModel, xDestMgr ); + } + io_xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDestDoc.isDocument() ? rDestDoc.getDocument() : Reference< frame::XModel >() ); } - io_xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDestDoc.isDocument() ? rDestDoc.getDocument() : Reference< frame::XModel >() ); } diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx index bccb4c4bcbb2..3224c7129a80 100644 --- a/basctl/source/basicide/scriptdocument.cxx +++ b/basctl/source/basicide/scriptdocument.cxx @@ -25,18 +25,17 @@ #include "doceventnotifier.hxx" #include "documentenumeration.hxx" -#include <com/sun/star/awt/XWindow2.hpp> -#include <com/sun/star/awt/UnoControlDialogModel.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> +#include <com/sun/star/util/theMacroExpander.hpp> #include <com/sun/star/document/MacroExecMode.hpp> -#include <com/sun/star/document/XEmbeddedScripts.hpp> +#include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/frame/XModel2.hpp> -#include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/awt/XWindow2.hpp> +#include <com/sun/star/document/XEmbeddedScripts.hpp> #include <com/sun/star/script/vba/XVBACompatibility.hpp> #include <com/sun/star/script/vba/XVBAModuleInfo.hpp> -#include <com/sun/star/uri/UriReferenceFactory.hpp> -#include <com/sun/star/util/theMacroExpander.hpp> #include <sfx2/objsh.hxx> #include <sfx2/app.hxx> @@ -630,7 +629,12 @@ namespace basctl if ( _rxExistingDialogModel.is() ) xDialogModel = _rxExistingDialogModel; else - xDialogModel = css::awt::UnoControlDialogModel::create( aContext ); + xDialogModel.set( + ( aContext->getServiceManager()-> + createInstanceWithContext( + "com.sun.star.awt.UnoControlDialogModel", + aContext ) ), + UNO_QUERY_THROW ); // import dialog model Reference< XInputStreamProvider > xISP( aElement, UNO_QUERY_THROW ); @@ -749,10 +753,14 @@ namespace basctl // create new dialog model Reference< XComponentContext > aContext( comphelper::getProcessComponentContext() ); - Reference< css::awt::XUnoControlDialogModel > xDialogModel = css::awt::UnoControlDialogModel::create( aContext ); + Reference< XNameContainer > xDialogModel( + aContext->getServiceManager()->createInstanceWithContext( + "com.sun.star.awt.UnoControlDialogModel", aContext ), + UNO_QUERY_THROW ); // set name property - xDialogModel->setName( _rDialogName ); + Reference< XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY_THROW ); + xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rDialogName ) ); // export dialog model _out_rDialogProvider = ::xmlscript::exportDialogModel( xDialogModel, aContext, isDocument() ? getDocument() : Reference< XModel >() ); diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx index 8e55c02387c2..54aef41b16ba 100644 --- a/basctl/source/dlged/dlged.cxx +++ b/basctl/source/dlged/dlged.cxx @@ -33,8 +33,6 @@ #include "baside3.hxx" #include <com/sun/star/awt/Toolkit.hpp> -#include <com/sun/star/awt/UnoControlDialog.hpp> -#include <com/sun/star/awt/UnoControlDialogModel.hpp> #include <com/sun/star/awt/XDialog.hpp> #include <com/sun/star/resource/StringResource.hpp> #include <com/sun/star/util/XCloneable.hpp> @@ -93,7 +91,7 @@ void DlgEditor::ShowDialog() uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext(); // create a dialog - uno::Reference< awt::XUnoControlDialog > xDlg = awt::UnoControlDialog::create( xContext ); + uno::Reference< awt::XControl > xDlg( getProcessServiceFactory()->createInstance( "com.sun.star.awt.UnoControlDialog" ), uno::UNO_QUERY ); // clone the dialog model uno::Reference< util::XCloneable > xC( m_xUnoControlDialogModel, uno::UNO_QUERY ); @@ -875,9 +873,9 @@ void DlgEditor::Paste() if ( xTransf->isDataFlavorSupported( m_ClipboardDataFlavors[0] ) ) { // create clipboard dialog model from xml - Reference< uno::XComponentContext > xContext = getProcessComponentContext(); - Reference< awt::XUnoControlDialogModel > xClipDialogModel = - awt::UnoControlDialogModel::create( xContext ); + Reference< lang::XMultiServiceFactory > xMSF = getProcessServiceFactory(); + Reference< container::XNameContainer > xClipDialogModel( xMSF->createInstance( + "com.sun.star.awt.UnoControlDialogModel" ), uno::UNO_QUERY ); bool bSourceIsLocalized = false; Sequence< sal_Int8 > DialogModelBytes; @@ -917,93 +915,102 @@ void DlgEditor::Paste() aAny >>= DialogModelBytes; } - ::xmlscript::importDialogModel( ::xmlscript::createInputStream( rtl::ByteSequence(DialogModelBytes.getArray(), DialogModelBytes.getLength()) ) , xClipDialogModel, xContext, m_xDocument ); - - // get control models from clipboard dialog model - Sequence< OUString > aNames = xClipDialogModel->getElementNames(); - const OUString* pNames = aNames.getConstArray(); - sal_uInt32 nCtrls = aNames.getLength(); - - Reference< resource::XStringResourcePersistence > xStringResourcePersistence; - if( nCtrls > 0 && bSourceIsLocalized ) + if ( xClipDialogModel.is() ) { - xStringResourcePersistence = css::resource::StringResource::create( getProcessComponentContext() ); - xStringResourcePersistence->importBinary( aResData ); + Reference< XComponentContext > xContext( + comphelper::getComponentContext( xMSF ) ); + ::xmlscript::importDialogModel( ::xmlscript::createInputStream( rtl::ByteSequence(DialogModelBytes.getArray(), DialogModelBytes.getLength()) ) , xClipDialogModel, xContext, m_xDocument ); } - for( sal_uInt32 n = 0; n < nCtrls; n++ ) + + // get control models from clipboard dialog model + Reference< ::com::sun::star::container::XNameAccess > xNameAcc( xClipDialogModel, UNO_QUERY ); + if ( xNameAcc.is() ) { - Any aA = xClipDialogModel->getByName( pNames[n] ); - Reference< ::com::sun::star::awt::XControlModel > xCM; - aA >>= xCM; - - // clone the control model - Reference< util::XCloneable > xClone( xCM, uno::UNO_QUERY ); - Reference< awt::XControlModel > xCtrlModel( xClone->createClone(), uno::UNO_QUERY ); - - DlgEdObj* pCtrlObj = new DlgEdObj(); - pCtrlObj->SetDlgEdForm(pDlgEdForm); // set parent form - pDlgEdForm->AddChild(pCtrlObj); // add child to parent form - pCtrlObj->SetUnoControlModel( xCtrlModel ); // set control model - - // set new name - OUString aOUniqueName( pCtrlObj->GetUniqueName() ); - Reference< beans::XPropertySet > xPSet( xCtrlModel , UNO_QUERY ); - Any aUniqueName; - aUniqueName <<= aOUniqueName; - xPSet->setPropertyValue( DLGED_PROP_NAME, aUniqueName ); - - // set tabindex - Reference< container::XNameAccess > xNA( m_xUnoControlDialogModel , UNO_QUERY ); - Sequence< OUString > aNames_ = xNA->getElementNames(); - Any aTabIndex; - aTabIndex <<= (sal_Int16) aNames_.getLength(); - xPSet->setPropertyValue( DLGED_PROP_TABINDEX, aTabIndex ); - - if( bLocalized ) + Sequence< OUString > aNames = xNameAcc->getElementNames(); + const OUString* pNames = aNames.getConstArray(); + sal_uInt32 nCtrls = aNames.getLength(); + + Reference< resource::XStringResourcePersistence > xStringResourcePersistence; + if( nCtrls > 0 && bSourceIsLocalized ) { - Any aControlAny; - aControlAny <<= xCtrlModel; - if( bSourceIsLocalized && xStringResourcePersistence.is() ) - { - Reference< resource::XStringResourceResolver > - xSourceStringResolver( xStringResourcePersistence, UNO_QUERY ); - LocalizationMgr::copyResourcesForPastedEditorObject( this, - aControlAny, aOUniqueName, xSourceStringResolver ); - } - else + xStringResourcePersistence = css::resource::StringResource::create( getProcessComponentContext() ); + xStringResourcePersistence->importBinary( aResData ); + } + for( sal_uInt32 n = 0; n < nCtrls; n++ ) + { + Any aA = xNameAcc->getByName( pNames[n] ); + Reference< ::com::sun::star::awt::XControlModel > xCM; + aA >>= xCM; + + // clone the control model + Reference< util::XCloneable > xClone( xCM, uno::UNO_QUERY ); + Reference< awt::XControlModel > xCtrlModel( xClone->createClone(), uno::UNO_QUERY ); + + DlgEdObj* pCtrlObj = new DlgEdObj(); + pCtrlObj->SetDlgEdForm(pDlgEdForm); // set parent form + pDlgEdForm->AddChild(pCtrlObj); // add child to parent form + pCtrlObj->SetUnoControlModel( xCtrlModel ); // set control model + + // set new name + OUString aOUniqueName( pCtrlObj->GetUniqueName() ); + Reference< beans::XPropertySet > xPSet( xCtrlModel , UNO_QUERY ); + Any aUniqueName; + aUniqueName <<= aOUniqueName; + xPSet->setPropertyValue( DLGED_PROP_NAME, aUniqueName ); + + // set tabindex + Reference< container::XNameAccess > xNA( m_xUnoControlDialogModel , UNO_QUERY ); + Sequence< OUString > aNames_ = xNA->getElementNames(); + Any aTabIndex; + aTabIndex <<= (sal_Int16) aNames_.getLength(); + xPSet->setPropertyValue( DLGED_PROP_TABINDEX, aTabIndex ); + + if( bLocalized ) { - LocalizationMgr::setControlResourceIDsForNewEditorObject - ( this, aControlAny, aOUniqueName ); + Any aControlAny; + aControlAny <<= xCtrlModel; + if( bSourceIsLocalized && xStringResourcePersistence.is() ) + { + Reference< resource::XStringResourceResolver > + xSourceStringResolver( xStringResourcePersistence, UNO_QUERY ); + LocalizationMgr::copyResourcesForPastedEditorObject( this, + aControlAny, aOUniqueName, xSourceStringResolver ); + } + else + { + LocalizationMgr::setControlResourceIDsForNewEditorObject + ( this, aControlAny, aOUniqueName ); + } } - } - // insert control model in editor dialog model - Any aCtrlModel; - aCtrlModel <<= xCtrlModel; - m_xUnoControlDialogModel->insertByName( aOUniqueName , aCtrlModel ); - - // insert object into drawing page - pDlgEdModel->GetPage(0)->InsertObject( pCtrlObj ); - pCtrlObj->SetRectFromProps(); - pCtrlObj->UpdateStep(); - pDlgEdForm->UpdateTabOrderAndGroups(); - pCtrlObj->StartListening(); // start listening - - // mark object - SdrPageView* pPgView = pDlgEdView->GetSdrPageView(); - pDlgEdView->MarkObj( pCtrlObj, pPgView, false, true); - } + // insert control model in editor dialog model + Any aCtrlModel; + aCtrlModel <<= xCtrlModel; + m_xUnoControlDialogModel->insertByName( aOUniqueName , aCtrlModel ); + + // insert object into drawing page + pDlgEdModel->GetPage(0)->InsertObject( pCtrlObj ); + pCtrlObj->SetRectFromProps(); + pCtrlObj->UpdateStep(); + pDlgEdForm->UpdateTabOrderAndGroups(); + pCtrlObj->StartListening(); // start listening + + // mark object + SdrPageView* pPgView = pDlgEdView->GetSdrPageView(); + pDlgEdView->MarkObj( pCtrlObj, pPgView, false, true); + } - // center marked objects in dialog editor form - Point aMarkCenter = (pDlgEdView->GetMarkedObjRect()).Center(); - Point aFormCenter = (pDlgEdForm->GetSnapRect()).Center(); - Point aPoint = aFormCenter - aMarkCenter; - Size aSize( aPoint.X() , aPoint.Y() ); - pDlgEdView->MoveMarkedObj( aSize ); // update of control model properties (position + size) in NbcMove - pDlgEdView->MarkListHasChanged(); + // center marked objects in dialog editor form + Point aMarkCenter = (pDlgEdView->GetMarkedObjRect()).Center(); + Point aFormCenter = (pDlgEdForm->GetSnapRect()).Center(); + Point aPoint = aFormCenter - aMarkCenter; + Size aSize( aPoint.X() , aPoint.Y() ); + pDlgEdView->MoveMarkedObj( aSize ); // update of control model properties (position + size) in NbcMove + pDlgEdView->MarkListHasChanged(); - // dialog model changed - SetDialogModelChanged(true); + // dialog model changed + SetDialogModelChanged(true); + } } } } diff --git a/basctl/source/dlged/dlgedfac.cxx b/basctl/source/dlged/dlgedfac.cxx index a092c8ffeea9..1ffbff22968d 100644 --- a/basctl/source/dlged/dlgedfac.cxx +++ b/basctl/source/dlged/dlgedfac.cxx @@ -24,8 +24,6 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/awt/ScrollBarOrientation.hpp> -#include <com/sun/star/awt/UnoControlDialogModel.hpp> - namespace basctl { @@ -48,11 +46,17 @@ DlgEdFactory::~DlgEdFactory() IMPL_LINK( DlgEdFactory, MakeObject, SdrObjFactory *, pObjFactory ) { static bool bNeedsInit = true; - static uno::Reference< awt::XUnoControlDialogModel > xDialogSFact; + static uno::Reference< lang::XMultiServiceFactory > xDialogSFact; if( bNeedsInit ) { - xDialogSFact = awt::UnoControlDialogModel::create( ::comphelper::getProcessComponentContext() ); + uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + uno::Reference< container::XNameContainer > xC( xMSF->createInstance( "com.sun.star.awt.UnoControlDialogModel" ), uno::UNO_QUERY ); + if( xC.is() ) + { + uno::Reference< lang::XMultiServiceFactory > xModFact( xC, uno::UNO_QUERY ); + xDialogSFact = xModFact; + } bNeedsInit = false; } diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx index a54d2a962cb7..f74bb95eb2a9 100644 --- a/basic/source/classes/eventatt.cxx +++ b/basic/source/classes/eventatt.cxx @@ -22,7 +22,6 @@ #include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> -#include <com/sun/star/awt/UnoControlDialogModel.hpp> #include <com/sun/star/awt/XControlContainer.hpp> #include <com/sun/star/awt/XControlModel.hpp> #include <com/sun/star/awt/XControl.hpp> @@ -424,7 +423,7 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit (void)pBasic; (void)bWrite; - Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); + Reference< XMultiServiceFactory > xMSF( comphelper::getProcessServiceFactory() ); // We need at least 1 parameter if ( rPar.Count() < 2 ) @@ -451,22 +450,43 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit } // Create new uno dialog - Reference< XUnoControlDialogModel > xDialogModel = UnoControlDialogModel::create( xContext ); + Reference< XNameContainer > xDialogModel( xMSF->createInstance( + OUString("com.sun.star.awt.UnoControlDialogModel")), UNO_QUERY ); + if( !xDialogModel.is() ) + { + return; + } Reference< XInputStreamProvider > xISP; aAnyISP >>= xISP; if( !xISP.is() ) { return; } + Reference< XComponentContext > xContext( comphelper::getComponentContext( xMSF ) ); // Import the DialogModel Reference< XInputStream > xInput( xISP->createInputStream() ); // i83963 Force decoration - if( !xDialogModel->getDecoration() ) + uno::Reference< beans::XPropertySet > xDlgModPropSet( xDialogModel, uno::UNO_QUERY ); + if( xDlgModPropSet.is() ) { - xDialogModel->setDecoration( true ); - xDialogModel->setTitle( OUString() ); + bool bDecoration = true; + try + { + OUString aDecorationPropName("Decoration"); + Any aDecorationAny = xDlgModPropSet->getPropertyValue( aDecorationPropName ); + aDecorationAny >>= bDecoration; + if( !bDecoration ) + { + xDlgModPropSet->setPropertyValue( aDecorationPropName, makeAny( true ) ); + + OUString aTitlePropName("Title"); + xDlgModPropSet->setPropertyValue( aTitlePropName, makeAny( OUString() ) ); + } + } + catch(const UnknownPropertyException& ) + {} } Any aDlgLibAny; diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 7b7ea190eb0a..5847754cac22 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -1607,7 +1607,7 @@ RTLFUNC(EqualUnoObjects) RTL_Impl_EqualUnoObjects( pBasic, rPar, bWrite ); } -// Instantiate "com.sun.star.awt.UnoControlDialog" on basis +// Instanciate "com.sun.star.awt.UnoControlDialog" on basis // of a DialogLibrary entry: Convert from XML-ByteSequence // and attach events. Implemented in classes\eventatt.cxx void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ); diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx index a20fd88c3223..47fb0e5a31ef 100644 --- a/basic/source/uno/dlgcont.cxx +++ b/basic/source/uno/dlgcont.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <com/sun/star/awt/UnoControlDialogModel.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/xml/sax/Parser.hpp> #include <com/sun/star/xml/sax/InputSource.hpp> @@ -237,7 +236,9 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e if ( xISP.is() ) { Reference< io::XInputStream > xInput( xISP->createInputStream() ); - Reference< awt::XUnoControlDialogModel > xDialogModel = awt::UnoControlDialogModel::create( mxContext ); + Reference< XNameContainer > xDialogModel( + mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", mxContext), + UNO_QUERY ); ::xmlscript::importDialogModel( xInput, xDialogModel, mxContext, mxOwnerDocument ); std::vector< OUString > vEmbeddedImageURLs; GraphicObject::InspectForGraphicObjectImageURL( xDialogModel, vEmbeddedImageURLs ); @@ -279,7 +280,14 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement Reference< XParser > xParser = xml::sax::Parser::create( mxContext ); - Reference< awt::XUnoControlDialogModel > xDialogModel = awt::UnoControlDialogModel::create( mxContext ); + Reference< XNameContainer > xDialogModel( + mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", mxContext), + UNO_QUERY ); + if( !xDialogModel.is() ) + { + OSL_FAIL( "### couldn't create com.sun.star.awt.UnoControlDialogModel component\n" ); + return aRetAny; + } // Read from storage? sal_Bool bStorage = xElementStream.is(); diff --git a/dbaccess/source/ext/macromigration/migrationengine.cxx b/dbaccess/source/ext/macromigration/migrationengine.cxx index 85d2aed7b08e..5132258ccea0 100644 --- a/dbaccess/source/ext/macromigration/migrationengine.cxx +++ b/dbaccess/source/ext/macromigration/migrationengine.cxx @@ -29,7 +29,6 @@ #include "progresscapture.hxx" #include "progressmixer.hxx" -#include <com/sun/star/awt/UnoControlDialogModel.hpp> #include <com/sun/star/sdb/XFormDocumentsSupplier.hpp> #include <com/sun/star/sdb/XReportDocumentsSupplier.hpp> #include <com/sun/star/util/XCloseable.hpp> @@ -1822,7 +1821,7 @@ namespace dbmm Reference< XInputStreamProvider > xISP( _inout_rDialogLibraryElement, UNO_QUERY_THROW ); Reference< XInputStream > xInput( xISP->createInputStream(), UNO_QUERY_THROW ); - Reference< css::awt::XUnoControlDialogModel > xDialogModel = css::awt::UnoControlDialogModel::create( m_aContext ); + Reference< XNameContainer > xDialogModel( m_aContext->getServiceManager()->createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", m_aContext), UNO_QUERY_THROW ); ::xmlscript::importDialogModel( xInput, xDialogModel, m_aContext, m_xDocumentModel ); // adjust the events of the dialog diff --git a/extensions/source/update/check/updatehdl.cxx b/extensions/source/update/check/updatehdl.cxx index 6c96e6e2dcac..96a74aa9a10d 100644 --- a/extensions/source/update/check/updatehdl.cxx +++ b/extensions/source/update/check/updatehdl.cxx @@ -33,8 +33,6 @@ #include "com/sun/star/awt/ActionEvent.hpp" #include "com/sun/star/awt/PushButtonType.hpp" -#include "com/sun/star/awt/UnoControlDialog.hpp" -#include "com/sun/star/awt/UnoControlDialogModel.hpp" #include "com/sun/star/awt/VclWindowPeerAttribute.hpp" #include "com/sun/star/awt/WindowAttribute.hpp" #include "com/sun/star/awt/XButton.hpp" @@ -1093,22 +1091,26 @@ void UpdateHandler::createDialog() loadStrings(); - uno::Reference< awt::XUnoControlDialogModel > xControlModel = awt::UnoControlDialogModel::create( mxContext ); + uno::Reference< lang::XMultiComponentFactory > xFactory( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); + uno::Reference< awt::XControlModel > xControlModel( xFactory->createInstanceWithContext( + "com.sun.star.awt.UnoControlDialogModel", + mxContext), uno::UNO_QUERY_THROW ); { // @see awt/UnoControlDialogModel.idl - xControlModel->setTitle( msDlgTitle); - xControlModel->setCloseable( true ); - xControlModel->setEnabled( true ); - xControlModel->setMoveable( true ); - xControlModel->setSizeable( true ); - xControlModel->setDesktopAsParent( true ); - xControlModel->setPositionX( 100 ); - xControlModel->setPositionY( 100 ); - xControlModel->setWidth( DIALOG_WIDTH ); - xControlModel->setHeight( DIALOG_HEIGHT ); - xControlModel->setHelpURL( INET_HID_SCHEME + OUString::createFromAscii( HID_CHECK_FOR_UPD_DLG ) ); + uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW ); + + xPropSet->setPropertyValue( "Title", uno::Any( msDlgTitle ) ); + xPropSet->setPropertyValue( "Closeable", uno::Any( true ) ); + xPropSet->setPropertyValue( "Enabled", uno::Any( true ) ); + xPropSet->setPropertyValue( "Moveable", uno::Any( true ) ); + xPropSet->setPropertyValue( "Sizeable", uno::Any( true ) ); + xPropSet->setPropertyValue( "DesktopAsParent", uno::Any( true ) ); + xPropSet->setPropertyValue( "PositionX", uno::Any(sal_Int32( 100 )) ); + xPropSet->setPropertyValue( "PositionY", uno::Any(sal_Int32( 100 )) ); + xPropSet->setPropertyValue( "Width", uno::Any(sal_Int32( DIALOG_WIDTH )) ); + xPropSet->setPropertyValue( "Height", uno::Any(sal_Int32( DIALOG_HEIGHT )) ); + xPropSet->setPropertyValue( "HelpURL", uno::makeAny( INET_HID_SCHEME + OUString::createFromAscii( HID_CHECK_FOR_UPD_DLG ) ) ); } - { // Label (fixed text) <status> uno::Sequence< beans::NamedValue > aProps(1); @@ -1320,19 +1322,25 @@ void UpdateHandler::createDialog() aProps); } - uno::Reference< awt::XUnoControlDialog > xControl = awt::UnoControlDialog::create( mxContext ); + uno::Reference< awt::XControl > xControl( + xFactory->createInstanceWithContext( "com.sun.star.awt.UnoControlDialog", mxContext), + uno::UNO_QUERY_THROW ); xControl->setModel( xControlModel ); if ( mbVisible == false ) { - xControl->setVisible( false ); + uno::Reference< awt::XWindow > xWindow( xControl, uno::UNO_QUERY ); + + if ( xWindow.is() ) + xWindow->setVisible( false ); } xControl->createPeer( NULL, NULL ); { + uno::Reference< awt::XControlContainer > xContainer (xControl, uno::UNO_QUERY); for ( int i = 0; i < HELP_BUTTON; i++ ) { - uno::Reference< awt::XButton > xButton ( xControl->getControl( msButtonIDs[i] ), uno::UNO_QUERY); + uno::Reference< awt::XButton > xButton ( xContainer->getControl( msButtonIDs[i] ), uno::UNO_QUERY); if (xButton.is()) { xButton->setActionCommand( msButtonIDs[i] ); diff --git a/filter/source/t602/t602filter.cxx b/filter/source/t602/t602filter.cxx index 0d3c948e0996..4ef5b6deeecf 100644 --- a/filter/source/t602/t602filter.cxx +++ b/filter/source/t602/t602filter.cxx @@ -26,13 +26,11 @@ #include <cppuhelper/factory.hxx> #include <cppuhelper/bootstrap.hxx> #include <com/sun/star/awt/Toolkit.hpp> -#include <com/sun/star/awt/UnoControlDialogModel.hpp> #include <com/sun/star/bridge/XUnoUrlResolver.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/ucb/XSimpleFileAccess.hpp> #include <com/sun/star/text/XTextDocument.hpp> #include <com/sun/star/container/XNameContainer.hpp> -#include <com/sun/star/awt/UnoControlDialog.hpp> #include <com/sun/star/awt/XControl.hpp> #include <com/sun/star/awt/XDialog.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> @@ -940,19 +938,27 @@ sal_Bool T602ImportFilterDialog::OptionsDlg() _prop->setPropertyValue(OUString::createFromAscii(_nam), any); #define _propGet(_prop,_nam) \ _prop->getPropertyValue(OUString::createFromAscii(_nam)); +#define _InstCtx(_path,_ctx)\ + rServiceManager->createInstanceWithContext(\ + OUString::createFromAscii(_path),_ctx); +#define _Inst(_path)\ + xMultiServiceFactory->createInstance(OUString::createFromAscii(_path) ); #define _Insert(_cont,_nam,_obj) \ any <<= _obj;\ _cont->insertByName( OUString::createFromAscii(_nam), any ); Reference < XComponentContext > rComponentContext = defaultBootstrap_InitialComponentContext(); Reference < XMultiComponentFactory > rServiceManager = rComponentContext->getServiceManager(); - Reference < XUnoControlDialogModel > rInstance = UnoControlDialogModel::create(rComponentContext ); + Reference < XInterface > rInstance = _InstCtx("com.sun.star.awt.UnoControlDialogModel", rComponentContext ); - rInstance->setPositionX(100); - rInstance->setPositionY(100); - rInstance->setWidth(130); - rInstance->setHeight(90); - rInstance->setTitle(getResStr(T602FILTER_STR_IMPORT_DIALOG_TITLE)); + Reference <XMultiServiceFactory> xMultiServiceFactory (rInstance,UNO_QUERY); + + Reference < XPropertySet > xPSetDialog( rInstance, UNO_QUERY ); + _propInt(xPSetDialog,"PositionX",100); + _propInt(xPSetDialog,"PositionY",100); + _propInt(xPSetDialog,"Width",130); + _propInt(xPSetDialog,"Height",90); + _propStringFromResId(xPSetDialog,"Title", T602FILTER_STR_IMPORT_DIALOG_TITLE); #define T602DLG_OK_BUTTON "ok_button" #define T602DLG_CANCEL_BUTTON "cancel_button" @@ -962,7 +968,7 @@ sal_Bool T602ImportFilterDialog::OptionsDlg() #define T602DLG_REFORMAT_CB "reformat_cb" #define T602DLG_CODE_TXT "code_txt" - Reference < XInterface > TextModel = rInstance->createInstance("com.sun.star.awt.UnoControlFixedTextModel"); + Reference < XInterface > TextModel = _Inst("com.sun.star.awt.UnoControlFixedTextModel"); Reference < XPropertySet > xPSetText( TextModel, UNO_QUERY ); _propInt(xPSetText,"PositionX",10); _propInt(xPSetText,"PositionY",8); @@ -971,7 +977,7 @@ sal_Bool T602ImportFilterDialog::OptionsDlg() _propString(xPSetText,"Name",T602DLG_CODE_TXT); _propStringFromResId(xPSetText,"Label",T602FILTER_STR_ENCODING_LABEL); - Reference < XInterface > ListBoxModel = rInstance->createInstance("com.sun.star.awt.UnoControlListBoxModel"); + Reference < XInterface > ListBoxModel = _Inst("com.sun.star.awt.UnoControlListBoxModel"); Reference < XPropertySet > xPSetCodeLB( ListBoxModel, UNO_QUERY ); _propInt(xPSetCodeLB,"PositionX",40); _propInt(xPSetCodeLB,"PositionY",5); @@ -995,7 +1001,7 @@ sal_Bool T602ImportFilterDialog::OptionsDlg() any <<= shr; xPSetCodeLB->setPropertyValue(OUString( "SelectedItems" ), any); - Reference < XInterface > AzbCheckBoxModel = rInstance->createInstance("com.sun.star.awt.UnoControlCheckBoxModel"); + Reference < XInterface > AzbCheckBoxModel = _Inst("com.sun.star.awt.UnoControlCheckBoxModel"); Reference < XPropertySet > xPSetAzbukaCB( AzbCheckBoxModel, UNO_QUERY ); _propInt(xPSetAzbukaCB,"PositionX",10); _propInt(xPSetAzbukaCB,"PositionY",25); @@ -1006,7 +1012,7 @@ sal_Bool T602ImportFilterDialog::OptionsDlg() _propStringFromResId(xPSetAzbukaCB,"Label",T602FILTER_STR_CYRILLIC_MODE); _propShort(xPSetAzbukaCB,"State",ini.ruscode); - Reference < XInterface > RefCheckBoxModel = rInstance->createInstance("com.sun.star.awt.UnoControlCheckBoxModel"); + Reference < XInterface > RefCheckBoxModel = _Inst("com.sun.star.awt.UnoControlCheckBoxModel"); Reference < XPropertySet > xPSetRefCB( RefCheckBoxModel, UNO_QUERY ); _propInt(xPSetRefCB,"PositionX",10); _propInt(xPSetRefCB,"PositionY",40); @@ -1017,7 +1023,7 @@ sal_Bool T602ImportFilterDialog::OptionsDlg() _propStringFromResId(xPSetRefCB,"Label",T602FILTER_STR_REFORMAT_TEXT); _propShort(xPSetRefCB,"State",ini.reformatpars); - Reference < XInterface > CommCheckBoxModel = rInstance->createInstance("com.sun.star.awt.UnoControlCheckBoxModel"); + Reference < XInterface > CommCheckBoxModel = _Inst("com.sun.star.awt.UnoControlCheckBoxModel"); Reference < XPropertySet > xPSetCommCB( CommCheckBoxModel, UNO_QUERY ); _propInt(xPSetCommCB,"PositionX",10); _propInt(xPSetCommCB,"PositionY",55); @@ -1028,7 +1034,7 @@ sal_Bool T602ImportFilterDialog::OptionsDlg() _propStringFromResId(xPSetCommCB,"Label",T602FILTER_STR_DOT_COMMANDS); _propShort(xPSetCommCB,"State",ini.showcomm); - Reference < XInterface > CancelButtonModel = rInstance->createInstance("com.sun.star.awt.UnoControlButtonModel"); + Reference < XInterface > CancelButtonModel = _Inst("com.sun.star.awt.UnoControlButtonModel"); Reference < XPropertySet > xPSetCancelButton( CancelButtonModel, UNO_QUERY ); _propInt(xPSetCancelButton,"PositionX",10); _propInt(xPSetCancelButton,"PositionY",70); @@ -1039,7 +1045,7 @@ sal_Bool T602ImportFilterDialog::OptionsDlg() _propShort(xPSetCancelButton,"PushButtonType",2); _propStringFromResId(xPSetCancelButton,"Label",T602FILTER_STR_CANCEL_BUTTON); - Reference < XInterface > OkButtonModel = rInstance->createInstance("com.sun.star.awt.UnoControlButtonModel"); + Reference < XInterface > OkButtonModel = _Inst("com.sun.star.awt.UnoControlButtonModel"); Reference < XPropertySet > xPSetOkButton( OkButtonModel, UNO_QUERY ); _propInt(xPSetOkButton,"PositionX",70); _propInt(xPSetOkButton,"PositionY",70); @@ -1061,18 +1067,31 @@ sal_Bool T602ImportFilterDialog::OptionsDlg() _Insert(xNameCont, T602DLG_CODE_LB, ListBoxModel); _Insert(xNameCont, T602DLG_CODE_TXT, TextModel); - Reference< XUnoControlDialog > dialog = UnoControlDialog::create(rComponentContext); + Reference< XInterface > dialog = _InstCtx("com.sun.star.awt.UnoControlDialog",rComponentContext); + Reference < XControl > xControl (dialog,UNO_QUERY); Reference < XControlModel > xControlModel (rInstance,UNO_QUERY); - dialog->setModel( xControlModel ); + if(!xControl.is()) + return sal_False; + + xControl->setModel( xControlModel ); Reference < XToolkit > xToolkit = Toolkit::create( rComponentContext ); + Reference < XWindow > xWindow (xControl,UNO_QUERY); + + if(!xWindow.is()) + return sal_False; - dialog->setVisible( false ); - dialog->createPeer( xToolkit, NULL ); + xWindow->setVisible( false ); + xControl->createPeer( xToolkit, NULL ); - ret = ( dialog->execute() != 0 ); + Reference < XDialog > xDialog (dialog,UNO_QUERY); + + if(!xDialog.is()) + return sal_False; + + ret = ( xDialog->execute() != 0 ); if ( ret ) { sal_Int16 tt = 0; @@ -1091,7 +1110,9 @@ sal_Bool T602ImportFilterDialog::OptionsDlg() } } - Reference<XControl>(dialog)->dispose(); + Reference < XComponent > xComponent (dialog,UNO_QUERY); + + xComponent->dispose(); return ret; } diff --git a/include/toolkit/controls/dialogcontrol.hxx b/include/toolkit/controls/dialogcontrol.hxx index a749c241fbc7..e8b95647c80f 100644 --- a/include/toolkit/controls/dialogcontrol.hxx +++ b/include/toolkit/controls/dialogcontrol.hxx @@ -21,8 +21,6 @@ #define TOOLKIT_DIALOG_CONTROL_HXX #include <toolkit/controls/controlmodelcontainerbase.hxx> -#include <com/sun/star/awt/XUnoControlDialog.hpp> -#include <com/sun/star/awt/XUnoControlDialogModel.hpp> #include <com/sun/star/awt/XTopWindow.hpp> #include <com/sun/star/awt/XDialog2.hpp> #include <com/sun/star/awt/XSimpleTabController.hpp> @@ -32,8 +30,6 @@ #include "toolkit/helper/macros.hxx" #include <toolkit/controls/unocontrolcontainer.hxx> #include <cppuhelper/basemutex.hxx> -#include <cppuhelper/implbase1.hxx> -#include <cppuhelper/implbase2.hxx> #include <cppuhelper/implbase3.hxx> #include <list> @@ -41,10 +37,7 @@ // class UnoControlDialogModel // ---------------------------------------------------- -typedef ::cppu::AggImplInheritanceHelper1 < ControlModelContainerBase - , ::com::sun::star::awt::XUnoControlDialogModel - > UnoControlDialogModel_Base; -class UnoControlDialogModel : public UnoControlDialogModel_Base +class UnoControlDialogModel : public ControlModelContainerBase { protected: ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj; @@ -52,19 +45,6 @@ protected: ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); // ::cppu::OPropertySetHelper void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception); - - OUString getPropertyString(const OUString& p1) throw(::com::sun::star::uno::RuntimeException); - sal_Bool getPropertyBool(const OUString& p1) throw(::com::sun::star::uno::RuntimeException); - sal_Int16 getPropertyInt16(const OUString& p1) throw(::com::sun::star::uno::RuntimeException); - sal_Int32 getPropertyInt32(const OUString& p1) throw(::com::sun::star::uno::RuntimeException); - void setPropertyString(const OUString& p1, const OUString& p2) throw(::com::sun::star::uno::RuntimeException) - { setPropertyValue( p1, css::uno::Any(p2) ); } - void setPropertyBool(const OUString& p1, sal_Bool p2) throw(::com::sun::star::uno::RuntimeException) - { setPropertyValue( p1, css::uno::Any(p2) ); } - void setPropertyInt16(const OUString& p1, sal_Int16 p2) throw(::com::sun::star::uno::RuntimeException) - { setPropertyValue( p1, css::uno::Any(p2) ); } - void setPropertyInt32(const OUString& p1, sal_Int32 p2) throw(::com::sun::star::uno::RuntimeException) - { setPropertyValue( p1, css::uno::Any(p2) ); } public: UnoControlDialogModel( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); UnoControlDialogModel( const UnoControlDialogModel& rModel ); @@ -80,144 +60,11 @@ public: // XServiceInfo DECLIMPL_SERVICEINFO_DERIVED( UnoControlDialogModel, ControlModelContainerBase, szServiceName2_UnoControlDialogModel ) - - // XUnoControlDialogModel attributes - virtual rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyString("Name"); } - virtual void SAL_CALL setName(const rtl::OUString& p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyString("Name", p1); } - virtual sal_Bool SAL_CALL getDecoration() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyBool("Decoration"); } - virtual void SAL_CALL setDecoration(sal_Bool p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyBool("Decoration", p1); } - virtual sal_Int32 SAL_CALL getPositionX() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyInt32("PositionX"); } - virtual void SAL_CALL setPositionX(sal_Int32 p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyInt32("PositionX", p1); } - virtual sal_Int32 SAL_CALL getPositionY() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyInt32("PositionY"); } - virtual void SAL_CALL setPositionY(sal_Int32 p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyInt32("PositionY", p1); } - virtual sal_Int32 SAL_CALL getWidth() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyInt32("Width"); } - virtual void SAL_CALL setWidth(sal_Int32 p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyInt32("Width", p1); } - virtual sal_Int32 SAL_CALL getHeight() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyInt32("Height"); } - virtual void SAL_CALL setHeight(sal_Int32 p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyInt32("Height", p1); } - virtual rtl::OUString SAL_CALL getDialogSourceURL() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyString("DialogSourceURL"); } - virtual void SAL_CALL setDialogSourceURL(const rtl::OUString& p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyString("DialogSourceURL", p1); } - virtual rtl::OUString SAL_CALL getTitle() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyString("Title"); } - virtual void SAL_CALL setTitle(const rtl::OUString& p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyString("Title", p1); } - virtual sal_Bool SAL_CALL getCloseable() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyBool("Closeable"); } - virtual void SAL_CALL setCloseable(sal_Bool p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyBool("Closeable", p1); } - virtual sal_Bool SAL_CALL getEnabled() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyBool("Enabled"); } - virtual void SAL_CALL setEnabled(sal_Bool p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyBool("Enabled", p1); } - virtual sal_Bool SAL_CALL getMoveable() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyBool("Moveable"); } - virtual void SAL_CALL setMoveable(sal_Bool p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyBool("Moveable", p1); } - virtual sal_Bool SAL_CALL getSizeable() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyBool("Sizeable"); } - virtual void SAL_CALL setSizeable(sal_Bool p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyBool("Sizeable", p1); } - virtual sal_Bool SAL_CALL getDesktopAsParent() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyBool("DesktopAsParent"); } - virtual void SAL_CALL setDesktopAsParent(sal_Bool p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyBool("DesktopAsParent", p1); } - virtual rtl::OUString SAL_CALL getHelpURL() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyString("HelpURL"); } - virtual void SAL_CALL setHelpURL(const rtl::OUString& p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyString("HelpURL", p1); } - virtual sal_Int32 SAL_CALL getBackgroundColor() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyInt32("BackgroundColor"); } - virtual void SAL_CALL setBackgroundColor(sal_Int32 p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyInt32("BackgroundColor", p1); } - virtual sal_Int16 SAL_CALL getFontEmphasisMark() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyInt16("FontEmphasisMark"); } - virtual void SAL_CALL setFontEmphasisMark(sal_Int16 p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyInt16("FontEmphasisMark", p1); } - virtual sal_Int16 SAL_CALL getFontRelief() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyInt16("FontRelief"); } - virtual void SAL_CALL setFontRelief(sal_Int16 p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyInt16("FontRelief", p1); } - virtual rtl::OUString SAL_CALL getHelpText() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyString("HelpText"); } - virtual void SAL_CALL setHelpText(const rtl::OUString& p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyString("HelpText", p1); } - virtual sal_Int32 SAL_CALL getTextColor() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyInt32("TextColor"); } - virtual void SAL_CALL setTextColor(sal_Int32 p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyInt32("TextColor", p1); } - virtual sal_Int32 SAL_CALL getTextLineColor() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyInt32("TextLineColor"); } - virtual void SAL_CALL setTextLineColor(sal_Int32 p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyInt32("TextLineColor", p1); } - virtual rtl::OUString SAL_CALL getImageURL() throw(::com::sun::star::uno::RuntimeException) - { return getPropertyString("ImageURL"); } - virtual void SAL_CALL setImageURL(const rtl::OUString& p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyString("ImageURL", p1); } - virtual com::sun::star::awt::FontDescriptor SAL_CALL getFontDescriptor() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setFontDescriptor(const com::sun::star::awt::FontDescriptor& p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyValue( "FontDescriptor", css::uno::Any(p1) ); } - virtual com::sun::star::uno::Reference<com::sun::star::graphic::XGraphic> SAL_CALL getGraphic() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setGraphic(const com::sun::star::uno::Reference<com::sun::star::graphic::XGraphic>& p1) throw(::com::sun::star::uno::RuntimeException) - { setPropertyValue( "Graphic", css::uno::Any(p1) ); } - - - // overrides to resolve ambiguity - virtual com::sun::star::uno::Any SAL_CALL getPropertyValue(const rtl::OUString& p1) throw (com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException) - { return UnoControlDialogModel_Base::ControlModelContainerBase::getPropertyValue(p1); } - virtual void SAL_CALL setPropertyValue(const OUString& p1, const com::sun::star::uno::Any& p2) throw (com::sun::star::beans::UnknownPropertyException, com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException) - { return UnoControlDialogModel_Base::ControlModelContainerBase::setPropertyValue(p1, p2); } - virtual void SAL_CALL addPropertyChangeListener(const OUString& p1, const com::sun::star::uno::Reference<com::sun::star::beans::XPropertyChangeListener>& p2) throw (com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException) - { return UnoControlDialogModel_Base::ControlModelContainerBase::addPropertyChangeListener(p1, p2); } - virtual void SAL_CALL removePropertyChangeListener(const OUString& p1, const com::sun::star::uno::Reference<com::sun::star::beans::XPropertyChangeListener>& p2) throw (com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException) - { return UnoControlDialogModel_Base::ControlModelContainerBase::removePropertyChangeListener(p1, p2); } - virtual void SAL_CALL addVetoableChangeListener(const OUString& p1, const com::sun::star::uno::Reference<com::sun::star::beans::XVetoableChangeListener>& p2) throw (com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException) - { return UnoControlDialogModel_Base::ControlModelContainerBase::addVetoableChangeListener(p1, p2); } - virtual void SAL_CALL removeVetoableChangeListener(const OUString& p1, const com::sun::star::uno::Reference<com::sun::star::beans::XVetoableChangeListener>& p2) throw (com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException) - { return UnoControlDialogModel_Base::ControlModelContainerBase::removeVetoableChangeListener(p1, p2); } - virtual com::sun::star::uno::Reference<com::sun::star::uno::XInterface> SAL_CALL createInstance(const OUString& p1) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException) - { return UnoControlDialogModel_Base::ControlModelContainerBase::createInstance(p1); } - virtual com::sun::star::uno::Reference<com::sun::star::uno::XInterface> SAL_CALL createInstanceWithArguments(const OUString& p1, const com::sun::star::uno::Sequence<com::sun::star::uno::Any>& p2) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException) - { return UnoControlDialogModel_Base::ControlModelContainerBase::createInstanceWithArguments(p1, p2); } - virtual com::sun::star::uno::Sequence<rtl::OUString> SAL_CALL getAvailableServiceNames() throw (::com::sun::star::uno::RuntimeException) - { return UnoControlDialogModel_Base::ControlModelContainerBase::getAvailableServiceNames(); } - - - virtual com::sun::star::uno::Type SAL_CALL getElementType() throw (::com::sun::star::uno::RuntimeException) - { return UnoControlDialogModel_Base::ControlModelContainerBase::getElementType(); } - virtual sal_Bool SAL_CALL hasElements() throw (::com::sun::star::uno::RuntimeException) - { return UnoControlDialogModel_Base::ControlModelContainerBase::hasElements(); } - virtual com::sun::star::uno::Any SAL_CALL getByName(const rtl::OUString& p1) throw (com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException) - { return UnoControlDialogModel_Base::ControlModelContainerBase::getByName(p1); } - virtual com::sun::star::uno::Sequence<rtl::OUString> SAL_CALL getElementNames() throw (::com::sun::star::uno::RuntimeException) - { return UnoControlDialogModel_Base::ControlModelContainerBase::getElementNames(); } - virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& p1) throw (::com::sun::star::uno::RuntimeException) - { return UnoControlDialogModel_Base::ControlModelContainerBase::hasByName(p1); } - virtual void SAL_CALL replaceByName(const rtl::OUString& p1, const com::sun::star::uno::Any& p2) throw (com::sun::star::lang::IllegalArgumentException, com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException) - { UnoControlDialogModel_Base::ControlModelContainerBase::replaceByName(p1, p2); } - virtual void SAL_CALL insertByName(const rtl::OUString& p1, const com::sun::star::uno::Any& p2) throw (com::sun::star::lang::IllegalArgumentException, com::sun::star::container::ElementExistException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException) - { UnoControlDialogModel_Base::ControlModelContainerBase::insertByName(p1, p2); } - virtual void SAL_CALL removeByName(const rtl::OUString& p1) throw (com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException) - { UnoControlDialogModel_Base::ControlModelContainerBase::removeByName(p1); } - - - }; -typedef ::cppu::AggImplInheritanceHelper2 < ControlContainerBase - , ::com::sun::star::awt::XUnoControlDialog +typedef ::cppu::AggImplInheritanceHelper3 < ControlContainerBase + , ::com::sun::star::awt::XTopWindow + , ::com::sun::star::awt::XDialog2 , ::com::sun::star::awt::XWindowListener > UnoDialogControl_Base; class UnoDialogControl : public UnoDialogControl_Base @@ -266,73 +113,6 @@ public: // XModifyListener virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); - // resolve some ambigous methods - virtual com::sun::star::uno::Reference<com::sun::star::awt::XWindowPeer> SAL_CALL getPeer() throw (com::sun::star::uno::RuntimeException) - { return UnoDialogControl_Base::ControlContainerBase::getPeer(); } - virtual void SAL_CALL addWindowListener(const com::sun::star::uno::Reference<com::sun::star::awt::XWindowListener>& p1) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::addWindowListener(p1); } - virtual com::sun::star::uno::Reference<com::sun::star::awt::XControlModel> SAL_CALL getModel() throw (com::sun::star::uno::RuntimeException) - { return UnoDialogControl_Base::ControlContainerBase::getModel(); } - virtual void SAL_CALL addEventListener(const com::sun::star::uno::Reference<com::sun::star::lang::XEventListener>& p1) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::addEventListener(p1); } - virtual void SAL_CALL removeEventListener(const com::sun::star::uno::Reference<com::sun::star::lang::XEventListener>& p1) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::removeEventListener(p1); } - virtual void SAL_CALL setContext(const com::sun::star::uno::Reference<com::sun::star::uno::XInterface>& p1) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::setContext(p1); } - virtual com::sun::star::uno::Reference<com::sun::star::uno::XInterface> SAL_CALL getContext() throw (com::sun::star::uno::RuntimeException) - { return UnoDialogControl_Base::ControlContainerBase::getContext(); } - virtual com::sun::star::uno::Reference<com::sun::star::awt::XView> SAL_CALL getView() throw (com::sun::star::uno::RuntimeException) - { return UnoDialogControl_Base::ControlContainerBase::getView(); } - virtual void SAL_CALL setDesignMode(sal_Bool p1) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::setDesignMode(p1); } - virtual sal_Bool SAL_CALL isDesignMode() throw (com::sun::star::uno::RuntimeException) - { return UnoDialogControl_Base::ControlContainerBase::isDesignMode(); } - virtual sal_Bool SAL_CALL isTransparent() throw (com::sun::star::uno::RuntimeException) - { return UnoDialogControl_Base::ControlContainerBase::isTransparent(); } - virtual void SAL_CALL setPosSize(sal_Int32 p1, sal_Int32 p2, sal_Int32 p3, sal_Int32 p4, sal_Int16 p5) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::setPosSize(p1, p2, p3, p4, p5); } - virtual com::sun::star::awt::Rectangle SAL_CALL getPosSize() throw (com::sun::star::uno::RuntimeException) - { return UnoDialogControl_Base::ControlContainerBase::getPosSize(); } - virtual void SAL_CALL setVisible(sal_Bool p1) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::setVisible(p1); } - virtual void SAL_CALL setEnable(sal_Bool p1) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::setEnable(p1); } - virtual void SAL_CALL setFocus() throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::setFocus(); } - virtual void SAL_CALL removeWindowListener(const com::sun::star::uno::Reference<com::sun::star::awt::XWindowListener>& p1) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::removeWindowListener(p1); } - virtual void SAL_CALL addFocusListener(const com::sun::star::uno::Reference<com::sun::star::awt::XFocusListener>& p1) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::addFocusListener(p1); } - virtual void SAL_CALL removeFocusListener(const com::sun::star::uno::Reference<com::sun::star::awt::XFocusListener>& p1) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::removeFocusListener(p1); } - virtual void SAL_CALL addKeyListener(const com::sun::star::uno::Reference<com::sun::star::awt::XKeyListener>& p1) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::addKeyListener(p1); } - virtual void SAL_CALL removeKeyListener(const com::sun::star::uno::Reference<com::sun::star::awt::XKeyListener>& p1) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::removeKeyListener(p1); } - virtual void SAL_CALL addMouseListener(const com::sun::star::uno::Reference<com::sun::star::awt::XMouseListener>& p1) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::addMouseListener(p1); } - virtual void SAL_CALL removeMouseListener(const com::sun::star::uno::Reference<com::sun::star::awt::XMouseListener>& p1) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::removeMouseListener(p1); } - virtual void SAL_CALL addMouseMotionListener(const com::sun::star::uno::Reference<com::sun::star::awt::XMouseMotionListener>& p1) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::addMouseMotionListener(p1); } - virtual void SAL_CALL removeMouseMotionListener(const com::sun::star::uno::Reference<com::sun::star::awt::XMouseMotionListener>& p1) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::removeMouseMotionListener(p1); } - virtual void SAL_CALL addPaintListener(const com::sun::star::uno::Reference<com::sun::star::awt::XPaintListener>& p1) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::addPaintListener(p1); } - virtual void SAL_CALL removePaintListener(const com::sun::star::uno::Reference<com::sun::star::awt::XPaintListener>& p1) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::removePaintListener(p1); } - virtual void SAL_CALL setStatusText(const rtl::OUString& p1) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::setStatusText(p1); } - virtual com::sun::star::uno::Sequence<com::sun::star::uno::Reference<com::sun::star::awt::XControl> > SAL_CALL getControls() throw (com::sun::star::uno::RuntimeException) - { return UnoDialogControl_Base::ControlContainerBase::getControls(); } - virtual com::sun::star::uno::Reference<com::sun::star::awt::XControl> SAL_CALL getControl(const rtl::OUString& p1) throw (com::sun::star::uno::RuntimeException) - { return UnoDialogControl_Base::ControlContainerBase::getControl(p1); } - virtual void SAL_CALL addControl(const rtl::OUString& p1, const com::sun::star::uno::Reference<com::sun::star::awt::XControl>& p2) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::addControl(p1, p2); } - virtual void SAL_CALL removeControl(const com::sun::star::uno::Reference<com::sun::star::awt::XControl>& p1) throw (com::sun::star::uno::RuntimeException) - { UnoDialogControl_Base::ControlContainerBase::removeControl(p1); } - - // ::com::sun::star::lang::XServiceInfo DECLIMPL_SERVICEINFO( UnoDialogControl, szServiceName2_UnoControlDialog ) diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 2e5723f89f3e..dcaf757c6a79 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -60,8 +60,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/awt,\ PopupMenu \ TabController \ Toolkit \ - UnoControlDialog \ - UnoControlDialogModel \ UnoControlDialogModelProvider \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/awt/grid,\ @@ -526,7 +524,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/awt,\ UnoControlCurrencyFieldModel \ UnoControlDateField \ UnoControlDateFieldModel \ + UnoControlDialog \ UnoControlDialogElement \ + UnoControlDialogModel \ UnoControlEdit \ UnoControlEditModel \ UnoControlFileControl \ @@ -1884,8 +1884,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/awt,\ XTopWindowListener \ XUnitConversion \ XUnoControlContainer \ - XUnoControlDialog \ - XUnoControlDialogModel \ XUserInputInterception \ XVclContainer \ XVclContainerListener \ diff --git a/offapi/com/sun/star/awt/UnoControlDialog.idl b/offapi/com/sun/star/awt/UnoControlDialog.idl index 67e0b79b8381..4cc079e4f082 100644 --- a/offapi/com/sun/star/awt/UnoControlDialog.idl +++ b/offapi/com/sun/star/awt/UnoControlDialog.idl @@ -19,14 +19,28 @@ #ifndef __com_sun_star_awt_UnoControlDialog_idl__ #define __com_sun_star_awt_UnoControlDialog_idl__ -#include <com/sun/star/awt/XUnoControlDialog.idl> +#include <com/sun/star/awt/UnoControlContainer.idl> -module com { module sun { module star { module awt { +#include <com/sun/star/awt/XTopWindow.idl> + +#include <com/sun/star/awt/XDialog2.idl> + + + + module com { module sun { module star { module awt { /** specifies a dialog control. */ -published service UnoControlDialog : XUnoControlDialog; +published service UnoControlDialog +{ + service com::sun::star::awt::UnoControlContainer; + + interface com::sun::star::awt::XTopWindow; + + interface com::sun::star::awt::XDialog2; + +}; }; }; }; }; diff --git a/offapi/com/sun/star/awt/UnoControlDialogModel.idl b/offapi/com/sun/star/awt/UnoControlDialogModel.idl index 3956102d1508..9c4dd99a4642 100644 --- a/offapi/com/sun/star/awt/UnoControlDialogModel.idl +++ b/offapi/com/sun/star/awt/UnoControlDialogModel.idl @@ -19,7 +19,14 @@ #ifndef __com_sun_star_awt_UnoControlDialogModel_idl__ #define __com_sun_star_awt_UnoControlDialogModel_idl__ -#include <com/sun/star/awt/XUnoControlDialogModel.idl> +#include <com/sun/star/awt/FontDescriptor.idl> +#include <com/sun/star/awt/UnoControlModel.idl> +#include <com/sun/star/container/XContainer.idl> +#include <com/sun/star/container/XNameContainer.idl> + +#include <com/sun/star/lang/XMultiServiceFactory.idl> +#include <com/sun/star/util/Color.idl> +#include <com/sun/star/graphic/XGraphic.idl> module com { module sun { module star { module awt { @@ -27,7 +34,118 @@ /** specifies the standard model of an <type>UnoControlDialog</type>. */ -published service UnoControlDialogModel : XUnoControlDialogModel; +published service UnoControlDialogModel +{ + service com::sun::star::awt::UnoControlModel; + + /** allows to create control models, which support the + <type>UnoControlDialogElement</type> service and can be inserted into + this container. + */ + interface com::sun::star::lang::XMultiServiceFactory; + + interface com::sun::star::container::XContainer; + + interface com::sun::star::container::XNameContainer; + + + /** specifies the background color (RGB) of the dialog. + */ + [property] com::sun::star::util::Color BackgroundColor; + + + /** specifies if the dialog is closeable. + */ + [property] boolean Closeable; + + + /** determines whether a dialog is enabled or disabled. + */ + [property] boolean Enabled; + + + /** specifies the font attributes of the text in the caption bar of the dialog. + */ + [property] com::sun::star::awt::FontDescriptor FontDescriptor; + + + /** specifies the <type scope="com::sun::star::text">FontEmphasis</type> + value of the text in the caption bar of the dialog. + */ + [property] short FontEmphasisMark; + + + /** specifies the <type scope="com::sun::star::text">FontRelief</type> + value of the text in the caption bar of the dialog. + */ + [property] short FontRelief; + + + /** specifies the help text of the dialog. + */ + [property] string HelpText; + + + /** specifies the help URL of the dialog. + */ + [property] string HelpURL; + + + /** specifies if the dialog is moveable. + */ + [property] boolean Moveable; + + + /** specifies if the dialog is sizeable. + */ + [property] boolean Sizeable; + + + /** specifies the text color (RGB) of the dialog. + */ + [property] com::sun::star::util::Color TextColor; + + + /** specifies the text line color (RGB) of the dialog. + */ + [property] com::sun::star::util::Color TextLineColor; + + + /** specifies the text that is displayed in the caption bar of the dialog. + */ + [property] string Title; + + + /** If set to true the dialog will have the desktop as parent. + + @since OOo 2.3 + */ + [optional, property] boolean DesktopAsParent; + + /** specifies a URL that references a graphic that should be used as a + background image. + @see Graphic + + @since OOo 2.4 + */ + [optional, property] string ImageURL; + + /** specifies a graphic to be displayed as a background image + + <p>If this property is present, it interacts with the <member>ImageURL</member>in the + following way: + <ul><li>If <member>ImageURL</member> is set, <member>Graphic</member> will be reset + to an object as loaded from the given image URL, or <NULL/> if <member>ImageURL</member> + does not point to a valid image file.</li> + <li>If <member>Graphic</member> is set, <member>ImageURL</member> will be reset + to an empty string.</li> + </ul></p> + + @since OOo 2.4 + */ + [optional, property, transient] com::sun::star::graphic::XGraphic Graphic; + +}; }; }; }; }; diff --git a/offapi/com/sun/star/awt/XUnoControlDialog.idl b/offapi/com/sun/star/awt/XUnoControlDialog.idl deleted file mode 100644 index 3d513b71adc3..000000000000 --- a/offapi/com/sun/star/awt/XUnoControlDialog.idl +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef __com_sun_star_awt_XUnoControlDialog_idl__ -#define __com_sun_star_awt_XUnoControlDialog_idl__ - -#include <com/sun/star/container/XNameContainer.idl> -#include <com/sun/star/awt/XControl.idl> -#include <com/sun/star/awt/XDialog2.idl> -#include <com/sun/star/awt/XTopWindow.idl> -#include <com/sun/star/awt/XControlContainer.idl> -#include <com/sun/star/awt/XWindow.idl> - - -module com { module sun { module star { module awt { - -/** - The interface for the UnoControlDialog service. - This service actually implements a whole whack of interfaces. This is the just - the subset that our code needs. - - @since LibreOffice 4.1 - */ -published interface XUnoControlDialog -{ - - interface com::sun::star::awt::XControlContainer; // -> XInterface - - interface com::sun::star::awt::XControl; // -> XComponent - - interface com::sun::star::awt::XWindow; // -> XComponent - - interface com::sun::star::awt::XTopWindow; // -> XInterface - - interface com::sun::star::awt::XDialog2; // -> XDialog -> XInterface -}; - - -}; }; }; }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/awt/XUnoControlDialogModel.idl b/offapi/com/sun/star/awt/XUnoControlDialogModel.idl deleted file mode 100644 index 9032a37b582d..000000000000 --- a/offapi/com/sun/star/awt/XUnoControlDialogModel.idl +++ /dev/null @@ -1,166 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef __com_sun_star_awt_XUnoControlDialogModel_idl__ -#define __com_sun_star_awt_XUnoControlDialogModel_idl__ - -#include <com/sun/star/awt/FontDescriptor.idl> -#include <com/sun/star/awt/XControlModel.idl> -#include <com/sun/star/beans/XPropertySet.idl> -#include <com/sun/star/container/XContainer.idl> -#include <com/sun/star/container/XNameContainer.idl> - -#include <com/sun/star/lang/XMultiServiceFactory.idl> -#include <com/sun/star/util/Color.idl> -#include <com/sun/star/graphic/XGraphic.idl> - - -module com { module sun { module star { module awt { - - -/** - Unified interface for the UnoControlDialogModel service. - - @since LibreOffice 4.1 - */ -published interface XUnoControlDialogModel -{ - interface com::sun::star::awt::XControlModel; - - /** allows to create control models, which support the - <type>UnoControlDialogElement</type> service and can be inserted into - this container. - */ - interface com::sun::star::lang::XMultiServiceFactory; - - interface com::sun::star::beans::XPropertySet; - - interface com::sun::star::container::XNameContainer; // -> XNameReplace -> XNameAccess -> XElementAccess - - [attribute] string Name; - - [attribute] boolean Decoration; - - [attribute] long PositionX; - - [attribute] long PositionY; - - [attribute] long Width; - - [attribute] long Height; - - [attribute] string DialogSourceURL; - - /** specifies the text that is displayed in the caption bar of the dialog. - */ - [attribute] string Title; - - /** specifies if the dialog is closeable. - */ - [attribute] boolean Closeable; - - /** determines whether a dialog is enabled or disabled. - */ - [attribute] boolean Enabled; - - /** specifies if the dialog is moveable. - */ - [attribute] boolean Moveable; - - /** specifies if the dialog is sizeable. - */ - [attribute] boolean Sizeable; - - /** If set to true the dialog will have the desktop as parent. - - @since OOo 2.3 - */ - [attribute] boolean DesktopAsParent; - - /** specifies the help URL of the dialog. - */ - [attribute] string HelpURL; - - - /** specifies the background color (RGB) of the dialog. - */ - [attribute] com::sun::star::util::Color BackgroundColor; - - - /** specifies the font attributes of the text in the caption bar of the dialog. - */ - [attribute] com::sun::star::awt::FontDescriptor FontDescriptor; - - - /** specifies the <type scope="com::sun::star::text">FontEmphasis</type> - value of the text in the caption bar of the dialog. - */ - [attribute] short FontEmphasisMark; - - - /** specifies the <type scope="com::sun::star::text">FontRelief</type> - value of the text in the caption bar of the dialog. - */ - [attribute] short FontRelief; - - - /** specifies the help text of the dialog. - */ - [attribute] string HelpText; - - - /** specifies the text color (RGB) of the dialog. - */ - [attribute] com::sun::star::util::Color TextColor; - - - /** specifies the text line color (RGB) of the dialog. - */ - [attribute] com::sun::star::util::Color TextLineColor; - - /** specifies a URL that references a graphic that should be used as a - background image. - @see Graphic - - @since OOo 2.4 - */ - [attribute] string ImageURL; - - /** specifies a graphic to be displayed as a background image - - <p>If this property is present, it interacts with the <member>ImageURL</member>in the - following way: - <ul><li>If <member>ImageURL</member> is set, <member>Graphic</member> will be reset - to an object as loaded from the given image URL, or <NULL/> if <member>ImageURL</member> - does not point to a valid image file.</li> - <li>If <member>Graphic</member> is set, <member>ImageURL</member> will be reset - to an empty string.</li> - </ul></p> - - @since OOo 2.4 - */ - [attribute] com::sun::star::graphic::XGraphic Graphic; - -}; - - -}; }; }; }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/type_reference/offapi.rdb b/offapi/type_reference/offapi.rdb Binary files differindex c117713b5b11..0d73ab1bc233 100644 --- a/offapi/type_reference/offapi.rdb +++ b/offapi/type_reference/offapi.rdb diff --git a/scripting/source/dlgprov/DialogModelProvider.cxx b/scripting/source/dlgprov/DialogModelProvider.cxx index b7b5de3da34e..aee0a9a16ec5 100644 --- a/scripting/source/dlgprov/DialogModelProvider.cxx +++ b/scripting/source/dlgprov/DialogModelProvider.cxx @@ -76,9 +76,12 @@ void SAL_CALL DialogModelProvider::initialize(const css::uno::Sequence< uno::Any if ( xInput.is() ) { xStringResourceManager = dlgprov::lcl_getStringResourceManager(m_xContext,sURL); + Any aDialogSourceURLAny; + aDialogSourceURLAny <<= sURL; Reference< frame::XModel > xModel; - m_xDialogModel = dlgprov::lcl_createDialogModel( m_xContext, xInput , xModel, xStringResourceManager, sURL ); + m_xDialogModel.set( dlgprov::lcl_createDialogModel( m_xContext, xInput , xModel, xStringResourceManager, aDialogSourceURLAny ), UNO_QUERY_THROW); + m_xDialogModelProp.set(m_xDialogModel, UNO_QUERY_THROW); } } catch( Exception& ) @@ -132,14 +135,14 @@ void SAL_CALL DialogModelProvider::removeByName(const OUString & aName) throw (c } uno::Reference< beans::XPropertySetInfo > SAL_CALL DialogModelProvider::getPropertySetInfo( ) throw (uno::RuntimeException) { - return m_xDialogModel->getPropertySetInfo(); + return m_xDialogModelProp->getPropertySetInfo(); } void SAL_CALL DialogModelProvider::setPropertyValue( const OUString&, const uno::Any& ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { } uno::Any SAL_CALL DialogModelProvider::getPropertyValue( const OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { - return m_xDialogModel->getPropertyValue(PropertyName); + return m_xDialogModelProp->getPropertyValue(PropertyName); } void SAL_CALL DialogModelProvider::addPropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { diff --git a/scripting/source/dlgprov/DialogModelProvider.hxx b/scripting/source/dlgprov/DialogModelProvider.hxx index b104614948c5..4d9256a35f14 100644 --- a/scripting/source/dlgprov/DialogModelProvider.hxx +++ b/scripting/source/dlgprov/DialogModelProvider.hxx @@ -23,8 +23,6 @@ #include "com/sun/star/container/XNameContainer.hpp" #include "com/sun/star/lang/XServiceInfo.hpp" #include "com/sun/star/beans/XPropertySet.hpp" -#include "com/sun/star/awt/XUnoControlDialogModel.hpp" - /// anonymous implementation namespace namespace dlgprov{ @@ -77,8 +75,9 @@ private: // destructor is private and will be called indirectly by the release call virtual ~DialogModelProvider() {} - css::uno::Reference< css::uno::XComponentContext > m_xContext; - css::uno::Reference< css::awt::XUnoControlDialogModel> m_xDialogModel; + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::container::XNameContainer> m_xDialogModel; + css::uno::Reference< css::beans::XPropertySet> m_xDialogModelProp; }; } // closing anonymous implementation namespace diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx index 2d96b9d2ff74..86c792774156 100644 --- a/scripting/source/dlgprov/dlgprov.cxx +++ b/scripting/source/dlgprov/dlgprov.cxx @@ -21,8 +21,6 @@ #include "DialogModelProvider.hxx" #include "dlgprov.hxx" #include "dlgevtatt.hxx" -#include <com/sun/star/awt/UnoControlDialog.hpp> -#include <com/sun/star/awt/UnoControlDialogModel.hpp> #include <com/sun/star/awt/Toolkit.hpp> #include <com/sun/star/awt/XControlContainer.hpp> #include <com/sun/star/awt/XWindowPeer.hpp> @@ -122,20 +120,23 @@ static OUString aResourceResolverPropName("ResourceResolver"); } return xStringResourceManager; } - static Reference< XUnoControlDialogModel > lcl_createControlModel(const Reference< XComponentContext >& i_xContext) + Reference< container::XNameContainer > lcl_createControlModel(const Reference< XComponentContext >& i_xContext) { - Reference< XUnoControlDialogModel > xControlModel = UnoControlDialogModel::create( i_xContext ); + Reference< XMultiComponentFactory > xSMgr_( i_xContext->getServiceManager(), UNO_QUERY_THROW ); + Reference< container::XNameContainer > xControlModel( xSMgr_->createInstanceWithContext( OUString( "com.sun.star.awt.UnoControlDialogModel" ), i_xContext ), UNO_QUERY_THROW ); return xControlModel; } - Reference< XUnoControlDialogModel > lcl_createDialogModel( const Reference< XComponentContext >& i_xContext, + Reference< container::XNameContainer > lcl_createDialogModel( const Reference< XComponentContext >& i_xContext, const Reference< io::XInputStream >& xInput, const Reference< frame::XModel >& xModel, const Reference< resource::XStringResourceManager >& xStringResourceManager, - const OUString& aDialogSourceURL) throw ( Exception ) + const Any &aDialogSourceURL) throw ( Exception ) { - Reference< XUnoControlDialogModel > xDialogModel( lcl_createControlModel(i_xContext) ); + Reference< container::XNameContainer > xDialogModel( lcl_createControlModel(i_xContext) ); - xDialogModel->setDialogSourceURL( aDialogSourceURL ); + OUString aDlgSrcUrlPropName( "DialogSourceURL" ); + Reference< beans::XPropertySet > xDlgPropSet( xDialogModel, UNO_QUERY ); + xDlgPropSet->setPropertyValue( aDlgSrcUrlPropName, aDialogSourceURL ); // #TODO we really need to detect the source of the Dialog, is it // the dialog. E.g. if the dialog was created from basic ( then we just @@ -254,15 +255,15 @@ static OUString aResourceResolverPropName("ResourceResolver"); return xStringResourceManager; } - Reference< XUnoControlDialogModel > DialogProviderImpl::createDialogModel( + Reference< container::XNameContainer > DialogProviderImpl::createDialogModel( const Reference< io::XInputStream >& xInput, const Reference< resource::XStringResourceManager >& xStringResourceManager, - const OUString &aDialogSourceURL) throw ( Exception ) + const Any &aDialogSourceURL) throw ( Exception ) { return lcl_createDialogModel(m_xContext,xInput,m_xModel,xStringResourceManager,aDialogSourceURL); } - Reference< XUnoControlDialogModel > DialogProviderImpl::createDialogModelForBasic() throw ( Exception ) + Reference< XControlModel > DialogProviderImpl::createDialogModelForBasic() throw ( Exception ) { if ( !m_BasicInfo.get() ) // shouln't get here @@ -270,10 +271,13 @@ static OUString aResourceResolverPropName("ResourceResolver"); Reference< resource::XStringResourceManager > xStringResourceManager = getStringResourceFromDialogLibrary( m_BasicInfo->mxDlgLib ); OUString aURL("" ); - return createDialogModel( m_BasicInfo->mxInput, xStringResourceManager, aURL ); + Any aDialogSourceURL; + aDialogSourceURL <<= aURL; + Reference< XControlModel > xCtrlModel( createDialogModel( m_BasicInfo->mxInput, xStringResourceManager, aDialogSourceURL ), UNO_QUERY_THROW ); + return xCtrlModel; } - Reference< XUnoControlDialogModel > DialogProviderImpl::createDialogModel( const OUString& sURL ) + Reference< XControlModel > DialogProviderImpl::createDialogModel( const OUString& sURL ) { OUString aURL( sURL ); @@ -443,7 +447,7 @@ static OUString aResourceResolverPropName("ResourceResolver"); } // import dialog model - Reference< XUnoControlDialogModel > xCtrlModel; + Reference< XControlModel > xCtrlModel; if ( xInput.is() && m_xContext.is() ) { Reference< resource::XStringResourceManager > xStringResourceManager; @@ -456,51 +460,67 @@ static OUString aResourceResolverPropName("ResourceResolver"); xStringResourceManager = getStringResourceFromDialogLibrary( xDialogLib ); } - xCtrlModel = createDialogModel( xInput , xStringResourceManager, aURL ); + Any aDialogSourceURLAny; + aDialogSourceURLAny <<= aURL; + + Reference< container::XNameContainer > xDialogModel( createDialogModel( xInput , xStringResourceManager, aDialogSourceURLAny ), UNO_QUERY_THROW); + + xCtrlModel = Reference< XControlModel >( xDialogModel, UNO_QUERY ); } return xCtrlModel; } // ----------------------------------------------------------------------------- - Reference< XUnoControlDialog > DialogProviderImpl::createDialogControl + Reference< XControl > DialogProviderImpl::createDialogControl ( const Reference< XControlModel >& rxDialogModel, const Reference< XWindowPeer >& xParent ) { OSL_ENSURE( rxDialogModel.is(), "DialogProviderImpl::getDialogControl: no dialog model" ); - Reference< XUnoControlDialog > xDialogControl; + Reference< XControl > xDialogControl; if ( m_xContext.is() ) { - xDialogControl = UnoControlDialog::create( m_xContext ); - - // set the model - if ( rxDialogModel.is() ) - xDialogControl->setModel( rxDialogModel ); + Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() ); - // set visible - xDialogControl->setVisible( sal_False ); - - // get the parent of the dialog control - Reference< XWindowPeer > xPeer; - if( xParent.is() ) - { - xPeer = xParent; - } - else if ( m_xModel.is() ) + if ( xSMgr.is() ) { - Reference< frame::XController > xController( m_xModel->getCurrentController(), UNO_QUERY ); - if ( xController.is() ) + xDialogControl = Reference< XControl >( xSMgr->createInstanceWithContext( + OUString( "com.sun.star.awt.UnoControlDialog" ), m_xContext ), UNO_QUERY ); + + if ( xDialogControl.is() ) { - Reference< frame::XFrame > xFrame( xController->getFrame(), UNO_QUERY ); - if ( xFrame.is() ) - xPeer = Reference< XWindowPeer>( xFrame->getContainerWindow(), UNO_QUERY ); + // set the model + if ( rxDialogModel.is() ) + xDialogControl->setModel( rxDialogModel ); + + // set visible + Reference< XWindow > xW( xDialogControl, UNO_QUERY ); + if ( xW.is() ) + xW->setVisible( sal_False ); + + // get the parent of the dialog control + Reference< XWindowPeer > xPeer; + if( xParent.is() ) + { + xPeer = xParent; + } + else if ( m_xModel.is() ) + { + Reference< frame::XController > xController( m_xModel->getCurrentController(), UNO_QUERY ); + if ( xController.is() ) + { + Reference< frame::XFrame > xFrame( xController->getFrame(), UNO_QUERY ); + if ( xFrame.is() ) + xPeer = Reference< XWindowPeer>( xFrame->getContainerWindow(), UNO_QUERY ); + } + } + + // create a peer + Reference< XToolkit> xToolkit( Toolkit::create( m_xContext ), UNO_QUERY_THROW ); + xDialogControl->createPeer( xToolkit, xPeer ); } } - - // create a peer - Reference< XToolkit> xToolkit( Toolkit::create( m_xContext ), UNO_QUERY_THROW ); - xDialogControl->createPeer( xToolkit, xPeer ); } return xDialogControl; diff --git a/scripting/source/dlgprov/dlgprov.hxx b/scripting/source/dlgprov/dlgprov.hxx index 515f25a4d3bd..651edfa32cb0 100644 --- a/scripting/source/dlgprov/dlgprov.hxx +++ b/scripting/source/dlgprov/dlgprov.hxx @@ -21,20 +21,18 @@ #define SCRIPTING_DLGPROV_HXX #include <com/sun/star/awt/XControl.hpp> -#include <com/sun/star/awt/XContainerWindowProvider.hpp> #include <com/sun/star/awt/XDialog.hpp> #include <com/sun/star/awt/XDialogProvider2.hpp> -#include <com/sun/star/awt/XUnoControlDialog.hpp> -#include <com/sun/star/awt/XUnoControlDialogModel.hpp> -#include <com/sun/star/beans/XIntrospectionAccess.hpp> -#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/awt/XContainerWindowProvider.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/io/XInputStream.hpp> -#include <com/sun/star/resource/XStringResourceManager.hpp> #include <com/sun/star/script/XScriptEventsAttacher.hpp> #include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/beans/XIntrospectionAccess.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/resource/XStringResourceManager.hpp> #include <cppuhelper/implbase4.hxx> #include <osl/mutex.hxx> @@ -55,14 +53,14 @@ namespace dlgprov // ============================================================================= // class DialogProviderImpl // ============================================================================= - ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager > lcl_getStringResourceManager(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_xContext,const OUString& i_sURL);; - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XUnoControlDialogModel > lcl_createDialogModel( + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > lcl_createControlModel(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_xContext); + ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager > lcl_getStringResourceManager(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_xContext,const OUString& i_sURL); + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > lcl_createDialogModel( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_xContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInput, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel, const ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager >& xStringResourceManager, - const OUString& aDialogSourceURL) throw ( ::com::sun::star::uno::Exception ); + const ::com::sun::star::uno::Any &aDialogSourceURL) throw ( ::com::sun::star::uno::Exception ); typedef ::cppu::WeakImplHelper4< ::com::sun::star::lang::XServiceInfo, @@ -82,11 +80,11 @@ namespace dlgprov std::auto_ptr< BasicRTLParams > m_BasicInfo; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel; - OUString msDialogLibName; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XUnoControlDialogModel > createDialogModel( const OUString& sURL ); + OUString msDialogLibName; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > createDialogModel( const OUString& sURL ); - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XUnoControlDialog > createDialogControl( + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > createDialogControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxDialogModel, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent ); @@ -97,11 +95,11 @@ namespace dlgprov ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess > inspectHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxHandler ); // helper methods - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XUnoControlDialogModel > createDialogModel( + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createDialogModel( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInput, const ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager >& xStringResourceManager, - const OUString &aDialogSourceURL) throw ( ::com::sun::star::uno::Exception ); - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XUnoControlDialogModel > createDialogModelForBasic() throw ( ::com::sun::star::uno::Exception ); + const ::com::sun::star::uno::Any &aDialogSourceURL) throw ( ::com::sun::star::uno::Exception ); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > createDialogModelForBasic() throw ( ::com::sun::star::uno::Exception ); // XDialogProvider / XDialogProvider2 impl method virtual ::com::sun::star::uno::Reference < ::com::sun::star::awt::XControl > SAL_CALL createDialogImpl( diff --git a/sdext/source/minimizer/informationdialog.cxx b/sdext/source/minimizer/informationdialog.cxx index 5c51ae28392b..babba10cfaf1 100644 --- a/sdext/source/minimizer/informationdialog.cxx +++ b/sdext/source/minimizer/informationdialog.cxx @@ -216,13 +216,30 @@ void InformationDialog::InitDialog() nDialogHeight -= 22; // setting the dialog properties - mxDialogModel->setCloseable(sal_True); - mxDialogModel->setHeight(nDialogHeight); - mxDialogModel->setMoveable(sal_True); - mxDialogModel->setPositionX(245); - mxDialogModel->setPositionY(115); - mxDialogModel->setTitle(getString( STR_SUN_OPTIMIZATION_WIZARD2 )); - mxDialogModel->setWidth(sal_Int32( DIALOG_WIDTH ) ); + OUString pNames[] = { + TKGet( TK_Closeable ), + TKGet( TK_Height ), + TKGet( TK_Moveable ), + TKGet( TK_PositionX ), + TKGet( TK_PositionY ), + TKGet( TK_Title ), + TKGet( TK_Width ) }; + + Any pValues[] = { + Any( sal_True ), + Any( nDialogHeight ), + Any( sal_True ), + Any( sal_Int32( 245 ) ), + Any( sal_Int32( 115 ) ), + Any( getString( STR_SUN_OPTIMIZATION_WIZARD2 ) ), + Any( sal_Int32( DIALOG_WIDTH ) ) }; + + sal_Int32 nCount = SAL_N_ELEMENTS( pNames ); + + Sequence< OUString > aNames( pNames, nCount ); + Sequence< Any > aValues( pValues, nCount ); + + mxDialogModelMultiPropertySet->setPropertyValues( aNames, aValues ); sal_Int64 nSource = mnSourceSize; sal_Int64 nDest = mnDestSize; diff --git a/sdext/source/minimizer/optimizerdialog.cxx b/sdext/source/minimizer/optimizerdialog.cxx index 0a3ff9551e44..d6c73488725d 100644 --- a/sdext/source/minimizer/optimizerdialog.cxx +++ b/sdext/source/minimizer/optimizerdialog.cxx @@ -52,13 +52,30 @@ using namespace ::com::sun::star::container; void OptimizerDialog::InitDialog() { // setting the dialog properties - mxDialogModel->setCloseable(sal_True); - mxDialogModel->setHeight(sal_Int32( DIALOG_HEIGHT )); - mxDialogModel->setMoveable(sal_True); - mxDialogModel->setPositionX(200); - mxDialogModel->setPositionY(52); - mxDialogModel->setTitle(getString( STR_SUN_OPTIMIZATION_WIZARD2 )); - mxDialogModel->setWidth(sal_Int32( OD_DIALOG_WIDTH ) ); + OUString pNames[] = { + TKGet( TK_Closeable ), + TKGet( TK_Height ), + TKGet( TK_Moveable ), + TKGet( TK_PositionX ), + TKGet( TK_PositionY ), + TKGet( TK_Title ), + TKGet( TK_Width ) }; + + Any pValues[] = { + Any( sal_True ), + Any( sal_Int32( DIALOG_HEIGHT ) ), + Any( sal_True ), + Any( sal_Int32( 200 ) ), + Any( sal_Int32( 52 ) ), + Any( getString( STR_SUN_OPTIMIZATION_WIZARD2 ) ), + Any( sal_Int32( OD_DIALOG_WIDTH ) ) }; + + sal_Int32 nCount = SAL_N_ELEMENTS( pNames ); + + Sequence< OUString > aNames( pNames, nCount ); + Sequence< Any > aValues( pValues, nCount ); + + mxDialogModelMultiPropertySet->setPropertyValues( aNames, aValues ); } // ----------------------------------------------------------------------------- @@ -93,7 +110,7 @@ void OptimizerDialog::InitRoadmap() Reference< XPropertySet > xPropertySet( mxRoadmapControlModel, UNO_QUERY_THROW ); xPropertySet->setPropertyValue( TKGet( TK_Name ), Any( TKGet( TK_rdmNavi ) ) ); - mxRoadmapControl = mxDialog->getControl( TKGet( TK_rdmNavi ) ); + mxRoadmapControl = mxDialogControlContainer->getControl( TKGet( TK_rdmNavi ) ); InsertRoadmapItem( 0, sal_True, getString( STR_INTRODUCTION ), ITEM_ID_INTRODUCTION ); InsertRoadmapItem( 1, sal_True, getString( STR_SLIDES ), ITEM_ID_SLIDES ); InsertRoadmapItem( 2, sal_True, getString( STR_IMAGE_OPTIMIZATION ), ITEM_ID_GRAPHIC_OPTIMIZATION ); @@ -505,7 +522,7 @@ void ActionListener::actionPerformed( const ActionEvent& rEvent ) if ( nInt16 ) { OUString aSaveAsURL; - FileOpenDialog aFileOpenDialog( ((UnoDialog&)mrOptimizerDialog).mxContext ); + FileOpenDialog aFileOpenDialog( ((UnoDialog&)mrOptimizerDialog).mxMSF ); // generating default file name Reference< XStorable > xStorable( mrOptimizerDialog.mxController->getModel(), UNO_QUERY ); diff --git a/sdext/source/minimizer/unodialog.cxx b/sdext/source/minimizer/unodialog.cxx index 3bf603c474ba..922527e2a88d 100644 --- a/sdext/source/minimizer/unodialog.cxx +++ b/sdext/source/minimizer/unodialog.cxx @@ -19,17 +19,15 @@ #include "unodialog.hxx" -#include <com/sun/star/awt/UnoControlDialog.hpp> -#include <com/sun/star/awt/UnoControlDialogModel.hpp> -#include <com/sun/star/awt/Toolkit.hpp> -#include <com/sun/star/awt/XMessageBoxFactory.hpp> -#include <com/sun/star/awt/MessageBoxButtons.hpp> -#include <com/sun/star/container/XIndexAccess.hpp> -#include <com/sun/star/drawing/XShapes.hpp> -#include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/text/XTextRange.hpp> +#include <com/sun/star/drawing/XShapes.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> #include <com/sun/star/view/XControlAccess.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/awt/Toolkit.hpp> +#include <com/sun/star/awt/XMessageBoxFactory.hpp> +#include <com/sun/star/awt/MessageBoxButtons.hpp> // ------------- // - UnoDialog - @@ -45,14 +43,26 @@ using namespace ::com::sun::star::frame; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::script; -UnoDialog::UnoDialog( const Reference< XComponentContext > &rxContext, Reference< XFrame >& rxFrame ) : - mxContext( rxContext ), +UnoDialog::UnoDialog( const Reference< XComponentContext > &rxMSF, Reference< XFrame >& rxFrame ) : + mxMSF( rxMSF ), mxController( rxFrame->getController() ), - mxDialogModel( UnoControlDialogModel::create(rxContext) ), - mxDialog( UnoControlDialog::create(rxContext) ), + mxDialogModel( mxMSF->getServiceManager()->createInstanceWithContext( OUString( + "com.sun.star.awt.UnoControlDialogModel" ), mxMSF ), UNO_QUERY_THROW ), + mxDialogModelMultiPropertySet( mxDialogModel, UNO_QUERY_THROW ), + mxDialogModelPropertySet( mxDialogModel, UNO_QUERY_THROW ), + mxDialogModelMSF( mxDialogModel, UNO_QUERY_THROW ), + mxDialogModelNameContainer( mxDialogModel, UNO_QUERY_THROW ), + mxDialogModelNameAccess( mxDialogModel, UNO_QUERY_THROW ), + mxControlModel( mxDialogModel, UNO_QUERY_THROW ), + mxDialog( mxMSF->getServiceManager()->createInstanceWithContext( OUString( + "com.sun.star.awt.UnoControlDialog" ), mxMSF ), UNO_QUERY_THROW ), + mxControl( mxDialog, UNO_QUERY_THROW ), mbStatus( sal_False ) { - mxDialog->setModel( mxDialogModel ); + mxControl->setModel( mxControlModel ); + mxDialogControlContainer = Reference< XControlContainer >( mxDialog, UNO_QUERY_THROW ); + mxDialogComponent = Reference< XComponent >( mxDialog, UNO_QUERY_THROW ); + mxDialogWindow = Reference< XWindow >( mxDialog, UNO_QUERY_THROW ); Reference< XFrame > xFrame( mxController->getFrame() ); Reference< XWindow > xContainerWindow( xFrame->getContainerWindow() ); @@ -71,8 +81,8 @@ UnoDialog::~UnoDialog() void UnoDialog::execute() { - mxDialog->setEnable( sal_True ); - mxDialog->setVisible( sal_True ); + mxDialogWindow->setEnable( sal_True ); + mxDialogWindow->setVisible( sal_True ); mxDialog->execute(); } @@ -87,14 +97,14 @@ void UnoDialog::endExecute( sal_Bool bStatus ) Reference< XWindowPeer > UnoDialog::createWindowPeer( Reference< XWindowPeer > xParentPeer ) throw ( Exception ) { - mxDialog->setVisible( sal_False ); - Reference< XToolkit > xToolkit( Toolkit::create( mxContext ), UNO_QUERY_THROW ); + mxDialogWindow->setVisible( sal_False ); + Reference< XToolkit > xToolkit( Toolkit::create( mxMSF ), UNO_QUERY_THROW ); if ( !xParentPeer.is() ) xParentPeer = xToolkit->getDesktopWindow(); mxReschedule = Reference< XReschedule >( xToolkit, UNO_QUERY ); - mxDialog->createPeer( xToolkit, xParentPeer ); + mxControl->createPeer( xToolkit, xParentPeer ); // xWindowPeer = xControl.getPeer(); - return mxDialog->getPeer(); + return mxControl->getPeer(); } // ----------------------------------------------------------------------------- @@ -105,10 +115,10 @@ Reference< XInterface > UnoDialog::insertControlModel( const OUString& rServiceN Reference< XInterface > xControlModel; try { - xControlModel = mxDialogModel->createInstance( rServiceName ); + xControlModel = mxDialogModelMSF->createInstance( rServiceName ); Reference< XMultiPropertySet > xMultiPropSet( xControlModel, UNO_QUERY_THROW ); xMultiPropSet->setPropertyValues( rPropertyNames, rPropertyValues ); - mxDialogModel->insertByName( rName, Any( xControlModel ) ); + mxDialogModelNameContainer->insertByName( rName, Any( xControlModel ) ); } catch( Exception& ) { @@ -122,7 +132,7 @@ void UnoDialog::setVisible( const OUString& rName, sal_Bool bVisible ) { try { - Reference< XInterface > xControl( mxDialog->getControl( rName ), UNO_QUERY_THROW ); + Reference< XInterface > xControl( mxDialogControlContainer->getControl( rName ), UNO_QUERY_THROW ); Reference< XWindow > xWindow( xControl, UNO_QUERY_THROW ); xWindow->setVisible( bVisible ); } @@ -143,7 +153,7 @@ Reference< XButton > UnoDialog::insertButton( const OUString& rName, Reference< rName, rPropertyNames, rPropertyValues ) ); Reference< XPropertySet > xPropertySet( xButtonModel, UNO_QUERY_THROW ); xPropertySet->setPropertyValue( OUString( "Name" ), Any( rName ) ); - xButton = Reference< XButton >( mxDialog->getControl( rName ), UNO_QUERY_THROW ); + xButton = Reference< XButton >( mxDialogControlContainer->getControl( rName ), UNO_QUERY_THROW ); if ( xActionListener.is() ) { @@ -168,7 +178,7 @@ Reference< XFixedText > UnoDialog::insertFixedText( const OUString& rName, const Reference< XPropertySet > xPropertySet( insertControlModel( OUString( "com.sun.star.awt.UnoControlFixedTextModel" ), rName, rPropertyNames, rPropertyValues ), UNO_QUERY_THROW ); xPropertySet->setPropertyValue( OUString( "Name" ), Any( rName ) ); - xFixedText = Reference< XFixedText >( mxDialog->getControl( rName ), UNO_QUERY_THROW ); + xFixedText = Reference< XFixedText >( mxDialogControlContainer->getControl( rName ), UNO_QUERY_THROW ); } catch ( Exception& ) { @@ -186,7 +196,7 @@ Reference< XCheckBox > UnoDialog::insertCheckBox( const OUString& rName, const S Reference< XPropertySet > xPropertySet( insertControlModel( OUString( "com.sun.star.awt.UnoControlCheckBoxModel" ), rName, rPropertyNames, rPropertyValues ), UNO_QUERY_THROW ); xPropertySet->setPropertyValue( OUString( "Name" ), Any( rName ) ); - xCheckBox = Reference< XCheckBox >( mxDialog->getControl( rName ), UNO_QUERY_THROW ); + xCheckBox = Reference< XCheckBox >( mxDialogControlContainer->getControl( rName ), UNO_QUERY_THROW ); } catch ( Exception& ) { @@ -204,7 +214,7 @@ Reference< XControl > UnoDialog::insertFormattedField( const OUString& rName, co Reference< XPropertySet > xPropertySet( insertControlModel( OUString( "com.sun.star.awt.UnoControlFormattedFieldModel" ), rName, rPropertyNames, rPropertyValues ), UNO_QUERY_THROW ); xPropertySet->setPropertyValue( OUString( "Name" ), Any( rName ) ); - xControl = Reference< XControl >( mxDialog->getControl( rName ), UNO_QUERY_THROW ); + xControl = Reference< XControl >( mxDialogControlContainer->getControl( rName ), UNO_QUERY_THROW ); } catch ( Exception& ) { @@ -222,7 +232,7 @@ Reference< XComboBox > UnoDialog::insertComboBox( const OUString& rName, const S Reference< XPropertySet > xPropertySet( insertControlModel( OUString( "com.sun.star.awt.UnoControlComboBoxModel" ), rName, rPropertyNames, rPropertyValues ), UNO_QUERY_THROW ); xPropertySet->setPropertyValue( OUString( "Name" ), Any( rName ) ); - xControl = Reference< XComboBox >( mxDialog->getControl( rName ), UNO_QUERY_THROW ); + xControl = Reference< XComboBox >( mxDialogControlContainer->getControl( rName ), UNO_QUERY_THROW ); } catch ( Exception& ) { @@ -240,7 +250,7 @@ Reference< XRadioButton > UnoDialog::insertRadioButton( const OUString& rName, c Reference< XPropertySet > xPropertySet( insertControlModel( OUString( "com.sun.star.awt.UnoControlRadioButtonModel" ), rName, rPropertyNames, rPropertyValues ), UNO_QUERY_THROW ); xPropertySet->setPropertyValue( OUString( "Name" ), Any( rName ) ); - xControl = Reference< XRadioButton >( mxDialog->getControl( rName ), UNO_QUERY_THROW ); + xControl = Reference< XRadioButton >( mxDialogControlContainer->getControl( rName ), UNO_QUERY_THROW ); } catch ( Exception& ) { @@ -258,7 +268,7 @@ Reference< XListBox > UnoDialog::insertListBox( const OUString& rName, const Seq Reference< XPropertySet > xPropertySet( insertControlModel( OUString( "com.sun.star.awt.UnoControlListBoxModel" ), rName, rPropertyNames, rPropertyValues ), UNO_QUERY_THROW ); xPropertySet->setPropertyValue( OUString( "Name" ), Any( rName ) ); - xControl = Reference< XListBox >( mxDialog->getControl( rName ), UNO_QUERY_THROW ); + xControl = Reference< XListBox >( mxDialogControlContainer->getControl( rName ), UNO_QUERY_THROW ); } catch ( Exception& ) { @@ -276,7 +286,7 @@ Reference< XControl > UnoDialog::insertImage( const OUString& rName, const Seque Reference< XPropertySet > xPropertySet( insertControlModel( OUString( "com.sun.star.awt.UnoControlImageControlModel" ), rName, rPropertyNames, rPropertyValues ), UNO_QUERY_THROW ); xPropertySet->setPropertyValue( OUString( "Name" ), Any( rName ) ); - xControl = Reference< XControl >( mxDialog->getControl( rName ), UNO_QUERY_THROW ); + xControl = Reference< XControl >( mxDialogControlContainer->getControl( rName ), UNO_QUERY_THROW ); } catch ( Exception& ) { @@ -290,9 +300,9 @@ void UnoDialog::setControlProperty( const OUString& rControlName, const OUString { try { - if ( mxDialogModel->hasByName( rControlName ) ) + if ( mxDialogModelNameAccess->hasByName( rControlName ) ) { - Reference< XPropertySet > xPropertySet( mxDialogModel->getByName( rControlName ), UNO_QUERY_THROW ); + Reference< XPropertySet > xPropertySet( mxDialogModelNameAccess->getByName( rControlName ), UNO_QUERY_THROW ); xPropertySet->setPropertyValue( rPropertyName, rPropertyValue ); } } @@ -308,9 +318,9 @@ Any UnoDialog::getControlProperty( const OUString& rControlName, const OUString& Any aRet; try { - if ( mxDialogModel->hasByName( rControlName ) ) + if ( mxDialogModelNameAccess->hasByName( rControlName ) ) { - Reference< XPropertySet > xPropertySet( mxDialogModel->getByName( rControlName ), UNO_QUERY_THROW ); + Reference< XPropertySet > xPropertySet( mxDialogModelNameAccess->getByName( rControlName ), UNO_QUERY_THROW ); aRet = xPropertySet->getPropertyValue( rPropertyName ); } } diff --git a/sdext/source/minimizer/unodialog.hxx b/sdext/source/minimizer/unodialog.hxx index 032fe6cf47af..b08ce1e5d8fe 100644 --- a/sdext/source/minimizer/unodialog.hxx +++ b/sdext/source/minimizer/unodialog.hxx @@ -39,12 +39,10 @@ #include <com/sun/star/awt/XButton.hpp> #include <com/sun/star/awt/XCheckBox.hpp> #include <com/sun/star/awt/XComboBox.hpp> -#include <com/sun/star/awt/XUnoControlDialogModel.hpp> #include <com/sun/star/awt/XTextComponent.hpp> #include <com/sun/star/awt/XRadioButton.hpp> #include <com/sun/star/awt/XListBox.hpp> #include <com/sun/star/awt/XFixedText.hpp> -#include <com/sun/star/awt/XUnoControlDialog.hpp> #include <com/sun/star/awt/XControlContainer.hpp> #include <com/sun/star/awt/XReschedule.hpp> #include <com/sun/star/awt/XDialog.hpp> @@ -108,15 +106,27 @@ public : void enableControl( const OUString& rControlName ); void disableControl( const OUString& rControlName ); - com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext; + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxMSF; com::sun::star::uno::Reference< com::sun::star::frame::XController > mxController; com::sun::star::uno::Reference< com::sun::star::awt::XReschedule > mxReschedule; - com::sun::star::uno::Reference< com::sun::star::awt::XUnoControlDialogModel > mxDialogModel; + com::sun::star::uno::Reference< com::sun::star::uno::XInterface > mxDialogModel; + com::sun::star::uno::Reference< com::sun::star::beans::XMultiPropertySet > mxDialogModelMultiPropertySet; + com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > mxDialogModelPropertySet; + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxDialogModelMSF; + com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > mxDialogModelNameContainer; + com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > mxDialogModelNameAccess; - com::sun::star::uno::Reference< com::sun::star::awt::XUnoControlDialog > mxDialog; + com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > mxControlModel; + + com::sun::star::uno::Reference< com::sun::star::awt::XDialog > mxDialog; + com::sun::star::uno::Reference< com::sun::star::awt::XControl > mxControl; com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer > mxWindowPeer; + com::sun::star::uno::Reference< com::sun::star::awt::XControlContainer > mxDialogControlContainer; + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > mxDialogComponent; + com::sun::star::uno::Reference< com::sun::star::awt::XWindow > mxDialogWindow; + sal_Bool mbStatus; }; diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index 6042203dc30f..096d07c0d848 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -146,7 +146,7 @@ OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::c // class UnoControlDialogModel // ---------------------------------------------------- UnoControlDialogModel::UnoControlDialogModel( const Reference< XComponentContext >& rxContext ) - :UnoControlDialogModel_Base( rxContext ) + :ControlModelContainerBase( rxContext ) { ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); // ImplRegisterProperty( BASEPROPERTY_BORDER ); @@ -180,7 +180,7 @@ UnoControlDialogModel::UnoControlDialogModel( const Reference< XComponentContext } UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel ) - : UnoControlDialogModel_Base( rModel ) + : ControlModelContainerBase( rModel ) { // need to clone BASEPROPERTY_USERFORMCONTAINEES too Reference< XNameContainer > xSrcNameCont( const_cast< UnoControlDialogModel& >(rModel).getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ) ), UNO_QUERY ); @@ -274,56 +274,6 @@ void SAL_CALL UnoControlDialogModel::setFastPropertyValue_NoBroadcast( sal_Int32 OSL_ENSURE( sal_False, "UnoControlDialogModel::setFastPropertyValue_NoBroadcast: caught an exception while setting ImageURL properties!" ); } } - -OUString UnoControlDialogModel::getPropertyString(const OUString& aPropertyName) throw (css::uno::RuntimeException) -{ - uno::Any any = getPropertyValue(aPropertyName); - OUString b; - any >>= b; - return b; -} - -sal_Bool UnoControlDialogModel::getPropertyBool(const OUString& aPropertyName) throw (css::uno::RuntimeException) -{ - uno::Any any = getPropertyValue(aPropertyName); - sal_Bool b = sal_False; - any >>= b; - return b; -} - -sal_Int16 UnoControlDialogModel::getPropertyInt16(const OUString& aPropertyName) throw (css::uno::RuntimeException) -{ - uno::Any any = getPropertyValue(aPropertyName); - sal_Int16 b = 0; - any >>= b; - return b; -} - -sal_Int32 UnoControlDialogModel::getPropertyInt32(const OUString& aPropertyName) throw (css::uno::RuntimeException) -{ - uno::Any any = getPropertyValue(aPropertyName); - sal_Int32 b = 0; - any >>= b; - return b; -} - -css::awt::FontDescriptor UnoControlDialogModel::getFontDescriptor() throw(css::uno::RuntimeException) -{ - uno::Any any = getPropertyValue("FontDescriptor"); - awt::FontDescriptor b; - any >>= b; - return b; -} - -Reference<css::graphic::XGraphic> SAL_CALL UnoControlDialogModel::getGraphic() throw(::com::sun::star::uno::RuntimeException) -{ - uno::Any any = getPropertyValue("Graphic"); - Reference<css::graphic::XGraphic> b; - any >>= b; - return b; -} - - // ============================================================================ // = class UnoDialogControl // ============================================================================ diff --git a/xmlscript/test/imexp.cxx b/xmlscript/test/imexp.cxx index c75cb8104ec7..de88975f1191 100644 --- a/xmlscript/test/imexp.cxx +++ b/xmlscript/test/imexp.cxx @@ -35,21 +35,23 @@ #include <vcl/svapp.hxx> #include <com/sun/star/awt/Toolkit.hpp> -#include <com/sun/star/awt/UnoControlDialog.hpp> -#include <com/sun/star/awt/UnoControlDialogModel.hpp> -#include <com/sun/star/awt/XToolkit.hpp> -#include <com/sun/star/awt/XControlModel.hpp> -#include <com/sun/star/awt/XControl.hpp> -#include <com/sun/star/awt/XDialog.hpp> -#include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> + #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> + #include <com/sun/star/registry/XSimpleRegistry.hpp> #include <com/sun/star/registry/XImplementationRegistration.hpp> #include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/awt/XToolkit.hpp> +#include <com/sun/star/awt/XControlModel.hpp> +#include <com/sun/star/awt/XControl.hpp> +#include <com/sun/star/awt/XDialog.hpp> + +#include <com/sun/star/container/XNameContainer.hpp> + using namespace ::rtl; using namespace ::cppu; @@ -88,7 +90,7 @@ Reference< XComponentContext > createInitialComponentContext( // ----------------------------------------------------------------------- -Reference< awt::XUnoControlDialogModel > importFile( +Reference< container::XNameContainer > importFile( char const * fname, Reference< XComponentContext > const & xContext ) { @@ -104,7 +106,8 @@ Reference< awt::XUnoControlDialogModel > importFile( ::fread( bytes.getArray(), nLength, 1, f ); ::fclose( f ); - Reference< awt::XUnoControlDialogModel > xModel = awt::UnoControlDialogModel::create( xContext ); + Reference< container::XNameContainer > xModel( xContext->getServiceManager()->createInstanceWithContext( + "com.sun.star.awt.UnoControlDialogModel", xContext ), UNO_QUERY ); ::xmlscript::importDialogModel( ::xmlscript::createInputStream( bytes ), xModel, xContext ); return xModel; @@ -183,10 +186,11 @@ void MyApp::Main() importFile( aParam1.getStr(), xContext ) ); OSL_ASSERT( xModel.is() ); - Reference< awt::XUnoControlDialog > xDlg = UnoControlDialog::create( xContext );; - xDlg->setModel( xModel ); + Reference< awt::XControl > xDlg( xMSF->createInstance( "com.sun.star.awt.UnoControlDialog" ), UNO_QUERY ); + xDlg->setModel( Reference< awt::XControlModel >::query( xModel ) ); xDlg->createPeer( xToolkit, 0 ); - xDlg->execute(); + Reference< awt::XDialog > xD( xDlg, UNO_QUERY ); + xD->execute(); if (GetCommandLineParamCount() == 3) { |