summaryrefslogtreecommitdiff
path: root/patches/vba/vba-vpagebreak-object.diff
blob: 06f9b6d833d56acdb38eae04b00bc69c640bbe2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
diff --git oovbaapi/ooo/vba/excel/XVPageBreak.idl oovbaapi/ooo/vba/excel/XVPageBreak.idl
new file mode 100755
index 0000000..8dc9692
--- /dev/null
+++ oovbaapi/ooo/vba/excel/XVPageBreak.idl
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XVPageBreak.idl,v $
+ * $Revision: 1.0 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_excel_XVPageBreak_idl__
+#define __ooo_vba_excel_XVPageBreak_idl__
+
+#ifndef __ooo_vba_excel_XPageBreak_idl__
+#include <ooo/vba/excel/XPageBreak.idl>
+#endif
+
+//=============================================================================
+
+module ooo {  module vba {  module excel { 
+
+//=============================================================================
+
+interface XVPageBreak
+{
+    interface ::ooo::vba::excel::XPageBreak;
+};
+
+//=============================================================================
+
+}; }; };
+
+#endif
+
+
diff --git oovbaapi/ooo/vba/excel/XVPageBreaks.idl oovbaapi/ooo/vba/excel/XVPageBreaks.idl
new file mode 100755
index 0000000..91501db
--- /dev/null
+++ oovbaapi/ooo/vba/excel/XVPageBreaks.idl
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XVPageBreaks.idl,v $
+ * $Revision: 1.0 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_excel_XVPageBreaks_idl__
+#define __ooo_vba_excel_XVPageBreaks_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+
+#ifndef __com_sun_star_helper_script_BasicErrorException_idl__
+#include <com/sun/star/script/BasicErrorException.idl>
+#endif
+
+#ifndef  __ooo_vba_XCollection_idl__
+#include <ooo/vba/XCollection.idl>
+#endif
+
+//=============================================================================
+
+module ooo {  module vba {  module excel { 
+
+//=============================================================================
+
+//interface XVPageBreak;
+
+interface XVPageBreaks
+{
+    interface ooo::vba::XCollection;
+    
+    //Methods	
+    any Add( [in] any Before ) raises( com::sun::star::script::BasicErrorException );
+};
+
+//=============================================================================
+
+}; }; };
+
+#endif
+
+
diff --git oovbaapi/ooo/vba/excel/XWorksheet.idl oovbaapi/ooo/vba/excel/XWorksheet.idl
index 03d2cc3..9e9b803 100644
--- oovbaapi/ooo/vba/excel/XWorksheet.idl
+++ oovbaapi/ooo/vba/excel/XWorksheet.idl
@@ -56,6 +56,7 @@ interface XRange;
 interface XOutline;
 interface XPageSetup;
 interface XHPageBreaks;
+interface XVPageBreaks;
 interface XWorksheet
 {
 	interface ::ooo::vba::XHelperInterface;
@@ -92,6 +93,7 @@ interface XWorksheet
 	XOutline Outline();
 	XPageSetup PageSetup();
 	any HPageBreaks([in] any Index);
+    any VPageBreaks([in] any Index);
 	any OLEObjects([in] any Index);
 	void ShowDataForm();
 	any Shapes([in] any Index);
diff --git oovbaapi/ooo/vba/excel/makefile.mk oovbaapi/ooo/vba/excel/makefile.mk
index 59333bf..2170810 100644
--- oovbaapi/ooo/vba/excel/makefile.mk
+++ oovbaapi/ooo/vba/excel/makefile.mk
@@ -98,6 +98,8 @@ IDLFILES= XApplication.idl\
  	XPageBreak.idl \
  	XHPageBreak.idl \
  	XHPageBreaks.idl \
+ 	XVPageBreak.idl \
+ 	XVPageBreaks.idl \
 
 
 # ------------------------------------------------------------------
diff --git sc/source/ui/vba/vbapagebreak.cxx sc/source/ui/vba/vbapagebreak.cxx
old mode 100644
new mode 100755
index 581e5bd..13ad8b5
--- sc/source/ui/vba/vbapagebreak.cxx
+++ sc/source/ui/vba/vbapagebreak.cxx
@@ -139,3 +139,37 @@ ScVbaHPageBreak::getServiceNames()
 	return aServiceNames;
 }
 
