LCOV - code coverage report
Current view: top level - sw/source/ui/vba - vbarevision.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 36 0.0 %
Date: 2014-04-14 Functions: 0 8 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             : #include "vbarevision.hxx"
      20             : #include <vbahelper/vbahelper.hxx>
      21             : #include <tools/diagnose_ex.h>
      22             : #include <com/sun/star/document/XRedlinesSupplier.hpp>
      23             : #include "wordvbahelper.hxx"
      24             : #include <docsh.hxx>
      25             : #include <doc.hxx>
      26             : 
      27             : using namespace ::ooo::vba;
      28             : using namespace ::com::sun::star;
      29             : 
      30           0 : SwVbaRevision::SwVbaRevision( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xRedlineProps ) throw ( uno::RuntimeException ) : SwVbaRevision_BASE( rParent, rContext ), mxModel( xModel ), mxRedlineProps( xRedlineProps )
      31             : {
      32           0 : }
      33             : 
      34           0 : SwVbaRevision::~SwVbaRevision()
      35             : {
      36           0 : }
      37             : 
      38           0 : sal_Int32 SwVbaRevision::GetPosition() throw (css::uno::RuntimeException)
      39             : {
      40           0 :     sal_Int32 nPos = -1;
      41           0 :     uno::Reference< document::XRedlinesSupplier > xRedlinesSupp( mxModel, uno::UNO_QUERY_THROW );
      42           0 :     uno::Reference< container::XIndexAccess > xRedlines( xRedlinesSupp->getRedlines(), uno::UNO_QUERY_THROW );
      43           0 :     sal_Int32 nCount = xRedlines->getCount();
      44           0 :     for( sal_Int32 i = 0; i < nCount; i++ )
      45             :     {
      46           0 :         uno::Reference< beans::XPropertySet > xProps( xRedlines->getByIndex( i ), uno::UNO_QUERY_THROW );
      47           0 :         if( xProps == mxRedlineProps )
      48             :         {
      49           0 :             nPos = i;
      50             :             OSL_TRACE(" SwVbaRevision::SwVbaRevision, the redline position is %d, ", nPos );
      51           0 :             break;
      52             :         }
      53           0 :     }
      54           0 :     if( nPos == -1 )
      55           0 :         throw uno::RuntimeException();
      56             : 
      57           0 :     return nPos;
      58             : }
      59             : 
      60             : void SAL_CALL
      61           0 : SwVbaRevision::Accept() throw ( css::uno::RuntimeException, std::exception )
      62             : {
      63           0 :     SwDoc* pDoc = word::getDocShell( mxModel )->GetDoc();
      64           0 :     if( pDoc )
      65           0 :         pDoc->AcceptRedline( GetPosition(), true );
      66           0 : }
      67             : 
      68             : void SAL_CALL
      69           0 : SwVbaRevision::Reject( ) throw ( css::uno::RuntimeException, std::exception )
      70             : {
      71           0 :     SwDoc* pDoc = word::getDocShell( mxModel )->GetDoc();
      72           0 :     if( pDoc )
      73           0 :         pDoc->RejectRedline( GetPosition(), true );
      74           0 : }
      75             : 
      76             : OUString
      77           0 : SwVbaRevision::getServiceImplName()
      78             : {
      79           0 :     return OUString("SwVbaRevision");
      80             : }
      81             : 
      82             : uno::Sequence< OUString >
      83           0 : SwVbaRevision::getServiceNames()
      84             : {
      85           0 :     static uno::Sequence< OUString > aServiceNames;
      86           0 :     if ( aServiceNames.getLength() == 0 )
      87             :     {
      88           0 :         aServiceNames.realloc( 1 );
      89           0 :         aServiceNames[ 0 ] = "ooo.vba.word.Revision";
      90             :     }
      91           0 :     return aServiceNames;
      92             : }
      93             : 
      94             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10