summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-07-24 14:41:35 +0200
committerNoel Grandin <noel@peralex.com>2013-07-24 14:44:57 +0200
commit96bd18f692f933b328facf75eb200114bb55eee7 (patch)
tree21c39e18db9b6d501b36972c9df93c553d2aa493 /sw/source
parentf5bf0fa958a709394be833584ed610a2d759ca32 (diff)
fdo#67213 - crash on opening AutoText dialog (Ctrl+F3
Revert "fdo#46808, Convert frame::FrameControl service to new style" This reverts commit 32eaa77db33b3b1f5793e92167b9f8c2708ea543. Conflicts: UnoControls/source/controls/framecontrol.cxx UnoControls/source/inc/framecontrol.hxx .. because I can't work out how it causes fdo#67213 - I suspect my changes might be interacting with UNO aggregation, which is always tricky. Change-Id: Icd14f9a7df98585393c5527a3817e05c26246de9
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/ui/inc/unotools.hxx16
-rw-r--r--sw/source/ui/utlui/unotools.cxx84
2 files changed, 57 insertions, 43 deletions
diff --git a/sw/source/ui/inc/unotools.hxx b/sw/source/ui/inc/unotools.hxx
index 87b296f39eea..33a8cbab8a1f 100644
--- a/sw/source/ui/inc/unotools.hxx
+++ b/sw/source/ui/inc/unotools.hxx
@@ -26,11 +26,11 @@
#include <vcl/fixed.hxx>
#include <vcl/layout.hxx>
#include <actctrl.hxx>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/frame/XController.hpp>
-#include <com/sun/star/frame/XFrameControl.hpp>
#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/container/XNamed.hpp>
#include <tools/resary.hxx>
#include "swdllapi.h"
@@ -68,7 +68,7 @@ class SwView;
class SW_DLLPUBLIC SwOneExampleFrame
{
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrameControl > m_xFrameControl;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > _xControl;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > _xModel;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > _xController;
::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > _xCursor;
@@ -102,10 +102,10 @@ public:
String* pURL = 0);
~SwOneExampleFrame();
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrameControl > & GetFrameControl() {return m_xFrameControl; }
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & GetModel() {return _xModel;}
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > & GetController() {return _xController;}
- ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > & GetTextCursor() {return _xCursor;}
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > & GetControl() {return _xControl; }
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & GetModel() {return _xModel;}
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > & GetController() {return _xController;}
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > & GetTextCursor() {return _xCursor;}
void ClearDocument( sal_Bool bStartTimer = sal_False );
diff --git a/sw/source/ui/utlui/unotools.cxx b/sw/source/ui/utlui/unotools.cxx
index 62fadccd1454..a0fd65d2b7c8 100644
--- a/sw/source/ui/utlui/unotools.cxx
+++ b/sw/source/ui/utlui/unotools.cxx
@@ -38,7 +38,6 @@
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/view/XViewSettingsSupplier.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/frame/FrameControl.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <comphelper/processfactory.hxx>
#include <sfx2/dispatch.hxx>
@@ -107,51 +106,62 @@ SwOneExampleFrame::~SwOneExampleFrame()
void SwOneExampleFrame::CreateControl()
{
- if(m_xFrameControl.is())
+ if(_xControl.is())
return ;
uno::Reference< lang::XMultiServiceFactory >
xMgr = comphelper::getProcessServiceFactory();
uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
- m_xFrameControl = frame::FrameControl::create(xContext);
-
- uno::Reference< awt::XWindowPeer > xParent( aTopWindow.GetComponentInterface() );
-
- uno::Reference< awt::XToolkit > xToolkit( awt::Toolkit::create(xContext), uno::UNO_QUERY_THROW );
-
- m_xFrameControl->createPeer( xToolkit, xParent );
+ uno::Reference< uno::XInterface > xInst = xMgr->createInstance( "com.sun.star.frame.FrameControl" );
+ _xControl = uno::Reference< awt::XControl >(xInst, uno::UNO_QUERY);
+ if(_xControl.is())
+ {
+ uno::Reference< awt::XWindowPeer > xParent( aTopWindow.GetComponentInterface() );
- m_xFrameControl->setVisible(sal_False);
- Size aWinSize(aTopWindow.GetOutputSizePixel());
- m_xFrameControl->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE );
+ uno::Reference< awt::XToolkit > xToolkit( awt::Toolkit::create(xContext), uno::UNO_QUERY_THROW );
- // create new doc
- OUString sTempURL(cFactory);
- if(sArgumentURL.Len())
- sTempURL = sArgumentURL;
+ _xControl->createPeer( xToolkit, xParent );
- uno::Sequence<beans::PropertyValue> aSeq(3);
- beans::PropertyValue* pValues = aSeq.getArray();
- pValues[0].Name = "ReadOnly";
- sal_Bool bTrue = sal_True;
- pValues[0].Value.setValue(&bTrue, ::getBooleanCppuType());
- pValues[1].Name = "OpenFlags";
- pValues[1].Value <<= OUString("-RB");
- pValues[2].Name = "Referer";
- pValues[2].Value <<= OUString("private:user");
+ uno::Reference< awt::XWindow > xWin( _xControl, uno::UNO_QUERY );
+ xWin->setVisible(sal_False);
+ Size aWinSize(aTopWindow.GetOutputSizePixel());
+ xWin->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE );
+
+ uno::Reference< beans::XPropertySet > xPrSet(xInst, uno::UNO_QUERY);
+ uno::Any aURL;
+ // create new doc
+ OUString sTempURL(cFactory);
+ if(sArgumentURL.Len())
+ sTempURL = sArgumentURL;
+ aURL <<= sTempURL;
+
+ uno::Sequence<beans::PropertyValue> aSeq(3);
+ beans::PropertyValue* pValues = aSeq.getArray();
+ pValues[0].Name = "ReadOnly";
+ sal_Bool bTrue = sal_True;
+ pValues[0].Value.setValue(&bTrue, ::getBooleanCppuType());
+ pValues[1].Name = "OpenFlags";
+ pValues[1].Value <<= OUString("-RB");
+ pValues[2].Name = "Referer";
+ pValues[2].Value <<= OUString("private:user");
+ uno::Any aArgs;
+ aArgs.setValue(&aSeq, ::getCppuType((uno::Sequence<beans::PropertyValue>*)0));
- m_xFrameControl->setLoaderArguments( aSeq );
- //save and set readonly???
+ xPrSet->setPropertyValue( "LoaderArguments", aArgs );
+ //save and set readonly???
- m_xFrameControl->setComponentURL( sTempURL );
+ xPrSet->setPropertyValue("ComponentURL", aURL);
- aLoadedTimer.Start();
- bServiceAvailable = sal_True;
+ aLoadedTimer.Start();
+ bServiceAvailable = sal_True;
+ }
}
void SwOneExampleFrame::DisposeControl()
{
_xCursor = 0;
- m_xFrameControl.clear();
+ if(_xControl.is())
+ _xControl->dispose();
+ _xControl = 0;
_xModel = 0;
_xController = 0;
}
@@ -183,11 +193,14 @@ static void disableScrollBars(uno::Reference< beans::XPropertySet > xViewProps,
IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer )
{
- if(!m_xFrameControl.is())
+ if(!_xControl.is())
return 0;
// now get the model
- uno::Reference< frame::XFrame > xFrm = m_xFrameControl->getFrame();
+ uno::Reference< beans::XPropertySet > xPrSet(_xControl, uno::UNO_QUERY);
+ uno::Any aFrame = xPrSet->getPropertyValue("Frame");
+ uno::Reference< frame::XFrame > xFrm;
+ aFrame >>= xFrm;
uno::Reference< beans::XPropertySet > xPropSet( xFrm, uno::UNO_QUERY );
if ( xPropSet.is() )
@@ -349,8 +362,9 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer )
xPProp->setPropertyValue(OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_RIGHT_MARGIN)), aZero);
}
+ uno::Reference< awt::XWindow > xWin( _xControl, uno::UNO_QUERY );
Size aWinSize(aTopWindow.GetOutputSizePixel());
- m_xFrameControl->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE );
+ xWin->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE );
// can only be done here - the SFX changes the ScrollBar values
disableScrollBars(xViewProps, nStyleFlags&EX_SHOW_ONLINE_LAYOUT);
@@ -363,7 +377,7 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer )
if(xScrCrsr.is())
xScrCrsr->screenUp();
- m_xFrameControl->setVisible( sal_True );
+ xWin->setVisible( sal_True );
aTopWindow.Show();
if( xTunnel.is() )