+template class ScVbaPageBreak< excel::XVPageBreak >;
+
+/* class ScVbaVPageBreak */
+ScVbaVPageBreak::ScVbaVPageBreak( const css::uno::Reference< ov::XHelperInterface >& xParent, 
+                                  const css::uno::Reference< css::uno::XComponentContext >& xContext,
+                                  css::uno::Reference< css::beans::XPropertySet >& xProps,
+                                  css::sheet::TablePageBreakData aTablePageBreakData ) throw ( css::uno::RuntimeException )
+:   ScVbaVPageBreak_BASE( xParent, xContext, xProps, aTablePageBreakData )
+{
+}
+            
+ScVbaVPageBreak::~ScVbaVPageBreak()
+{
+}
+
+rtl::OUString& 
+ScVbaVPageBreak::getServiceImplName()
+{
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaVPageBreak") );
+    return sImplName;
+}
+
+uno::Sequence< rtl::OUString > 
+ScVbaVPageBreak::getServiceNames()
+{
+    static uno::Sequence< rtl::OUString > aServiceNames;
+    if ( aServiceNames.getLength() == 0 )
+    {
+        aServiceNames.realloc( 1 );
+        aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.VPageBreak" ) );
+    }
+    return aServiceNames;
+}
+
diff --git sc/source/ui/vba/vbapagebreak.hxx sc/source/ui/vba/vbapagebreak.hxx
old mode 100644
new mode 100755
index a07cfda..04c8702
--- sc/source/ui/vba/vbapagebreak.hxx
+++ sc/source/ui/vba/vbapagebreak.hxx
@@ -33,6 +33,7 @@
 #include <cppuhelper/implbase1.hxx>
 #include <ooo/vba/excel/XPageBreak.hpp>
 #include <ooo/vba/excel/XHPageBreak.hpp>
+#include <ooo/vba/excel/XVPageBreak.hpp>
 #include <ooo/vba/excel/XRange.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/script/BasicErrorException.hpp>
@@ -84,4 +85,22 @@ public:
 	virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 };
 
+//VPageBreak
+typedef ScVbaPageBreak < ov::excel::XVPageBreak > ScVbaVPageBreak_BASE;
+
+class ScVbaVPageBreak :  public ScVbaVPageBreak_BASE
+{
+public:
+    ScVbaVPageBreak( const css::uno::Reference< ov::XHelperInterface >& xParent, 
+                     const css::uno::Reference< css::uno::XComponentContext >& xContext,
+                     css::uno::Reference< css::beans::XPropertySet >& xProps,
+                     css::sheet::TablePageBreakData aTablePageBreakData) throw (css::uno::RuntimeException);
+            
+    virtual ~ScVbaVPageBreak();
+    
+    // XHelperInterface
+    virtual rtl::OUString& getServiceImplName();
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
 #endif
diff --git sc/source/ui/vba/vbapagebreaks.cxx sc/source/ui/vba/vbapagebreaks.cxx
old mode 100644
new mode 100755
index 8859ca6..51eaffb
--- sc/source/ui/vba/vbapagebreaks.cxx
+++ sc/source/ui/vba/vbapagebreaks.cxx
@@ -90,8 +90,8 @@ public:
 	virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException);
 	virtual uno::Type SAL_CALL getElementType(  ) throw (uno::RuntimeException)
 	{
-		//if( m_bColumn )
-			// return excel::XVPageBreak::static_type(0);
+        if( m_bColumn )
+             return excel::XVPageBreak::static_type(0);
 		return  excel::XHPageBreak::static_type(0);
 	}
 	virtual sal_Bool SAL_CALL hasElements(  ) throw (uno::RuntimeException)
@@ -137,8 +137,8 @@ uno::Any SAL_CALL RangePageBreaks::getByIndex( sal_Int32 Index ) throw (lang::In
         if( (nPos < xIndexAccess->getCount()) && (nPos > -1) )
         {
             uno::Reference< beans::XPropertySet > xRowColPropertySet( xIndexAccess->getByIndex(nPos), uno::UNO_QUERY_THROW );
-			//if( m_bColumn )
-			//	return uno::makeAny( uno::Reference< excel::XVPageBreak >( new ScVbaVPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) ));
+            if( m_bColumn )
+                return uno::makeAny( uno::Reference< excel::XVPageBreak >( new ScVbaVPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) ));
 			return uno::makeAny( uno::Reference< excel::XHPageBreak >( new ScVbaHPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) ));
         }
     }
