LCOV - code coverage report
Current view: top level - sfx2/source/dialog - partwnd.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 64 0.0 %
Date: 2014-04-14 Functions: 0 14 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/awt/XWindow.hpp>
      21             : #include <com/sun/star/awt/PosSize.hpp>
      22             : #include <com/sun/star/beans/PropertyValue.hpp>
      23             : #include <com/sun/star/beans/XPropertySet.hpp>
      24             : #include <com/sun/star/frame/Frame.hpp>
      25             : #include <com/sun/star/frame/XController.hpp>
      26             : #include <com/sun/star/lang/XComponent.hpp>
      27             : #include <com/sun/star/lang/DisposedException.hpp>
      28             : #include <com/sun/star/task/XStatusIndicator.hpp>
      29             : #include <com/sun/star/uno/Reference.h>
      30             : #include <com/sun/star/uno/Sequence.hxx>
      31             : #include <com/sun/star/util/URL.hpp>
      32             : #include <com/sun/star/util/XCloseable.hpp>
      33             : #include <com/sun/star/util/CloseVetoException.hpp>
      34             : #include <comphelper/processfactory.hxx>
      35             : 
      36             : #include <toolkit/helper/vclunohelper.hxx>
      37             : 
      38             : #include <sfx2/sfxsids.hrc>
      39             : #include "partwnd.hxx"
      40             : #include <sfx2/bindings.hxx>
      41             : #include <sfx2/dispatch.hxx>
      42             : #include <sfx2/viewfrm.hxx>
      43             : #include <sfx2/frame.hxx>
      44             : #include <sfx2/sfxuno.hxx>
      45             : 
      46             : 
      47             : // SfxPartChildWnd_Impl
      48             : 
      49             : 
      50           0 : SFX_IMPL_DOCKINGWINDOW( SfxPartChildWnd_Impl, SID_BROWSER );
      51             : 
      52           0 : SfxPartChildWnd_Impl::SfxPartChildWnd_Impl
      53             : (
      54             :     Window* pParentWnd,
      55             :     sal_uInt16 nId,
      56             :     SfxBindings* pBindings,
      57             :     SfxChildWinInfo* pInfo
      58             : )
      59           0 :     : SfxChildWindow( pParentWnd, nId )
      60             : {
      61             :     // Create Window
      62           0 :     pWindow = new SfxPartDockWnd_Impl( pBindings, this, pParentWnd, WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK );
      63           0 :     eChildAlignment = SFX_ALIGN_TOP;
      64             : 
      65             :     assert(pInfo);
      66           0 :     pInfo->nFlags |= SFX_CHILDWIN_FORCEDOCK;
      67             : 
      68           0 :     ((SfxDockingWindow*)pWindow)->SetFloatingSize( Size( 175, 175 ) );
      69           0 :     pWindow->SetSizePixel( Size( 175, 175 ) );
      70             : 
      71           0 :     ( ( SfxDockingWindow* ) pWindow )->Initialize( pInfo );
      72           0 :     SetHideNotDelete( true );
      73           0 : }
      74             : 
      75           0 : SfxPartChildWnd_Impl::~SfxPartChildWnd_Impl()
      76             : {
      77           0 :     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame = GetFrame();
      78             : 
      79             :     // If xFrame=NULL release pMgr! Because this window lives longer then the manager!
      80             :     // In these case we got a xFrame->dispose() call from outside ... and has release our
      81             :     // frame reference in our own DisposingListener.
      82             :     // But don't do it, if xFrame already exist. Then dispose() must come from inside ...
      83             :     // and we need a valid pMgr for further operations ...
      84             : 
      85           0 :     SfxPartDockWnd_Impl* pWin = (SfxPartDockWnd_Impl*) pWindow;
      86             : 
      87           0 :     if ( pWin && xFrame == pWin->GetBindings().GetActiveFrame() )
      88           0 :         pWin->GetBindings().SetActiveFrame( NULL );
      89           0 : }
      90             : 
      91           0 : bool SfxPartChildWnd_Impl::QueryClose()
      92             : {
      93           0 :     return ( (SfxPartDockWnd_Impl*)pWindow )->QueryClose();
      94             : }
      95             : 
      96             : 
      97             : // SfxPartDockWnd_Impl
      98             : 
      99             : 
     100           0 : SfxPartDockWnd_Impl::SfxPartDockWnd_Impl
     101             : (
     102             :     SfxBindings* pBind,
     103             :     SfxChildWindow* pChildWin,
     104             :     Window* pParent,
     105             :     WinBits nBits
     106             : )
     107           0 :     : SfxDockingWindow( pBind, pChildWin, pParent, nBits )
     108             : {
     109             :     css::uno::Reference < css::frame::XFrame2 > xFrame = css::frame::Frame::create(
     110           0 :             ::comphelper::getProcessComponentContext() );
     111           0 :     xFrame->initialize( VCLUnoHelper::GetInterface ( this ) );
     112             : 
     113             :     try
     114             :     {
     115           0 :         css::uno::Reference< css::beans::XPropertySet > xLMPropSet( xFrame->getLayoutManager(), css::uno::UNO_QUERY_THROW );
     116             : 
     117           0 :         const OUString aAutomaticToolbars( "AutomaticToolbars" );
     118           0 :         xLMPropSet->setPropertyValue( aAutomaticToolbars, css::uno::Any( sal_False ));
     119             :     }
     120           0 :     catch( css::uno::RuntimeException& )
     121             :     {
     122           0 :         throw;
     123             :     }
     124           0 :     catch( css::uno::Exception& )
     125             :     {
     126             :     }
     127             : 
     128           0 :     pChildWin->SetFrame( css::uno::Reference<css::frame::XFrame>(xFrame,css::uno::UNO_QUERY_THROW) );
     129           0 :     if ( pBind->GetDispatcher() )
     130             :     {
     131             :         css::uno::Reference < css::frame::XFramesSupplier >
     132           0 :                 xSupp ( pBind->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface(), css::uno::UNO_QUERY );
     133           0 :         if ( xSupp.is() )
     134           0 :             xSupp->getFrames()->append( css::uno::Reference<css::frame::XFrame>(xFrame, css::uno::UNO_QUERY_THROW) );
     135             :     }
     136             :     else {
     137             :         OSL_FAIL("Bindings without Dispatcher!");
     138           0 :     }
     139           0 : }
     140             : 
     141             : 
     142             : 
     143           0 : SfxPartDockWnd_Impl::~SfxPartDockWnd_Impl()
     144             : {
     145           0 : }
     146             : 
     147             : 
     148             : 
     149           0 : void SfxPartDockWnd_Impl::Resize()
     150             : 
     151             : /*  [Description]
     152             : 
     153             :     Adjusting the size of the controls wrt the new window size
     154             : */
     155             : 
     156             : {
     157           0 :     SfxDockingWindow::Resize();
     158           0 : }
     159             : 
     160             : 
     161             : 
     162           0 : bool SfxPartDockWnd_Impl::QueryClose()
     163             : {
     164           0 :     bool bClose = true;
     165           0 :     SfxChildWindow* pChild = GetChildWindow_Impl();
     166           0 :     if( pChild )
     167             :     {
     168           0 :         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame = pChild->GetFrame();
     169           0 :         if( xFrame.is() )
     170             :         {
     171           0 :             ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >  xCtrl = xFrame->getController();
     172           0 :             if( xCtrl.is() )
     173           0 :                 bClose = xCtrl->suspend( sal_True );
     174           0 :         }
     175             :     }
     176             : 
     177           0 :     return bClose;
     178             : }
     179             : 
     180             : 
     181             : 
     182           0 : bool SfxPartDockWnd_Impl::Notify( NotifyEvent& rEvt )
     183             : {
     184           0 :     if( rEvt.GetType() == EVENT_GETFOCUS )
     185             :     {
     186           0 :         SfxChildWindow* pChild = GetChildWindow_Impl();
     187           0 :         if( pChild )
     188             :         {
     189           0 :             ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame = pChild->GetFrame();
     190           0 :             if( xFrame.is() )
     191           0 :                 xFrame->activate();
     192             :         }
     193             :     }
     194             : 
     195           0 :     return SfxDockingWindow::Notify( rEvt );
     196             : }
     197             : 
     198           0 : void SfxPartDockWnd_Impl::FillInfo( SfxChildWinInfo& rInfo ) const
     199             : {
     200           0 :     SfxDockingWindow::FillInfo( rInfo );
     201           0 :     rInfo.bVisible = false;
     202           0 : }
     203             : 
     204             : 
     205             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10