summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-05-16 14:13:36 +0200
committerNoel Grandin <noel@peralex.com>2013-05-21 08:23:58 +0200
commit6c61b20a8d4a6dcac28801cde82a211fb7e30654 (patch)
treed82328eaa120b8bc822f028fa1e62bc7814c9e1b /basic
parent6c53dff36ebdac7b6a6cf514ab469b2202d6aa48 (diff)
fdo#46808, Convert awt::UnoControlDialogModel to new style
Change-Id: I4b912034ef3f4855b87d6d6f18ff13bd1ecc8f72
Diffstat (limited to 'basic')
-rw-r--r--basic/source/classes/eventatt.cxx32
-rw-r--r--basic/source/uno/dlgcont.cxx14
2 files changed, 9 insertions, 37 deletions
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();