@@ -187,8 +187,8 @@ uno::Any RangePageBreaks::Add( const css::uno::Any& Before ) throw ( css::script
 	sheet::TablePageBreakData aTablePageBreakData;
 	aTablePageBreakData.ManualBreak = sal_True;
 	aTablePageBreakData.Position = nAPIRowColIndex;
-	//if( m_bColumn )
-	//	return uno::makeAny( uno::Reference< excel::XVPageBreak >( new ScVbaVPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) ));
+    if( m_bColumn )
+        return uno::makeAny( uno::Reference< excel::XVPageBreak >( new ScVbaVPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) ));
 	return uno::makeAny( uno::Reference< excel::XHPageBreak >( new ScVbaHPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) ));
 }
 
@@ -267,3 +267,64 @@ ScVbaHPageBreaks::getServiceNames()
 	return aServiceNames;
 }
 
+//VPageBreak
+ScVbaVPageBreaks::ScVbaVPageBreaks( const uno::Reference< XHelperInterface >& xParent, 
+                                    const uno::Reference< uno::XComponentContext >& xContext,
+                                    uno::Reference< sheet::XSheetPageBreak >& xSheetPageBreak ) throw ( uno::RuntimeException )
+:   ScVbaVPageBreaks_BASE( xParent, xContext, new RangePageBreaks( xParent, xContext, xSheetPageBreak, sal_True ) ), 
+    mxSheetPageBreak( xSheetPageBreak )
+{
+}
+
+ScVbaVPageBreaks::~ScVbaVPageBreaks()
+{
+}
+
+uno::Any SAL_CALL 
+ScVbaVPageBreaks::Add( const uno::Any& Before ) throw ( script::BasicErrorException, uno::RuntimeException )
+{
+    RangePageBreaks* pPageBreaks = dynamic_cast< RangePageBreaks* >( m_xIndexAccess.get() );
+    if( pPageBreaks )
+    {
+        return pPageBreaks->Add( Before );
+    }
+    return uno::Any();
+}
+
+uno::Reference< container::XEnumeration >
+ScVbaVPageBreaks::createEnumeration() throw ( uno::RuntimeException )
+{
+    return new RangePageBreaksEnumWrapper( m_xIndexAccess );
+}
+
+uno::Any
+ScVbaVPageBreaks::createCollectionObject( const css::uno::Any& aSource )
+{
+    return aSource; // its already a pagebreak object
+}
+
+uno::Type 
+ScVbaVPageBreaks::getElementType() throw ( uno::RuntimeException )
+{
+    return excel::XVPageBreak::static_type( 0 );
+}
+
+rtl::OUString& 
+ScVbaVPageBreaks::getServiceImplName()
+{
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM( "ScVbaVPageBreaks" ) );
+    return sImplName;
+}
+
+uno::Sequence< rtl::OUString > 
+ScVbaVPageBreaks::getServiceNames()
+{
+    static uno::Sequence< rtl::OUString > aServiceNames;
+    if ( aServiceNames.getLength() == 0 )
+    {
+        aServiceNames.realloc( 1 );
+        aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.VPageBreaks" ) );
+    }
+    return aServiceNames;
+}
+
diff --git sc/source/ui/vba/vbapagebreaks.hxx sc/source/ui/vba/vbapagebreaks.hxx
old mode 100644
new mode 100755
index 530d82a..cc2a642
--- sc/source/ui/vba/vbapagebreaks.hxx
+++ sc/source/ui/vba/vbapagebreaks.hxx
@@ -33,6 +33,8 @@
 #include <cppuhelper/implbase1.hxx>
 #include <ooo/vba/excel/XHPageBreaks.hpp>
 #include <ooo/vba/excel/XHPageBreak.hpp>
