ITEM: Refactor ItemType
[LibreOffice.git] / sw / source / ui / vba / vbasection.cxx
blobc47e6651552c58196d485d94243fb9311771a2fd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "vbasection.hxx"
20 #include <utility>
21 #include <vbahelper/vbahelper.hxx>
22 #include "vbapagesetup.hxx"
23 #include "vbaheadersfooters.hxx"
24 #include <unotxdoc.hxx>
26 using namespace ::ooo::vba;
27 using namespace ::com::sun::star;
29 SwVbaSection::SwVbaSection( const uno::Reference< ooo::vba::XHelperInterface >& rParent,
30 const uno::Reference< uno::XComponentContext >& rContext,
31 rtl::Reference< SwXTextDocument > xModel,
32 uno::Reference< beans::XPropertySet > xProps )
33 : SwVbaSection_BASE( rParent, rContext ),
34 mxModel(std::move( xModel )),
35 mxPageProps(std::move( xProps ))
39 SwVbaSection::~SwVbaSection()
43 sal_Bool SAL_CALL SwVbaSection::getProtectedForForms()
45 return false;
48 void SAL_CALL SwVbaSection::setProtectedForForms( sal_Bool /*_protectedforforms*/ )
52 uno::Any SAL_CALL SwVbaSection::Headers( const uno::Any& index )
54 uno::Reference< XCollection > xCol( new SwVbaHeadersFooters( this, mxContext, mxModel, mxPageProps, true ) );
55 if ( index.hasValue() )
56 return xCol->Item( index, uno::Any() );
57 return uno::Any( xCol );
60 uno::Any SAL_CALL SwVbaSection::Footers( const uno::Any& index )
62 uno::Reference< XCollection > xCol( new SwVbaHeadersFooters( this, mxContext, mxModel, mxPageProps, false ) );
63 if ( index.hasValue() )
64 return xCol->Item( index, uno::Any() );
65 return uno::Any( xCol );
68 uno::Any SAL_CALL
69 SwVbaSection::PageSetup( )
71 return uno::Any( uno::Reference< word::XPageSetup >( new SwVbaPageSetup( this, mxContext, mxModel, mxPageProps ) ) );
74 OUString
75 SwVbaSection::getServiceImplName()
77 return u"SwVbaSection"_ustr;
80 uno::Sequence< OUString >
81 SwVbaSection::getServiceNames()
83 static uno::Sequence< OUString > const aServiceNames
85 u"ooo.vba.word.Section"_ustr
87 return aServiceNames;
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */