Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2008 by Sun Microsystems, Inc.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #include "vbatableofcontents.hxx"
29 : : #include <vbahelper/vbahelper.hxx>
30 : : #include <tools/diagnose_ex.h>
31 : : #include <ooo/vba/word/WdTabLeader.hpp>
32 : :
33 : : using namespace ::ooo::vba;
34 : : using namespace ::com::sun::star;
35 : :
36 : 0 : SwVbaTableOfContents::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 ) throw ( uno::RuntimeException ) :
37 : 0 : SwVbaTableOfContents_BASE( rParent, rContext ), mxTextDocument( xDoc ), mxDocumentIndex( xDocumentIndex )
38 : : {
39 [ # # ]: 0 : mxTocProps.set( mxDocumentIndex, uno::UNO_QUERY_THROW );
40 : 0 : }
41 : :
42 : :
43 : 0 : SwVbaTableOfContents::~SwVbaTableOfContents()
44 : : {
45 [ # # ]: 0 : }
46 : :
47 : 0 : ::sal_Int32 SAL_CALL SwVbaTableOfContents::getLowerHeadingLevel() throw (uno::RuntimeException)
48 : : {
49 : 0 : sal_Int16 nLevel = 0;
50 [ # # ][ # # ]: 0 : mxTocProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Level") ) ) >>= nLevel;
[ # # ]
51 : 0 : return nLevel;
52 : : }
53 : :
54 : 0 : void SAL_CALL SwVbaTableOfContents::setLowerHeadingLevel( ::sal_Int32 _lowerheadinglevel ) throw (uno::RuntimeException)
55 : : {
56 [ # # ][ # # ]: 0 : mxTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Level") ), uno::makeAny( sal_Int8( _lowerheadinglevel ) ) );
[ # # ]
57 : 0 : }
58 : :
59 : 0 : ::sal_Int32 SAL_CALL SwVbaTableOfContents::getTabLeader() throw (uno::RuntimeException)
60 : : {
61 : : // not support in Writer
62 : 0 : return word::WdTabLeader::wdTabLeaderDots;
63 : : }
64 : :
65 : 0 : void SAL_CALL SwVbaTableOfContents::setTabLeader( ::sal_Int32 /*_tableader*/ ) throw (uno::RuntimeException)
66 : : {
67 : : // not support in Writer
68 : 0 : }
69 : :
70 : 0 : ::sal_Bool SAL_CALL SwVbaTableOfContents::getUseFields() throw (css::uno::RuntimeException)
71 : : {
72 : 0 : sal_Bool bUseFields = sal_False;
73 [ # # ][ # # ]: 0 : mxTocProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromMarks") ) ) >>= bUseFields;
[ # # ]
74 : 0 : return bUseFields;
75 : : }
76 : :
77 : 0 : void SAL_CALL SwVbaTableOfContents::setUseFields( ::sal_Bool _useFields ) throw (css::uno::RuntimeException)
78 : : {
79 [ # # ][ # # ]: 0 : mxTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromMarks") ), uno::makeAny( _useFields ) );
80 : 0 : }
81 : :
82 : 0 : ::sal_Bool SAL_CALL SwVbaTableOfContents::getUseOutlineLevels() throw (css::uno::RuntimeException)
83 : : {
84 : 0 : sal_Bool bUseOutlineLevels = sal_False;
85 [ # # ][ # # ]: 0 : mxTocProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromOutline") ) ) >>= bUseOutlineLevels;
[ # # ]
86 : 0 : return bUseOutlineLevels;
87 : : }
88 : :
89 : 0 : void SAL_CALL SwVbaTableOfContents::setUseOutlineLevels( ::sal_Bool _useOutlineLevels ) throw (css::uno::RuntimeException)
90 : : {
91 [ # # ][ # # ]: 0 : mxTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromOutline") ), uno::makeAny( _useOutlineLevels ) );
92 : 0 : }
93 : :
94 : 0 : void SAL_CALL SwVbaTableOfContents::Delete( ) throw (uno::RuntimeException)
95 : : {
96 [ # # ]: 0 : uno::Reference< text::XTextContent > xTextContent( mxDocumentIndex, uno::UNO_QUERY_THROW );
97 [ # # ][ # # ]: 0 : mxTextDocument->getText()->removeTextContent( xTextContent );
[ # # ][ # # ]
98 : 0 : }
99 : :
100 : 0 : void SAL_CALL SwVbaTableOfContents::Update( ) throw (uno::RuntimeException)
101 : : {
102 : 0 : mxDocumentIndex->update();
103 : 0 : }
104 : :
105 : : rtl::OUString
106 : 0 : SwVbaTableOfContents::getServiceImplName()
107 : : {
108 : 0 : return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SwVbaTableOfContents"));
109 : : }
110 : :
111 : : uno::Sequence< rtl::OUString >
112 : 0 : SwVbaTableOfContents::getServiceNames()
113 : : {
114 [ # # ][ # # ]: 0 : static uno::Sequence< rtl::OUString > aServiceNames;
[ # # ][ # # ]
115 [ # # ]: 0 : if ( aServiceNames.getLength() == 0 )
116 : : {
117 : 0 : aServiceNames.realloc( 1 );
118 [ # # ]: 0 : aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TableOfContents" ) );
119 : : }
120 : 0 : return aServiceNames;
121 : : }
122 : :
123 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|