LibreOffice Module sw (master) 1
vbatableofcontents.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 */
20#include <com/sun/star/beans/XPropertySet.hpp>
21#include <ooo/vba/word/WdTabLeader.hpp>
22#include <utility>
23
24using namespace ::ooo::vba;
25using namespace ::com::sun::star;
26
27SwVbaTableOfContents::SwVbaTableOfContents( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, uno::Reference< text::XTextDocument > xDoc, uno::Reference< text::XDocumentIndex > xDocumentIndex ) :
28 SwVbaTableOfContents_BASE( rParent, rContext ), mxTextDocument(std::move( xDoc )), mxDocumentIndex(std::move( xDocumentIndex ))
29{
30 mxTocProps.set( mxDocumentIndex, uno::UNO_QUERY_THROW );
31}
32
34{
35}
36
38{
39 sal_Int16 nLevel = 0;
40 mxTocProps->getPropertyValue("Level") >>= nLevel;
41 return nLevel;
42}
43
44void SAL_CALL SwVbaTableOfContents::setLowerHeadingLevel( ::sal_Int32 _lowerheadinglevel )
45{
46 mxTocProps->setPropertyValue("Level", uno::Any( sal_Int8( _lowerheadinglevel ) ) );
47}
48
50{
51 // not support in Writer
52 return word::WdTabLeader::wdTabLeaderDots;
53}
54
55void SAL_CALL SwVbaTableOfContents::setTabLeader( ::sal_Int32 /*_tableader*/ )
56{
57 // not support in Writer
58}
59
61{
62 bool bUseFields = false;
63 mxTocProps->getPropertyValue("CreateFromMarks") >>= bUseFields;
64 return bUseFields;
65}
66
68{
69 mxTocProps->setPropertyValue("CreateFromMarks", uno::Any( _useFields ) );
70}
71
73{
74 bool bUseOutlineLevels = false;
75 mxTocProps->getPropertyValue("CreateFromOutline") >>= bUseOutlineLevels;
76 return bUseOutlineLevels;
77}
78
79void SAL_CALL SwVbaTableOfContents::setUseOutlineLevels( sal_Bool _useOutlineLevels )
80{
81 mxTocProps->setPropertyValue("CreateFromOutline", uno::Any( _useOutlineLevels ) );
82}
83
85{
86 uno::Reference< text::XTextContent > xTextContent( mxDocumentIndex, uno::UNO_QUERY_THROW );
87 mxTextDocument->getText()->removeTextContent( xTextContent );
88}
89
91{
92 mxDocumentIndex->update();
93}
94
95OUString
97{
98 return "SwVbaTableOfContents";
99}
100
101uno::Sequence< OUString >
103{
104 static uno::Sequence< OUString > const aServiceNames
105 {
106 "ooo.vba.word.TableOfContents"
107 };
108 return aServiceNames;
109}
110
111/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::beans::XPropertySet > mxTocProps
virtual void SAL_CALL Delete() override
virtual void SAL_CALL setUseOutlineLevels(sal_Bool _useOutlineLevels) override
virtual OUString getServiceImplName() override
virtual ::sal_Int32 SAL_CALL getLowerHeadingLevel() override
virtual void SAL_CALL setUseFields(sal_Bool _useFields) override
virtual css::uno::Sequence< OUString > getServiceNames() override
virtual sal_Bool SAL_CALL getUseOutlineLevels() override
virtual ::sal_Int32 SAL_CALL getTabLeader() override
css::uno::Reference< css::text::XDocumentIndex > mxDocumentIndex
virtual void SAL_CALL setTabLeader(::sal_Int32 _tableader) override
virtual sal_Bool SAL_CALL getUseFields() override
css::uno::Reference< css::text::XTextDocument > mxTextDocument
SwVbaTableOfContents(const css::uno::Reference< ooo::vba::XHelperInterface > &rParent, const css::uno::Reference< css::uno::XComponentContext > &rContext, css::uno::Reference< css::text::XTextDocument > xDoc, css::uno::Reference< css::text::XDocumentIndex > xDocumentIndex)
virtual ~SwVbaTableOfContents() override
virtual void SAL_CALL setLowerHeadingLevel(::sal_Int32 _lowerheadinglevel) override
virtual void SAL_CALL Update() override
Sequence< OUString > aServiceNames
unsigned char sal_Bool
signed char sal_Int8