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
23using namespace ::ooo::vba;
24using namespace ::com::sun::star;
25
26SwVbaTableOfContents::SwVbaTableOfContents( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& xDoc, const uno::Reference< text::XDocumentIndex >& xDocumentIndex ) :
27 SwVbaTableOfContents_BASE( rParent, rContext ), mxTextDocument( xDoc ), mxDocumentIndex( xDocumentIndex )
28{
29 mxTocProps.set( mxDocumentIndex, uno::UNO_QUERY_THROW );
30}
31
33{
34}
35
37{
38 sal_Int16 nLevel = 0;
39 mxTocProps->getPropertyValue("Level") >>= nLevel;
40 return nLevel;
41}
42
43void SAL_CALL SwVbaTableOfContents::setLowerHeadingLevel( ::sal_Int32 _lowerheadinglevel )
44{
45 mxTocProps->setPropertyValue("Level", uno::Any( sal_Int8( _lowerheadinglevel ) ) );
46}
47
49{
50 // not support in Writer
51 return word::WdTabLeader::wdTabLeaderDots;
52}
53
54void SAL_CALL SwVbaTableOfContents::setTabLeader( ::sal_Int32 /*_tableader*/ )
55{
56 // not support in Writer
57}
58
60{
61 bool bUseFields = false;
62 mxTocProps->getPropertyValue("CreateFromMarks") >>= bUseFields;
63 return bUseFields;
64}
65
67{
68 mxTocProps->setPropertyValue("CreateFromMarks", uno::Any( _useFields ) );
69}
70
72{
73 bool bUseOutlineLevels = false;
74 mxTocProps->getPropertyValue("CreateFromOutline") >>= bUseOutlineLevels;
75 return bUseOutlineLevels;
76}
77
78void SAL_CALL SwVbaTableOfContents::setUseOutlineLevels( sal_Bool _useOutlineLevels )
79{
80 mxTocProps->setPropertyValue("CreateFromOutline", uno::Any( _useOutlineLevels ) );
81}
82
84{
85 uno::Reference< text::XTextContent > xTextContent( mxDocumentIndex, uno::UNO_QUERY_THROW );
86 mxTextDocument->getText()->removeTextContent( xTextContent );
87}
88
90{
91 mxDocumentIndex->update();
92}
93
94OUString
96{
97 return "SwVbaTableOfContents";
98}
99
100uno::Sequence< OUString >
102{
103 static uno::Sequence< OUString > const aServiceNames
104 {
105 "ooo.vba.word.TableOfContents"
106 };
107 return aServiceNames;
108}
109
110/* 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
virtual ~SwVbaTableOfContents() override
virtual void SAL_CALL setLowerHeadingLevel(::sal_Int32 _lowerheadinglevel) override
SwVbaTableOfContents(const css::uno::Reference< ooo::vba::XHelperInterface > &rParent, const css::uno::Reference< css::uno::XComponentContext > &rContext, const css::uno::Reference< css::text::XTextDocument > &xDoc, const css::uno::Reference< css::text::XDocumentIndex > &xDocumentIndex)
virtual void SAL_CALL Update() override
Sequence< OUString > aServiceNames
unsigned char sal_Bool
signed char sal_Int8