1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #include "vbatableofcontents.hxx"
20 #include <com/sun/star/beans/XPropertySet.hpp>
21 #include <ooo/vba/word/WdTabLeader.hpp>
24 using namespace ::ooo::vba
;
25 using namespace ::com::sun::star
;
27 SwVbaTableOfContents::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
))
30 mxTocProps
.set( mxDocumentIndex
, uno::UNO_QUERY_THROW
);
33 SwVbaTableOfContents::~SwVbaTableOfContents()
37 ::sal_Int32 SAL_CALL
SwVbaTableOfContents::getLowerHeadingLevel()
40 mxTocProps
->getPropertyValue("Level") >>= nLevel
;
44 void SAL_CALL
SwVbaTableOfContents::setLowerHeadingLevel( ::sal_Int32 _lowerheadinglevel
)
46 mxTocProps
->setPropertyValue("Level", uno::Any( sal_Int8( _lowerheadinglevel
) ) );
49 ::sal_Int32 SAL_CALL
SwVbaTableOfContents::getTabLeader()
51 // not support in Writer
52 return word::WdTabLeader::wdTabLeaderDots
;
55 void SAL_CALL
SwVbaTableOfContents::setTabLeader( ::sal_Int32
/*_tableader*/ )
57 // not support in Writer
60 sal_Bool SAL_CALL
SwVbaTableOfContents::getUseFields()
62 bool bUseFields
= false;
63 mxTocProps
->getPropertyValue("CreateFromMarks") >>= bUseFields
;
67 void SAL_CALL
SwVbaTableOfContents::setUseFields( sal_Bool _useFields
)
69 mxTocProps
->setPropertyValue("CreateFromMarks", uno::Any( _useFields
) );
72 sal_Bool SAL_CALL
SwVbaTableOfContents::getUseOutlineLevels()
74 bool bUseOutlineLevels
= false;
75 mxTocProps
->getPropertyValue("CreateFromOutline") >>= bUseOutlineLevels
;
76 return bUseOutlineLevels
;
79 void SAL_CALL
SwVbaTableOfContents::setUseOutlineLevels( sal_Bool _useOutlineLevels
)
81 mxTocProps
->setPropertyValue("CreateFromOutline", uno::Any( _useOutlineLevels
) );
84 void SAL_CALL
SwVbaTableOfContents::Delete( )
86 uno::Reference
< text::XTextContent
> xTextContent( mxDocumentIndex
, uno::UNO_QUERY_THROW
);
87 mxTextDocument
->getText()->removeTextContent( xTextContent
);
90 void SAL_CALL
SwVbaTableOfContents::Update( )
92 mxDocumentIndex
->update();
96 SwVbaTableOfContents::getServiceImplName()
98 return "SwVbaTableOfContents";
101 uno::Sequence
< OUString
>
102 SwVbaTableOfContents::getServiceNames()
104 static uno::Sequence
< OUString
> const aServiceNames
106 "ooo.vba.word.TableOfContents"
108 return aServiceNames
;
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */