2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-07 17:28:03 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-07 17:28:03 +00:00
|
|
|
* $RCSfile: partwnd.cxx,v $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-07 17:28:03 +00:00
|
|
|
* $Revision: 1.14 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-07 17:28:03 +00:00
|
|
|
* last change: $Author: rt $ $Date: 2005-09-07 18:28:02 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-07 17:28:03 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-07 17:28:03 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-07 17:28:03 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-07 17:28:03 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-07 17:28:03 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
// includes ******************************************************************
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
|
|
|
|
#include <com/sun/star/awt/XWindow.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_TASK_XSTATUSINDICATOR_HPP_
|
|
|
|
#include <com/sun/star/task/XStatusIndicator.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
|
|
|
|
#include <com/sun/star/uno/Reference.h>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
|
|
|
|
#include <com/sun/star/uno/Sequence.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
|
|
|
|
#include <com/sun/star/beans/PropertyValue.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_UTIL_URL_HPP_
|
|
|
|
#include <com/sun/star/util/URL.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
|
|
|
|
#include <com/sun/star/frame/XFrame.hpp>
|
|
|
|
#endif
|
2002-05-23 12:16:46 +00:00
|
|
|
#ifndef _COM_SUN_STAR_UTIL_XCLOSEABLE_HPP_
|
|
|
|
#include <com/sun/star/util/XCloseable.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_UTIL_CLOSEVETOEXCEPTION_HPP_
|
|
|
|
#include <com/sun/star/util/CloseVetoException.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
|
|
|
|
#include <com/sun/star/lang/XComponent.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
|
|
|
|
#include <com/sun/star/lang/DisposedException.hpp>
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
#ifndef _COM_SUN_STAR_FRAME_XCONTROLLER_HPP_
|
|
|
|
#include <com/sun/star/frame/XController.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
|
|
|
|
#include <com/sun/star/awt/PosSize.hpp>
|
|
|
|
#endif
|
2000-10-23 11:10:27 +00:00
|
|
|
#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
|
|
|
|
#include <comphelper/processfactory.hxx>
|
|
|
|
#endif
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <toolkit/helper/vclunohelper.hxx>
|
|
|
|
|
|
|
|
#include "sfxsids.hrc"
|
2000-10-23 11:10:27 +00:00
|
|
|
#include "partwnd.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "bindings.hxx"
|
2000-10-30 13:12:23 +00:00
|
|
|
#include "dispatch.hxx"
|
|
|
|
#include "viewfrm.hxx"
|
|
|
|
#include "frame.hxx"
|
2000-10-23 11:10:27 +00:00
|
|
|
#include "sfxuno.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-10-23 11:10:27 +00:00
|
|
|
/*
|
2000-09-18 16:07:07 +00:00
|
|
|
// class SfxPartwinFrame_Impl ------------------------------------------
|
|
|
|
|
|
|
|
class SfxPartwinFrame_Impl : public SfxUnoFrame
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SfxPopupStatusIndicator* pIndicator;
|
|
|
|
SfxPartDockWnd_Impl* pBeamer;
|
|
|
|
|
|
|
|
virtual void SAL_CALL initialize(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > & aPeer) throw ( ::com::sun::star::uno::RuntimeException );
|
|
|
|
virtual SfxFrame* CreateFrame( Window* pParent );
|
|
|
|
virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > SAL_CALL getStatusIndicator(void) throw ( ::com::sun::star::uno::RuntimeException );
|
|
|
|
void dispatch_Impl( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs );
|
|
|
|
};
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > SAL_CALL SfxPartwinFrame_Impl::getStatusIndicator(void) throw ( ::com::sun::star::uno::RuntimeException )
|
|
|
|
{
|
|
|
|
return pIndicator->GetInterface();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SfxPartwinFrame_Impl::dispatch_Impl( const ::com::sun::star::util::URL& rURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs )
|
|
|
|
{
|
|
|
|
if ( !pBeamer )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if ( rURL.Protocol.compareToAscii(".uno:") == 0 )
|
|
|
|
{
|
|
|
|
if ( rURL.Path.compareToAscii("Reload") == 0)
|
|
|
|
{
|
|
|
|
SfxUnoFrame::dispatch_Impl( rURL, rArgs );
|
|
|
|
if ( pBeamer->IsAutoHide_Impl() )
|
|
|
|
pBeamer->AutoShow_Impl( sal_True );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
SfxUnoFrame::dispatch_Impl( rURL, rArgs );
|
|
|
|
|
|
|
|
if ( rURL.Complete.len() )
|
|
|
|
{
|
|
|
|
if ( pBeamer->IsAutoHide_Impl() )
|
|
|
|
pBeamer->AutoShow_Impl( sal_True );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xTmp( this );
|
|
|
|
SfxApplication* pApp = SFX_APP();
|
2000-12-18 08:08:26 +00:00
|
|
|
pApp->SetChildWindow( SID_BROWSER, sal_False );
|
|
|
|
pApp->GetBindings().Invalidate( SID_BROWSER );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-10-23 11:10:27 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
void SAL_CALL SfxPartwinFrame_Impl::initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > & aWindow ) throw ( ::com::sun::star::uno::RuntimeException )
|
|
|
|
{
|
|
|
|
setName( rtl::OUString::createFromAscii("_partwindow") );
|
|
|
|
SetContainerWindow_Impl( aWindow );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
SfxFrame* SfxPartwinFrame_Impl::CreateFrame( Window* pParent )
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2000-10-23 11:10:27 +00:00
|
|
|
*/
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
//****************************************************************************
|
|
|
|
// SfxPartChildWnd_Impl
|
|
|
|
//****************************************************************************
|
|
|
|
|
2000-12-18 08:08:26 +00:00
|
|
|
SFX_IMPL_DOCKINGWINDOW( SfxPartChildWnd_Impl, SID_BROWSER );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
SfxPartChildWnd_Impl::SfxPartChildWnd_Impl
|
|
|
|
(
|
|
|
|
Window* pParent,
|
|
|
|
sal_uInt16 nId,
|
|
|
|
SfxBindings* pBindings,
|
|
|
|
SfxChildWinInfo* pInfo
|
|
|
|
)
|
|
|
|
: SfxChildWindow( pParent, nId )
|
|
|
|
{
|
|
|
|
// Window erzeugen
|
2000-10-23 11:10:27 +00:00
|
|
|
pWindow = new SfxPartDockWnd_Impl( pBindings, this, pParent, WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK );
|
2000-09-18 16:07:07 +00:00
|
|
|
eChildAlignment = SFX_ALIGN_TOP;
|
2002-09-30 16:05:42 +00:00
|
|
|
if ( pInfo )
|
|
|
|
pInfo->nFlags |= SFX_CHILDWIN_FORCEDOCK;
|
|
|
|
|
2003-06-27 08:11:35 +00:00
|
|
|
((SfxDockingWindow*)pWindow)->SetFloatingSize( Size( 175, 175 ) );
|
|
|
|
pWindow->SetSizePixel( Size( 175, 175 ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
( ( SfxDockingWindow* ) pWindow )->Initialize( pInfo );
|
|
|
|
}
|
|
|
|
|
2000-12-07 10:23:05 +00:00
|
|
|
SfxPartChildWnd_Impl::~SfxPartChildWnd_Impl()
|
|
|
|
{
|
2001-11-28 10:23:58 +00:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame = GetFrame();
|
|
|
|
|
|
|
|
// If xFrame=NULL release pMgr! Because this window lives longer then the manager!
|
|
|
|
// In these case we got a xFrame->dispose() call from outside ... and has release our
|
|
|
|
// frame reference in our own DisposingListener.
|
|
|
|
// But don't do it, if xFrame already exist. Then dispose() must come from inside ...
|
|
|
|
// and we need a valid pMgr for further operations ...
|
|
|
|
|
2003-03-27 10:29:38 +00:00
|
|
|
SfxPartDockWnd_Impl* pWin = (SfxPartDockWnd_Impl*) pWindow;
|
|
|
|
// if( pWin != NULL && !xFrame.is() )
|
|
|
|
// pWin->ReleaseChildWindow_Impl();
|
|
|
|
/*
|
2001-11-28 10:23:58 +00:00
|
|
|
// Release frame and window.
|
|
|
|
// If frame reference is valid here ... start dieing from inside by calling dispose().
|
|
|
|
SetFrame( NULL );
|
2000-12-07 10:23:05 +00:00
|
|
|
pWindow = NULL;
|
2003-03-27 10:29:38 +00:00
|
|
|
*/
|
2002-01-07 11:12:09 +00:00
|
|
|
if ( pWin && xFrame == pWin->GetBindings().GetActiveFrame() )
|
2003-03-27 10:29:38 +00:00
|
|
|
pWin->GetBindings().SetActiveFrame( NULL );
|
|
|
|
/*
|
2001-11-28 10:23:58 +00:00
|
|
|
if( xFrame.is() )
|
2002-05-23 12:16:46 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > xCloseable ( xFrame, ::com::sun::star::uno::UNO_QUERY );
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xDisposeable( xFrame, ::com::sun::star::uno::UNO_QUERY );
|
|
|
|
if (xCloseable.is())
|
|
|
|
xCloseable->close(sal_True);
|
|
|
|
else
|
|
|
|
if (xDisposeable.is())
|
|
|
|
xDisposeable->dispose();
|
|
|
|
}
|
|
|
|
catch( ::com::sun::star::util::CloseVetoException& )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
catch( ::com::sun::star::lang::DisposedException& )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
2003-03-27 10:29:38 +00:00
|
|
|
*/
|
2000-12-07 10:23:05 +00:00
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
sal_Bool SfxPartChildWnd_Impl::QueryClose()
|
|
|
|
{
|
|
|
|
return ( (SfxPartDockWnd_Impl*)pWindow )->QueryClose();
|
|
|
|
}
|
|
|
|
|
|
|
|
//****************************************************************************
|
|
|
|
// SfxPartDockWnd_Impl
|
|
|
|
//****************************************************************************
|
|
|
|
|
|
|
|
SfxPartDockWnd_Impl::SfxPartDockWnd_Impl
|
|
|
|
(
|
|
|
|
SfxBindings* pBindings,
|
|
|
|
SfxChildWindow* pChildWin,
|
|
|
|
Window* pParent,
|
|
|
|
WinBits nBits
|
2000-10-23 11:10:27 +00:00
|
|
|
)
|
|
|
|
: SfxDockingWindow( pBindings, pChildWin, pParent, nBits )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-11-28 10:23:58 +00:00
|
|
|
::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > xFrame(
|
2000-10-23 11:10:27 +00:00
|
|
|
::comphelper::getProcessServiceFactory()->createInstance(
|
|
|
|
DEFINE_CONST_UNICODE("com.sun.star.frame.Frame") ), ::com::sun::star::uno::UNO_QUERY );
|
2001-11-28 10:23:58 +00:00
|
|
|
xFrame->initialize( VCLUnoHelper::GetInterface ( this ) );
|
|
|
|
pChildWin->SetFrame( xFrame );
|
2000-12-05 11:45:18 +00:00
|
|
|
if ( pBindings->GetDispatcher() )
|
|
|
|
{
|
|
|
|
::com::sun::star::uno::Reference < ::com::sun::star::frame::XFramesSupplier >
|
|
|
|
xSupp ( pBindings->GetDispatcher()->GetFrame()->GetFrame()->GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY );
|
|
|
|
if ( xSupp.is() )
|
2001-11-28 10:23:58 +00:00
|
|
|
xSupp->getFrames()->append( xFrame );
|
2000-12-05 11:45:18 +00:00
|
|
|
}
|
2000-12-07 10:23:05 +00:00
|
|
|
else
|
|
|
|
DBG_ERROR("Bindings without Dispatcher!");
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//****************************************************************************
|
|
|
|
|
|
|
|
SfxPartDockWnd_Impl::~SfxPartDockWnd_Impl()
|
|
|
|
{
|
2000-12-07 10:23:05 +00:00
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
//****************************************************************************
|
|
|
|
|
|
|
|
Rectangle impl_Rectangle_Struct2Object( const ::com::sun::star::awt::Rectangle& aRectangleStruct )
|
|
|
|
{
|
|
|
|
return Rectangle(aRectangleStruct.X,aRectangleStruct.Y,aRectangleStruct.Width,aRectangleStruct.Height);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SfxPartDockWnd_Impl::Resize()
|
|
|
|
|
|
|
|
/* [Beschreibung]
|
|
|
|
Anpassung der Gr"osse der Controls an die neue Windowgr"osse
|
|
|
|
*/
|
|
|
|
|
|
|
|
{
|
|
|
|
SfxDockingWindow::Resize();
|
|
|
|
}
|
|
|
|
|
|
|
|
//****************************************************************************
|
|
|
|
|
|
|
|
sal_Bool SfxPartDockWnd_Impl::QueryClose()
|
|
|
|
{
|
|
|
|
sal_Bool bClose = sal_True;
|
2001-11-28 10:23:58 +00:00
|
|
|
SfxChildWindow* pChild = GetChildWindow_Impl();
|
|
|
|
if( pChild )
|
|
|
|
{
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame = pChild->GetFrame();
|
|
|
|
if( xFrame.is() )
|
|
|
|
{
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > xCtrl = xFrame->getController();
|
|
|
|
if( xCtrl.is() )
|
|
|
|
bClose = xCtrl->suspend( sal_True );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return bClose;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//****************************************************************************
|
|
|
|
|
|
|
|
long SfxPartDockWnd_Impl::Notify( NotifyEvent& rEvt )
|
|
|
|
{
|
2001-11-28 10:23:58 +00:00
|
|
|
if( rEvt.GetType() == EVENT_GETFOCUS )
|
|
|
|
{
|
|
|
|
SfxChildWindow* pChild = GetChildWindow_Impl();
|
|
|
|
if( pChild )
|
|
|
|
{
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame = pChild->GetFrame();
|
|
|
|
if( xFrame.is() )
|
|
|
|
xFrame->activate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
return SfxDockingWindow::Notify( rEvt );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SfxPartDockWnd_Impl::FillInfo( SfxChildWinInfo& rInfo ) const
|
|
|
|
{
|
|
|
|
SfxDockingWindow::FillInfo( rInfo );
|
|
|
|
rInfo.bVisible = sal_False;
|
|
|
|
}
|
|
|
|
|
|
|
|
|