diff options
author | Noel Grandin <noel@peralex.com> | 2013-05-16 14:13:36 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-05-21 08:23:58 +0200 |
commit | 6c61b20a8d4a6dcac28801cde82a211fb7e30654 (patch) | |
tree | d82328eaa120b8bc822f028fa1e62bc7814c9e1b | |
parent | 6c53dff36ebdac7b6a6cf514ab469b2202d6aa48 (diff) |
fdo#46808, Convert awt::UnoControlDialogModel to new style
Change-Id: I4b912034ef3f4855b87d6d6f18ff13bd1ecc8f72
28 files changed, 627 insertions, 519 deletions
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index 2643400dcc01..a6b87743f4f0 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -35,6 +35,7 @@ #include "objdlg.hxx" #include <basic/basmgr.hxx> +#include <com/sun/star/awt/UnoControlDialogModel.hpp> #include <com/sun/star/resource/StringResourceWithLocation.hpp> #include <com/sun/star/ucb/SimpleFileAccess.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> @@ -944,8 +945,7 @@ bool implImportDialog( Window* pWin, const OUString& rCurPath, const ScriptDocum { bool bDone = false; - Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); - Reference< XComponentContext > xContext( comphelper::getComponentContext( xMSF ) ); + Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); Reference < XFilePicker3 > xFP = FilePicker::createWithMode(xContext, TemplateDescription::FILEOPEN_SIMPLE); Reference< XFilePickerControlAccess > xFPControl(xFP, UNO_QUERY); @@ -977,10 +977,9 @@ bool implImportDialog( Window* pWin, const OUString& rCurPath, const ScriptDocum try { // create dialog model - Reference< container::XNameContainer > xDialogModel( xMSF->createInstance - ( "com.sun.star.awt.UnoControlDialogModel" ), UNO_QUERY_THROW ); + Reference< awt::XUnoControlDialogModel > xDialogModel = awt::UnoControlDialogModel::create( xContext ); - Reference< XSimpleFileAccess3 > xSFI( SimpleFileAccess::create(comphelper::getProcessComponentContext()) ); + Reference< XSimpleFileAccess3 > xSFI( SimpleFileAccess::create(xContext) ); Reference< XInputStream > xInput; if( xSFI->exists( aCurPath ) ) @@ -988,20 +987,7 @@ bool implImportDialog( Window* pWin, const OUString& rCurPath, const ScriptDocum ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() ); - OUString aXmlDlgName; - Reference< beans::XPropertySet > xDialogModelPropSet( xDialogModel, UNO_QUERY ); - if( xDialogModelPropSet.is() ) - { - try - { - Any aXmlDialogNameAny = xDialogModelPropSet->getPropertyValue( DLGED_PROP_NAME ); - OUString aOUXmlDialogName; - aXmlDialogNameAny >>= aOUXmlDialogName; - aXmlDlgName = aOUXmlDialogName; - } - catch(const beans::UnknownPropertyException& ) - {} - } + OUString aXmlDlgName = xDialogModel->getName(); bool bValidName = !aXmlDlgName.isEmpty(); OSL_ASSERT( bValidName ); if( !bValidName ) @@ -1186,30 +1172,8 @@ bool implImportDialog( Window* pWin, const OUString& rCurPath, const ScriptDocum if( eNameClashMode == CLASH_RENAME_DIALOG ) { - bool bRenamed = false; - if( xDialogModelPropSet.is() ) - { - try - { - Any aXmlDialogNameAny; - aXmlDialogNameAny <<= OUString( aNewDlgName ); - xDialogModelPropSet->setPropertyValue( DLGED_PROP_NAME, aXmlDialogNameAny ); - bRenamed = true; - } - catch(const beans::UnknownPropertyException& ) - {} - } - - - if( bRenamed ) - { - LocalizationMgr::renameStringResourceIDs( rDocument, aLibName, aNewDlgName, xDialogModel ); - } - else - { - // TODO: Assertion? - return bDone; - } + xDialogModel->setName( aNewDlgName ); + LocalizationMgr::renameStringResourceIDs( rDocument, aLibName, aNewDlgName, xDialogModel ); } Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() ); diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx index 8d0b70dbb251..271282e5f445 100644 --- a/basctl/source/basicide/basides3.cxx +++ b/basctl/source/basicide/basides3.cxx @@ -26,8 +26,9 @@ #include <localizationmgr.hxx> #include <dlgedview.hxx> #include <comphelper/processfactory.hxx> -#include <com/sun/star/script/XLibraryContainer.hpp> +#include <com/sun/star/awt/UnoControlDialogModel.hpp> #include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/script/XLibraryContainer.hpp> #include <xmlscript/xmldlg_imexp.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/docfac.hxx> @@ -75,12 +76,9 @@ DialogWindow* Shell::CreateDlgWin( const ScriptDocument& rDocument, const OUStri if ( xISP.is() ) { // create dialog model - Reference< lang::XMultiServiceFactory > xMSF = getProcessServiceFactory(); - Reference< container::XNameContainer > xDialogModel( xMSF->createInstance - ( "com.sun.star.awt.UnoControlDialogModel" ), UNO_QUERY ); + Reference< uno::XComponentContext > xContext = getProcessComponentContext(); + Reference< awt::XUnoControlDialogModel > xDialogModel = awt::UnoControlDialogModel::create( xContext ); 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 49c58a31af09..84a25a9910b8 100644 --- a/basctl/source/basicide/moduldlg.cxx +++ b/basctl/source/basicide/moduldlg.cxx @@ -28,6 +28,7 @@ #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> @@ -284,31 +285,25 @@ void Shell::CopyDialogResources( return; // create dialog model - Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - Reference< container::XNameContainer > xDialogModel = Reference< container::XNameContainer >( xMSF->createInstance - ( "com.sun.star.awt.UnoControlDialogModel" ), UNO_QUERY ); + Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + Reference< awt::XUnoControlDialogModel > xDialogModel = awt::UnoControlDialogModel::create( xContext ); 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( xDialogModel.is() ) + if( bSourceLocalized && bDestLocalized ) { - 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 >() ); + 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 >() ); } diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx index 3224c7129a80..bccb4c4bcbb2 100644 --- a/basctl/source/basicide/scriptdocument.cxx +++ b/basctl/source/basicide/scriptdocument.cxx @@ -25,17 +25,18 @@ #include "doceventnotifier.hxx" #include "documentenumeration.hxx" -#include <com/sun/star/uri/UriReferenceFactory.hpp> -#include <com/sun/star/util/theMacroExpander.hpp> +#include <com/sun/star/awt/XWindow2.hpp> +#include <com/sun/star/awt/UnoControlDialogModel.hpp> #include <com/sun/star/document/MacroExecMode.hpp> -#include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/document/XEmbeddedScripts.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/awt/XWindow2.hpp> -#include <com/sun/star/document/XEmbeddedScripts.hpp> +#include <com/sun/star/frame/XStorable.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> @@ -629,12 +630,7 @@ namespace basctl if ( _rxExistingDialogModel.is() ) xDialogModel = _rxExistingDialogModel; else - xDialogModel.set( - ( aContext->getServiceManager()-> - createInstanceWithContext( - "com.sun.star.awt.UnoControlDialogModel", - aContext ) ), - UNO_QUERY_THROW ); + xDialogModel = css::awt::UnoControlDialogModel::create( aContext ); // import dialog model Reference< XInputStreamProvider > xISP( aElement, UNO_QUERY_THROW ); @@ -753,14 +749,10 @@ namespace basctl // create new dialog model Reference< XComponentContext > aContext( comphelper::getProcessComponentContext() ); - Reference< XNameContainer > xDialogModel( - aContext->getServiceManager()->createInstanceWithContext( - "com.sun.star.awt.UnoControlDialogModel", aContext ), - UNO_QUERY_THROW ); + Reference< css::awt::XUnoControlDialogModel > xDialogModel = css::awt::UnoControlDialogModel::create( aContext ); // set name property - Reference< XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY_THROW ); - xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rDialogName ) ); + xDialogModel->setName( _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 935dcfd5b0b4..c4683f91d44f 100644 --- a/basctl/source/dlged/dlged.cxx +++ b/basctl/source/dlged/dlged.cxx @@ -33,6 +33,7 @@ #include "baside3.hxx" #include <com/sun/star/awt/XDialog.hpp> +#include <com/sun/star/awt/UnoControlDialogModel.hpp> #include <com/sun/star/resource/StringResource.hpp> #include <com/sun/star/util/XCloneable.hpp> #include <com/sun/star/util/NumberFormatsSupplier.hpp> @@ -872,9 +873,9 @@ void DlgEditor::Paste() if ( xTransf->isDataFlavorSupported( m_ClipboardDataFlavors[0] ) ) { // create clipboard dialog model from xml - Reference< lang::XMultiServiceFactory > xMSF = getProcessServiceFactory(); - Reference< container::XNameContainer > xClipDialogModel( xMSF->createInstance( - "com.sun.star.awt.UnoControlDialogModel" ), uno::UNO_QUERY ); + Reference< uno::XComponentContext > xContext = getProcessComponentContext(); + Reference< awt::XUnoControlDialogModel > xClipDialogModel = + awt::UnoControlDialogModel::create( xContext ); bool bSourceIsLocalized = false; Sequence< sal_Int8 > DialogModelBytes; @@ -914,102 +915,93 @@ void DlgEditor::Paste() aAny >>= DialogModelBytes; } - if ( xClipDialogModel.is() ) - { - Reference< XComponentContext > xContext( - comphelper::getComponentContext( xMSF ) ); - ::xmlscript::importDialogModel( ::xmlscript::createInputStream( rtl::ByteSequence(DialogModelBytes.getArray(), DialogModelBytes.getLength()) ) , xClipDialogModel, xContext, m_xDocument ); - } + ::xmlscript::importDialogModel( ::xmlscript::createInputStream( rtl::ByteSequence(DialogModelBytes.getArray(), DialogModelBytes.getLength()) ) , xClipDialogModel, xContext, m_xDocument ); // get control models from clipboard dialog model - Reference< ::com::sun::star::container::XNameAccess > xNameAcc( xClipDialogModel, UNO_QUERY ); - if ( xNameAcc.is() ) - { - Sequence< OUString > aNames = xNameAcc->getElementNames(); - const OUString* pNames = aNames.getConstArray(); - sal_uInt32 nCtrls = aNames.getLength(); + Sequence< OUString > aNames = xClipDialogModel->getElementNames(); + const OUString* pNames = aNames.getConstArray(); + sal_uInt32 nCtrls = aNames.getLength(); - Reference< resource::XStringResourcePersistence > xStringResourcePersistence; - if( nCtrls > 0 && bSourceIsLocalized ) - { - xStringResourcePersistence = css::resource::StringResource::create( getProcessComponentContext() ); - xStringResourcePersistence->importBinary( aResData ); - } - for( sal_uInt32 n = 0; n < nCtrls; n++ ) + Reference< resource::XStringResourcePersistence > xStringResourcePersistence; + if( nCtrls > 0 && bSourceIsLocalized ) + { + xStringResourcePersistence = css::resource::StringResource::create( getProcessComponentContext() ); + xStringResourcePersistence->importBinary( aResData ); + } + for( sal_uInt32 n = 0; n < nCtrls; n++ ) + { + 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 ) { - 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 ) + Any aControlAny; + aControlAny <<= xCtrlModel; + if( bSourceIsLocalized && xStringResourcePersistence.is() ) { - 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 ); - } + 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); } - // 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); + // 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(); + + // dialog model changed + SetDialogModelChanged(true); } } } diff --git a/basctl/source/dlged/dlgedfac.cxx b/basctl/source/dlged/dlgedfac.cxx index 1ffbff22968d..a092c8ffeea9 100644 --- a/basctl/source/dlged/dlgedfac.cxx +++ b/basctl/source/dlged/dlgedfac.cxx @@ -24,6 +24,8 @@ #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 { @@ -46,17 +48,11 @@ DlgEdFactory::~DlgEdFactory() IMPL_LINK( DlgEdFactory, MakeObject, SdrObjFactory *, pObjFactory ) { static bool bNeedsInit = true; - static uno::Reference< lang::XMultiServiceFactory > xDialogSFact; + static uno::Reference< awt::XUnoControlDialogModel > xDialogSFact; if( bNeedsInit ) { - 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; - } + xDialogSFact = awt::UnoControlDialogModel::create( ::comphelper::getProcessComponentContext() ); bNeedsInit = false; } diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx index f74bb95eb2a9..a54d2a962cb7 100644 --- a/basic/source/classes/eventatt.cxx +++ b/basic/source/classes/eventatt.cxx @@ -22,6 +22,7 @@ #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> @@ -423,7 +424,7 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit (void)pBasic; (void)bWrite; - Reference< XMultiServiceFactory > xMSF( comphelper::getProcessServiceFactory() ); + Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); // We need at least 1 parameter if ( rPar.Count() < 2 ) @@ -450,43 +451,22 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit } // Create new uno dialog - Reference< XNameContainer > xDialogModel( xMSF->createInstance( - OUString("com.sun.star.awt.UnoControlDialogModel")), UNO_QUERY ); - if( !xDialogModel.is() ) - { - return; - } + Reference< XUnoControlDialogModel > xDialogModel = UnoControlDialogModel::create( xContext ); 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 - uno::Reference< beans::XPropertySet > xDlgModPropSet( xDialogModel, uno::UNO_QUERY ); - if( xDlgModPropSet.is() ) + if( !xDialogModel->getDecoration() ) { - 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& ) - {} + xDialogModel->setDecoration( true ); + xDialogModel->setTitle( OUString() ); } Any aDlgLibAny; diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx index a9b28cebb1a1..6ba2ff153f31 100644 --- a/basic/source/uno/dlgcont.cxx +++ b/basic/source/uno/dlgcont.cxx @@ -17,6 +17,7 @@ * 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> @@ -236,9 +237,7 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e if ( xISP.is() ) { Reference< io::XInputStream > xInput( xISP->createInputStream() ); - Reference< XNameContainer > xDialogModel( - mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", mxContext), - UNO_QUERY ); + Reference< awt::XUnoControlDialogModel > xDialogModel = awt::UnoControlDialogModel::create( mxContext ); ::xmlscript::importDialogModel( xInput, xDialogModel, mxContext, mxOwnerDocument ); std::vector< OUString > vEmbeddedImageURLs; GraphicObject::InspectForGraphicObjectImageURL( Reference< XInterface >( xDialogModel, UNO_QUERY ), vEmbeddedImageURLs ); @@ -280,14 +279,7 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement Reference< XParser > xParser = xml::sax::Parser::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; - } + Reference< awt::XUnoControlDialogModel > xDialogModel = awt::UnoControlDialogModel::create( mxContext ); // 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 bd75b8a39971..7c5a37df3721 100644 --- a/dbaccess/source/ext/macromigration/migrationengine.cxx +++ b/dbaccess/source/ext/macromigration/migrationengine.cxx @@ -29,6 +29,7 @@ #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> @@ -1821,7 +1822,7 @@ namespace dbmm Reference< XInputStreamProvider > xISP( _inout_rDialogLibraryElement, UNO_QUERY_THROW ); Reference< XInputStream > xInput( xISP->createInputStream(), UNO_QUERY_THROW ); - Reference< XNameContainer > xDialogModel( m_aContext->getServiceManager()->createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", m_aContext), UNO_QUERY_THROW ); + Reference< css::awt::XUnoControlDialogModel > xDialogModel = css::awt::UnoControlDialogModel::create( m_aContext ); ::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 0bb52c1cb138..22ddd5d02c2d 100644 --- a/extensions/source/update/check/updatehdl.cxx +++ b/extensions/source/update/check/updatehdl.cxx @@ -31,6 +31,7 @@ #include <com/sun/star/style/VerticalAlignment.hpp> +#include "com/sun/star/awt/UnoControlDialogModel.hpp" #include "com/sun/star/awt/ActionEvent.hpp" #include "com/sun/star/awt/PushButtonType.hpp" #include "com/sun/star/awt/VclWindowPeerAttribute.hpp" @@ -1091,26 +1092,23 @@ void UpdateHandler::createDialog() loadStrings(); - 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 ); + uno::Reference< awt::XUnoControlDialogModel > xControlDialogModel = awt::UnoControlDialogModel::create( mxContext ); { // @see awt/UnoControlDialogModel.idl - 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 ) ) ); + xControlDialogModel->setTitle( msDlgTitle); + xControlDialogModel->setCloseable( true ); + xControlDialogModel->setEnabled( true ); + xControlDialogModel->setMoveable( true ); + xControlDialogModel->setSizeable( true ); + xControlDialogModel->setDesktopAsParent( true ); + xControlDialogModel->setPositionX( 100 ); + xControlDialogModel->setPositionY( 100 ); + xControlDialogModel->setWidth( DIALOG_WIDTH ); + xControlDialogModel->setHeight( DIALOG_HEIGHT ); + xControlDialogModel->setHelpURL( INET_HID_SCHEME + OUString::createFromAscii( HID_CHECK_FOR_UPD_DLG ) ); } + + uno::Reference< awt::XControlModel > xControlModel = xControlModel; { // Label (fixed text) <status> uno::Sequence< beans::NamedValue > aProps(1); @@ -1322,6 +1320,7 @@ void UpdateHandler::createDialog() aProps); } + uno::Reference< lang::XMultiComponentFactory > xFactory( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); uno::Reference< awt::XControl > xControl( xFactory->createInstanceWithContext( "com.sun.star.awt.UnoControlDialog", mxContext), uno::UNO_QUERY_THROW ); diff --git a/filter/source/t602/t602filter.cxx b/filter/source/t602/t602filter.cxx index 63218a12dc93..0e2d6cff6606 100644 --- a/filter/source/t602/t602filter.cxx +++ b/filter/source/t602/t602filter.cxx @@ -25,6 +25,7 @@ #include <cppuhelper/factory.hxx> #include <cppuhelper/bootstrap.hxx> +#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> @@ -940,24 +941,19 @@ sal_Bool T602ImportFilterDialog::OptionsDlg() #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 < XInterface > rInstance = _InstCtx("com.sun.star.awt.UnoControlDialogModel", rComponentContext ); + Reference < XUnoControlDialogModel > rInstance = UnoControlDialogModel::create(rComponentContext ); - 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); + rInstance->setPositionX(100); + rInstance->setPositionY(100); + rInstance->setWidth(130); + rInstance->setHeight(90); + rInstance->setTitle(getResStr(T602FILTER_STR_IMPORT_DIALOG_TITLE)); #define T602DLG_OK_BUTTON "ok_button" #define T602DLG_CANCEL_BUTTON "cancel_button" @@ -967,7 +963,7 @@ sal_Bool T602ImportFilterDialog::OptionsDlg() #define T602DLG_REFORMAT_CB "reformat_cb" #define T602DLG_CODE_TXT "code_txt" - Reference < XInterface > TextModel = _Inst("com.sun.star.awt.UnoControlFixedTextModel"); + Reference < XInterface > TextModel = rInstance->createInstance("com.sun.star.awt.UnoControlFixedTextModel"); Reference < XPropertySet > xPSetText( TextModel, UNO_QUERY ); _propInt(xPSetText,"PositionX",10); _propInt(xPSetText,"PositionY",8); @@ -976,7 +972,7 @@ sal_Bool T602ImportFilterDialog::OptionsDlg() _propString(xPSetText,"Name",T602DLG_CODE_TXT); _propStringFromResId(xPSetText,"Label",T602FILTER_STR_ENCODING_LABEL); - Reference < XInterface > ListBoxModel = _Inst("com.sun.star.awt.UnoControlListBoxModel"); + Reference < XInterface > ListBoxModel = rInstance->createInstance("com.sun.star.awt.UnoControlListBoxModel"); Reference < XPropertySet > xPSetCodeLB( ListBoxModel, UNO_QUERY ); _propInt(xPSetCodeLB,"PositionX",40); _propInt(xPSetCodeLB,"PositionY",5); @@ -1000,7 +996,7 @@ sal_Bool T602ImportFilterDialog::OptionsDlg() any <<= shr; xPSetCodeLB->setPropertyValue(OUString( "SelectedItems" ), any); - Reference < XInterface > AzbCheckBoxModel = _Inst("com.sun.star.awt.UnoControlCheckBoxModel"); + Reference < XInterface > AzbCheckBoxModel = rInstance->createInstance("com.sun.star.awt.UnoControlCheckBoxModel"); Reference < XPropertySet > xPSetAzbukaCB( AzbCheckBoxModel, UNO_QUERY ); _propInt(xPSetAzbukaCB,"PositionX",10); _propInt(xPSetAzbukaCB,"PositionY",25); @@ -1011,7 +1007,7 @@ sal_Bool T602ImportFilterDialog::OptionsDlg() _propStringFromResId(xPSetAzbukaCB,"Label",T602FILTER_STR_CYRILLIC_MODE); _propShort(xPSetAzbukaCB,"State",ini.ruscode); - Reference < XInterface > RefCheckBoxModel = _Inst("com.sun.star.awt.UnoControlCheckBoxModel"); + Reference < XInterface > RefCheckBoxModel = rInstance->createInstance("com.sun.star.awt.UnoControlCheckBoxModel"); Reference < XPropertySet > xPSetRefCB( RefCheckBoxModel, UNO_QUERY ); _propInt(xPSetRefCB,"PositionX",10); _propInt(xPSetRefCB,"PositionY",40); @@ -1022,7 +1018,7 @@ sal_Bool T602ImportFilterDialog::OptionsDlg() _propStringFromResId(xPSetRefCB,"Label",T602FILTER_STR_REFORMAT_TEXT); _propShort(xPSetRefCB,"State",ini.reformatpars); - Reference < XInterface > CommCheckBoxModel = _Inst("com.sun.star.awt.UnoControlCheckBoxModel"); + Reference < XInterface > CommCheckBoxModel = rInstance->createInstance("com.sun.star.awt.UnoControlCheckBoxModel"); Reference < XPropertySet > xPSetCommCB( CommCheckBoxModel, UNO_QUERY ); _propInt(xPSetCommCB,"PositionX",10); _propInt(xPSetCommCB,"PositionY",55); @@ -1033,7 +1029,7 @@ sal_Bool T602ImportFilterDialog::OptionsDlg() _propStringFromResId(xPSetCommCB,"Label",T602FILTER_STR_DOT_COMMANDS); _propShort(xPSetCommCB,"State",ini.showcomm); - Reference < XInterface > CancelButtonModel = _Inst("com.sun.star.awt.UnoControlButtonModel"); + Reference < XInterface > CancelButtonModel = rInstance->createInstance("com.sun.star.awt.UnoControlButtonModel"); Reference < XPropertySet > xPSetCancelButton( CancelButtonModel, UNO_QUERY ); _propInt(xPSetCancelButton,"PositionX",10); _propInt(xPSetCancelButton,"PositionY",70); @@ -1044,7 +1040,7 @@ sal_Bool T602ImportFilterDialog::OptionsDlg() _propShort(xPSetCancelButton,"PushButtonType",2); _propStringFromResId(xPSetCancelButton,"Label",T602FILTER_STR_CANCEL_BUTTON); - Reference < XInterface > OkButtonModel = _Inst("com.sun.star.awt.UnoControlButtonModel"); + Reference < XInterface > OkButtonModel = rInstance->createInstance("com.sun.star.awt.UnoControlButtonModel"); Reference < XPropertySet > xPSetOkButton( OkButtonModel, UNO_QUERY ); _propInt(xPSetOkButton,"PositionX",70); _propInt(xPSetOkButton,"PositionY",70); diff --git a/include/toolkit/controls/dialogcontrol.hxx b/include/toolkit/controls/dialogcontrol.hxx index e8b95647c80f..73d1c62a520e 100644 --- a/include/toolkit/controls/dialogcontrol.hxx +++ b/include/toolkit/controls/dialogcontrol.hxx @@ -21,6 +21,7 @@ #define TOOLKIT_DIALOG_CONTROL_HXX #include <toolkit/controls/controlmodelcontainerbase.hxx> +#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> @@ -30,6 +31,7 @@ #include "toolkit/helper/macros.hxx" #include <toolkit/controls/unocontrolcontainer.hxx> #include <cppuhelper/basemutex.hxx> +#include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase3.hxx> #include <list> @@ -37,7 +39,10 @@ // class UnoControlDialogModel // ---------------------------------------------------- -class UnoControlDialogModel : public ControlModelContainerBase +typedef ::cppu::AggImplInheritanceHelper1 < ControlModelContainerBase + , ::com::sun::star::awt::XUnoControlDialogModel + > UnoControlDialogModel_Base; +class UnoControlDialogModel : public UnoControlDialogModel_Base { protected: ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj; @@ -45,6 +50,19 @@ 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 ); @@ -60,6 +78,143 @@ 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::uno::Reference<com::sun::star::resource::XStringResourceManager> SAL_CALL getResourceResolver() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setResourceResolver(const com::sun::star::uno::Reference<com::sun::star::resource::XStringResourceManager>& p1) throw(::com::sun::star::uno::RuntimeException) + { setPropertyValue( "ResourceResolver", css::uno::Any(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::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::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::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::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::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::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::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::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::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::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::uno::RuntimeException) + { UnoControlDialogModel_Base::ControlModelContainerBase::insertByName(p1, p2); } + virtual void SAL_CALL removeByName(const rtl::OUString& p1) throw (::com::sun::star::uno::RuntimeException) + { UnoControlDialogModel_Base::ControlModelContainerBase::removeByName(p1); } + + + }; typedef ::cppu::AggImplInheritanceHelper3 < ControlContainerBase diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 6c5c6f4a7a38..0313680fc02e 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -60,6 +60,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/awt,\ PopupMenu \ TabController \ Toolkit \ + UnoControlDialogModel \ UnoControlDialogModelProvider \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/awt/grid,\ @@ -515,7 +516,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/awt,\ UnoControlDateFieldModel \ UnoControlDialog \ UnoControlDialogElement \ - UnoControlDialogModel \ UnoControlEdit \ UnoControlEditModel \ UnoControlFileControl \ @@ -1874,6 +1874,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/awt,\ XTopWindowListener \ XUnitConversion \ XUnoControlContainer \ + XUnoControlDialogModel \ XUserInputInterception \ XVclContainer \ XVclContainerListener \ diff --git a/offapi/com/sun/star/awt/UnoControlDialogModel.idl b/offapi/com/sun/star/awt/UnoControlDialogModel.idl index 9c4dd99a4642..3956102d1508 100644 --- a/offapi/com/sun/star/awt/UnoControlDialogModel.idl +++ b/offapi/com/sun/star/awt/UnoControlDialogModel.idl @@ -19,14 +19,7 @@ #ifndef __com_sun_star_awt_UnoControlDialogModel_idl__ #define __com_sun_star_awt_UnoControlDialogModel_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> +#include <com/sun/star/awt/XUnoControlDialogModel.idl> module com { module sun { module star { module awt { @@ -34,118 +27,7 @@ /** specifies the standard model of an <type>UnoControlDialog</type>. */ -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; - -}; +published service UnoControlDialogModel : XUnoControlDialogModel; }; }; }; }; diff --git a/offapi/com/sun/star/awt/XUnoControlDialogModel.idl b/offapi/com/sun/star/awt/XUnoControlDialogModel.idl new file mode 100644 index 000000000000..81cd2b1fd569 --- /dev/null +++ b/offapi/com/sun/star/awt/XUnoControlDialogModel.idl @@ -0,0 +1,169 @@ +/* -*- 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> +#include <com/sun/star/resource/XStringResourceManager.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; + + [attribute] com::sun::star::resource::XStringResourceManager ResourceResolver; + + /** 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/com/sun/star/resource/XStringResourceManager.idl b/offapi/com/sun/star/resource/XStringResourceManager.idl index ad9a8f39062f..423bedf61cf6 100644 --- a/offapi/com/sun/star/resource/XStringResourceManager.idl +++ b/offapi/com/sun/star/resource/XStringResourceManager.idl @@ -44,7 +44,7 @@ module com { module sun { module star { module resource { localized dialogs. */ -interface XStringResourceManager: com::sun::star::resource::XStringResourceResolver +published interface XStringResourceManager: com::sun::star::resource::XStringResourceResolver { /** Returns the resource's read only state diff --git a/offapi/com/sun/star/resource/XStringResourceResolver.idl b/offapi/com/sun/star/resource/XStringResourceResolver.idl index d236f0d69ddf..49bd841fa47c 100644 --- a/offapi/com/sun/star/resource/XStringResourceResolver.idl +++ b/offapi/com/sun/star/resource/XStringResourceResolver.idl @@ -42,7 +42,7 @@ module com { module sun { module star { module resource { But also changing the locale at runtime can be supported in this way. */ -interface XStringResourceResolver: com::sun::star::util::XModifyBroadcaster +published interface XStringResourceResolver: com::sun::star::util::XModifyBroadcaster { /** Resolves the passed ResoureID for the current locale. This diff --git a/offapi/type_reference/offapi.rdb b/offapi/type_reference/offapi.rdb Binary files differindex 0d73ab1bc233..c257c38e5132 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 aee0a9a16ec5..b7b5de3da34e 100644 --- a/scripting/source/dlgprov/DialogModelProvider.cxx +++ b/scripting/source/dlgprov/DialogModelProvider.cxx @@ -76,12 +76,9 @@ 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.set( dlgprov::lcl_createDialogModel( m_xContext, xInput , xModel, xStringResourceManager, aDialogSourceURLAny ), UNO_QUERY_THROW); - m_xDialogModelProp.set(m_xDialogModel, UNO_QUERY_THROW); + m_xDialogModel = dlgprov::lcl_createDialogModel( m_xContext, xInput , xModel, xStringResourceManager, sURL ); } } catch( Exception& ) @@ -135,14 +132,14 @@ void SAL_CALL DialogModelProvider::removeByName(const OUString & aName) throw (c } uno::Reference< beans::XPropertySetInfo > SAL_CALL DialogModelProvider::getPropertySetInfo( ) throw (uno::RuntimeException) { - return m_xDialogModelProp->getPropertySetInfo(); + return m_xDialogModel->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_xDialogModelProp->getPropertyValue(PropertyName); + return m_xDialogModel->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 4d9256a35f14..b104614948c5 100644 --- a/scripting/source/dlgprov/DialogModelProvider.hxx +++ b/scripting/source/dlgprov/DialogModelProvider.hxx @@ -23,6 +23,8 @@ #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{ @@ -75,9 +77,8 @@ 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::container::XNameContainer> m_xDialogModel; - css::uno::Reference< css::beans::XPropertySet> m_xDialogModelProp; + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::awt::XUnoControlDialogModel> m_xDialogModel; }; } // closing anonymous implementation namespace diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx index 2be567db31c8..ea0856e95759 100644 --- a/scripting/source/dlgprov/dlgprov.cxx +++ b/scripting/source/dlgprov/dlgprov.cxx @@ -21,6 +21,7 @@ #include "DialogModelProvider.hxx" #include "dlgprov.hxx" #include "dlgevtatt.hxx" +#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> @@ -86,8 +87,6 @@ namespace dlgprov { //......................................................................... -static OUString aResourceResolverPropName("ResourceResolver"); - Reference< resource::XStringResourceManager > lcl_getStringResourceManager(const Reference< XComponentContext >& i_xContext,const OUString& i_sURL) { INetURLObject aInetObj( i_sURL ); @@ -120,23 +119,20 @@ static OUString aResourceResolverPropName("ResourceResolver"); } return xStringResourceManager; } - Reference< container::XNameContainer > lcl_createControlModel(const Reference< XComponentContext >& i_xContext) + static Reference< XUnoControlDialogModel > lcl_createControlModel(const Reference< XComponentContext >& 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 ); + Reference< XUnoControlDialogModel > xControlModel = UnoControlDialogModel::create( i_xContext ); return xControlModel; } - Reference< container::XNameContainer > lcl_createDialogModel( const Reference< XComponentContext >& i_xContext, + Reference< XUnoControlDialogModel > lcl_createDialogModel( const Reference< XComponentContext >& i_xContext, const Reference< io::XInputStream >& xInput, const Reference< frame::XModel >& xModel, const Reference< resource::XStringResourceManager >& xStringResourceManager, - const Any &aDialogSourceURL) throw ( Exception ) + const OUString& aDialogSourceURL) throw ( Exception ) { - Reference< container::XNameContainer > xDialogModel( lcl_createControlModel(i_xContext) ); + Reference< XUnoControlDialogModel > xDialogModel( lcl_createControlModel(i_xContext) ); - OUString aDlgSrcUrlPropName( "DialogSourceURL" ); - Reference< beans::XPropertySet > xDlgPropSet( xDialogModel, UNO_QUERY ); - xDlgPropSet->setPropertyValue( aDlgSrcUrlPropName, aDialogSourceURL ); + xDialogModel->setDialogSourceURL( 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 @@ -150,10 +146,7 @@ static OUString aResourceResolverPropName("ResourceResolver"); // Set resource property if( xStringResourceManager.is() ) { - Reference< beans::XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY ); - Any aStringResourceManagerAny; - aStringResourceManagerAny <<= xStringResourceManager; - xDlgPSet->setPropertyValue( aResourceResolverPropName, aStringResourceManagerAny ); + xDialogModel->setResourceResolver( xStringResourceManager ); } return xDialogModel; @@ -255,15 +248,15 @@ static OUString aResourceResolverPropName("ResourceResolver"); return xStringResourceManager; } - Reference< container::XNameContainer > DialogProviderImpl::createDialogModel( + Reference< XUnoControlDialogModel > DialogProviderImpl::createDialogModel( const Reference< io::XInputStream >& xInput, const Reference< resource::XStringResourceManager >& xStringResourceManager, - const Any &aDialogSourceURL) throw ( Exception ) + const OUString &aDialogSourceURL) throw ( Exception ) { return lcl_createDialogModel(m_xContext,xInput,m_xModel,xStringResourceManager,aDialogSourceURL); } - Reference< XControlModel > DialogProviderImpl::createDialogModelForBasic() throw ( Exception ) + Reference< XUnoControlDialogModel > DialogProviderImpl::createDialogModelForBasic() throw ( Exception ) { if ( !m_BasicInfo.get() ) // shouln't get here @@ -271,13 +264,10 @@ static OUString aResourceResolverPropName("ResourceResolver"); Reference< resource::XStringResourceManager > xStringResourceManager = getStringResourceFromDialogLibrary( m_BasicInfo->mxDlgLib ); OUString aURL("" ); - Any aDialogSourceURL; - aDialogSourceURL <<= aURL; - Reference< XControlModel > xCtrlModel( createDialogModel( m_BasicInfo->mxInput, xStringResourceManager, aDialogSourceURL ), UNO_QUERY_THROW ); - return xCtrlModel; + return createDialogModel( m_BasicInfo->mxInput, xStringResourceManager, aURL ); } - Reference< XControlModel > DialogProviderImpl::createDialogModel( const OUString& sURL ) + Reference< XUnoControlDialogModel > DialogProviderImpl::createDialogModel( const OUString& sURL ) { OUString aURL( sURL ); @@ -447,7 +437,7 @@ static OUString aResourceResolverPropName("ResourceResolver"); } // import dialog model - Reference< XControlModel > xCtrlModel; + Reference< XUnoControlDialogModel > xCtrlModel; if ( xInput.is() && m_xContext.is() ) { Reference< resource::XStringResourceManager > xStringResourceManager; @@ -460,12 +450,7 @@ static OUString aResourceResolverPropName("ResourceResolver"); xStringResourceManager = getStringResourceFromDialogLibrary( xDialogLib ); } - Any aDialogSourceURLAny; - aDialogSourceURLAny <<= aURL; - - Reference< container::XNameContainer > xDialogModel( createDialogModel( xInput , xStringResourceManager, aDialogSourceURLAny ), UNO_QUERY_THROW); - - xCtrlModel = Reference< XControlModel >( xDialogModel, UNO_QUERY ); + xCtrlModel = createDialogModel( xInput , xStringResourceManager, aURL ); } return xCtrlModel; } diff --git a/scripting/source/dlgprov/dlgprov.hxx b/scripting/source/dlgprov/dlgprov.hxx index 651edfa32cb0..a515b9448e9f 100644 --- a/scripting/source/dlgprov/dlgprov.hxx +++ b/scripting/source/dlgprov/dlgprov.hxx @@ -21,9 +21,10 @@ #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/XContainerWindowProvider.hpp> +#include <com/sun/star/awt/XUnoControlDialogModel.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XInitialization.hpp> @@ -53,14 +54,14 @@ namespace dlgprov // ============================================================================= // class DialogProviderImpl // ============================================================================= - ::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( + ::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( 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 ::com::sun::star::uno::Any &aDialogSourceURL) throw ( ::com::sun::star::uno::Exception ); + const OUString& aDialogSourceURL) throw ( ::com::sun::star::uno::Exception ); typedef ::cppu::WeakImplHelper4< ::com::sun::star::lang::XServiceInfo, @@ -80,9 +81,9 @@ 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; - 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::XUnoControlDialogModel > createDialogModel( const OUString& sURL ); ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > createDialogControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxDialogModel, @@ -95,11 +96,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::container::XNameContainer > createDialogModel( + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XUnoControlDialogModel > 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 ::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 ); + 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 ); // 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 babba10cfaf1..5c51ae28392b 100644 --- a/sdext/source/minimizer/informationdialog.cxx +++ b/sdext/source/minimizer/informationdialog.cxx @@ -216,30 +216,13 @@ void InformationDialog::InitDialog() nDialogHeight -= 22; // setting the dialog properties - 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 ); + 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 ) ); sal_Int64 nSource = mnSourceSize; sal_Int64 nDest = mnDestSize; diff --git a/sdext/source/minimizer/optimizerdialog.cxx b/sdext/source/minimizer/optimizerdialog.cxx index d6c73488725d..e8ef92b40248 100644 --- a/sdext/source/minimizer/optimizerdialog.cxx +++ b/sdext/source/minimizer/optimizerdialog.cxx @@ -52,30 +52,13 @@ using namespace ::com::sun::star::container; void OptimizerDialog::InitDialog() { // setting the dialog properties - 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 ); + 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 ) ); } // ----------------------------------------------------------------------------- @@ -522,7 +505,7 @@ void ActionListener::actionPerformed( const ActionEvent& rEvent ) if ( nInt16 ) { OUString aSaveAsURL; - FileOpenDialog aFileOpenDialog( ((UnoDialog&)mrOptimizerDialog).mxMSF ); + FileOpenDialog aFileOpenDialog( ((UnoDialog&)mrOptimizerDialog).mxContext ); // 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 922527e2a88d..29291b73f022 100644 --- a/sdext/source/minimizer/unodialog.cxx +++ b/sdext/source/minimizer/unodialog.cxx @@ -19,15 +19,16 @@ #include "unodialog.hxx" -#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/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/view/XSelectionSupplier.hpp> +#include <com/sun/star/view/XControlAccess.hpp> // ------------- // - UnoDialog - @@ -43,23 +44,16 @@ using namespace ::com::sun::star::frame; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::script; -UnoDialog::UnoDialog( const Reference< XComponentContext > &rxMSF, Reference< XFrame >& rxFrame ) : - mxMSF( rxMSF ), +UnoDialog::UnoDialog( const Reference< XComponentContext > &rxContext, Reference< XFrame >& rxFrame ) : + mxContext( rxContext ), mxController( rxFrame->getController() ), - 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 ), + mxDialogModel( UnoControlDialogModel::create(rxContext) ), + mxDialog( mxContext->getServiceManager()->createInstanceWithContext( OUString( + "com.sun.star.awt.UnoControlDialog" ), mxContext ), UNO_QUERY_THROW ), mxControl( mxDialog, UNO_QUERY_THROW ), mbStatus( sal_False ) { - mxControl->setModel( mxControlModel ); + mxControl->setModel( mxDialogModel ); mxDialogControlContainer = Reference< XControlContainer >( mxDialog, UNO_QUERY_THROW ); mxDialogComponent = Reference< XComponent >( mxDialog, UNO_QUERY_THROW ); mxDialogWindow = Reference< XWindow >( mxDialog, UNO_QUERY_THROW ); @@ -98,7 +92,7 @@ Reference< XWindowPeer > UnoDialog::createWindowPeer( Reference< XWindowPeer > x throw ( Exception ) { mxDialogWindow->setVisible( sal_False ); - Reference< XToolkit > xToolkit( Toolkit::create( mxMSF ), UNO_QUERY_THROW ); + Reference< XToolkit > xToolkit( Toolkit::create( mxContext ), UNO_QUERY_THROW ); if ( !xParentPeer.is() ) xParentPeer = xToolkit->getDesktopWindow(); mxReschedule = Reference< XReschedule >( xToolkit, UNO_QUERY ); @@ -115,10 +109,10 @@ Reference< XInterface > UnoDialog::insertControlModel( const OUString& rServiceN Reference< XInterface > xControlModel; try { - xControlModel = mxDialogModelMSF->createInstance( rServiceName ); + xControlModel = mxDialogModel->createInstance( rServiceName ); Reference< XMultiPropertySet > xMultiPropSet( xControlModel, UNO_QUERY_THROW ); xMultiPropSet->setPropertyValues( rPropertyNames, rPropertyValues ); - mxDialogModelNameContainer->insertByName( rName, Any( xControlModel ) ); + mxDialogModel->insertByName( rName, Any( xControlModel ) ); } catch( Exception& ) { @@ -300,9 +294,9 @@ void UnoDialog::setControlProperty( const OUString& rControlName, const OUString { try { - if ( mxDialogModelNameAccess->hasByName( rControlName ) ) + if ( mxDialogModel->hasByName( rControlName ) ) { - Reference< XPropertySet > xPropertySet( mxDialogModelNameAccess->getByName( rControlName ), UNO_QUERY_THROW ); + Reference< XPropertySet > xPropertySet( mxDialogModel->getByName( rControlName ), UNO_QUERY_THROW ); xPropertySet->setPropertyValue( rPropertyName, rPropertyValue ); } } @@ -318,9 +312,9 @@ Any UnoDialog::getControlProperty( const OUString& rControlName, const OUString& Any aRet; try { - if ( mxDialogModelNameAccess->hasByName( rControlName ) ) + if ( mxDialogModel->hasByName( rControlName ) ) { - Reference< XPropertySet > xPropertySet( mxDialogModelNameAccess->getByName( rControlName ), UNO_QUERY_THROW ); + Reference< XPropertySet > xPropertySet( mxDialogModel->getByName( rControlName ), UNO_QUERY_THROW ); aRet = xPropertySet->getPropertyValue( rPropertyName ); } } diff --git a/sdext/source/minimizer/unodialog.hxx b/sdext/source/minimizer/unodialog.hxx index b08ce1e5d8fe..37be5e01149b 100644 --- a/sdext/source/minimizer/unodialog.hxx +++ b/sdext/source/minimizer/unodialog.hxx @@ -39,6 +39,7 @@ #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> @@ -106,18 +107,11 @@ public : void enableControl( const OUString& rControlName ); void disableControl( const OUString& rControlName ); - com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxMSF; + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext; 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::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::XControlModel > mxControlModel; + com::sun::star::uno::Reference< com::sun::star::awt::XUnoControlDialogModel > mxDialogModel; com::sun::star::uno::Reference< com::sun::star::awt::XDialog > mxDialog; com::sun::star::uno::Reference< com::sun::star::awt::XControl > mxControl; diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index 096d07c0d848..bd3ce4c09771 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 ) - :ControlModelContainerBase( rxContext ) + :UnoControlDialogModel_Base( rxContext ) { ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); // ImplRegisterProperty( BASEPROPERTY_BORDER ); @@ -180,7 +180,7 @@ UnoControlDialogModel::UnoControlDialogModel( const Reference< XComponentContext } UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel ) - : ControlModelContainerBase( rModel ) + : UnoControlDialogModel_Base( rModel ) { // need to clone BASEPROPERTY_USERFORMCONTAINEES too Reference< XNameContainer > xSrcNameCont( const_cast< UnoControlDialogModel& >(rModel).getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ) ), UNO_QUERY ); @@ -274,6 +274,64 @@ 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; +} + +Reference<css::resource::XStringResourceManager> UnoControlDialogModel::getResourceResolver() throw(css::uno::RuntimeException) +{ + uno::Any any = getPropertyValue("ResourceResolver"); + Reference<css::resource::XStringResourceManager> b; + 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 42cc8851a86c..7d73bd82099c 100644 --- a/xmlscript/test/imexp.cxx +++ b/xmlscript/test/imexp.cxx @@ -44,6 +44,7 @@ #include <com/sun/star/registry/XImplementationRegistration.hpp> #include <com/sun/star/uno/XComponentContext.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> @@ -89,7 +90,7 @@ Reference< XComponentContext > createInitialComponentContext( // ----------------------------------------------------------------------- -Reference< container::XNameContainer > importFile( +Reference< awt::XUnoControlDialogModel > importFile( char const * fname, Reference< XComponentContext > const & xContext ) { @@ -105,8 +106,7 @@ Reference< container::XNameContainer > importFile( ::fread( bytes.getArray(), nLength, 1, f ); ::fclose( f ); - Reference< container::XNameContainer > xModel( xContext->getServiceManager()->createInstanceWithContext( - "com.sun.star.awt.UnoControlDialogModel", xContext ), UNO_QUERY ); + Reference< awt::XUnoControlDialogModel > xModel = awt::UnoControlDialogModel::create( xContext ); ::xmlscript::importDialogModel( ::xmlscript::createInputStream( bytes ), xModel, xContext ); return xModel; |