LibreOffice Module sw (master)  1
vbasection.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  */
19 #include "vbasection.hxx"
20 #include <vbahelper/vbahelper.hxx>
21 #include <tools/diagnose_ex.h>
22 #include "vbapagesetup.hxx"
23 #include "vbaheadersfooters.hxx"
24 
25 using namespace ::ooo::vba;
26 using namespace ::com::sun::star;
27 
28 SwVbaSection::SwVbaSection( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xProps ) :
29  SwVbaSection_BASE( rParent, rContext ), mxModel( xModel ), mxPageProps( xProps )
30 {
31 }
32 
34 {
35 }
36 
38 {
39  return false;
40 }
41 
42 void SAL_CALL SwVbaSection::setProtectedForForms( sal_Bool /*_protectedforforms*/ )
43 {
44 }
45 
46 uno::Any SAL_CALL SwVbaSection::Headers( const uno::Any& index )
47 {
48  uno::Reference< XCollection > xCol( new SwVbaHeadersFooters( this, mxContext, mxModel, mxPageProps, true ) );
49  if ( index.hasValue() )
50  return xCol->Item( index, uno::Any() );
51  return uno::makeAny( xCol );
52 }
53 
54 uno::Any SAL_CALL SwVbaSection::Footers( const uno::Any& index )
55 {
56  uno::Reference< XCollection > xCol( new SwVbaHeadersFooters( this, mxContext, mxModel, mxPageProps, false ) );
57  if ( index.hasValue() )
58  return xCol->Item( index, uno::Any() );
59  return uno::makeAny( xCol );
60 }
61 
62 uno::Any SAL_CALL
64 {
65  return uno::makeAny( uno::Reference< word::XPageSetup >( new SwVbaPageSetup( this, mxContext, mxModel, mxPageProps ) ) );
66 }
67 
68 OUString
70 {
71  return "SwVbaSection";
72 }
73 
74 uno::Sequence< OUString >
76 {
77  static uno::Sequence< OUString > const aServiceNames
78  {
79  "ooo.vba.word.Section"
80  };
81  return aServiceNames;
82 }
83 
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL setProtectedForForms(sal_Bool _protectedforforms) override
Definition: vbasection.cxx:42
bool hasValue()
virtual OUString getServiceImplName() override
Definition: vbasection.cxx:69
css::uno::Reference< css::frame::XModel2 > mxModel
virtual css::uno::Sequence< OUString > getServiceNames() override
Definition: vbasection.cxx:75
virtual ~SwVbaSection() override
Definition: vbasection.cxx:33
virtual css::uno::Any SAL_CALL Footers(const css::uno::Any &index) override
Definition: vbasection.cxx:54
css::uno::Reference< css::beans::XPropertySet > mxPageProps
Definition: vbasection.hxx:31
virtual css::uno::Any SAL_CALL Headers(const css::uno::Any &index) override
Definition: vbasection.cxx:46
virtual sal_Bool SAL_CALL getProtectedForForms() override
Definition: vbasection.cxx:37
unsigned char sal_Bool
css::uno::Reference< css::frame::XModel > mxModel
Definition: vbasection.hxx:30
css::uno::Reference< css::uno::XComponentContext > mxContext
SwVbaSection(const css::uno::Reference< ooo::vba::XHelperInterface > &rParent, const css::uno::Reference< css::uno::XComponentContext > &rContext, const css::uno::Reference< css::frame::XModel > &xModel, const css::uno::Reference< css::beans::XPropertySet > &xProps)
Definition: vbasection.cxx:28
virtual css::uno::Any SAL_CALL PageSetup() override
Definition: vbasection.cxx:63