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 "vbapagebreak.hxx"
20 #include "vbarange.hxx"
21 #include <ooo/vba/excel/XlPageBreak.hpp>
22 using namespace ::com::sun::star
;
23 using namespace ::ooo::vba
;
25 template< typename Ifc1
>
26 ScVbaPageBreak
<Ifc1
>::ScVbaPageBreak( const uno::Reference
< XHelperInterface
>& xParent
,
27 const uno::Reference
< uno::XComponentContext
>& xContext
,
28 uno::Reference
< beans::XPropertySet
>& xProps
,
29 sheet::TablePageBreakData aTablePageBreakData
) throw (uno::RuntimeException
):
30 ScVbaPageBreak_BASE( xParent
, xContext
),
31 mxRowColPropertySet( xProps
),
32 maTablePageBreakData( aTablePageBreakData
)
36 template< typename Ifc1
>
37 sal_Int32 ScVbaPageBreak
<Ifc1
>::getType() throw (uno::RuntimeException
)
39 uno::Any aValue
= mxRowColPropertySet
->getPropertyValue("IsStartOfNewPage");
40 bool hasPageBreak
= false;
41 aValue
>>= hasPageBreak
;
44 return excel::XlPageBreak::xlPageBreakNone
;
46 if( maTablePageBreakData
.ManualBreak
)
47 return excel::XlPageBreak::xlPageBreakManual
;
49 return excel::XlPageBreak::xlPageBreakAutomatic
;
52 template< typename Ifc1
>
53 void ScVbaPageBreak
<Ifc1
>::setType(sal_Int32 type
) throw (uno::RuntimeException
)
55 if( (type
!= excel::XlPageBreak::xlPageBreakNone
) &&
56 (type
!= excel::XlPageBreak::xlPageBreakManual
) &&
57 (type
!= excel::XlPageBreak::xlPageBreakAutomatic
) )
59 DebugHelper::runtimeexception(SbERR_BAD_PARAMETER
, OUString() );
62 if( type
== excel::XlPageBreak::xlPageBreakNone
)
64 mxRowColPropertySet
->setPropertyValue("IsStartOfNewPage", uno::makeAny(sal_False
));
68 mxRowColPropertySet
->setPropertyValue("IsStartOfNewPage", uno::makeAny(sal_True
));
69 if( type
== excel::XlPageBreak::xlPageBreakManual
)
70 maTablePageBreakData
.ManualBreak
= sal_True
;
72 maTablePageBreakData
.ManualBreak
= false;
75 template< typename Ifc1
>
76 void ScVbaPageBreak
<Ifc1
>::Delete() throw ( script::BasicErrorException
, uno::RuntimeException
)
78 mxRowColPropertySet
->setPropertyValue("IsStartOfNewPage", uno::makeAny(sal_False
));
81 template< typename Ifc1
>
82 uno::Reference
< excel::XRange
> ScVbaPageBreak
<Ifc1
>::Location() throw ( script::BasicErrorException
, uno::RuntimeException
)
84 uno::Reference
< table::XCellRange
> xRange( mxRowColPropertySet
, uno::UNO_QUERY_THROW
);
85 return new ScVbaRange( ScVbaPageBreak_BASE::getParent(), ScVbaPageBreak_BASE::mxContext
, xRange
);
88 template< typename Ifc1
>
90 ScVbaPageBreak
<Ifc1
>::getServiceImplName()
92 return OUString("ScVbaPageBreak");
95 template< typename Ifc1
>
96 uno::Sequence
< OUString
>
97 ScVbaPageBreak
<Ifc1
>::getServiceNames()
99 static uno::Sequence
< OUString
> aServiceNames
;
100 if ( aServiceNames
.getLength() == 0 )
102 aServiceNames
.realloc( 1 );
103 aServiceNames
[ 0 ] = "ooo.vba.excel.PageBreak";
105 return aServiceNames
;
108 template class ScVbaPageBreak
< excel::XHPageBreak
>;
110 /* class ScVbaHPageBreak */
112 ScVbaHPageBreak::getServiceImplName()
114 return OUString("ScVbaHPageBreak");
117 uno::Sequence
< OUString
>
118 ScVbaHPageBreak::getServiceNames()
120 static uno::Sequence
< OUString
> aServiceNames
;
121 if ( aServiceNames
.getLength() == 0 )
123 aServiceNames
.realloc( 1 );
124 aServiceNames
[ 0 ] = "ooo.vba.excel.HPageBreak";
126 return aServiceNames
;
129 template class ScVbaPageBreak
< excel::XVPageBreak
>;
131 /* class ScVbaVPageBreak */
132 ScVbaVPageBreak::ScVbaVPageBreak( const css::uno::Reference
< ov::XHelperInterface
>& xParent
,
133 const css::uno::Reference
< css::uno::XComponentContext
>& xContext
,
134 css::uno::Reference
< css::beans::XPropertySet
>& xProps
,
135 css::sheet::TablePageBreakData aTablePageBreakData
) throw ( css::uno::RuntimeException
)
136 : ScVbaVPageBreak_BASE( xParent
, xContext
, xProps
, aTablePageBreakData
)
140 ScVbaVPageBreak::~ScVbaVPageBreak()
145 ScVbaVPageBreak::getServiceImplName()
147 return OUString("ScVbaVPageBreak");
150 uno::Sequence
< OUString
>
151 ScVbaVPageBreak::getServiceNames()
153 static uno::Sequence
< OUString
> aServiceNames
;
154 if ( aServiceNames
.getLength() == 0 )
156 aServiceNames
.realloc( 1 );
157 aServiceNames
[ 0 ] = "ooo.vba.excel.VPageBreak";
159 return aServiceNames
;
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */