2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-07-05 20:18:35 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2006-09-17 15:50:53 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-12-09 11:12:09 +01:00
|
|
|
#include "impframe.hxx"
|
|
|
|
#include "objshimp.hxx"
|
2013-11-11 22:11:22 -06:00
|
|
|
#include <sfx2/sfxhelp.hxx>
|
2009-12-09 11:12:09 +01:00
|
|
|
#include "workwin.hxx"
|
|
|
|
|
2013-11-11 22:11:22 -06:00
|
|
|
#include <sfx2/app.hxx>
|
|
|
|
#include <sfx2/bindings.hxx>
|
|
|
|
#include <sfx2/dispatch.hxx>
|
|
|
|
#include <sfx2/docfac.hxx>
|
|
|
|
#include <sfx2/docfile.hxx>
|
|
|
|
#include <sfx2/event.hxx>
|
|
|
|
#include <sfx2/objface.hxx>
|
|
|
|
#include <sfx2/request.hxx>
|
2009-12-09 11:12:09 +01:00
|
|
|
|
2006-11-01 17:29:27 +00:00
|
|
|
#include <com/sun/star/awt/XWindow2.hpp>
|
2009-12-09 11:12:09 +01:00
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
2012-12-14 12:58:00 +02:00
|
|
|
#include <com/sun/star/frame/Desktop.hpp>
|
2009-12-03 09:29:45 +01:00
|
|
|
#include <com/sun/star/frame/XComponentLoader.hpp>
|
2013-03-22 09:24:15 +02:00
|
|
|
#include <com/sun/star/frame/Frame.hpp>
|
2009-12-09 11:12:09 +01:00
|
|
|
#include <com/sun/star/frame/XFramesSupplier.hpp>
|
|
|
|
#include <com/sun/star/frame/XLayoutManager.hpp>
|
|
|
|
|
|
|
|
#include <comphelper/namedvaluecollection.hxx>
|
|
|
|
#include <comphelper/processfactory.hxx>
|
2010-01-08 22:50:33 +01:00
|
|
|
#include <svl/eitem.hxx>
|
|
|
|
#include <svl/intitem.hxx>
|
2010-01-11 09:53:12 +01:00
|
|
|
#include <svl/itemset.hxx>
|
2010-01-08 22:50:33 +01:00
|
|
|
#include <svl/rectitem.hxx>
|
|
|
|
#include <svl/stritem.hxx>
|
2009-12-09 11:12:09 +01:00
|
|
|
#include <toolkit/helper/vclunohelper.hxx>
|
2009-11-27 21:16:24 +01:00
|
|
|
#include <tools/diagnose_ex.h>
|
2014-11-21 22:17:04 -05:00
|
|
|
#include <vcl/syswin.hxx>
|
2004-11-17 09:25:21 +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;
|
2009-12-03 09:29:45 +01:00
|
|
|
using ::com::sun::star::lang::XMultiServiceFactory;
|
|
|
|
using ::com::sun::star::lang::XComponent;
|
|
|
|
using ::com::sun::star::frame::XComponentLoader;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
class SfxFrameWindow_Impl : public vcl::Window
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
public:
|
2009-11-27 21:16:24 +01:00
|
|
|
SfxFrame* pFrame;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
SfxFrameWindow_Impl( SfxFrame* pF, vcl::Window& i_rContainerWindow );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
|
|
|
|
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
|
|
|
|
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
|
|
|
|
virtual bool Notify( NotifyEvent& rEvt ) SAL_OVERRIDE;
|
|
|
|
virtual void Resize() SAL_OVERRIDE;
|
|
|
|
virtual void GetFocus() SAL_OVERRIDE;
|
2000-09-18 16:07:07 +00:00
|
|
|
void DoResize();
|
|
|
|
};
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
SfxFrameWindow_Impl::SfxFrameWindow_Impl( SfxFrame* pF, vcl::Window& i_rContainerWindow )
|
2009-12-03 13:51:54 +01:00
|
|
|
: Window( &i_rContainerWindow, WB_BORDER | WB_CLIPCHILDREN | WB_NODIALOGCONTROL | WB_3DLOOK )
|
2000-09-18 16:07:07 +00:00
|
|
|
, pFrame( pF )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-12-09 11:12:09 +01:00
|
|
|
void SfxFrameWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
|
2002-04-23 16:08:25 +00:00
|
|
|
{
|
|
|
|
Window::DataChanged( rDCEvt );
|
|
|
|
SfxWorkWindow *pWorkWin = pFrame->GetWorkWindow_Impl();
|
|
|
|
if ( pWorkWin )
|
|
|
|
pWorkWin->DataChanged_Impl( rDCEvt );
|
|
|
|
}
|
|
|
|
|
2014-01-17 16:40:50 +01:00
|
|
|
bool SfxFrameWindow_Impl::Notify( NotifyEvent& rNEvt )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2002-08-23 10:10:28 +00:00
|
|
|
if ( pFrame->IsClosing_Impl() || !pFrame->GetFrameInterface().is() )
|
2014-01-17 16:40:50 +01:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
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 );
|
|
|
|
|
2014-11-26 14:53:25 +00:00
|
|
|
if ( rNEvt.GetType() == MouseNotifyEvent::GETFOCUS )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-11-01 17:29:27 +00:00
|
|
|
if ( pView->GetViewShell() && !pView->GetViewShell()->GetUIActiveIPClient_Impl() && !pFrame->IsInPlace() )
|
2007-01-23 06:15:03 +00:00
|
|
|
{
|
2011-03-08 13:48:14 +01:00
|
|
|
OSL_TRACE("SfxFrame: GotFocus");
|
2014-03-19 09:01:06 +02:00
|
|
|
pView->MakeActive_Impl( false );
|
2007-01-23 06:15:03 +00:00
|
|
|
}
|
2005-03-23 13:26:23 +00:00
|
|
|
|
2009-09-18 10:15:03 +00:00
|
|
|
// if focus was on an external window, the clipboard content might have been changed
|
|
|
|
pView->GetBindings().Invalidate( SID_PASTE );
|
|
|
|
pView->GetBindings().Invalidate( SID_PASTE_SPECIAL );
|
2014-01-17 16:40:50 +01:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2014-11-26 14:53:25 +00:00
|
|
|
else if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
|
2001-11-01 08:17:53 +00:00
|
|
|
{
|
2001-11-06 08:25:33 +00:00
|
|
|
if ( pView->GetViewShell()->KeyInput( *rNEvt.GetKeyEvent() ) )
|
2014-01-17 16:40:50 +01:00
|
|
|
return true;
|
2001-11-01 08:17:53 +00:00
|
|
|
}
|
2014-11-26 14:53:25 +00:00
|
|
|
else if ( rNEvt.GetType() == MouseNotifyEvent::EXECUTEDIALOG /*|| rNEvt.GetType() == MouseNotifyEvent::INPUTDISABLE*/ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-03-19 09:01:06 +02:00
|
|
|
pView->SetModalMode( true );
|
2014-01-17 16:40:50 +01:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2014-11-26 14:53:25 +00:00
|
|
|
else if ( rNEvt.GetType() == MouseNotifyEvent::ENDEXECUTEDIALOG /*|| rNEvt.GetType() == MouseNotifyEvent::INPUTENABLE*/ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-03-19 09:01:06 +02:00
|
|
|
pView->SetModalMode( false );
|
2014-01-17 16:40:50 +01:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return Window::Notify( rNEvt );
|
|
|
|
}
|
|
|
|
|
2014-01-18 00:18:52 +01:00
|
|
|
bool SfxFrameWindow_Impl::PreNotify( NotifyEvent& rNEvt )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-11-26 14:53:25 +00:00
|
|
|
MouseNotifyEvent nType = rNEvt.GetType();
|
|
|
|
if ( nType == MouseNotifyEvent::KEYINPUT || nType == MouseNotifyEvent::KEYUP )
|
2003-03-27 10:29:38 +00:00
|
|
|
{
|
|
|
|
SfxViewFrame* pView = pFrame->GetCurrentViewFrame();
|
|
|
|
SfxViewShell* pShell = pView ? pView->GetViewShell() : NULL;
|
|
|
|
if ( pShell && pShell->HasKeyListeners_Impl() && pShell->HandleNotifyEvent_Impl( rNEvt ) )
|
2014-01-18 00:18:52 +01:00
|
|
|
return true;
|
2003-03-27 10:29:38 +00:00
|
|
|
}
|
2014-11-26 14:53:25 +00:00
|
|
|
else if ( nType == MouseNotifyEvent::MOUSEBUTTONUP || nType == MouseNotifyEvent::MOUSEBUTTONDOWN )
|
2003-03-27 10:29:38 +00:00
|
|
|
{
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* pWindow = rNEvt.GetWindow();
|
2003-03-27 10:29:38 +00:00
|
|
|
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 ) )
|
2014-01-18 00:18:52 +01:00
|
|
|
return true;
|
2003-03-27 10:29:38 +00:00
|
|
|
}
|
|
|
|
|
2014-11-26 14:53:25 +00:00
|
|
|
if ( nType == MouseNotifyEvent::MOUSEBUTTONDOWN )
|
2001-02-19 10:55:10 +00:00
|
|
|
{
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* pWindow = rNEvt.GetWindow();
|
2001-02-19 10:55:10 +00:00
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
2009-12-09 11:12:09 +01:00
|
|
|
void SfxFrameWindow_Impl::GetFocus()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2002-09-03 10:47:39 +00:00
|
|
|
if ( pFrame && !pFrame->IsClosing_Impl() && pFrame->GetCurrentViewFrame() && pFrame->GetFrameInterface().is() )
|
2014-03-19 09:01:06 +02:00
|
|
|
pFrame->GetCurrentViewFrame()->MakeActive_Impl( true );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2009-12-09 11:12:09 +01:00
|
|
|
void SfxFrameWindow_Impl::Resize()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-12-03 16:46:38 +00:00
|
|
|
if ( IsReallyVisible() || IsReallyShown() || GetOutputSizePixel().Width() )
|
2000-09-18 16:07:07 +00:00
|
|
|
DoResize();
|
|
|
|
}
|
|
|
|
|
2009-12-09 11:12:09 +01:00
|
|
|
void SfxFrameWindow_Impl::StateChanged( StateChangedType nStateChange )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-05-05 13:46:44 +02:00
|
|
|
if ( nStateChange == StateChangedType::InitShow )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-01-28 19:57:12 +01: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 )
|
2011-12-07 02:33:51 -08:00
|
|
|
pView->GetBindings().GetWorkWindow_Impl()->ShowChildren_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
|
|
|
}
|
|
|
|
|
2009-12-09 11:12:09 +01:00
|
|
|
void SfxFrameWindow_Impl::DoResize()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( !pFrame->pImp->bLockResize )
|
|
|
|
pFrame->Resize();
|
|
|
|
}
|
|
|
|
|
2009-12-17 13:44:23 +01:00
|
|
|
Reference < XFrame > SfxFrame::CreateBlankFrame()
|
2009-12-04 12:17:03 +01:00
|
|
|
{
|
2009-12-17 13:44:23 +01:00
|
|
|
Reference < XFrame > xFrame;
|
2009-12-04 12:17:03 +01:00
|
|
|
try
|
|
|
|
{
|
2012-12-14 12:58:00 +02:00
|
|
|
Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
|
2013-02-01 09:33:19 +01:00
|
|
|
xFrame.set( xDesktop->findFrame( "_blank", 0 ), UNO_SET_THROW );
|
2009-12-04 12:17:03 +01:00
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
2009-12-17 13:44:23 +01:00
|
|
|
return xFrame;
|
2009-12-04 12:17:03 +01:00
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, vcl::Window& rWindow, sal_uInt16 nViewId, bool bHidden )
|
2001-06-27 11:32:26 +00:00
|
|
|
{
|
2009-12-03 09:29:45 +01:00
|
|
|
SfxFrame* pFrame = NULL;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
// create and initialize new top level frame for this window
|
2013-03-19 13:08:47 +02:00
|
|
|
Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
|
|
|
|
Reference < XDesktop2 > xDesktop = Desktop::create( xContext );
|
2013-03-22 09:24:15 +02:00
|
|
|
Reference < XFrame2 > xFrame = Frame::create( xContext );
|
2001-06-27 11:32:26 +00:00
|
|
|
|
2009-12-03 09:29:45 +01:00
|
|
|
Reference< awt::XWindow2 > xWin( VCLUnoHelper::GetInterface ( &rWindow ), uno::UNO_QUERY_THROW );
|
|
|
|
xFrame->initialize( xWin.get() );
|
2013-05-02 10:36:43 +02:00
|
|
|
xDesktop->getFrames()->append( xFrame );
|
2001-06-27 11:32:26 +00:00
|
|
|
|
2009-12-03 09:29:45 +01:00
|
|
|
if ( xWin->isActive() )
|
|
|
|
xFrame->activate();
|
2006-11-01 17:29:27 +00:00
|
|
|
|
2009-12-03 09:29:45 +01:00
|
|
|
// create load arguments
|
|
|
|
Sequence< PropertyValue > aLoadArgs;
|
|
|
|
TransformItems( SID_OPENDOC, *rDoc.GetMedium()->GetItemSet(), aLoadArgs );
|
2001-06-27 11:32:26 +00:00
|
|
|
|
2009-12-03 09:29:45 +01:00
|
|
|
::comphelper::NamedValueCollection aArgs( aLoadArgs );
|
|
|
|
aArgs.put( "Model", rDoc.GetModel() );
|
|
|
|
aArgs.put( "Hidden", bHidden );
|
2001-06-27 11:32:26 +00:00
|
|
|
if ( nViewId )
|
2009-12-03 09:29:45 +01:00
|
|
|
aArgs.put( "ViewId", nViewId );
|
|
|
|
|
|
|
|
aLoadArgs = aArgs.getPropertyValues();
|
|
|
|
|
|
|
|
// load the doc into that frame
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sLoaderURL( "private:object" );
|
2009-12-03 09:29:45 +01:00
|
|
|
Reference< XComponentLoader > xLoader( xFrame, UNO_QUERY_THROW );
|
|
|
|
xLoader->loadComponentFromURL(
|
2009-12-10 12:41:28 +01:00
|
|
|
sLoaderURL,
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString( "_self" ),
|
2009-12-03 09:29:45 +01:00
|
|
|
0,
|
|
|
|
aLoadArgs
|
|
|
|
);
|
|
|
|
|
|
|
|
for ( pFrame = SfxFrame::GetFirst();
|
|
|
|
pFrame;
|
|
|
|
pFrame = SfxFrame::GetNext( *pFrame )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if ( pFrame->GetFrameInterface() == xFrame )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
OSL_ENSURE( pFrame, "SfxFrame::Create: load succeeded, but no SfxFrame was created during this!" );
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
2001-06-27 11:32:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return pFrame;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-12-17 13:44:23 +01:00
|
|
|
SfxFrame* SfxFrame::Create( const Reference < XFrame >& i_rFrame )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// create a new TopFrame to an external XFrame object ( wrap controller )
|
2009-12-17 13:44:23 +01:00
|
|
|
ENSURE_OR_THROW( i_rFrame.is(), "NULL frame not allowed" );
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* pWindow = VCLUnoHelper::GetWindow( i_rFrame->getContainerWindow() );
|
2009-11-27 21:16:24 +01:00
|
|
|
ENSURE_OR_THROW( pWindow, "frame without container window not allowed" );
|
|
|
|
|
|
|
|
SfxFrame* pFrame = new SfxFrame( *pWindow, false );
|
2009-12-17 13:44:23 +01:00
|
|
|
pFrame->SetFrameInterface_Impl( i_rFrame );
|
2000-09-18 16:07:07 +00:00
|
|
|
return pFrame;
|
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
SfxFrame::SfxFrame( vcl::Window& i_rContainerWindow, bool i_bHidden )
|
2014-07-25 13:50:40 +01:00
|
|
|
:SvCompatWeakBase<SfxFrame>( this )
|
2014-07-10 17:05:19 +02:00
|
|
|
,pParentFrame( NULL )
|
2009-11-27 21:16:24 +01:00
|
|
|
,pChildArr( NULL )
|
|
|
|
,pImp( NULL )
|
|
|
|
,pWindow( NULL )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2009-11-27 21:16:24 +01:00
|
|
|
Construct_Impl();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-11-27 21:16:24 +01:00
|
|
|
pImp->bHidden = i_bHidden;
|
|
|
|
InsertTopFrame_Impl( this );
|
2009-12-03 13:51:54 +01:00
|
|
|
pImp->pExternalContainerWindow = &i_rContainerWindow;
|
|
|
|
|
2015-04-17 17:53:05 +02:00
|
|
|
pWindow = VclPtr<SfxFrameWindow_Impl>::Create( this, i_rContainerWindow );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-12-03 13:51:54 +01:00
|
|
|
// always show pWindow, which is the ComponentWindow of the XFrame we live in
|
|
|
|
// nowadays, since SfxFrames can be created with an XFrame only, hiding or showing the complete XFrame
|
|
|
|
// is not done at level of the container window, not at SFX level. Thus, the component window can
|
|
|
|
// always be visible.
|
|
|
|
pWindow->Show();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-03-14 07:50:04 +02:00
|
|
|
void SfxFrame::SetPresentationMode( bool bSet )
|
2001-06-29 10:29:48 +00:00
|
|
|
{
|
2001-09-04 09:39:24 +00:00
|
|
|
if ( GetCurrentViewFrame() )
|
2014-10-20 09:10:45 +02:00
|
|
|
GetCurrentViewFrame()->GetWindow().SetBorderStyle( bSet ? WindowBorderStyle::NOBORDER : WindowBorderStyle::NORMAL );
|
2001-09-04 09:39:24 +00:00
|
|
|
|
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() )
|
|
|
|
{
|
2013-06-29 21:24:12 +02:00
|
|
|
Any aValue = xPropSet->getPropertyValue("LayoutManager");
|
2005-10-27 13:06:22 +00:00
|
|
|
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() )
|
2014-03-13 10:22:49 +02:00
|
|
|
GetCurrentViewFrame()->GetDispatcher()->Update_Impl( true );
|
2001-06-29 10:29:48 +00:00
|
|
|
}
|
|
|
|
|
2009-11-27 21:16:24 +01:00
|
|
|
SystemWindow* SfxFrame::GetSystemWindow() const
|
2007-12-07 11:22:26 +00:00
|
|
|
{
|
|
|
|
return GetTopWindow_Impl();
|
|
|
|
}
|
|
|
|
|
2009-11-27 21:16:24 +01:00
|
|
|
SystemWindow* SfxFrame::GetTopWindow_Impl() const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2009-12-03 13:51:54 +01:00
|
|
|
if ( pImp->pExternalContainerWindow->IsSystemWindow() )
|
2015-03-09 14:29:30 +02:00
|
|
|
return static_cast<SystemWindow*>( pImp->pExternalContainerWindow.get() );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-03-14 07:50:04 +02:00
|
|
|
bool SfxFrame::Close()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
delete this;
|
2014-03-14 07:50:04 +02:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-03-14 07:50:04 +02:00
|
|
|
void SfxFrame::LockResize_Impl( bool bLock )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pImp->bLockResize = bLock;
|
|
|
|
}
|
|
|
|
|
2014-03-14 07:50:04 +02:00
|
|
|
void SfxFrame::SetMenuBarOn_Impl( bool bOn )
|
2001-06-21 12:57:41 +00:00
|
|
|
{
|
|
|
|
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() )
|
|
|
|
{
|
2013-06-29 21:24:12 +02:00
|
|
|
Any aValue = xPropSet->getPropertyValue("LayoutManager");
|
2004-02-25 14:48:48 +00:00
|
|
|
aValue >>= xLayoutManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( xLayoutManager.is() )
|
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aMenuBarURL( "private:resource/menubar/menubar" );
|
2004-02-25 14:48:48 +00:00
|
|
|
|
|
|
|
if ( bOn )
|
|
|
|
xLayoutManager->showElement( aMenuBarURL );
|
|
|
|
else
|
|
|
|
xLayoutManager->hideElement( aMenuBarURL );
|
|
|
|
}
|
2001-06-21 12:57:41 +00:00
|
|
|
}
|
|
|
|
|
2014-03-14 07:50:04 +02:00
|
|
|
bool SfxFrame::IsMenuBarOn_Impl() const
|
2001-06-21 12:57:41 +00:00
|
|
|
{
|
|
|
|
return pImp->bMenuBarOn;
|
2004-07-06 12:41:00 +00:00
|
|
|
}
|
|
|
|
|
2009-12-11 21:51:06 +01:00
|
|
|
void SfxFrame::PrepareForDoc_Impl( SfxObjectShell& i_rDoc )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2009-12-11 21:51:06 +01:00
|
|
|
const ::comphelper::NamedValueCollection aDocumentArgs( i_rDoc.GetModel()->getArgs() );
|
|
|
|
|
2009-12-09 12:29:14 +01:00
|
|
|
// hidden?
|
2009-12-10 15:36:53 +01:00
|
|
|
OSL_ENSURE( !pImp->bHidden, "when does this happen?" );
|
2009-12-11 21:51:06 +01:00
|
|
|
pImp->bHidden = aDocumentArgs.getOrDefault( "Hidden", pImp->bHidden );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-12-10 15:36:53 +01:00
|
|
|
// update our descriptor
|
|
|
|
UpdateDescriptor( &i_rDoc );
|
2009-11-20 15:17:30 +01:00
|
|
|
|
2009-12-10 15:36:53 +01:00
|
|
|
// plugin mode
|
2009-12-11 21:51:06 +01:00
|
|
|
sal_Int16 nPluginMode = aDocumentArgs.getOrDefault( "PluginMode", sal_Int16( 0 ) );
|
2009-11-25 09:32:26 +01:00
|
|
|
if ( nPluginMode && ( nPluginMode != 2 ) )
|
2014-03-14 07:50:04 +02:00
|
|
|
SetInPlace_Impl( true );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2009-12-10 12:41:09 +01:00
|
|
|
bool SfxFrame::IsMarkedHidden_Impl() const
|
|
|
|
{
|
|
|
|
return pImp->bHidden;
|
|
|
|
}
|
2010-10-12 15:53:47 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|