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 "vbalisttemplate.hxx"
20 #include <vbahelper/vbahelper.hxx>
21 #include <tools/diagnose_ex.h>
22 #include "vbalistlevels.hxx"
23 #include <com/sun/star/beans/XPropertySet.hpp>
24
25 using namespace ::ooo::vba;
26 using namespace ::com::sun::star;
27
SwVbaListTemplate(const uno::Reference<ooo::vba::XHelperInterface> & rParent,const uno::Reference<uno::XComponentContext> & rContext,const uno::Reference<text::XTextDocument> & xTextDoc,sal_Int32 nGalleryType,sal_Int32 nTemplateType)28 SwVbaListTemplate::SwVbaListTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& xTextDoc, sal_Int32 nGalleryType, sal_Int32 nTemplateType ) : SwVbaListTemplate_BASE( rParent, rContext )
29 {
30 pListHelper.reset( new SwVbaListHelper( xTextDoc, nGalleryType, nTemplateType ) );
31 }
32
~SwVbaListTemplate()33 SwVbaListTemplate::~SwVbaListTemplate()
34 {
35 }
36
37 uno::Any SAL_CALL
ListLevels(const uno::Any & index)38 SwVbaListTemplate::ListLevels( const uno::Any& index )
39 {
40 uno::Reference< XCollection > xCol( new SwVbaListLevels( mxParent, mxContext, pListHelper ) );
41 if ( index.hasValue() )
42 return xCol->Item( index, uno::Any() );
43 return uno::makeAny( xCol );
44 }
45
applyListTemplate(uno::Reference<beans::XPropertySet> const & xProps)46 void SwVbaListTemplate::applyListTemplate( uno::Reference< beans::XPropertySet > const & xProps )
47 {
48 uno::Reference< container::XIndexReplace > xNumberingRules = pListHelper->getNumberingRules();
49 xProps->setPropertyValue("NumberingRules", uno::makeAny( xNumberingRules ) );
50 }
51
52 OUString
getServiceImplName()53 SwVbaListTemplate::getServiceImplName()
54 {
55 return "SwVbaListTemplate";
56 }
57
58 uno::Sequence< OUString >
getServiceNames()59 SwVbaListTemplate::getServiceNames()
60 {
61 static uno::Sequence< OUString > const aServiceNames
62 {
63 "ooo.vba.word.ListTemplate"
64 };
65 return aServiceNames;
66 }
67
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
69