summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-05-24 22:44:30 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-05-25 11:47:50 +0200
commit1b6678993c905df231147d55e4fc9a9b15406812 (patch)
tree200dd3911abf9dc99713ac0ec52e50a6a3a22252 /basic
parentf6d39d7e2c64a6aec8c83943caf827a57f067335 (diff)
Revert "fdo#46808, Convert awt::UnoControlDialogModel to new style"
This reverts commit 6c61b20a8d4a6dcac28801cde82a211fb7e30654. As discussed at <http://lists.freedesktop.org/archives/libreoffice/2013-May/052449.html> "Re: fdo#46808, Convert awt::UnoControlDialogModel to new style problem" why the odd change in 2e2a4827ce6708f0e8677dba9cc92e1479a44086 "scripting: get CreateUnoDialog() work again" appears to fix things again: The problem is that the implementation of the css.awt.UnoControlDialogModel involves UNO aggregation (IMPL_CREATE_INSTANCE_WITH_GEOMETRY(UnoControlDialogModel) in toolkit/soruce/helper/registerservices.cxx creating a OGeometryControlModel<UnoControlDialogModel> instance that aggregates a UnoControlDialogModel instance). That means that queryInterface can return a reference to something that is technically a different object, and that's what's happening here, and explains why calling setPropertyValue in two different ways on what logically appears to be a single object can end up calling two different implementations (of two different physical objects). (UNO aggregation is known to be broken and should not be used. Nevertheless, there's still code that does---code that is a horrible mess and hard to clean up.) That all this worked as intended in the past is just sheer luck, but any way of substantially touching it is asking for trouble. I'm going to revert 6c61b20a8d4a6dcac28801cde82a211fb7e30654 again. I wasn't able to revert without also reverting be50ad28f5bbdaeff527f646481ce263843c2401 "fdo#46808, Convert awt::XUnoControlDialog to new style," as the two were tightly dependant. Also reverts all the follow-up fixes cb4b6dde8fda2a5848e11063028bf44d72f85431 "-Werror,-Wuninitialized" (sans the const-ness fix in UpdateHandler::insertControlModel), 697a007c61b9cabceb9767fad87cd5822b300452 "Fix exception specifications," 2ce6828bbbf6ba181bb2276adeec279e74151ef6 "fix awt::UnoControlModelDialog crash," and 2e2a4827ce6708f0e8677dba9cc92e1479a44086 "scripting: get CreateUnoDialog() work again." Conflicts: basctl/source/dlged/dlged.cxx filter/source/t602/t602filter.cxx xmlscript/test/imexp.cxx Change-Id: I5d133468062f3ca36300db52fbd699be1ac72998 (cherry picked from commit e36f83d81c462e1a5959b160886e481a8d449494)
Diffstat (limited to 'basic')
-rw-r--r--basic/source/classes/eventatt.cxx32
-rw-r--r--basic/source/runtime/methods1.cxx2
-rw-r--r--basic/source/uno/dlgcont.cxx14
3 files changed, 38 insertions, 10 deletions
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 6ba2ff153f31..a9b28cebb1a1 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( Reference< XInterface >( xDialogModel, UNO_QUERY ), 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();