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 2000, 2010 Oracle and/or its affiliates.
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 "vbapagebreak.hxx"
29 : : #include "vbarange.hxx"
30 : : #include <ooo/vba/excel/XlPageBreak.hpp>
31 : : using namespace ::com::sun::star;
32 : : using namespace ::ooo::vba;
33 : :
34 : : template< typename Ifc1 >
35 : 0 : ScVbaPageBreak<Ifc1>::ScVbaPageBreak( const uno::Reference< XHelperInterface >& xParent,
36 : : const uno::Reference< uno::XComponentContext >& xContext,
37 : : uno::Reference< beans::XPropertySet >& xProps,
38 : : sheet::TablePageBreakData aTablePageBreakData) throw (uno::RuntimeException):
39 : : ScVbaPageBreak_BASE( xParent, xContext ),
40 : : mxRowColPropertySet( xProps ),
41 : 0 : maTablePageBreakData( aTablePageBreakData )
42 : : {
43 : 0 : }
44 : :
45 : : template< typename Ifc1 >
46 : 0 : sal_Int32 ScVbaPageBreak<Ifc1>::getType() throw (uno::RuntimeException)
47 : : {
48 [ # # ][ # # ]: 0 : uno::Any aValue = mxRowColPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" )));
[ # # ][ # # ]
[ # # ][ # # ]
49 : 0 : sal_Bool hasPageBreak = false;
50 : 0 : aValue >>= hasPageBreak;
51 : :
52 [ # # # # ]: 0 : if( !hasPageBreak )
53 : 0 : return excel::XlPageBreak::xlPageBreakNone;
54 : :
55 [ # # ][ # # ]: 0 : if( maTablePageBreakData.ManualBreak )
56 : 0 : return excel::XlPageBreak::xlPageBreakManual;
57 : :
58 : 0 : return excel::XlPageBreak::xlPageBreakAutomatic;
59 : : }
60 : :
61 : : template< typename Ifc1 >
62 : 0 : void ScVbaPageBreak<Ifc1>::setType(sal_Int32 type) throw (uno::RuntimeException)
63 : : {
64 [ # # ][ # # ]: 0 : if( (type != excel::XlPageBreak::xlPageBreakNone) &&
[ # # ][ # # ]
[ # # ][ # # ]
65 : : (type != excel::XlPageBreak::xlPageBreakManual) &&
66 : : (type != excel::XlPageBreak::xlPageBreakAutomatic) )
67 : : {
68 [ # # ][ # # ]: 0 : DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
69 : : }
70 : :
71 [ # # ][ # # ]: 0 : if( type == excel::XlPageBreak::xlPageBreakNone )
72 : : {
73 [ # # ][ # # ]: 0 : mxRowColPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" )), uno::makeAny(sal_False));
[ # # ][ # # ]
[ # # ][ # # ]
74 : 0 : return;
75 : : }
76 : :
77 [ # # ][ # # ]: 0 : mxRowColPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" )), uno::makeAny(sal_True));
[ # # ][ # # ]
[ # # ][ # # ]
78 [ # # # # ]: 0 : if( type == excel::XlPageBreak::xlPageBreakManual )
79 : 0 : maTablePageBreakData.ManualBreak = sal_True;
80 : : else
81 : 0 : maTablePageBreakData.ManualBreak = false;
82 : : }
83 : :
84 : : template< typename Ifc1 >
85 : 0 : void ScVbaPageBreak<Ifc1>::Delete() throw ( script::BasicErrorException, uno::RuntimeException)
86 : : {
87 [ # # ][ # # ]: 0 : mxRowColPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" )), uno::makeAny(sal_False));
[ # # ][ # # ]
[ # # ][ # # ]
88 : 0 : }
89 : :
90 : : template< typename Ifc1 >
91 : 0 : uno::Reference< excel::XRange> ScVbaPageBreak<Ifc1>::Location() throw ( script::BasicErrorException, uno::RuntimeException)
92 : : {
93 [ # # ][ # # ]: 0 : uno::Reference< table::XCellRange > xRange( mxRowColPropertySet, uno::UNO_QUERY_THROW );
94 [ # # ][ # # ]: 0 : return new ScVbaRange( ScVbaPageBreak_BASE::getParent(), ScVbaPageBreak_BASE::mxContext, xRange);
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
95 : : }
96 : :
97 : : template< typename Ifc1 >
98 : : rtl::OUString
99 : 0 : ScVbaPageBreak<Ifc1>::getServiceImplName()
100 : : {
101 : 0 : return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScVbaPageBreak"));
102 : : }
103 : :
104 : : template< typename Ifc1 >
105 : : uno::Sequence< rtl::OUString >
106 : 0 : ScVbaPageBreak<Ifc1>::getServiceNames()
107 : : {
108 [ # # ][ # # ]: 0 : static uno::Sequence< rtl::OUString > aServiceNames;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
109 [ # # ][ # # ]: 0 : if ( aServiceNames.getLength() == 0 )
110 : : {
111 : 0 : aServiceNames.realloc( 1 );
112 [ # # ][ # # ]: 0 : aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.PageBreak" ) );
113 : : }
114 : 0 : return aServiceNames;
115 : : }
116 : :
117 : : template class ScVbaPageBreak< excel::XHPageBreak >;
118 : :
119 : : /* class ScVbaHPageBreak */
120 : : rtl::OUString
121 : 0 : ScVbaHPageBreak::getServiceImplName()
122 : : {
123 : 0 : return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScVbaHPageBreak"));
124 : : }
125 : :
126 : : uno::Sequence< rtl::OUString >
127 : 0 : ScVbaHPageBreak::getServiceNames()
128 : : {
129 [ # # ][ # # ]: 0 : static uno::Sequence< rtl::OUString > aServiceNames;
[ # # ][ # # ]
130 [ # # ]: 0 : if ( aServiceNames.getLength() == 0 )
131 : : {
132 : 0 : aServiceNames.realloc( 1 );
133 [ # # ]: 0 : aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.HPageBreak" ) );
134 : : }
135 : 0 : return aServiceNames;
136 : : }
137 : :
138 : : template class ScVbaPageBreak< excel::XVPageBreak >;
139 : :
140 : : /* class ScVbaVPageBreak */
141 : 0 : ScVbaVPageBreak::ScVbaVPageBreak( const css::uno::Reference< ov::XHelperInterface >& xParent,
142 : : const css::uno::Reference< css::uno::XComponentContext >& xContext,
143 : : css::uno::Reference< css::beans::XPropertySet >& xProps,
144 : : css::sheet::TablePageBreakData aTablePageBreakData ) throw ( css::uno::RuntimeException )
145 : 0 : : ScVbaVPageBreak_BASE( xParent, xContext, xProps, aTablePageBreakData )
146 : : {
147 : 0 : }
148 : :
149 : 0 : ScVbaVPageBreak::~ScVbaVPageBreak()
150 : : {
151 [ # # ]: 0 : }
152 : :
153 : : rtl::OUString
154 : 0 : ScVbaVPageBreak::getServiceImplName()
155 : : {
156 : 0 : return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScVbaVPageBreak"));
157 : : }
158 : :
159 : : uno::Sequence< rtl::OUString >
160 : 0 : ScVbaVPageBreak::getServiceNames()
161 : : {
162 [ # # ][ # # ]: 0 : static uno::Sequence< rtl::OUString > aServiceNames;
[ # # ][ # # ]
163 [ # # ]: 0 : if ( aServiceNames.getLength() == 0 )
164 : : {
165 : 0 : aServiceNames.realloc( 1 );
166 [ # # ]: 0 : aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.VPageBreak" ) );
167 : : }
168 : 0 : return aServiceNames;
169 : : }
170 : :
171 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|