2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
|
*
|
2005-09-07 18:30:26 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-07 18:30:26 +00:00
|
|
|
* $RCSfile: topfrm.cxx,v $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2006-11-01 17:29:27 +00:00
|
|
|
* $Revision: 1.86 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2006-11-01 17:29:27 +00:00
|
|
|
* last change: $Author: vg $ $Date: 2006-11-01 18:29:27 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2005-09-07 18:30:26 +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 18:30:26 +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 18:30:26 +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 18:30:26 +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 18:30:26 +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
|
|
|
*
|
|
|
|
|
************************************************************************/
|
2006-09-17 15:50:53 +00:00
|
|
|
|
|
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
|
#include "precompiled_sfx2.hxx"
|
2004-09-08 14:47:13 +00:00
|
|
|
#ifndef GCC
|
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
#include "topfrm.hxx"
|
|
|
|
|
|
2005-03-01 19:04:11 +00:00
|
|
|
#ifndef _COM_SUN_STAR_FRAME_XMODULEMANAGER_HPP_
|
|
|
|
|
#include <com/sun/star/frame/XModuleManager.hpp>
|
2004-02-25 14:48:48 +00:00
|
|
|
#endif
|
2003-03-27 10:29:38 +00:00
|
|
|
#ifndef _COM_SUN_STAR_UTIL_XURLTRANSFORMER_HPP_
|
|
|
|
|
#include <com/sun/star/util/XURLTransformer.hpp>
|
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
|
|
|
|
|
#include <com/sun/star/uno/Reference.h>
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
|
|
|
|
|
#include <com/sun/star/frame/XFrame.hpp>
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
|
2000-10-23 11:26:53 +00:00
|
|
|
#include <comphelper/processfactory.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#endif
|
|
|
|
|
#ifndef _COM_SUN_STAR_FRAME_XFRAMESSUPPLIER_HPP_
|
|
|
|
|
#include <com/sun/star/frame/XFramesSupplier.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
|
2000-09-18 16:07:07 +00:00
|
|
|
#ifndef _TOOLKIT_UNOHLP_HXX
|
|
|
|
|
#include <toolkit/helper/vclunohelper.hxx>
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _UNO_COM_SUN_STAR_AWT_POSSIZE_HPP_
|
|
|
|
|
#include <com/sun/star/awt/PosSize.hpp>
|
|
|
|
|
#endif
|
2003-03-27 10:29:38 +00:00
|
|
|
#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
|
|
|
|
|
#include <com/sun/star/container/XIndexAccess.hpp>
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _COM_SUN_STAR_CONTAINER_XPROPERTYSET_HPP_
|
|
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
|
|
|
|
#endif
|
2005-03-01 19:04:11 +00:00
|
|
|
#ifndef _COM_SUN_STAR_FRAME_XLAYOUTMANAGER_HPP_
|
|
|
|
|
#include <com/sun/star/frame/XLayoutManager.hpp>
|
2004-02-25 14:48:48 +00:00
|
|
|
#endif
|
2005-03-29 14:41:39 +00:00
|
|
|
#ifndef _COM_SUN_STAR_BEANS_NAMEDVALUE_HPP_
|
|
|
|
|
#include <com/sun/star/beans/NamedValue.hpp>
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _COM_SUN_STAR_BEANS_XMATERIALHOLDER_HPP_
|
|
|
|
|
#include <com/sun/star/beans/XMaterialHolder.hpp>
|
|
|
|
|
#endif
|
2006-11-01 17:29:27 +00:00
|
|
|
#ifndef _COM_SUN_STAR_AWT_XWINDOW2_HPP_
|
|
|
|
|
#include <com/sun/star/awt/XWindow2.hpp>
|
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
#ifndef _SV_MENU_HXX
|
|
|
|
|
#include <vcl/menu.hxx>
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _SFXRECTITEM_HXX //autogen
|
|
|
|
|
#include <svtools/rectitem.hxx>
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _SFXINTITEM_HXX //autogen
|
|
|
|
|
#include <svtools/intitem.hxx>
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _SFXENUMITEM_HXX //autogen
|
|
|
|
|
#include <svtools/eitem.hxx>
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _SFXSTRITEM_HXX //autogen
|
|
|
|
|
#include <svtools/stritem.hxx>
|
|
|
|
|
#endif
|
2001-07-03 11:22:17 +00:00
|
|
|
#ifndef SVTOOLS_ASYNCLINK_HXX
|
|
|
|
|
#include <svtools/asynclink.hxx>
|
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
#ifndef _SFXECODE_HXX
|
|
|
|
|
#include <svtools/sfxecode.hxx>
|
|
|
|
|
#endif
|
|
|
|
|
#include <vcl/dialog.hxx>
|
|
|
|
|
#include <svtools/urihelper.hxx>
|
2002-07-08 06:39:55 +00:00
|
|
|
#include <svtools/moduleoptions.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-11-17 09:25:21 +00:00
|
|
|
#ifndef _UTL_CONFIGMGR_HXX_
|
|
|
|
|
#include <unotools/configmgr.hxx>
|
|
|
|
|
#endif
|
|
|
|
|
#include <unotools/bootstrap.hxx>
|
|
|
|
|
|
2004-08-31 11:37:46 +00:00
|
|
|
#include <sfxresid.hxx>
|
|
|
|
|
#include <../appl/app.hrc>
|
|
|
|
|
|
2006-05-02 16:06:52 +00:00
|
|
|
// wg. pTopFrames
|
|
|
|
|
#include "appdata.hxx"
|
|
|
|
|
#include "app.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "sfx.hrc"
|
|
|
|
|
#include "objsh.hxx"
|
|
|
|
|
#include "docfile.hxx"
|
|
|
|
|
#include "viewsh.hxx"
|
|
|
|
|
#include "bindings.hxx"
|
|
|
|
|
#include "dispatch.hxx"
|
|
|
|
|
#include "request.hxx"
|
|
|
|
|
#include "objitem.hxx"
|
|
|
|
|
#include "objface.hxx"
|
|
|
|
|
#include "msg.hxx"
|
|
|
|
|
#include "objshimp.hxx"
|
|
|
|
|
#include "workwin.hxx"
|
|
|
|
|
#include "sfxtypes.hxx"
|
|
|
|
|
#include "splitwin.hxx"
|
|
|
|
|
#include "arrdecl.hxx"
|
2001-06-26 13:51:18 +00:00
|
|
|
#include "sfxhelp.hxx"
|
2001-07-03 16:35:30 +00:00
|
|
|
#include "fcontnr.hxx"
|
|
|
|
|
#include "docfac.hxx"
|
2001-11-15 14:13:16 +00:00
|
|
|
#include "statcach.hxx"
|
2005-03-23 13:26:23 +00:00
|
|
|
#include "event.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-09-20 09:16:11 +00:00
|
|
|
using namespace ::com::sun::star;
|
2000-09-18 16:07:07 +00:00
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
|
using namespace ::com::sun::star::frame;
|
2002-05-23 12:16:46 +00:00
|
|
|
using namespace ::com::sun::star::util;
|
2003-03-27 10:29:38 +00:00
|
|
|
using namespace ::com::sun::star::container;
|
|
|
|
|
using namespace ::com::sun::star::beans;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
#define SfxTopViewFrame
|
|
|
|
|
#include "sfxslots.hxx"
|
|
|
|
|
|
2006-06-19 21:39:02 +00:00
|
|
|
DBG_NAME(SfxTopViewFrame)
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-09-20 09:16:11 +00:00
|
|
|
#include <comphelper/sequenceashashmap.hxx>
|
|
|
|
|
static ::rtl::OUString GetModuleName_Impl( const ::rtl::OUString& sDocService )
|
|
|
|
|
{
|
2005-03-01 19:04:11 +00:00
|
|
|
uno::Reference< container::XNameAccess > xMM( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager")), uno::UNO_QUERY );
|
2004-09-20 09:16:11 +00:00
|
|
|
::rtl::OUString sVar;
|
|
|
|
|
if ( !xMM.is() )
|
|
|
|
|
return sVar;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
::comphelper::SequenceAsHashMap aAnalyzer( xMM->getByName(sDocService) );
|
|
|
|
|
sVar = aAnalyzer.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii("ooSetupFactoryUIName"), ::rtl::OUString() );
|
|
|
|
|
}
|
|
|
|
|
catch( uno::Exception& )
|
|
|
|
|
{
|
|
|
|
|
sVar = ::rtl::OUString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return sVar;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
class SfxTopFrame_Impl
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
Window* pWindow; // maybe external
|
|
|
|
|
BOOL bHidden;
|
|
|
|
|
BOOL bLockResize;
|
2001-06-21 12:57:41 +00:00
|
|
|
BOOL bMenuBarOn;
|
2000-09-18 16:07:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class SfxTopWindow_Impl : public Window
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
SfxTopFrame* pFrame;
|
|
|
|
|
|
|
|
|
|
SfxTopWindow_Impl( SfxTopFrame* pF );
|
|
|
|
|
// : Window( pF->pImp->pWindow, WB_CLIPCHILDREN | WB_NODIALOGCONTROL | WB_3DLOOK )
|
|
|
|
|
// , pFrame( pF )
|
|
|
|
|
// { SetBackground(); }
|
|
|
|
|
~SfxTopWindow_Impl( );
|
|
|
|
|
|
2002-04-23 16:08:25 +00:00
|
|
|
virtual void DataChanged( const DataChangedEvent& rDCEvt );
|
2000-09-18 16:07:07 +00:00
|
|
|
virtual void StateChanged( StateChangedType nStateChange );
|
|
|
|
|
virtual long PreNotify( NotifyEvent& rNEvt );
|
|
|
|
|
virtual long Notify( NotifyEvent& rEvt );
|
|
|
|
|
virtual void Resize();
|
|
|
|
|
virtual void GetFocus();
|
|
|
|
|
void DoResize();
|
2002-10-07 09:19:26 +00:00
|
|
|
DECL_LINK( CloserHdl, void* );
|
2000-09-18 16:07:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
SfxTopWindow_Impl::SfxTopWindow_Impl( SfxTopFrame* pF )
|
2001-11-09 14:31:35 +00:00
|
|
|
: Window( pF->pImp->pWindow, WB_BORDER | WB_CLIPCHILDREN | WB_NODIALOGCONTROL | WB_3DLOOK )
|
2000-09-18 16:07:07 +00:00
|
|
|
, pFrame( pF )
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SfxTopWindow_Impl::~SfxTopWindow_Impl( )
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-23 16:08:25 +00:00
|
|
|
void SfxTopWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
|
|
|
|
|
{
|
|
|
|
|
Window::DataChanged( rDCEvt );
|
|
|
|
|
SfxWorkWindow *pWorkWin = pFrame->GetWorkWindow_Impl();
|
|
|
|
|
if ( pWorkWin )
|
|
|
|
|
pWorkWin->DataChanged_Impl( rDCEvt );
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
long SfxTopWindow_Impl::Notify( NotifyEvent& rNEvt )
|
|
|
|
|
{
|
2002-08-23 10:10:28 +00:00
|
|
|
if ( pFrame->IsClosing_Impl() || !pFrame->GetFrameInterface().is() )
|
2000-09-18 16:07:07 +00:00
|
|
|
return sal_False;
|
|
|
|
|
|
2001-11-01 08:17:53 +00:00
|
|
|
SfxViewFrame* pView = pFrame->GetCurrentViewFrame();
|
2004-10-04 20:04:13 +00:00
|
|
|
if ( !pView || !pView->GetObjectShell() )
|
2001-11-15 14:13:16 +00:00
|
|
|
return Window::Notify( rNEvt );
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( rNEvt.GetType() == EVENT_GETFOCUS )
|
|
|
|
|
{
|
2006-11-01 17:29:27 +00:00
|
|
|
if ( pView->GetViewShell() && !pView->GetViewShell()->GetUIActiveIPClient_Impl() && !pFrame->IsInPlace() )
|
2000-09-18 16:07:07 +00:00
|
|
|
pView->MakeActive_Impl( FALSE );
|
2005-03-23 13:26:23 +00:00
|
|
|
|
2006-11-01 17:29:27 +00:00
|
|
|
// TODO/LATER: do we still need this code?
|
2001-06-26 13:51:18 +00:00
|
|
|
Window* pWindow = rNEvt.GetWindow();
|
2001-07-10 10:32:11 +00:00
|
|
|
ULONG nHelpId = 0;
|
|
|
|
|
while ( !nHelpId && pWindow )
|
|
|
|
|
{
|
|
|
|
|
nHelpId = pWindow->GetHelpId();
|
|
|
|
|
pWindow = pWindow->GetParent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( nHelpId )
|
|
|
|
|
SfxHelp::OpenHelpAgent( pFrame, nHelpId );
|
2006-11-01 17:29:27 +00:00
|
|
|
|
|
|
|
|
return sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-11-01 08:17:53 +00:00
|
|
|
else if( rNEvt.GetType() == EVENT_KEYINPUT )
|
|
|
|
|
{
|
2001-11-06 08:25:33 +00:00
|
|
|
if ( pView->GetViewShell()->KeyInput( *rNEvt.GetKeyEvent() ) )
|
2001-11-02 15:45:24 +00:00
|
|
|
return TRUE;
|
2001-11-01 08:17:53 +00:00
|
|
|
}
|
2003-03-27 10:29:38 +00:00
|
|
|
else if ( rNEvt.GetType() == EVENT_EXECUTEDIALOG /*|| rNEvt.GetType() == EVENT_INPUTDISABLE*/ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-11-15 14:13:16 +00:00
|
|
|
pView->SetModalMode( sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
return sal_True;
|
|
|
|
|
}
|
2003-03-27 10:29:38 +00:00
|
|
|
else if ( rNEvt.GetType() == EVENT_ENDEXECUTEDIALOG /*|| rNEvt.GetType() == EVENT_INPUTENABLE*/ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-03-27 10:29:38 +00:00
|
|
|
//EnableInput( sal_True, sal_True );
|
2001-11-15 14:13:16 +00:00
|
|
|
pView->SetModalMode( sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
return sal_True;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Window::Notify( rNEvt );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long SfxTopWindow_Impl::PreNotify( NotifyEvent& rNEvt )
|
|
|
|
|
{
|
2003-03-27 10:29:38 +00:00
|
|
|
USHORT nType = rNEvt.GetType();
|
|
|
|
|
if ( nType == EVENT_KEYINPUT || nType == EVENT_KEYUP )
|
|
|
|
|
{
|
|
|
|
|
SfxViewFrame* pView = pFrame->GetCurrentViewFrame();
|
|
|
|
|
SfxViewShell* pShell = pView ? pView->GetViewShell() : NULL;
|
|
|
|
|
if ( pShell && pShell->HasKeyListeners_Impl() && pShell->HandleNotifyEvent_Impl( rNEvt ) )
|
|
|
|
|
return sal_True;
|
|
|
|
|
}
|
|
|
|
|
else if ( nType == EVENT_MOUSEBUTTONUP || nType == EVENT_MOUSEBUTTONDOWN )
|
|
|
|
|
{
|
|
|
|
|
Window* pWindow = rNEvt.GetWindow();
|
|
|
|
|
SfxViewFrame* pView = pFrame->GetCurrentViewFrame();
|
|
|
|
|
SfxViewShell* pShell = pView ? pView->GetViewShell() : NULL;
|
|
|
|
|
if ( pShell )
|
|
|
|
|
if ( pWindow == pShell->GetWindow() || pShell->GetWindow()->IsChild( pWindow ) )
|
|
|
|
|
if ( pShell->HasMouseClickListeners_Impl() && pShell->HandleNotifyEvent_Impl( rNEvt ) )
|
|
|
|
|
return sal_True;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( nType == EVENT_MOUSEBUTTONDOWN )
|
2001-02-19 10:55:10 +00:00
|
|
|
{
|
|
|
|
|
Window* pWindow = rNEvt.GetWindow();
|
|
|
|
|
const MouseEvent* pMEvent = rNEvt.GetMouseEvent();
|
|
|
|
|
Point aPos = pWindow->OutputToScreenPixel( pMEvent->GetPosPixel() );
|
|
|
|
|
SfxWorkWindow *pWorkWin = pFrame->GetWorkWindow_Impl();
|
2001-08-15 14:16:26 +00:00
|
|
|
if ( pWorkWin )
|
|
|
|
|
pWorkWin->EndAutoShow_Impl( aPos );
|
2001-02-19 10:55:10 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
return Window::PreNotify( rNEvt );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SfxTopWindow_Impl::GetFocus()
|
|
|
|
|
{
|
2002-09-03 10:47:39 +00:00
|
|
|
if ( pFrame && !pFrame->IsClosing_Impl() && pFrame->GetCurrentViewFrame() && pFrame->GetFrameInterface().is() )
|
2000-09-18 16:07:07 +00:00
|
|
|
pFrame->GetCurrentViewFrame()->MakeActive_Impl( TRUE );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SfxTopWindow_Impl::Resize()
|
|
|
|
|
{
|
2001-12-03 16:46:38 +00:00
|
|
|
if ( IsReallyVisible() || IsReallyShown() || GetOutputSizePixel().Width() )
|
2000-09-18 16:07:07 +00:00
|
|
|
DoResize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SfxTopWindow_Impl::StateChanged( StateChangedType nStateChange )
|
|
|
|
|
{
|
|
|
|
|
if ( nStateChange == STATE_CHANGE_INITSHOW )
|
|
|
|
|
{
|
2006-02-09 12:59:01 +00:00
|
|
|
pFrame->pImp->bHidden = FALSE;
|
2005-01-31 07:46:02 +00:00
|
|
|
if ( pFrame->IsInPlace() )
|
|
|
|
|
// TODO/MBA: workaround for bug in LayoutManager: the final resize does not get through because the
|
|
|
|
|
// LayoutManager works asynchronously and between resize and time execution the DockingAcceptor was exchanged so that
|
|
|
|
|
// the resize event never is sent to the component
|
|
|
|
|
SetSizePixel( GetParent()->GetOutputSizePixel() );
|
2005-03-23 13:26:23 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
DoResize();
|
2005-03-23 13:26:23 +00:00
|
|
|
SfxViewFrame* pView = pFrame->GetCurrentViewFrame();
|
|
|
|
|
if ( pView )
|
|
|
|
|
pView->GetBindings().GetWorkWindow_Impl()->ShowChilds_Impl();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2005-03-23 13:26:23 +00:00
|
|
|
|
|
|
|
|
Window::StateChanged( nStateChange );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SfxTopWindow_Impl::DoResize()
|
|
|
|
|
{
|
|
|
|
|
if ( !pFrame->pImp->bLockResize )
|
|
|
|
|
pFrame->Resize();
|
|
|
|
|
}
|
|
|
|
|
|
2001-11-15 14:13:16 +00:00
|
|
|
class StopButtonTimer_Impl : public Timer
|
|
|
|
|
{
|
|
|
|
|
BOOL bState;
|
|
|
|
|
SfxViewFrame* pFrame;
|
|
|
|
|
protected:
|
|
|
|
|
virtual void Timeout();
|
|
|
|
|
public:
|
|
|
|
|
StopButtonTimer_Impl( SfxViewFrame*);
|
|
|
|
|
void SetButtonState( BOOL bStateP );
|
|
|
|
|
BOOL GetButtonState() const { return bState; }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
StopButtonTimer_Impl::StopButtonTimer_Impl( SfxViewFrame*p)
|
|
|
|
|
: bState( FALSE )
|
|
|
|
|
, pFrame( p )
|
|
|
|
|
{
|
|
|
|
|
SetTimeout( 200 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StopButtonTimer_Impl::SetButtonState( BOOL bStateP )
|
|
|
|
|
{
|
|
|
|
|
if( bStateP )
|
|
|
|
|
{
|
|
|
|
|
bState = TRUE;
|
|
|
|
|
Stop();
|
|
|
|
|
}
|
|
|
|
|
else if( bState )
|
|
|
|
|
Start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StopButtonTimer_Impl::Timeout()
|
|
|
|
|
{
|
|
|
|
|
bState = FALSE;
|
|
|
|
|
pFrame->GetBindings().Invalidate( SID_BROWSE_STOP );
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
class SfxTopViewWin_Impl : public Window
|
|
|
|
|
{
|
|
|
|
|
friend class SfxInternalFrame;
|
|
|
|
|
|
|
|
|
|
BOOL bActive;
|
|
|
|
|
SfxTopViewFrame* pFrame;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
SfxTopViewWin_Impl( SfxTopViewFrame* p,
|
|
|
|
|
Window *pParent, WinBits nBits=0 ) :
|
|
|
|
|
Window( pParent, nBits | WB_BORDER | WB_CLIPCHILDREN ),
|
2004-09-08 14:47:13 +00:00
|
|
|
bActive( FALSE ),
|
|
|
|
|
pFrame( p )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-11-09 14:31:35 +00:00
|
|
|
p->GetFrame()->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual void Resize();
|
|
|
|
|
virtual void StateChanged( StateChangedType nStateChange );
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
|
void SfxTopViewWin_Impl::StateChanged( StateChangedType nStateChange )
|
|
|
|
|
{
|
|
|
|
|
if ( nStateChange == STATE_CHANGE_INITSHOW )
|
2006-02-09 12:59:01 +00:00
|
|
|
{
|
|
|
|
|
SfxObjectShell* pDoc = pFrame->GetObjectShell();
|
|
|
|
|
if ( pDoc && !pFrame->IsVisible_Impl() )
|
|
|
|
|
{
|
|
|
|
|
pDoc->GetMedium()->GetItemSet()->ClearItem( SID_HIDDEN );
|
|
|
|
|
pFrame->Show();
|
|
|
|
|
if ( pDoc->Get_Impl()->bHiddenLockedByAPI )
|
|
|
|
|
{
|
|
|
|
|
pDoc->Get_Impl()->bHiddenLockedByAPI = FALSE;
|
|
|
|
|
pDoc->OwnerLock(FALSE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
pFrame->Resize();
|
2006-02-09 12:59:01 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
|
Window::StateChanged( nStateChange );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SfxTopViewWin_Impl::Resize()
|
|
|
|
|
{
|
2001-12-03 16:46:38 +00:00
|
|
|
if ( IsReallyVisible() || IsReallyShown() || GetOutputSizePixel().Width() )
|
2000-09-18 16:07:07 +00:00
|
|
|
pFrame->Resize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class SfxTopViewFrame_Impl
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
sal_Bool bActive;
|
|
|
|
|
Window* pWindow;
|
2003-03-27 10:29:38 +00:00
|
|
|
String aFactoryName;
|
2001-11-15 14:13:16 +00:00
|
|
|
StopButtonTimer_Impl* pStopButtonTimer;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
SfxTopViewFrame_Impl()
|
|
|
|
|
: bActive( sal_False )
|
|
|
|
|
, pWindow( 0 )
|
2001-11-15 14:13:16 +00:00
|
|
|
, pStopButtonTimer( 0 )
|
2000-09-18 16:07:07 +00:00
|
|
|
{}
|
|
|
|
|
};
|
|
|
|
|
|
2001-07-03 11:22:17 +00:00
|
|
|
static svtools::AsynchronLink* pPendingCloser = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2005-03-29 14:41:39 +00:00
|
|
|
static String _getTabString()
|
|
|
|
|
{
|
|
|
|
|
String result;
|
|
|
|
|
|
|
|
|
|
Reference < XMaterialHolder > xHolder(
|
|
|
|
|
::comphelper::getProcessServiceFactory()->createInstance(
|
|
|
|
|
DEFINE_CONST_UNICODE("com.sun.star.tab.tabreg") ), UNO_QUERY );
|
|
|
|
|
if (xHolder.is())
|
|
|
|
|
{
|
|
|
|
|
rtl::OUString aTabString;
|
|
|
|
|
Sequence< NamedValue > sMaterial;
|
|
|
|
|
if (xHolder->getMaterial() >>= sMaterial) {
|
|
|
|
|
for (int i=0; i < sMaterial.getLength(); i++) {
|
|
|
|
|
if ((sMaterial[i].Name.equalsAscii("title")) &&
|
|
|
|
|
(sMaterial[i].Value >>= aTabString))
|
|
|
|
|
{
|
|
|
|
|
result += ' ';
|
|
|
|
|
result += String(aTabString);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
SfxTopFrame* SfxTopFrame::Create( SfxObjectShell* pDoc, USHORT nViewId, BOOL bHidden, const SfxItemSet* pSet )
|
|
|
|
|
{
|
2000-10-23 11:26:53 +00:00
|
|
|
Reference < XFrame > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
|
2003-03-27 10:29:38 +00:00
|
|
|
SfxTopFrame *pFrame = NULL;
|
|
|
|
|
BOOL bNewView = FALSE;
|
|
|
|
|
if ( pSet )
|
|
|
|
|
{
|
|
|
|
|
SFX_ITEMSET_ARG( pSet, pItem, SfxBoolItem, SID_OPEN_NEW_VIEW, sal_False );
|
|
|
|
|
bNewView = pItem && pItem->GetValue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( pDoc && !bHidden && !bNewView )
|
|
|
|
|
{
|
|
|
|
|
URL aTargetURL;
|
|
|
|
|
aTargetURL.Complete = pDoc->GetMedium()->GetURLObject().GetMainURL( INetURLObject::NO_DECODE );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 10:29:38 +00:00
|
|
|
BOOL bIsBasic = FALSE;
|
|
|
|
|
if ( !aTargetURL.Complete.getLength() )
|
|
|
|
|
{
|
|
|
|
|
String sFactory = String::CreateFromAscii(pDoc->GetFactory().GetShortName());
|
|
|
|
|
bIsBasic = (sFactory.CompareIgnoreCaseToAscii("sbasic")==COMPARE_EQUAL);
|
|
|
|
|
|
|
|
|
|
if (!bIsBasic)
|
|
|
|
|
{
|
|
|
|
|
String aURL = String::CreateFromAscii("private:factory/");
|
|
|
|
|
aURL += sFactory;
|
|
|
|
|
aTargetURL.Complete = aURL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bIsBasic)
|
|
|
|
|
{
|
|
|
|
|
Reference < XFramesSupplier > xSupplier( xDesktop, UNO_QUERY );
|
|
|
|
|
if (xSupplier.is())
|
|
|
|
|
{
|
|
|
|
|
Reference < XIndexAccess > xContainer(xSupplier->getFrames(), UNO_QUERY);
|
|
|
|
|
if (xContainer.is())
|
|
|
|
|
{
|
2005-03-01 19:04:11 +00:00
|
|
|
Reference< ::com::sun::star::frame::XModuleManager > xCheck(::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager" )), UNO_QUERY);
|
2003-03-27 10:29:38 +00:00
|
|
|
sal_Int32 nCount = xContainer->getCount();
|
|
|
|
|
for (sal_Int32 i=0; i<nCount; ++i)
|
|
|
|
|
{
|
2004-02-25 14:48:48 +00:00
|
|
|
try
|
2003-03-27 10:29:38 +00:00
|
|
|
{
|
2004-02-25 14:48:48 +00:00
|
|
|
Reference < XFrame > xFrame;
|
|
|
|
|
if (!(xContainer->getByIndex(i) >>= xFrame) || !xFrame.is())
|
|
|
|
|
continue;
|
|
|
|
|
::rtl::OUString sModule = xCheck->identify(xFrame);
|
|
|
|
|
if (sModule.equalsAscii("com.sun.star.frame.StartModule"))
|
|
|
|
|
{
|
|
|
|
|
pFrame = Create(xFrame);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2003-03-27 10:29:38 +00:00
|
|
|
}
|
2004-02-25 14:48:48 +00:00
|
|
|
catch(const Exception&) {}
|
2003-03-27 10:29:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY );
|
|
|
|
|
xTrans->parseStrict( aTargetURL );
|
|
|
|
|
|
|
|
|
|
Reference < ::com::sun::star::frame::XDispatchProvider > xProv( xDesktop, UNO_QUERY );
|
|
|
|
|
Reference < ::com::sun::star::frame::XDispatch > xDisp;
|
|
|
|
|
if ( xProv.is() )
|
|
|
|
|
{
|
|
|
|
|
Sequence < ::com::sun::star::beans::PropertyValue > aSeq(1);
|
|
|
|
|
aSeq[0].Name = ::rtl::OUString::createFromAscii("Model");
|
|
|
|
|
aSeq[0].Value <<= pDoc->GetModel();
|
|
|
|
|
::rtl::OUString aTargetFrame( ::rtl::OUString::createFromAscii("_default") );
|
|
|
|
|
xDisp = xProv->queryDispatch( aTargetURL, aTargetFrame , 0 );
|
|
|
|
|
if ( xDisp.is() )
|
|
|
|
|
xDisp->dispatch( aTargetURL, aSeq );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames;
|
|
|
|
|
for( USHORT nPos = rArr.Count(); nPos--; )
|
|
|
|
|
{
|
|
|
|
|
SfxTopFrame *pF = (SfxTopFrame*) rArr[ nPos ];
|
|
|
|
|
if ( pF->GetCurrentDocument() == pDoc )
|
|
|
|
|
{
|
|
|
|
|
pFrame = pF;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( !pFrame )
|
|
|
|
|
{
|
|
|
|
|
Reference < XFrame > xFrame = xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 );
|
|
|
|
|
pFrame = Create( xFrame );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pFrame->pImp->bHidden = bHidden;
|
2002-07-08 06:39:55 +00:00
|
|
|
Window* pWindow = pFrame->GetTopWindow_Impl();
|
2003-03-27 10:29:38 +00:00
|
|
|
if ( pWindow && pDoc )
|
2002-07-08 06:39:55 +00:00
|
|
|
{
|
2004-09-20 09:16:11 +00:00
|
|
|
::rtl::OUString aDocServiceName( pDoc->GetFactory().GetDocumentServiceName() );
|
2004-11-17 09:25:21 +00:00
|
|
|
::rtl::OUString aProductName;
|
|
|
|
|
::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTNAME) >>= aProductName;
|
2002-07-08 06:39:55 +00:00
|
|
|
String aTitle = pDoc->GetTitle( SFX_TITLE_DETECT );
|
|
|
|
|
aTitle += String::CreateFromAscii( " - " );
|
2004-11-17 09:25:21 +00:00
|
|
|
aTitle += String(aProductName);
|
2004-09-20 09:16:11 +00:00
|
|
|
aTitle += ' ';
|
|
|
|
|
aTitle += String( GetModuleName_Impl( aDocServiceName ) );
|
2004-11-17 09:25:21 +00:00
|
|
|
#ifndef PRODUCT
|
|
|
|
|
::rtl::OUString aDefault;
|
|
|
|
|
aTitle += DEFINE_CONST_UNICODE(" [");
|
|
|
|
|
String aVerId( utl::Bootstrap::getBuildIdData( aDefault ));
|
|
|
|
|
aTitle += aVerId;
|
|
|
|
|
aTitle += ']';
|
|
|
|
|
#endif
|
2005-03-29 14:41:39 +00:00
|
|
|
|
|
|
|
|
// append TAB string if available
|
|
|
|
|
aTitle += _getTabString();
|
|
|
|
|
|
2002-07-08 06:39:55 +00:00
|
|
|
pWindow->SetText( aTitle );
|
|
|
|
|
if( pWindow->GetType() == WINDOW_WORKWINDOW )
|
|
|
|
|
{
|
|
|
|
|
SvtModuleOptions::EFactory eFactory;
|
2004-09-20 09:16:11 +00:00
|
|
|
if( SvtModuleOptions::ClassifyFactoryByName( aDocServiceName, eFactory ) )
|
2002-07-08 06:39:55 +00:00
|
|
|
{
|
|
|
|
|
WorkWindow* pWorkWindow = (WorkWindow*)pWindow;
|
|
|
|
|
pWorkWindow->SetIcon( (sal_uInt16) SvtModuleOptions().GetFactoryIcon( eFactory ) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
pFrame->SetItemSet_Impl( pSet );
|
2003-05-02 14:31:08 +00:00
|
|
|
if ( pDoc && pDoc != pFrame->GetCurrentDocument() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
|
if ( nViewId )
|
|
|
|
|
pDoc->GetMedium()->GetItemSet()->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) );
|
|
|
|
|
pFrame->InsertDocument( pDoc );
|
2006-07-13 15:06:03 +00:00
|
|
|
if ( pWindow && !bHidden )
|
2005-02-02 13:03:21 +00:00
|
|
|
pWindow->Show();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return pFrame;
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-27 11:32:26 +00:00
|
|
|
SfxTopFrame* SfxTopFrame::Create( SfxObjectShell* pDoc, Window* pWindow, USHORT nViewId, BOOL bHidden, const SfxItemSet* pSet )
|
|
|
|
|
{
|
|
|
|
|
Reference < ::com::sun::star::lang::XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() );
|
|
|
|
|
Reference < XFramesSupplier > xDesktop ( xFact->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
|
2002-06-03 09:58:49 +00:00
|
|
|
Reference < XFrame > xFrame( xFact->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Frame") ), UNO_QUERY );
|
2001-06-27 11:32:26 +00:00
|
|
|
|
|
|
|
|
xFrame->initialize( VCLUnoHelper::GetInterface ( pWindow ) );
|
|
|
|
|
if ( xDesktop.is() )
|
|
|
|
|
xDesktop->getFrames()->append( xFrame );
|
|
|
|
|
|
2006-11-01 17:29:27 +00:00
|
|
|
uno::Reference< awt::XWindow2 > xWin( VCLUnoHelper::GetInterface ( pWindow ), uno::UNO_QUERY );
|
|
|
|
|
if ( xWin.is() && xWin->isActive() )
|
|
|
|
|
xFrame->activate();
|
|
|
|
|
|
2001-06-27 11:32:26 +00:00
|
|
|
SfxTopFrame* pFrame = new SfxTopFrame( pWindow );
|
|
|
|
|
pFrame->SetFrameInterface_Impl( xFrame );
|
|
|
|
|
pFrame->pImp->bHidden = bHidden;
|
|
|
|
|
|
|
|
|
|
pFrame->SetItemSet_Impl( pSet );
|
|
|
|
|
if ( pDoc )
|
|
|
|
|
{
|
|
|
|
|
if ( nViewId )
|
|
|
|
|
pDoc->GetMedium()->GetItemSet()->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) );
|
|
|
|
|
pFrame->InsertDocument( pDoc );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return pFrame;
|
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
SfxTopFrame* SfxTopFrame::Create( Reference < XFrame > xFrame )
|
|
|
|
|
{
|
|
|
|
|
// create a new TopFrame to an external XFrame object ( wrap controller )
|
2006-02-10 09:20:47 +00:00
|
|
|
DBG_ASSERT( xFrame.is(), "Wrong parameter!" );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
Window* pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
|
|
|
|
|
SfxTopFrame* pFrame = new SfxTopFrame( pWindow );
|
|
|
|
|
pFrame->SetFrameInterface_Impl( xFrame );
|
|
|
|
|
return pFrame;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SfxTopFrame::SfxTopFrame( Window* pExternal, sal_Bool bHidden )
|
|
|
|
|
: SfxFrame( NULL )
|
|
|
|
|
, pWindow( NULL )
|
|
|
|
|
{
|
|
|
|
|
pImp = new SfxTopFrame_Impl;
|
|
|
|
|
pImp->bHidden = bHidden;
|
|
|
|
|
pImp->bLockResize = FALSE;
|
2001-06-21 12:57:41 +00:00
|
|
|
pImp->bMenuBarOn = TRUE;
|
2000-09-18 16:07:07 +00:00
|
|
|
InsertTopFrame_Impl( this );
|
|
|
|
|
if ( pExternal )
|
|
|
|
|
{
|
|
|
|
|
pImp->pWindow = pExternal;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DBG_ERROR( "TopFrame without window created!" );
|
|
|
|
|
/*
|
|
|
|
|
pImp->pWindow = new SfxTopFrameWindow_Impl( this );
|
|
|
|
|
pImp->pWindow->SetActivateMode( ACTIVATE_MODE_GRABFOCUS );
|
|
|
|
|
pImp->pWindow->SetPosSizePixel( Point( 20,20 ), Size( 800,600 ) );
|
|
|
|
|
if ( GetFrameInterface().is() )
|
|
|
|
|
GetFrameInterface()->initialize( VCLUnoHelper::GetInterface( pImp->pWindow ) );
|
|
|
|
|
pImp->pWindow->Show();
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pWindow = new SfxTopWindow_Impl( this );
|
2003-03-27 10:29:38 +00:00
|
|
|
/** AS:
|
|
|
|
|
Hide this window till the component was realy loaded. Otherwhise it overpaint e.g. the old component hardly
|
|
|
|
|
and produce repaint errors.
|
2000-09-18 16:07:07 +00:00
|
|
|
pWindow->Show();
|
2003-03-27 10:29:38 +00:00
|
|
|
*/
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SfxTopFrame::~SfxTopFrame()
|
|
|
|
|
{
|
|
|
|
|
RemoveTopFrame_Impl( this );
|
|
|
|
|
DELETEZ( pWindow );
|
|
|
|
|
delete pImp;
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-29 10:29:48 +00:00
|
|
|
void SfxTopFrame::SetPresentationMode( BOOL bSet )
|
|
|
|
|
{
|
2001-09-04 09:39:24 +00:00
|
|
|
if ( GetCurrentViewFrame() )
|
|
|
|
|
GetCurrentViewFrame()->GetWindow().SetBorderStyle( bSet ? WINDOW_BORDER_NOBORDER : WINDOW_BORDER_NORMAL );
|
|
|
|
|
|
2005-10-27 13:06:22 +00:00
|
|
|
Reference< com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY );
|
|
|
|
|
Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
|
|
|
|
|
|
|
|
|
|
if ( xPropSet.is() )
|
|
|
|
|
{
|
|
|
|
|
Any aValue = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )));
|
|
|
|
|
aValue >>= xLayoutManager;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( xLayoutManager.is() )
|
|
|
|
|
xLayoutManager->setVisible( !bSet ); // we don't want to have ui in presentation mode
|
|
|
|
|
|
2004-03-17 11:21:59 +00:00
|
|
|
SetMenuBarOn_Impl( !bSet );
|
2001-06-29 10:29:48 +00:00
|
|
|
if ( GetWorkWindow_Impl() )
|
|
|
|
|
GetWorkWindow_Impl()->SetDockingAllowed( !bSet );
|
|
|
|
|
if ( GetCurrentViewFrame() )
|
|
|
|
|
GetCurrentViewFrame()->GetDispatcher()->Update_Impl( TRUE );
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
SystemWindow* SfxTopFrame::GetTopWindow_Impl() const
|
|
|
|
|
{
|
|
|
|
|
if ( pImp->pWindow->IsSystemWindow() )
|
|
|
|
|
return (SystemWindow*) pImp->pWindow;
|
|
|
|
|
else
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Window& SfxTopFrame::GetWindow() const
|
|
|
|
|
{
|
|
|
|
|
return *pWindow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sal_Bool SfxTopFrame::Close()
|
|
|
|
|
{
|
|
|
|
|
delete this;
|
|
|
|
|
return sal_True;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SfxTopFrame::LockResize_Impl( BOOL bLock )
|
|
|
|
|
{
|
|
|
|
|
pImp->bLockResize = bLock;
|
|
|
|
|
}
|
|
|
|
|
|
2006-06-19 21:39:02 +00:00
|
|
|
IMPL_LINK( SfxTopWindow_Impl, CloserHdl, void*, EMPTYARG )
|
2002-10-07 09:19:26 +00:00
|
|
|
{
|
|
|
|
|
if ( pFrame && !pFrame->PrepareClose_Impl( TRUE ) )
|
|
|
|
|
return 0L;
|
2002-10-28 11:49:16 +00:00
|
|
|
|
|
|
|
|
if ( pFrame )
|
|
|
|
|
pFrame->GetCurrentViewFrame()->GetBindings().Execute( SID_CLOSEWIN, 0, 0, SFX_CALLMODE_ASYNCHRON );
|
2002-10-07 09:19:26 +00:00
|
|
|
return 0L;
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-21 12:57:41 +00:00
|
|
|
void SfxTopFrame::SetMenuBarOn_Impl( BOOL bOn )
|
|
|
|
|
{
|
|
|
|
|
pImp->bMenuBarOn = bOn;
|
2004-09-09 15:52:15 +00:00
|
|
|
|
2004-02-25 14:48:48 +00:00
|
|
|
Reference< com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY );
|
2005-03-01 19:04:11 +00:00
|
|
|
Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
|
2004-02-25 14:48:48 +00:00
|
|
|
|
|
|
|
|
if ( xPropSet.is() )
|
|
|
|
|
{
|
|
|
|
|
Any aValue = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )));
|
|
|
|
|
aValue >>= xLayoutManager;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( xLayoutManager.is() )
|
|
|
|
|
{
|
|
|
|
|
rtl::OUString aMenuBarURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/menubar/menubar" ));
|
|
|
|
|
|
|
|
|
|
if ( bOn )
|
|
|
|
|
xLayoutManager->showElement( aMenuBarURL );
|
|
|
|
|
else
|
|
|
|
|
xLayoutManager->hideElement( aMenuBarURL );
|
|
|
|
|
}
|
2001-06-21 12:57:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BOOL SfxTopFrame::IsMenuBarOn_Impl() const
|
|
|
|
|
{
|
|
|
|
|
return pImp->bMenuBarOn;
|
2004-07-06 12:41:00 +00:00
|
|
|
}
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
String SfxTopFrame::GetWindowData()
|
|
|
|
|
{
|
|
|
|
|
String aActWinData;
|
2000-11-08 13:25:58 +00:00
|
|
|
char cToken = ',';
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
SfxViewFrame *pActFrame = SfxViewFrame::Current();
|
|
|
|
|
SfxViewFrame *pFrame = GetCurrentViewFrame();
|
|
|
|
|
const sal_Bool bActWin = ( pActFrame->GetTopViewFrame() == pFrame );
|
|
|
|
|
|
|
|
|
|
// ::com::sun::star::sdbcx::User-Daten der ViewShell
|
|
|
|
|
String aUserData;
|
|
|
|
|
pFrame->GetViewShell()->WriteUserData(aUserData);
|
|
|
|
|
|
|
|
|
|
// assemble ini-data
|
|
|
|
|
String aWinData;
|
|
|
|
|
aWinData += String::CreateFromInt32( pFrame->GetCurViewId() );
|
|
|
|
|
aWinData += cToken;
|
|
|
|
|
|
|
|
|
|
aWinData += '1'; // former attribute "isfloating"
|
|
|
|
|
aWinData += cToken;
|
|
|
|
|
|
|
|
|
|
// aktives kennzeichnen
|
|
|
|
|
aWinData += cToken;
|
|
|
|
|
aWinData += bActWin ? '1' : '0';
|
|
|
|
|
|
|
|
|
|
aWinData += cToken;
|
|
|
|
|
aWinData += aUserData;
|
|
|
|
|
|
|
|
|
|
return aWinData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc )
|
|
|
|
|
/* [Beschreibung]
|
|
|
|
|
*/
|
|
|
|
|
{
|
|
|
|
|
// Spezielle Bedingungen testen: nicht im ModalMode!
|
|
|
|
|
if ( !SfxFrame::InsertDocument( pDoc ) )
|
|
|
|
|
return sal_False;
|
|
|
|
|
|
|
|
|
|
SfxObjectShell *pOld = GetCurrentDocument();
|
|
|
|
|
|
|
|
|
|
// Position und Groesse testen
|
|
|
|
|
// Wenn diese schon gesetzt sind, soll offensichtlich nicht noch
|
|
|
|
|
// LoadWindows_Impl aufgerufen werden ( z.B. weil dieses ein CreateFrame()
|
|
|
|
|
// an einer Task aufgerufen hat! )
|
|
|
|
|
const SfxItemSet* pSet = GetItemSet_Impl();
|
|
|
|
|
if ( !pSet )
|
|
|
|
|
pSet = pDoc->GetMedium()->GetItemSet();
|
|
|
|
|
SetItemSet_Impl(0);
|
|
|
|
|
|
|
|
|
|
// Position und Gr"o\se
|
|
|
|
|
SFX_ITEMSET_ARG(
|
|
|
|
|
pSet, pAreaItem, SfxRectangleItem, SID_VIEW_POS_SIZE, sal_False );
|
2004-10-04 20:04:13 +00:00
|
|
|
// View-Id
|
2000-09-18 16:07:07 +00:00
|
|
|
SFX_ITEMSET_ARG(
|
|
|
|
|
pSet, pViewIdItem, SfxUInt16Item, SID_VIEW_ID, sal_False );
|
|
|
|
|
// Zoom
|
|
|
|
|
SFX_ITEMSET_ARG(
|
|
|
|
|
pSet, pModeItem, SfxUInt16Item, SID_VIEW_ZOOM_MODE, sal_False );
|
|
|
|
|
// Hidden
|
|
|
|
|
SFX_ITEMSET_ARG(
|
|
|
|
|
pSet, pHidItem, SfxBoolItem, SID_HIDDEN, sal_False);
|
|
|
|
|
// ViewDaten
|
|
|
|
|
SFX_ITEMSET_ARG(
|
|
|
|
|
pSet, pViewDataItem, SfxStringItem, SID_USER_DATA, sal_False );
|
2003-03-27 10:29:38 +00:00
|
|
|
// ViewOnly
|
|
|
|
|
SFX_ITEMSET_ARG(
|
|
|
|
|
pSet, pEditItem, SfxBoolItem, SID_VIEWONLY, sal_False);
|
2004-10-04 20:04:13 +00:00
|
|
|
// InPlace (Hack)
|
|
|
|
|
SFX_ITEMSET_ARG(
|
|
|
|
|
pSet, pPluginItem, SfxUInt16Item, SID_PLUGIN_MODE, sal_False );
|
2003-03-27 10:29:38 +00:00
|
|
|
|
2004-07-06 12:41:00 +00:00
|
|
|
// Plugin (external InPlace)
|
|
|
|
|
SFX_ITEMSET_ARG(
|
|
|
|
|
pSet, pPluginMode, SfxUInt16Item, SID_PLUGIN_MODE, sal_False);
|
2004-12-23 10:09:56 +00:00
|
|
|
// Jump (GotoBookmark)
|
|
|
|
|
SFX_ITEMSET_ARG(
|
|
|
|
|
pSet, pJumpItem, SfxStringItem, SID_JUMPMARK, sal_False);
|
2004-07-06 12:41:00 +00:00
|
|
|
|
2003-03-27 10:29:38 +00:00
|
|
|
if ( pEditItem && pEditItem->GetValue() )
|
|
|
|
|
SetMenuBarOn_Impl( FALSE );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
if ( pHidItem )
|
|
|
|
|
pImp->bHidden = pHidItem->GetValue();
|
|
|
|
|
|
|
|
|
|
if( !pImp->bHidden )
|
|
|
|
|
pDoc->OwnerLock( sal_True );
|
|
|
|
|
|
|
|
|
|
// Wenn z.B. eine Fenstergr"o\se gesetzt wurde, soll keine Fensterinformation
|
|
|
|
|
// aus den Dokument geladen werden, z.B. weil InsertDocument seinerseits
|
|
|
|
|
// aus LoadWindows_Impl aufgerufen wurde!
|
2004-12-23 10:09:56 +00:00
|
|
|
if ( !pJumpItem && !pPluginMode && pDoc && !pAreaItem && !pViewIdItem && !pModeItem &&
|
2000-09-18 16:07:07 +00:00
|
|
|
!pImp->bHidden && pDoc->LoadWindows_Impl( this ) )
|
|
|
|
|
{
|
2006-02-09 13:09:03 +00:00
|
|
|
if ( GetCurrentDocument() != pDoc )
|
|
|
|
|
// something went wrong during insertion
|
|
|
|
|
return sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
pDoc->OwnerLock( sal_False );
|
|
|
|
|
return sal_True;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( pDoc )
|
|
|
|
|
{
|
|
|
|
|
UpdateHistory( pDoc );
|
|
|
|
|
UpdateDescriptor( pDoc );
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-19 07:03:59 +00:00
|
|
|
SetFrameType_Impl( GetFrameType() & ~SFXFRAME_FRAMESET );
|
2000-09-18 16:07:07 +00:00
|
|
|
sal_Bool bBrowsing = sal_True;
|
|
|
|
|
SfxViewFrame *pFrame = GetCurrentViewFrame();
|
|
|
|
|
if ( pFrame )
|
|
|
|
|
{
|
|
|
|
|
sal_Bool bChildActivated = sal_False;
|
|
|
|
|
if ( pFrame->GetActiveChildFrame_Impl() && pFrame->GetActiveChildFrame_Impl() == SfxViewFrame::Current() )
|
|
|
|
|
{
|
|
|
|
|
// ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier > xFrames( GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY );
|
|
|
|
|
// if ( xFrames.is() )
|
|
|
|
|
// xFrames->setActiveFrame( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > () );
|
|
|
|
|
pFrame->SetActiveChildFrame_Impl(0);
|
2006-05-02 16:06:52 +00:00
|
|
|
SfxViewFrame::SetViewFrame( pFrame );
|
2000-09-18 16:07:07 +00:00
|
|
|
bChildActivated = sal_True;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( pFrame->GetObjectShell() )
|
2005-03-23 13:26:23 +00:00
|
|
|
{
|
2000-09-18 16:07:07 +00:00
|
|
|
pFrame->ReleaseObjectShell_Impl( sal_False );
|
2005-03-23 13:26:23 +00:00
|
|
|
}
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pViewIdItem )
|
|
|
|
|
pFrame->SetViewData_Impl( pViewIdItem->GetValue(), String() );
|
|
|
|
|
if ( pDoc )
|
|
|
|
|
pFrame->SetObjectShell_Impl( *pDoc );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2005-11-03 11:06:27 +00:00
|
|
|
// 1: internal embedded object
|
|
|
|
|
// 2: external embedded object
|
|
|
|
|
// 3: OLE server
|
2004-10-04 20:04:13 +00:00
|
|
|
if ( pPluginItem && pPluginItem->GetValue() != 2 )
|
|
|
|
|
SetInPlace_Impl( TRUE );
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
bBrowsing = sal_False;
|
|
|
|
|
pFrame = new SfxTopViewFrame( this, pDoc, pViewIdItem ? pViewIdItem->GetValue() : 0 );
|
2006-02-09 13:09:03 +00:00
|
|
|
if ( !pFrame->GetViewShell() )
|
|
|
|
|
return sal_False;
|
|
|
|
|
|
2004-10-04 20:04:13 +00:00
|
|
|
if ( pPluginItem && pPluginItem->GetValue() == 1 )
|
|
|
|
|
{
|
|
|
|
|
pFrame->ForceOuterResize_Impl( FALSE );
|
|
|
|
|
pFrame->GetBindings().HidePopups(TRUE);
|
2006-11-01 17:29:27 +00:00
|
|
|
|
|
|
|
|
// MBA: layoutmanager of inplace frame starts locked and invisible
|
2004-10-04 20:04:13 +00:00
|
|
|
GetWorkWindow_Impl()->MakeVisible_Impl( FALSE );
|
2006-11-01 17:29:27 +00:00
|
|
|
GetWorkWindow_Impl()->Lock_Impl( TRUE );
|
2004-10-04 20:04:13 +00:00
|
|
|
|
|
|
|
|
GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER );
|
|
|
|
|
if ( GetCurrentViewFrame() )
|
|
|
|
|
GetCurrentViewFrame()->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER );
|
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
2004-04-21 11:20:24 +00:00
|
|
|
String aMark;
|
|
|
|
|
SFX_ITEMSET_ARG( pSet, pMarkItem, SfxStringItem, SID_JUMPMARK, FALSE );
|
|
|
|
|
if ( pMarkItem )
|
|
|
|
|
aMark = pMarkItem->GetValue();
|
|
|
|
|
|
|
|
|
|
if ( pDoc->Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-04-21 11:20:24 +00:00
|
|
|
if ( pViewDataItem )
|
2000-09-18 16:07:07 +00:00
|
|
|
pFrame->GetViewShell()->ReadUserData( pViewDataItem->GetValue(), sal_True );
|
2004-04-21 11:20:24 +00:00
|
|
|
else if( aMark.Len() )
|
|
|
|
|
GetCurrentViewFrame()->GetViewShell()->JumpToMark( aMark );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Daten setzen, die in FinishedLoading ausgewertet werden
|
|
|
|
|
MarkData_Impl*& rpMark = pDoc->Get_Impl()->pMarkData;
|
|
|
|
|
if (!rpMark)
|
|
|
|
|
rpMark = new MarkData_Impl;
|
|
|
|
|
rpMark->pFrame = GetCurrentViewFrame();
|
|
|
|
|
if ( pViewDataItem )
|
2000-09-18 16:07:07 +00:00
|
|
|
rpMark->aUserData = pViewDataItem->GetValue();
|
2004-04-21 11:20:24 +00:00
|
|
|
else
|
|
|
|
|
rpMark->aMark = aMark;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Position und Groesse setzen
|
2004-09-08 14:47:13 +00:00
|
|
|
//sal_uInt16 nWinMode = pModeItem ? pModeItem->GetValue() : 1;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pAreaItem && !pOld )
|
|
|
|
|
{
|
|
|
|
|
Window *pWin = pImp->pWindow;
|
|
|
|
|
|
|
|
|
|
// Groesse setzen
|
|
|
|
|
const Rectangle aWinRect( pAreaItem->GetValue() );
|
|
|
|
|
const Size aAppWindow( pImp->pWindow->GetDesktopRectPixel().GetSize() );
|
|
|
|
|
Point aPos( aWinRect.TopLeft() );
|
|
|
|
|
Size aSz(aWinRect.GetSize());
|
|
|
|
|
if ( aSz.Width() && aSz.Height() )
|
|
|
|
|
{
|
|
|
|
|
aPos.X() = Min(aPos.X(),
|
|
|
|
|
long(aAppWindow.Width() - aSz.Width() + aSz.Width() / 2) );
|
|
|
|
|
aPos.Y() = Min(aPos.Y(),
|
|
|
|
|
long( aAppWindow.Height() - aSz.Height() + aSz.Height() / 2) );
|
|
|
|
|
if ( aPos.X() + aSz.Width() <
|
|
|
|
|
aAppWindow.Width() + aSz.Width() / 2 &&
|
|
|
|
|
aPos.Y() + aSz.Height() <
|
|
|
|
|
aAppWindow.Height() + aSz.Height() / 2 )
|
|
|
|
|
{
|
|
|
|
|
pWin->SetPosPixel( aPos );
|
|
|
|
|
pWin->SetOutputSizePixel( aSz );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( !pImp->bHidden )
|
|
|
|
|
{
|
2004-10-04 20:04:13 +00:00
|
|
|
if ( pDoc->IsHelpDocument() || pPluginItem && pPluginItem->GetValue() == 2 )
|
2001-09-04 09:39:24 +00:00
|
|
|
pFrame->GetDispatcher()->HideUI( TRUE );
|
|
|
|
|
else
|
|
|
|
|
pFrame->GetDispatcher()->HideUI( FALSE );
|
2004-04-21 11:20:24 +00:00
|
|
|
|
2004-10-04 20:04:13 +00:00
|
|
|
if ( IsInPlace() )
|
|
|
|
|
pFrame->LockAdjustPosSizePixel();
|
|
|
|
|
|
2004-07-06 12:41:00 +00:00
|
|
|
if ( pPluginMode && pPluginMode->GetValue() == 3)
|
|
|
|
|
GetWorkWindow_Impl()->SetInternalDockingAllowed(FALSE);
|
|
|
|
|
|
2006-11-01 17:29:27 +00:00
|
|
|
if ( !IsInPlace() )
|
|
|
|
|
pFrame->GetDispatcher()->Update_Impl();
|
2000-09-18 16:07:07 +00:00
|
|
|
pFrame->Show();
|
|
|
|
|
GetWindow().Show();
|
2006-11-01 17:29:27 +00:00
|
|
|
if ( !IsInPlace() )
|
|
|
|
|
pFrame->MakeActive_Impl( GetFrameInterface()->isActive() );
|
2000-09-18 16:07:07 +00:00
|
|
|
pDoc->OwnerLock( sal_False );
|
2005-02-02 13:03:21 +00:00
|
|
|
|
|
|
|
|
// Dont show container window! Its done by framework or directly
|
|
|
|
|
// by SfxTopFrame::Create() or SfxViewFrame::ExecView_Impl() ...
|
2004-10-04 20:04:13 +00:00
|
|
|
|
|
|
|
|
if ( IsInPlace() )
|
2005-11-03 11:06:27 +00:00
|
|
|
{
|
2004-10-04 20:04:13 +00:00
|
|
|
pFrame->UnlockAdjustPosSizePixel();
|
2005-11-03 11:06:27 +00:00
|
|
|
// force resize for OLE server to fix layout problems of writer and math
|
|
|
|
|
// see i53651
|
|
|
|
|
if ( pPluginItem && pPluginItem->GetValue() == 3 )
|
|
|
|
|
pFrame->Resize(TRUE);
|
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2006-02-09 12:59:01 +00:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DBG_ASSERT( !IsInPlace() && !pPluginMode && !pPluginItem, "Special modes not compatible with hidden mode!" );
|
|
|
|
|
GetWindow().Show();
|
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
// Jetzt UpdateTitle, hidden TopFrames haben sonst keinen Namen!
|
|
|
|
|
pFrame->UpdateTitle();
|
2003-06-16 10:37:29 +00:00
|
|
|
|
2004-10-04 20:04:13 +00:00
|
|
|
if ( !IsInPlace() )
|
2003-06-16 10:37:29 +00:00
|
|
|
{
|
2004-10-04 20:04:13 +00:00
|
|
|
if ( pFrame->GetViewShell()->UseObjectSize() )
|
|
|
|
|
{
|
|
|
|
|
GetCurrentViewFrame()->UnlockAdjustPosSizePixel();
|
|
|
|
|
GetCurrentViewFrame()->Resize(TRUE);
|
|
|
|
|
GetCurrentViewFrame()->ForceInnerResize_Impl( FALSE );
|
|
|
|
|
GetCurrentViewFrame()->Resize(TRUE);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
GetCurrentViewFrame()->Resize(TRUE);
|
2003-06-16 10:37:29 +00:00
|
|
|
}
|
|
|
|
|
|
2005-03-23 13:26:23 +00:00
|
|
|
SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_VIEWCREATED, pDoc ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
return sal_True;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//========================================================================
|
|
|
|
|
|
2006-06-19 21:39:02 +00:00
|
|
|
long SfxViewFrameClose_Impl( void* /*pObj*/, void* pArg )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
|
((SfxViewFrame*)pArg)->GetFrame()->DoClose();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2001-11-19 10:18:59 +00:00
|
|
|
TYPEINIT1(SfxTopFrame, SfxFrame);
|
2000-09-18 16:07:07 +00:00
|
|
|
TYPEINIT1(SfxTopViewFrame, SfxViewFrame);
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
|
SFX_IMPL_INTERFACE(SfxTopViewFrame,SfxViewFrame,ResId(0,0))
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
|
String SfxTopViewFrame::UpdateTitle()
|
|
|
|
|
|
|
|
|
|
/* [Beschreibung]
|
|
|
|
|
|
|
|
|
|
Mit dieser Methode kann der SfxTopViewFrame gezwungen werden, sich sofort
|
|
|
|
|
den neuen Titel vom der <SfxObjectShell> zu besorgen.
|
|
|
|
|
|
|
|
|
|
[Anmerkung]
|
|
|
|
|
|
|
|
|
|
Dies ist z.B. dann notwendig, wenn man der SfxObjectShell als SfxListener
|
|
|
|
|
zuh"ort und dort auf den <SfxSimpleHint> SFX_HINT_TITLECHANGED reagieren
|
|
|
|
|
m"ochte, um dann die Titel seiner Views abzufragen. Diese Views (SfxTopViewFrames)
|
|
|
|
|
jedoch sind ebenfalls SfxListener und da die Reihenfolge der Benachrichtigung
|
|
|
|
|
nicht feststeht, mu\s deren Titel-Update vorab erzwungen werden.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Beispiel]
|
|
|
|
|
|
|
|
|
|
void SwDocShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
|
|
|
|
|
{
|
|
|
|
|
if ( rHint.IsA(TYPE(SfxSimpleHint)) )
|
|
|
|
|
{
|
|
|
|
|
switch( ( (SfxSimpleHint&) rHint ).GetId() )
|
|
|
|
|
{
|
|
|
|
|
case SFX_HINT_TITLECHANGED:
|
|
|
|
|
for ( SfxTopViewFrame *pTop = (SfxTopViewFrame*)
|
|
|
|
|
SfxViewFrame::GetFirst(this, TYPE(SfxTopViewFrame));
|
|
|
|
|
pTop;
|
|
|
|
|
pTop = (SfxTopViewFrame*)
|
|
|
|
|
SfxViewFrame::GetNext(this, TYPE(SfxTopViewFrame));
|
|
|
|
|
{
|
|
|
|
|
pTop->UpdateTitle();
|
|
|
|
|
... pTop->GetName() ...
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
...
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
DBG_CHKTHIS(SfxTopViewFrame, 0);
|
|
|
|
|
|
2001-07-03 16:35:30 +00:00
|
|
|
const SfxObjectFactory &rFact = GetObjectShell()->GetFactory();
|
2004-01-28 18:15:56 +00:00
|
|
|
pImp->aFactoryName = String::CreateFromAscii( rFact.GetShortName() );
|
2001-06-27 11:32:26 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
String aTitle = SfxViewFrame::UpdateTitle();
|
2004-08-31 11:37:46 +00:00
|
|
|
|
|
|
|
|
// xmlsec05, check with SFX team
|
|
|
|
|
if ( GetObjectShell()->GetDocumentSignatureState() == SIGNATURESTATE_SIGNATURES_OK )
|
|
|
|
|
{
|
|
|
|
|
aTitle += String::CreateFromAscii( " " );
|
|
|
|
|
aTitle += String( SfxResId( RID_XMLSEC_DOCUMENTSIGNED ) );
|
|
|
|
|
aTitle += String::CreateFromAscii( " " );
|
|
|
|
|
}
|
|
|
|
|
|
2004-11-17 09:25:21 +00:00
|
|
|
::rtl::OUString aProductName;
|
|
|
|
|
::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTNAME) >>= aProductName;
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
aTitle += String::CreateFromAscii( " - " );
|
2004-11-17 09:25:21 +00:00
|
|
|
aTitle += String(aProductName);
|
2004-09-20 09:16:11 +00:00
|
|
|
aTitle += ' ';
|
|
|
|
|
::rtl::OUString aDocServiceName( GetObjectShell()->GetFactory().GetDocumentServiceName() );
|
|
|
|
|
aTitle += String( GetModuleName_Impl( aDocServiceName ) );
|
2004-11-17 09:25:21 +00:00
|
|
|
#ifndef PRODUCT
|
|
|
|
|
::rtl::OUString aDefault;
|
|
|
|
|
aTitle += DEFINE_CONST_UNICODE(" [");
|
|
|
|
|
String aVerId( utl::Bootstrap::getBuildIdData( aDefault ));
|
|
|
|
|
aTitle += aVerId;
|
|
|
|
|
aTitle += ']';
|
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2005-03-29 14:41:39 +00:00
|
|
|
// append TAB string if available
|
|
|
|
|
aTitle += _getTabString();
|
|
|
|
|
|
2002-05-16 13:10:18 +00:00
|
|
|
GetBindings().Invalidate( SID_NEWDOCDIRECT );
|
|
|
|
|
|
2002-07-10 09:38:29 +00:00
|
|
|
Window* pWindow = GetTopFrame_Impl()->GetTopWindow_Impl();
|
|
|
|
|
if ( pWindow && pWindow->GetText() != aTitle )
|
|
|
|
|
pWindow->SetText( aTitle );
|
2000-09-18 16:07:07 +00:00
|
|
|
return aTitle;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
|
void SfxTopViewFrame::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
|
|
|
|
|
{
|
|
|
|
|
{DBG_CHKTHIS(SfxTopViewFrame, 0);}
|
|
|
|
|
|
|
|
|
|
if( IsDowning_Impl())
|
|
|
|
|
return;
|
2006-06-19 21:39:02 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// we know only SimpleHints
|
|
|
|
|
if ( rHint.IsA(TYPE(SfxSimpleHint)) )
|
|
|
|
|
{
|
|
|
|
|
switch( ( (SfxSimpleHint&) rHint ).GetId() )
|
|
|
|
|
{
|
|
|
|
|
case SFX_HINT_MODECHANGED:
|
|
|
|
|
case SFX_HINT_TITLECHANGED:
|
|
|
|
|
// when the document changes its title, change views too
|
|
|
|
|
UpdateTitle();
|
|
|
|
|
break;
|
|
|
|
|
|
2001-03-09 16:55:57 +00:00
|
|
|
case SFX_HINT_DEINITIALIZING:
|
2000-09-18 16:07:07 +00:00
|
|
|
// on all other changes force repaint
|
|
|
|
|
GetFrame()->DoClose();
|
|
|
|
|
return;
|
2006-06-19 21:39:02 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SfxViewFrame::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
|
sal_Bool SfxTopViewFrame::Close()
|
|
|
|
|
{
|
|
|
|
|
{DBG_CHKTHIS(SfxTopViewFrame, 0);}
|
|
|
|
|
|
|
|
|
|
// Modaler Dialog oben ??
|
|
|
|
|
// if ( pImp->GetModalDialog() )
|
|
|
|
|
// return sal_False;
|
|
|
|
|
|
|
|
|
|
// eigentliches Schlie\sen
|
|
|
|
|
if ( SfxViewFrame::Close() )
|
|
|
|
|
{
|
2006-05-02 16:06:52 +00:00
|
|
|
if (SfxViewFrame::Current() == this)
|
|
|
|
|
SfxViewFrame::SetViewFrame(0);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
// Da der Dispatcher leer ger"aumt wird, kann man ihn auch nicht mehr
|
|
|
|
|
// vern"unftig verwenden - also besser still legen
|
|
|
|
|
GetDispatcher()->Lock(sal_True);
|
|
|
|
|
delete this;
|
2002-10-07 09:19:26 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
return sal_True;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return sal_False;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SfxTopViewFrame::SfxTopViewFrame
|
|
|
|
|
(
|
|
|
|
|
SfxFrame* pFrame,
|
|
|
|
|
SfxObjectShell* pObjShell,
|
|
|
|
|
sal_uInt16 nViewId
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/* [Beschreibung]
|
|
|
|
|
|
|
|
|
|
Ctor des SfxTopViewFrame f"ur eine <SfxObjectShell> aus der Ressource.
|
|
|
|
|
Die 'nViewId' der zu erzeugenden <SfxViewShell> kann angegeben werden
|
|
|
|
|
(default ist die zuerst registrierte SfxViewShell-Subklasse).
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
: SfxViewFrame( *(new SfxBindings), pFrame, pObjShell, SFXFRAME_HASTITLE )
|
|
|
|
|
{
|
|
|
|
|
DBG_CTOR(SfxTopViewFrame, 0);
|
|
|
|
|
|
|
|
|
|
pCloser = 0;
|
|
|
|
|
pImp = new SfxTopViewFrame_Impl;
|
2001-11-15 14:13:16 +00:00
|
|
|
pImp->pStopButtonTimer = new StopButtonTimer_Impl(this);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
//(mba)/task if ( !pFrame->GetTask() )
|
|
|
|
|
{
|
|
|
|
|
pImp->pWindow = new SfxTopViewWin_Impl( this, &pFrame->GetWindow() );
|
|
|
|
|
pImp->pWindow->SetSizePixel( pFrame->GetWindow().GetOutputSizePixel() );
|
|
|
|
|
SetWindow_Impl( pImp->pWindow );
|
|
|
|
|
pFrame->SetOwnsBindings_Impl( sal_True );
|
|
|
|
|
pFrame->CreateWorkWindow_Impl();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sal_uInt32 nType = SFXFRAME_OWNSDOCUMENT | SFXFRAME_HASTITLE;
|
|
|
|
|
if ( pObjShell && pObjShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
|
|
|
|
|
nType |= SFXFRAME_EXTERNAL;
|
|
|
|
|
GetFrame()->SetFrameType_Impl( GetFrame()->GetFrameType() | nType );
|
|
|
|
|
|
2004-10-04 20:04:13 +00:00
|
|
|
if ( GetFrame()->IsInPlace() )
|
|
|
|
|
{
|
|
|
|
|
LockAdjustPosSizePixel();
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-09 13:09:03 +00:00
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if ( pObjShell )
|
|
|
|
|
SwitchToViewShell_Impl( nViewId );
|
|
|
|
|
}
|
|
|
|
|
catch (com::sun::star::uno::Exception& )
|
|
|
|
|
{
|
|
|
|
|
// make sure that the ctor is left regularly
|
|
|
|
|
ReleaseObjectShell_Impl();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-10-04 20:04:13 +00:00
|
|
|
if ( GetFrame()->IsInPlace() )
|
|
|
|
|
{
|
|
|
|
|
UnlockAdjustPosSizePixel();
|
|
|
|
|
}
|
|
|
|
|
else if ( GetViewShell()->UseObjectSize() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-10-04 20:04:13 +00:00
|
|
|
// initiale Gr"o\se festlegen
|
2000-09-18 16:07:07 +00:00
|
|
|
// Zuerst die logischen Koordinaten von IP-Objekt und EditWindow
|
|
|
|
|
// ber"ucksichtigen
|
2003-06-16 10:37:29 +00:00
|
|
|
LockAdjustPosSizePixel();
|
|
|
|
|
ForceInnerResize_Impl( TRUE );
|
2004-10-04 20:04:13 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
Window *pWindow = GetViewShell()->GetWindow();
|
|
|
|
|
|
|
|
|
|
// Da in den Applikationen bei der R"ucktransformation immer die
|
|
|
|
|
// Eckpunkte tranformiert werden und nicht die Size (um die Ecken
|
|
|
|
|
// alignen zu k"onnen), transformieren wir hier auch die Punkte, um
|
|
|
|
|
// m"oglichst wenig Rundungsfehler zu erhalten.
|
2004-10-04 20:04:13 +00:00
|
|
|
/*
|
|
|
|
|
Rectangle aRect = pWindow->LogicToLogic( GetObjectShell()->GetVisArea(),
|
|
|
|
|
GetObjectShell()->GetMapUnit(),
|
2000-09-18 16:07:07 +00:00
|
|
|
pWindow->GetMapMode() );
|
2004-10-04 20:04:13 +00:00
|
|
|
*/
|
|
|
|
|
Rectangle aRect = pWindow->LogicToPixel( GetObjectShell()->GetVisArea() );
|
2000-09-18 16:07:07 +00:00
|
|
|
Size aSize = aRect.GetSize();
|
|
|
|
|
GetViewShell()->GetWindow()->SetSizePixel( aSize );
|
|
|
|
|
DoAdjustPosSizePixel(GetViewShell(), Point(), aSize );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
|
SfxTopViewFrame::~SfxTopViewFrame()
|
|
|
|
|
{
|
|
|
|
|
DBG_DTOR(SfxTopViewFrame, 0);
|
|
|
|
|
|
|
|
|
|
SetDowning_Impl();
|
|
|
|
|
|
2006-05-02 16:06:52 +00:00
|
|
|
if ( SfxViewFrame::Current() == this )
|
|
|
|
|
SfxViewFrame::SetViewFrame(NULL);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
ReleaseObjectShell_Impl();
|
|
|
|
|
if ( pPendingCloser == pCloser )
|
|
|
|
|
pPendingCloser = 0;
|
|
|
|
|
delete pCloser;
|
|
|
|
|
if ( GetFrame()->OwnsBindings_Impl() )
|
|
|
|
|
// Die Bindings l"oscht der Frame!
|
|
|
|
|
KillDispatcher_Impl();
|
|
|
|
|
|
|
|
|
|
delete pImp->pWindow;
|
2001-11-15 14:13:16 +00:00
|
|
|
delete pImp->pStopButtonTimer;
|
2000-09-18 16:07:07 +00:00
|
|
|
delete pImp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
|
sal_Bool SfxTopViewFrame::SetBorderPixelImpl( const SfxViewShell *pVSh, const SvBorder &rBorder )
|
|
|
|
|
{
|
|
|
|
|
if( SfxViewFrame::SetBorderPixelImpl( GetViewShell(), rBorder ) )
|
|
|
|
|
{
|
2004-10-04 20:04:13 +00:00
|
|
|
if ( IsResizeInToOut_Impl() && !GetFrame()->IsInPlace() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
|
Size aSize = pVSh->GetWindow()->GetOutputSizePixel();
|
2003-06-16 10:37:29 +00:00
|
|
|
if ( aSize.Width() && aSize.Height() )
|
|
|
|
|
{
|
|
|
|
|
aSize.Width() += rBorder.Left() + rBorder.Right();
|
|
|
|
|
aSize.Height() += rBorder.Top() + rBorder.Bottom();
|
|
|
|
|
|
|
|
|
|
Size aOldSize = GetWindow().GetOutputSizePixel();
|
|
|
|
|
GetWindow().SetOutputSizePixel( aSize );
|
|
|
|
|
Window* pParent = &GetWindow();
|
|
|
|
|
while ( pParent->GetParent() )
|
|
|
|
|
pParent = pParent->GetParent();
|
|
|
|
|
Size aOuterSize = pParent->GetOutputSizePixel();
|
|
|
|
|
aOuterSize.Width() += ( aSize.Width() - aOldSize.Width() );
|
|
|
|
|
aOuterSize.Height() += ( aSize.Height() - aOldSize.Height() );
|
|
|
|
|
pParent->SetOutputSizePixel( aOuterSize );
|
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Point aPoint;
|
|
|
|
|
Rectangle aEditArea( aPoint, GetWindow().GetOutputSizePixel() );
|
|
|
|
|
aEditArea.Left() += rBorder.Left();
|
|
|
|
|
aEditArea.Right() -= rBorder.Right();
|
|
|
|
|
aEditArea.Top() += rBorder.Top();
|
|
|
|
|
aEditArea.Bottom() -= rBorder.Bottom();
|
|
|
|
|
pVSh->GetWindow()->SetPosSizePixel( aEditArea.TopLeft(), aEditArea.GetSize() );
|
|
|
|
|
}
|
|
|
|
|
return sal_True;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return sal_False;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SfxTopViewFrame::Exec_Impl(SfxRequest &rReq )
|
|
|
|
|
{
|
|
|
|
|
// Wenn gerade die Shells ausgetauscht werden...
|
|
|
|
|
if ( !GetObjectShell() || !GetViewShell() )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
switch ( rReq.GetSlot() )
|
|
|
|
|
{
|
2001-06-29 10:29:48 +00:00
|
|
|
case SID_SHOWPOPUPS :
|
|
|
|
|
{
|
|
|
|
|
SFX_REQUEST_ARG(rReq, pShowItem, SfxBoolItem, SID_SHOWPOPUPS, FALSE);
|
|
|
|
|
BOOL bShow = pShowItem ? pShowItem->GetValue() : TRUE;
|
|
|
|
|
SFX_REQUEST_ARG(rReq, pIdItem, SfxUInt16Item, SID_CONFIGITEMID, FALSE);
|
|
|
|
|
USHORT nId = pIdItem ? pIdItem->GetValue() : 0;
|
|
|
|
|
|
|
|
|
|
// ausfuehren
|
|
|
|
|
SfxWorkWindow *pWorkWin = GetFrame()->GetWorkWindow_Impl();
|
|
|
|
|
if ( bShow )
|
|
|
|
|
{
|
|
|
|
|
// Zuerst die Floats auch anzeigbar machen
|
|
|
|
|
pWorkWin->MakeChildsVisible_Impl( bShow );
|
|
|
|
|
GetDispatcher()->Update_Impl( TRUE );
|
|
|
|
|
|
|
|
|
|
// Dann anzeigen
|
|
|
|
|
GetBindings().HidePopups( !bShow );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Alles hiden
|
|
|
|
|
SfxBindings *pBind = &GetBindings();
|
|
|
|
|
while ( pBind )
|
|
|
|
|
{
|
|
|
|
|
pBind->HidePopupCtrls_Impl( !bShow );
|
|
|
|
|
pBind = pBind->GetSubBindings_Impl();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pWorkWin->HidePopups_Impl( !bShow, TRUE, nId );
|
|
|
|
|
pWorkWin->MakeChildsVisible_Impl( bShow );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Invalidate( rReq.GetSlot() );
|
|
|
|
|
rReq.Done();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
case SID_ACTIVATE:
|
|
|
|
|
{
|
|
|
|
|
MakeActive_Impl( TRUE );
|
|
|
|
|
rReq.SetReturnValue( SfxObjectItem( 0, this ) );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case SID_WIN_POSSIZE:
|
|
|
|
|
break;
|
|
|
|
|
|
2001-06-27 11:32:26 +00:00
|
|
|
case SID_NEWDOCDIRECT :
|
|
|
|
|
{
|
2001-09-27 09:43:13 +00:00
|
|
|
SFX_REQUEST_ARG( rReq, pFactoryItem, SfxStringItem, SID_NEWDOCDIRECT, FALSE);
|
2001-10-12 11:00:30 +00:00
|
|
|
String aFactName;
|
|
|
|
|
if ( pFactoryItem )
|
|
|
|
|
aFactName = pFactoryItem->GetValue();
|
2003-05-15 09:54:49 +00:00
|
|
|
else if ( pImp->aFactoryName.Len() )
|
|
|
|
|
aFactName = pImp->aFactoryName;
|
|
|
|
|
else
|
2001-07-03 16:35:30 +00:00
|
|
|
{
|
2001-10-12 11:00:30 +00:00
|
|
|
DBG_ERROR("Missing argument!");
|
|
|
|
|
break;
|
2001-07-03 16:35:30 +00:00
|
|
|
}
|
2001-10-12 11:00:30 +00:00
|
|
|
|
|
|
|
|
SfxRequest aReq( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, GetPool() );
|
|
|
|
|
String aFact = String::CreateFromAscii("private:factory/");
|
2003-05-15 09:54:49 +00:00
|
|
|
aFact += aFactName;
|
2001-10-12 11:00:30 +00:00
|
|
|
aReq.AppendItem( SfxStringItem( SID_FILE_NAME, aFact ) );
|
|
|
|
|
aReq.AppendItem( SfxFrameItem( SID_DOCFRAME, GetFrame() ) );
|
|
|
|
|
aReq.AppendItem( SfxStringItem( SID_TARGETNAME, String::CreateFromAscii( "_blank" ) ) );
|
|
|
|
|
SFX_APP()->ExecuteSlot( aReq );
|
2001-11-01 08:17:53 +00:00
|
|
|
const SfxViewFrameItem* pItem = PTR_CAST( SfxViewFrameItem, aReq.GetReturnValue() );
|
|
|
|
|
if ( pItem )
|
|
|
|
|
rReq.SetReturnValue( SfxFrameItem( 0, pItem->GetFrame() ) );
|
2001-06-27 11:32:26 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
case SID_CLOSEWIN:
|
|
|
|
|
{
|
2001-08-21 09:22:06 +00:00
|
|
|
// disable CloseWin, if frame is not a task
|
2002-05-23 12:16:46 +00:00
|
|
|
Reference < XCloseable > xTask( GetFrame()->GetFrameInterface(), UNO_QUERY );
|
2001-08-21 09:22:06 +00:00
|
|
|
if ( !xTask.is() )
|
|
|
|
|
break;
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( GetViewShell()->PrepareClose() )
|
|
|
|
|
{
|
2001-06-27 11:32:26 +00:00
|
|
|
// weitere Views auf dasselbe Doc?
|
2000-09-18 16:07:07 +00:00
|
|
|
SfxObjectShell *pDocSh = GetObjectShell();
|
|
|
|
|
int bOther = sal_False;
|
|
|
|
|
for ( const SfxTopViewFrame *pFrame =
|
|
|
|
|
(SfxTopViewFrame *)SfxViewFrame::GetFirst( pDocSh, TYPE(SfxTopViewFrame) );
|
|
|
|
|
!bOther && pFrame;
|
|
|
|
|
pFrame = (SfxTopViewFrame *)SfxViewFrame::GetNext( *pFrame, pDocSh, TYPE(SfxTopViewFrame) ) )
|
|
|
|
|
bOther = (pFrame != this);
|
|
|
|
|
|
2006-05-02 16:06:52 +00:00
|
|
|
// Doc braucht nur gefragt zu werden, wenn keine weitere View
|
2000-09-18 16:07:07 +00:00
|
|
|
sal_Bool bClosed = sal_False;
|
2001-08-31 14:52:31 +00:00
|
|
|
sal_Bool bUI = TRUE;
|
|
|
|
|
if ( ( bOther || pDocSh->PrepareClose( bUI ) ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-03-27 10:29:38 +00:00
|
|
|
if ( !bOther )
|
|
|
|
|
pDocSh->SetModified( FALSE );
|
2000-09-18 16:07:07 +00:00
|
|
|
rReq.Done(); // unbedingt vor Close() rufen!
|
2002-05-23 12:16:46 +00:00
|
|
|
bClosed = sal_False;
|
2002-10-28 11:49:16 +00:00
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
xTask->close(sal_True);
|
|
|
|
|
bClosed = sal_True;
|
|
|
|
|
}
|
|
|
|
|
catch( CloseVetoException& )
|
|
|
|
|
{
|
|
|
|
|
bClosed = sal_False;
|
2002-05-23 12:16:46 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bClosed ));
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rReq.Done();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SfxTopViewFrame::GetState_Impl( SfxItemSet &rSet )
|
|
|
|
|
{
|
|
|
|
|
SfxObjectShell *pDocSh = GetObjectShell();
|
|
|
|
|
|
|
|
|
|
if ( !pDocSh )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
const sal_uInt16 *pRanges = rSet.GetRanges();
|
|
|
|
|
DBG_ASSERT(pRanges, "Set ohne Bereich");
|
|
|
|
|
while ( *pRanges )
|
|
|
|
|
{
|
|
|
|
|
for ( sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich )
|
|
|
|
|
{
|
|
|
|
|
switch(nWhich)
|
|
|
|
|
{
|
2001-06-27 11:32:26 +00:00
|
|
|
case SID_NEWDOCDIRECT :
|
|
|
|
|
{
|
2003-03-27 10:29:38 +00:00
|
|
|
if ( pImp->aFactoryName.Len() )
|
2002-05-16 13:10:18 +00:00
|
|
|
{
|
|
|
|
|
String aFact = String::CreateFromAscii("private:factory/");
|
2003-03-27 10:29:38 +00:00
|
|
|
aFact += pImp->aFactoryName;
|
2002-05-16 13:10:18 +00:00
|
|
|
rSet.Put( SfxStringItem( nWhich, aFact ) );
|
|
|
|
|
}
|
2001-06-27 11:32:26 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
case SID_NEWWINDOW:
|
|
|
|
|
rSet.DisableItem(nWhich);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SID_CLOSEWIN:
|
2001-08-21 09:22:06 +00:00
|
|
|
{
|
|
|
|
|
// disable CloseWin, if frame is not a task
|
2002-05-23 12:16:46 +00:00
|
|
|
Reference < XCloseable > xTask( GetFrame()->GetFrameInterface(), UNO_QUERY );
|
2001-08-21 09:22:06 +00:00
|
|
|
if ( !xTask.is() )
|
|
|
|
|
rSet.DisableItem(nWhich);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-17 14:50:34 +00:00
|
|
|
case SID_SHOWPOPUPS :
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SID_WIN_POSSIZE:
|
|
|
|
|
{
|
|
|
|
|
rSet.Put( SfxRectangleItem( nWhich, Rectangle(
|
|
|
|
|
GetWindow().GetPosPixel(), GetWindow().GetSizePixel() ) ) );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
DBG_ERROR( "invalid message-id" );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
++pRanges;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SfxTopViewFrame::INetExecute_Impl( SfxRequest &rRequest )
|
|
|
|
|
{
|
|
|
|
|
sal_uInt16 nSlotId = rRequest.GetSlot();
|
|
|
|
|
switch( nSlotId )
|
|
|
|
|
{
|
|
|
|
|
case SID_BROWSE_FORWARD:
|
|
|
|
|
case SID_BROWSE_BACKWARD:
|
|
|
|
|
{
|
|
|
|
|
// Anzeige der n"achsten oder vorherigen Seite aus der History
|
|
|
|
|
SFX_REQUEST_ARG( rRequest, pSteps, SfxUInt16Item, nSlotId, sal_False );
|
|
|
|
|
GetFrame()->Browse( nSlotId == SID_BROWSE_FORWARD, pSteps ? pSteps->GetValue() : 1,
|
|
|
|
|
(rRequest.GetModifier() & KEY_MOD1) != 0 );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case SID_CREATELINK:
|
|
|
|
|
{
|
|
|
|
|
/*! (pb) we need new implementation to create a link
|
|
|
|
|
*/
|
|
|
|
|
break;
|
|
|
|
|
}
|
2001-11-15 14:13:16 +00:00
|
|
|
case SID_BROWSE_STOP:
|
|
|
|
|
{
|
|
|
|
|
if ( GetCancelManager() )
|
|
|
|
|
GetCancelManager()->Cancel( TRUE );
|
|
|
|
|
|
|
|
|
|
// cancel jobs in hidden tasks
|
|
|
|
|
SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames;
|
|
|
|
|
for( USHORT nPos = rArr.Count(); nPos--; )
|
|
|
|
|
{
|
|
|
|
|
SfxFrame *pFrame = rArr[ nPos ];
|
|
|
|
|
if ( !pFrame->GetCurrentViewFrame() )
|
|
|
|
|
pFrame->GetCancelManager()->Cancel( TRUE );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case SID_FOCUSURLBOX:
|
|
|
|
|
{
|
|
|
|
|
SfxStateCache *pCache = GetBindings().GetAnyStateCache_Impl( SID_OPENURL );
|
|
|
|
|
if( pCache )
|
|
|
|
|
{
|
|
|
|
|
SfxControllerItem* pCtrl = pCache->GetItemLink();
|
|
|
|
|
while( pCtrl )
|
|
|
|
|
{
|
|
|
|
|
pCtrl->StateChanged( SID_FOCUSURLBOX, SFX_ITEM_UNKNOWN, 0 );
|
|
|
|
|
pCtrl = pCtrl->GetItemLink();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-06-14 10:31:49 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// Recording
|
|
|
|
|
rRequest.Done();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SfxTopViewFrame::INetState_Impl( SfxItemSet &rItemSet )
|
|
|
|
|
{
|
|
|
|
|
if ( !GetFrame()->CanBrowseForward() )
|
|
|
|
|
rItemSet.DisableItem( SID_BROWSE_FORWARD );
|
|
|
|
|
|
|
|
|
|
if ( !GetFrame()->CanBrowseBackward() )
|
|
|
|
|
rItemSet.DisableItem( SID_BROWSE_BACKWARD );
|
|
|
|
|
|
2001-11-15 14:13:16 +00:00
|
|
|
// Add/SaveToBookmark bei BASIC-IDE, QUERY-EDITOR etc. disablen
|
2000-09-18 16:07:07 +00:00
|
|
|
SfxObjectShell *pDocSh = GetObjectShell();
|
2001-11-15 14:13:16 +00:00
|
|
|
sal_Bool bPseudo = pDocSh && !( pDocSh->GetFactory().GetFlags() & SFXOBJECTSHELL_HASOPENDOC );
|
|
|
|
|
sal_Bool bEmbedded = pDocSh && pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !pDocSh || bPseudo || bEmbedded || !pDocSh->HasName() )
|
|
|
|
|
rItemSet.DisableItem( SID_CREATELINK );
|
2001-11-15 14:13:16 +00:00
|
|
|
|
|
|
|
|
pImp->pStopButtonTimer->SetButtonState( GetCancelManager()->CanCancel() );
|
|
|
|
|
if ( !pImp->pStopButtonTimer->GetButtonState() )
|
|
|
|
|
rItemSet.DisableItem( SID_BROWSE_STOP );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SfxTopViewFrame::SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY )
|
|
|
|
|
{
|
|
|
|
|
GetViewShell()->SetZoomFactor( rZoomX, rZoomY );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SfxTopViewFrame::Activate( sal_Bool bMDI )
|
|
|
|
|
{
|
|
|
|
|
DBG_ASSERT(GetViewShell(), "Keine Shell");
|
2006-11-01 17:29:27 +00:00
|
|
|
if ( bMDI )
|
2000-09-18 16:07:07 +00:00
|
|
|
pImp->bActive = sal_True;
|
|
|
|
|
//(mba): hier evtl. wie in Beanframe NotifyEvent ?!
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SfxTopViewFrame::Deactivate( sal_Bool bMDI )
|
|
|
|
|
{
|
|
|
|
|
DBG_ASSERT(GetViewShell(), "Keine Shell");
|
2006-11-01 17:29:27 +00:00
|
|
|
if ( bMDI )
|
2000-09-18 16:07:07 +00:00
|
|
|
pImp->bActive = sal_False;
|
|
|
|
|
//(mba): hier evtl. wie in Beanframe NotifyEvent ?!
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-07 09:19:26 +00:00
|
|
|
void SfxTopFrame::CheckMenuCloser_Impl( MenuBar* pMenuBar )
|
|
|
|
|
{
|
|
|
|
|
Reference < ::com::sun::star::frame::XFrame > xFrame = GetFrameInterface();
|
|
|
|
|
|
|
|
|
|
// checks if there is more than one "real" (not help) task window
|
|
|
|
|
// in this case a close button is inserted into the menubar
|
|
|
|
|
|
2006-02-10 09:20:47 +00:00
|
|
|
DBG_ASSERT( xFrame.is(), "Attention: this bug is very hard to reproduce. Please try to remember how you triggered it!");
|
2003-12-01 10:59:42 +00:00
|
|
|
if ( !xFrame.is() || !xFrame->getController().is() )
|
2002-10-07 09:19:26 +00:00
|
|
|
// dummy component
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
Reference < ::com::sun::star::frame::XFramesSupplier > xDesktop( xFrame->getCreator(), UNO_QUERY );
|
|
|
|
|
if ( !xDesktop.is() )
|
|
|
|
|
// test only for task windows
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
sal_Bool bLastTask = sal_False;
|
|
|
|
|
Reference < ::com::sun::star::container::XIndexAccess >
|
|
|
|
|
xList ( xDesktop->getFrames(), ::com::sun::star::uno::UNO_QUERY );
|
|
|
|
|
sal_Int32 nCount = xList->getCount();
|
|
|
|
|
if ( nCount<=1 )
|
|
|
|
|
// only one task
|
|
|
|
|
bLastTask = sal_True;
|
|
|
|
|
else if ( nCount==2 )
|
|
|
|
|
{
|
|
|
|
|
// if we have to tasks, one can be the help task, that should be ignored
|
|
|
|
|
for( sal_Int32 i=0; i<nCount; ++i )
|
|
|
|
|
{
|
|
|
|
|
Reference < ::com::sun::star::frame::XFrame > xTask;
|
|
|
|
|
::com::sun::star::uno::Any aVal = xList->getByIndex(i);
|
|
|
|
|
if ( (aVal>>=xTask) && xTask.is() && xTask->getName().compareToAscii("OFFICE_HELP_TASK") == COMPARE_EQUAL )
|
|
|
|
|
{
|
|
|
|
|
// one of the two open tasks was the help task -> ignored
|
|
|
|
|
bLastTask = sal_True;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pMenuBar->ShowCloser(bLastTask);
|
|
|
|
|
}
|