+#include <ooo/vba/excel/XVPageBreaks.hpp>
+#include <ooo/vba/excel/XVPageBreak.hpp>
 #include <ooo/vba/excel/XRange.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/script/BasicErrorException.hpp>
@@ -68,4 +70,31 @@ public:
 	virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 };
 
+//VPageBreaks
+typedef CollTestImplHelper< ov::excel::XVPageBreaks > ScVbaVPageBreaks_BASE;
+
+class ScVbaVPageBreaks : public ScVbaVPageBreaks_BASE
+{
+    css::uno::Reference< css::sheet::XSheetPageBreak > mxSheetPageBreak;
+
+public:
+    ScVbaVPageBreaks( const css::uno::Reference< ov::XHelperInterface >& xParent, 
+                      const css::uno::Reference< css::uno::XComponentContext >& xContext,
+                      css::uno::Reference< css::sheet::XSheetPageBreak >& xSheetPageBreak ) throw ( css::uno::RuntimeException );
+
+    virtual ~ScVbaVPageBreaks();
+
+    // XVPageBreaks 
+    virtual css::uno::Any SAL_CALL Add( const css::uno::Any& Before ) throw ( css::script::BasicErrorException, css::uno::RuntimeException );
+
+    // XEnumerationAccess
+    virtual css::uno::Type SAL_CALL getElementType() throw ( css::uno::RuntimeException );
+    virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw ( css::uno::RuntimeException );	
+    virtual css::uno::Any createCollectionObject( const css::uno::Any& );
+
+    // XHelperInterface
+    virtual rtl::OUString& getServiceImplName();
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
 #endif
diff --git sc/source/ui/vba/vbaworksheet.cxx sc/source/ui/vba/vbaworksheet.cxx
old mode 100644
new mode 100755
index d687610..fddb886
--- sc/source/ui/vba/vbaworksheet.cxx
+++ sc/source/ui/vba/vbaworksheet.cxx
@@ -370,6 +370,16 @@ ScVbaWorksheet::HPageBreaks( const uno::Any& aIndex ) throw (uno::RuntimeExcepti
    return uno::makeAny( xHPageBreaks );
 }
 
+uno::Any
+ScVbaWorksheet::VPageBreaks( const uno::Any& aIndex ) throw ( uno::RuntimeException )
+{
+    uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak( getSheet(), uno::UNO_QUERY_THROW );
+    uno::Reference< excel::XVPageBreaks > xVPageBreaks( new ScVbaVPageBreaks( this, mxContext, xSheetPageBreak ) ); 
+    if( aIndex.hasValue() )
+        return xVPageBreaks->Item( aIndex, uno::Any()); 
+    return uno::makeAny( xVPageBreaks );
+}
+
 sal_Int32 
 ScVbaWorksheet::getStandardWidth() throw (uno::RuntimeException)
 {
diff --git sc/source/ui/vba/vbaworksheet.hxx sc/source/ui/vba/vbaworksheet.hxx
index e70b282..b275960 100644
--- sc/source/ui/vba/vbaworksheet.hxx
+++ sc/source/ui/vba/vbaworksheet.hxx
@@ -44,6 +44,7 @@
 #include <ooo/vba/excel/XOutline.hpp>
 #include <ooo/vba/excel/XPageSetup.hpp>
 #include <ooo/vba/excel/XHPageBreaks.hpp>
+#include <ooo/vba/excel/XVPageBreaks.hpp>
 #include <ooo/vba/excel/XChartObjects.hpp>
 #include <com/sun/star/container/XNamed.hpp>
 
@@ -94,6 +95,7 @@ public:
 	virtual css::uno::Reference< ov::excel::XOutline > SAL_CALL Outline( ) throw (css::uno::RuntimeException);
 	virtual css::uno::Reference< ov::excel::XPageSetup > SAL_CALL PageSetup( ) throw (css::uno::RuntimeException);
 	virtual css::uno::Any SAL_CALL HPageBreaks( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+    virtual css::uno::Any SAL_CALL VPageBreaks( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
 	virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getNext() throw (css::uno::RuntimeException);
 	virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getPrevious() throw (css::uno::RuntimeException);
  	virtual sal_Int16 SAL_CALL getIndex() throw (css::uno::RuntimeException);