Kaydet (Commit) 96bd18f6 authored tarafından Noel Grandin's avatar Noel Grandin

fdo#67213 - crash on opening AutoText dialog (Ctrl+F3

Revert "fdo#46808, Convert frame::FrameControl service to new style"
This reverts commit 32eaa77d.
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
üst f5bf0fa9
...@@ -46,17 +46,6 @@ using namespace ::com::sun::star::util ; ...@@ -46,17 +46,6 @@ using namespace ::com::sun::star::util ;
namespace unocontrols{ namespace unocontrols{
#define SERVICENAME_FRAMECONTROL "com.sun.star.frame.FrameControl"
#define IMPLEMENTATIONNAME_FRAMECONTROL "stardiv.UnoControls.FrameControl"
#define PROPERTYNAME_LOADERARGUMENTS "LoaderArguments"
#define PROPERTYNAME_COMPONENTURL "ComponentURL"
#define PROPERTYNAME_FRAME "Frame"
#define PROPERTY_COUNT 3 // you must count the propertys
#define PROPERTYHANDLE_COMPONENTURL 0 // Id must be the index into the array
#define PROPERTYHANDLE_FRAME 1
#define PROPERTYHANDLE_LOADERARGUMENTS 2
//______________________________________________________________________________________________________________ //______________________________________________________________________________________________________________
// construct/destruct // construct/destruct
//______________________________________________________________________________________________________________ //______________________________________________________________________________________________________________
......
...@@ -199,7 +199,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/frame,\ ...@@ -199,7 +199,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/frame,\
DispatchRecorderSupplier \ DispatchRecorderSupplier \
DocumentTemplates \ DocumentTemplates \
Frame \ Frame \
FrameControl \
FrameLoaderFactory \ FrameLoaderFactory \
GlobalEventBroadcaster \ GlobalEventBroadcaster \
LayoutManager \ LayoutManager \
...@@ -944,6 +943,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/frame,\ ...@@ -944,6 +943,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/frame,\
DesktopTask \ DesktopTask \
DesktopTasks \ DesktopTasks \
DispatchProvider \ DispatchProvider \
FrameControl \
FrameLoader \ FrameLoader \
FramesContainer \ FramesContainer \
PopupMenuController \ PopupMenuController \
...@@ -2586,7 +2586,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/frame,\ ...@@ -2586,7 +2586,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/frame,\
XFrame \ XFrame \
XFrame2 \ XFrame2 \
XFrameActionListener \ XFrameActionListener \
XFrameControl \
XFrameLoader \ XFrameLoader \
XFrameLoaderQuery \ XFrameLoaderQuery \
XFrameSetModel \ XFrameSetModel \
......
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
#ifndef __com_sun_star_frame_FrameControl_idl__ #ifndef __com_sun_star_frame_FrameControl_idl__
#define __com_sun_star_frame_FrameControl_idl__ #define __com_sun_star_frame_FrameControl_idl__
#include <com/sun/star/frame/XFrameControl.idl> #include <com/sun/star/awt/UnoControl.idl>
#include <com/sun/star/beans/XPropertySet.idl>
module com { module sun { module star { module frame { module com { module sun { module star { module frame {
...@@ -33,7 +34,26 @@ ...@@ -33,7 +34,26 @@
any UI. any UI.
</p> </p>
*/ */
published service FrameControl : XFrameControl; published service FrameControl
{
/** the base service of all controls
*/
service com::sun::star::awt::UnoControl;
/** contains the type of the component which is loaded into the frame,
or the document which implicitly specifies the type
*/
[property] string ComponentUrl;
/** the frame held by this control
<p>
The Frame is created if the control
is shown and the #ComponentUrl is set.
</p>
*/
[property, readonly] string Frame;
};
}; }; }; }; }; }; }; };
......
/* -*- 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_frame_XFrameControl_idl__
#define __com_sun_star_frame_XFrameControl_idl__
#include <com/sun/star/awt/UnoControl.idl>
#include <com/sun/star/beans/XPropertySet.idl>
#include <com/sun/star/beans/PropertyValue.idl>
#include <com/sun/star/frame/XFrame2.idl>
module com { module sun { module star { module frame {
/**
Unified interface for the FrameControl service.
This is not the complete set of interfaces this service implements, just the bare minimum
that we use internally.
@since LibreOffice 4.2
*/
published interface XFrameControl
{
interface com::sun::star::awt::XControl;
interface com::sun::star::awt::XWindow;
/** contains the type of the component which is loaded into the frame,
or the document which implicitly specifies the type
*/
[attribute] string ComponentURL;
/** the frame held by this control
<p>
The Frame is created if the control
is shown and the #ComponentUrl is set.
</p>
*/
[attribute] com::sun::star::frame::XFrame2 Frame;
[attribute] sequence< ::com::sun::star::beans::PropertyValue > LoaderArguments;
};
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -26,11 +26,11 @@ ...@@ -26,11 +26,11 @@
#include <vcl/fixed.hxx> #include <vcl/fixed.hxx>
#include <vcl/layout.hxx> #include <vcl/layout.hxx>
#include <actctrl.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/XController.hpp>
#include <com/sun/star/frame/XFrameControl.hpp>
#include <com/sun/star/text/XTextCursor.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 <tools/resary.hxx>
#include "swdllapi.h" #include "swdllapi.h"
...@@ -68,7 +68,7 @@ class SwView; ...@@ -68,7 +68,7 @@ class SwView;
class SW_DLLPUBLIC SwOneExampleFrame 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::XModel > _xModel;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > _xController; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > _xController;
::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > _xCursor; ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > _xCursor;
...@@ -102,10 +102,10 @@ public: ...@@ -102,10 +102,10 @@ public:
String* pURL = 0); String* pURL = 0);
~SwOneExampleFrame(); ~SwOneExampleFrame();
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrameControl > & GetFrameControl() {return m_xFrameControl; } ::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::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::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::text::XTextCursor > & GetTextCursor() {return _xCursor;}
void ClearDocument( sal_Bool bStartTimer = sal_False ); void ClearDocument( sal_Bool bStartTimer = sal_False );
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#include <com/sun/star/awt/PosSize.hpp> #include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/view/XViewSettingsSupplier.hpp> #include <com/sun/star/view/XViewSettingsSupplier.hpp>
#include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/frame/FrameControl.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp> #include <com/sun/star/frame/XLayoutManager.hpp>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <sfx2/dispatch.hxx> #include <sfx2/dispatch.hxx>
...@@ -107,51 +106,62 @@ SwOneExampleFrame::~SwOneExampleFrame() ...@@ -107,51 +106,62 @@ SwOneExampleFrame::~SwOneExampleFrame()
void SwOneExampleFrame::CreateControl() void SwOneExampleFrame::CreateControl()
{ {
if(m_xFrameControl.is()) if(_xControl.is())
return ; return ;
uno::Reference< lang::XMultiServiceFactory > uno::Reference< lang::XMultiServiceFactory >
xMgr = comphelper::getProcessServiceFactory(); xMgr = comphelper::getProcessServiceFactory();
uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
m_xFrameControl = frame::FrameControl::create(xContext); uno::Reference< uno::XInterface > xInst = xMgr->createInstance( "com.sun.star.frame.FrameControl" );
_xControl = uno::Reference< awt::XControl >(xInst, uno::UNO_QUERY);
uno::Reference< awt::XWindowPeer > xParent( aTopWindow.GetComponentInterface() ); if(_xControl.is())
{
uno::Reference< awt::XToolkit > xToolkit( awt::Toolkit::create(xContext), uno::UNO_QUERY_THROW ); uno::Reference< awt::XWindowPeer > xParent( aTopWindow.GetComponentInterface() );
m_xFrameControl->createPeer( xToolkit, xParent );
m_xFrameControl->setVisible(sal_False); uno::Reference< awt::XToolkit > xToolkit( awt::Toolkit::create(xContext), uno::UNO_QUERY_THROW );
Size aWinSize(aTopWindow.GetOutputSizePixel());
m_xFrameControl->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE );
// create new doc _xControl->createPeer( xToolkit, xParent );
OUString sTempURL(cFactory);
if(sArgumentURL.Len())
sTempURL = sArgumentURL;
uno::Sequence<beans::PropertyValue> aSeq(3); uno::Reference< awt::XWindow > xWin( _xControl, uno::UNO_QUERY );
beans::PropertyValue* pValues = aSeq.getArray(); xWin->setVisible(sal_False);
pValues[0].Name = "ReadOnly"; Size aWinSize(aTopWindow.GetOutputSizePixel());
sal_Bool bTrue = sal_True; xWin->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE );
pValues[0].Value.setValue(&bTrue, ::getBooleanCppuType());
pValues[1].Name = "OpenFlags"; uno::Reference< beans::XPropertySet > xPrSet(xInst, uno::UNO_QUERY);
pValues[1].Value <<= OUString("-RB"); uno::Any aURL;
pValues[2].Name = "Referer"; // create new doc
pValues[2].Value <<= OUString("private:user"); 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 ); xPrSet->setPropertyValue( "LoaderArguments", aArgs );
//save and set readonly??? //save and set readonly???
m_xFrameControl->setComponentURL( sTempURL ); xPrSet->setPropertyValue("ComponentURL", aURL);
aLoadedTimer.Start(); aLoadedTimer.Start();
bServiceAvailable = sal_True; bServiceAvailable = sal_True;
}
} }
void SwOneExampleFrame::DisposeControl() void SwOneExampleFrame::DisposeControl()
{ {
_xCursor = 0; _xCursor = 0;
m_xFrameControl.clear(); if(_xControl.is())
_xControl->dispose();
_xControl = 0;
_xModel = 0; _xModel = 0;
_xController = 0; _xController = 0;
} }
...@@ -183,11 +193,14 @@ static void disableScrollBars(uno::Reference< beans::XPropertySet > xViewProps, ...@@ -183,11 +193,14 @@ static void disableScrollBars(uno::Reference< beans::XPropertySet > xViewProps,
IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer ) IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer )
{ {
if(!m_xFrameControl.is()) if(!_xControl.is())
return 0; return 0;
// now get the model // 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 ); uno::Reference< beans::XPropertySet > xPropSet( xFrm, uno::UNO_QUERY );
if ( xPropSet.is() ) if ( xPropSet.is() )
...@@ -349,8 +362,9 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer ) ...@@ -349,8 +362,9 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer )
xPProp->setPropertyValue(OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_RIGHT_MARGIN)), aZero); 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()); 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 // can only be done here - the SFX changes the ScrollBar values
disableScrollBars(xViewProps, nStyleFlags&EX_SHOW_ONLINE_LAYOUT); disableScrollBars(xViewProps, nStyleFlags&EX_SHOW_ONLINE_LAYOUT);
...@@ -363,7 +377,7 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer ) ...@@ -363,7 +377,7 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer )
if(xScrCrsr.is()) if(xScrCrsr.is())
xScrCrsr->screenUp(); xScrCrsr->screenUp();
m_xFrameControl->setVisible( sal_True ); xWin->setVisible( sal_True );
aTopWindow.Show(); aTopWindow.Show();
if( xTunnel.is() ) if( xTunnel.is() )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment