LibreOffice Module sw (master) 1
vbarevision.cxx
Go to the documentation of this file.
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 <sal/log.hxx>
21#include <com/sun/star/document/XRedlinesSupplier.hpp>
22#include <com/sun/star/container/XIndexAccess.hpp>
23#include <com/sun/star/frame/XModel.hpp>
24#include "wordvbahelper.hxx"
25#include <docsh.hxx>
26#include <doc.hxx>
28#include <utility>
29
30using namespace ::ooo::vba;
31using namespace ::com::sun::star;
32
33SwVbaRevision::SwVbaRevision( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, uno::Reference< frame::XModel > xModel, uno::Reference< beans::XPropertySet > xRedlineProps ) : SwVbaRevision_BASE( rParent, rContext ), mxModel(std::move( xModel )), mxRedlineProps(std::move( xRedlineProps ))
34{
35}
36
38{
39}
40
42{
43 sal_Int32 nPos = -1;
44 uno::Reference< document::XRedlinesSupplier > xRedlinesSupp( mxModel, uno::UNO_QUERY_THROW );
45 uno::Reference< container::XIndexAccess > xRedlines( xRedlinesSupp->getRedlines(), uno::UNO_QUERY_THROW );
46 sal_Int32 nCount = xRedlines->getCount();
47 for( sal_Int32 i = 0; i < nCount; i++ )
48 {
49 uno::Reference< beans::XPropertySet > xProps( xRedlines->getByIndex( i ), uno::UNO_QUERY_THROW );
50 if( xProps == mxRedlineProps )
51 {
52 nPos = i;
53 SAL_INFO("sw.ui", "the redline position is " << nPos);
54 break;
55 }
56 }
57 if( nPos == -1 )
58 throw uno::RuntimeException();
59
60 return nPos;
61}
62
63void SAL_CALL
65{
67 if( pDoc )
69}
70
71void SAL_CALL
73{
75 if( pDoc )
77}
78
79OUString
81{
82 return "SwVbaRevision";
83}
84
85uno::Sequence< OUString >
87{
88 static uno::Sequence< OUString > const aServiceNames
89 {
90 "ooo.vba.word.Revision"
91 };
92 return aServiceNames;
93}
94
95/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::frame::XModel2 > mxModel
virtual bool RejectRedline(SwRedlineTable::size_type nPos, bool bCallDelete)=0
virtual bool AcceptRedline(SwRedlineTable::size_type nPos, bool bCallDelete)=0
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
Definition: doc.hxx:194
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:341
virtual void SAL_CALL Accept() override
Definition: vbarevision.cxx:64
virtual ~SwVbaRevision() override
Definition: vbarevision.cxx:37
virtual void SAL_CALL Reject() override
Definition: vbarevision.cxx:72
SwVbaRevision(const css::uno::Reference< ooo::vba::XHelperInterface > &rParent, const css::uno::Reference< css::uno::XComponentContext > &rContext, css::uno::Reference< css::frame::XModel > xModel, css::uno::Reference< css::beans::XPropertySet > xRedlineProps)
Definition: vbarevision.cxx:33
virtual OUString getServiceImplName() override
Definition: vbarevision.cxx:80
css::uno::Reference< css::frame::XModel > mxModel
Definition: vbarevision.hxx:30
css::uno::Reference< css::beans::XPropertySet > mxRedlineProps
Definition: vbarevision.hxx:31
sal_Int32 GetPosition()
Definition: vbarevision.cxx:41
virtual css::uno::Sequence< OUString > getServiceNames() override
Definition: vbarevision.cxx:86
int nCount
Sequence< OUString > aServiceNames
sal_uInt16 nPos
#define SAL_INFO(area, stream)
int i
SwDocShell * getDocShell(const uno::Reference< frame::XModel > &xModel)
Reference< XModel > xModel