xref: /AOO41X/main/sc/source/ui/vba/vbapagebreaks.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #include "vbapagebreaks.hxx"
28*cdf0e10cSrcweir #include "vbapagebreak.hxx"
29*cdf0e10cSrcweir #include <ooo/vba/excel/XWorksheet.hpp>
30*cdf0e10cSrcweir using namespace ::com::sun::star;
31*cdf0e10cSrcweir using namespace ::ooo::vba;
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir typedef ::cppu::WeakImplHelper1<container::XIndexAccess > RangePageBreaks_Base;
34*cdf0e10cSrcweir class RangePageBreaks : public RangePageBreaks_Base
35*cdf0e10cSrcweir {
36*cdf0e10cSrcweir private:
37*cdf0e10cSrcweir 	uno::Reference< XHelperInterface > mxParent;
38*cdf0e10cSrcweir 	uno::Reference< uno::XComponentContext > mxContext;
39*cdf0e10cSrcweir 	uno::Reference< sheet::XSheetPageBreak > mxSheetPageBreak;
40*cdf0e10cSrcweir 	sal_Bool m_bColumn;
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir public:
43*cdf0e10cSrcweir 	RangePageBreaks( const uno::Reference< XHelperInterface >& xParent,
44*cdf0e10cSrcweir 					 const uno::Reference< uno::XComponentContext >& xContext,
45*cdf0e10cSrcweir 					 uno::Reference< sheet::XSheetPageBreak >& xSheetPageBreak,
46*cdf0e10cSrcweir 					 sal_Bool bColumn ) : mxParent( xParent ), mxContext( xContext ), mxSheetPageBreak( xSheetPageBreak ), m_bColumn( bColumn )
47*cdf0e10cSrcweir 	{
48*cdf0e10cSrcweir 	}
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir 	sal_Int32 getAPIStartofRange( const uno::Reference< excel::XRange >& xRange ) throw (css::uno::RuntimeException)
51*cdf0e10cSrcweir 	{
52*cdf0e10cSrcweir 		if( m_bColumn )
53*cdf0e10cSrcweir 			return xRange->getColumn() - 1;
54*cdf0e10cSrcweir 		return xRange->getRow() - 1;
55*cdf0e10cSrcweir 	}
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir 	sal_Int32 getAPIEndIndexofRange( const uno::Reference< excel::XRange >& xRange, sal_Int32 nUsedStart ) throw (uno::RuntimeException)
58*cdf0e10cSrcweir 	{
59*cdf0e10cSrcweir 		if( m_bColumn )
60*cdf0e10cSrcweir 			return nUsedStart + xRange->Columns( uno::Any() )->getCount();
61*cdf0e10cSrcweir 	    return nUsedStart + xRange->Rows( uno::Any() )->getCount();
62*cdf0e10cSrcweir 	}
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir 	uno::Sequence<sheet::TablePageBreakData> getAllPageBreaks() throw (uno::RuntimeException)
65*cdf0e10cSrcweir 	{
66*cdf0e10cSrcweir 		if( m_bColumn )
67*cdf0e10cSrcweir 			return mxSheetPageBreak->getColumnPageBreaks();
68*cdf0e10cSrcweir     	return mxSheetPageBreak->getRowPageBreaks();
69*cdf0e10cSrcweir 	}
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir 	uno::Reference<container::XIndexAccess> getRowColContainer() throw (uno::RuntimeException)
72*cdf0e10cSrcweir 	{
73*cdf0e10cSrcweir 		uno::Reference< table::XColumnRowRange > xColumnRowRange( mxSheetPageBreak, uno::UNO_QUERY_THROW );
74*cdf0e10cSrcweir     	uno::Reference<container::XIndexAccess> xIndexAccess;
75*cdf0e10cSrcweir 		if( m_bColumn )
76*cdf0e10cSrcweir 			xIndexAccess.set( xColumnRowRange->getColumns(), uno::UNO_QUERY_THROW );
77*cdf0e10cSrcweir 		else
78*cdf0e10cSrcweir 			xIndexAccess.set( xColumnRowRange->getRows(), uno::UNO_QUERY_THROW );
79*cdf0e10cSrcweir     	return xIndexAccess;
80*cdf0e10cSrcweir 	}
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir 	sheet::TablePageBreakData getTablePageBreakData( sal_Int32 nAPIItemIndex ) throw ( script::BasicErrorException, uno::RuntimeException);
83*cdf0e10cSrcweir 	uno::Any Add( const css::uno::Any& Before ) throw ( css::script::BasicErrorException, css::uno::RuntimeException);
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir 	// XIndexAccess
86*cdf0e10cSrcweir 	virtual sal_Int32 SAL_CALL getCount(  ) throw (uno::RuntimeException);
87*cdf0e10cSrcweir 	virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException);
88*cdf0e10cSrcweir 	virtual uno::Type SAL_CALL getElementType(  ) throw (uno::RuntimeException)
89*cdf0e10cSrcweir 	{
90*cdf0e10cSrcweir 		if( m_bColumn )
91*cdf0e10cSrcweir 			 return excel::XVPageBreak::static_type(0);
92*cdf0e10cSrcweir 		return  excel::XHPageBreak::static_type(0);
93*cdf0e10cSrcweir 	}
94*cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL hasElements(  ) throw (uno::RuntimeException)
95*cdf0e10cSrcweir 	{
96*cdf0e10cSrcweir 		return sal_True;
97*cdf0e10cSrcweir 	}
98*cdf0e10cSrcweir };
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir /** @TODO Unlike MS Excel this method only considers the pagebreaks that intersect the used range
101*cdf0e10cSrcweir *  To become completely compatible the print area has to be considered. As far as I found out this printarea
102*cdf0e10cSrcweir *  also considers the position and sizes of shapes and manually inserted page breaks
103*cdf0e10cSrcweir *  Note: In MS  there is a limit of 1026 horizontal page breaks per sheet.
104*cdf0e10cSrcweir */
105*cdf0e10cSrcweir sal_Int32 SAL_CALL RangePageBreaks::getCount(  ) throw (uno::RuntimeException)
106*cdf0e10cSrcweir {
107*cdf0e10cSrcweir     sal_Int32 nCount = 0;
108*cdf0e10cSrcweir     uno::Reference< excel::XWorksheet > xWorksheet( mxParent, uno::UNO_QUERY_THROW );
109*cdf0e10cSrcweir     uno::Reference< excel::XRange > xRange = xWorksheet->getUsedRange();
110*cdf0e10cSrcweir     sal_Int32 nUsedStart = getAPIStartofRange( xRange );
111*cdf0e10cSrcweir     sal_Int32 nUsedEnd = getAPIEndIndexofRange( xRange, nUsedStart );
112*cdf0e10cSrcweir     uno::Sequence<sheet::TablePageBreakData> aTablePageBreakData = getAllPageBreaks();
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir     sal_Int32 nLength = aTablePageBreakData.getLength();
115*cdf0e10cSrcweir     for( sal_Int32 i=0; i<nLength; i++ )
116*cdf0e10cSrcweir     {
117*cdf0e10cSrcweir         sal_Int32 nPos = aTablePageBreakData[i].Position;
118*cdf0e10cSrcweir         if( nPos > nUsedEnd )
119*cdf0e10cSrcweir             return nCount;
120*cdf0e10cSrcweir         if( nPos >= nUsedStart )
121*cdf0e10cSrcweir             nCount++;
122*cdf0e10cSrcweir     }
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir     return nCount;
125*cdf0e10cSrcweir }
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir uno::Any SAL_CALL RangePageBreaks::getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
128*cdf0e10cSrcweir {
129*cdf0e10cSrcweir     if( (Index < getCount()) && ( Index >= 0 ))
130*cdf0e10cSrcweir     {
131*cdf0e10cSrcweir         sheet::TablePageBreakData aTablePageBreakData = getTablePageBreakData( Index );
132*cdf0e10cSrcweir         uno::Reference< container::XIndexAccess > xIndexAccess = getRowColContainer();
133*cdf0e10cSrcweir         sal_Int32 nPos = aTablePageBreakData.Position;
134*cdf0e10cSrcweir         if( (nPos < xIndexAccess->getCount()) && (nPos > -1) )
135*cdf0e10cSrcweir         {
136*cdf0e10cSrcweir             uno::Reference< beans::XPropertySet > xRowColPropertySet( xIndexAccess->getByIndex(nPos), uno::UNO_QUERY_THROW );
137*cdf0e10cSrcweir 			if( m_bColumn )
138*cdf0e10cSrcweir 				return uno::makeAny( uno::Reference< excel::XVPageBreak >( new ScVbaVPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) ));
139*cdf0e10cSrcweir 			return uno::makeAny( uno::Reference< excel::XHPageBreak >( new ScVbaHPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) ));
140*cdf0e10cSrcweir         }
141*cdf0e10cSrcweir     }
142*cdf0e10cSrcweir 	throw lang::IndexOutOfBoundsException();
143*cdf0e10cSrcweir }
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir sheet::TablePageBreakData RangePageBreaks::getTablePageBreakData( sal_Int32 nAPIItemIndex ) throw ( script::BasicErrorException, uno::RuntimeException)
146*cdf0e10cSrcweir {
147*cdf0e10cSrcweir     sal_Int32 index = -1;
148*cdf0e10cSrcweir     sheet::TablePageBreakData aTablePageBreakData;
149*cdf0e10cSrcweir     uno::Reference< excel::XWorksheet > xWorksheet( mxParent, uno::UNO_QUERY_THROW );
150*cdf0e10cSrcweir     uno::Reference< excel::XRange > xRange = xWorksheet->getUsedRange();
151*cdf0e10cSrcweir     sal_Int32 nUsedStart = getAPIStartofRange( xRange );
152*cdf0e10cSrcweir     sal_Int32 nUsedEnd = getAPIEndIndexofRange( xRange, nUsedStart );
153*cdf0e10cSrcweir     uno::Sequence<sheet::TablePageBreakData> aTablePageBreakDataList = getAllPageBreaks();
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir     sal_Int32 nLength = aTablePageBreakDataList.getLength();
156*cdf0e10cSrcweir     for( sal_Int32 i=0; i<nLength; i++ )
157*cdf0e10cSrcweir     {
158*cdf0e10cSrcweir         aTablePageBreakData = aTablePageBreakDataList[i];
159*cdf0e10cSrcweir         sal_Int32 nPos = aTablePageBreakData.Position;
160*cdf0e10cSrcweir         if( nPos >= nUsedStart )
161*cdf0e10cSrcweir             index++;
162*cdf0e10cSrcweir         if( nPos > nUsedEnd )
163*cdf0e10cSrcweir             DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
164*cdf0e10cSrcweir         if( index == nAPIItemIndex )
165*cdf0e10cSrcweir             return aTablePageBreakData;
166*cdf0e10cSrcweir     }
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir     return aTablePageBreakData;
169*cdf0e10cSrcweir }
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir uno::Any RangePageBreaks::Add( const css::uno::Any& Before ) throw ( css::script::BasicErrorException, css::uno::RuntimeException)
172*cdf0e10cSrcweir {
173*cdf0e10cSrcweir     uno::Reference< excel::XRange > xRange;
174*cdf0e10cSrcweir     Before >>= xRange;
175*cdf0e10cSrcweir     if( !xRange.is() )
176*cdf0e10cSrcweir     {
177*cdf0e10cSrcweir 		DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
178*cdf0e10cSrcweir 	}
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 	sal_Int32 nAPIRowColIndex = getAPIStartofRange( xRange );
181*cdf0e10cSrcweir 	uno::Reference< container::XIndexAccess > xIndexAccess = getRowColContainer();
182*cdf0e10cSrcweir 	uno::Reference< beans::XPropertySet > xRowColPropertySet( xIndexAccess->getByIndex(nAPIRowColIndex), uno::UNO_QUERY_THROW );
183*cdf0e10cSrcweir 	xRowColPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" )), uno::makeAny(sal_True));
184*cdf0e10cSrcweir 	sheet::TablePageBreakData aTablePageBreakData;
185*cdf0e10cSrcweir 	aTablePageBreakData.ManualBreak = sal_True;
186*cdf0e10cSrcweir 	aTablePageBreakData.Position = nAPIRowColIndex;
187*cdf0e10cSrcweir 	if( m_bColumn )
188*cdf0e10cSrcweir 		return uno::makeAny( uno::Reference< excel::XVPageBreak >( new ScVbaVPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) ));
189*cdf0e10cSrcweir 	return uno::makeAny( uno::Reference< excel::XHPageBreak >( new ScVbaHPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) ));
190*cdf0e10cSrcweir }
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir class RangePageBreaksEnumWrapper : public EnumerationHelper_BASE
194*cdf0e10cSrcweir {
195*cdf0e10cSrcweir 	uno::Reference<container::XIndexAccess > m_xIndexAccess;
196*cdf0e10cSrcweir 	sal_Int32 nIndex;
197*cdf0e10cSrcweir public:
198*cdf0e10cSrcweir 	RangePageBreaksEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {}
199*cdf0e10cSrcweir 	virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException)
200*cdf0e10cSrcweir 	{
201*cdf0e10cSrcweir 		return ( nIndex < m_xIndexAccess->getCount() );
202*cdf0e10cSrcweir 	}
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir 	virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
205*cdf0e10cSrcweir 	{
206*cdf0e10cSrcweir 		if ( nIndex < m_xIndexAccess->getCount() )
207*cdf0e10cSrcweir 			return m_xIndexAccess->getByIndex( nIndex++ );
208*cdf0e10cSrcweir 		throw container::NoSuchElementException();
209*cdf0e10cSrcweir 	}
210*cdf0e10cSrcweir };
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir ScVbaHPageBreaks::ScVbaHPageBreaks( const uno::Reference< XHelperInterface >& xParent,
213*cdf0e10cSrcweir                                     const uno::Reference< uno::XComponentContext >& xContext,
214*cdf0e10cSrcweir             		                uno::Reference< sheet::XSheetPageBreak >& xSheetPageBreak) throw (uno::RuntimeException):
215*cdf0e10cSrcweir                           ScVbaHPageBreaks_BASE( xParent,xContext, new RangePageBreaks( xParent, xContext, xSheetPageBreak, sal_False )),
216*cdf0e10cSrcweir 						  mxSheetPageBreak( xSheetPageBreak )
217*cdf0e10cSrcweir {
218*cdf0e10cSrcweir }
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir uno::Any SAL_CALL ScVbaHPageBreaks::Add( const uno::Any& Before) throw ( script::BasicErrorException, uno::RuntimeException)
221*cdf0e10cSrcweir {
222*cdf0e10cSrcweir 	RangePageBreaks* pPageBreaks = dynamic_cast< RangePageBreaks* >( m_xIndexAccess.get() );
223*cdf0e10cSrcweir 	if( pPageBreaks )
224*cdf0e10cSrcweir 	{
225*cdf0e10cSrcweir 		return pPageBreaks->Add( Before );
226*cdf0e10cSrcweir 	}
227*cdf0e10cSrcweir 	return uno::Any();
228*cdf0e10cSrcweir }
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir uno::Reference< container::XEnumeration >
231*cdf0e10cSrcweir ScVbaHPageBreaks::createEnumeration() throw (uno::RuntimeException)
232*cdf0e10cSrcweir {
233*cdf0e10cSrcweir 	return new RangePageBreaksEnumWrapper( m_xIndexAccess );
234*cdf0e10cSrcweir }
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir uno::Any
237*cdf0e10cSrcweir ScVbaHPageBreaks::createCollectionObject( const css::uno::Any& aSource )
238*cdf0e10cSrcweir {
239*cdf0e10cSrcweir 	return aSource; // its already a pagebreak object
240*cdf0e10cSrcweir }
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir uno::Type
243*cdf0e10cSrcweir ScVbaHPageBreaks::getElementType() throw (uno::RuntimeException)
244*cdf0e10cSrcweir {
245*cdf0e10cSrcweir 	return excel::XHPageBreak::static_type(0);
246*cdf0e10cSrcweir }
247*cdf0e10cSrcweir 
248*cdf0e10cSrcweir rtl::OUString&
249*cdf0e10cSrcweir ScVbaHPageBreaks::getServiceImplName()
250*cdf0e10cSrcweir {
251*cdf0e10cSrcweir 	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaHPageBreaks") );
252*cdf0e10cSrcweir 	return sImplName;
253*cdf0e10cSrcweir }
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir uno::Sequence< rtl::OUString >
256*cdf0e10cSrcweir ScVbaHPageBreaks::getServiceNames()
257*cdf0e10cSrcweir {
258*cdf0e10cSrcweir 	static uno::Sequence< rtl::OUString > aServiceNames;
259*cdf0e10cSrcweir 	if ( aServiceNames.getLength() == 0 )
260*cdf0e10cSrcweir 	{
261*cdf0e10cSrcweir 		aServiceNames.realloc( 1 );
262*cdf0e10cSrcweir 		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.HPageBreaks" ) );
263*cdf0e10cSrcweir 	}
264*cdf0e10cSrcweir 	return aServiceNames;
265*cdf0e10cSrcweir }
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir //VPageBreak
268*cdf0e10cSrcweir ScVbaVPageBreaks::ScVbaVPageBreaks( const uno::Reference< XHelperInterface >& xParent,
269*cdf0e10cSrcweir                                     const uno::Reference< uno::XComponentContext >& xContext,
270*cdf0e10cSrcweir             		                uno::Reference< sheet::XSheetPageBreak >& xSheetPageBreak ) throw ( uno::RuntimeException )
271*cdf0e10cSrcweir :   ScVbaVPageBreaks_BASE( xParent, xContext, new RangePageBreaks( xParent, xContext, xSheetPageBreak, sal_True ) ),
272*cdf0e10cSrcweir 	mxSheetPageBreak( xSheetPageBreak )
273*cdf0e10cSrcweir {
274*cdf0e10cSrcweir }
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir ScVbaVPageBreaks::~ScVbaVPageBreaks()
277*cdf0e10cSrcweir {
278*cdf0e10cSrcweir }
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir uno::Any SAL_CALL
281*cdf0e10cSrcweir ScVbaVPageBreaks::Add( const uno::Any& Before ) throw ( script::BasicErrorException, uno::RuntimeException )
282*cdf0e10cSrcweir {
283*cdf0e10cSrcweir 	RangePageBreaks* pPageBreaks = dynamic_cast< RangePageBreaks* >( m_xIndexAccess.get() );
284*cdf0e10cSrcweir 	if( pPageBreaks )
285*cdf0e10cSrcweir 	{
286*cdf0e10cSrcweir 		return pPageBreaks->Add( Before );
287*cdf0e10cSrcweir 	}
288*cdf0e10cSrcweir 	return uno::Any();
289*cdf0e10cSrcweir }
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir uno::Reference< container::XEnumeration >
292*cdf0e10cSrcweir ScVbaVPageBreaks::createEnumeration() throw ( uno::RuntimeException )
293*cdf0e10cSrcweir {
294*cdf0e10cSrcweir 	return new RangePageBreaksEnumWrapper( m_xIndexAccess );
295*cdf0e10cSrcweir }
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir uno::Any
298*cdf0e10cSrcweir ScVbaVPageBreaks::createCollectionObject( const css::uno::Any& aSource )
299*cdf0e10cSrcweir {
300*cdf0e10cSrcweir 	return aSource; // its already a pagebreak object
301*cdf0e10cSrcweir }
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir uno::Type
304*cdf0e10cSrcweir ScVbaVPageBreaks::getElementType() throw ( uno::RuntimeException )
305*cdf0e10cSrcweir {
306*cdf0e10cSrcweir 	return excel::XVPageBreak::static_type( 0 );
307*cdf0e10cSrcweir }
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir rtl::OUString&
310*cdf0e10cSrcweir ScVbaVPageBreaks::getServiceImplName()
311*cdf0e10cSrcweir {
312*cdf0e10cSrcweir 	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM( "ScVbaVPageBreaks" ) );
313*cdf0e10cSrcweir 	return sImplName;
314*cdf0e10cSrcweir }
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir uno::Sequence< rtl::OUString >
317*cdf0e10cSrcweir ScVbaVPageBreaks::getServiceNames()
318*cdf0e10cSrcweir {
319*cdf0e10cSrcweir 	static uno::Sequence< rtl::OUString > aServiceNames;
320*cdf0e10cSrcweir 	if ( aServiceNames.getLength() == 0 )
321*cdf0e10cSrcweir 	{
322*cdf0e10cSrcweir 		aServiceNames.realloc( 1 );
323*cdf0e10cSrcweir 		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.VPageBreaks" ) );
324*cdf0e10cSrcweir 	}
325*cdf0e10cSrcweir 	return aServiceNames;
326*cdf0e10cSrcweir }
327*cdf0e10cSrcweir 
328