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 @@ ...@@ -4,9 +4,9 @@
* *
* $RCSfile: docholder.cxx,v $ * $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 Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1. * the terms of GNU Lesser General Public License Version 2.1.
...@@ -127,6 +127,13 @@ ...@@ -127,6 +127,13 @@
#ifndef _COM_SUN_STAR_EMBED_XVISUALOBJECT_HPP_ #ifndef _COM_SUN_STAR_EMBED_XVISUALOBJECT_HPP_
#include <com/sun/star/embed/XVisualObject.hpp> #include <com/sun/star/embed/XVisualObject.hpp>
#endif #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_ #ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h> #include <osl/diagnose.h>
#endif #endif
...@@ -158,6 +165,7 @@ DocumentHolder::DocumentHolder( ...@@ -158,6 +165,7 @@ DocumentHolder::DocumentHolder(
m_nMenuHandle(NULL), m_nMenuHandle(NULL),
m_nMenuShared(NULL), m_nMenuShared(NULL),
m_nOLEMenu(NULL), m_nOLEMenu(NULL),
m_nMacroExecMode( document::MacroExecMode::USE_CONFIG ),
m_bLink( sal_False ) m_bLink( sal_False )
{ {
static const ::rtl::OUString aServiceName ( static const ::rtl::OUString aServiceName (
...@@ -178,6 +186,95 @@ DocumentHolder::~DocumentHolder() ...@@ -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 void DocumentHolder::OnPosRectChanged(LPRECT lpRect) const
{ {
lpRect->left += m_aBorder.left; lpRect->left += m_aBorder.left;
...@@ -226,6 +323,9 @@ HRESULT DocumentHolder::InPlaceActivate( ...@@ -226,6 +323,9 @@ HRESULT DocumentHolder::InPlaceActivate(
return NOERROR; return NOERROR;
} }
if ( !m_xDocument.is() )
return ERROR;
//1. Initialization, obtaining interfaces, OnInPlaceActivate. //1. Initialization, obtaining interfaces, OnInPlaceActivate.
hr=pActiveSite->QueryInterface( hr=pActiveSite->QueryInterface(
IID_IOleInPlaceSite, IID_IOleInPlaceSite,
...@@ -259,6 +359,8 @@ HRESULT DocumentHolder::InPlaceActivate( ...@@ -259,6 +359,8 @@ HRESULT DocumentHolder::InPlaceActivate(
uno::Sequence<sal_Int8> aProcessIdent(16); uno::Sequence<sal_Int8> aProcessIdent(16);
rtl_getGlobalProcessId((sal_uInt8*)aProcessIdent.getArray()); rtl_getGlobalProcessId((sal_uInt8*)aProcessIdent.getArray());
try
{
if(!m_xEditWindow.is()) if(!m_xEditWindow.is())
{ // determine XWindow and window handle of parent { // determine XWindow and window handle of parent
HWND hWndxWinParent(0); HWND hWndxWinParent(0);
...@@ -372,53 +474,7 @@ HRESULT DocumentHolder::InPlaceActivate( ...@@ -372,53 +474,7 @@ HRESULT DocumentHolder::InPlaceActivate(
m_xLayoutManager->setDockingAreaAcceptor(this); m_xLayoutManager->setDockingAreaAcceptor(this);
// load the model into the frame // load the model into the frame
uno::Reference<frame::XComponentLoader> xComponentLoader( LoadDocInFrame( sal_True );
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);
}
static const ::rtl::OUString aDesktopServiceName ( static const ::rtl::OUString aDesktopServiceName (
RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.frame.Desktop" ) ); RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.frame.Desktop" ) );
...@@ -473,6 +529,11 @@ HRESULT DocumentHolder::InPlaceActivate( ...@@ -473,6 +529,11 @@ HRESULT DocumentHolder::InPlaceActivate(
hr=UIActivate(); hr=UIActivate();
m_pIOleIPSite->DiscardUndoState(); m_pIOleIPSite->DiscardUndoState();
}
catch( uno::Exception& )
{
hr = ERROR;
}
return hr; return hr;
} }
...@@ -900,57 +961,20 @@ void DocumentHolder::ClearInterceptor() ...@@ -900,57 +961,20 @@ void DocumentHolder::ClearInterceptor()
void DocumentHolder::show() void DocumentHolder::show()
{ {
if(m_xFrame.is()) { try
{
if(m_xFrame.is())
{
m_xFrame->activate(); m_xFrame->activate();
uno::Reference<awt::XTopWindow> xTopWindow( uno::Reference<awt::XTopWindow> xTopWindow(
m_xFrame->getContainerWindow(),uno::UNO_QUERY); m_xFrame->getContainerWindow(),uno::UNO_QUERY);
if(xTopWindow.is()) if(xTopWindow.is())
xTopWindow->toFront(); xTopWindow->toFront();
} }
else { else if( DocumentFrame().is() )
uno::Reference<frame::XComponentLoader> xComponentLoader(
DocumentFrame(),uno::UNO_QUERY);
if(xComponentLoader.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 // get rid of second closer if it is there
uno::Reference< beans::XPropertySet > xProps( m_xFrame, uno::UNO_QUERY ); uno::Reference< beans::XPropertySet > xProps( m_xFrame, uno::UNO_QUERY );
if ( xProps.is() ) if ( xProps.is() )
...@@ -964,12 +988,6 @@ void DocumentHolder::show() ...@@ -964,12 +988,6 @@ void DocumentHolder::show()
uno::makeAny( uno::Reference< frame::XStatusListener >() ) ); uno::makeAny( uno::Reference< frame::XStatusListener >() ) );
} }
} }
}
catch( uno::Exception& )
{
OSL_ENSURE( sal_False, "Can not adjust the frame!\n" );
}
if ( !m_bLink ) if ( !m_bLink )
{ {
...@@ -981,11 +999,16 @@ void DocumentHolder::show() ...@@ -981,11 +999,16 @@ void DocumentHolder::show()
catch( uno::Exception& ) catch( uno::Exception& )
{} {}
} }
}
if ( !m_bLink ) if ( !m_bLink )
setTitle(m_aDocumentNamePart); setTitle(m_aDocumentNamePart);
} }
}
catch( uno::Exception& )
{
OSL_ENSURE( sal_False, "Can not show the frame!\n" );
}
} }
void DocumentHolder::resizeWin( const SIZEL& rNewSize ) 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