Kaydet (Commit) 5f5171f1 authored tarafından Rüdiger Timm's avatar Rüdiger Timm

INTEGRATION: CWS fwk80_SRC680 (1.29.14); FILE MERGED

2008/01/02 12:24:04 mav 1.29.14.1: #i84941# use the MediaDescriptor only to handle the macro execution
üst a0d2c8cd
......@@ -4,9 +4,9 @@
*
* $RCSfile: docholder.cxx,v $
*
* $Revision: 1.29 $
* $Revision: 1.30 $
*
* last change: $Author: vg $ $Date: 2007-03-26 14:47:53 $
* last change: $Author: rt $ $Date: 2008-01-29 15:26:03 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
......@@ -127,6 +127,13 @@
#ifndef _COM_SUN_STAR_EMBED_XVISUALOBJECT_HPP_
#include <com/sun/star/embed/XVisualObject.hpp>
#endif
#ifndef _COM_SUN_STAR_DOCUMENT_MACROEXECMODE_HPP_
#include <com/sun/star/document/MacroExecMode.hpp>
#endif
#ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_
#include <com/sun/star/task/XInteractionHandler.hpp>
#endif
#ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h>
#endif
......@@ -158,6 +165,7 @@ DocumentHolder::DocumentHolder(
m_nMenuHandle(NULL),
m_nMenuShared(NULL),
m_nOLEMenu(NULL),
m_nMacroExecMode( document::MacroExecMode::USE_CONFIG ),
m_bLink( sal_False )
{
static const ::rtl::OUString aServiceName (
......@@ -178,6 +186,95 @@ DocumentHolder::~DocumentHolder()
}
void DocumentHolder::LoadDocInFrame( sal_Bool bPluginMode )
{
uno::Reference<frame::XComponentLoader> xComponentLoader(
m_xFrame,uno::UNO_QUERY);
if( xComponentLoader.is() && m_xDocument.is() )
{
uno::Reference< task::XInteractionHandler > xHandler(
m_xFactory->createInstance(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ),
uno::UNO_QUERY );
uno::Any aAny;
sal_Int32 nLen = 3;
uno::Sequence<beans::PropertyValue> aSeq( nLen );
aAny <<= uno::Reference<uno::XInterface>(
m_xDocument, uno::UNO_QUERY);
aSeq[0] = beans::PropertyValue(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("Model")),
-1,
aAny,
beans::PropertyState_DIRECT_VALUE);
aAny <<= sal_False;
aSeq[1] = beans::PropertyValue(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("ReadOnly")),
-1,
aAny,
beans::PropertyState_DIRECT_VALUE);
aAny <<= (sal_Bool) sal_True;
aSeq[2] = beans::PropertyValue(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("NoAutoSave")),
-1,
aAny,
beans::PropertyState_DIRECT_VALUE);
if ( bPluginMode )
{
aSeq.realloc( ++nLen );
aAny <<= (sal_Int16) 3;
aSeq[nLen-1] = beans::PropertyValue(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("PluginMode")),
-1,
aAny,
beans::PropertyState_DIRECT_VALUE);
}
if ( xHandler.is() )
{
aSeq.realloc( nLen+=2 );
aAny <<= xHandler;
aSeq[nLen-2] = beans::PropertyValue(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("InteractionHandler")),
-1,
aAny,
beans::PropertyState_DIRECT_VALUE);
aAny <<= m_nMacroExecMode;
aSeq[nLen-1] = beans::PropertyValue(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("MacroExecutionMode")),
-1,
aAny,
beans::PropertyState_DIRECT_VALUE);
}
xComponentLoader->loadComponentFromURL(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("private:object")),
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_self")),
0,
aSeq);
uno::Sequence< beans::PropertyValue > aResArgs = m_xDocument->getArgs();
for ( int nInd = 0; nInd < aResArgs.getLength(); nInd++ )
if ( aResArgs[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MacroExecutionMode" ) ) ) )
{
aResArgs[nInd].Value >>= m_nMacroExecMode;
break;
}
}
}
void DocumentHolder::OnPosRectChanged(LPRECT lpRect) const
{
lpRect->left += m_aBorder.left;
......@@ -226,6 +323,9 @@ HRESULT DocumentHolder::InPlaceActivate(
return NOERROR;
}
if ( !m_xDocument.is() )
return ERROR;
//1. Initialization, obtaining interfaces, OnInPlaceActivate.
hr=pActiveSite->QueryInterface(
IID_IOleInPlaceSite,
......@@ -259,6 +359,8 @@ HRESULT DocumentHolder::InPlaceActivate(
uno::Sequence<sal_Int8> aProcessIdent(16);
rtl_getGlobalProcessId((sal_uInt8*)aProcessIdent.getArray());
try
{
if(!m_xEditWindow.is())
{ // determine XWindow and window handle of parent
HWND hWndxWinParent(0);
......@@ -372,53 +474,7 @@ HRESULT DocumentHolder::InPlaceActivate(
m_xLayoutManager->setDockingAreaAcceptor(this);
// load the model into the frame
uno::Reference<frame::XComponentLoader> xComponentLoader(
m_xFrame,uno::UNO_QUERY);
if(xComponentLoader.is())
{
uno::Any aAny;
uno::Sequence<beans::PropertyValue> aSeq(4);
aAny <<= uno::Reference<uno::XInterface>(
GetDocument(),uno::UNO_QUERY);
aSeq[0] = beans::PropertyValue(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("Model")),
-1,
aAny,
beans::PropertyState_DIRECT_VALUE);
aAny <<= sal_False;
aSeq[1] = beans::PropertyValue(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("ReadOnly")),
-1,
aAny,
beans::PropertyState_DIRECT_VALUE);
aAny <<= (sal_Int16) 3;
aSeq[2] = beans::PropertyValue(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("PluginMode")),
-1,
aAny,
beans::PropertyState_DIRECT_VALUE);
aAny <<= (sal_Bool) sal_True;
aSeq[3] = beans::PropertyValue(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("NoAutoSave")),
-1,
aAny,
beans::PropertyState_DIRECT_VALUE);
xComponentLoader->loadComponentFromURL(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("private:object")),
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_self")),
0,
aSeq);
}
LoadDocInFrame( sal_True );
static const ::rtl::OUString aDesktopServiceName (
RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.frame.Desktop" ) );
......@@ -473,6 +529,11 @@ HRESULT DocumentHolder::InPlaceActivate(
hr=UIActivate();
m_pIOleIPSite->DiscardUndoState();
}
catch( uno::Exception& )
{
hr = ERROR;
}
return hr;
}
......@@ -900,57 +961,20 @@ void DocumentHolder::ClearInterceptor()
void DocumentHolder::show()
{
if(m_xFrame.is()) {
try
{
if(m_xFrame.is())
{
m_xFrame->activate();
uno::Reference<awt::XTopWindow> xTopWindow(
m_xFrame->getContainerWindow(),uno::UNO_QUERY);
if(xTopWindow.is())
xTopWindow->toFront();
}
else {
uno::Reference<frame::XComponentLoader> xComponentLoader(
DocumentFrame(),uno::UNO_QUERY);
if(xComponentLoader.is())
else if( DocumentFrame().is() )
{
uno::Sequence<beans::PropertyValue> aSeq(3);
LoadDocInFrame( sal_False );
uno::Any aAny;
aAny <<= uno::Reference<uno::XInterface>(
GetDocument(),uno::UNO_QUERY);
aSeq[0] = beans::PropertyValue(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("Model")),
-1,
aAny,
beans::PropertyState_DIRECT_VALUE);
aAny <<= sal_False;
aSeq[1] = beans::PropertyValue(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("ReadOnly")),
-1,
aAny,
beans::PropertyState_DIRECT_VALUE);
aAny <<= (sal_Bool) sal_True;
aSeq[2] = beans::PropertyValue(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("NoAutoSave")),
-1,
aAny,
beans::PropertyState_DIRECT_VALUE);
xComponentLoader->loadComponentFromURL(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("private:object")),
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_self")),
0,
aSeq);
try
{
// get rid of second closer if it is there
uno::Reference< beans::XPropertySet > xProps( m_xFrame, uno::UNO_QUERY );
if ( xProps.is() )
......@@ -964,12 +988,6 @@ void DocumentHolder::show()
uno::makeAny( uno::Reference< frame::XStatusListener >() ) );
}
}
}
catch( uno::Exception& )
{
OSL_ENSURE( sal_False, "Can not adjust the frame!\n" );
}
if ( !m_bLink )
{
......@@ -981,11 +999,16 @@ void DocumentHolder::show()
catch( uno::Exception& )
{}
}
}
if ( !m_bLink )
setTitle(m_aDocumentNamePart);
}
}
catch( uno::Exception& )
{
OSL_ENSURE( sal_False, "Can not show the frame!\n" );
}
}
void DocumentHolder::resizeWin( const SIZEL& rNewSize )
......
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