LCOV - code coverage report
Current view: top level - sw/source/ui/vba - vbawindow.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 62 1.6 %
Date: 2015-06-13 12:38:46 Functions: 2 13 15.4 %
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             : #include <vbahelper/helperdecl.hxx>
      20             : #include <ooo/vba/word/WdWindowState.hpp>
      21             : #include <vcl/wrkwin.hxx>
      22             : 
      23             : #include "vbawindow.hxx"
      24             : #include "vbaglobals.hxx"
      25             : #include "vbadocument.hxx"
      26             : #include "vbaview.hxx"
      27             : #include "vbapanes.hxx"
      28             : #include "vbapane.hxx"
      29             : #include "wordvbahelper.hxx"
      30             : #include <view.hxx>
      31             : 
      32             : using namespace ::com::sun::star;
      33             : using namespace ::ooo::vba;
      34             : 
      35           0 : SwVbaWindow::SwVbaWindow(
      36             :         const uno::Reference< XHelperInterface >& xParent,
      37             :         const uno::Reference< uno::XComponentContext >& xContext,
      38             :         const uno::Reference< frame::XModel >& xModel,
      39             :         const uno::Reference< frame::XController >& xController ) throw (uno::RuntimeException) :
      40           0 :     WindowImpl_BASE( xParent, xContext, xModel, xController )
      41             : {
      42           0 : }
      43             : 
      44             : void
      45           0 : SwVbaWindow::Activate() throw (css::uno::RuntimeException, std::exception)
      46             : {
      47           0 :     SwVbaDocument document( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
      48             : 
      49           0 :     document.Activate();
      50           0 : }
      51             : 
      52             : void
      53           0 : SwVbaWindow::Close( const uno::Any& SaveChanges, const uno::Any& RouteDocument ) throw (uno::RuntimeException, std::exception)
      54             : {
      55             :     // FIXME: it is incorrect when there are more than 1 windows
      56           0 :     SwVbaDocument document( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
      57           0 :     uno::Any FileName;
      58           0 :     document.Close(SaveChanges, FileName, RouteDocument );
      59           0 : }
      60             : 
      61             : uno::Any SAL_CALL
      62           0 : SwVbaWindow::getView() throw (uno::RuntimeException, std::exception)
      63             : {
      64           0 :     return uno::makeAny( uno::Reference< word::XView >( new SwVbaView( this,  mxContext, m_xModel ) ) );
      65             : }
      66             : 
      67           0 : void SAL_CALL SwVbaWindow::setView( const uno::Any& _view ) throw (uno::RuntimeException, std::exception)
      68             : {
      69           0 :     sal_Int32 nType = 0;
      70           0 :     if( _view >>= nType )
      71             :     {
      72           0 :         SwVbaView view( this,  mxContext, m_xModel );
      73           0 :         view.setType( nType );
      74             :     }
      75           0 : }
      76             : 
      77             : uno::Any SAL_CALL
      78           0 : SwVbaWindow::getWindowState() throw (uno::RuntimeException, std::exception)
      79             : {
      80           0 :     sal_Int32 nwindowState = word::WdWindowState::wdWindowStateNormal;
      81           0 :     SwView* pView = word::getView( m_xModel );
      82           0 :     SfxViewFrame* pViewFrame = pView -> GetViewFrame();
      83           0 :     WorkWindow* pWork = static_cast<WorkWindow*>( pViewFrame->GetFrame().GetSystemWindow() );
      84           0 :     if ( pWork )
      85             :     {
      86           0 :         if ( pWork -> IsMaximized())
      87           0 :             nwindowState = word::WdWindowState::wdWindowStateMaximize;
      88           0 :         else if (pWork -> IsMinimized())
      89           0 :             nwindowState = word::WdWindowState::wdWindowStateMinimize;
      90             :     }
      91           0 :     return uno::makeAny( nwindowState );
      92             : }
      93             : 
      94             : void SAL_CALL
      95           0 : SwVbaWindow::setWindowState( const uno::Any& _windowstate ) throw (uno::RuntimeException, std::exception)
      96             : {
      97           0 :     sal_Int32 nwindowState = word::WdWindowState::wdWindowStateMaximize;
      98           0 :     _windowstate >>= nwindowState;
      99           0 :     SwView* pView = word::getView( m_xModel );
     100           0 :     SfxViewFrame* pViewFrame = pView -> GetViewFrame();
     101           0 :     WorkWindow* pWork = static_cast<WorkWindow*>( pViewFrame->GetFrame().GetSystemWindow() );
     102           0 :     if ( pWork )
     103             :     {
     104           0 :         if ( nwindowState == word::WdWindowState::wdWindowStateMaximize )
     105           0 :             pWork -> Maximize();
     106           0 :         else if (nwindowState == word::WdWindowState::wdWindowStateMinimize)
     107           0 :             pWork -> Minimize();
     108           0 :         else if (nwindowState == word::WdWindowState::wdWindowStateNormal)
     109           0 :             pWork -> Restore();
     110             :         else
     111           0 :             throw uno::RuntimeException("Invalid Parameter" );
     112             :     }
     113           0 : }
     114             : 
     115             : uno::Any SAL_CALL
     116           0 : SwVbaWindow::Panes( const uno::Any& aIndex ) throw (uno::RuntimeException, std::exception)
     117             : {
     118           0 :     uno::Reference< XCollection > xPanes( new SwVbaPanes( this,  mxContext, m_xModel ) );
     119           0 :     if(  aIndex.getValueTypeClass() == uno::TypeClass_VOID )
     120           0 :         return uno::makeAny( xPanes );
     121             : 
     122           0 :     return uno::Any( xPanes->Item( aIndex, uno::Any() ) );
     123             : }
     124             : 
     125             : uno::Any SAL_CALL
     126           0 : SwVbaWindow::ActivePane() throw (uno::RuntimeException, std::exception)
     127             : {
     128           0 :     return uno::makeAny( uno::Reference< word::XPane >( new SwVbaPane( this,  mxContext, m_xModel ) ) );
     129             : }
     130             : 
     131             : OUString
     132           0 : SwVbaWindow::getServiceImplName()
     133             : {
     134           0 :     return OUString("SwVbaWindow");
     135             : }
     136             : 
     137             : uno::Sequence< OUString >
     138           0 : SwVbaWindow::getServiceNames()
     139             : {
     140           0 :     static uno::Sequence< OUString > aServiceNames;
     141           0 :     if ( aServiceNames.getLength() == 0 )
     142             :     {
     143           0 :         aServiceNames.realloc( 1 );
     144           0 :         aServiceNames[ 0 ] = "ooo.vba.word.Window";
     145             :     }
     146           0 :     return aServiceNames;
     147           3 : }
     148             : 
     149             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11