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

Generated by: LCOV version 1.10