diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-05-24 22:44:30 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-05-25 11:45:47 +0200 |
commit | e36f83d81c462e1a5959b160886e481a8d449494 (patch) | |
tree | 32dcfbb76d86a0f044ae4f564b6eec097da61d60 /xmlscript/test | |
parent | aaff3ae833f1180a17b9738a7825a780bea64a79 (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
Diffstat (limited to 'xmlscript/test')
-rw-r--r-- | xmlscript/test/imexp.cxx | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/xmlscript/test/imexp.cxx b/xmlscript/test/imexp.cxx index c75cb8104ec7..de88975f1191 100644 --- a/xmlscript/test/imexp.cxx +++ b/xmlscript/test/imexp.cxx @@ -35,21 +35,23 @@ #include <vcl/svapp.hxx> #include <com/sun/star/awt/Toolkit.hpp> -#include <com/sun/star/awt/UnoControlDialog.hpp> -#include <com/sun/star/awt/UnoControlDialogModel.hpp> -#include <com/sun/star/awt/XToolkit.hpp> -#include <com/sun/star/awt/XControlModel.hpp> -#include <com/sun/star/awt/XControl.hpp> -#include <com/sun/star/awt/XDialog.hpp> -#include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> + #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> + #include <com/sun/star/registry/XSimpleRegistry.hpp> #include <com/sun/star/registry/XImplementationRegistration.hpp> #include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/awt/XToolkit.hpp> +#include <com/sun/star/awt/XControlModel.hpp> +#include <com/sun/star/awt/XControl.hpp> +#include <com/sun/star/awt/XDialog.hpp> + +#include <com/sun/star/container/XNameContainer.hpp> + using namespace ::rtl; using namespace ::cppu; @@ -88,7 +90,7 @@ Reference< XComponentContext > createInitialComponentContext( // ----------------------------------------------------------------------- -Reference< awt::XUnoControlDialogModel > importFile( +Reference< container::XNameContainer > importFile( char const * fname, Reference< XComponentContext > const & xContext ) { @@ -104,7 +106,8 @@ Reference< awt::XUnoControlDialogModel > importFile( ::fread( bytes.getArray(), nLength, 1, f ); ::fclose( f ); - Reference< awt::XUnoControlDialogModel > xModel = awt::UnoControlDialogModel::create( xContext ); + Reference< container::XNameContainer > xModel( xContext->getServiceManager()->createInstanceWithContext( + "com.sun.star.awt.UnoControlDialogModel", xContext ), UNO_QUERY ); ::xmlscript::importDialogModel( ::xmlscript::createInputStream( bytes ), xModel, xContext ); return xModel; @@ -183,10 +186,11 @@ void MyApp::Main() importFile( aParam1.getStr(), xContext ) ); OSL_ASSERT( xModel.is() ); - Reference< awt::XUnoControlDialog > xDlg = UnoControlDialog::create( xContext );; - xDlg->setModel( xModel ); + Reference< awt::XControl > xDlg( xMSF->createInstance( "com.sun.star.awt.UnoControlDialog" ), UNO_QUERY ); + xDlg->setModel( Reference< awt::XControlModel >::query( xModel ) ); xDlg->createPeer( xToolkit, 0 ); - xDlg->execute(); + Reference< awt::XDialog > xD( xDlg, UNO_QUERY ); + xD->execute(); if (GetCommandLineParamCount() == 3) { |