~ubuntu-branches/ubuntu/natty/libreoffice-l10n/natty-security

« back to all changes in this revision

Viewing changes to libreoffice-build/patches/vba/vba-word-support-m4.diff

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2011-01-19 15:13:37 UTC
  • mfrom: (0.3.1) (0.2.1) (0.1.1)
  • Revision ID: package-import@ubuntu.com-20110119151337-5pr1w2ev91hmmdye
Tags: 1:3.3.0~rc3-2ubuntu1
* Merge 3.3.0~rc3 changes.
* Merged Debian packaging up to r2330.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
diff --git offapi/com/sun/star/document/VbaEventId.idl offapi/com/sun/star/document/VbaEventId.idl
 
2
index eaeb877..b5af431 100644
 
3
--- offapi/com/sun/star/document/VbaEventId.idl
 
4
+++ offapi/com/sun/star/document/VbaEventId.idl
 
5
@@ -75,6 +75,13 @@ constants VbaEventId
 
6
     const long VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK         = 57;
 
7
     const long VBAEVENT_WORKBOOK_SHEET_PIVOTTABLEUPDATE        = 58;
 
8
     const long VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE         = 59;
 
9
+
 
10
+    // Document event for Word
 
11
+    const long VBAEVENT_DOCUMENT_NEW                            = 70;
 
12
+    const long VBAEVENT_DOCUMENT_AUTONEW                        = 71;
 
13
+    const long VBAEVENT_DOCUMENT_OPEN                           = 72;
 
14
+    const long VBAEVENT_DOCUMENT_AUTOOPEN                       = 73;
 
15
+    const long VBAEVENT_DOCUMENT_CLOSE                          = 74;
 
16
 };
 
17
 
 
18
 }; }; }; };
 
19
diff --git offapi/com/sun/star/document/VbaEventsHelper.idl offapi/com/sun/star/document/VbaEventsHelper.idl
 
20
index 610970e..30f8f7e 100644
 
21
--- offapi/com/sun/star/document/VbaEventsHelper.idl
 
22
+++ offapi/com/sun/star/document/VbaEventsHelper.idl
 
23
@@ -32,8 +32,8 @@
 
24
  *    MA  02111-1307  USA
 
25
  *
 
26
  ************************************************************************/
 
27
-#ifndef __org_openoffice_vba_VbaEventsHelper_idl__
 
28
-#define __org_openoffice_vba_VbaEventsHelper_idl__
 
29
+#ifndef __com_sun_star_document_VbaEventsHelper_idl__
 
30
+#define __com_sun_star_document_VbaEventsHelper_idl__
 
31
 
 
32
 #ifndef __com_sun_star_uno_XInterface_idl__
 
33
 #include <com/sun/star/uno/XInterface.idl>
 
34
diff --git offapi/com/sun/star/sheet/SpreadsheetDocumentVbaEventsHelper.idl offapi/com/sun/star/sheet/SpreadsheetDocumentVbaEventsHelper.idl
 
35
new file mode 100644
 
36
index 0000000..b08a58c
 
37
--- /dev/null
 
38
+++ offapi/com/sun/star/sheet/SpreadsheetDocumentVbaEventsHelper.idl
 
39
@@ -0,0 +1,52 @@
 
40
+/*************************************************************************
 
41
+ *
 
42
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
43
+ * 
 
44
+ * Copyright 2008 by Sun Microsystems, Inc.
 
45
+ *
 
46
+ * OpenOffice.org - a multi-platform office productivity suite
 
47
+ *
 
48
+ * $RCSfile: TextDocument.idl,v $
 
49
+ * $Revision: 1.18 $
 
50
+ *
 
51
+ * This file is part of OpenOffice.org.
 
52
+ *
 
53
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
54
+ * it under the terms of the GNU Lesser General Public License version 3
 
55
+ * only, as published by the Free Software Foundation.
 
56
+ *
 
57
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
58
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
59
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
60
+ * GNU Lesser General Public License version 3 for more details
 
61
+ * (a copy is included in the LICENSE file that accompanied this code).
 
62
+ *
 
63
+ * You should have received a copy of the GNU Lesser General Public License
 
64
+ * version 3 along with OpenOffice.org.  If not, see
 
65
+ * <http://www.openoffice.org/license.html>
 
66
+ * for a copy of the LGPLv3 License.
 
67
+ *
 
68
+ ************************************************************************/
 
69
+#ifndef __com_sun_star_sheet_SpreadsheetDocumentVbaEventsHelper_idl__
 
70
+#define __com_sun_star_sheet_SpreadsheetDocumentVbaEventsHelper_idl__
 
71
+
 
72
+#ifndef __com_sun_star_document_VbaEventsHelper_idl__
 
73
+#include <com/sun/star/document/VbaEventsHelper.idl>
 
74
+#endif
 
75
+
 
76
+//=============================================================================
 
77
+
 
78
+ module com {  module sun {  module star {  module sheet {
 
79
+
 
80
+//=============================================================================
 
81
+
 
82
+service SpreadsheetDocumentVbaEventsHelper
 
83
+{
 
84
+    service com::sun::star::document::VbaEventsHelper;
 
85
+};
 
86
+
 
87
+//=============================================================================
 
88
+
 
89
+}; }; }; };
 
90
+
 
91
+#endif
 
92
diff --git offapi/com/sun/star/sheet/makefile.mk offapi/com/sun/star/sheet/makefile.mk
 
93
index 468e96b..6d245e7 100644
 
94
--- offapi/com/sun/star/sheet/makefile.mk
 
95
+++ offapi/com/sun/star/sheet/makefile.mk
 
96
@@ -198,6 +198,7 @@ IDLFILES=\
 
97
     Spreadsheet.idl\
 
98
     SpreadsheetDocument.idl\
 
99
     SpreadsheetDocumentSettings.idl\
 
100
+    SpreadsheetDocumentVbaEventsHelper.idl\
 
101
     SpreadsheetDrawPage.idl\
 
102
     SpreadsheetView.idl\
 
103
     SpreadsheetViewPane.idl\
 
104
diff --git offapi/com/sun/star/text/TextDocumentVbaEventsHelper.idl offapi/com/sun/star/text/TextDocumentVbaEventsHelper.idl
 
105
new file mode 100644
 
106
index 0000000..b4f2707
 
107
--- /dev/null
 
108
+++ offapi/com/sun/star/text/TextDocumentVbaEventsHelper.idl
 
109
@@ -0,0 +1,52 @@
 
110
+/*************************************************************************
 
111
+ *
 
112
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
113
+ * 
 
114
+ * Copyright 2008 by Sun Microsystems, Inc.
 
115
+ *
 
116
+ * OpenOffice.org - a multi-platform office productivity suite
 
117
+ *
 
118
+ * $RCSfile: TextDocument.idl,v $
 
119
+ * $Revision: 1.18 $
 
120
+ *
 
121
+ * This file is part of OpenOffice.org.
 
122
+ *
 
123
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
124
+ * it under the terms of the GNU Lesser General Public License version 3
 
125
+ * only, as published by the Free Software Foundation.
 
126
+ *
 
127
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
128
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
129
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
130
+ * GNU Lesser General Public License version 3 for more details
 
131
+ * (a copy is included in the LICENSE file that accompanied this code).
 
132
+ *
 
133
+ * You should have received a copy of the GNU Lesser General Public License
 
134
+ * version 3 along with OpenOffice.org.  If not, see
 
135
+ * <http://www.openoffice.org/license.html>
 
136
+ * for a copy of the LGPLv3 License.
 
137
+ *
 
138
+ ************************************************************************/
 
139
+#ifndef __com_sun_star_text_TextDocumentVbaEventsHelper_idl__
 
140
+#define __com_sun_star_text_TextDocumentVbaEventsHelper_idl__
 
141
+
 
142
+#ifndef __com_sun_star_document_VbaEventsHelper_idl__
 
143
+#include <com/sun/star/document/VbaEventsHelper.idl>
 
144
+#endif
 
145
+
 
146
+//=============================================================================
 
147
+
 
148
+ module com {  module sun {  module star {  module text {
 
149
+
 
150
+//=============================================================================
 
151
+
 
152
+service TextDocumentVbaEventsHelper
 
153
+{
 
154
+    service com::sun::star::document::VbaEventsHelper;
 
155
+};
 
156
+
 
157
+//=============================================================================
 
158
+
 
159
+}; }; }; };
 
160
+
 
161
+#endif
 
162
diff --git offapi/com/sun/star/text/makefile.mk offapi/com/sun/star/text/makefile.mk
 
163
index c018c94..c639d7b 100644
 
164
--- offapi/com/sun/star/text/makefile.mk
 
165
+++ offapi/com/sun/star/text/makefile.mk
 
166
@@ -156,6 +156,7 @@ IDLFILES=\
 
167
      TextContentCollection.idl\
 
168
      TextCursor.idl\
 
169
      TextDocument.idl\
 
170
+     TextDocumentVbaEventsHelper.idl\
 
171
      TextDocumentView.idl\
 
172
      TextEmbeddedObject.idl\
 
173
      TextEmbeddedObjects.idl\
 
174
diff --git oovbaapi/ooo/vba/XDocumentBase.idl oovbaapi/ooo/vba/XDocumentBase.idl
 
175
index aab3c8e..0c74fa8 100644
 
176
--- oovbaapi/ooo/vba/XDocumentBase.idl
 
177
+++ oovbaapi/ooo/vba/XDocumentBase.idl
 
178
@@ -58,7 +58,6 @@ interface XDocumentBase
 
179
        void Close([in] any SaveChanges, [in] any FileName, [in] any RouteWorkBook);
 
180
        void Save();
 
181
        void Activate();
 
182
-       void Protect( [in] any Password );
 
183
        void Unprotect( [in] any Password );
 
184
 };
 
185
 
 
186
diff --git oovbaapi/ooo/vba/excel/XWorkbook.idl oovbaapi/ooo/vba/excel/XWorkbook.idl
 
187
index 4aa9403..d763f2c 100644
 
188
--- oovbaapi/ooo/vba/excel/XWorkbook.idl
 
189
+++ oovbaapi/ooo/vba/excel/XWorkbook.idl
 
190
@@ -65,6 +65,7 @@ interface XWorkbook : com::sun::star::uno::XInterface
 
191
     any Colors([in] any Index) raises (com::sun::star::script::BasicErrorException);
 
192
     long FileFormat() raises (com::sun::star::script::BasicErrorException);
 
193
     void SaveCopyAs( [in] string Filename );
 
194
+    void Protect( [in] any Password );
 
195
 };
 
196
 
 
197
 }; }; };
 
198
diff --git oovbaapi/ooo/vba/msforms/XCheckBox.idl oovbaapi/ooo/vba/msforms/XCheckBox.idl
 
199
new file mode 100644
 
200
index 0000000..30bdee0
 
201
--- /dev/null
 
202
+++ oovbaapi/ooo/vba/msforms/XCheckBox.idl
 
203
@@ -0,0 +1,53 @@
 
204
+/*************************************************************************
 
205
+ *
 
206
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
207
+ * 
 
208
+ * Copyright 2008 by Sun Microsystems, Inc.
 
209
+ *
 
210
+ * OpenOffice.org - a multi-platform office productivity suite
 
211
+ *
 
212
+ * $RCSfile: XCheckBox.idl,v $
 
213
+ * $Revision: 1.3 $
 
214
+ *
 
215
+ * This file is part of OpenOffice.org.
 
216
+ *
 
217
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
218
+ * it under the terms of the GNU Lesser General Public License version 3
 
219
+ * only, as published by the Free Software Foundation.
 
220
+ *
 
221
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
222
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
223
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
224
+ * GNU Lesser General Public License version 3 for more details
 
225
+ * (a copy is included in the LICENSE file that accompanied this code).
 
226
+ *
 
227
+ * You should have received a copy of the GNU Lesser General Public License
 
228
+ * version 3 along with OpenOffice.org.  If not, see
 
229
+ * <http://www.openoffice.org/license.html>
 
230
+ * for a copy of the LGPLv3 License.
 
231
+ *
 
232
+ ************************************************************************/
 
233
+#ifndef __ooo_vba_msforms_XCheckBox_idl__
 
234
+#define __ooo_vba_msforms_XCheckBox_idl__
 
235
+
 
236
+#ifndef __com_sun_star_uno_XInterface_idl__
 
237
+#include <com/sun/star/uno/XInterface.idl>
 
238
+#endif
 
239
+//=============================================================================
 
240
+
 
241
+module ooo {  module vba {  module msforms { 
 
242
+
 
243
+//=============================================================================
 
244
+interface XCheckBox: com::sun::star::uno::XInterface 
 
245
+{
 
246
+    [attribute] string Caption;
 
247
+    [attribute] any Value;
 
248
+};
 
249
+
 
250
+//=============================================================================
 
251
+
 
252
+}; }; };
 
253
+
 
254
+#endif
 
255
+
 
256
+
 
257
diff --git oovbaapi/ooo/vba/msforms/XComboBox.idl oovbaapi/ooo/vba/msforms/XComboBox.idl
 
258
index 42fb76a..c0e8ee3 100644
 
259
--- oovbaapi/ooo/vba/msforms/XComboBox.idl
 
260
+++ oovbaapi/ooo/vba/msforms/XComboBox.idl
 
261
@@ -50,6 +50,7 @@ interface XComboBox: ::com::sun::star::uno::XInterface
 
262
     void AddItem( [in] any pvargItem, [in] any pvargIndex );
 
263
     void removeItem( [in] any index );
 
264
     void Clear();
 
265
+    any List( [in] any pvargIndex, [in] any pvarColumn );
 
266
 };
 
267
 
 
268
 //=============================================================================
 
269
diff --git oovbaapi/ooo/vba/msforms/XControl.idl oovbaapi/ooo/vba/msforms/XControl.idl
 
270
index 303b211..12f33bb 100644
 
271
--- oovbaapi/ooo/vba/msforms/XControl.idl
 
272
+++ oovbaapi/ooo/vba/msforms/XControl.idl
 
273
@@ -62,6 +62,7 @@ interface XControl
 
274
     [attribute] double  Top;
 
275
     [attribute] string Name;
 
276
        [attribute] string ControlTipText;
 
277
+    [attribute] long ForeColor;
 
278
 };
 
279
 
 
280
 //=============================================================================
 
281
diff --git oovbaapi/ooo/vba/msforms/XLabel.idl oovbaapi/ooo/vba/msforms/XLabel.idl
 
282
index c44a063..c5e7e65 100644
 
283
--- oovbaapi/ooo/vba/msforms/XLabel.idl
 
284
+++ oovbaapi/ooo/vba/msforms/XLabel.idl
 
285
@@ -42,7 +42,7 @@ interface XLabel: com::sun::star::uno::XInterface
 
286
 {
 
287
     [attribute] string Caption;
 
288
     [attribute] any Value;
 
289
-       [attribute] long ForeColor; //liuchen 2009-7-3
 
290
+    [attribute] string Accelerator;
 
291
 };
 
292
 
 
293
 //=============================================================================
 
294
diff --git oovbaapi/ooo/vba/msforms/XShapeRange.idl oovbaapi/ooo/vba/msforms/XShapeRange.idl
 
295
index 0ae1883..34dd2dc 100644
 
296
--- oovbaapi/ooo/vba/msforms/XShapeRange.idl
 
297
+++ oovbaapi/ooo/vba/msforms/XShapeRange.idl
 
298
@@ -50,6 +50,7 @@ interface XShapeRange
 
299
 {
 
300
     interface ooo::vba::XCollection;
 
301
 
 
302
+    [attribute] string Name;
 
303
     [attribute] double Height;
 
304
     [attribute] double Width;
 
305
     [attribute] double Left;
 
306
@@ -68,6 +69,7 @@ interface XShapeRange
 
307
     void IncrementRotation( [in] double Increment );
 
308
     void IncrementLeft( [in] double Increment );
 
309
     void IncrementTop( [in] double Increment );
 
310
+    void ZOrder( [in] long ZOrderCmd );
 
311
 };
 
312
 }; }; };
 
313
 
 
314
diff --git oovbaapi/ooo/vba/msforms/makefile.mk oovbaapi/ooo/vba/msforms/makefile.mk
 
315
index 02da992..79a9924 100644
 
316
--- oovbaapi/ooo/vba/msforms/makefile.mk
 
317
+++ oovbaapi/ooo/vba/msforms/makefile.mk
 
318
@@ -48,6 +48,7 @@ IDLFILES=\
 
319
     XLabel.idl \
 
320
     XTextBox.idl \
 
321
     XRadioButton.idl \
 
322
+    XCheckBox.idl \
 
323
     XShape.idl \
 
324
     XShapes.idl \
 
325
     XLineFormat.idl \
 
326
diff --git oovbaapi/ooo/vba/word/XApplication.idl oovbaapi/ooo/vba/word/XApplication.idl
 
327
index b3623e4..0b07dd8 100644
 
328
--- oovbaapi/ooo/vba/word/XApplication.idl
 
329
+++ oovbaapi/ooo/vba/word/XApplication.idl
 
330
@@ -60,6 +60,7 @@ interface XApplication : com::sun::star::uno::XInterface
 
331
     any Documents( [in] any aIndex );
 
332
     any Addins( [in] any aIndex );
 
333
     any Dialogs( [in] any aIndex );
 
334
+    any ListGalleries( [in] any aIndex );
 
335
     float CentimetersToPoints([in] float Centimeters );
 
336
 };
 
337
 
 
338
diff --git oovbaapi/ooo/vba/word/XCell.idl oovbaapi/ooo/vba/word/XCell.idl
 
339
new file mode 100644
 
340
index 0000000..700b9dc
 
341
--- /dev/null
 
342
+++ oovbaapi/ooo/vba/word/XCell.idl
 
343
@@ -0,0 +1,59 @@
 
344
+/*************************************************************************
 
345
+ *
 
346
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
347
+ * 
 
348
+ * Copyright 2008 by Sun Microsystems, Inc.
 
349
+ *
 
350
+ * OpenOffice.org - a multi-platform office productivity suite
 
351
+ *
 
352
+ * $RCSfile: 
 
353
+ * $Revision: 
 
354
+ *
 
355
+ * This file is part of OpenOffice.org.
 
356
+ *
 
357
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
358
+ * it under the terms of the GNU Lesser General Public License version 3
 
359
+ * only, as published by the Free Software Foundation.
 
360
+ *
 
361
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
362
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
363
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
364
+ * GNU Lesser General Public License version 3 for more details
 
365
+ * (a copy is included in the LICENSE file that accompanied this code).
 
366
+ *
 
367
+ * You should have received a copy of the GNU Lesser General Public License
 
368
+ * version 3 along with OpenOffice.org.  If not, see
 
369
+ * <http://www.openoffice.org/license.html>
 
370
+ * for a copy of the LGPLv3 License.
 
371
+ *
 
372
+ ************************************************************************/
 
373
+#ifndef __ooo_vba_word_XCell_idl__
 
374
+#define __ooo_vba_word_XCell_idl__
 
375
+
 
376
+#ifndef __com_sun_star_uno_XInterface_idl__
 
377
+#include <com/sun/star/uno/XInterface.idl>
 
378
+#endif
 
379
+
 
380
+#ifndef __ooo_vba_XHelperInterface_idl__
 
381
+#include <ooo/vba/XHelperInterface.idl>
 
382
+#endif
 
383
+
 
384
+module ooo {  module vba {  module word { 
 
385
+
 
386
+interface XCell
 
387
+{
 
388
+    interface ooo::vba::XHelperInterface;
 
389
+
 
390
+    [attribute] long Width;
 
391
+    [attribute] any Height;
 
392
+    [attribute] long HeightRule;
 
393
+
 
394
+    void SetWidth( [in] float ColumnWidth, [in] long RulerStyle );
 
395
+    void SetHeight( [in] float RowHeight, [in] long HeightRule );
 
396
+};
 
397
+
 
398
+}; }; };
 
399
+
 
400
+#endif
 
401
+
 
402
+
 
403
diff --git oovbaapi/ooo/vba/word/XCells.idl oovbaapi/ooo/vba/word/XCells.idl
 
404
new file mode 100644
 
405
index 0000000..9a18c55
 
406
--- /dev/null
 
407
+++ oovbaapi/ooo/vba/word/XCells.idl
 
408
@@ -0,0 +1,62 @@
 
409
+/*************************************************************************
 
410
+ *
 
411
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
412
+ * 
 
413
+ * Copyright 2008 by Sun Microsystems, Inc.
 
414
+ *
 
415
+ * OpenOffice.org - a multi-platform office productivity suite
 
416
+ *
 
417
+ * $RCSfile: 
 
418
+ * $Revision: 
 
419
+ *
 
420
+ * This file is part of OpenOffice.org.
 
421
+ *
 
422
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
423
+ * it under the terms of the GNU Lesser General Public License version 3
 
424
+ * only, as published by the Free Software Foundation.
 
425
+ *
 
426
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
427
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
428
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
429
+ * GNU Lesser General Public License version 3 for more details
 
430
+ * (a copy is included in the LICENSE file that accompanied this code).
 
431
+ *
 
432
+ * You should have received a copy of the GNU Lesser General Public License
 
433
+ * version 3 along with OpenOffice.org.  If not, see
 
434
+ * <http://www.openoffice.org/license.html>
 
435
+ * for a copy of the LGPLv3 License.
 
436
+ *
 
437
+ ************************************************************************/
 
438
+#ifndef __ooo_vba_word_XCells_idl__
 
439
+#define __ooo_vba_word_XCells_idl__
 
440
+
 
441
+#ifndef __com_sun_star_uno_XInterface_idl__
 
442
+#include <com/sun/star/uno/XInterface.idl>
 
443
+#endif
 
444
+
 
445
+#ifndef __ooo_vba_XCollection_idl__
 
446
+#include <ooo/vba/XCollection.idl>
 
447
+#endif
 
448
+
 
449
+
 
450
+//=============================================================================
 
451
+
 
452
+module ooo {  module vba {  module word { 
 
453
+
 
454
+//=============================================================================
 
455
+
 
456
+interface XCells 
 
457
+{
 
458
+    interface ::ooo::vba::XCollection;
 
459
+
 
460
+    [attribute] long Width;
 
461
+    [attribute] any Height;
 
462
+    [attribute] long HeightRule;
 
463
+
 
464
+    void SetWidth( [in] float ColumnWidth, [in] long RulerStyle );
 
465
+    void SetHeight( [in] float RowHeight, [in] long HeightRule );
 
466
+};
 
467
+
 
468
+}; }; };
 
469
+
 
470
+#endif
 
471
diff --git oovbaapi/ooo/vba/word/XCheckBox.idl oovbaapi/ooo/vba/word/XCheckBox.idl
 
472
new file mode 100644
 
473
index 0000000..1baafe5
 
474
--- /dev/null
 
475
+++ oovbaapi/ooo/vba/word/XCheckBox.idl
 
476
@@ -0,0 +1,54 @@
 
477
+/*************************************************************************
 
478
+ *
 
479
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
480
+ * 
 
481
+ * Copyright 2008 by Sun Microsystems, Inc.
 
482
+ *
 
483
+ * OpenOffice.org - a multi-platform office productivity suite
 
484
+ *
 
485
+ * $RCSfile: 
 
486
+ * $Revision: 
 
487
+ *
 
488
+ * This file is part of OpenOffice.org.
 
489
+ *
 
490
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
491
+ * it under the terms of the GNU Lesser General Public License version 3
 
492
+ * only, as published by the Free Software Foundation.
 
493
+ *
 
494
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
495
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
496
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
497
+ * GNU Lesser General Public License version 3 for more details
 
498
+ * (a copy is included in the LICENSE file that accompanied this code).
 
499
+ *
 
500
+ * You should have received a copy of the GNU Lesser General Public License
 
501
+ * version 3 along with OpenOffice.org.  If not, see
 
502
+ * <http://www.openoffice.org/license.html>
 
503
+ * for a copy of the LGPLv3 License.
 
504
+ *
 
505
+ ************************************************************************/
 
506
+#ifndef __ooo_vba_word_XCheckBox_idl__
 
507
+#define __ooo_vba_word_XCheckBox_idl__
 
508
+
 
509
+#ifndef __com_sun_star_uno_XInterface_idl__
 
510
+#include <com/sun/star/uno/XInterface.idl>
 
511
+#endif
 
512
+
 
513
+#ifndef __ooo_vba_XHelperInterface_idl__
 
514
+#include <ooo/vba/XHelperInterface.idl>
 
515
+#endif
 
516
+
 
517
+module ooo {  module vba {  module word { 
 
518
+
 
519
+interface XCheckBox
 
520
+{
 
521
+    interface ooo::vba::XHelperInterface;
 
522
+
 
523
+    [attribute] boolean Value;
 
524
+};
 
525
+
 
526
+}; }; };
 
527
+
 
528
+#endif
 
529
+
 
530
+
 
531
diff --git oovbaapi/ooo/vba/word/XColumn.idl oovbaapi/ooo/vba/word/XColumn.idl
 
532
new file mode 100644
 
533
index 0000000..78266fc
 
534
--- /dev/null
 
535
+++ oovbaapi/ooo/vba/word/XColumn.idl
 
536
@@ -0,0 +1,56 @@
 
537
+/*************************************************************************
 
538
+ *
 
539
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
540
+ * 
 
541
+ * Copyright 2008 by Sun Microsystems, Inc.
 
542
+ *
 
543
+ * OpenOffice.org - a multi-platform office productivity suite
 
544
+ *
 
545
+ * $RCSfile: 
 
546
+ * $Revision: 
 
547
+ *
 
548
+ * This file is part of OpenOffice.org.
 
549
+ *
 
550
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
551
+ * it under the terms of the GNU Lesser General Public License version 3
 
552
+ * only, as published by the Free Software Foundation.
 
553
+ *
 
554
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
555
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
556
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
557
+ * GNU Lesser General Public License version 3 for more details
 
558
+ * (a copy is included in the LICENSE file that accompanied this code).
 
559
+ *
 
560
+ * You should have received a copy of the GNU Lesser General Public License
 
561
+ * version 3 along with OpenOffice.org.  If not, see
 
562
+ * <http://www.openoffice.org/license.html>
 
563
+ * for a copy of the LGPLv3 License.
 
564
+ *
 
565
+ ************************************************************************/
 
566
+#ifndef __ooo_vba_word_XColumn_idl__
 
567
+#define __ooo_vba_word_XColumn_idl__
 
568
+
 
569
+#ifndef __com_sun_star_uno_XInterface_idl__
 
570
+#include <com/sun/star/uno/XInterface.idl>
 
571
+#endif
 
572
+
 
573
+#ifndef __ooo_vba_XHelperInterface_idl__
 
574
+#include <ooo/vba/XHelperInterface.idl>
 
575
+#endif
 
576
+
 
577
+module ooo {  module vba {  module word { 
 
578
+
 
579
+interface XColumn
 
580
+{
 
581
+    interface ooo::vba::XHelperInterface;
 
582
+
 
583
+    [attribute] long Width;
 
584
+
 
585
+    void Select();
 
586
+};
 
587
+
 
588
+}; }; };
 
589
+
 
590
+#endif
 
591
+
 
592
+
 
593
diff --git oovbaapi/ooo/vba/word/XColumns.idl oovbaapi/ooo/vba/word/XColumns.idl
 
594
new file mode 100644
 
595
index 0000000..84ed9cb
 
596
--- /dev/null
 
597
+++ oovbaapi/ooo/vba/word/XColumns.idl
 
598
@@ -0,0 +1,59 @@
 
599
+/*************************************************************************
 
600
+ *
 
601
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
602
+ * 
 
603
+ * Copyright 2008 by Sun Microsystems, Inc.
 
604
+ *
 
605
+ * OpenOffice.org - a multi-platform office productivity suite
 
606
+ *
 
607
+ * $RCSfile: 
 
608
+ * $Revision: 
 
609
+ *
 
610
+ * This file is part of OpenOffice.org.
 
611
+ *
 
612
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
613
+ * it under the terms of the GNU Lesser General Public License version 3
 
614
+ * only, as published by the Free Software Foundation.
 
615
+ *
 
616
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
617
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
618
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
619
+ * GNU Lesser General Public License version 3 for more details
 
620
+ * (a copy is included in the LICENSE file that accompanied this code).
 
621
+ *
 
622
+ * You should have received a copy of the GNU Lesser General Public License
 
623
+ * version 3 along with OpenOffice.org.  If not, see
 
624
+ * <http://www.openoffice.org/license.html>
 
625
+ * for a copy of the LGPLv3 License.
 
626
+ *
 
627
+ ************************************************************************/
 
628
+#ifndef __ooo_vba_word_XColumns_idl__
 
629
+#define __ooo_vba_word_XColumns_idl__
 
630
+
 
631
+#ifndef __com_sun_star_uno_XInterface_idl__
 
632
+#include <com/sun/star/uno/XInterface.idl>
 
633
+#endif
 
634
+
 
635
+#ifndef __ooo_vba_XCollection_idl__
 
636
+#include <ooo/vba/XCollection.idl>
 
637
+#endif
 
638
+
 
639
+
 
640
+//=============================================================================
 
641
+
 
642
+module ooo {  module vba {  module word { 
 
643
+
 
644
+//=============================================================================
 
645
+
 
646
+interface XColumns 
 
647
+{
 
648
+    interface ::ooo::vba::XCollection;
 
649
+
 
650
+    [attribute] long Width;
 
651
+
 
652
+    void Select();
 
653
+};
 
654
+
 
655
+}; }; };
 
656
+
 
657
+#endif
 
658
diff --git oovbaapi/ooo/vba/word/XDocument.idl oovbaapi/ooo/vba/word/XDocument.idl
 
659
index a7ceb18..b3ec455 100644
 
660
--- oovbaapi/ooo/vba/word/XDocument.idl
 
661
+++ oovbaapi/ooo/vba/word/XDocument.idl
 
662
@@ -52,6 +52,11 @@ interface XDocument : com::sun::star::script::XInvocation
 
663
 {
 
664
     [attribute, readonly] XRange Content;
 
665
     [attribute] any AttachedTemplate;
 
666
+    [attribute] long ProtectionType;
 
667
+    [attribute] boolean UpdateStylesOnOpen;
 
668
+    [attribute] boolean AutoHyphenation;
 
669
+    [attribute] long HyphenationZone;
 
670
+    [attribute] long ConsecutiveHyphensLimit;
 
671
 
 
672
     XRange Range( [in] any Start, [in] any End );
 
673
     any BuiltInDocumentProperties( [in] any index );
 
674
@@ -66,6 +71,14 @@ interface XDocument : com::sun::star::script::XInvocation
 
675
     any Sections([in] any Index);
 
676
        void Activate();
 
677
     any PageSetup();
 
678
+    any TablesOfContents([in] any Index);
 
679
+    any FormFields([in] any Index);
 
680
+    void Protect( [in] long Type, [in] any NOReset, [in] any Password, [in] any UseIRM, [in] any EnforceStyleLock );
 
681
+    void PrintOut([in] any Background, [in] any Append, [in] any Range, [in] any OutputFileName, [in] any From, [in] any To, [in] any Item, [in] any Copies, [in] any Pages, [in] any PageType, [in] any PrintToFile, [in] any Collate, [in] any FileName, [in] any ActivePrinterMacGX, [in] any ManualDuplexPrint, [in] any PrintZoomColumn, [in] any PrintZoomRow, [in] any PrintZoomPaperWidth, [in] any PrintZoomPaperHeight);
 
682
+    void PrintPreview();
 
683
+    void ClosePrintPreview();
 
684
+    any Revisions( [in] any index );
 
685
+    any Frames( [in] any index );
 
686
 };
 
687
 
 
688
 }; }; };
 
689
diff --git oovbaapi/ooo/vba/word/XField.idl oovbaapi/ooo/vba/word/XField.idl
 
690
index 19d3d3b..1acd208 100644
 
691
--- oovbaapi/ooo/vba/word/XField.idl
 
692
+++ oovbaapi/ooo/vba/word/XField.idl
 
693
@@ -44,6 +44,8 @@ module ooo { module vba { module word {
 
694
 interface XField 
 
695
 {
 
696
     interface ::ooo::vba::XHelperInterface;
 
697
+
 
698
+    boolean Update();
 
699
 };
 
700
 
 
701
 }; }; };
 
702
diff --git oovbaapi/ooo/vba/word/XFormField.idl oovbaapi/ooo/vba/word/XFormField.idl
 
703
new file mode 100644
 
704
index 0000000..23d2a83
 
705
--- /dev/null
 
706
+++ oovbaapi/ooo/vba/word/XFormField.idl
 
707
@@ -0,0 +1,58 @@
 
708
+/*************************************************************************
 
709
+ *
 
710
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
711
+ * 
 
712
+ * Copyright 2008 by Sun Microsystems, Inc.
 
713
+ *
 
714
+ * OpenOffice.org - a multi-platform office productivity suite
 
715
+ *
 
716
+ * $RCSfile: 
 
717
+ * $Revision: 
 
718
+ *
 
719
+ * This file is part of OpenOffice.org.
 
720
+ *
 
721
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
722
+ * it under the terms of the GNU Lesser General Public License version 3
 
723
+ * only, as published by the Free Software Foundation.
 
724
+ *
 
725
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
726
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
727
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
728
+ * GNU Lesser General Public License version 3 for more details
 
729
+ * (a copy is included in the LICENSE file that accompanied this code).
 
730
+ *
 
731
+ * You should have received a copy of the GNU Lesser General Public License
 
732
+ * version 3 along with OpenOffice.org.  If not, see
 
733
+ * <http://www.openoffice.org/license.html>
 
734
+ * for a copy of the LGPLv3 License.
 
735
+ *
 
736
+ ************************************************************************/
 
737
+#ifndef __ooo_vba_word_XFormField_idl__
 
738
+#define __ooo_vba_word_XFormField_idl__
 
739
+
 
740
+#ifndef __com_sun_star_uno_XInterface_idl__
 
741
+#include <com/sun/star/uno/XInterface.idl>
 
742
+#endif
 
743
+
 
744
+#ifndef __ooo_vba_XHelperInterface_idl__
 
745
+#include <ooo/vba/XHelperInterface.idl>
 
746
+#endif
 
747
+
 
748
+module ooo {  module vba {  module word { 
 
749
+
 
750
+interface XFormField
 
751
+{
 
752
+    interface ooo::vba::XHelperInterface;
 
753
+
 
754
+    [attribute] string Result;
 
755
+    [attribute] boolean Enabled;
 
756
+
 
757
+    any CheckBox();
 
758
+
 
759
+};
 
760
+
 
761
+}; }; };
 
762
+
 
763
+#endif
 
764
+
 
765
+
 
766
diff --git oovbaapi/ooo/vba/word/XFormFields.idl oovbaapi/ooo/vba/word/XFormFields.idl
 
767
new file mode 100644
 
768
index 0000000..7a19d3b
 
769
--- /dev/null
 
770
+++ oovbaapi/ooo/vba/word/XFormFields.idl
 
771
@@ -0,0 +1,55 @@
 
772
+/*************************************************************************
 
773
+ *
 
774
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
775
+ * 
 
776
+ * Copyright 2008 by Sun Microsystems, Inc.
 
777
+ *
 
778
+ * OpenOffice.org - a multi-platform office productivity suite
 
779
+ *
 
780
+ * $RCSfile: 
 
781
+ * $Revision: 
 
782
+ *
 
783
+ * This file is part of OpenOffice.org.
 
784
+ *
 
785
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
786
+ * it under the terms of the GNU Lesser General Public License version 3
 
787
+ * only, as published by the Free Software Foundation.
 
788
+ *
 
789
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
790
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
791
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
792
+ * GNU Lesser General Public License version 3 for more details
 
793
+ * (a copy is included in the LICENSE file that accompanied this code).
 
794
+ *
 
795
+ * You should have received a copy of the GNU Lesser General Public License
 
796
+ * version 3 along with OpenOffice.org.  If not, see
 
797
+ * <http://www.openoffice.org/license.html>
 
798
+ * for a copy of the LGPLv3 License.
 
799
+ *
 
800
+ ************************************************************************/
 
801
+#ifndef __ooo_vba_word_XFormFields_idl__
 
802
+#define __ooo_vba_word_XFormFields_idl__
 
803
+
 
804
+#ifndef __com_sun_star_uno_XInterface_idl__
 
805
+#include <com/sun/star/uno/XInterface.idl>
 
806
+#endif
 
807
+
 
808
+#ifndef __ooo_vba_XCollection_idl__
 
809
+#include <ooo/vba/XCollection.idl>
 
810
+#endif
 
811
+
 
812
+
 
813
+//=============================================================================
 
814
+
 
815
+module ooo {  module vba {  module word { 
 
816
+
 
817
+//=============================================================================
 
818
+
 
819
+interface XFormFields 
 
820
+{
 
821
+    interface ::ooo::vba::XCollection;
 
822
+};
 
823
+
 
824
+}; }; };
 
825
+
 
826
+#endif
 
827
diff --git oovbaapi/ooo/vba/word/XFrame.idl oovbaapi/ooo/vba/word/XFrame.idl
 
828
new file mode 100644
 
829
index 0000000..5007405
 
830
--- /dev/null
 
831
+++ oovbaapi/ooo/vba/word/XFrame.idl
 
832
@@ -0,0 +1,58 @@
 
833
+/*************************************************************************
 
834
+ *
 
835
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
836
+ * 
 
837
+ * Copyright 2008 by Sun Microsystems, Inc.
 
838
+ *
 
839
+ * OpenOffice.org - a multi-platform office productivity suite
 
840
+ *
 
841
+ * $RCSfile: 
 
842
+ * $Revision: 
 
843
+ *
 
844
+ * This file is part of OpenOffice.org.
 
845
+ *
 
846
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
847
+ * it under the terms of the GNU Lesser General Public License version 3
 
848
+ * only, as published by the Free Software Foundation.
 
849
+ *
 
850
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
851
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
852
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
853
+ * GNU Lesser General Public License version 3 for more details
 
854
+ * (a copy is included in the LICENSE file that accompanied this code).
 
855
+ *
 
856
+ * You should have received a copy of the GNU Lesser General Public License
 
857
+ * version 3 along with OpenOffice.org.  If not, see
 
858
+ * <http://www.openoffice.org/license.html>
 
859
+ * for a copy of the LGPLv3 License.
 
860
+ *
 
861
+ ************************************************************************/
 
862
+#ifndef __ooo_vba_word_XFrame_idl__
 
863
+#define __ooo_vba_word_XFrame_idl__
 
864
+
 
865
+#ifndef __com_sun_star_uno_XInterface_idl__
 
866
+#include <com/sun/star/uno/XInterface.idl>
 
867
+#endif
 
868
+
 
869
+#ifndef __ooo_vba_XHelperInterface_idl__
 
870
+#include <ooo/vba/XHelperInterface.idl>
 
871
+#endif
 
872
+
 
873
+#ifndef __com_sun_star_container_XNamed_idl__
 
874
+#include <com/sun/star/container/XNamed.idl>
 
875
+#endif
 
876
+
 
877
+module ooo {  module vba {  module word { 
 
878
+
 
879
+interface XFrame
 
880
+{
 
881
+    interface ooo::vba::XHelperInterface;
 
882
+
 
883
+    void Select();
 
884
+};
 
885
+
 
886
+}; }; };
 
887
+
 
888
+#endif
 
889
+
 
890
+
 
891
diff --git oovbaapi/ooo/vba/word/XFrames.idl oovbaapi/ooo/vba/word/XFrames.idl
 
892
new file mode 100644
 
893
index 0000000..4c81545
 
894
--- /dev/null
 
895
+++ oovbaapi/ooo/vba/word/XFrames.idl
 
896
@@ -0,0 +1,55 @@
 
897
+/*************************************************************************
 
898
+ *
 
899
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
900
+ * 
 
901
+ * Copyright 2008 by Sun Microsystems, Inc.
 
902
+ *
 
903
+ * OpenOffice.org - a multi-platform office productivity suite
 
904
+ *
 
905
+ * $RCSfile: 
 
906
+ * $Revision: 
 
907
+ *
 
908
+ * This file is part of OpenOffice.org.
 
909
+ *
 
910
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
911
+ * it under the terms of the GNU Lesser General Public License version 3
 
912
+ * only, as published by the Free Software Foundation.
 
913
+ *
 
914
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
915
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
916
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
917
+ * GNU Lesser General Public License version 3 for more details
 
918
+ * (a copy is included in the LICENSE file that accompanied this code).
 
919
+ *
 
920
+ * You should have received a copy of the GNU Lesser General Public License
 
921
+ * version 3 along with OpenOffice.org.  If not, see
 
922
+ * <http://www.openoffice.org/license.html>
 
923
+ * for a copy of the LGPLv3 License.
 
924
+ *
 
925
+ ************************************************************************/
 
926
+#ifndef __ooo_vba_word_XFrames_idl__
 
927
+#define __ooo_vba_word_XFrames_idl__
 
928
+
 
929
+#ifndef __com_sun_star_uno_XInterface_idl__
 
930
+#include <com/sun/star/uno/XInterface.idl>
 
931
+#endif
 
932
+
 
933
+#ifndef __ooo_vba_XCollection_idl__
 
934
+#include <ooo/vba/XCollection.idl>
 
935
+#endif
 
936
+
 
937
+
 
938
+//=============================================================================
 
939
+
 
940
+module ooo {  module vba {  module word { 
 
941
+
 
942
+//=============================================================================
 
943
+
 
944
+interface XFrames 
 
945
+{
 
946
+    interface ::ooo::vba::XCollection;
 
947
+};
 
948
+
 
949
+}; }; };
 
950
+
 
951
+#endif
 
952
diff --git oovbaapi/ooo/vba/word/XGlobals.idl oovbaapi/ooo/vba/word/XGlobals.idl
 
953
index 519499c..33106fa 100644
 
954
--- oovbaapi/ooo/vba/word/XGlobals.idl
 
955
+++ oovbaapi/ooo/vba/word/XGlobals.idl
 
956
@@ -52,6 +52,7 @@ interface XGlobals : com::sun::star::uno::XInterface
 
957
     any Documents( [in] any aIndex );
 
958
     any Addins( [in] any aIndex );
 
959
     any Dialogs( [in] any aIndex );
 
960
+    any ListGalleries( [in] any aIndex );
 
961
     float CentimetersToPoints([in] float Centimeters );
 
962
 };
 
963
 
 
964
diff --git oovbaapi/ooo/vba/word/XHeadersFooters.idl oovbaapi/ooo/vba/word/XHeadersFooters.idl
 
965
new file mode 100644
 
966
index 0000000..22066e8
 
967
--- /dev/null
 
968
+++ oovbaapi/ooo/vba/word/XHeadersFooters.idl
 
969
@@ -0,0 +1,55 @@
 
970
+/*************************************************************************
 
971
+ *
 
972
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
973
+ * 
 
974
+ * Copyright 2008 by Sun Microsystems, Inc.
 
975
+ *
 
976
+ * OpenOffice.org - a multi-platform office productivity suite
 
977
+ *
 
978
+ * $RCSfile: 
 
979
+ * $Revision: 
 
980
+ *
 
981
+ * This file is part of OpenOffice.org.
 
982
+ *
 
983
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
984
+ * it under the terms of the GNU Lesser General Public License version 3
 
985
+ * only, as published by the Free Software Foundation.
 
986
+ *
 
987
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
988
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
989
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
990
+ * GNU Lesser General Public License version 3 for more details
 
991
+ * (a copy is included in the LICENSE file that accompanied this code).
 
992
+ *
 
993
+ * You should have received a copy of the GNU Lesser General Public License
 
994
+ * version 3 along with OpenOffice.org.  If not, see
 
995
+ * <http://www.openoffice.org/license.html>
 
996
+ * for a copy of the LGPLv3 License.
 
997
+ *
 
998
+ ************************************************************************/
 
999
+#ifndef __ooo_vba_word_XHeadersFooters_idl__
 
1000
+#define __ooo_vba_word_XHeadersFooters_idl__
 
1001
+
 
1002
+#ifndef __com_sun_star_uno_XInterface_idl__
 
1003
+#include <com/sun/star/uno/XInterface.idl>
 
1004
+#endif
 
1005
+
 
1006
+#ifndef __ooo_vba_XCollection_idl__
 
1007
+#include <ooo/vba/XCollection.idl>
 
1008
+#endif
 
1009
+
 
1010
+
 
1011
+//=============================================================================
 
1012
+
 
1013
+module ooo {  module vba {  module word { 
 
1014
+
 
1015
+//=============================================================================
 
1016
+
 
1017
+interface XHeadersFooters 
 
1018
+{
 
1019
+    interface ::ooo::vba::XCollection;
 
1020
+};
 
1021
+
 
1022
+}; }; };
 
1023
+
 
1024
+#endif
 
1025
diff --git oovbaapi/ooo/vba/word/XListFormat.idl oovbaapi/ooo/vba/word/XListFormat.idl
 
1026
new file mode 100644
 
1027
index 0000000..d9aa65a
 
1028
--- /dev/null
 
1029
+++ oovbaapi/ooo/vba/word/XListFormat.idl
 
1030
@@ -0,0 +1,60 @@
 
1031
+/*************************************************************************
 
1032
+ *
 
1033
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
1034
+ * 
 
1035
+ * Copyright 2008 by Sun Microsystems, Inc.
 
1036
+ *
 
1037
+ * OpenOffice.org - a multi-platform office productivity suite
 
1038
+ *
 
1039
+ * $RCSfile: 
 
1040
+ * $Revision: 
 
1041
+ *
 
1042
+ * This file is part of OpenOffice.org.
 
1043
+ *
 
1044
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
1045
+ * it under the terms of the GNU Lesser General Public License version 3
 
1046
+ * only, as published by the Free Software Foundation.
 
1047
+ *
 
1048
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
1049
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
1050
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
1051
+ * GNU Lesser General Public License version 3 for more details
 
1052
+ * (a copy is included in the LICENSE file that accompanied this code).
 
1053
+ *
 
1054
+ * You should have received a copy of the GNU Lesser General Public License
 
1055
+ * version 3 along with OpenOffice.org.  If not, see
 
1056
+ * <http://www.openoffice.org/license.html>
 
1057
+ * for a copy of the LGPLv3 License.
 
1058
+ *
 
1059
+ ************************************************************************/
 
1060
+#ifndef __ooo_vba_word_XListFormat_idl__
 
1061
+#define __ooo_vba_word_XListFormat_idl__
 
1062
+
 
1063
+#ifndef __com_sun_star_uno_XInterface_idl__
 
1064
+#include <com/sun/star/uno/XInterface.idl>
 
1065
+#endif
 
1066
+
 
1067
+#ifndef __ooo_vba_XHelperInterface_idl__
 
1068
+#include <ooo/vba/XHelperInterface.idl>
 
1069
+#endif
 
1070
+
 
1071
+module ooo {  module vba {  module word { 
 
1072
+
 
1073
+interface XListTemplate;
 
1074
+interface XListFormat
 
1075
+{
 
1076
+    interface ooo::vba::XHelperInterface;
 
1077
+
 
1078
+    void ApplyListTemplate([in] XListTemplate ListTemplate,
 
1079
+        [in] any /* optional */ ContinuePreviousList,
 
1080
+        [in] any /* optional */ ApplyTo,
 
1081
+        [in] any /* optional */ DefaultListBehavior);
 
1082
+    
 
1083
+    void ConvertNumbersToText();
 
1084
+};
 
1085
+
 
1086
+}; }; };
 
1087
+
 
1088
+#endif
 
1089
+
 
1090
+
 
1091
diff --git oovbaapi/ooo/vba/word/XListGalleries.idl oovbaapi/ooo/vba/word/XListGalleries.idl
 
1092
new file mode 100644
 
1093
index 0000000..9268afc
 
1094
--- /dev/null
 
1095
+++ oovbaapi/ooo/vba/word/XListGalleries.idl
 
1096
@@ -0,0 +1,55 @@
 
1097
+/*************************************************************************
 
1098
+ *
 
1099
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
1100
+ * 
 
1101
+ * Copyright 2008 by Sun Microsystems, Inc.
 
1102
+ *
 
1103
+ * OpenOffice.org - a multi-platform office productivity suite
 
1104
+ *
 
1105
+ * $RCSfile: 
 
1106
+ * $Revision: 
 
1107
+ *
 
1108
+ * This file is part of OpenOffice.org.
 
1109
+ *
 
1110
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
1111
+ * it under the terms of the GNU Lesser General Public License version 3
 
1112
+ * only, as published by the Free Software Foundation.
 
1113
+ *
 
1114
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
1115
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
1116
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
1117
+ * GNU Lesser General Public License version 3 for more details
 
1118
+ * (a copy is included in the LICENSE file that accompanied this code).
 
1119
+ *
 
1120
+ * You should have received a copy of the GNU Lesser General Public License
 
1121
+ * version 3 along with OpenOffice.org.  If not, see
 
1122
+ * <http://www.openoffice.org/license.html>
 
1123
+ * for a copy of the LGPLv3 License.
 
1124
+ *
 
1125
+ ************************************************************************/
 
1126
+#ifndef __ooo_vba_word_XListGalleries_idl__
 
1127
+#define __ooo_vba_word_XListGalleries_idl__
 
1128
+
 
1129
+#ifndef __com_sun_star_uno_XInterface_idl__
 
1130
+#include <com/sun/star/uno/XInterface.idl>
 
1131
+#endif
 
1132
+
 
1133
+#ifndef __ooo_vba_XCollection_idl__
 
1134
+#include <ooo/vba/XCollection.idl>
 
1135
+#endif
 
1136
+
 
1137
+
 
1138
+//=============================================================================
 
1139
+
 
1140
+module ooo {  module vba {  module word { 
 
1141
+
 
1142
+//=============================================================================
 
1143
+
 
1144
+interface XListGalleries 
 
1145
+{
 
1146
+    interface ::ooo::vba::XCollection;
 
1147
+};
 
1148
+
 
1149
+}; }; };
 
1150
+
 
1151
+#endif
 
1152
diff --git oovbaapi/ooo/vba/word/XListGallery.idl oovbaapi/ooo/vba/word/XListGallery.idl
 
1153
new file mode 100644
 
1154
index 0000000..4bd83b9
 
1155
--- /dev/null
 
1156
+++ oovbaapi/ooo/vba/word/XListGallery.idl
 
1157
@@ -0,0 +1,54 @@
 
1158
+/*************************************************************************
 
1159
+ *
 
1160
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
1161
+ * 
 
1162
+ * Copyright 2008 by Sun Microsystems, Inc.
 
1163
+ *
 
1164
+ * OpenOffice.org - a multi-platform office productivity suite
 
1165
+ *
 
1166
+ * $RCSfile: 
 
1167
+ * $Revision: 
 
1168
+ *
 
1169
+ * This file is part of OpenOffice.org.
 
1170
+ *
 
1171
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
1172
+ * it under the terms of the GNU Lesser General Public License version 3
 
1173
+ * only, as published by the Free Software Foundation.
 
1174
+ *
 
1175
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
1176
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
1177
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
1178
+ * GNU Lesser General Public License version 3 for more details
 
1179
+ * (a copy is included in the LICENSE file that accompanied this code).
 
1180
+ *
 
1181
+ * You should have received a copy of the GNU Lesser General Public License
 
1182
+ * version 3 along with OpenOffice.org.  If not, see
 
1183
+ * <http://www.openoffice.org/license.html>
 
1184
+ * for a copy of the LGPLv3 License.
 
1185
+ *
 
1186
+ ************************************************************************/
 
1187
+#ifndef __ooo_vba_word_XListGallery_idl__
 
1188
+#define __ooo_vba_word_XListGallery_idl__
 
1189
+
 
1190
+#ifndef __com_sun_star_uno_XInterface_idl__
 
1191
+#include <com/sun/star/uno/XInterface.idl>
 
1192
+#endif
 
1193
+
 
1194
+#ifndef __ooo_vba_XHelperInterface_idl__
 
1195
+#include <ooo/vba/XHelperInterface.idl>
 
1196
+#endif
 
1197
+
 
1198
+module ooo {  module vba {  module word { 
 
1199
+
 
1200
+interface XListGallery
 
1201
+{
 
1202
+    interface ooo::vba::XHelperInterface;
 
1203
+
 
1204
+    any ListTemplates( [in] any aIndex );
 
1205
+};
 
1206
+
 
1207
+}; }; };
 
1208
+
 
1209
+#endif
 
1210
+
 
1211
+
 
1212
diff --git oovbaapi/ooo/vba/word/XListLevel.idl oovbaapi/ooo/vba/word/XListLevel.idl
 
1213
new file mode 100644
 
1214
index 0000000..0ea1be7
 
1215
--- /dev/null
 
1216
+++ oovbaapi/ooo/vba/word/XListLevel.idl
 
1217
@@ -0,0 +1,66 @@
 
1218
+/*************************************************************************
 
1219
+ *
 
1220
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
1221
+ * 
 
1222
+ * Copyright 2008 by Sun Microsystems, Inc.
 
1223
+ *
 
1224
+ * OpenOffice.org - a multi-platform office productivity suite
 
1225
+ *
 
1226
+ * $RCSfile: 
 
1227
+ * $Revision: 
 
1228
+ *
 
1229
+ * This file is part of OpenOffice.org.
 
1230
+ *
 
1231
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
1232
+ * it under the terms of the GNU Lesser General Public License version 3
 
1233
+ * only, as published by the Free Software Foundation.
 
1234
+ *
 
1235
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
1236
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
1237
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
1238
+ * GNU Lesser General Public License version 3 for more details
 
1239
+ * (a copy is included in the LICENSE file that accompanied this code).
 
1240
+ *
 
1241
+ * You should have received a copy of the GNU Lesser General Public License
 
1242
+ * version 3 along with OpenOffice.org.  If not, see
 
1243
+ * <http://www.openoffice.org/license.html>
 
1244
+ * for a copy of the LGPLv3 License.
 
1245
+ *
 
1246
+ ************************************************************************/
 
1247
+#ifndef __ooo_vba_word_XListLevel_idl__
 
1248
+#define __ooo_vba_word_XListLevel_idl__
 
1249
+
 
1250
+#ifndef __com_sun_star_uno_XInterface_idl__
 
1251
+#include <com/sun/star/uno/XInterface.idl>
 
1252
+#endif
 
1253
+
 
1254
+#ifndef __ooo_vba_XHelperInterface_idl__
 
1255
+#include <ooo/vba/XHelperInterface.idl>
 
1256
+#endif
 
1257
+
 
1258
+module ooo {  module vba {  module word { 
 
1259
+
 
1260
+interface XFont;
 
1261
+interface XListLevel
 
1262
+{
 
1263
+    interface ooo::vba::XHelperInterface;
 
1264
+
 
1265
+    [attribute] long Alignment;
 
1266
+    [attribute] XFont Font;
 
1267
+    [attribute, readonly] long Index;
 
1268
+    [attribute] string LinkedStyle;
 
1269
+    [attribute] string NumberFormat;
 
1270
+    [attribute] float NumberPosition;
 
1271
+    [attribute] long NumberStyle;
 
1272
+    [attribute] long ResetOnHigher;
 
1273
+    [attribute] long StartAt;
 
1274
+    [attribute] float TabPosition;
 
1275
+    [attribute] float TextPosition;
 
1276
+    [attribute] long TrailingCharacter;
 
1277
+};
 
1278
+
 
1279
+}; }; };
 
1280
+
 
1281
+#endif
 
1282
+
 
1283
+
 
1284
diff --git oovbaapi/ooo/vba/word/XListLevels.idl oovbaapi/ooo/vba/word/XListLevels.idl
 
1285
new file mode 100644
 
1286
index 0000000..522d474
 
1287
--- /dev/null
 
1288
+++ oovbaapi/ooo/vba/word/XListLevels.idl
 
1289
@@ -0,0 +1,55 @@
 
1290
+/*************************************************************************
 
1291
+ *
 
1292
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
1293
+ * 
 
1294
+ * Copyright 2008 by Sun Microsystems, Inc.
 
1295
+ *
 
1296
+ * OpenOffice.org - a multi-platform office productivity suite
 
1297
+ *
 
1298
+ * $RCSfile: 
 
1299
+ * $Revision: 
 
1300
+ *
 
1301
+ * This file is part of OpenOffice.org.
 
1302
+ *
 
1303
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
1304
+ * it under the terms of the GNU Lesser General Public License version 3
 
1305
+ * only, as published by the Free Software Foundation.
 
1306
+ *
 
1307
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
1308
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
1309
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
1310
+ * GNU Lesser General Public License version 3 for more details
 
1311
+ * (a copy is included in the LICENSE file that accompanied this code).
 
1312
+ *
 
1313
+ * You should have received a copy of the GNU Lesser General Public License
 
1314
+ * version 3 along with OpenOffice.org.  If not, see
 
1315
+ * <http://www.openoffice.org/license.html>
 
1316
+ * for a copy of the LGPLv3 License.
 
1317
+ *
 
1318
+ ************************************************************************/
 
1319
+#ifndef __ooo_vba_word_XListLevels_idl__
 
1320
+#define __ooo_vba_word_XListLevels_idl__
 
1321
+
 
1322
+#ifndef __com_sun_star_uno_XInterface_idl__
 
1323
+#include <com/sun/star/uno/XInterface.idl>
 
1324
+#endif
 
1325
+
 
1326
+#ifndef __ooo_vba_XCollection_idl__
 
1327
+#include <ooo/vba/XCollection.idl>
 
1328
+#endif
 
1329
+
 
1330
+
 
1331
+//=============================================================================
 
1332
+
 
1333
+module ooo {  module vba {  module word { 
 
1334
+
 
1335
+//=============================================================================
 
1336
+
 
1337
+interface XListLevels 
 
1338
+{
 
1339
+    interface ::ooo::vba::XCollection;
 
1340
+};
 
1341
+
 
1342
+}; }; };
 
1343
+
 
1344
+#endif
 
1345
diff --git oovbaapi/ooo/vba/word/XListTemplate.idl oovbaapi/ooo/vba/word/XListTemplate.idl
 
1346
new file mode 100644
 
1347
index 0000000..403bfa9
 
1348
--- /dev/null
 
1349
+++ oovbaapi/ooo/vba/word/XListTemplate.idl
 
1350
@@ -0,0 +1,54 @@
 
1351
+/*************************************************************************
 
1352
+ *
 
1353
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
1354
+ * 
 
1355
+ * Copyright 2008 by Sun Microsystems, Inc.
 
1356
+ *
 
1357
+ * OpenOffice.org - a multi-platform office productivity suite
 
1358
+ *
 
1359
+ * $RCSfile: 
 
1360
+ * $Revision: 
 
1361
+ *
 
1362
+ * This file is part of OpenOffice.org.
 
1363
+ *
 
1364
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
1365
+ * it under the terms of the GNU Lesser General Public License version 3
 
1366
+ * only, as published by the Free Software Foundation.
 
1367
+ *
 
1368
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
1369
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
1370
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
1371
+ * GNU Lesser General Public License version 3 for more details
 
1372
+ * (a copy is included in the LICENSE file that accompanied this code).
 
1373
+ *
 
1374
+ * You should have received a copy of the GNU Lesser General Public License
 
1375
+ * version 3 along with OpenOffice.org.  If not, see
 
1376
+ * <http://www.openoffice.org/license.html>
 
1377
+ * for a copy of the LGPLv3 License.
 
1378
+ *
 
1379
+ ************************************************************************/
 
1380
+#ifndef __ooo_vba_word_XListTemplate_idl__
 
1381
+#define __ooo_vba_word_XListTemplate_idl__
 
1382
+
 
1383
+#ifndef __com_sun_star_uno_XInterface_idl__
 
1384
+#include <com/sun/star/uno/XInterface.idl>
 
1385
+#endif
 
1386
+
 
1387
+#ifndef __ooo_vba_XHelperInterface_idl__
 
1388
+#include <ooo/vba/XHelperInterface.idl>
 
1389
+#endif
 
1390
+
 
1391
+module ooo {  module vba {  module word { 
 
1392
+
 
1393
+interface XListTemplate
 
1394
+{
 
1395
+    interface ooo::vba::XHelperInterface;
 
1396
+
 
1397
+    any ListLevels( [in] any aIndex );
 
1398
+};
 
1399
+
 
1400
+}; }; };
 
1401
+
 
1402
+#endif
 
1403
+
 
1404
+
 
1405
diff --git oovbaapi/ooo/vba/word/XListTemplates.idl oovbaapi/ooo/vba/word/XListTemplates.idl
 
1406
new file mode 100644
 
1407
index 0000000..d6ec96d
 
1408
--- /dev/null
 
1409
+++ oovbaapi/ooo/vba/word/XListTemplates.idl
 
1410
@@ -0,0 +1,55 @@
 
1411
+/*************************************************************************
 
1412
+ *
 
1413
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
1414
+ * 
 
1415
+ * Copyright 2008 by Sun Microsystems, Inc.
 
1416
+ *
 
1417
+ * OpenOffice.org - a multi-platform office productivity suite
 
1418
+ *
 
1419
+ * $RCSfile: 
 
1420
+ * $Revision: 
 
1421
+ *
 
1422
+ * This file is part of OpenOffice.org.
 
1423
+ *
 
1424
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
1425
+ * it under the terms of the GNU Lesser General Public License version 3
 
1426
+ * only, as published by the Free Software Foundation.
 
1427
+ *
 
1428
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
1429
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
1430
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
1431
+ * GNU Lesser General Public License version 3 for more details
 
1432
+ * (a copy is included in the LICENSE file that accompanied this code).
 
1433
+ *
 
1434
+ * You should have received a copy of the GNU Lesser General Public License
 
1435
+ * version 3 along with OpenOffice.org.  If not, see
 
1436
+ * <http://www.openoffice.org/license.html>
 
1437
+ * for a copy of the LGPLv3 License.
 
1438
+ *
 
1439
+ ************************************************************************/
 
1440
+#ifndef __ooo_vba_word_XListTemplates_idl__
 
1441
+#define __ooo_vba_word_XListTemplates_idl__
 
1442
+
 
1443
+#ifndef __com_sun_star_uno_XInterface_idl__
 
1444
+#include <com/sun/star/uno/XInterface.idl>
 
1445
+#endif
 
1446
+
 
1447
+#ifndef __ooo_vba_XCollection_idl__
 
1448
+#include <ooo/vba/XCollection.idl>
 
1449
+#endif
 
1450
+
 
1451
+
 
1452
+//=============================================================================
 
1453
+
 
1454
+module ooo {  module vba {  module word { 
 
1455
+
 
1456
+//=============================================================================
 
1457
+
 
1458
+interface XListTemplates 
 
1459
+{
 
1460
+    interface ::ooo::vba::XCollection;
 
1461
+};
 
1462
+
 
1463
+}; }; };
 
1464
+
 
1465
+#endif
 
1466
diff --git oovbaapi/ooo/vba/word/XParagraph.idl oovbaapi/ooo/vba/word/XParagraph.idl
 
1467
index 79ad7ae..7dd2b41 100644
 
1468
--- oovbaapi/ooo/vba/word/XParagraph.idl
 
1469
+++ oovbaapi/ooo/vba/word/XParagraph.idl
 
1470
@@ -46,6 +46,7 @@ interface XParagraph
 
1471
     interface ooo::vba::XHelperInterface;
 
1472
 
 
1473
     [attribute, readonly] XRange Range;
 
1474
+    [attribute] any Style;
 
1475
 };
 
1476
 
 
1477
 }; }; };
 
1478
diff --git oovbaapi/ooo/vba/word/XRange.idl oovbaapi/ooo/vba/word/XRange.idl
 
1479
index 47e688e..8f19ad5 100644
 
1480
--- oovbaapi/ooo/vba/word/XRange.idl
 
1481
+++ oovbaapi/ooo/vba/word/XRange.idl
 
1482
@@ -48,13 +48,14 @@ module ooo {  module vba {  module word {
 
1483
 interface XParagraphFormat;
 
1484
 interface XStyle;
 
1485
 interface XFont;
 
1486
+interface XListFormat;
 
1487
 interface XRange
 
1488
 {
 
1489
     interface ooo::vba::XHelperInterface;
 
1490
 
 
1491
     [attribute] string Text;
 
1492
     [attribute] XParagraphFormat ParagraphFormat;
 
1493
-    [attribute] XStyle Style;
 
1494
+    [attribute] any Style;
 
1495
     [attribute,readonly] ::com::sun::star::text::XTextRange XTextRange;
 
1496
     // Of course Font is NOT readonly, #FIXME #TODO
 
1497
     // readonly though will force an error attempting to write
 
1498
@@ -62,6 +63,7 @@ interface XRange
 
1499
     [attribute] long LanguageID;
 
1500
     [attribute] long Start;
 
1501
     [attribute] long End;
 
1502
+    [attribute, readonly] XListFormat ListFormat;
 
1503
 
 
1504
     void InsertBreak( [in] any Type );
 
1505
     void Select();
 
1506
@@ -69,6 +71,10 @@ interface XRange
 
1507
     void InsertParagraphBefore();
 
1508
     void InsertParagraphAfter();
 
1509
     any PageSetup();
 
1510
+    boolean InRange( [in] XRange Range );
 
1511
+    any Revisions( [in] any index );
 
1512
+    any Sections( [in] any index );
 
1513
+    any Fields( [in] any index );
 
1514
 };
 
1515
 
 
1516
 }; }; };
 
1517
diff --git oovbaapi/ooo/vba/word/XReplacement.idl oovbaapi/ooo/vba/word/XReplacement.idl
 
1518
index daae501..b1d7a6c 100644
 
1519
--- oovbaapi/ooo/vba/word/XReplacement.idl
 
1520
+++ oovbaapi/ooo/vba/word/XReplacement.idl
 
1521
@@ -45,6 +45,8 @@ interface XReplacement
 
1522
     interface ooo::vba::XHelperInterface;
 
1523
 
 
1524
     [attribute] string Text;
 
1525
+
 
1526
+    void ClearFormatting();
 
1527
 };
 
1528
 
 
1529
 }; }; };
 
1530
diff --git oovbaapi/ooo/vba/word/XRevision.idl oovbaapi/ooo/vba/word/XRevision.idl
 
1531
new file mode 100644
 
1532
index 0000000..bb3e570
 
1533
--- /dev/null
 
1534
+++ oovbaapi/ooo/vba/word/XRevision.idl
 
1535
@@ -0,0 +1,56 @@
 
1536
+/*************************************************************************
 
1537
+ *
 
1538
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
1539
+ * 
 
1540
+ * Copyright 2008 by Sun Microsystems, Inc.
 
1541
+ *
 
1542
+ * OpenOffice.org - a multi-platform office productivity suite
 
1543
+ *
 
1544
+ * $RCSfile: 
 
1545
+ * $Revision: 
 
1546
+ *
 
1547
+ * This file is part of OpenOffice.org.
 
1548
+ *
 
1549
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
1550
+ * it under the terms of the GNU Lesser General Public License version 3
 
1551
+ * only, as published by the Free Software Foundation.
 
1552
+ *
 
1553
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
1554
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
1555
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
1556
+ * GNU Lesser General Public License version 3 for more details
 
1557
+ * (a copy is included in the LICENSE file that accompanied this code).
 
1558
+ *
 
1559
+ * You should have received a copy of the GNU Lesser General Public License
 
1560
+ * version 3 along with OpenOffice.org.  If not, see
 
1561
+ * <http://www.openoffice.org/license.html>
 
1562
+ * for a copy of the LGPLv3 License.
 
1563
+ *
 
1564
+ ************************************************************************/
 
1565
+#ifndef __ooo_vba_word_XRevision_idl__
 
1566
+#define __ooo_vba_word_XRevision_idl__
 
1567
+
 
1568
+#ifndef __com_sun_star_uno_XInterface_idl__
 
1569
+#include <com/sun/star/uno/XInterface.idl>
 
1570
+#endif
 
1571
+
 
1572
+#ifndef __ooo_vba_XHelperInterface_idl__
 
1573
+#include <ooo/vba/XHelperInterface.idl>
 
1574
+#endif
 
1575
+
 
1576
+module ooo {  module vba {  module word { 
 
1577
+
 
1578
+interface XRange;
 
1579
+interface XRevision
 
1580
+{
 
1581
+    interface ooo::vba::XHelperInterface;
 
1582
+
 
1583
+    void Accept();
 
1584
+    void Reject();
 
1585
+};
 
1586
+
 
1587
+}; }; };
 
1588
+
 
1589
+#endif
 
1590
+
 
1591
+
 
1592
diff --git oovbaapi/ooo/vba/word/XRevisions.idl oovbaapi/ooo/vba/word/XRevisions.idl
 
1593
new file mode 100644
 
1594
index 0000000..358face
 
1595
--- /dev/null
 
1596
+++ oovbaapi/ooo/vba/word/XRevisions.idl
 
1597
@@ -0,0 +1,58 @@
 
1598
+/*************************************************************************
 
1599
+ *
 
1600
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
1601
+ * 
 
1602
+ * Copyright 2008 by Sun Microsystems, Inc.
 
1603
+ *
 
1604
+ * OpenOffice.org - a multi-platform office productivity suite
 
1605
+ *
 
1606
+ * $RCSfile: 
 
1607
+ * $Revision: 
 
1608
+ *
 
1609
+ * This file is part of OpenOffice.org.
 
1610
+ *
 
1611
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
1612
+ * it under the terms of the GNU Lesser General Public License version 3
 
1613
+ * only, as published by the Free Software Foundation.
 
1614
+ *
 
1615
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
1616
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
1617
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
1618
+ * GNU Lesser General Public License version 3 for more details
 
1619
+ * (a copy is included in the LICENSE file that accompanied this code).
 
1620
+ *
 
1621
+ * You should have received a copy of the GNU Lesser General Public License
 
1622
+ * version 3 along with OpenOffice.org.  If not, see
 
1623
+ * <http://www.openoffice.org/license.html>
 
1624
+ * for a copy of the LGPLv3 License.
 
1625
+ *
 
1626
+ ************************************************************************/
 
1627
+#ifndef __ooo_vba_word_XRevisions_idl__
 
1628
+#define __ooo_vba_word_XRevisions_idl__
 
1629
+
 
1630
+#ifndef __com_sun_star_uno_XInterface_idl__
 
1631
+#include <com/sun/star/uno/XInterface.idl>
 
1632
+#endif
 
1633
+
 
1634
+#ifndef __ooo_vba_XCollection_idl__
 
1635
+#include <ooo/vba/XCollection.idl>
 
1636
+#endif
 
1637
+
 
1638
+
 
1639
+//=============================================================================
 
1640
+
 
1641
+module ooo {  module vba {  module word { 
 
1642
+
 
1643
+//=============================================================================
 
1644
+
 
1645
+interface XRevisions 
 
1646
+{
 
1647
+    interface ::ooo::vba::XCollection;
 
1648
+
 
1649
+    void AcceptAll();
 
1650
+    void RejectAll();
 
1651
+};
 
1652
+
 
1653
+}; }; };
 
1654
+
 
1655
+#endif
 
1656
diff --git oovbaapi/ooo/vba/word/XRow.idl oovbaapi/ooo/vba/word/XRow.idl
 
1657
new file mode 100644
 
1658
index 0000000..2c54828
 
1659
--- /dev/null
 
1660
+++ oovbaapi/ooo/vba/word/XRow.idl
 
1661
@@ -0,0 +1,58 @@
 
1662
+/*************************************************************************
 
1663
+ *
 
1664
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
1665
+ * 
 
1666
+ * Copyright 2008 by Sun Microsystems, Inc.
 
1667
+ *
 
1668
+ * OpenOffice.org - a multi-platform office productivity suite
 
1669
+ *
 
1670
+ * $RCSfile: 
 
1671
+ * $Revision: 
 
1672
+ *
 
1673
+ * This file is part of OpenOffice.org.
 
1674
+ *
 
1675
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
1676
+ * it under the terms of the GNU Lesser General Public License version 3
 
1677
+ * only, as published by the Free Software Foundation.
 
1678
+ *
 
1679
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
1680
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
1681
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
1682
+ * GNU Lesser General Public License version 3 for more details
 
1683
+ * (a copy is included in the LICENSE file that accompanied this code).
 
1684
+ *
 
1685
+ * You should have received a copy of the GNU Lesser General Public License
 
1686
+ * version 3 along with OpenOffice.org.  If not, see
 
1687
+ * <http://www.openoffice.org/license.html>
 
1688
+ * for a copy of the LGPLv3 License.
 
1689
+ *
 
1690
+ ************************************************************************/
 
1691
+#ifndef __ooo_vba_word_XRow_idl__
 
1692
+#define __ooo_vba_word_XRow_idl__
 
1693
+
 
1694
+#ifndef __com_sun_star_uno_XInterface_idl__
 
1695
+#include <com/sun/star/uno/XInterface.idl>
 
1696
+#endif
 
1697
+
 
1698
+#ifndef __ooo_vba_XHelperInterface_idl__
 
1699
+#include <ooo/vba/XHelperInterface.idl>
 
1700
+#endif
 
1701
+
 
1702
+module ooo {  module vba {  module word { 
 
1703
+
 
1704
+interface XRow
 
1705
+{
 
1706
+    interface ooo::vba::XHelperInterface;
 
1707
+
 
1708
+    [attribute] any Height;
 
1709
+    [attribute] long HeightRule;
 
1710
+
 
1711
+    void Select();
 
1712
+    void SetHeight( [in] float RowHeight, [in] long HeightRule );
 
1713
+};
 
1714
+
 
1715
+}; }; };
 
1716
+
 
1717
+#endif
 
1718
+
 
1719
+
 
1720
diff --git oovbaapi/ooo/vba/word/XRows.idl oovbaapi/ooo/vba/word/XRows.idl
 
1721
new file mode 100644
 
1722
index 0000000..8d0ae61
 
1723
--- /dev/null
 
1724
+++ oovbaapi/ooo/vba/word/XRows.idl
 
1725
@@ -0,0 +1,63 @@
 
1726
+/*************************************************************************
 
1727
+ *
 
1728
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
1729
+ * 
 
1730
+ * Copyright 2008 by Sun Microsystems, Inc.
 
1731
+ *
 
1732
+ * OpenOffice.org - a multi-platform office productivity suite
 
1733
+ *
 
1734
+ * $RCSfile: 
 
1735
+ * $Revision: 
 
1736
+ *
 
1737
+ * This file is part of OpenOffice.org.
 
1738
+ *
 
1739
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
1740
+ * it under the terms of the GNU Lesser General Public License version 3
 
1741
+ * only, as published by the Free Software Foundation.
 
1742
+ *
 
1743
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
1744
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
1745
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
1746
+ * GNU Lesser General Public License version 3 for more details
 
1747
+ * (a copy is included in the LICENSE file that accompanied this code).
 
1748
+ *
 
1749
+ * You should have received a copy of the GNU Lesser General Public License
 
1750
+ * version 3 along with OpenOffice.org.  If not, see
 
1751
+ * <http://www.openoffice.org/license.html>
 
1752
+ * for a copy of the LGPLv3 License.
 
1753
+ *
 
1754
+ ************************************************************************/
 
1755
+#ifndef __ooo_vba_word_XRows_idl__
 
1756
+#define __ooo_vba_word_XRows_idl__
 
1757
+
 
1758
+#ifndef __com_sun_star_uno_XInterface_idl__
 
1759
+#include <com/sun/star/uno/XInterface.idl>
 
1760
+#endif
 
1761
+
 
1762
+#ifndef __ooo_vba_XCollection_idl__
 
1763
+#include <ooo/vba/XCollection.idl>
 
1764
+#endif
 
1765
+
 
1766
+
 
1767
+//=============================================================================
 
1768
+
 
1769
+module ooo {  module vba {  module word { 
 
1770
+
 
1771
+//=============================================================================
 
1772
+
 
1773
+interface XRows 
 
1774
+{
 
1775
+    interface ::ooo::vba::XCollection;
 
1776
+
 
1777
+    [attribute] long Alignment;
 
1778
+    [attribute] any AllowBreakAcrossPages;
 
1779
+    [attribute] float SpaceBetweenColumns;
 
1780
+
 
1781
+    void Delete();
 
1782
+    void SetLeftIndent( [in] float LeftIndent, [in] long RulerStyle );
 
1783
+    void Select();
 
1784
+};
 
1785
+
 
1786
+}; }; };
 
1787
+
 
1788
+#endif
 
1789
diff --git oovbaapi/ooo/vba/word/XSection.idl oovbaapi/ooo/vba/word/XSection.idl
 
1790
index c79a24b..6a8671c 100644
 
1791
--- oovbaapi/ooo/vba/word/XSection.idl
 
1792
+++ oovbaapi/ooo/vba/word/XSection.idl
 
1793
@@ -46,8 +46,8 @@ interface XSection
 
1794
 
 
1795
     [attribute] boolean ProtectedForForms;
 
1796
 
 
1797
-    any Headers();
 
1798
-    any Footers();
 
1799
+    any Headers( [in] any aIndex );
 
1800
+    any Footers( [in] any aIndex );
 
1801
     any PageSetup();
 
1802
 };
 
1803
 
 
1804
diff --git oovbaapi/ooo/vba/word/XSelection.idl oovbaapi/ooo/vba/word/XSelection.idl
 
1805
index 44026da..696e7df 100644
 
1806
--- oovbaapi/ooo/vba/word/XSelection.idl
 
1807
+++ oovbaapi/ooo/vba/word/XSelection.idl
 
1808
@@ -55,7 +55,7 @@ interface XSelection
 
1809
     [attribute, readonly] XRange Range;
 
1810
     [attribute] XParagraphFormat ParagraphFormat;
 
1811
     [attribute, readonly] XFind Find;
 
1812
-    [attribute] XStyle Style;
 
1813
+    [attribute] any Style;
 
1814
     [attribute, readonly] XFont Font;
 
1815
     [attribute, readonly] XHeaderFooter HeaderFooter;
 
1816
     [attribute] long LanguageID;
 
1817
@@ -71,6 +71,7 @@ interface XSelection
 
1818
     void MoveRight( [in] any Unit, [in] any Count, [in] any Extend );
 
1819
     void MoveLeft( [in] any Unit, [in] any Count, [in] any Extend );
 
1820
     void MoveDown( [in] any Unit, [in] any Count, [in] any Extend );
 
1821
+    void MoveUp( [in] any Unit, [in] any Count, [in] any Extend );
 
1822
     void TypeParagraph();
 
1823
     void InsertParagraph();
 
1824
     void InsertParagraphBefore();
 
1825
@@ -80,6 +81,19 @@ interface XSelection
 
1826
     any Information( [in] long Type );
 
1827
     void InsertBreak( [in] any Type );
 
1828
     any ShapeRange();
 
1829
+    void SelectColumn();
 
1830
+    void SelectRow();
 
1831
+    any Rows( [in] any aIndex );
 
1832
+    any Columns( [in] any aIndex );
 
1833
+    any Cells( [in] any aIndex );
 
1834
+    void Copy();
 
1835
+    void CopyAsPicture();
 
1836
+    void Paste();
 
1837
+    void Collapse([in] any Direction);
 
1838
+    void WholeStory();
 
1839
+    boolean InRange( [in] XRange Range );
 
1840
+    void SplitTable();
 
1841
+    any Paragraphs( [in] any aIndex );
 
1842
 };
 
1843
 
 
1844
 }; }; };
 
1845
diff --git oovbaapi/ooo/vba/word/XStyle.idl oovbaapi/ooo/vba/word/XStyle.idl
 
1846
index af19517..9eb9381 100644
 
1847
--- oovbaapi/ooo/vba/word/XStyle.idl
 
1848
+++ oovbaapi/ooo/vba/word/XStyle.idl
 
1849
@@ -38,17 +38,32 @@
 
1850
 #include <ooo/vba/XHelperInterface.idl>
 
1851
 #endif
 
1852
 
 
1853
+#ifndef __com_sun_star_script_XDefaultProperty_idl__
 
1854
+#include <com/sun/star/script/XDefaultProperty.idl>
 
1855
+#endif
 
1856
+
 
1857
 module ooo {  module vba {  module word { 
 
1858
 
 
1859
 interface XFont;
 
1860
+interface XListTemplate;
 
1861
+interface XParagraphFormat;
 
1862
 interface XStyle
 
1863
 {
 
1864
     interface ooo::vba::XHelperInterface;
 
1865
+    interface com::sun::star::script::XDefaultProperty;
 
1866
 
 
1867
     [attribute] string Name;
 
1868
     [attribute] long LanguageID;
 
1869
     [attribute, readonly] long Type;
 
1870
     [attribute, readonly] XFont Font;
 
1871
+    [attribute] string NameLocal;
 
1872
+    [attribute, readonly] XParagraphFormat ParagraphFormat;
 
1873
+    [attribute] boolean AutomaticallyUpdate;
 
1874
+    [attribute] any BaseStyle;
 
1875
+    [attribute] any NextParagraphStyle;
 
1876
+    [attribute, readonly] long ListLevelNumber;
 
1877
+
 
1878
+    void LinkToListTemplate( [in] XListTemplate ListTemplate, [in] any ListLevelNumber );
 
1879
 };
 
1880
 
 
1881
 }; }; };
 
1882
diff --git oovbaapi/ooo/vba/word/XTabStop.idl oovbaapi/ooo/vba/word/XTabStop.idl
 
1883
new file mode 100644
 
1884
index 0000000..b9cf94d
 
1885
--- /dev/null
 
1886
+++ oovbaapi/ooo/vba/word/XTabStop.idl
 
1887
@@ -0,0 +1,52 @@
 
1888
+/*************************************************************************
 
1889
+ *
 
1890
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
1891
+ * 
 
1892
+ * Copyright 2008 by Sun Microsystems, Inc.
 
1893
+ *
 
1894
+ * OpenOffice.org - a multi-platform office productivity suite
 
1895
+ *
 
1896
+ * $RCSfile: 
 
1897
+ * $Revision: 
 
1898
+ *
 
1899
+ * This file is part of OpenOffice.org.
 
1900
+ *
 
1901
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
1902
+ * it under the terms of the GNU Lesser General Public License version 3
 
1903
+ * only, as published by the Free Software Foundation.
 
1904
+ *
 
1905
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
1906
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
1907
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
1908
+ * GNU Lesser General Public License version 3 for more details
 
1909
+ * (a copy is included in the LICENSE file that accompanied this code).
 
1910
+ *
 
1911
+ * You should have received a copy of the GNU Lesser General Public License
 
1912
+ * version 3 along with OpenOffice.org.  If not, see
 
1913
+ * <http://www.openoffice.org/license.html>
 
1914
+ * for a copy of the LGPLv3 License.
 
1915
+ *
 
1916
+ ************************************************************************/
 
1917
+#ifndef __ooo_vba_word_XTabStop_idl__
 
1918
+#define __ooo_vba_word_XTabStop_idl__
 
1919
+
 
1920
+#ifndef __com_sun_star_uno_XInterface_idl__
 
1921
+#include <com/sun/star/uno/XInterface.idl>
 
1922
+#endif
 
1923
+
 
1924
+#ifndef __ooo_vba_XHelperInterface_idl__
 
1925
+#include <ooo/vba/XHelperInterface.idl>
 
1926
+#endif
 
1927
+
 
1928
+module ooo {  module vba {  module word { 
 
1929
+
 
1930
+interface XTabStop
 
1931
+{
 
1932
+    interface ooo::vba::XHelperInterface;
 
1933
+};
 
1934
+
 
1935
+}; }; };
 
1936
+
 
1937
+#endif
 
1938
+
 
1939
+
 
1940
diff --git oovbaapi/ooo/vba/word/XTabStops.idl oovbaapi/ooo/vba/word/XTabStops.idl
 
1941
new file mode 100644
 
1942
index 0000000..318d492
 
1943
--- /dev/null
 
1944
+++ oovbaapi/ooo/vba/word/XTabStops.idl
 
1945
@@ -0,0 +1,59 @@
 
1946
+/*************************************************************************
 
1947
+ *
 
1948
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
1949
+ * 
 
1950
+ * Copyright 2008 by Sun Microsystems, Inc.
 
1951
+ *
 
1952
+ * OpenOffice.org - a multi-platform office productivity suite
 
1953
+ *
 
1954
+ * $RCSfile: 
 
1955
+ * $Revision: 
 
1956
+ *
 
1957
+ * This file is part of OpenOffice.org.
 
1958
+ *
 
1959
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
1960
+ * it under the terms of the GNU Lesser General Public License version 3
 
1961
+ * only, as published by the Free Software Foundation.
 
1962
+ *
 
1963
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
1964
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
1965
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
1966
+ * GNU Lesser General Public License version 3 for more details
 
1967
+ * (a copy is included in the LICENSE file that accompanied this code).
 
1968
+ *
 
1969
+ * You should have received a copy of the GNU Lesser General Public License
 
1970
+ * version 3 along with OpenOffice.org.  If not, see
 
1971
+ * <http://www.openoffice.org/license.html>
 
1972
+ * for a copy of the LGPLv3 License.
 
1973
+ *
 
1974
+ ************************************************************************/
 
1975
+#ifndef __ooo_vba_word_XTabStops_idl__
 
1976
+#define __ooo_vba_word_XTabStops_idl__
 
1977
+
 
1978
+#ifndef __com_sun_star_uno_XInterface_idl__
 
1979
+#include <com/sun/star/uno/XInterface.idl>
 
1980
+#endif
 
1981
+
 
1982
+#ifndef __ooo_vba_XCollection_idl__
 
1983
+#include <ooo/vba/XCollection.idl>
 
1984
+#endif
 
1985
+
 
1986
+
 
1987
+//=============================================================================
 
1988
+
 
1989
+module ooo {  module vba {  module word { 
 
1990
+
 
1991
+//=============================================================================
 
1992
+
 
1993
+interface XTabStop;
 
1994
+interface XTabStops 
 
1995
+{
 
1996
+    interface ::ooo::vba::XCollection;
 
1997
+
 
1998
+    XTabStop Add([in] float Position, [in] any Alignment, [in] any Leader );
 
1999
+    void ClearAll();
 
2000
+};
 
2001
+
 
2002
+}; }; };
 
2003
+
 
2004
+#endif
 
2005
diff --git oovbaapi/ooo/vba/word/XTable.idl oovbaapi/ooo/vba/word/XTable.idl
 
2006
index f677da6..ef6d441 100644
 
2007
--- oovbaapi/ooo/vba/word/XTable.idl
 
2008
+++ oovbaapi/ooo/vba/word/XTable.idl
 
2009
@@ -77,7 +77,9 @@ interface XTable
 
2010
         raises(com::sun::star::script::BasicErrorException);
 
2011
 */
 
2012
     any Borders( [in] any aIndex );
 
2013
-
 
2014
+    
 
2015
+    any Rows([in] any aIndex );
 
2016
+    any Columns([in] any aIndex );
 
2017
 };
 
2018
 
 
2019
 }; }; };
 
2020
diff --git oovbaapi/ooo/vba/word/XTableOfContents.idl oovbaapi/ooo/vba/word/XTableOfContents.idl
 
2021
new file mode 100644
 
2022
index 0000000..dcb7e8a
 
2023
--- /dev/null
 
2024
+++ oovbaapi/ooo/vba/word/XTableOfContents.idl
 
2025
@@ -0,0 +1,60 @@
 
2026
+/*************************************************************************
 
2027
+ *
 
2028
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
2029
+ * 
 
2030
+ * Copyright 2008 by Sun Microsystems, Inc.
 
2031
+ *
 
2032
+ * OpenOffice.org - a multi-platform office productivity suite
 
2033
+ *
 
2034
+ * $RCSfile: 
 
2035
+ * $Revision: 
 
2036
+ *
 
2037
+ * This file is part of OpenOffice.org.
 
2038
+ *
 
2039
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
2040
+ * it under the terms of the GNU Lesser General Public License version 3
 
2041
+ * only, as published by the Free Software Foundation.
 
2042
+ *
 
2043
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
2044
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
2045
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
2046
+ * GNU Lesser General Public License version 3 for more details
 
2047
+ * (a copy is included in the LICENSE file that accompanied this code).
 
2048
+ *
 
2049
+ * You should have received a copy of the GNU Lesser General Public License
 
2050
+ * version 3 along with OpenOffice.org.  If not, see
 
2051
+ * <http://www.openoffice.org/license.html>
 
2052
+ * for a copy of the LGPLv3 License.
 
2053
+ *
 
2054
+ ************************************************************************/
 
2055
+#ifndef __ooo_vba_word_XTableOfContents_idl__
 
2056
+#define __ooo_vba_word_XTableOfContents_idl__
 
2057
+
 
2058
+#ifndef __com_sun_star_uno_XInterface_idl__
 
2059
+#include <com/sun/star/uno/XInterface.idl>
 
2060
+#endif
 
2061
+
 
2062
+#ifndef __ooo_vba_XHelperInterface_idl__
 
2063
+#include <ooo/vba/XHelperInterface.idl>
 
2064
+#endif
 
2065
+
 
2066
+module ooo {  module vba {  module word { 
 
2067
+
 
2068
+interface XTableOfContents
 
2069
+{
 
2070
+    interface ooo::vba::XHelperInterface;
 
2071
+
 
2072
+    [attribute] long LowerHeadingLevel;
 
2073
+    [attribute] long TabLeader;
 
2074
+    [attribute] boolean UseFields;
 
2075
+    [attribute] boolean UseOutlineLevels;
 
2076
+
 
2077
+    void Delete();
 
2078
+    void Update();
 
2079
+};
 
2080
+
 
2081
+}; }; };
 
2082
+
 
2083
+#endif
 
2084
+
 
2085
+
 
2086
diff --git oovbaapi/ooo/vba/word/XTablesOfContents.idl oovbaapi/ooo/vba/word/XTablesOfContents.idl
 
2087
new file mode 100644
 
2088
index 0000000..53c557b
 
2089
--- /dev/null
 
2090
+++ oovbaapi/ooo/vba/word/XTablesOfContents.idl
 
2091
@@ -0,0 +1,59 @@
 
2092
+/*************************************************************************
 
2093
+ *
 
2094
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
2095
+ * 
 
2096
+ * Copyright 2008 by Sun Microsystems, Inc.
 
2097
+ *
 
2098
+ * OpenOffice.org - a multi-platform office productivity suite
 
2099
+ *
 
2100
+ * $RCSfile: 
 
2101
+ * $Revision: 
 
2102
+ *
 
2103
+ * This file is part of OpenOffice.org.
 
2104
+ *
 
2105
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
2106
+ * it under the terms of the GNU Lesser General Public License version 3
 
2107
+ * only, as published by the Free Software Foundation.
 
2108
+ *
 
2109
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
2110
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
2111
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
2112
+ * GNU Lesser General Public License version 3 for more details
 
2113
+ * (a copy is included in the LICENSE file that accompanied this code).
 
2114
+ *
 
2115
+ * You should have received a copy of the GNU Lesser General Public License
 
2116
+ * version 3 along with OpenOffice.org.  If not, see
 
2117
+ * <http://www.openoffice.org/license.html>
 
2118
+ * for a copy of the LGPLv3 License.
 
2119
+ *
 
2120
+ ************************************************************************/
 
2121
+#ifndef __ooo_vba_word_XTablesOfContents_idl__
 
2122
+#define __ooo_vba_word_XTablesOfContents_idl__
 
2123
+
 
2124
+#ifndef __com_sun_star_uno_XInterface_idl__
 
2125
+#include <com/sun/star/uno/XInterface.idl>
 
2126
+#endif
 
2127
+
 
2128
+#ifndef __ooo_vba_XCollection_idl__
 
2129
+#include <ooo/vba/XCollection.idl>
 
2130
+#endif
 
2131
+
 
2132
+
 
2133
+//=============================================================================
 
2134
+
 
2135
+module ooo {  module vba {  module word { 
 
2136
+
 
2137
+//=============================================================================
 
2138
+
 
2139
+interface XTableOfContents;
 
2140
+interface XRange;
 
2141
+interface XTablesOfContents 
 
2142
+{
 
2143
+    interface ::ooo::vba::XCollection;
 
2144
+
 
2145
+    XTableOfContents Add([in] XRange Range, [in] any UseHeadingStyles, [in] any UpperHeadingLevel, [in] any LowerHeadingLevel, [in] any UseFields, [in] any TableID, [in] any RightAlignPageNumbers, [in] any IncludePageNumbers, [in] any AddedStyles, [in] any UseHyperlinks, [in] any HidePageNumbersInWeb, [in] any UseOutlineLevels );
 
2146
+};
 
2147
+
 
2148
+}; }; };
 
2149
+
 
2150
+#endif
 
2151
diff --git oovbaapi/ooo/vba/word/XTemplate.idl oovbaapi/ooo/vba/word/XTemplate.idl
 
2152
index a2bd1d7..0b9cf6e 100644
 
2153
--- oovbaapi/ooo/vba/word/XTemplate.idl
 
2154
+++ oovbaapi/ooo/vba/word/XTemplate.idl
 
2155
@@ -45,6 +45,7 @@ interface XTemplate
 
2156
     interface ooo::vba::XHelperInterface;
 
2157
 
 
2158
     [attribute, readonly] string Name;
 
2159
+    [attribute, readonly] string Path;
 
2160
 
 
2161
     any AutoTextEntries( [in] any aIndex );
 
2162
 };
 
2163
diff --git oovbaapi/ooo/vba/word/XWindow.idl oovbaapi/ooo/vba/word/XWindow.idl
 
2164
index 9235335..220d9ee 100644
 
2165
--- oovbaapi/ooo/vba/word/XWindow.idl
 
2166
+++ oovbaapi/ooo/vba/word/XWindow.idl
 
2167
@@ -47,6 +47,7 @@ module ooo {  module vba {  module word {
 
2168
 interface XWindow : com::sun::star::uno::XInterface
 
2169
 {
 
2170
     [attribute] any View;
 
2171
+    [attribute] any WindowState;
 
2172
        void Activate();
 
2173
     void Close([in] any SaveChanges, [in] any RouteDocument);
 
2174
        any Panes( [in] any aIndex ); // this is a fake api for it seems not support in Write
 
2175
diff --git oovbaapi/ooo/vba/word/makefile.mk oovbaapi/ooo/vba/word/makefile.mk
 
2176
index 8126587..83b1f4f 100644
 
2177
--- oovbaapi/ooo/vba/word/makefile.mk
 
2178
+++ oovbaapi/ooo/vba/word/makefile.mk
 
2179
@@ -83,6 +83,31 @@ IDLFILES= XGlobals.idl\
 
2180
        XPageSetup.idl \
 
2181
        XSection.idl \
 
2182
        XSections.idl \
 
2183
+    XRow.idl \
 
2184
+    XRows.idl \
 
2185
+    XColumn.idl \
 
2186
+    XColumns.idl \
 
2187
+    XCell.idl \
 
2188
+    XCells.idl \
 
2189
+    XTabStop.idl \
 
2190
+    XTabStops.idl \
 
2191
+    XTableOfContents.idl \
 
2192
+    XTablesOfContents.idl \
 
2193
+    XListFormat.idl \
 
2194
+    XListGalleries.idl \
 
2195
+    XListGallery.idl \
 
2196
+    XListTemplate.idl \
 
2197
+    XListTemplates.idl \
 
2198
+    XListLevel.idl \
 
2199
+    XListLevels.idl \
 
2200
+    XFormField.idl \
 
2201
+    XFormFields.idl \
 
2202
+    XRevision.idl \
 
2203
+    XRevisions.idl \
 
2204
+    XFrame.idl \
 
2205
+    XFrames.idl \
 
2206
+    XCheckBox.idl \
 
2207
+    XHeadersFooters.idl \
 
2208
 
 
2209
 # ------------------------------------------------------------------
 
2210
 
 
2211
diff --git sc/source/core/data/documen2.cxx sc/source/core/data/documen2.cxx
 
2212
index 481178c..2a34517 100644
 
2213
--- sc/source/core/data/documen2.cxx
 
2214
+++ sc/source/core/data/documen2.cxx
 
2215
@@ -1276,7 +1276,7 @@ ScDocument::GetVbaEventsHelper()
 
2216
             uno::Reference< frame::XModel > xModel( pShell ? pShell->GetModel() : NULL, uno::UNO_QUERY );
 
2217
             uno::Sequence< uno::Any > aArgs(1);
 
2218
             aArgs[0] = uno::Any( xModel );
 
2219
-            uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.VbaEventsHelper" ) ), aArgs ), uno::UNO_QUERY );
 
2220
+            uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocumentVbaEventsHelper" ) ), aArgs ), uno::UNO_QUERY );
 
2221
             // helper will always be created successfully.
 
2222
             mxVbaEventsHelper.set( xVbaEventsHelper, uno::UNO_QUERY );
 
2223
         }
 
2224
diff --git sc/source/ui/vba/vbaeventshelper.cxx sc/source/ui/vba/vbaeventshelper.cxx
 
2225
index 78b3ede..e3a6e85 100644
 
2226
--- sc/source/ui/vba/vbaeventshelper.cxx
 
2227
+++ sc/source/ui/vba/vbaeventshelper.cxx
 
2228
@@ -375,50 +375,20 @@ VbaEventsListener::borderWidthsChanged( const uno::Reference< uno::XInterface >&
 
2229
     }
 
2230
 }
 
2231
 
 
2232
-class ImplVbaEventNameInfo
 
2233
+ScVbaEventsHelper::ScVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArgs, uno::Reference< uno::XComponentContext > const& xContext ) : VbaEventsHelperBase( xContext ), mbOpened( sal_False )
 
2234
 {
 
2235
-private:
 
2236
-    map< sal_Int32, rtl::OUString > m_aEventNameMap;
 
2237
-
 
2238
-protected:
 
2239
-    static ImplVbaEventNameInfo* pImplVbaEventNameInfo;
 
2240
-    ImplVbaEventNameInfo() { InitImplVbaEventNameInfo(); }
 
2241
-private:
 
2242
-    void insert( const sal_Int32 nId, const rtl::OUString& sEventName )
 
2243
-    {
 
2244
-        m_aEventNameMap.insert( make_pair( nId, sEventName ) );
 
2245
-    }
 
2246
-    void InitImplVbaEventNameInfo();
 
2247
-public:
 
2248
-    virtual ~ImplVbaEventNameInfo();
 
2249
-    rtl::OUString getEventName( const sal_Int32 nId )
 
2250
-    {
 
2251
-        map< sal_Int32, rtl::OUString >::iterator iter = m_aEventNameMap.find( nId );
 
2252
-        if( iter != m_aEventNameMap.end() )
 
2253
-            return iter->second;
 
2254
-        return rtl::OUString();
 
2255
-    }
 
2256
-    static ImplVbaEventNameInfo* GetImplVbaEventNameInfo();
 
2257
-};
 
2258
-ImplVbaEventNameInfo* ImplVbaEventNameInfo::pImplVbaEventNameInfo = NULL;
 
2259
-
 
2260
-ImplVbaEventNameInfo::~ImplVbaEventNameInfo()
 
2261
-{
 
2262
-    if( pImplVbaEventNameInfo )
 
2263
-    {
 
2264
-        delete pImplVbaEventNameInfo;
 
2265
-        pImplVbaEventNameInfo = NULL;
 
2266
-    }
 
2267
+    Initilize();
 
2268
+    uno::Reference< frame::XModel > xModel ( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ), uno::UNO_QUERY );
 
2269
+    pDocShell = excel::getDocShell( xModel );
 
2270
+    pDoc = pDocShell->GetDocument();
 
2271
+    // Add worksheet change listener
 
2272
+    uno::Reference< util::XChangesNotifier > xChangesNotifier( xModel, uno::UNO_QUERY );
 
2273
+    if( xChangesNotifier.is() )
 
2274
+        xChangesNotifier->addChangesListener( uno::Reference< util::XChangesListener >( new WorksheetChangeListener( this ) ) );
 
2275
 }
 
2276
 
 
2277
-ImplVbaEventNameInfo* 
 
2278
-ImplVbaEventNameInfo::GetImplVbaEventNameInfo()
 
2279
+ScVbaEventsHelper::~ScVbaEventsHelper()
 
2280
 {
 
2281
-    if( !pImplVbaEventNameInfo )
 
2282
-    {
 
2283
-        pImplVbaEventNameInfo = new ImplVbaEventNameInfo;
 
2284
-    }
 
2285
-    return pImplVbaEventNameInfo;
 
2286
 }
 
2287
 
 
2288
 #define CREATEOUSTRING(asciistr) rtl::OUString::createFromAscii(asciistr)
 
2289
@@ -433,7 +403,7 @@ ImplVbaEventNameInfo::GetImplVbaEventNameInfo()
 
2290
 #define INSERT_WORKBOOK_EVENT_INFO( Event, EventName ) \
 
2291
         INSERT_EVENT_INFO(  WORKBOOK, Event, CREATEOUSTRING("Workbook_"), EventName )
 
2292
 
 
2293
-void ImplVbaEventNameInfo::InitImplVbaEventNameInfo()
 
2294
+void ScVbaEventsHelper::Initilize()
 
2295
 {
 
2296
     INSERT_WORKSHEET_EVENT_INFO( ACTIVATE, "Activate");
 
2297
     INSERT_WORKSHEET_EVENT_INFO( BEFOREDOUBLECLICK, "BeforeDoubleClick" );
 
2298
@@ -460,32 +430,6 @@ void ImplVbaEventNameInfo::InitImplVbaEventNameInfo()
 
2299
     INSERT_WORKBOOK_EVENT_INFO( WINDOWRESIZE, "WindowResize" );
 
2300
 }
 
2301
 
 
2302
-ScVbaEventsHelper::ScVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArgs, uno::Reference< uno::XComponentContext > const& xContext )
 
2303
-    : m_xContext( xContext ), mbOpened( sal_False ), mbIgnoreEvents( sal_False )
 
2304
-{
 
2305
-    uno::Reference< frame::XModel > xModel ( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ), uno::UNO_QUERY );
 
2306
-    pDocShell = excel::getDocShell( xModel );
 
2307
-    pDoc = pDocShell->GetDocument();
 
2308
-    // Add worksheet change listener
 
2309
-    uno::Reference< util::XChangesNotifier > xChangesNotifier( xModel, uno::UNO_QUERY );
 
2310
-    if( xChangesNotifier.is() )
 
2311
-        xChangesNotifier->addChangesListener( uno::Reference< util::XChangesListener >( new WorksheetChangeListener( this ) ) );
 
2312
-}
 
2313
-
 
2314
-ScVbaEventsHelper::~ScVbaEventsHelper()
 
2315
-{
 
2316
-}
 
2317
-
 
2318
-rtl::OUString
 
2319
-ScVbaEventsHelper::getEventName( const sal_Int32 nId )
 
2320
-{
 
2321
-    rtl::OUString sEventName;
 
2322
-    ImplVbaEventNameInfo* pEventInfo = ImplVbaEventNameInfo::GetImplVbaEventNameInfo();
 
2323
-    if( pEventInfo )
 
2324
-        sEventName = pEventInfo->getEventName( nId );
 
2325
-    return sEventName;
 
2326
-}
 
2327
-
 
2328
 uno::Any ScVbaEventsHelper::createWorkSheet( SfxObjectShell* pShell, SCTAB nTab )
 
2329
 {
 
2330
        uno::Any aRet;
 
2331
@@ -1049,16 +993,15 @@ ScVbaEventsHelper::ProcessCompatibleVbaEvent( sal_Int32 nEventId, const uno::Seq
 
2332
 ::sal_Bool SAL_CALL 
 
2333
 ScVbaEventsHelper::getIgnoreEvents() throw (uno::RuntimeException)
 
2334
 {
 
2335
-    return mbIgnoreEvents;
 
2336
+    return VbaEventsHelperBase::getIgnoreEvents();
 
2337
 }
 
2338
 
 
2339
 void SAL_CALL 
 
2340
 ScVbaEventsHelper::setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (uno::RuntimeException)
 
2341
 {
 
2342
-    mbIgnoreEvents = _ignoreevents;
 
2343
+    VbaEventsHelperBase::setIgnoreEvents( _ignoreevents );
 
2344
 }
 
2345
 
 
2346
-
 
2347
 namespace vbaeventshelper
 
2348
 {
 
2349
 namespace sdecl = comphelper::service_decl;
 
2350
@@ -1066,5 +1009,5 @@ sdecl::class_<ScVbaEventsHelper, sdecl::with_args<true> > serviceImpl;
 
2351
 extern sdecl::ServiceDecl const serviceDecl(
 
2352
     serviceImpl,
 
2353
     "ScVbaEventsHelper",
 
2354
-    "com.sun.star.document.VbaEventsHelper" );
 
2355
+    "com.sun.star.sheet.SpreadsheetDocumentVbaEventsHelper" );
 
2356
 }
 
2357
diff --git sc/source/ui/vba/vbaeventshelper.hxx sc/source/ui/vba/vbaeventshelper.hxx
 
2358
index 78037af..20a2cef 100644
 
2359
--- sc/source/ui/vba/vbaeventshelper.hxx
 
2360
+++ sc/source/ui/vba/vbaeventshelper.hxx
 
2361
@@ -42,6 +42,7 @@
 
2362
 #include <com/sun/star/document/XVbaEventsHelper.hpp>
 
2363
 #include <com/sun/star/awt/XWindowListener.hpp>
 
2364
 #include "excelvbahelper.hxx"
 
2365
+#include <vbahelper/vbaeventshelperbase.hxx>
 
2366
 
 
2367
 #define INVALID_TAB -1
 
2368
 
 
2369
@@ -49,15 +50,13 @@ typedef ::cppu::WeakImplHelper1< com::sun::star::document::XVbaEventsHelper > VB
 
2370
 
 
2371
 class VbaEventsListener;
 
2372
 class ScDocShell;
 
2373
-class ScVbaEventsHelper : public VBAWorkbookEvent_BASE
 
2374
+class ScVbaEventsHelper : public VBAWorkbookEvent_BASE, public VbaEventsHelperBase
 
2375
 {
 
2376
 private:
 
2377
        ScDocument* pDoc;
 
2378
        ScDocShell* pDocShell;
 
2379
-    css::uno::Reference< css::uno::XComponentContext > m_xContext;
 
2380
     css::uno::Reference< css::awt::XWindowListener > m_xVbaEventsListener;
 
2381
     sal_Bool mbOpened;
 
2382
-    sal_Bool mbIgnoreEvents;
 
2383
 
 
2384
        String getSheetModuleName( SCTAB nTab );
 
2385
        css::uno::Any createWorkSheet( SfxObjectShell* pShell, SCTAB nTab );
 
2386
@@ -65,12 +64,12 @@ private:
 
2387
        css::uno::Any createHyperlink( const css::uno::Any& rCell );
 
2388
        css::uno::Any createWindow( SfxObjectShell* pShell );
 
2389
     SCTAB getTabFromArgs( const css::uno::Sequence< css::uno::Any > aArgs, const sal_Int32 nPos = 0 );
 
2390
-    rtl::OUString getEventName( const sal_Int32 nEventId );
 
2391
     rtl::OUString getMacroPath( const sal_Int32 nEventId, const SCTAB nTab = INVALID_TAB );
 
2392
     sal_Bool processVbaEvent( const sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs, const SCTAB nTab = INVALID_TAB );
 
2393
+    void Initilize();
 
2394
 
 
2395
 public:
 
2396
-       ScVbaEventsHelper( ScDocument* pDocument ):pDoc( pDocument ), mbOpened( sal_False ){};
 
2397
+    //ScVbaEventsHelper( ScDocument* pDocument ):pDoc( pDocument ), mbOpened( sal_False ){};
 
2398
     ScVbaEventsHelper( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
 
2399
     ~ScVbaEventsHelper();
 
2400
        ScDocument* getDocument() { return pDoc; };
 
2401
diff --git sc/source/ui/vba/vbaworkbook.cxx sc/source/ui/vba/vbaworkbook.cxx
 
2402
index 5a97ed8..bcb9cd2 100644
 
2403
--- sc/source/ui/vba/vbaworkbook.cxx
 
2404
+++ sc/source/ui/vba/vbaworkbook.cxx
 
2405
@@ -264,6 +264,12 @@ ScVbaWorkbook::Activate() throw (uno::RuntimeException)
 
2406
     VbaDocumentBase::Activate();
 
2407
 }
 
2408
 
 
2409
+void
 
2410
+ScVbaWorkbook::Protect( const uno::Any &aPassword ) throw (uno::RuntimeException)
 
2411
+{
 
2412
+    VbaDocumentBase::Protect( aPassword );
 
2413
+}
 
2414
+
 
2415
 ::sal_Bool
 
2416
 ScVbaWorkbook::getProtectStructure() throw (uno::RuntimeException)
 
2417
 {
 
2418
diff --git sc/source/ui/vba/vbaworkbook.hxx sc/source/ui/vba/vbaworkbook.hxx
 
2419
index 8d3d493..7dfcedc 100644
 
2420
--- sc/source/ui/vba/vbaworkbook.hxx
 
2421
+++ sc/source/ui/vba/vbaworkbook.hxx
 
2422
@@ -64,6 +64,7 @@ public:
 
2423
     virtual css::uno::Any SAL_CALL Sheets( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
 
2424
     virtual css::uno::Any SAL_CALL Windows( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
 
2425
     virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
 
2426
+    virtual void SAL_CALL Protect( const css::uno::Any & aPassword ) throw (css::uno::RuntimeException);
 
2427
     // Amelia Wang
 
2428
     virtual css::uno::Any SAL_CALL Names( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
 
2429
 
 
2430
diff --git svx/source/msfilter/msvbahelper.cxx svx/source/msfilter/msvbahelper.cxx
 
2431
index 6fd2d34..7919fb6 100644
 
2432
--- svx/source/msfilter/msvbahelper.cxx
 
2433
+++ svx/source/msfilter/msvbahelper.cxx
 
2434
@@ -40,6 +40,7 @@
 
2435
 #include <com/sun/star/document/XDocumentInfoSupplier.hpp>
 
2436
 #include <tools/urlobj.hxx>
 
2437
 #include <osl/file.hxx>
 
2438
+#include <svtools/pathoptions.hxx>
 
2439
 
 
2440
 using namespace ::com::sun::star;
 
2441
 
 
2442
@@ -216,9 +217,19 @@ VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUStrin
 
2443
         String sDocUrlOrPath = MacroName.copy( 0, nDocSepIndex );
 
2444
         sMacroUrl = MacroName.copy( nDocSepIndex + 1 );
 
2445
         OSL_TRACE("doc search, current shell is 0x%x", pShell );
 
2446
-        SfxObjectShell* pFoundShell = findShellForUrl( sDocUrlOrPath );
 
2447
+        SfxObjectShell* pFoundShell = NULL;
 
2448
+        if( bSearchGlobalTemplates )
 
2449
+        {
 
2450
+            SvtPathOptions aPathOpt;
 
2451
+            String aAddinPath = aPathOpt.GetAddinPath();
 
2452
+            if( rtl::OUString( sDocUrlOrPath ).indexOf( aAddinPath ) == 0 )
 
2453
+                pFoundShell = pShell; 
 
2454
+        }
 
2455
+        if( pFoundShell == NULL )
 
2456
+            pFoundShell = findShellForUrl( sDocUrlOrPath );
 
2457
         OSL_TRACE("doc search, after find, found shell is 0x%x", pFoundShell );
 
2458
-        return resolveVBAMacro( pFoundShell, sMacroUrl ); 
 
2459
+        aRes = resolveVBAMacro( pFoundShell, sMacroUrl, bSearchGlobalTemplates ); 
 
2460
+        return aRes;
 
2461
     }    
 
2462
     else
 
2463
     {
 
2464
diff --git sw/inc/doc.hxx sw/inc/doc.hxx
 
2465
index 7666665..5052f96 100644
 
2466
--- sw/inc/doc.hxx
 
2467
+++ sw/inc/doc.hxx
 
2468
@@ -82,6 +82,7 @@ class SwList;
 
2469
 #include "comphelper/implementationreference.hxx"
 
2470
 #include <com/sun/star/chart2/data/XDataProvider.hpp>
 
2471
 #include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
 
2472
+#include <com/sun/star/document/XVbaEventsHelper.hpp>
 
2473
 
 
2474
 #include <hash_map>
 
2475
 #include <stringhash.hxx>
 
2476
@@ -402,6 +403,7 @@ class SW_DLLPUBLIC SwDoc :
 
2477
     // table of forbidden characters of this document
 
2478
     vos::ORef<SvxForbiddenCharactersTable>     xForbiddenCharsTable;
 
2479
    com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> m_xTemplateToProjectCache;
 
2480
+    com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > mxVbaEventsHelper;
 
2481
 
 
2482
     // --> OD 2007-10-26 #i83479#
 
2483
 public:
 
2484
@@ -2118,6 +2120,7 @@ public:
 
2485
     }
 
2486
         void SetVBATemplateToProjectCache( com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xCache ) { m_xTemplateToProjectCache = xCache; };
 
2487
         com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > GetVBATemplateToProjectCache() { return m_xTemplateToProjectCache; };
 
2488
+    com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > GetVbaEventsHelper();
 
2489
 
 
2490
     ::sfx2::IXmlIdRegistry& GetXmlIdRegistry();
 
2491
     ::sw::MetaFieldManager & GetMetaFieldManager();
 
2492
diff --git sw/inc/unotbl.hxx sw/inc/unotbl.hxx
 
2493
index 20b769f..cff829f 100644
 
2494
--- sw/inc/unotbl.hxx
 
2495
+++ sw/inc/unotbl.hxx
 
2496
@@ -323,7 +323,7 @@ public:
 
2497
     SwXTextTable(SwFrmFmt& rFrmFmt);
 
2498
 
 
2499
 
 
2500
-    static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
 
2501
+    SW_DLLPUBLIC static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
 
2502
 
 
2503
     //XUnoTunnel
 
2504
     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
 
2505
diff --git sw/source/core/doc/doc.cxx sw/source/core/doc/doc.cxx
 
2506
index 42f0148..914a843 100644
 
2507
--- sw/source/core/doc/doc.cxx
 
2508
+++ sw/source/core/doc/doc.cxx
 
2509
@@ -2015,6 +2015,28 @@ void SwDoc::ChkCondColls()
 
2510
      }
 
2511
 }
 
2512
 
 
2513
+uno::Reference< document::XVbaEventsHelper > 
 
2514
+SwDoc::GetVbaEventsHelper()
 
2515
+{
 
2516
+    if( !mxVbaEventsHelper.is() )
 
2517
+    {
 
2518
+        try
 
2519
+        {
 
2520
+            uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
 
2521
+            uno::Reference< frame::XModel > xModel( pDocShell ? pDocShell->GetModel() : NULL, uno::UNO_QUERY );
 
2522
+            uno::Sequence< uno::Any > aArgs(1);
 
2523
+            aArgs[0] = uno::Any( xModel );
 
2524
+            uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocumentVbaEventsHelper" ) ), aArgs ), uno::UNO_QUERY );
 
2525
+            // helper will always be created successfully.
 
2526
+            mxVbaEventsHelper.set( xVbaEventsHelper, uno::UNO_QUERY );
 
2527
+        }
 
2528
+        catch( uno::Exception& e )
 
2529
+        {
 
2530
+        }
 
2531
+    }
 
2532
+    return mxVbaEventsHelper;
 
2533
+}
 
2534
+
 
2535
 void SwDoc::setExternalData(::sw::tExternalDataType eType,
 
2536
                             ::sw::tExternalDataPointer pPayload)
 
2537
 {
 
2538
diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
 
2539
index 462adec..3e10291 100644
 
2540
--- sw/source/filter/ww8/ww8par.cxx
 
2541
+++ sw/source/filter/ww8/ww8par.cxx
 
2542
@@ -163,68 +163,6 @@ using namespace nsHdFtFlags;
 
2543
 #include <svtools/pathoptions.hxx>
 
2544
 #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
 
2545
 
 
2546
-const static String sThisDocument( RTL_CONSTASCII_USTRINGPARAM("ThisDocument"));
 
2547
-
 
2548
-struct DocEventNameTable
 
2549
-{
 
2550
-    const sal_Char* sEventName;
 
2551
-    const sal_Char* sMacroName;
 
2552
-};
 
2553
-
 
2554
-const DocEventNameTable aEventNameTable[] = 
 
2555
-{
 
2556
-    {"OnNew", "Document_New"},
 
2557
-    {"OnLoad", "Document_Open"},
 
2558
-    {"OnPrepareUnload", "Document_Close"},
 
2559
-    {NULL, NULL}
 
2560
-};
 
2561
-
 
2562
-bool registerDocEvent( SfxObjectShell* pShell )
 
2563
-{
 
2564
-       bool result = false;
 
2565
-       const static rtl::OUString sEvtType( RTL_CONSTASCII_USTRINGPARAM("EventType") );
 
2566
-       const static rtl::OUString sScript( RTL_CONSTASCII_USTRINGPARAM("Script") );
 
2567
-    uno::Reference< document::XEventsSupplier > xEvtSupplier( pShell->GetModel(), uno::UNO_QUERY );
 
2568
-    if( !xEvtSupplier.is() )
 
2569
-        return result;
 
2570
-    uno::Reference< container::XNameReplace > xEvts( xEvtSupplier->getEvents(), uno::UNO_QUERY );     
 
2571
-       if ( xEvts.is() )
 
2572
-       {
 
2573
-        for( const DocEventNameTable* pTable = aEventNameTable; pTable->sEventName != NULL; pTable++ )
 
2574
-        {
 
2575
-            rtl::OUString sEvt = rtl::OUString::createFromAscii( pTable->sEventName );
 
2576
-            String sMacroName = String::CreateFromAscii( pTable->sMacroName ).Insert( '.', 0 ).Insert( sThisDocument, 0);
 
2577
-            // fail to search the macro if the module is not specified.
 
2578
-            ooo::vba::VBAMacroResolvedInfo aMacroInfo = ooo::vba::resolveVBAMacro( pShell, sMacroName );
 
2579
-            if( !aMacroInfo.IsResolved() )
 
2580
-                continue;
 
2581
-
 
2582
-                   uno::Sequence< beans::PropertyValue > aEvents;
 
2583
-                   xEvts->getByName( sEvt ) >>= aEvents;
 
2584
-                   uno::Sequence< beans::PropertyValue > aOpenEvt( 2 );
 
2585
-                   aOpenEvt[ 0 ].Name = sEvtType;
 
2586
-                   aOpenEvt[ 0 ].Value = uno::makeAny(sScript);
 
2587
-                   aOpenEvt[ 1 ].Name = sScript;
 
2588
-            rtl::OUString sUrl = ooo::vba::makeMacroURL( aMacroInfo.ResolvedMacro() );
 
2589
-               aOpenEvt[ 1 ].Value = uno::makeAny(sUrl);
 
2590
-               sal_Int32 nPos = aEvents.getLength();
 
2591
-
 
2592
-                   sal_Int32 nNewSize = aEvents.getLength() + aOpenEvt.getLength();
 
2593
-                   if ( nNewSize > aEvents.getLength() )
 
2594
-                           aEvents.realloc( nNewSize );
 
2595
-
 
2596
-               for ( sal_Int32 nIndex = nPos, nCpyIndex = 0; nIndex<nNewSize; nIndex++, nCpyIndex++ )
 
2597
-                       aEvents[ nIndex ] = aOpenEvt[ nCpyIndex ];      
 
2598
-                       
 
2599
-                   uno::Any aParam = uno::makeAny( aEvents );
 
2600
-
 
2601
-                   xEvts->replaceByName( sEvt, aParam ); 
 
2602
-                   result = true;
 
2603
-        }    
 
2604
-       }
 
2605
-       return result;
 
2606
-}
 
2607
-
 
2608
 class Sttb : TBBase
 
2609
 {
 
2610
 struct SBBItem
 
2611
@@ -4363,10 +4301,6 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
 
2612
 
 
2613
             StoreMacroCmds();
 
2614
 
 
2615
-            // Hackly to register the document event.
 
2616
-            // should be find a better solution to share the codes with Excel Workbook event. 
 
2617
-            registerDocEvent( mpDocShell );
 
2618
-
 
2619
             maTracer.LeaveEnvironment(sw::log::eMacros);
 
2620
         }
 
2621
         ReadText(0, pWwFib->ccpText, MAN_MAINTEXT);
 
2622
diff --git sw/source/ui/app/docsh2.cxx sw/source/ui/app/docsh2.cxx
 
2623
index 1b0a0c1..8e59ff5 100644
 
2624
--- sw/source/ui/app/docsh2.cxx
 
2625
+++ sw/source/ui/app/docsh2.cxx
 
2626
@@ -151,6 +151,8 @@
 
2627
 #include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
 
2628
 #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
 
2629
 #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
 
2630
+#include <com/sun/star/document/XVbaEventsHelper.hpp>
 
2631
+#include <com/sun/star/document/VbaEventId.hpp>
 
2632
 
 
2633
 #include <svx/acorrcfg.hxx>
 
2634
 #include <SwStyleNameMapper.hxx>
 
2635
@@ -169,6 +171,7 @@ using namespace ::com::sun::star::uno;
 
2636
 using namespace ::com::sun::star;
 
2637
 using ::rtl::OUString;
 
2638
 using namespace ::sfx2;
 
2639
+using namespace com::sun::star::document::VbaEventId;
 
2640
 
 
2641
 extern BOOL FindPhyStyle( SwDoc& , const String& , SfxStyleFamily );
 
2642
 
 
2643
@@ -222,6 +225,31 @@ void SwDocShell::DoFlushDocInfo()
 
2644
     }
 
2645
 }
 
2646
 
 
2647
+void lcl_processCompatibleSfxHint( const uno::Reference< document::XVbaEventsHelper >& xVbaEventsHelper, const SfxHint& rHint )
 
2648
+{
 
2649
+    if ( rHint.ISA( SfxEventHint ) )
 
2650
+    {
 
2651
+        uno::Sequence< uno::Any > aArgs;
 
2652
+        ULONG nEventId = ((SfxEventHint&)rHint).GetEventId();
 
2653
+        switch( nEventId )
 
2654
+        {
 
2655
+            case SFX_EVENT_CREATEDOC:
 
2656
+            {
 
2657
+                xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_DOCUMENT_NEW, aArgs );
 
2658
+                break;
 
2659
+            }
 
2660
+            case SFX_EVENT_OPENDOC:
 
2661
+            {
 
2662
+                xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_DOCUMENT_OPEN, aArgs );
 
2663
+                break;
 
2664
+            }
 
2665
+            default:
 
2666
+            {
 
2667
+                //do nothing
 
2668
+            }
 
2669
+        }
 
2670
+    }
 
2671
+}
 
2672
 
 
2673
 /*--------------------------------------------------------------------
 
2674
     Beschreibung:      Benachrichtigung bei geaenderter DocInfo
 
2675
@@ -233,15 +261,18 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
 
2676
     {
 
2677
 //MA: Kommt bei der OLE-Registration vor!
 
2678
 //             ASSERT( !this, "DocShell ist nicht richtig initialisiert!" );
 
2679
-        return ;
 
2680
-    }
 
2681
-
 
2682
-    USHORT nAction = 0;
 
2683
-    if( rHint.ISA(SfxSimpleHint) )
 
2684
-    {
 
2685
-        // swithc for more actions
 
2686
-        switch( ((SfxSimpleHint&) rHint).GetId() )
 
2687
-        {
 
2688
+        return ;
 
2689
+    }
 
2690
+    uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper = pDoc->GetVbaEventsHelper();
 
2691
+    if( xVbaEventsHelper.is() )
 
2692
+        lcl_processCompatibleSfxHint( xVbaEventsHelper, rHint );
 
2693
+
 
2694
+    USHORT nAction = 0;
 
2695
+    if( rHint.ISA(SfxSimpleHint) )
 
2696
+    {
 
2697
+        // swithc for more actions
 
2698
+        switch( ((SfxSimpleHint&) rHint).GetId() )
 
2699
+        {
 
2700
             case SFX_HINT_TITLECHANGED:
 
2701
                 if( GetMedium() )
 
2702
                     nAction = 2;
 
2703
@@ -317,7 +348,17 @@ USHORT SwDocShell::PrepareClose( BOOL bUI, BOOL bForBrowsing )
 
2704
     if( TRUE == nRet ) //Unbedingt auf TRUE abfragen! (RET_NEWTASK)
 
2705
         EndListening( *this );
 
2706
 
 
2707
-    return nRet;
 
2708
+    if( pDoc && IsInPrepareClose() )
 
2709
+    {
 
2710
+        uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper = pDoc->GetVbaEventsHelper();
 
2711
+        if( xVbaEventsHelper.is() )
 
2712
+        {
 
2713
+            uno::Sequence< uno::Any > aArgs;
 
2714
+            xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_DOCUMENT_CLOSE, aArgs );
 
2715
+        }    
 
2716
+    }    
 
2717
+     
 
2718
+    return nRet;
 
2719
 }
 
2720
 
 
2721
 /*--------------------------------------------------------------------
 
2722
diff --git sw/source/ui/vba/makefile.mk sw/source/ui/vba/makefile.mk
 
2723
index f51ef26..10e4ab6 100644
 
2724
--- sw/source/ui/vba/makefile.mk
 
2725
+++ sw/source/ui/vba/makefile.mk
 
2726
@@ -86,6 +86,7 @@ SLOFILES= \
 
2727
                                $(SLO)$/vbaborders.obj \
 
2728
                                $(SLO)$/vbadocuments.obj \
 
2729
                                $(SLO)$/vbaheaderfooter.obj \
 
2730
+                $(SLO)$/vbaheadersfooters.obj \
 
2731
                                $(SLO)$/vbaheaderfooterhelper.obj \
 
2732
                                $(SLO)$/vbaaddin.obj \
 
2733
                                $(SLO)$/vbaaddins.obj \
 
2734
@@ -95,6 +96,33 @@ SLOFILES= \
 
2735
                                $(SLO)$/vbapagesetup.obj \
 
2736
                                $(SLO)$/vbasection.obj \
 
2737
                                $(SLO)$/vbasections.obj \
 
2738
+                $(SLO)$/vbarow.obj \
 
2739
+                $(SLO)$/vbarows.obj \
 
2740
+                $(SLO)$/vbacolumn.obj \
 
2741
+                $(SLO)$/vbacolumns.obj \
 
2742
+                $(SLO)$/vbatablehelper.obj \
 
2743
+                $(SLO)$/vbacell.obj \
 
2744
+                $(SLO)$/vbacells.obj \
 
2745
+                $(SLO)$/vbatabstop.obj \
 
2746
+                $(SLO)$/vbatabstops.obj \
 
2747
+                $(SLO)$/vbatableofcontents.obj \
 
2748
+                $(SLO)$/vbatablesofcontents.obj \
 
2749
+                $(SLO)$/vbalistgallery.obj \
 
2750
+                $(SLO)$/vbalistgalleries.obj \
 
2751
+                $(SLO)$/vbalisthelper.obj \
 
2752
+                $(SLO)$/vbalisttemplate.obj \
 
2753
+                $(SLO)$/vbalisttemplates.obj \
 
2754
+                $(SLO)$/vbalistlevel.obj \
 
2755
+                $(SLO)$/vbalistlevels.obj \
 
2756
+                $(SLO)$/vbalistformat.obj \
 
2757
+                $(SLO)$/vbarevision.obj \
 
2758
+                $(SLO)$/vbarevisions.obj \
 
2759
+                $(SLO)$/vbaframe.obj \
 
2760
+                $(SLO)$/vbaframes.obj \
 
2761
+                $(SLO)$/vbaformfield.obj \
 
2762
+                $(SLO)$/vbaformfields.obj \
 
2763
+                $(SLO)$/vbaeventshelper.obj \
 
2764
+                $(SLO)$/vbacheckbox.obj \
 
2765
 
 
2766
 # --- Targets ------------------------------------------------------
 
2767
 
 
2768
diff --git sw/source/ui/vba/service.cxx sw/source/ui/vba/service.cxx
 
2769
index 0ed9492..ae34ec0 100644
 
2770
--- sw/source/ui/vba/service.cxx
 
2771
+++ sw/source/ui/vba/service.cxx
 
2772
@@ -55,6 +55,11 @@ namespace wrapformat
 
2773
 extern sdecl::ServiceDecl const serviceDecl;
 
2774
 }
 
2775
 
 
2776
+namespace vbaeventshelper
 
2777
+{
 
2778
+extern sdecl::ServiceDecl const serviceDecl;
 
2779
+}
 
2780
+
 
2781
 extern "C"
 
2782
 {
 
2783
     void SAL_CALL component_getImplementationEnvironment( 
 
2784
@@ -71,7 +76,7 @@ extern "C"
 
2785
 
 
2786
        // Component registration
 
2787
         return component_writeInfoHelper( pServiceManager, pRegistryKey, 
 
2788
-               globals::serviceDecl, document::serviceDecl, wrapformat::serviceDecl  ); 
 
2789
+        globals::serviceDecl, document::serviceDecl, wrapformat::serviceDecl, vbaeventshelper::serviceDecl ); 
 
2790
     }
 
2791
 
 
2792
     void * SAL_CALL component_getFactory( 
 
2793
@@ -80,7 +85,7 @@ extern "C"
 
2794
     {
 
2795
                OSL_TRACE("In component_getFactory for %s", pImplName );
 
2796
        void* pRet =  component_getFactoryHelper(
 
2797
-               pImplName, pServiceManager, pRegistryKey, globals::serviceDecl, document::serviceDecl, wrapformat::serviceDecl );
 
2798
+            pImplName, pServiceManager, pRegistryKey, globals::serviceDecl, document::serviceDecl, wrapformat::serviceDecl, vbaeventshelper::serviceDecl );
 
2799
        OSL_TRACE("Ret is 0x%x", pRet);
 
2800
        return pRet;
 
2801
     }
 
2802
diff --git sw/source/ui/vba/vbaapplication.cxx sw/source/ui/vba/vbaapplication.cxx
 
2803
index ba57192..0d5dadb 100644
 
2804
--- sw/source/ui/vba/vbaapplication.cxx
 
2805
+++ sw/source/ui/vba/vbaapplication.cxx
 
2806
@@ -43,6 +43,7 @@
 
2807
 #include <svx/acorrcfg.hxx>
 
2808
 #include "wordvbahelper.hxx"
 
2809
 #include <docsh.hxx>
 
2810
+#include "vbalistgalleries.hxx"
 
2811
 
 
2812
 using namespace ::ooo;
 
2813
 using namespace ::ooo::vba;
 
2814
@@ -154,6 +155,16 @@ SwVbaApplication::Dialogs( const uno::Any& index ) throw (uno::RuntimeException)
 
2815
     return uno::makeAny( xCol );
 
2816
 }
 
2817
 
 
2818
+uno::Any SAL_CALL
 
2819
+SwVbaApplication::ListGalleries( const uno::Any& index ) throw (uno::RuntimeException)
 
2820
+{
 
2821
+    uno::Reference< text::XTextDocument > xTextDoc( getCurrentDocument(), uno::UNO_QUERY_THROW );
 
2822
+    uno::Reference< XCollection > xCol( new SwVbaListGalleries( this, mxContext, xTextDoc ) );
 
2823
+    if ( index.hasValue() )
 
2824
+        return xCol->Item( index, uno::Any() );
 
2825
+    return uno::makeAny( xCol );
 
2826
+}
 
2827
+
 
2828
 sal_Bool SAL_CALL SwVbaApplication::getDisplayAutoCompleteTips() throw (css::uno::RuntimeException)
 
2829
 {
 
2830
     return SvxAutoCorrCfg::Get()->IsAutoTextTip();
 
2831
diff --git sw/source/ui/vba/vbaapplication.hxx sw/source/ui/vba/vbaapplication.hxx
 
2832
index 935a03c..88736ff 100644
 
2833
--- sw/source/ui/vba/vbaapplication.hxx
 
2834
+++ sw/source/ui/vba/vbaapplication.hxx
 
2835
@@ -63,6 +63,7 @@ public:
 
2836
     virtual css::uno::Any SAL_CALL Documents( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);  
 
2837
     virtual css::uno::Any SAL_CALL Addins( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);  
 
2838
     virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);  
 
2839
+    virtual css::uno::Any SAL_CALL ListGalleries( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);  
 
2840
     virtual sal_Bool SAL_CALL getDisplayAutoCompleteTips() throw (css::uno::RuntimeException);
 
2841
     virtual void SAL_CALL setDisplayAutoCompleteTips( sal_Bool _displayAutoCompleteTips ) throw (css::uno::RuntimeException);
 
2842
     virtual sal_Int32 SAL_CALL getEnableCancelKey() throw (css::uno::RuntimeException);
 
2843
diff --git sw/source/ui/vba/vbaautotextentry.cxx sw/source/ui/vba/vbaautotextentry.cxx
 
2844
index 30bdc2a..47745d3 100644
 
2845
--- sw/source/ui/vba/vbaautotextentry.cxx
 
2846
+++ sw/source/ui/vba/vbaautotextentry.cxx
 
2847
@@ -29,7 +29,9 @@
 
2848
  ************************************************************************/
 
2849
 #include "vbaautotextentry.hxx"
 
2850
 #include <vbahelper/vbahelper.hxx>
 
2851
+#include <com/sun/star/text/XParagraphCursor.hpp>
 
2852
 #include <tools/diagnose_ex.h>
 
2853
+#include "wordvbahelper.hxx"
 
2854
 #include "vbarange.hxx"
 
2855
 
 
2856
 using namespace ::ooo::vba;
 
2857
@@ -44,7 +46,7 @@ SwVbaAutoTextEntry::~SwVbaAutoTextEntry()
 
2858
 {
 
2859
 }
 
2860
 
 
2861
-uno::Reference< word::XRange > SAL_CALL SwVbaAutoTextEntry::Insert( const uno::Reference< word::XRange >& _where, const uno::Any& /*_richtext*/ ) throw ( uno::RuntimeException )
 
2862
+uno::Reference< word::XRange > SAL_CALL SwVbaAutoTextEntry::Insert( const uno::Reference< word::XRange >& _where, const uno::Any& _richtext ) throw ( uno::RuntimeException )
 
2863
 {
 
2864
     SwVbaRange* pWhere = dynamic_cast<SwVbaRange*>( _where.get() );
 
2865
     if( pWhere )
 
2866
@@ -58,8 +60,28 @@ uno::Reference< word::XRange > SAL_CALL SwVbaAutoTextEntry::Insert( const uno::R
 
2867
         uno::Reference< text::XTextCursor > xTC = xText->createTextCursorByRange( xTextRange->getStart() );
 
2868
         xTC->goRight( 1, sal_True );
 
2869
         xTC->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("") ) ); // remove marker
 
2870
+        // remove the blank paragraph if it is a rich text
 
2871
+        sal_Bool bRich = sal_False;
 
2872
+        _richtext >>= bRich;
 
2873
+        if( bRich )
 
2874
+        {
 
2875
+            // check if it is a blank paragraph
 
2876
+            uno::Reference< text::XParagraphCursor > xParaCursor( xTC, uno::UNO_QUERY_THROW );
 
2877
+            if( xParaCursor->isStartOfParagraph() && xParaCursor->isEndOfParagraph() )
 
2878
+            {
 
2879
+                //remove the blank paragraph
 
2880
+                uno::Reference< frame::XModel > xModel( getCurrentWordDoc( mxContext ), uno::UNO_QUERY_THROW );
 
2881
+                uno::Reference< text::XTextViewCursor > xTVCursor = word::getXTextViewCursor( xModel );
 
2882
+                uno::Reference< text::XTextRange > xCurrentRange( xTC->getEnd(), uno::UNO_QUERY_THROW );
 
2883
+                xTVCursor->gotoRange( xCurrentRange, sal_False );
 
2884
+                rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Delete"));
 
2885
+                dispatchRequests( xModel,url );
 
2886
+                xTVCursor->gotoRange( xEndMarker->getEnd(), sal_False );
 
2887
+            }
 
2888
+        }
 
2889
         xEndMarker->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("") ) ); // remove marker
 
2890
-        xTC->gotoRange( xEndMarker, sal_True );
 
2891
+        //xTC->gotoRange( xEndMarker, sal_True );
 
2892
+        xTC = xText->createTextCursorByRange( xEndMarker->getEnd() );
 
2893
         pWhere->setXTextCursor( xTC );
 
2894
     }
 
2895
     return uno::Reference< word::XRange >( pWhere );
 
2896
@@ -98,8 +120,9 @@ SwVbaAutoTextEntries::getElementType() throw (uno::RuntimeException)
 
2897
 uno::Reference< container::XEnumeration >
 
2898
 SwVbaAutoTextEntries::createEnumeration() throw (uno::RuntimeException)
 
2899
 {
 
2900
-    uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
 
2901
-    return xEnumerationAccess->createEnumeration();
 
2902
+    //uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
 
2903
+    //return xEnumerationAccess->createEnumeration();
 
2904
+    throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
2905
 }
 
2906
 
 
2907
 uno::Any
 
2908
diff --git sw/source/ui/vba/vbabookmark.cxx sw/source/ui/vba/vbabookmark.cxx
 
2909
index 0c7bacf..9e77b51 100644
 
2910
--- sw/source/ui/vba/vbabookmark.cxx
 
2911
+++ sw/source/ui/vba/vbabookmark.cxx
 
2912
@@ -32,9 +32,12 @@
 
2913
 #include <tools/diagnose_ex.h>
 
2914
 #include <com/sun/star/text/XTextDocument.hpp>
 
2915
 #include <com/sun/star/text/XTextContent.hpp>
 
2916
+#include <com/sun/star/text/XTextRange.hpp>
 
2917
 #include <com/sun/star/text/XTextViewCursor.hpp>
 
2918
 #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
 
2919
+#include <com/sun/star/view/XSelectionSupplier.hpp>
 
2920
 #include "vbarange.hxx"
 
2921
+#include "wordvbahelper.hxx"
 
2922
 
 
2923
 using namespace ::ooo::vba;
 
2924
 using namespace ::com::sun::star;
 
2925
@@ -68,8 +71,8 @@ void SAL_CALL SwVbaBookmark::Delete() throw ( uno::RuntimeException )
 
2926
 void SAL_CALL SwVbaBookmark::Select() throw ( uno::RuntimeException )
 
2927
 {
 
2928
     checkVality();
 
2929
-    uno::Reference< text::XTextViewCursorSupplier > xViewCursorSupplier( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
 
2930
-    xViewCursorSupplier->getViewCursor()->gotoRange( mxBookmark->getAnchor(),sal_False );
 
2931
+    uno::Reference< view::XSelectionSupplier > xSelectSupp( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
 
2932
+    xSelectSupp->select( uno::makeAny( mxBookmark ) );
 
2933
 }
 
2934
 
 
2935
 rtl::OUString SAL_CALL SwVbaBookmark::getName() throw ( uno::RuntimeException )
 
2936
diff --git sw/source/ui/vba/vbabookmarks.cxx sw/source/ui/vba/vbabookmarks.cxx
 
2937
index e7d73cf..86a82a9 100644
 
2938
--- sw/source/ui/vba/vbabookmarks.cxx
 
2939
+++ sw/source/ui/vba/vbabookmarks.cxx
 
2940
@@ -123,7 +123,7 @@ SwVbaBookmarks::SwVbaBookmarks( const uno::Reference< XHelperInterface >& xParen
 
2941
     uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW );
 
2942
     // use view cursor to insert bookmark, or it will fail if insert bookmark in table
 
2943
     // mxText = xDocument->getText();
 
2944
-    mxText = word::getXTextViewCursor( mxModel )->getText();
 
2945
+    //mxText = word::getXTextViewCursor( mxModel )->getText();
 
2946
 }
 
2947
 // XEnumerationAccess
 
2948
 uno::Type
 
2949
@@ -149,16 +149,16 @@ SwVbaBookmarks::createCollectionObject( const css::uno::Any& aSource )
 
2950
 void SwVbaBookmarks::removeBookmarkByName( const rtl::OUString& rName ) throw (uno::RuntimeException)
 
2951
 {
 
2952
     uno::Reference< text::XTextContent > xBookmark( m_xNameAccess->getByName( rName ), uno::UNO_QUERY_THROW );
 
2953
-    mxText->removeTextContent( xBookmark );
 
2954
+    word::getXTextViewCursor( mxModel )->getText()->removeTextContent( xBookmark );
 
2955
 }
 
2956
 
 
2957
-void SwVbaBookmarks::addBookmarkByName( const rtl::OUString& rName, const uno::Reference< text::XTextRange >& rTextRange ) throw (uno::RuntimeException)
 
2958
+void SwVbaBookmarks::addBookmarkByName( const uno::Reference< frame::XModel >& xModel, const rtl::OUString& rName, const uno::Reference< text::XTextRange >& rTextRange ) throw (uno::RuntimeException)
 
2959
 {
 
2960
-    uno::Reference< lang::XMultiServiceFactory > xDocMSF( mxModel, uno::UNO_QUERY_THROW );
 
2961
+    uno::Reference< lang::XMultiServiceFactory > xDocMSF( xModel, uno::UNO_QUERY_THROW );
 
2962
     uno::Reference< text::XTextContent > xBookmark( xDocMSF->createInstance(  rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Bookmark")) ), uno::UNO_QUERY_THROW );
 
2963
     uno::Reference< container::XNamed > xNamed( xBookmark, uno::UNO_QUERY_THROW );
 
2964
     xNamed->setName( rName );
 
2965
-    mxText->insertTextContent( rTextRange, xBookmark, sal_False );
 
2966
+    rTextRange->getText()->insertTextContent( rTextRange, xBookmark, sal_False );
 
2967
 }
 
2968
 
 
2969
 uno::Any SAL_CALL
 
2970
@@ -184,7 +184,7 @@ SwVbaBookmarks::Add( const rtl::OUString& rName, const uno::Any& rRange ) throw
 
2971
     if( m_xNameAccess->hasByName( aName ) )
 
2972
         removeBookmarkByName( aName );
 
2973
     
 
2974
-    addBookmarkByName( aName, xTextRange );
 
2975
+    addBookmarkByName( mxModel, aName, xTextRange );
 
2976
 
 
2977
     return uno::makeAny( uno::Reference< word::XBookmark >( new SwVbaBookmark( getParent(), mxContext, mxModel, aName ) ) );
 
2978
 }
 
2979
diff --git sw/source/ui/vba/vbabookmarks.hxx sw/source/ui/vba/vbabookmarks.hxx
 
2980
index 6047788..fc7539c 100644
 
2981
--- sw/source/ui/vba/vbabookmarks.hxx
 
2982
+++ sw/source/ui/vba/vbabookmarks.hxx
 
2983
@@ -50,12 +50,12 @@ private:
 
2984
 
 
2985
 private:
 
2986
     void removeBookmarkByName( const rtl::OUString& rName ) throw (css::uno::RuntimeException);
 
2987
-    void addBookmarkByName( const rtl::OUString& rName, const css::uno::Reference< css::text::XTextRange >& rTextRange ) throw (css::uno::RuntimeException);
 
2988
 
 
2989
 public:
 
2990
        SwVbaBookmarks( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xBookmarks, const css::uno::Reference< css::frame::XModel >& xModel );
 
2991
        virtual ~SwVbaBookmarks() {}
 
2992
 
 
2993
+    static void addBookmarkByName( const css::uno::Reference< css::frame::XModel >& xModel, const rtl::OUString& rName, const css::uno::Reference< css::text::XTextRange >& rTextRange ) throw (css::uno::RuntimeException);
 
2994
        // XEnumerationAccess
 
2995
        virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
 
2996
        virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
 
2997
diff --git sw/source/ui/vba/vbaborders.cxx sw/source/ui/vba/vbaborders.cxx
 
2998
index 0c7c4f7..f10864c 100644
 
2999
--- sw/source/ui/vba/vbaborders.cxx
 
3000
+++ sw/source/ui/vba/vbaborders.cxx
 
3001
@@ -351,14 +351,19 @@ SwVbaBorders::getItemByIntIndex( const sal_Int32 nIndex )  throw (uno::RuntimeEx
 
3002
 
 
3003
 sal_Bool SAL_CALL SwVbaBorders::getShadow() throw (uno::RuntimeException)
 
3004
 {
 
3005
+    /*
 
3006
     table::ShadowFormat aShadowFormat;
 
3007
     m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShadowFormat") ) ) >>= aShadowFormat;
 
3008
     return ( aShadowFormat.Location != table::ShadowLocation_NONE );
 
3009
+    */
 
3010
+    // always return False for table border in MS Word
 
3011
+    return sal_False;
 
3012
 }
 
3013
 
 
3014
 void SAL_CALL SwVbaBorders::setShadow( sal_Bool /*_shadow*/ ) throw (uno::RuntimeException)
 
3015
 {
 
3016
-    throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
3017
+    // not support in Table border in Word
 
3018
+    // TODO: 
 
3019
 }
 
3020
 
 
3021
 rtl::OUString& 
 
3022
diff --git sw/source/ui/vba/vbacell.cxx sw/source/ui/vba/vbacell.cxx
 
3023
new file mode 100644
 
3024
index 0000000..59e2f22
 
3025
--- /dev/null
 
3026
+++ sw/source/ui/vba/vbacell.cxx
 
3027
@@ -0,0 +1,120 @@
 
3028
+/*************************************************************************
 
3029
+ *
 
3030
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
3031
+ * 
 
3032
+ * Copyright 2008 by Sun Microsystems, Inc.
 
3033
+ *
 
3034
+ * OpenOffice.org - a multi-platform office productivity suite
 
3035
+ *
 
3036
+ * $RCSfile: 
 
3037
+ * $Revision: 
 
3038
+ *
 
3039
+ * This file is part of OpenOffice.org.
 
3040
+ *
 
3041
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
3042
+ * it under the terms of the GNU Lesser General Public License version 3
 
3043
+ * only, as published by the Free Software Foundation.
 
3044
+ *
 
3045
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
3046
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
3047
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
3048
+ * GNU Lesser General Public License version 3 for more details
 
3049
+ * (a copy is included in the LICENSE file that accompanied this code).
 
3050
+ *
 
3051
+ * You should have received a copy of the GNU Lesser General Public License
 
3052
+ * version 3 along with OpenOffice.org.  If not, see
 
3053
+ * <http://www.openoffice.org/license.html>
 
3054
+ * for a copy of the LGPLv3 License.
 
3055
+ *
 
3056
+ ************************************************************************/
 
3057
+#include "vbacell.hxx"
 
3058
+#include <vbahelper/vbahelper.hxx>
 
3059
+#include <tools/diagnose_ex.h>
 
3060
+#include "vbatable.hxx"
 
3061
+#include <com/sun/star/table/XCellRange.hpp>
 
3062
+#include <com/sun/star/view/XSelectionSupplier.hpp>
 
3063
+#include <rtl/ustrbuf.hxx>
 
3064
+#include "wordvbahelper.hxx"
 
3065
+#include "vbatablehelper.hxx"
 
3066
+#include "vbarow.hxx"
 
3067
+
 
3068
+using namespace ::ooo::vba;
 
3069
+using namespace ::com::sun::star;
 
3070
+
 
3071
+SwVbaCell::SwVbaCell( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nColumn, sal_Int32 nRow ) throw ( uno::RuntimeException ) :
 
3072
+    SwVbaCell_BASE( rParent, rContext ), mxTextTable( xTextTable ), mnColumn( nColumn ), mnRow( nRow )
 
3073
+{
 
3074
+}
 
3075
+
 
3076
+SwVbaCell::~SwVbaCell()
 
3077
+{
 
3078
+}
 
3079
+
 
3080
+::sal_Int32 SAL_CALL SwVbaCell::getWidth() throw (css::uno::RuntimeException)
 
3081
+{
 
3082
+    SwVbaTableHelper aTableHelper( mxTextTable );
 
3083
+    return aTableHelper.GetColWidth( mnColumn, mnRow, sal_True );
 
3084
+}
 
3085
+
 
3086
+void SAL_CALL SwVbaCell::setWidth( ::sal_Int32 _width ) throw (css::uno::RuntimeException)
 
3087
+{
 
3088
+    SwVbaTableHelper aTableHelper( mxTextTable );
 
3089
+    aTableHelper.SetColWidth( _width, mnColumn, mnRow, sal_True );
 
3090
+}
 
3091
+
 
3092
+uno::Any SAL_CALL SwVbaCell::getHeight() throw (css::uno::RuntimeException)
 
3093
+{
 
3094
+    uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
 
3095
+    return xRow->getHeight();
 
3096
+}
 
3097
+
 
3098
+void SAL_CALL SwVbaCell::setHeight( const uno::Any& _height ) throw (css::uno::RuntimeException)
 
3099
+{
 
3100
+    uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
 
3101
+    xRow->setHeight( _height );
 
3102
+}
 
3103
+
 
3104
+::sal_Int32 SAL_CALL SwVbaCell::getHeightRule() throw (css::uno::RuntimeException)
 
3105
+{
 
3106
+    uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
 
3107
+    return xRow->getHeightRule();
 
3108
+}
 
3109
+
 
3110
+void SAL_CALL SwVbaCell::setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException)
 
3111
+{
 
3112
+    uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
 
3113
+    xRow->setHeightRule( _heightrule );
 
3114
+}
 
3115
+
 
3116
+void SAL_CALL SwVbaCell::SetWidth( float width, sal_Int32 rulestyle ) throw (css::uno::RuntimeException)
 
3117
+{
 
3118
+    // FIXME: handle the argument: rulestyle
 
3119
+    setWidth( width );
 
3120
+}
 
3121
+
 
3122
+void SAL_CALL SwVbaCell::SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException)
 
3123
+{
 
3124
+    // FIXME: handle the argument: heightrule 
 
3125
+    setHeightRule( heightrule );
 
3126
+    setHeight( uno::makeAny( height ) );
 
3127
+}
 
3128
+
 
3129
+rtl::OUString& 
 
3130
+SwVbaCell::getServiceImplName()
 
3131
+{
 
3132
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaCell") );
 
3133
+    return sImplName;
 
3134
+}
 
3135
+
 
3136
+uno::Sequence< rtl::OUString > 
 
3137
+SwVbaCell::getServiceNames()
 
3138
+{
 
3139
+    static uno::Sequence< rtl::OUString > aServiceNames;
 
3140
+    if ( aServiceNames.getLength() == 0 )
 
3141
+    {
 
3142
+        aServiceNames.realloc( 1 );
 
3143
+        aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Cell" ) );
 
3144
+    }
 
3145
+    return aServiceNames;
 
3146
+}
 
3147
+
 
3148
diff --git sw/source/ui/vba/vbacell.hxx sw/source/ui/vba/vbacell.hxx
 
3149
new file mode 100644
 
3150
index 0000000..1350288
 
3151
--- /dev/null
 
3152
+++ sw/source/ui/vba/vbacell.hxx
 
3153
@@ -0,0 +1,67 @@
 
3154
+/*************************************************************************
 
3155
+ *
 
3156
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
3157
+ * 
 
3158
+ * Copyright 2008 by Sun Microsystems, Inc.
 
3159
+ *
 
3160
+ * OpenOffice.org - a multi-platform office productivity suite
 
3161
+ *
 
3162
+ * $RCSfile: 
 
3163
+ * $Revision: 
 
3164
+ *
 
3165
+ * This file is part of OpenOffice.org.
 
3166
+ *
 
3167
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
3168
+ * it under the terms of the GNU Lesser General Public License version 3
 
3169
+ * only, as published by the Free Software Foundation.
 
3170
+ *
 
3171
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
3172
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
3173
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
3174
+ * GNU Lesser General Public License version 3 for more details
 
3175
+ * (a copy is included in the LICENSE file that accompanied this code).
 
3176
+ *
 
3177
+ * You should have received a copy of the GNU Lesser General Public License
 
3178
+ * version 3 along with OpenOffice.org.  If not, see
 
3179
+ * <http://www.openoffice.org/license.html>
 
3180
+ * for a copy of the LGPLv3 License.
 
3181
+ *
 
3182
+ ************************************************************************/
 
3183
+#ifndef SW_VBA_CELL_HXX
 
3184
+#define SW_VBA_CELL_HXX
 
3185
+
 
3186
+#include <ooo/vba/word/XCell.hpp>
 
3187
+#include <vbahelper/vbahelperinterface.hxx>
 
3188
+#include <cppuhelper/implbase1.hxx>
 
3189
+#include <com/sun/star/text/XTextTable.hpp>
 
3190
+
 
3191
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XCell > SwVbaCell_BASE;
 
3192
+
 
3193
+class SwVbaCell : public SwVbaCell_BASE
 
3194
+{
 
3195
+private:
 
3196
+    css::uno::Reference< css::text::XTextTable > mxTextTable;
 
3197
+    sal_Int32 mnColumn;
 
3198
+    sal_Int32 mnRow;
 
3199
+
 
3200
+public:
 
3201
+    SwVbaCell( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nColumn, sal_Int32 nRow ) throw ( css::uno::RuntimeException );
 
3202
+    virtual ~SwVbaCell();
 
3203
+
 
3204
+    // Attributes
 
3205
+    virtual ::sal_Int32 SAL_CALL getWidth() throw (css::uno::RuntimeException);
 
3206
+    virtual void SAL_CALL setWidth( ::sal_Int32 _width ) throw (css::uno::RuntimeException);
 
3207
+    virtual css::uno::Any SAL_CALL getHeight() throw (css::uno::RuntimeException);
 
3208
+    virtual void SAL_CALL setHeight( const css::uno::Any& _height ) throw (css::uno::RuntimeException);
 
3209
+    virtual ::sal_Int32 SAL_CALL getHeightRule() throw (css::uno::RuntimeException);
 
3210
+    virtual void SAL_CALL setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException);
 
3211
+
 
3212
+    // Methods
 
3213
+    virtual void SAL_CALL SetWidth( float width, sal_Int32 rulestyle ) throw (css::uno::RuntimeException);
 
3214
+    virtual void SAL_CALL SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException);
 
3215
+
 
3216
+    // XHelperInterface
 
3217
+    virtual rtl::OUString& getServiceImplName();
 
3218
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
3219
+};
 
3220
+#endif /* SW_VBA_CELL_HXX */
 
3221
diff --git sw/source/ui/vba/vbacells.cxx sw/source/ui/vba/vbacells.cxx
 
3222
new file mode 100644
 
3223
index 0000000..603c08f
 
3224
--- /dev/null
 
3225
+++ sw/source/ui/vba/vbacells.cxx
 
3226
@@ -0,0 +1,223 @@
 
3227
+/*************************************************************************
 
3228
+ *
 
3229
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
3230
+ * 
 
3231
+ * Copyright 2008 by Sun Microsystems, Inc.
 
3232
+ *
 
3233
+ * OpenOffice.org - a multi-platform office productivity suite
 
3234
+ *
 
3235
+ * $RCSfile: 
 
3236
+ * $Revision: 
 
3237
+ *
 
3238
+ * This file is part of OpenOffice.org.
 
3239
+ *
 
3240
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
3241
+ * it under the terms of the GNU Lesser General Public License version 3
 
3242
+ * only, as published by the Free Software Foundation.
 
3243
+ *
 
3244
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
3245
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
3246
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
3247
+ * GNU Lesser General Public License version 3 for more details
 
3248
+ * (a copy is included in the LICENSE file that accompanied this code).
 
3249
+ *
 
3250
+ * You should have received a copy of the GNU Lesser General Public License
 
3251
+ * version 3 along with OpenOffice.org.  If not, see
 
3252
+ * <http://www.openoffice.org/license.html>
 
3253
+ * for a copy of the LGPLv3 License.
 
3254
+ *
 
3255
+ ************************************************************************/
 
3256
+#include "vbacells.hxx"
 
3257
+#include "vbacell.hxx"
 
3258
+#include "wordvbahelper.hxx"
 
3259
+#include "vbatablehelper.hxx"
 
3260
+#include "vbarow.hxx"
 
3261
+
 
3262
+using namespace ::ooo::vba;
 
3263
+using namespace ::com::sun::star;
 
3264
+
 
3265
+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > CellCollectionHelper_Base;
 
3266
+
 
3267
+class CellsEnumWrapper : public EnumerationHelper_BASE
 
3268
+{
 
3269
+    uno::Reference< container::XIndexAccess > mxIndexAccess;
 
3270
+    sal_Int32 nIndex;
 
3271
+
 
3272
+public:
 
3273
+    CellsEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : mxIndexAccess( xIndexAccess ), nIndex( 0 )
 
3274
+    {
 
3275
+    }
 
3276
+    virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException)
 
3277
+    {
 
3278
+        return ( nIndex < mxIndexAccess->getCount() );
 
3279
+    }
 
3280
+
 
3281
+    virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
 
3282
+    {
 
3283
+        if( nIndex < mxIndexAccess->getCount() )
 
3284
+        {
 
3285
+            return mxIndexAccess->getByIndex( nIndex++ );
 
3286
+        }
 
3287
+        throw container::NoSuchElementException();
 
3288
+    }
 
3289
+};
 
3290
+
 
3291
+class CellCollectionHelper : public CellCollectionHelper_Base
 
3292
+{
 
3293
+private:
 
3294
+    uno::Reference< XHelperInterface > mxParent;
 
3295
+    uno::Reference< uno::XComponentContext > mxContext;
 
3296
+    uno::Reference< css::text::XTextTable > mxTextTable;
 
3297
+    sal_Int32 mnLeft;
 
3298
+    sal_Int32 mnTop;
 
3299
+    sal_Int32 mnRight;
 
3300
+    sal_Int32 mnBottom;
 
3301
+
 
3302
+public:
 
3303
+    CellCollectionHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw ( css::uno::RuntimeException ): mxParent( xParent ), mxContext( xContext ), mxTextTable( xTextTable ), mnLeft( nLeft ), mnTop( nTop ), mnRight( nRight ), mnBottom( nBottom )
 
3304
+    {
 
3305
+    }
 
3306
+    virtual ~CellCollectionHelper() {}
 
3307
+
 
3308
+    virtual sal_Int32 SAL_CALL getCount(  ) throw (uno::RuntimeException)
 
3309
+    {
 
3310
+        return ( mnRight - mnLeft + 1 ) * ( mnBottom - mnTop + 1 );
 
3311
+    }
 
3312
+    virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
 
3313
+    {
 
3314
+        if ( Index < 0 || Index >= getCount() )    
 
3315
+            throw css::lang::IndexOutOfBoundsException();
 
3316
+        
 
3317
+        for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
 
3318
+        {
 
3319
+            for( sal_Int32 col = mnLeft; col <= mnRight; col++ )
 
3320
+            {
 
3321
+                if( Index == ( ( row - mnTop ) * ( mnRight - mnLeft + 1 ) + ( col - mnLeft ) ) )
 
3322
+                    return uno::makeAny( uno::Reference< word::XCell >( new SwVbaCell( mxParent, mxContext, mxTextTable, col, row ) ) );
 
3323
+            }
 
3324
+        }
 
3325
+        throw css::lang::IndexOutOfBoundsException();
 
3326
+        
 
3327
+    }
 
3328
+    virtual uno::Type SAL_CALL getElementType(  ) throw (uno::RuntimeException)
 
3329
+    {
 
3330
+        return word::XCell::static_type(0);
 
3331
+    }
 
3332
+    virtual sal_Bool SAL_CALL hasElements(  ) throw (uno::RuntimeException)
 
3333
+    {
 
3334
+        return sal_True;
 
3335
+    }
 
3336
+    // XEnumerationAccess
 
3337
+    virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration(  ) throw (uno::RuntimeException)
 
3338
+    {
 
3339
+        return new CellsEnumWrapper( this );
 
3340
+    }
 
3341
+};
 
3342
+
 
3343
+SwVbaCells::SwVbaCells( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw (uno::RuntimeException) : SwVbaCells_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new CellCollectionHelper( xParent, xContext, xTextTable, nLeft, nTop, nRight, nBottom ) ) ), mxTextTable( xTextTable ), mnLeft( nLeft ), mnTop( nTop ), mnRight( nRight ), mnBottom( nBottom )
 
3344
+{
 
3345
+}
 
3346
+
 
3347
+::sal_Int32 SAL_CALL SwVbaCells::getWidth() throw (css::uno::RuntimeException)
 
3348
+{
 
3349
+    uno::Reference< word::XCell > xCell( m_xIndexAccess->getByIndex( 0 ), uno::UNO_QUERY_THROW );
 
3350
+    return xCell->getWidth();
 
3351
+}
 
3352
+
 
3353
+void SAL_CALL SwVbaCells::setWidth( ::sal_Int32 _width ) throw (css::uno::RuntimeException)
 
3354
+{
 
3355
+    sal_Int32 nIndex = 0;
 
3356
+    while( nIndex < m_xIndexAccess->getCount() )
 
3357
+    {
 
3358
+        uno::Reference< word::XCell > xCell( m_xIndexAccess->getByIndex( nIndex++ ), uno::UNO_QUERY_THROW );
 
3359
+        xCell->setWidth( _width );
 
3360
+    }
 
3361
+}
 
3362
+
 
3363
+uno::Any SAL_CALL SwVbaCells::getHeight() throw (css::uno::RuntimeException)
 
3364
+{
 
3365
+    uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnTop ) );
 
3366
+    return xRow->getHeight();
 
3367
+}
 
3368
+
 
3369
+void SAL_CALL SwVbaCells::setHeight( const uno::Any& _height ) throw (css::uno::RuntimeException)
 
3370
+{
 
3371
+    for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
 
3372
+    {
 
3373
+        uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, row ) );
 
3374
+        xRow->setHeight( _height );
 
3375
+    }    
 
3376
+}
 
3377
+
 
3378
+::sal_Int32 SAL_CALL SwVbaCells::getHeightRule() throw (css::uno::RuntimeException)
 
3379
+{
 
3380
+    uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnTop ) );
 
3381
+    return xRow->getHeightRule();
 
3382
+}
 
3383
+
 
3384
+void SAL_CALL SwVbaCells::setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException)
 
3385
+{
 
3386
+    for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
 
3387
+    {
 
3388
+        uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, row ) );
 
3389
+        xRow->setHeightRule( _heightrule );
 
3390
+    }    
 
3391
+}
 
3392
+
 
3393
+void SAL_CALL SwVbaCells::SetWidth( float width, sal_Int32 rulestyle ) throw (css::uno::RuntimeException)
 
3394
+{
 
3395
+    sal_Int32 nIndex = 0;
 
3396
+    while( nIndex < m_xIndexAccess->getCount() )
 
3397
+    {
 
3398
+        uno::Reference< word::XCell > xCell( m_xIndexAccess->getByIndex( nIndex++ ), uno::UNO_QUERY_THROW );
 
3399
+        xCell->SetWidth( width, rulestyle );
 
3400
+    }
 
3401
+}
 
3402
+
 
3403
+void SAL_CALL SwVbaCells::SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException)
 
3404
+{
 
3405
+    for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
 
3406
+    {
 
3407
+        uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, row ) );
 
3408
+        xRow->SetHeight( height, heightrule );
 
3409
+    }    
 
3410
+}
 
3411
+
 
3412
+// XEnumerationAccess
 
3413
+uno::Type
 
3414
+SwVbaCells::getElementType() throw (uno::RuntimeException)
 
3415
+{
 
3416
+    return word::XCell::static_type(0);
 
3417
+}
 
3418
+
 
3419
+uno::Reference< container::XEnumeration >
 
3420
+SwVbaCells::createEnumeration() throw (uno::RuntimeException)
 
3421
+{
 
3422
+    uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
 
3423
+    return xEnumAccess->createEnumeration();
 
3424
+}
 
3425
+
 
3426
+uno::Any
 
3427
+SwVbaCells::createCollectionObject( const uno::Any& aSource )
 
3428
+{
 
3429
+    return aSource;
 
3430
+}
 
3431
+
 
3432
+rtl::OUString& 
 
3433
+SwVbaCells::getServiceImplName()
 
3434
+{
 
3435
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaCells") );
 
3436
+    return sImplName;
 
3437
+} 
 
3438
+
 
3439
+uno::Sequence<rtl::OUString> 
 
3440
+SwVbaCells::getServiceNames()
 
3441
+{
 
3442
+    static uno::Sequence< rtl::OUString > sNames;
 
3443
+    if ( sNames.getLength() == 0 )
 
3444
+    {
 
3445
+        sNames.realloc( 1 );
 
3446
+        sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Cells") );
 
3447
+    }
 
3448
+    return sNames;
 
3449
+}
 
3450
diff --git sw/source/ui/vba/vbacells.hxx sw/source/ui/vba/vbacells.hxx
 
3451
new file mode 100644
 
3452
index 0000000..3468b29
 
3453
--- /dev/null
 
3454
+++ sw/source/ui/vba/vbacells.hxx
 
3455
@@ -0,0 +1,75 @@
 
3456
+/*************************************************************************
 
3457
+ *
 
3458
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
3459
+ * 
 
3460
+ * Copyright 2008 by Sun Microsystems, Inc.
 
3461
+ *
 
3462
+ * OpenOffice.org - a multi-platform office productivity suite
 
3463
+ *
 
3464
+ * $RCSfile: 
 
3465
+ * $Revision: 
 
3466
+ *
 
3467
+ * This file is part of OpenOffice.org.
 
3468
+ *
 
3469
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
3470
+ * it under the terms of the GNU Lesser General Public License version 3
 
3471
+ * only, as published by the Free Software Foundation.
 
3472
+ *
 
3473
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
3474
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
3475
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
3476
+ * GNU Lesser General Public License version 3 for more details
 
3477
+ * (a copy is included in the LICENSE file that accompanied this code).
 
3478
+ *
 
3479
+ * You should have received a copy of the GNU Lesser General Public License
 
3480
+ * version 3 along with OpenOffice.org.  If not, see
 
3481
+ * <http://www.openoffice.org/license.html>
 
3482
+ * for a copy of the LGPLv3 License.
 
3483
+ *
 
3484
+ ************************************************************************/
 
3485
+#ifndef SW_VBA_CELLS_HXX
 
3486
+#define SW_VBA_CELLS_HXX
 
3487
+
 
3488
+#include <vbahelper/vbacollectionimpl.hxx>
 
3489
+#include <ooo/vba/word/XCells.hpp>
 
3490
+#include <vbahelper/vbahelperinterface.hxx>
 
3491
+#include <com/sun/star/text/XTextTable.hpp>
 
3492
+
 
3493
+typedef CollTestImplHelper< ooo::vba::word::XCells > SwVbaCells_BASE;
 
3494
+
 
3495
+class SwVbaCells : public SwVbaCells_BASE
 
3496
+{
 
3497
+private:
 
3498
+    css::uno::Reference< css::text::XTextTable > mxTextTable;
 
3499
+    sal_Int32 mnLeft;
 
3500
+    sal_Int32 mnTop;
 
3501
+    sal_Int32 mnRight;
 
3502
+    sal_Int32 mnBottom;
 
3503
+
 
3504
+public:
 
3505
+    SwVbaCells( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw ( css::uno::RuntimeException );
 
3506
+    virtual ~SwVbaCells() {}
 
3507
+
 
3508
+    // Attributes
 
3509
+    virtual ::sal_Int32 SAL_CALL getWidth() throw (css::uno::RuntimeException);
 
3510
+    virtual void SAL_CALL setWidth( ::sal_Int32 _width ) throw (css::uno::RuntimeException);
 
3511
+    virtual css::uno::Any SAL_CALL getHeight() throw (css::uno::RuntimeException);
 
3512
+    virtual void SAL_CALL setHeight( const css::uno::Any& _height ) throw (css::uno::RuntimeException);
 
3513
+    virtual ::sal_Int32 SAL_CALL getHeightRule() throw (css::uno::RuntimeException);
 
3514
+    virtual void SAL_CALL setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException);
 
3515
+
 
3516
+    // Methods
 
3517
+    virtual void SAL_CALL SetWidth( float width, sal_Int32 rulestyle ) throw (css::uno::RuntimeException);
 
3518
+    virtual void SAL_CALL SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException);
 
3519
+
 
3520
+    // XEnumerationAccess
 
3521
+    virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
 
3522
+    virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
 
3523
+
 
3524
+    // SwVbaCells_BASE
 
3525
+    virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); 
 
3526
+    virtual rtl::OUString& getServiceImplName();
 
3527
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
3528
+};    
 
3529
+
 
3530
+#endif /* SW_VBA_CELLS_HXX */
 
3531
diff --git sw/source/ui/vba/vbacheckbox.cxx sw/source/ui/vba/vbacheckbox.cxx
 
3532
new file mode 100644
 
3533
index 0000000..307f7a2
 
3534
--- /dev/null
 
3535
+++ sw/source/ui/vba/vbacheckbox.cxx
 
3536
@@ -0,0 +1,98 @@
 
3537
+/*************************************************************************
 
3538
+ *
 
3539
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
3540
+ * 
 
3541
+ * Copyright 2008 by Sun Microsystems, Inc.
 
3542
+ *
 
3543
+ * OpenOffice.org - a multi-platform office productivity suite
 
3544
+ *
 
3545
+ * $RCSfile: 
 
3546
+ * $Revision: 
 
3547
+ *
 
3548
+ * This file is part of OpenOffice.org.
 
3549
+ *
 
3550
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
3551
+ * it under the terms of the GNU Lesser General Public License version 3
 
3552
+ * only, as published by the Free Software Foundation.
 
3553
+ *
 
3554
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
3555
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
3556
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
3557
+ * GNU Lesser General Public License version 3 for more details
 
3558
+ * (a copy is included in the LICENSE file that accompanied this code).
 
3559
+ *
 
3560
+ * You should have received a copy of the GNU Lesser General Public License
 
3561
+ * version 3 along with OpenOffice.org.  If not, see
 
3562
+ * <http://www.openoffice.org/license.html>
 
3563
+ * for a copy of the LGPLv3 License.
 
3564
+ *
 
3565
+ ************************************************************************/
 
3566
+#include "vbacheckbox.hxx"
 
3567
+#include <vbahelper/vbahelper.hxx>
 
3568
+#include <tools/diagnose_ex.h>
 
3569
+#include <com/sun/star/text/XTextDocument.hpp>
 
3570
+#include <com/sun/star/text/XTextContent.hpp>
 
3571
+#include <com/sun/star/text/XTextViewCursor.hpp>
 
3572
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
 
3573
+#include <ecmaflds.hxx>
 
3574
+
 
3575
+using namespace ::ooo::vba;
 
3576
+using namespace ::com::sun::star;
 
3577
+
 
3578
+SwVbaCheckBox::SwVbaCheckBox( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& rModel, const uno::Reference< text::XFormField >& xFormField ) throw ( uno::RuntimeException ) : SwVbaCheckBox_BASE( rParent, rContext ), mxModel( rModel ), mxFormField( xFormField )
 
3579
+{
 
3580
+    rtl::OUString sType = mxFormField->getFieldType();
 
3581
+    if( !sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX ) )
 
3582
+    {
 
3583
+        throw uno::RuntimeException( rtl::OUString(
 
3584
+            RTL_CONSTASCII_USTRINGPARAM("It is not a CheckBox")), uno::Reference< uno::XInterface >() );
 
3585
+    }
 
3586
+}
 
3587
+
 
3588
+SwVbaCheckBox::~SwVbaCheckBox()
 
3589
+{
 
3590
+}
 
3591
+
 
3592
+sal_Bool SAL_CALL SwVbaCheckBox::getValue() throw ( uno::RuntimeException )
 
3593
+{
 
3594
+    sal_Bool bValue = sal_False;
 
3595
+    sal_Int32 nCount = mxFormField->getParamCount();
 
3596
+    for( sal_Int32 i = 0; i < nCount; i++ )
 
3597
+    {
 
3598
+        if( mxFormField->getParamName(i).equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX_CHECKED ) )
 
3599
+        {
 
3600
+            if( mxFormField->getParamValue(i).equalsIgnoreAsciiCaseAscii("on") )
 
3601
+                bValue = sal_True;
 
3602
+            else
 
3603
+                bValue = sal_False;
 
3604
+            break;    
 
3605
+        }
 
3606
+    }
 
3607
+    return bValue;
 
3608
+}
 
3609
+
 
3610
+void SAL_CALL SwVbaCheckBox::setValue( sal_Bool value ) throw ( uno::RuntimeException )
 
3611
+{
 
3612
+    rtl::OUString sValue = rtl::OUString::createFromAscii( value ? "on" : "off" );
 
3613
+    mxFormField->addParam( rtl::OUString::createFromAscii( ECMA_FORMCHECKBOX_CHECKED ), sValue, sal_True );
 
3614
+}
 
3615
+
 
3616
+rtl::OUString& 
 
3617
+SwVbaCheckBox::getServiceImplName()
 
3618
+{
 
3619
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaCheckBox") );
 
3620
+    return sImplName;
 
3621
+}
 
3622
+
 
3623
+uno::Sequence< rtl::OUString > 
 
3624
+SwVbaCheckBox::getServiceNames()
 
3625
+{
 
3626
+    static uno::Sequence< rtl::OUString > aServiceNames;
 
3627
+    if ( aServiceNames.getLength() == 0 )
 
3628
+    {
 
3629
+        aServiceNames.realloc( 1 );
 
3630
+        aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.CheckBox" ) );
 
3631
+    }
 
3632
+    return aServiceNames;
 
3633
+}
 
3634
+
 
3635
diff --git sw/source/ui/vba/vbacheckbox.hxx sw/source/ui/vba/vbacheckbox.hxx
 
3636
new file mode 100644
 
3637
index 0000000..7b12ed5
 
3638
--- /dev/null
 
3639
+++ sw/source/ui/vba/vbacheckbox.hxx
 
3640
@@ -0,0 +1,58 @@
 
3641
+/*************************************************************************
 
3642
+ *
 
3643
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
3644
+ * 
 
3645
+ * Copyright 2008 by Sun Microsystems, Inc.
 
3646
+ *
 
3647
+ * OpenOffice.org - a multi-platform office productivity suite
 
3648
+ *
 
3649
+ * $RCSfile: 
 
3650
+ * $Revision: 
 
3651
+ *
 
3652
+ * This file is part of OpenOffice.org.
 
3653
+ *
 
3654
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
3655
+ * it under the terms of the GNU Lesser General Public License version 3
 
3656
+ * only, as published by the Free Software Foundation.
 
3657
+ *
 
3658
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
3659
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
3660
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
3661
+ * GNU Lesser General Public License version 3 for more details
 
3662
+ * (a copy is included in the LICENSE file that accompanied this code).
 
3663
+ *
 
3664
+ * You should have received a copy of the GNU Lesser General Public License
 
3665
+ * version 3 along with OpenOffice.org.  If not, see
 
3666
+ * <http://www.openoffice.org/license.html>
 
3667
+ * for a copy of the LGPLv3 License.
 
3668
+ *
 
3669
+ ************************************************************************/
 
3670
+#ifndef SW_VBA_CHECKBOX_HXX
 
3671
+#define SW_VBA_CHECKBOX_HXX
 
3672
+
 
3673
+#include <ooo/vba/word/XCheckBox.hpp>
 
3674
+#include <cppuhelper/implbase1.hxx>
 
3675
+#include <com/sun/star/text/XFormField.hpp>
 
3676
+#include <vbahelper/vbahelperinterface.hxx>
 
3677
+
 
3678
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XCheckBox > SwVbaCheckBox_BASE;
 
3679
+
 
3680
+class SwVbaCheckBox : public SwVbaCheckBox_BASE
 
3681
+{
 
3682
+private:
 
3683
+    css::uno::Reference< css::frame::XModel > mxModel;
 
3684
+    css::uno::Reference< css::text::XFormField > mxFormField;
 
3685
+
 
3686
+public:
 
3687
+    SwVbaCheckBox( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const css::uno::Reference< css::text::XFormField >& xFormField ) throw ( css::uno::RuntimeException );
 
3688
+    virtual ~SwVbaCheckBox();
 
3689
+
 
3690
+    // Methods
 
3691
+    sal_Bool SAL_CALL getValue() throw ( css::uno::RuntimeException );
 
3692
+    void SAL_CALL setValue( sal_Bool value ) throw ( css::uno::RuntimeException );
 
3693
+
 
3694
+    // XHelperInterface
 
3695
+    virtual rtl::OUString& getServiceImplName();
 
3696
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
3697
+};
 
3698
+#endif /* SW_VBA_CHECKBOX_HXX */
 
3699
diff --git sw/source/ui/vba/vbacolumn.cxx sw/source/ui/vba/vbacolumn.cxx
 
3700
new file mode 100644
 
3701
index 0000000..3dd4eb1
 
3702
--- /dev/null
 
3703
+++ sw/source/ui/vba/vbacolumn.cxx
 
3704
@@ -0,0 +1,201 @@
 
3705
+/*************************************************************************
 
3706
+ *
 
3707
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
3708
+ * 
 
3709
+ * Copyright 2008 by Sun Microsystems, Inc.
 
3710
+ *
 
3711
+ * OpenOffice.org - a multi-platform office productivity suite
 
3712
+ *
 
3713
+ * $RCSfile: 
 
3714
+ * $Revision: 
 
3715
+ *
 
3716
+ * This file is part of OpenOffice.org.
 
3717
+ *
 
3718
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
3719
+ * it under the terms of the GNU Lesser General Public License version 3
 
3720
+ * only, as published by the Free Software Foundation.
 
3721
+ *
 
3722
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
3723
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
3724
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
3725
+ * GNU Lesser General Public License version 3 for more details
 
3726
+ * (a copy is included in the LICENSE file that accompanied this code).
 
3727
+ *
 
3728
+ * You should have received a copy of the GNU Lesser General Public License
 
3729
+ * version 3 along with OpenOffice.org.  If not, see
 
3730
+ * <http://www.openoffice.org/license.html>
 
3731
+ * for a copy of the LGPLv3 License.
 
3732
+ *
 
3733
+ ************************************************************************/
 
3734
+#include "vbacolumn.hxx"
 
3735
+#include <vbahelper/vbahelper.hxx>
 
3736
+#include <tools/diagnose_ex.h>
 
3737
+#include "vbatable.hxx"
 
3738
+#include <com/sun/star/table/XCellRange.hpp>
 
3739
+#include <com/sun/star/view/XSelectionSupplier.hpp>
 
3740
+#include <rtl/ustrbuf.hxx>
 
3741
+#include "wordvbahelper.hxx"
 
3742
+#include "vbatablehelper.hxx"
 
3743
+
 
3744
+#define RELATIVE_TABLE_WIDTH 10000
 
3745
+
 
3746
+using namespace ::ooo::vba;
 
3747
+using namespace ::com::sun::star;
 
3748
+
 
3749
+SwVbaColumn::SwVbaColumn( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nIndex ) throw ( uno::RuntimeException ) :
 
3750
+    SwVbaColumn_BASE( rParent, rContext ), mxTextTable( xTextTable ), mnIndex( nIndex )
 
3751
+{
 
3752
+    mxTableColumns = mxTextTable->getColumns();
 
3753
+}
 
3754
+
 
3755
+SwVbaColumn::~SwVbaColumn()
 
3756
+{
 
3757
+}
 
3758
+
 
3759
+void SwVbaColumn::calculateAbsoluteColumnWidth( sal_Int32 nTableWidth, const css::uno::Sequence< css::text::TableColumnSeparator >& aSeparators, double* pAbsWidth )
 
3760
+{
 
3761
+    const text::TableColumnSeparator* pArray = aSeparators.getConstArray();
 
3762
+    sal_Int32 nSepCount = aSeparators.getLength();
 
3763
+    for( sal_Int32 i = 0; i <= nSepCount; i++ )
 
3764
+    {
 
3765
+        sal_Int32 nRelColWidth = 0;
 
3766
+        if( i == 0 )
 
3767
+        {
 
3768
+            if( nSepCount != 0 )
 
3769
+            {
 
3770
+                nRelColWidth = pArray[0].Position;
 
3771
+            }
 
3772
+            else
 
3773
+            {
 
3774
+                nRelColWidth = RELATIVE_TABLE_WIDTH;
 
3775
+            }
 
3776
+        }
 
3777
+        else
 
3778
+        {
 
3779
+            if( i == nSepCount )
 
3780
+            {
 
3781
+                nRelColWidth = RELATIVE_TABLE_WIDTH - pArray[i-1].Position;
 
3782
+            }
 
3783
+            else
 
3784
+            {
 
3785
+                nRelColWidth = pArray[i].Position - pArray[i-1].Position;
 
3786
+            }
 
3787
+        }
 
3788
+        pAbsWidth[i] = ( (double)nRelColWidth / RELATIVE_TABLE_WIDTH ) * (double) nTableWidth;
 
3789
+    }
 
3790
+}
 
3791
+
 
3792
+void SwVbaColumn::calculateRelativeColumnWidth( const double* pAbsWidth, double* pRelWidth, sal_Int32 nCount )
 
3793
+{
 
3794
+    double tableWidth = 0.0;
 
3795
+    for( sal_Int32 i = 0; i < nCount; i++ )
 
3796
+    {
 
3797
+        tableWidth += pAbsWidth[i];
 
3798
+    }
 
3799
+
 
3800
+    pRelWidth[ nCount - 1 ] = tableWidth;
 
3801
+    for( sal_Int32 i = 0; i < nCount - 1; i++ )
 
3802
+    {
 
3803
+        if( i == 0 )
 
3804
+        {
 
3805
+            pRelWidth[i] = ( pAbsWidth[i] * RELATIVE_TABLE_WIDTH ) / tableWidth;
 
3806
+        }
 
3807
+        else
 
3808
+        {
 
3809
+            pRelWidth[i] = pRelWidth[i-1] + ( pAbsWidth[i] * RELATIVE_TABLE_WIDTH ) / tableWidth;
 
3810
+        }
 
3811
+    }
 
3812
+}
 
3813
+
 
3814
+sal_Int32 SAL_CALL
 
3815
+SwVbaColumn::getWidth( ) throw ( css::uno::RuntimeException )
 
3816
+{
 
3817
+   /* uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
 
3818
+    uno::Sequence< text::TableColumnSeparator > aSeparators;
 
3819
+    xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TableColumnSeparators") ) ) >>= aSeparators;
 
3820
+    sal_Int32 nTableWidth = SwVbaTable::getTableWidth( xTableProps );
 
3821
+    sal_Int32 nColCont = aSeparators.getLength() + 1;
 
3822
+    double dAbsColWidth[ nColCont ];
 
3823
+    calculateAbsoluteColumnWidth( nTableWidth, aSeparators, dAbsColWidth );
 
3824
+    return Millimeter::getInPoints( (sal_Int32)( dAbsColWidth[ mnIndex ] ) );
 
3825
+   */ 
 
3826
+    SwVbaTableHelper aTableHelper( mxTextTable );
 
3827
+    return aTableHelper.GetColWidth( mnIndex );
 
3828
+}
 
3829
+
 
3830
+void SAL_CALL
 
3831
+SwVbaColumn::setWidth( sal_Int32 _width ) throw ( css::uno::RuntimeException )
 
3832
+{
 
3833
+/*    uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
 
3834
+    uno::Sequence< text::TableColumnSeparator > aSeparators;
 
3835
+    xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TableColumnSeparators") ) ) >>= aSeparators;
 
3836
+    sal_Int32 nTableWidth = SwVbaTable::getTableWidth( xTableProps );
 
3837
+    sal_Int32 nColCont = aSeparators.getLength() + 1;
 
3838
+    double dAbsColWidth[ nColCont ];
 
3839
+    calculateAbsoluteColumnWidth( nTableWidth, aSeparators, dAbsColWidth );
 
3840
+    dAbsColWidth[ mnIndex ] = Millimeter::getInHundredthsOfOneMillimeter( _width );
 
3841
+    double tableWidth = 0.0;
 
3842
+    for( sal_Int32 i = 0; i < nColCont; i++ )
 
3843
+    {
 
3844
+        tableWidth += dAbsColWidth[i];
 
3845
+    }
 
3846
+    
 
3847
+    double dRelColWidth[ nColCont ];
 
3848
+    calculateRelativeColumnWidth( dAbsColWidth, dRelColWidth, nColCont);
 
3849
+
 
3850
+    text::TableColumnSeparator* pArray = aSeparators.getArray();
 
3851
+    for( sal_Int32 i = 0; i < nColCont - 1; i++ )
 
3852
+    {
 
3853
+        pArray[i].Position = (sal_Int16)(dRelColWidth[i]);
 
3854
+    }
 
3855
+
 
3856
+    xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TableColumnSeparators") ), uno::makeAny( aSeparators ) );
 
3857
+    SwVbaTable::setTableWidth( xTableProps, (sal_Int32)( tableWidth ) );
 
3858
+    */
 
3859
+
 
3860
+    SwVbaTableHelper aTableHelper( mxTextTable );
 
3861
+    aTableHelper.SetColWidth( _width, mnIndex );
 
3862
+}
 
3863
+
 
3864
+void SAL_CALL
 
3865
+SwVbaColumn::Select( ) throw ( uno::RuntimeException )
 
3866
+{
 
3867
+    SelectColumn( getCurrentWordDoc(mxContext), mxTextTable, mnIndex, mnIndex );
 
3868
+}
 
3869
+
 
3870
+void SwVbaColumn::SelectColumn( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nStartColumn, sal_Int32 nEndColumn ) throw ( uno::RuntimeException )
 
3871
+{
 
3872
+    rtl::OUStringBuffer aRangeName;
 
3873
+    rtl::OUString sStartCol = SwVbaTableHelper::getColumnStr( nStartColumn );
 
3874
+    aRangeName.append(sStartCol).append(sal_Int32( 1 ) );
 
3875
+    rtl::OUString sEndCol = SwVbaTableHelper::getColumnStr( nEndColumn );
 
3876
+    sal_Int32 nRowCount = xTextTable->getRows()->getCount();
 
3877
+    aRangeName.appendAscii(":").append( sEndCol ).append( sal_Int32( nRowCount ) );
 
3878
+
 
3879
+    uno::Reference< table::XCellRange > xCellRange( xTextTable, uno::UNO_QUERY_THROW );
 
3880
+    rtl::OUString sSelRange = aRangeName.makeStringAndClear();
 
3881
+    uno::Reference< table::XCellRange > xSelRange = xCellRange->getCellRangeByName( sSelRange );
 
3882
+
 
3883
+    uno::Reference< view::XSelectionSupplier > xSelection( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
 
3884
+    xSelection->select( uno::makeAny( xSelRange ) );
 
3885
+}
 
3886
+
 
3887
+rtl::OUString& 
 
3888
+SwVbaColumn::getServiceImplName()
 
3889
+{
 
3890
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaColumn") );
 
3891
+    return sImplName;
 
3892
+}
 
3893
+
 
3894
+uno::Sequence< rtl::OUString > 
 
3895
+SwVbaColumn::getServiceNames()
 
3896
+{
 
3897
+    static uno::Sequence< rtl::OUString > aServiceNames;
 
3898
+    if ( aServiceNames.getLength() == 0 )
 
3899
+    {
 
3900
+        aServiceNames.realloc( 1 );
 
3901
+        aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Column" ) );
 
3902
+    }
 
3903
+    return aServiceNames;
 
3904
+}
 
3905
+
 
3906
diff --git sw/source/ui/vba/vbacolumn.hxx sw/source/ui/vba/vbacolumn.hxx
 
3907
new file mode 100644
 
3908
index 0000000..6d67bdd
 
3909
--- /dev/null
 
3910
+++ sw/source/ui/vba/vbacolumn.hxx
 
3911
@@ -0,0 +1,68 @@
 
3912
+/*************************************************************************
 
3913
+ *
 
3914
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
3915
+ * 
 
3916
+ * Copyright 2008 by Sun Microsystems, Inc.
 
3917
+ *
 
3918
+ * OpenOffice.org - a multi-platform office productivity suite
 
3919
+ *
 
3920
+ * $RCSfile: 
 
3921
+ * $Revision: 
 
3922
+ *
 
3923
+ * This file is part of OpenOffice.org.
 
3924
+ *
 
3925
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
3926
+ * it under the terms of the GNU Lesser General Public License version 3
 
3927
+ * only, as published by the Free Software Foundation.
 
3928
+ *
 
3929
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
3930
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
3931
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
3932
+ * GNU Lesser General Public License version 3 for more details
 
3933
+ * (a copy is included in the LICENSE file that accompanied this code).
 
3934
+ *
 
3935
+ * You should have received a copy of the GNU Lesser General Public License
 
3936
+ * version 3 along with OpenOffice.org.  If not, see
 
3937
+ * <http://www.openoffice.org/license.html>
 
3938
+ * for a copy of the LGPLv3 License.
 
3939
+ *
 
3940
+ ************************************************************************/
 
3941
+#ifndef SW_VBA_COLUMN_HXX
 
3942
+#define SW_VBA_COLUMN_HXX
 
3943
+
 
3944
+#include <ooo/vba/word/XColumn.hpp>
 
3945
+#include <vbahelper/vbahelperinterface.hxx>
 
3946
+#include <cppuhelper/implbase1.hxx>
 
3947
+#include <com/sun/star/table/XTableColumns.hpp>
 
3948
+#include <com/sun/star/text/XTextTable.hpp>
 
3949
+#include <com/sun/star/text/TableColumnSeparator.hpp>
 
3950
+
 
3951
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XColumn > SwVbaColumn_BASE;
 
3952
+
 
3953
+class SwVbaColumn : public SwVbaColumn_BASE
 
3954
+{
 
3955
+private:
 
3956
+    css::uno::Reference< css::text::XTextTable > mxTextTable;
 
3957
+    css::uno::Reference< css::table::XTableColumns > mxTableColumns;
 
3958
+    sal_Int32 mnIndex;
 
3959
+
 
3960
+private:
 
3961
+    void calculateAbsoluteColumnWidth( sal_Int32 nTableWidth, const css::uno::Sequence< css::text::TableColumnSeparator >& aSeparators, double* pAbsWidth );
 
3962
+    void calculateRelativeColumnWidth( const double* pAbsWidth, double* pRelWidth, sal_Int32 nCount );
 
3963
+
 
3964
+public:
 
3965
+    SwVbaColumn( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nIndex ) throw ( css::uno::RuntimeException );
 
3966
+    virtual ~SwVbaColumn();
 
3967
+
 
3968
+    // Methods
 
3969
+    virtual sal_Int32 SAL_CALL getWidth() throw ( css::uno::RuntimeException );
 
3970
+    virtual void SAL_CALL setWidth( sal_Int32 _width ) throw ( css::uno::RuntimeException );
 
3971
+    virtual void SAL_CALL Select(  ) throw (css::uno::RuntimeException);
 
3972
+
 
3973
+    static void SelectColumn( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nStartColumn, sal_Int32 nEndColumn ) throw (css::uno::RuntimeException);
 
3974
+
 
3975
+    // XHelperInterface
 
3976
+    virtual rtl::OUString& getServiceImplName();
 
3977
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
3978
+};
 
3979
+#endif /* SW_VBA_COLUMN_HXX */
 
3980
diff --git sw/source/ui/vba/vbacolumns.cxx sw/source/ui/vba/vbacolumns.cxx
 
3981
new file mode 100644
 
3982
index 0000000..1ce3bf9
 
3983
--- /dev/null
 
3984
+++ sw/source/ui/vba/vbacolumns.cxx
 
3985
@@ -0,0 +1,160 @@
 
3986
+/*************************************************************************
 
3987
+ *
 
3988
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
3989
+ * 
 
3990
+ * Copyright 2008 by Sun Microsystems, Inc.
 
3991
+ *
 
3992
+ * OpenOffice.org - a multi-platform office productivity suite
 
3993
+ *
 
3994
+ * $RCSfile: 
 
3995
+ * $Revision: 
 
3996
+ *
 
3997
+ * This file is part of OpenOffice.org.
 
3998
+ *
 
3999
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
4000
+ * it under the terms of the GNU Lesser General Public License version 3
 
4001
+ * only, as published by the Free Software Foundation.
 
4002
+ *
 
4003
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
4004
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
4005
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
4006
+ * GNU Lesser General Public License version 3 for more details
 
4007
+ * (a copy is included in the LICENSE file that accompanied this code).
 
4008
+ *
 
4009
+ * You should have received a copy of the GNU Lesser General Public License
 
4010
+ * version 3 along with OpenOffice.org.  If not, see
 
4011
+ * <http://www.openoffice.org/license.html>
 
4012
+ * for a copy of the LGPLv3 License.
 
4013
+ *
 
4014
+ ************************************************************************/
 
4015
+#include "vbacolumns.hxx"
 
4016
+#include "vbacolumn.hxx"
 
4017
+#include <com/sun/star/text/HoriOrientation.hpp>
 
4018
+#include <com/sun/star/table/XCellRange.hpp>
 
4019
+#include <ooo/vba/word/WdConstants.hpp>
 
4020
+#include <ooo/vba/word/WdRulerStyle.hpp>
 
4021
+#include "wordvbahelper.hxx"
 
4022
+#include "vbatablehelper.hxx"
 
4023
+
 
4024
+using namespace ::ooo::vba;
 
4025
+using namespace ::com::sun::star;
 
4026
+
 
4027
+class ColumnsEnumWrapper : public EnumerationHelper_BASE
 
4028
+{
 
4029
+    uno::Reference< text::XTextTable > mxTextTable;
 
4030
+    uno::Reference< container::XIndexAccess > mxIndexAccess;
 
4031
+    uno::WeakReference< XHelperInterface > mxParent;
 
4032
+    uno::Reference< uno::XComponentContext > mxContext;
 
4033
+    sal_Int32 nIndex;
 
4034
+
 
4035
+public:
 
4036
+    ColumnsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< text::XTextTable >& xTextTable ) : mxParent( xParent ), mxContext( xContext ), mxTextTable( xTextTable ), nIndex( 0 ) 
 
4037
+    {
 
4038
+        mxIndexAccess.set( mxTextTable->getColumns(), uno::UNO_QUERY );
 
4039
+    }
 
4040
+    virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException)
 
4041
+    {
 
4042
+        return ( nIndex < mxIndexAccess->getCount() );
 
4043
+    }
 
4044
+
 
4045
+    virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
 
4046
+    {
 
4047
+        if( nIndex < mxIndexAccess->getCount() )
 
4048
+        {
 
4049
+            return uno::makeAny( uno::Reference< word::XColumn > ( new SwVbaColumn( mxParent, mxContext, mxTextTable, nIndex++ ) ) );
 
4050
+        }
 
4051
+        throw container::NoSuchElementException();
 
4052
+    }
 
4053
+};
 
4054
+
 
4055
+SwVbaColumns::SwVbaColumns( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, const uno::Reference< table::XTableColumns >& xTableColumns ) throw (uno::RuntimeException) : SwVbaColumns_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xTableColumns, uno::UNO_QUERY_THROW ) ), mxTextTable( xTextTable ), mxTableColumns( xTableColumns ) 
 
4056
+{
 
4057
+    mnStartColumnIndex = 0;
 
4058
+    SwVbaTableHelper aTableHelper( mxTextTable );
 
4059
+    mnEndColumnIndex = aTableHelper.getTabColumnsMaxCount( ) - 1;
 
4060
+}
 
4061
+
 
4062
+SwVbaColumns::SwVbaColumns( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, const uno::Reference< table::XTableColumns >& xTableColumns, sal_Int32 nStartCol, sal_Int32 nEndCol ) throw (uno::RuntimeException) : SwVbaColumns_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xTableColumns, uno::UNO_QUERY_THROW ) ), mxTextTable( xTextTable ), mxTableColumns( xTableColumns ), mnStartColumnIndex( nStartCol ), mnEndColumnIndex( nEndCol ) 
 
4063
+{
 
4064
+    if( mnEndColumnIndex < mnStartColumnIndex )
 
4065
+        throw uno::RuntimeException();
 
4066
+}
 
4067
+
 
4068
+uno::Reference< word::XColumn > SwVbaColumns::getColumnAtIndex( sal_Int32 index ) throw (uno::RuntimeException)
 
4069
+{
 
4070
+    return uno::Reference< word::XColumn >( new SwVbaColumn( this, mxContext, mxTextTable, index ) );
 
4071
+}
 
4072
+
 
4073
+::sal_Int32 SAL_CALL SwVbaColumns::getWidth() throw (uno::RuntimeException)
 
4074
+{
 
4075
+    return getColumnAtIndex( mnStartColumnIndex )->getWidth();
 
4076
+}
 
4077
+
 
4078
+void SAL_CALL SwVbaColumns::setWidth( ::sal_Int32 _width ) throw (uno::RuntimeException)
 
4079
+{
 
4080
+    for( sal_Int32 index = mnStartColumnIndex; index <= mnEndColumnIndex; index++ )
 
4081
+    {
 
4082
+        getColumnAtIndex( index )->setWidth( _width );
 
4083
+    }
 
4084
+}
 
4085
+
 
4086
+void SAL_CALL SwVbaColumns::Select(  ) throw (uno::RuntimeException)
 
4087
+{
 
4088
+    SwVbaColumn::SelectColumn( getCurrentWordDoc(mxContext), mxTextTable, mnStartColumnIndex, mnEndColumnIndex );
 
4089
+}
 
4090
+
 
4091
+::sal_Int32 SAL_CALL SwVbaColumns::getCount() throw (uno::RuntimeException)
 
4092
+{
 
4093
+    return ( mnEndColumnIndex - mnStartColumnIndex + 1 );
 
4094
+}
 
4095
+
 
4096
+uno::Any SAL_CALL SwVbaColumns::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
 
4097
+{
 
4098
+    sal_Int32 nIndex = 0;
 
4099
+    if( ( Index1 >>= nIndex ) == sal_True )
 
4100
+    {
 
4101
+        if( nIndex <= 0 || nIndex > getCount() )
 
4102
+        {
 
4103
+            throw  lang::IndexOutOfBoundsException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
 
4104
+        }
 
4105
+        return uno::makeAny( uno::Reference< word::XColumn >( new SwVbaColumn( this, mxContext, mxTextTable, nIndex - 1 ) ) );
 
4106
+    }
 
4107
+    throw  uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
 
4108
+}
 
4109
+
 
4110
+// XEnumerationAccess
 
4111
+uno::Type
 
4112
+SwVbaColumns::getElementType() throw (uno::RuntimeException)
 
4113
+{
 
4114
+    return word::XColumn::static_type(0);
 
4115
+}
 
4116
+uno::Reference< container::XEnumeration >
 
4117
+SwVbaColumns::createEnumeration() throw (uno::RuntimeException)
 
4118
+{
 
4119
+    return new ColumnsEnumWrapper( this, mxContext, mxTextTable );
 
4120
+}
 
4121
+
 
4122
+uno::Any
 
4123
+SwVbaColumns::createCollectionObject( const uno::Any& aSource )
 
4124
+{
 
4125
+    return aSource;
 
4126
+}
 
4127
+
 
4128
+rtl::OUString& 
 
4129
+SwVbaColumns::getServiceImplName()
 
4130
+{
 
4131
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaColumns") );
 
4132
+    return sImplName;
 
4133
+} 
 
4134
+
 
4135
+uno::Sequence<rtl::OUString> 
 
4136
+SwVbaColumns::getServiceNames()
 
4137
+{
 
4138
+    static uno::Sequence< rtl::OUString > sNames;
 
4139
+    if ( sNames.getLength() == 0 )
 
4140
+    {
 
4141
+        sNames.realloc( 1 );
 
4142
+        sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Columns") );
 
4143
+    }
 
4144
+    return sNames;
 
4145
+}
 
4146
diff --git sw/source/ui/vba/vbacolumns.hxx sw/source/ui/vba/vbacolumns.hxx
 
4147
new file mode 100644
 
4148
index 0000000..3fd2b4a
 
4149
--- /dev/null
 
4150
+++ sw/source/ui/vba/vbacolumns.hxx
 
4151
@@ -0,0 +1,75 @@
 
4152
+/*************************************************************************
 
4153
+ *
 
4154
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
4155
+ * 
 
4156
+ * Copyright 2008 by Sun Microsystems, Inc.
 
4157
+ *
 
4158
+ * OpenOffice.org - a multi-platform office productivity suite
 
4159
+ *
 
4160
+ * $RCSfile: 
 
4161
+ * $Revision: 
 
4162
+ *
 
4163
+ * This file is part of OpenOffice.org.
 
4164
+ *
 
4165
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
4166
+ * it under the terms of the GNU Lesser General Public License version 3
 
4167
+ * only, as published by the Free Software Foundation.
 
4168
+ *
 
4169
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
4170
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
4171
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
4172
+ * GNU Lesser General Public License version 3 for more details
 
4173
+ * (a copy is included in the LICENSE file that accompanied this code).
 
4174
+ *
 
4175
+ * You should have received a copy of the GNU Lesser General Public License
 
4176
+ * version 3 along with OpenOffice.org.  If not, see
 
4177
+ * <http://www.openoffice.org/license.html>
 
4178
+ * for a copy of the LGPLv3 License.
 
4179
+ *
 
4180
+ ************************************************************************/
 
4181
+#ifndef SW_VBA_COLUMNS_HXX
 
4182
+#define SW_VBA_COLUMNS_HXX
 
4183
+
 
4184
+#include <vbahelper/vbacollectionimpl.hxx>
 
4185
+#include <ooo/vba/word/XColumns.hpp>
 
4186
+#include <ooo/vba/word/XColumn.hpp>
 
4187
+#include <vbahelper/vbahelperinterface.hxx>
 
4188
+#include <com/sun/star/table/XTableColumns.hpp>
 
4189
+#include <com/sun/star/text/XTextTable.hpp>
 
4190
+
 
4191
+typedef CollTestImplHelper< ooo::vba::word::XColumns > SwVbaColumns_BASE;
 
4192
+
 
4193
+class SwVbaColumns : public SwVbaColumns_BASE
 
4194
+{
 
4195
+private:
 
4196
+    css::uno::Reference< css::text::XTextTable > mxTextTable;
 
4197
+    css::uno::Reference< css::table::XTableColumns > mxTableColumns;
 
4198
+    sal_Int32 mnStartColumnIndex;
 
4199
+    sal_Int32 mnEndColumnIndex;
 
4200
+
 
4201
+private:
 
4202
+    css::uno::Reference< ooo::vba::word::XColumn > getColumnAtIndex( sal_Int32 index ) throw (css::uno::RuntimeException);
 
4203
+
 
4204
+public:
 
4205
+    SwVbaColumns( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, const css::uno::Reference< css::table::XTableColumns >& xTableColumns ) throw ( css::uno::RuntimeException );
 
4206
+    SwVbaColumns( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, const css::uno::Reference< css::table::XTableColumns >& xTableColumns, sal_Int32 nStartCol, sal_Int32 nEndCol ) throw ( css::uno::RuntimeException );
 
4207
+    virtual ~SwVbaColumns() {}
 
4208
+
 
4209
+    virtual sal_Int32 SAL_CALL getWidth(  ) throw (css::uno::RuntimeException);
 
4210
+    virtual void SAL_CALL setWidth( sal_Int32 _width ) throw (css::uno::RuntimeException);
 
4211
+    virtual void SAL_CALL Select(  ) throw (css::uno::RuntimeException);
 
4212
+
 
4213
+    //XCollection
 
4214
+    virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
 
4215
+    virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& /*not processed in this base class*/ ) throw ( css::uno::RuntimeException );
 
4216
+    // XEnumerationAccess
 
4217
+    virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
 
4218
+    virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
 
4219
+
 
4220
+    // SwVbaColumns_BASE
 
4221
+    virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); 
 
4222
+    virtual rtl::OUString& getServiceImplName();
 
4223
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
4224
+};    
 
4225
+
 
4226
+#endif /* SW_VBA_COLUMNS_HXX */
 
4227
diff --git sw/source/ui/vba/vbadocument.cxx sw/source/ui/vba/vbadocument.cxx
 
4228
index 1409dbb..d012c27 100644
 
4229
--- sw/source/ui/vba/vbadocument.cxx
 
4230
+++ sw/source/ui/vba/vbadocument.cxx
 
4231
@@ -41,7 +41,9 @@
 
4232
 #include <com/sun/star/drawing/XControlShape.hpp>
 
4233
 #include <com/sun/star/drawing/XControlShape.hpp>
 
4234
 #include <com/sun/star/form/XFormsSupplier.hpp>
 
4235
+#include <com/sun/star/document/XRedlinesSupplier.hpp>
 
4236
 #include <ooo/vba/XControlProvider.hpp>
 
4237
+#include <ooo/vba/word/WdProtectionType.hpp>
 
4238
 
 
4239
 #include <vbahelper/helperdecl.hxx>
 
4240
 #include <wordvbahelper.hxx>
 
4241
@@ -53,7 +55,13 @@
 
4242
 #include "vbafield.hxx"
 
4243
 #include "vbapagesetup.hxx"
 
4244
 #include "vbasections.hxx"
 
4245
+#include "vbatablesofcontents.hxx"
 
4246
 #include <vbahelper/vbashapes.hxx>
 
4247
+#include <vbahelper/vbahelper.hxx>
 
4248
+#include "vbarevisions.hxx"
 
4249
+#include "vbaframes.hxx"
 
4250
+#include "vbaformfields.hxx"
 
4251
+#include <osl/file.hxx>
 
4252
 
 
4253
 using namespace ::ooo::vba;
 
4254
 using namespace ::com::sun::star;
 
4255
@@ -223,6 +231,24 @@ SwVbaDocument::Sections( const uno::Any& index ) throw (uno::RuntimeException)
 
4256
 }
 
4257
 
 
4258
 uno::Any SAL_CALL
 
4259
+SwVbaDocument::TablesOfContents( const uno::Any& index ) throw (uno::RuntimeException)
 
4260
+{
 
4261
+    uno::Reference< XCollection > xCol( new SwVbaTablesOfContents( this, mxContext, mxTextDocument ) );
 
4262
+    if ( index.hasValue() )
 
4263
+        return xCol->Item( index, uno::Any() );
 
4264
+    return uno::makeAny( xCol );
 
4265
+}
 
4266
+
 
4267
+uno::Any SAL_CALL
 
4268
+SwVbaDocument::FormFields( const uno::Any& index ) throw (uno::RuntimeException)
 
4269
+{
 
4270
+    uno::Reference< XCollection > xCol( new SwVbaFormFields( this, mxContext, getModel() ) );
 
4271
+    if ( index.hasValue() )
 
4272
+        return xCol->Item( index, uno::Any() );
 
4273
+    return uno::makeAny( xCol );
 
4274
+}
 
4275
+
 
4276
+uno::Any SAL_CALL
 
4277
 SwVbaDocument::PageSetup( ) throw (uno::RuntimeException)
 
4278
 {
 
4279
     uno::Reference< beans::XPropertySet > xPageProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
 
4280
@@ -242,16 +268,35 @@ SwVbaDocument::getAttachedTemplate() throw (uno::RuntimeException)
 
4281
     uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( getModel(), uno::UNO_QUERY_THROW );
 
4282
     uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
 
4283
     uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
 
4284
-    rtl::OUString sTemplateName = xDocProps->getTemplateName();
 
4285
+    rtl::OUString sTemplateUrl = xDocProps->getTemplateURL();
 
4286
 
 
4287
-    xTemplate = new SwVbaTemplate( this, mxContext, getModel(), sTemplateName );
 
4288
+    xTemplate = new SwVbaTemplate( this, mxContext, getModel(), sTemplateUrl );
 
4289
     return uno::makeAny( xTemplate );
 
4290
 }
 
4291
 
 
4292
 void SAL_CALL 
 
4293
-SwVbaDocument::setAttachedTemplate( const css::uno::Any& /*_attachedtemplate*/ ) throw (uno::RuntimeException)
 
4294
+SwVbaDocument::setAttachedTemplate( const css::uno::Any& _attachedtemplate ) throw (uno::RuntimeException)
 
4295
 {
 
4296
-    throw uno::RuntimeException();
 
4297
+    rtl::OUString sTemplate;
 
4298
+    if( !( _attachedtemplate >>= sTemplate ) )
 
4299
+    {
 
4300
+        throw uno::RuntimeException();
 
4301
+    }
 
4302
+    rtl::OUString aURL;
 
4303
+    INetURLObject aObj;
 
4304
+    aObj.SetURL( sTemplate );
 
4305
+    bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
 
4306
+    if ( bIsURL )
 
4307
+        aURL = sTemplate;
 
4308
+    else
 
4309
+        osl::FileBase::getFileURLFromSystemPath( sTemplate, aURL );
 
4310
+
 
4311
+    SwDocShell* pDocShell = word::getDocShell( getModel() );
 
4312
+    uno::Reference< word::XTemplate > xTemplate;
 
4313
+    uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( getModel(), uno::UNO_QUERY_THROW );
 
4314
+    uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
 
4315
+    uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
 
4316
+    xDocProps->setTemplateURL( aURL );
 
4317
 }
 
4318
 
 
4319
 uno::Any SAL_CALL 
 
4320
@@ -270,6 +315,116 @@ void SAL_CALL SwVbaDocument::Activate() throw (uno::RuntimeException)
 
4321
     VbaDocumentBase::Activate();
 
4322
 }
 
4323
 
 
4324
+::sal_Int32 SAL_CALL SwVbaDocument::getProtectionType() throw (css::uno::RuntimeException)
 
4325
+{
 
4326
+    //TODO
 
4327
+    return word::WdProtectionType::wdNoProtection;
 
4328
+}
 
4329
+
 
4330
+void SAL_CALL SwVbaDocument::setProtectionType( ::sal_Int32 _protectiontype ) throw (css::uno::RuntimeException)
 
4331
+{
 
4332
+    //TODO
 
4333
+}
 
4334
+
 
4335
+::sal_Bool SAL_CALL SwVbaDocument::getUpdateStylesOnOpen() throw (css::uno::RuntimeException)
 
4336
+{
 
4337
+    //TODO
 
4338
+    return sal_False;
 
4339
+}
 
4340
+
 
4341
+void SAL_CALL SwVbaDocument::setUpdateStylesOnOpen( ::sal_Bool _updatestylesonopen ) throw (uno::RuntimeException)
 
4342
+{
 
4343
+    //TODO
 
4344
+}
 
4345
+
 
4346
+::sal_Bool SAL_CALL SwVbaDocument::getAutoHyphenation() throw (uno::RuntimeException)
 
4347
+{
 
4348
+    // check this property only in default paragraph style
 
4349
+    sal_Bool IsAutoHyphenation = sal_False;
 
4350
+    uno::Reference< beans::XPropertySet > xParaProps( word::getDefaultParagraphStyle( getModel() ), uno::UNO_QUERY_THROW );
 
4351
+    xParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation")) ) >>= IsAutoHyphenation;
 
4352
+    return IsAutoHyphenation;
 
4353
+}
 
4354
+
 
4355
+void SAL_CALL SwVbaDocument::setAutoHyphenation( ::sal_Bool _autohyphenation ) throw (uno::RuntimeException)
 
4356
+{
 
4357
+    //TODO
 
4358
+    uno::Reference< beans::XPropertySet > xParaProps( word::getDefaultParagraphStyle( getModel() ), uno::UNO_QUERY_THROW );
 
4359
+    xParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation")), uno::makeAny( _autohyphenation ) );
 
4360
+}
 
4361
+
 
4362
+::sal_Int32 SAL_CALL SwVbaDocument::getHyphenationZone() throw (uno::RuntimeException)
 
4363
+{
 
4364
+    //TODO
 
4365
+    return 0;
 
4366
+}
 
4367
+
 
4368
+void SAL_CALL SwVbaDocument::setHyphenationZone( ::sal_Int32 _hyphenationzone ) throw (uno::RuntimeException)
 
4369
+{
 
4370
+    //TODO
 
4371
+}
 
4372
+
 
4373
+::sal_Int32 SAL_CALL SwVbaDocument::getConsecutiveHyphensLimit() throw (uno::RuntimeException)
 
4374
+{
 
4375
+    //TODO
 
4376
+    sal_Int16 nHyphensLimit = 0;
 
4377
+    uno::Reference< beans::XPropertySet > xParaProps( word::getDefaultParagraphStyle( getModel() ), uno::UNO_QUERY_THROW );
 
4378
+    xParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaHyphenationMaxHyphens")) ) >>= nHyphensLimit;
 
4379
+    return nHyphensLimit;
 
4380
+}
 
4381
+
 
4382
+void SAL_CALL SwVbaDocument::setConsecutiveHyphensLimit( ::sal_Int32 _consecutivehyphenslimit ) throw (uno::RuntimeException)
 
4383
+{
 
4384
+    sal_Int16 nHyphensLimit = static_cast< sal_Int16 >( _consecutivehyphenslimit );
 
4385
+    uno::Reference< beans::XPropertySet > xParaProps( word::getDefaultParagraphStyle( getModel() ), uno::UNO_QUERY_THROW );
 
4386
+    xParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaHyphenationMaxHyphens")), uno::makeAny( nHyphensLimit ) );
 
4387
+}
 
4388
+
 
4389
+void SAL_CALL SwVbaDocument::Protect( ::sal_Int32 Type, const uno::Any& NOReset, const uno::Any& Password, const uno::Any& UseIRM, const uno::Any& EnforceStyleLock ) throw (uno::RuntimeException)
 
4390
+{
 
4391
+    // Seems not support in Writer
 
4392
+    // VbaDocumentBase::Protect( Password );
 
4393
+}
 
4394
+
 
4395
+void SAL_CALL SwVbaDocument::PrintOut( const uno::Any& Background, const uno::Any& Append, const uno::Any& Range, const uno::Any& OutputFileName, const uno::Any& From, const uno::Any& To, const uno::Any& Item, const uno::Any& Copies, const uno::Any& Pages, const uno::Any& PageType, const uno::Any& PrintToFile, const uno::Any& Collate, const uno::Any& FileName, const uno::Any& ActivePrinterMacGX, const uno::Any& ManualDuplexPrint, const uno::Any& PrintZoomColumn, const uno::Any& PrintZoomRow, const uno::Any& PrintZoomPaperWidth, const uno::Any& PrintZoomPaperHeight ) throw (uno::RuntimeException)
 
4396
+{
 
4397
+    //TODO
 
4398
+}
 
4399
+
 
4400
+void SAL_CALL SwVbaDocument::PrintPreview(  ) throw (uno::RuntimeException)
 
4401
+{
 
4402
+    rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PrintPreview"));
 
4403
+    dispatchRequests( mxModel,url );
 
4404
+}
 
4405
+
 
4406
+void SAL_CALL SwVbaDocument::ClosePrintPreview(  ) throw (uno::RuntimeException)
 
4407
+{
 
4408
+    rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ClosePreview"));
 
4409
+    dispatchRequests( mxModel,url );
 
4410
+}
 
4411
+
 
4412
+uno::Any SAL_CALL
 
4413
+SwVbaDocument::Revisions( const uno::Any& index ) throw (uno::RuntimeException)
 
4414
+{
 
4415
+    uno::Reference< document::XRedlinesSupplier > xRedlinesSupp( mxTextDocument, uno::UNO_QUERY_THROW );
 
4416
+    uno::Reference< container::XIndexAccess > xRedlines( xRedlinesSupp->getRedlines(), uno::UNO_QUERY_THROW );
 
4417
+    uno::Reference< XCollection > xCol( new SwVbaRevisions( this, mxContext, getModel(), xRedlines ) );
 
4418
+    if ( index.hasValue() )
 
4419
+        return xCol->Item( index, uno::Any() );
 
4420
+    return uno::makeAny( xCol );
 
4421
+}
 
4422
+
 
4423
+uno::Any SAL_CALL
 
4424
+SwVbaDocument::Frames( const uno::Any& index ) throw (uno::RuntimeException)
 
4425
+{
 
4426
+    uno::Reference< text::XTextFramesSupplier > xTextFramesSupp( mxTextDocument, uno::UNO_QUERY_THROW );
 
4427
+    uno::Reference< container::XIndexAccess > xFrames( xTextFramesSupp->getTextFrames(), uno::UNO_QUERY_THROW );
 
4428
+    uno::Reference< XCollection > xCol( new SwVbaFrames( this, mxContext, xFrames, getModel() ) );
 
4429
+    if ( index.hasValue() )
 
4430
+        return xCol->Item( index, uno::Any() );
 
4431
+    return uno::makeAny( xCol );
 
4432
+}
 
4433
+
 
4434
 uno::Any
 
4435
 SwVbaDocument::getControlShape( const ::rtl::OUString& sName )
 
4436
 {
 
4437
diff --git sw/source/ui/vba/vbadocument.hxx sw/source/ui/vba/vbadocument.hxx
 
4438
index 651b06c..020ab2b 100644
 
4439
--- sw/source/ui/vba/vbadocument.hxx
 
4440
+++ sw/source/ui/vba/vbadocument.hxx
 
4441
@@ -68,6 +68,25 @@ public:
 
4442
     virtual css::uno::Any SAL_CALL Sections( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
 
4443
        virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
 
4444
     virtual css::uno::Any SAL_CALL PageSetup() throw (css::uno::RuntimeException);
 
4445
+    virtual css::uno::Any SAL_CALL TablesOfContents( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
 
4446
+    virtual css::uno::Any SAL_CALL FormFields( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
 
4447
+    virtual ::sal_Int32 SAL_CALL getProtectionType() throw (css::uno::RuntimeException);
 
4448
+    virtual void SAL_CALL setProtectionType( ::sal_Int32 _protectiontype ) throw (css::uno::RuntimeException);
 
4449
+    virtual ::sal_Bool SAL_CALL getUpdateStylesOnOpen() throw (css::uno::RuntimeException);
 
4450
+    virtual void SAL_CALL setUpdateStylesOnOpen( ::sal_Bool _updatestylesonopen ) throw (css::uno::RuntimeException);
 
4451
+    virtual ::sal_Bool SAL_CALL getAutoHyphenation() throw (css::uno::RuntimeException);
 
4452
+    virtual void SAL_CALL setAutoHyphenation( ::sal_Bool _autohyphenation ) throw (css::uno::RuntimeException);
 
4453
+    virtual ::sal_Int32 SAL_CALL getHyphenationZone() throw (css::uno::RuntimeException);
 
4454
+    virtual void SAL_CALL setHyphenationZone( ::sal_Int32 _hyphenationzone ) throw (css::uno::RuntimeException);
 
4455
+    virtual ::sal_Int32 SAL_CALL getConsecutiveHyphensLimit() throw (css::uno::RuntimeException);
 
4456
+    virtual void SAL_CALL setConsecutiveHyphensLimit( ::sal_Int32 _consecutivehyphenslimit ) throw (css::uno::RuntimeException);
 
4457
+    virtual void SAL_CALL Protect( ::sal_Int32 Type, const css::uno::Any& NOReset, const css::uno::Any& Password, const css::uno::Any& UseIRM, const css::uno::Any& EnforceStyleLock ) throw (css::uno::RuntimeException);
 
4458
+    virtual void SAL_CALL PrintOut( const css::uno::Any& Background, const css::uno::Any& Append, const css::uno::Any& Range, const css::uno::Any& OutputFileName, const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Item, const css::uno::Any& Copies, const css::uno::Any& Pages, const css::uno::Any& PageType, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& FileName, const css::uno::Any& ActivePrinterMacGX, const css::uno::Any& ManualDuplexPrint, const css::uno::Any& PrintZoomColumn, const css::uno::Any& PrintZoomRow, const css::uno::Any& PrintZoomPaperWidth, const css::uno::Any& PrintZoomPaperHeight ) throw (css::uno::RuntimeException);
 
4459
+    virtual void SAL_CALL PrintPreview(  ) throw (css::uno::RuntimeException);
 
4460
+    virtual void SAL_CALL ClosePrintPreview(  ) throw (css::uno::RuntimeException);
 
4461
+    virtual css::uno::Any SAL_CALL Revisions( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
 
4462
+    virtual css::uno::Any SAL_CALL Frames( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
 
4463
+
 
4464
        // XInvocation
 
4465
        virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection(  ) throw (css::uno::RuntimeException);
 
4466
        virtual css::uno::Any SAL_CALL invoke( const ::rtl::OUString& aFunctionName, const css::uno::Sequence< css::uno::Any >& aParams, css::uno::Sequence< ::sal_Int16 >& aOutParamIndex, css::uno::Sequence< css::uno::Any >& aOutParam ) throw (css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException);
 
4467
diff --git sw/source/ui/vba/vbadocumentproperties.cxx sw/source/ui/vba/vbadocumentproperties.cxx
 
4468
index f07b978..dfea425 100644
 
4469
--- sw/source/ui/vba/vbadocumentproperties.cxx
 
4470
+++ sw/source/ui/vba/vbadocumentproperties.cxx
 
4471
@@ -206,16 +206,16 @@ public:
 
4472
     
 
4473
     static DocPropInfo createDocPropInfo( const rtl::OUString& sDesc, const rtl::OUString& sPropName, boost::shared_ptr< PropertGetSetHelper >& rHelper )
 
4474
     {
 
4475
-        return createDocPropInfo( rtl::OUStringToOString( sDesc, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( sPropName, RTL_TEXTENCODING_UTF8 ).getStr(), rHelper );
 
4476
+        DocPropInfo aItem;
 
4477
+        aItem.msMSODesc = sDesc;
 
4478
+        aItem.msOOOPropName = sPropName;
 
4479
+        aItem.mpPropGetSetHelper = rHelper;
 
4480
+        return aItem;
 
4481
     }
 
4482
 
 
4483
     static DocPropInfo createDocPropInfo( const sal_Char* sDesc, const sal_Char* sPropName, boost::shared_ptr< PropertGetSetHelper >& rHelper )
 
4484
     {
 
4485
-        DocPropInfo aItem;
 
4486
-        aItem.msMSODesc = rtl::OUString::createFromAscii( sDesc );
 
4487
-        aItem.msOOOPropName = rtl::OUString::createFromAscii( sPropName );
 
4488
-        aItem.mpPropGetSetHelper = rHelper;
 
4489
-        return aItem;
 
4490
+        return createDocPropInfo( rtl::OUString::createFromAscii( sDesc ), rtl::OUString::createFromAscii( sPropName ), rHelper );
 
4491
     }
 
4492
     uno::Any getValue() 
 
4493
     {
 
4494
diff --git sw/source/ui/vba/vbaeventshelper.cxx sw/source/ui/vba/vbaeventshelper.cxx
 
4495
new file mode 100644
 
4496
index 0000000..384a81f
 
4497
--- /dev/null
 
4498
+++ sw/source/ui/vba/vbaeventshelper.cxx
 
4499
@@ -0,0 +1,169 @@
 
4500
+/*************************************************************************
 
4501
+ *
 
4502
+ *  OpenOffice.org - a multi-platform office productivity suite
 
4503
+ *
 
4504
+ *  $RCSfile: vbaeventshelper.cxx,v $
 
4505
+ *
 
4506
+ *  $Revision: 1.0 $
 
4507
+ *
 
4508
+ *  last change: $Author: vg $ $Date: 2007/12/07 10:42:26 $
 
4509
+ *
 
4510
+ *  The Contents of this file are made available subject to
 
4511
+ *  the terms of GNU Lesser General Public License Version 2.1.
 
4512
+ *
 
4513
+ *
 
4514
+ *    GNU Lesser General Public License Version 2.1
 
4515
+ *    =============================================
 
4516
+ *    Copyright 2005 by Sun Microsystems, Inc.
 
4517
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
 
4518
+ *
 
4519
+ *    This library is free software; you can redistribute it and/or
 
4520
+ *    modify it under the terms of the GNU Lesser General Public
 
4521
+ *    License version 2.1, as published by the Free Software Foundation.
 
4522
+ *
 
4523
+ *    This library is distributed in the hope that it will be useful,
 
4524
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
4525
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
4526
+ *    Lesser General Public License for more details.
 
4527
+ *
 
4528
+ *    You should have received a copy of the GNU Lesser General Public
 
4529
+ *    License along with this library; if not, write to the Free Software
 
4530
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 
4531
+ *    MA  02111-1307  USA
 
4532
+ *
 
4533
+ ************************************************************************/
 
4534
+#include "vbaeventshelper.hxx"
 
4535
+#include <vbahelper/helperdecl.hxx>
 
4536
+#include <sfx2/objsh.hxx> 
 
4537
+#include <comphelper/processfactory.hxx>
 
4538
+#include <cppuhelper/implbase1.hxx>
 
4539
+#include <svx/msvbahelper.hxx>
 
4540
+#include "wordvbahelper.hxx"
 
4541
+
 
4542
+using namespace com::sun::star;
 
4543
+using namespace ooo::vba;
 
4544
+using namespace com::sun::star::document::VbaEventId;
 
4545
+
 
4546
+const static String sThisDocument( RTL_CONSTASCII_USTRINGPARAM("ThisDocument"));
 
4547
+
 
4548
+SwVbaEventsHelper::SwVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArgs, uno::Reference< uno::XComponentContext > const& xContext ) : VbaEventsHelperBase( xContext )
 
4549
+{
 
4550
+    Initilize();
 
4551
+    uno::Reference< frame::XModel > xModel ( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ), uno::UNO_QUERY );
 
4552
+    pDocShell = word::getDocShell( xModel );
 
4553
+}
 
4554
+
 
4555
+SwVbaEventsHelper::~SwVbaEventsHelper()
 
4556
+{
 
4557
+}
 
4558
+
 
4559
+void SwVbaEventsHelper::Initilize()
 
4560
+{
 
4561
+    insert( VBAEVENT_DOCUMENT_NEW, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Document_New") ) );
 
4562
+    insert( VBAEVENT_DOCUMENT_AUTONEW, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoNew") ) );
 
4563
+    insert( VBAEVENT_DOCUMENT_OPEN, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Document_Open") ) );
 
4564
+    insert( VBAEVENT_DOCUMENT_AUTOOPEN, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoOpen") ) );
 
4565
+    insert( VBAEVENT_DOCUMENT_CLOSE, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Document_Close") ) );
 
4566
+}
 
4567
+
 
4568
+rtl::OUString
 
4569
+SwVbaEventsHelper::getMacroPath( const sal_Int32 nEventId )
 
4570
+{
 
4571
+    String sMacroName = getEventName( nEventId );
 
4572
+    VBAMacroResolvedInfo sMacroResolvedInfo;
 
4573
+    switch( nEventId )
 
4574
+    {
 
4575
+        // Document events
 
4576
+        case VBAEVENT_DOCUMENT_NEW:
 
4577
+        case VBAEVENT_DOCUMENT_OPEN:
 
4578
+        case VBAEVENT_DOCUMENT_CLOSE:
 
4579
+        {
 
4580
+            sMacroName.Insert( '.', 0 ).Insert( sThisDocument, 0);
 
4581
+            sMacroResolvedInfo = resolveVBAMacro( pDocShell, sMacroName );
 
4582
+            break;
 
4583
+        }
 
4584
+        case VBAEVENT_DOCUMENT_AUTONEW:
 
4585
+        case VBAEVENT_DOCUMENT_AUTOOPEN:
 
4586
+        {
 
4587
+            sMacroResolvedInfo = resolveVBAMacro( pDocShell, sMacroName );
 
4588
+            break;
 
4589
+        }
 
4590
+        default:
 
4591
+            break;
 
4592
+    }
 
4593
+    return sMacroResolvedInfo.ResolvedMacro();
 
4594
+}
 
4595
+
 
4596
+sal_Bool SwVbaEventsHelper::processVbaEvent( const sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs )
 
4597
+{
 
4598
+    sal_Bool result = sal_False;
 
4599
+    uno::Sequence< uno::Any > aArgs;
 
4600
+    uno::Any aRet;
 
4601
+    uno::Any aDummyCaller;
 
4602
+    
 
4603
+    // For most cases, there is no corresponsible event macro in the document. 
 
4604
+    // It is better fo check if the event macro exists before process the arguments to improve performance.
 
4605
+    rtl::OUString sMacroPath = getMacroPath( nEventId );
 
4606
+    if( sMacroPath.getLength() )
 
4607
+    {
 
4608
+        // excute the macro
 
4609
+        result = executeMacro( pDocShell, sMacroPath, aArgs, aRet, aDummyCaller );
 
4610
+    }
 
4611
+    
 
4612
+    return result;
 
4613
+}
 
4614
+
 
4615
+sal_Bool SAL_CALL 
 
4616
+SwVbaEventsHelper::ProcessCompatibleVbaEvent( sal_Int32 nEventId, const uno::Sequence< uno::Any >& aArgs ) throw (uno::RuntimeException)
 
4617
+{
 
4618
+    if( !pDocShell || mbIgnoreEvents)
 
4619
+        return sal_False;
 
4620
+    
 
4621
+    // In order to better support "withevents" in the future, 
 
4622
+    // it is better to process a event at a time
 
4623
+    switch( nEventId )
 
4624
+    {
 
4625
+        case VBAEVENT_DOCUMENT_NEW:
 
4626
+        {
 
4627
+            processVbaEvent( VBAEVENT_DOCUMENT_AUTONEW, aArgs );
 
4628
+            processVbaEvent( nEventId, aArgs );
 
4629
+            break;
 
4630
+        }
 
4631
+        case VBAEVENT_DOCUMENT_OPEN:
 
4632
+        {
 
4633
+            processVbaEvent( VBAEVENT_DOCUMENT_AUTOOPEN, aArgs );
 
4634
+            processVbaEvent( nEventId, aArgs );
 
4635
+            break;
 
4636
+        }
 
4637
+        case VBAEVENT_DOCUMENT_CLOSE:
 
4638
+        {
 
4639
+            return processVbaEvent( nEventId, aArgs );
 
4640
+        }
 
4641
+        default:
 
4642
+            OSL_TRACE( "Invalid Event" );
 
4643
+    }
 
4644
+
 
4645
+    return sal_True;
 
4646
+}
 
4647
+
 
4648
+::sal_Bool SAL_CALL 
 
4649
+SwVbaEventsHelper::getIgnoreEvents() throw (uno::RuntimeException)
 
4650
+{
 
4651
+    return VbaEventsHelperBase::getIgnoreEvents();
 
4652
+}
 
4653
+
 
4654
+void SAL_CALL 
 
4655
+SwVbaEventsHelper::setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (uno::RuntimeException)
 
4656
+{
 
4657
+    VbaEventsHelperBase::setIgnoreEvents( _ignoreevents );
 
4658
+}
 
4659
+
 
4660
+namespace vbaeventshelper
 
4661
+{
 
4662
+namespace sdecl = comphelper::service_decl;
 
4663
+sdecl::class_<SwVbaEventsHelper, sdecl::with_args<true> > serviceImpl;
 
4664
+extern sdecl::ServiceDecl const serviceDecl(
 
4665
+    serviceImpl,
 
4666
+    "SwVbaEventsHelper",
 
4667
+    "com.sun.star.text.TextDocumentVbaEventsHelper" );
 
4668
+}
 
4669
diff --git sw/source/ui/vba/vbaeventshelper.hxx sw/source/ui/vba/vbaeventshelper.hxx
 
4670
new file mode 100644
 
4671
index 0000000..02dd648
 
4672
--- /dev/null
 
4673
+++ sw/source/ui/vba/vbaeventshelper.hxx
 
4674
@@ -0,0 +1,67 @@
 
4675
+/*************************************************************************
 
4676
+ *
 
4677
+ *  OpenOffice.org - a multi-platform office productivity suite
 
4678
+ *
 
4679
+ *  $RCSfile: vbaeventshelper.hxx,v $
 
4680
+ *
 
4681
+ *  $Revision: 1.0 $
 
4682
+ *
 
4683
+ *  last change: $Author: vg $ $Date: 2007/12/07 10:42:26 $
 
4684
+ *
 
4685
+ *  The Contents of this file are made available subject to
 
4686
+ *  the terms of GNU Lesser General Public License Version 2.1.
 
4687
+ *
 
4688
+ *
 
4689
+ *    GNU Lesser General Public License Version 2.1
 
4690
+ *    =============================================
 
4691
+ *    Copyright 2005 by Sun Microsystems, Inc.
 
4692
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
 
4693
+ *
 
4694
+ *    This library is free software; you can redistribute it and/or
 
4695
+ *    modify it under the terms of the GNU Lesser General Public
 
4696
+ *    License version 2.1, as published by the Free Software Foundation.
 
4697
+ *
 
4698
+ *    This library is distributed in the hope that it will be useful,
 
4699
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
4700
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
4701
+ *    Lesser General Public License for more details.
 
4702
+ *
 
4703
+ *    You should have received a copy of the GNU Lesser General Public
 
4704
+ *    License along with this library; if not, write to the Free Software
 
4705
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 
4706
+ *    MA  02111-1307  USA
 
4707
+ *
 
4708
+ ************************************************************************/
 
4709
+
 
4710
+#ifndef SW_VBAEVENTS_HXX
 
4711
+#define SW_VBAEVENTS_HXX
 
4712
+
 
4713
+#include <cppuhelper/implbase1.hxx>
 
4714
+#include <com/sun/star/document/VbaEventId.hpp>
 
4715
+#include <com/sun/star/document/XVbaEventsHelper.hpp>
 
4716
+#include <vbahelper/vbaeventshelperbase.hxx>
 
4717
+#include <doc.hxx>
 
4718
+#include <docsh.hxx>
 
4719
+
 
4720
+typedef ::cppu::WeakImplHelper1< com::sun::star::document::XVbaEventsHelper > VBADocumentEvent_BASE;
 
4721
+
 
4722
+class SwVbaEventsHelper : public VBADocumentEvent_BASE, public VbaEventsHelperBase
 
4723
+{
 
4724
+private:
 
4725
+    SwDocShell* pDocShell;
 
4726
+
 
4727
+    rtl::OUString getMacroPath( const sal_Int32 nEventId );
 
4728
+    sal_Bool processVbaEvent( const sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs );
 
4729
+    void Initilize();
 
4730
+
 
4731
+public:
 
4732
+    SwVbaEventsHelper( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
 
4733
+    ~SwVbaEventsHelper();
 
4734
+    // XVBAWorkbookEventHelper
 
4735
+    virtual sal_Bool SAL_CALL ProcessCompatibleVbaEvent( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException);
 
4736
+    virtual void SAL_CALL setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (css::uno::RuntimeException);
 
4737
+    virtual ::sal_Bool SAL_CALL getIgnoreEvents() throw (css::uno::RuntimeException);
 
4738
+};
 
4739
+
 
4740
+#endif
 
4741
+
 
4742
diff --git sw/source/ui/vba/vbafield.cxx sw/source/ui/vba/vbafield.cxx
 
4743
index 6effe4d..849f59e 100644
 
4744
--- sw/source/ui/vba/vbafield.cxx
 
4745
+++ sw/source/ui/vba/vbafield.cxx
 
4746
@@ -36,6 +36,7 @@
 
4747
 #include <ooo/vba/word/WdFieldType.hpp>
 
4748
 #include <com/sun/star/text/FilenameDisplayFormat.hpp>
 
4749
 #include <com/sun/star/util/XRefreshable.hpp>
 
4750
+#include <com/sun/star/util/XUpdatable.hpp>
 
4751
 #include <swtypes.hxx>
 
4752
 
 
4753
 using namespace ::ooo::vba;
 
4754
@@ -48,6 +49,17 @@ SwVbaField::SwVbaField(  const uno::Reference< ooo::vba::XHelperInterface >& rPa
 
4755
     mxTextField.set( xTextField, uno::UNO_QUERY_THROW );
 
4756
 }
 
4757
 
 
4758
+sal_Bool SAL_CALL SwVbaField::Update() throw (uno::RuntimeException)
 
4759
+{
 
4760
+    uno::Reference< util::XUpdatable > xUpdatable( mxTextField, uno::UNO_QUERY );
 
4761
+    if( xUpdatable.is() )
 
4762
+    {
 
4763
+        xUpdatable->update();
 
4764
+        return sal_True;
 
4765
+    }
 
4766
+    return sal_False;
 
4767
+}
 
4768
+
 
4769
 // XHelperInterface
 
4770
 rtl::OUString& 
 
4771
 SwVbaField::getServiceImplName()
 
4772
@@ -371,6 +383,7 @@ SwVbaFields::Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range,
 
4773
     {
 
4774
         _ReadFieldParams aReadParam(sText);
 
4775
         sFieldName = aReadParam.GetFieldName();
 
4776
+        OSL_TRACE("SwVbaFields::Add, the field name is %s ",rtl::OUStringToOString( sFieldName, RTL_TEXTENCODING_UTF8 ).getStr() );
 
4777
     }
 
4778
 
 
4779
     uno::Reference< text::XTextContent > xTextField;
 
4780
@@ -378,6 +391,10 @@ SwVbaFields::Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range,
 
4781
     {
 
4782
         xTextField.set( Create_Field_FileName( sText ), uno::UNO_QUERY_THROW );
 
4783
     }
 
4784
+    else if( nType == word::WdFieldType::wdFieldDocProperty || sFieldName.EqualsIgnoreCaseAscii("DOCPROPERTY") )
 
4785
+    {
 
4786
+        xTextField.set( Create_Field_DocProperty( sText ), uno::UNO_QUERY_THROW );
 
4787
+    }    
 
4788
     else
 
4789
     {
 
4790
         throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
4791
@@ -422,6 +439,104 @@ uno::Reference< text::XTextField > SwVbaFields::Create_Field_FileName( const rtl
 
4792
     return xTextField;
 
4793
 }
 
4794
 
 
4795
+struct DocPropertyTable
 
4796
+{
 
4797
+    const char* sDocPropertyName;
 
4798
+    const char* sFieldService;
 
4799
+};
 
4800
+
 
4801
+static const DocPropertyTable aDocPropertyTables[] = 
 
4802
+{ 
 
4803
+    { "Author", "com.sun.star.text.textfield.docinfo.CreateAuthor" }, 
 
4804
+    { "Bytes", NULL },
 
4805
+    { "Category", NULL },
 
4806
+    { "Characters",NULL },
 
4807
+    { "CharactersWithSpaces", NULL },
 
4808
+    { "Comments", "com.sun.star.text.textfield.docinfo.Description" },
 
4809
+    { "Company", NULL },
 
4810
+    { "CreateTime", "com.sun.star.text.textfield.docinfo.CreateDateTime" },
 
4811
+    { "HyperlinkBase", NULL },
 
4812
+    { "Keywords", "com.sun.star.text.textfield.docinfo.Keywords" },
 
4813
+    { "LastPrinted", "com.sun.star.text.textfield.docinfo.PrintDateTime" },
 
4814
+    { "LastSavedBy", "com.sun.star.text.textfield.docinfo.ChangeAuthor" },
 
4815
+    { "LastSavedTime", "com.sun.star.text.textfield.docinfo.ChangeDateTime" },
 
4816
+    { "Lines", NULL },
 
4817
+    { "Manager", NULL },
 
4818
+    { "NameofApplication", NULL },
 
4819
+    { "ODMADocID", NULL },
 
4820
+    { "Pages", "com.sun.star.text.textfield.PageCount" },
 
4821
+    { "Paragraphs", "com.sun.star.text.textfield.ParagraphCount" },
 
4822
+    { "RevisionNumber", "com.sun.star.text.textfield.docinfo.Revision" },
 
4823
+    { "Security", NULL },
 
4824
+    { "Subject", "com.sun.star.text.textfield.docinfo.Subject" },
 
4825
+    { "Template", "com.sun.star.text.textfield.TemplateName" },
 
4826
+    { "Title", "com.sun.star.text.textfield.docinfo.Title" },
 
4827
+    { "TotalEditingTime", "com.sun.star.text.textfield.docinfo.EditTime" },
 
4828
+    { "Words", "com.sun.star.text.textfield.WordCount" },
 
4829
+    { NULL, NULL }
 
4830
+};
 
4831
+
 
4832
+uno::Reference< text::XTextField > SwVbaFields::Create_Field_DocProperty( const rtl::OUString _text ) throw (uno::RuntimeException)
 
4833
+{
 
4834
+    String aDocProperty;
 
4835
+    _ReadFieldParams aReadParam( _text );
 
4836
+    long nRet;
 
4837
+    while( -1 != ( nRet = aReadParam.SkipToNextToken() ))
 
4838
+    {
 
4839
+        switch( nRet )
 
4840
+        {
 
4841
+            case -2:
 
4842
+                if( !aDocProperty.Len() )
 
4843
+                    aDocProperty = aReadParam.GetResult();
 
4844
+                break;
 
4845
+            case '*':
 
4846
+                //Skip over MERGEFORMAT
 
4847
+                aReadParam.SkipToNextToken();
 
4848
+                break;
 
4849
+        }
 
4850
+    }
 
4851
+    aDocProperty.EraseAllChars('"');
 
4852
+    OSL_TRACE("SwVbaFields::Create_Field_DocProperty, the document property name is %s ",rtl::OUStringToOString( aDocProperty, RTL_TEXTENCODING_UTF8 ).getStr() );
 
4853
+    if( aDocProperty.Len() == 0 )
 
4854
+    {
 
4855
+        throw uno::RuntimeException();
 
4856
+    }
 
4857
+
 
4858
+    sal_Bool bCustom = sal_True;
 
4859
+    rtl::OUString sFieldService;
 
4860
+    // find the build in document properties
 
4861
+    for( const DocPropertyTable* pTable = aDocPropertyTables; pTable->sDocPropertyName != NULL; pTable++ )
 
4862
+    {
 
4863
+        if( aDocProperty.EqualsIgnoreCaseAscii( pTable->sDocPropertyName ) )
 
4864
+        {
 
4865
+            if( pTable->sFieldService != NULL )
 
4866
+                sFieldService = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( pTable->sFieldService ) );
 
4867
+            bCustom = sal_False;
 
4868
+            break;
 
4869
+        }
 
4870
+    }
 
4871
+
 
4872
+    if( bCustom )
 
4873
+    {
 
4874
+        sFieldService = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.textfield.docinfo.Custom" ) );
 
4875
+    }    
 
4876
+    else if( sFieldService.getLength() == 0 )
 
4877
+    {
 
4878
+        throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
4879
+    }
 
4880
+
 
4881
+    uno::Reference< text::XTextField > xTextField( mxMSF->createInstance( sFieldService ), uno::UNO_QUERY_THROW );
 
4882
+
 
4883
+    if( bCustom )
 
4884
+    {
 
4885
+        uno::Reference< beans::XPropertySet > xProps( xTextField, uno::UNO_QUERY_THROW );
 
4886
+        rtl::OUString sDocPropertyName( aDocProperty );
 
4887
+        xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ), uno::makeAny( sDocPropertyName ) );
 
4888
+    }
 
4889
+    
 
4890
+    return xTextField;
 
4891
+}
 
4892
+
 
4893
 uno::Reference< container::XEnumeration > SAL_CALL 
 
4894
 SwVbaFields::createEnumeration() throw (uno::RuntimeException)
 
4895
 {
 
4896
diff --git sw/source/ui/vba/vbafield.hxx sw/source/ui/vba/vbafield.hxx
 
4897
index ab28416..9ec21b3 100644
 
4898
--- sw/source/ui/vba/vbafield.hxx
 
4899
+++ sw/source/ui/vba/vbafield.hxx
 
4900
@@ -44,7 +44,8 @@ class SwVbaField : public SwVbaField_BASE
 
4901
     css::uno::Reference< css::text::XTextField > mxTextField;
 
4902
 public:
 
4903
     SwVbaField( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const css::uno::Reference< css::text::XTextField >& xTextField) throw ( css::uno::RuntimeException);
 
4904
-
 
4905
+  
 
4906
+    virtual sal_Bool SAL_CALL Update() throw ( css::uno::RuntimeException);
 
4907
     // XHelperInterface
 
4908
     virtual rtl::OUString& getServiceImplName();
 
4909
     virtual css::uno::Sequence<rtl::OUString> getServiceNames();  
 
4910
@@ -60,6 +61,7 @@ class SwVbaFields : public SwVbaFields_BASE
 
4911
     css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF;
 
4912
 private:
 
4913
     css::uno::Reference< css::text::XTextField > Create_Field_FileName( const rtl::OUString _text ) throw (css::uno::RuntimeException);
 
4914
+    css::uno::Reference< css::text::XTextField > Create_Field_DocProperty( const rtl::OUString _text ) throw (css::uno::RuntimeException);
 
4915
 
 
4916
 public:
 
4917
     SwVbaFields( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel );
 
4918
diff --git sw/source/ui/vba/vbaformfield.cxx sw/source/ui/vba/vbaformfield.cxx
 
4919
new file mode 100644
 
4920
index 0000000..944ffbb
 
4921
--- /dev/null
 
4922
+++ sw/source/ui/vba/vbaformfield.cxx
 
4923
@@ -0,0 +1,139 @@
 
4924
+/*************************************************************************
 
4925
+ *
 
4926
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
4927
+ * 
 
4928
+ * Copyright 2008 by Sun Microsystems, Inc.
 
4929
+ *
 
4930
+ * OpenOffice.org - a multi-platform office productivity suite
 
4931
+ *
 
4932
+ * $RCSfile: 
 
4933
+ * $Revision: 
 
4934
+ *
 
4935
+ * This file is part of OpenOffice.org.
 
4936
+ *
 
4937
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
4938
+ * it under the terms of the GNU Lesser General Public License version 3
 
4939
+ * only, as published by the Free Software Foundation.
 
4940
+ *
 
4941
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
4942
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
4943
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
4944
+ * GNU Lesser General Public License version 3 for more details
 
4945
+ * (a copy is included in the LICENSE file that accompanied this code).
 
4946
+ *
 
4947
+ * You should have received a copy of the GNU Lesser General Public License
 
4948
+ * version 3 along with OpenOffice.org.  If not, see
 
4949
+ * <http://www.openoffice.org/license.html>
 
4950
+ * for a copy of the LGPLv3 License.
 
4951
+ *
 
4952
+ ************************************************************************/
 
4953
+#include "vbaformfield.hxx"
 
4954
+#include <vbahelper/vbahelper.hxx>
 
4955
+#include <tools/diagnose_ex.h>
 
4956
+#include <com/sun/star/text/XTextDocument.hpp>
 
4957
+#include <com/sun/star/text/XTextContent.hpp>
 
4958
+#include <com/sun/star/text/XTextViewCursor.hpp>
 
4959
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
 
4960
+#include <ecmaflds.hxx>
 
4961
+#include "vbacheckbox.hxx"
 
4962
+
 
4963
+using namespace ::ooo::vba;
 
4964
+using namespace ::com::sun::star;
 
4965
+
 
4966
+SwVbaFormField::SwVbaFormField( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& rModel, const uno::Reference< text::XFormField >& xFormField ) throw ( uno::RuntimeException ) : SwVbaFormField_BASE( rParent, rContext ), mxModel( rModel ), mxFormField( xFormField )
 
4967
+{
 
4968
+}
 
4969
+
 
4970
+SwVbaFormField::~SwVbaFormField()
 
4971
+{
 
4972
+}
 
4973
+
 
4974
+rtl::OUString SAL_CALL SwVbaFormField::getResult() throw ( uno::RuntimeException )
 
4975
+{
 
4976
+    rtl::OUString sResult;
 
4977
+    rtl::OUString sType = mxFormField->getFieldType();
 
4978
+    if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMTEXT ) )
 
4979
+    {
 
4980
+        uno::Reference< text::XTextContent > xTextContent( mxFormField, uno::UNO_QUERY_THROW );
 
4981
+        uno::Reference< text::XTextRange > xTextRange = xTextContent->getAnchor();
 
4982
+        sResult = xTextRange->getString();
 
4983
+    }
 
4984
+    else if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX ) )
 
4985
+    {
 
4986
+        sal_Int32 nValue = 0;
 
4987
+        sal_Int32 nCount = mxFormField->getParamCount();
 
4988
+        for( sal_Int32 i = 0; i < nCount; i++ )
 
4989
+        {
 
4990
+            if( mxFormField->getParamName(i).equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX_CHECKED ) )
 
4991
+            {
 
4992
+                if( mxFormField->getParamValue(i).equalsIgnoreAsciiCaseAscii("on") )
 
4993
+                    nValue = 1;
 
4994
+                else
 
4995
+                    nValue = 0;
 
4996
+                break;    
 
4997
+            }
 
4998
+
 
4999
+        }
 
5000
+        sResult = rtl::OUString::valueOf( nValue );
 
5001
+    }
 
5002
+    else
 
5003
+    {
 
5004
+        throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
5005
+    }
 
5006
+    return sResult;
 
5007
+}
 
5008
+
 
5009
+void SAL_CALL SwVbaFormField::setResult( const rtl::OUString& result ) throw ( uno::RuntimeException )
 
5010
+{
 
5011
+    rtl::OUString sType = mxFormField->getFieldType();
 
5012
+    if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMTEXT ) )
 
5013
+    {
 
5014
+        uno::Reference< text::XTextContent > xTextContent( mxFormField, uno::UNO_QUERY_THROW );
 
5015
+        uno::Reference< text::XTextRange > xTextRange = xTextContent->getAnchor();
 
5016
+        xTextRange->setString( result );
 
5017
+    }
 
5018
+    else if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX ) )
 
5019
+    {
 
5020
+        // do nothing
 
5021
+    }
 
5022
+    else
 
5023
+    {
 
5024
+        throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
5025
+    }
 
5026
+}
 
5027
+
 
5028
+sal_Bool SAL_CALL SwVbaFormField::getEnabled() throw ( uno::RuntimeException )
 
5029
+{
 
5030
+    //allways return true
 
5031
+    return sal_True;
 
5032
+}
 
5033
+
 
5034
+void SAL_CALL SwVbaFormField::setEnabled( sal_Bool/* enabled */ ) throw ( uno::RuntimeException )
 
5035
+{
 
5036
+    // not support in Writer
 
5037
+}
 
5038
+
 
5039
+uno::Any SAL_CALL SwVbaFormField::CheckBox() throw ( uno::RuntimeException )
 
5040
+{
 
5041
+    return uno::makeAny( uno::Reference< word::XCheckBox >( new SwVbaCheckBox( this, mxContext, mxModel, mxFormField ) ) );
 
5042
+}
 
5043
+
 
5044
+rtl::OUString& 
 
5045
+SwVbaFormField::getServiceImplName()
 
5046
+{
 
5047
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFormField") );
 
5048
+    return sImplName;
 
5049
+}
 
5050
+
 
5051
+uno::Sequence< rtl::OUString > 
 
5052
+SwVbaFormField::getServiceNames()
 
5053
+{
 
5054
+    static uno::Sequence< rtl::OUString > aServiceNames;
 
5055
+    if ( aServiceNames.getLength() == 0 )
 
5056
+    {
 
5057
+        aServiceNames.realloc( 1 );
 
5058
+        aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.FormField" ) );
 
5059
+    }
 
5060
+    return aServiceNames;
 
5061
+}
 
5062
+
 
5063
diff --git sw/source/ui/vba/vbaformfield.hxx sw/source/ui/vba/vbaformfield.hxx
 
5064
new file mode 100644
 
5065
index 0000000..e3a2d7f
 
5066
--- /dev/null
 
5067
+++ sw/source/ui/vba/vbaformfield.hxx
 
5068
@@ -0,0 +1,61 @@
 
5069
+/*************************************************************************
 
5070
+ *
 
5071
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
5072
+ * 
 
5073
+ * Copyright 2008 by Sun Microsystems, Inc.
 
5074
+ *
 
5075
+ * OpenOffice.org - a multi-platform office productivity suite
 
5076
+ *
 
5077
+ * $RCSfile: 
 
5078
+ * $Revision: 
 
5079
+ *
 
5080
+ * This file is part of OpenOffice.org.
 
5081
+ *
 
5082
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
5083
+ * it under the terms of the GNU Lesser General Public License version 3
 
5084
+ * only, as published by the Free Software Foundation.
 
5085
+ *
 
5086
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
5087
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
5088
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
5089
+ * GNU Lesser General Public License version 3 for more details
 
5090
+ * (a copy is included in the LICENSE file that accompanied this code).
 
5091
+ *
 
5092
+ * You should have received a copy of the GNU Lesser General Public License
 
5093
+ * version 3 along with OpenOffice.org.  If not, see
 
5094
+ * <http://www.openoffice.org/license.html>
 
5095
+ * for a copy of the LGPLv3 License.
 
5096
+ *
 
5097
+ ************************************************************************/
 
5098
+#ifndef SW_VBA_FORMFIELD_HXX
 
5099
+#define SW_VBA_FORMFIELD_HXX
 
5100
+
 
5101
+#include <ooo/vba/word/XFormField.hpp>
 
5102
+#include <cppuhelper/implbase1.hxx>
 
5103
+#include <com/sun/star/text/XFormField.hpp>
 
5104
+#include <vbahelper/vbahelperinterface.hxx>
 
5105
+
 
5106
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XFormField > SwVbaFormField_BASE;
 
5107
+
 
5108
+class SwVbaFormField : public SwVbaFormField_BASE
 
5109
+{
 
5110
+private:
 
5111
+    css::uno::Reference< css::frame::XModel > mxModel;
 
5112
+    css::uno::Reference< css::text::XFormField > mxFormField;
 
5113
+
 
5114
+public:
 
5115
+    SwVbaFormField( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const css::uno::Reference< css::text::XFormField >& xFormField ) throw ( css::uno::RuntimeException );
 
5116
+    virtual ~SwVbaFormField();
 
5117
+
 
5118
+    // Methods
 
5119
+    rtl::OUString SAL_CALL getResult() throw ( css::uno::RuntimeException );
 
5120
+    void SAL_CALL setResult( const rtl::OUString& result ) throw ( css::uno::RuntimeException );
 
5121
+    sal_Bool SAL_CALL getEnabled() throw ( css::uno::RuntimeException );
 
5122
+    void SAL_CALL setEnabled( sal_Bool enabled ) throw ( css::uno::RuntimeException );
 
5123
+    css::uno::Any SAL_CALL CheckBox() throw ( css::uno::RuntimeException );
 
5124
+
 
5125
+    // XHelperInterface
 
5126
+    virtual rtl::OUString& getServiceImplName();
 
5127
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
5128
+};
 
5129
+#endif /* SW_VBA_FORMFIELD_HXX */
 
5130
diff --git sw/source/ui/vba/vbaformfields.cxx sw/source/ui/vba/vbaformfields.cxx
 
5131
new file mode 100644
 
5132
index 0000000..b56cff8
 
5133
--- /dev/null
 
5134
+++ sw/source/ui/vba/vbaformfields.cxx
 
5135
@@ -0,0 +1,205 @@
 
5136
+/*************************************************************************
 
5137
+ *
 
5138
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
5139
+ * 
 
5140
+ * Copyright 2008 by Sun Microsystems, Inc.
 
5141
+ *
 
5142
+ * OpenOffice.org - a multi-platform office productivity suite
 
5143
+ *
 
5144
+ * $RCSfile: 
 
5145
+ * $Revision: 
 
5146
+ *
 
5147
+ * This file is part of OpenOffice.org.
 
5148
+ *
 
5149
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
5150
+ * it under the terms of the GNU Lesser General Public License version 3
 
5151
+ * only, as published by the Free Software Foundation.
 
5152
+ *
 
5153
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
5154
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
5155
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
5156
+ * GNU Lesser General Public License version 3 for more details
 
5157
+ * (a copy is included in the LICENSE file that accompanied this code).
 
5158
+ *
 
5159
+ * You should have received a copy of the GNU Lesser General Public License
 
5160
+ * version 3 along with OpenOffice.org.  If not, see
 
5161
+ * <http://www.openoffice.org/license.html>
 
5162
+ * for a copy of the LGPLv3 License.
 
5163
+ *
 
5164
+ ************************************************************************/
 
5165
+#include "vbaformfields.hxx"
 
5166
+#include "vbaformfield.hxx"
 
5167
+#include <com/sun/star/container/XNamed.hpp>
 
5168
+#include <com/sun/star/text/XTextDocument.hpp>
 
5169
+#include <com/sun/star/text/XTextViewCursor.hpp>
 
5170
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
 
5171
+#include "wordvbahelper.hxx"
 
5172
+#include <cppuhelper/implbase3.hxx>
 
5173
+
 
5174
+using namespace ::ooo::vba;
 
5175
+using namespace ::com::sun::star;
 
5176
+
 
5177
+typedef std::vector< uno::Reference< text::XFormField > > XFormFieldVec;
 
5178
+typedef ::cppu::WeakImplHelper1< container::XEnumeration > FormFiledEnumeration_BASE;
 
5179
+typedef ::cppu::WeakImplHelper3< container::XNameAccess, container::XIndexAccess, container::XEnumerationAccess > FormFieldCollectionHelper_BASE;
 
5180
+
 
5181
+rtl::OUString lcl_getFormFieldName( const uno::Reference< text::XFormField >& xFormField )
 
5182
+{
 
5183
+    rtl::OUString sName;
 
5184
+    sal_Int32 nCount = xFormField->getParamCount();
 
5185
+    for( sal_Int32 i = 0; i < nCount; i++ )
 
5186
+    {
 
5187
+        if( xFormField->getParamName(i).equalsIgnoreAsciiCaseAscii( "Name" ) )
 
5188
+        {
 
5189
+            sName = xFormField->getParamValue(i);
 
5190
+            OSL_TRACE("lcl_getFormFieldName: %s", rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() );
 
5191
+            break;
 
5192
+        }
 
5193
+    }
 
5194
+    return sName;
 
5195
+}
 
5196
+
 
5197
+class FormFieldsEnumeration : public FormFiledEnumeration_BASE
 
5198
+{
 
5199
+private:
 
5200
+    uno::Reference< XHelperInterface > mxParent;
 
5201
+    uno::Reference< uno::XComponentContext > mxContext;
 
5202
+    uno::Reference< frame::XModel > mxModel;
 
5203
+    XFormFieldVec mxFormFields;
 
5204
+    XFormFieldVec::iterator cachePos;
 
5205
+public:
 
5206
+    FormFieldsEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const XFormFieldVec& xFormFiels ) throw (uno::RuntimeException) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ), mxFormFields( xFormFiels ), cachePos( mxFormFields.begin() )
 
5207
+    {
 
5208
+    }
 
5209
+    virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException)
 
5210
+    {
 
5211
+        return ( cachePos != mxFormFields.end() );
 
5212
+    }
 
5213
+
 
5214
+    virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) 
 
5215
+    { 
 
5216
+        if ( !hasMoreElements() )
 
5217
+            throw container::NoSuchElementException();
 
5218
+        uno::Reference< text::XFormField > xFormField( *cachePos++ );    
 
5219
+        return uno::makeAny( uno::Reference< word::XFormField > ( new SwVbaFormField( mxParent, mxContext, mxModel, xFormField ) ) );
 
5220
+    }
 
5221
+
 
5222
+};
 
5223
+
 
5224
+class FormFieldCollectionHelper : public FormFieldCollectionHelper_BASE
 
5225
+{
 
5226
+private:
 
5227
+    uno::Reference< XHelperInterface > mxParent;
 
5228
+    uno::Reference< uno::XComponentContext > mxContext;
 
5229
+    uno::Reference< frame::XModel > mxModel;
 
5230
+    XFormFieldVec mxFormFields;
 
5231
+    XFormFieldVec::iterator cachePos;
 
5232
+public:
 
5233
+    FormFieldCollectionHelper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel )
 
5234
+    {
 
5235
+        uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( xModel,uno::UNO_QUERY_THROW );
 
5236
+        uno::Reference< container::XIndexAccess > xIndexAccess( xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY_THROW );
 
5237
+        sal_Int32 nCount = xIndexAccess->getCount();
 
5238
+        for( sal_Int32 i = 0; i < nCount; i++ )
 
5239
+        {
 
5240
+            uno::Reference< text::XFormField > xFormField( xIndexAccess->getByIndex( i ), uno::UNO_QUERY );
 
5241
+            if( xFormField.is() )
 
5242
+                mxFormFields.push_back( xFormField );
 
5243
+        }
 
5244
+        cachePos = mxFormFields.begin();
 
5245
+    }
 
5246
+    // XElementAccess
 
5247
+    virtual uno::Type SAL_CALL getElementType(  ) throw (uno::RuntimeException) { return  word::XFormField::static_type(0); }
 
5248
+    virtual ::sal_Bool SAL_CALL hasElements(  ) throw (uno::RuntimeException) { return getCount() > 0 ; }
 
5249
+    // XNameAcess 
 
5250
+    virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
 
5251
+    {
 
5252
+        if ( !hasByName(aName) )
 
5253
+            throw container::NoSuchElementException();
 
5254
+        uno::Reference< text::XFormField > xFormField( *cachePos, uno::UNO_QUERY_THROW );
 
5255
+        return uno::makeAny( uno::Reference< word::XFormField >( new SwVbaFormField( mxParent, mxContext, mxModel, xFormField ) ) );
 
5256
+    }
 
5257
+    virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw (uno::RuntimeException)
 
5258
+    {
 
5259
+        uno::Sequence< rtl::OUString > sNames( mxFormFields.size() );
 
5260
+        rtl::OUString* pString = sNames.getArray();
 
5261
+        XFormFieldVec::iterator it = mxFormFields.begin();
 
5262
+        XFormFieldVec::iterator it_end = mxFormFields.end();
 
5263
+        for ( ; it != it_end; ++it, ++pString )
 
5264
+        {
 
5265
+            uno::Reference< text::XFormField > xFormField( *cachePos, uno::UNO_QUERY_THROW );
 
5266
+            *pString =  lcl_getFormFieldName( xFormField );
 
5267
+        }
 
5268
+        return sNames;
 
5269
+    }
 
5270
+    virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
 
5271
+    {
 
5272
+        cachePos = mxFormFields.begin();
 
5273
+        XFormFieldVec::iterator it_end = mxFormFields.end();
 
5274
+        for ( ; cachePos != it_end; ++cachePos )
 
5275
+        {
 
5276
+            //uno::Reference< container::XNamed > xName( *cachePos, uno::UNO_QUERY_THROW );
 
5277
+            uno::Reference< text::XFormField > xFormField( *cachePos, uno::UNO_QUERY_THROW );
 
5278
+            if ( aName.equalsIgnoreAsciiCase( lcl_getFormFieldName( xFormField )) )
 
5279
+                break;
 
5280
+        }
 
5281
+        return ( cachePos != it_end );
 
5282
+    }
 
5283
+    // XIndexAccess
 
5284
+    virtual ::sal_Int32 SAL_CALL getCount(  ) throw (uno::RuntimeException)
 
5285
+    {
 
5286
+        return mxFormFields.size();
 
5287
+    }
 
5288
+    virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
 
5289
+    {
 
5290
+        if ( Index < 0 || Index >= getCount() )
 
5291
+            throw lang::IndexOutOfBoundsException();
 
5292
+        return uno::makeAny( uno::Reference< word::XFormField >( new SwVbaFormField( mxParent, mxContext, mxModel, mxFormFields[ Index ] ) ) );
 
5293
+    }
 
5294
+    // XEnumerationAccess
 
5295
+    virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration(  ) throw (uno::RuntimeException)
 
5296
+    {
 
5297
+        return new FormFieldsEnumeration( mxParent, mxContext, mxModel, mxFormFields );
 
5298
+    }
 
5299
+};
 
5300
+
 
5301
+SwVbaFormFields::SwVbaFormFields( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ): SwVbaFormFields_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new FormFieldCollectionHelper( xParent, xContext, xModel ) ) ), mxModel( xModel ) 
 
5302
+{
 
5303
+}
 
5304
+// XEnumerationAccess
 
5305
+uno::Type
 
5306
+SwVbaFormFields::getElementType() throw (uno::RuntimeException)
 
5307
+{
 
5308
+    return word::XFormField::static_type(0);
 
5309
+}
 
5310
+uno::Reference< container::XEnumeration >
 
5311
+SwVbaFormFields::createEnumeration() throw (uno::RuntimeException)
 
5312
+{
 
5313
+    uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
 
5314
+    return xEnumAccess->createEnumeration();
 
5315
+}
 
5316
+
 
5317
+uno::Any
 
5318
+SwVbaFormFields::createCollectionObject( const css::uno::Any& aSource )
 
5319
+{
 
5320
+    return aSource;
 
5321
+}
 
5322
+
 
5323
+rtl::OUString& 
 
5324
+SwVbaFormFields::getServiceImplName()
 
5325
+{
 
5326
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFormFields") );
 
5327
+    return sImplName;
 
5328
+}
 
5329
+
 
5330
+css::uno::Sequence<rtl::OUString> 
 
5331
+SwVbaFormFields::getServiceNames()
 
5332
+{
 
5333
+    static uno::Sequence< rtl::OUString > sNames;
 
5334
+    if ( sNames.getLength() == 0 )
 
5335
+    {
 
5336
+        sNames.realloc( 1 );
 
5337
+        sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.FormFields") );
 
5338
+    }
 
5339
+    return sNames;
 
5340
+}
 
5341
diff --git sw/source/ui/vba/vbaformfields.hxx sw/source/ui/vba/vbaformfields.hxx
 
5342
new file mode 100644
 
5343
index 0000000..76ef6bb
 
5344
--- /dev/null
 
5345
+++ sw/source/ui/vba/vbaformfields.hxx
 
5346
@@ -0,0 +1,60 @@
 
5347
+/*************************************************************************
 
5348
+ *
 
5349
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
5350
+ * 
 
5351
+ * Copyright 2008 by Sun Microsystems, Inc.
 
5352
+ *
 
5353
+ * OpenOffice.org - a multi-platform office productivity suite
 
5354
+ *
 
5355
+ * $RCSfile: 
 
5356
+ * $Revision: 
 
5357
+ *
 
5358
+ * This file is part of OpenOffice.org.
 
5359
+ *
 
5360
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
5361
+ * it under the terms of the GNU Lesser General Public License version 3
 
5362
+ * only, as published by the Free Software Foundation.
 
5363
+ *
 
5364
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
5365
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
5366
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
5367
+ * GNU Lesser General Public License version 3 for more details
 
5368
+ * (a copy is included in the LICENSE file that accompanied this code).
 
5369
+ *
 
5370
+ * You should have received a copy of the GNU Lesser General Public License
 
5371
+ * version 3 along with OpenOffice.org.  If not, see
 
5372
+ * <http://www.openoffice.org/license.html>
 
5373
+ * for a copy of the LGPLv3 License.
 
5374
+ *
 
5375
+ ************************************************************************/
 
5376
+#ifndef SW_VBA_FORMFIELDS_HXX
 
5377
+#define SW_VBA_FORMFIELDS_HXX
 
5378
+
 
5379
+#include <vbahelper/vbacollectionimpl.hxx>
 
5380
+#include <ooo/vba/word/XFormFields.hpp>
 
5381
+#include <vbahelper/vbahelperinterface.hxx>
 
5382
+#include <com/sun/star/text/XBookmarksSupplier.hpp>
 
5383
+#include <com/sun/star/text/XTextRange.hpp>
 
5384
+
 
5385
+typedef CollTestImplHelper< ooo::vba::word::XFormFields > SwVbaFormFields_BASE;
 
5386
+
 
5387
+class SwVbaFormFields : public SwVbaFormFields_BASE
 
5388
+{
 
5389
+private:
 
5390
+    css::uno::Reference< css::frame::XModel > mxModel;
 
5391
+
 
5392
+public:
 
5393
+    SwVbaFormFields( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel );
 
5394
+    virtual ~SwVbaFormFields() {}
 
5395
+
 
5396
+    // XEnumerationAccess
 
5397
+    virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
 
5398
+    virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
 
5399
+
 
5400
+    // SwVbaFormFields_BASE
 
5401
+    virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); 
 
5402
+    virtual rtl::OUString& getServiceImplName();
 
5403
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
5404
+};    
 
5405
+
 
5406
+#endif /* SW_VBA_FORMFIELDS_HXX */
 
5407
diff --git sw/source/ui/vba/vbaframe.cxx sw/source/ui/vba/vbaframe.cxx
 
5408
new file mode 100644
 
5409
index 0000000..bec1aa6
 
5410
--- /dev/null
 
5411
+++ sw/source/ui/vba/vbaframe.cxx
 
5412
@@ -0,0 +1,75 @@
 
5413
+/*************************************************************************
 
5414
+ *
 
5415
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
5416
+ * 
 
5417
+ * Copyright 2008 by Sun Microsystems, Inc.
 
5418
+ *
 
5419
+ * OpenOffice.org - a multi-platform office productivity suite
 
5420
+ *
 
5421
+ * $RCSfile: 
 
5422
+ * $Revision: 
 
5423
+ *
 
5424
+ * This file is part of OpenOffice.org.
 
5425
+ *
 
5426
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
5427
+ * it under the terms of the GNU Lesser General Public License version 3
 
5428
+ * only, as published by the Free Software Foundation.
 
5429
+ *
 
5430
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
5431
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
5432
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
5433
+ * GNU Lesser General Public License version 3 for more details
 
5434
+ * (a copy is included in the LICENSE file that accompanied this code).
 
5435
+ *
 
5436
+ * You should have received a copy of the GNU Lesser General Public License
 
5437
+ * version 3 along with OpenOffice.org.  If not, see
 
5438
+ * <http://www.openoffice.org/license.html>
 
5439
+ * for a copy of the LGPLv3 License.
 
5440
+ *
 
5441
+ ************************************************************************/
 
5442
+#include "vbaframe.hxx"
 
5443
+#include <vbahelper/vbahelper.hxx>
 
5444
+#include <tools/diagnose_ex.h>
 
5445
+#include <com/sun/star/text/XTextDocument.hpp>
 
5446
+#include <com/sun/star/text/XTextContent.hpp>
 
5447
+#include <com/sun/star/text/XTextViewCursor.hpp>
 
5448
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
 
5449
+#include <com/sun/star/view/XSelectionSupplier.hpp>
 
5450
+
 
5451
+using namespace ::ooo::vba;
 
5452
+using namespace ::com::sun::star;
 
5453
+
 
5454
+SwVbaFrame::SwVbaFrame( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< frame::XModel >& rModel, const css::uno::Reference< text::XTextFrame >& xTextFrame ) throw ( css::uno::RuntimeException ) :
 
5455
+    SwVbaFrame_BASE( rParent, rContext ), mxModel( rModel ), mxTextFrame( xTextFrame )
 
5456
+{
 
5457
+}
 
5458
+
 
5459
+SwVbaFrame::~SwVbaFrame()
 
5460
+{
 
5461
+}
 
5462
+
 
5463
+void SAL_CALL SwVbaFrame::Select() throw ( uno::RuntimeException )
 
5464
+{
 
5465
+    uno::Reference< view::XSelectionSupplier > xSelectSupp( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
 
5466
+    xSelectSupp->select( uno::makeAny( mxTextFrame ) );
 
5467
+}
 
5468
+
 
5469
+rtl::OUString& 
 
5470
+SwVbaFrame::getServiceImplName()
 
5471
+{
 
5472
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFrame") );
 
5473
+    return sImplName;
 
5474
+}
 
5475
+
 
5476
+uno::Sequence< rtl::OUString > 
 
5477
+SwVbaFrame::getServiceNames()
 
5478
+{
 
5479
+    static uno::Sequence< rtl::OUString > aServiceNames;
 
5480
+    if ( aServiceNames.getLength() == 0 )
 
5481
+    {
 
5482
+        aServiceNames.realloc( 1 );
 
5483
+        aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Frame" ) );
 
5484
+    }
 
5485
+    return aServiceNames;
 
5486
+}
 
5487
+
 
5488
diff --git sw/source/ui/vba/vbaframe.hxx sw/source/ui/vba/vbaframe.hxx
 
5489
new file mode 100644
 
5490
index 0000000..a36ebf8
 
5491
--- /dev/null
 
5492
+++ sw/source/ui/vba/vbaframe.hxx
 
5493
@@ -0,0 +1,57 @@
 
5494
+/*************************************************************************
 
5495
+ *
 
5496
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
5497
+ * 
 
5498
+ * Copyright 2008 by Sun Microsystems, Inc.
 
5499
+ *
 
5500
+ * OpenOffice.org - a multi-platform office productivity suite
 
5501
+ *
 
5502
+ * $RCSfile: 
 
5503
+ * $Revision: 
 
5504
+ *
 
5505
+ * This file is part of OpenOffice.org.
 
5506
+ *
 
5507
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
5508
+ * it under the terms of the GNU Lesser General Public License version 3
 
5509
+ * only, as published by the Free Software Foundation.
 
5510
+ *
 
5511
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
5512
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
5513
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
5514
+ * GNU Lesser General Public License version 3 for more details
 
5515
+ * (a copy is included in the LICENSE file that accompanied this code).
 
5516
+ *
 
5517
+ * You should have received a copy of the GNU Lesser General Public License
 
5518
+ * version 3 along with OpenOffice.org.  If not, see
 
5519
+ * <http://www.openoffice.org/license.html>
 
5520
+ * for a copy of the LGPLv3 License.
 
5521
+ *
 
5522
+ ************************************************************************/
 
5523
+#ifndef SW_VBA_FRAME_HXX
 
5524
+#define SW_VBA_FRAME_HXX
 
5525
+
 
5526
+#include <ooo/vba/word/XFrame.hpp>
 
5527
+#include <vbahelper/vbahelperinterface.hxx>
 
5528
+#include <cppuhelper/implbase1.hxx>
 
5529
+#include <com/sun/star/text/XTextFrame.hpp>
 
5530
+
 
5531
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XFrame > SwVbaFrame_BASE;
 
5532
+
 
5533
+class SwVbaFrame : public SwVbaFrame_BASE
 
5534
+{
 
5535
+private:
 
5536
+    css::uno::Reference< css::frame::XModel > mxModel;
 
5537
+    css::uno::Reference< css::text::XTextFrame > mxTextFrame;
 
5538
+
 
5539
+public:
 
5540
+    SwVbaFrame( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const css::uno::Reference< css::text::XTextFrame >& xTextFrame ) throw ( css::uno::RuntimeException );
 
5541
+    virtual ~SwVbaFrame();
 
5542
+
 
5543
+   // Methods
 
5544
+    virtual void SAL_CALL Select() throw ( css::uno::RuntimeException );
 
5545
+
 
5546
+    // XHelperInterface
 
5547
+    virtual rtl::OUString& getServiceImplName();
 
5548
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
5549
+};
 
5550
+#endif /* SW_VBA_FRAME_HXX */
 
5551
diff --git sw/source/ui/vba/vbaframes.cxx sw/source/ui/vba/vbaframes.cxx
 
5552
new file mode 100644
 
5553
index 0000000..2c9fa92
 
5554
--- /dev/null
 
5555
+++ sw/source/ui/vba/vbaframes.cxx
 
5556
@@ -0,0 +1,109 @@
 
5557
+/*************************************************************************
 
5558
+ *
 
5559
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
5560
+ * 
 
5561
+ * Copyright 2008 by Sun Microsystems, Inc.
 
5562
+ *
 
5563
+ * OpenOffice.org - a multi-platform office productivity suite
 
5564
+ *
 
5565
+ * $RCSfile: 
 
5566
+ * $Revision: 
 
5567
+ *
 
5568
+ * This file is part of OpenOffice.org.
 
5569
+ *
 
5570
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
5571
+ * it under the terms of the GNU Lesser General Public License version 3
 
5572
+ * only, as published by the Free Software Foundation.
 
5573
+ *
 
5574
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
5575
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
5576
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
5577
+ * GNU Lesser General Public License version 3 for more details
 
5578
+ * (a copy is included in the LICENSE file that accompanied this code).
 
5579
+ *
 
5580
+ * You should have received a copy of the GNU Lesser General Public License
 
5581
+ * version 3 along with OpenOffice.org.  If not, see
 
5582
+ * <http://www.openoffice.org/license.html>
 
5583
+ * for a copy of the LGPLv3 License.
 
5584
+ *
 
5585
+ ************************************************************************/
 
5586
+#include "vbaframes.hxx"
 
5587
+#include "vbaframe.hxx"
 
5588
+#include <com/sun/star/text/XTextDocument.hpp>
 
5589
+#include <com/sun/star/text/XTextViewCursor.hpp>
 
5590
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
 
5591
+#include "wordvbahelper.hxx"
 
5592
+
 
5593
+using namespace ::ooo::vba;
 
5594
+using namespace ::com::sun::star;
 
5595
+
 
5596
+typedef ::cppu::WeakImplHelper1< container::XEnumeration > FramesEnumeration_Base;
 
5597
+class FramesEnumeration : public FramesEnumeration_Base 
 
5598
+{
 
5599
+private:
 
5600
+    uno::Reference< XHelperInterface > mxParent;
 
5601
+    uno::Reference< uno::XComponentContext > mxContext;
 
5602
+    uno::Reference< container::XIndexAccess> mxIndexAccess;
 
5603
+    uno::Reference< frame::XModel > mxModel;
 
5604
+    sal_Int32 nCurrentPos;
 
5605
+public:
 
5606
+    FramesEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess,  const uno::Reference< frame::XModel >& xModel  ) throw ( uno::RuntimeException ) : mxParent( xParent ), mxContext( xContext), mxIndexAccess( xIndexAccess ), mxModel( xModel ), nCurrentPos(0)
 
5607
+    {
 
5608
+    }
 
5609
+    virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException)
 
5610
+    {
 
5611
+        return ( nCurrentPos < mxIndexAccess->getCount() );
 
5612
+    }
 
5613
+
 
5614
+    virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) 
 
5615
+    { 
 
5616
+        if ( !hasMoreElements() )
 
5617
+            throw container::NoSuchElementException();
 
5618
+        uno::Reference< text::XTextFrame > xTextFrame( mxIndexAccess->getByIndex( nCurrentPos++ ), uno::UNO_QUERY_THROW );
 
5619
+        return uno::makeAny( uno::Reference< word::XFrame > ( new SwVbaFrame( mxParent, mxContext, mxModel, xTextFrame ) ) );
 
5620
+    }
 
5621
+
 
5622
+};
 
5623
+
 
5624
+SwVbaFrames::SwVbaFrames( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xFrames, const uno::Reference< frame::XModel >& xModel ): SwVbaFrames_BASE( xParent, xContext, xFrames ), mxModel( xModel ) 
 
5625
+{
 
5626
+    mxFramesSupplier.set( mxModel, uno::UNO_QUERY_THROW );
 
5627
+}
 
5628
+// XEnumerationAccess
 
5629
+uno::Type
 
5630
+SwVbaFrames::getElementType() throw (uno::RuntimeException)
 
5631
+{
 
5632
+    return word::XFrame::static_type(0);
 
5633
+}
 
5634
+
 
5635
+uno::Reference< container::XEnumeration >
 
5636
+SwVbaFrames::createEnumeration() throw (uno::RuntimeException)
 
5637
+{
 
5638
+    return new FramesEnumeration( this, mxContext,m_xIndexAccess, mxModel );
 
5639
+}
 
5640
+
 
5641
+uno::Any
 
5642
+SwVbaFrames::createCollectionObject( const css::uno::Any& aSource )
 
5643
+{
 
5644
+    uno::Reference< text::XTextFrame > xTextFrame( aSource, uno::UNO_QUERY_THROW );
 
5645
+    return uno::makeAny( uno::Reference< word::XFrame > ( new SwVbaFrame( this, mxContext, mxModel, xTextFrame ) ) );
 
5646
+}
 
5647
+
 
5648
+rtl::OUString& 
 
5649
+SwVbaFrames::getServiceImplName()
 
5650
+{
 
5651
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFrames") );
 
5652
+    return sImplName;
 
5653
+}
 
5654
+
 
5655
+css::uno::Sequence<rtl::OUString> 
 
5656
+SwVbaFrames::getServiceNames()
 
5657
+{
 
5658
+    static uno::Sequence< rtl::OUString > sNames;
 
5659
+    if ( sNames.getLength() == 0 )
 
5660
+    {
 
5661
+        sNames.realloc( 1 );
 
5662
+        sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Frames") );
 
5663
+    }
 
5664
+    return sNames;
 
5665
+}
 
5666
diff --git sw/source/ui/vba/vbaframes.hxx sw/source/ui/vba/vbaframes.hxx
 
5667
new file mode 100644
 
5668
index 0000000..0957820
 
5669
--- /dev/null
 
5670
+++ sw/source/ui/vba/vbaframes.hxx
 
5671
@@ -0,0 +1,61 @@
 
5672
+/*************************************************************************
 
5673
+ *
 
5674
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
5675
+ * 
 
5676
+ * Copyright 2008 by Sun Microsystems, Inc.
 
5677
+ *
 
5678
+ * OpenOffice.org - a multi-platform office productivity suite
 
5679
+ *
 
5680
+ * $RCSfile: 
 
5681
+ * $Revision: 
 
5682
+ *
 
5683
+ * This file is part of OpenOffice.org.
 
5684
+ *
 
5685
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
5686
+ * it under the terms of the GNU Lesser General Public License version 3
 
5687
+ * only, as published by the Free Software Foundation.
 
5688
+ *
 
5689
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
5690
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
5691
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
5692
+ * GNU Lesser General Public License version 3 for more details
 
5693
+ * (a copy is included in the LICENSE file that accompanied this code).
 
5694
+ *
 
5695
+ * You should have received a copy of the GNU Lesser General Public License
 
5696
+ * version 3 along with OpenOffice.org.  If not, see
 
5697
+ * <http://www.openoffice.org/license.html>
 
5698
+ * for a copy of the LGPLv3 License.
 
5699
+ *
 
5700
+ ************************************************************************/
 
5701
+#ifndef SW_VBA_FRAMES_HXX
 
5702
+#define SW_VBA_FRAMES_HXX
 
5703
+
 
5704
+#include <vbahelper/vbacollectionimpl.hxx>
 
5705
+#include <ooo/vba/word/XFrames.hpp>
 
5706
+#include <vbahelper/vbahelperinterface.hxx>
 
5707
+#include <com/sun/star/text/XTextFramesSupplier.hpp>
 
5708
+
 
5709
+typedef CollTestImplHelper< ooo::vba::word::XFrames > SwVbaFrames_BASE;
 
5710
+
 
5711
+class SwVbaFrames : public SwVbaFrames_BASE
 
5712
+{
 
5713
+private:
 
5714
+    css::uno::Reference< css::frame::XModel > mxModel;
 
5715
+    css::uno::Reference< css::text::XTextFramesSupplier > mxFramesSupplier;
 
5716
+
 
5717
+public:
 
5718
+    SwVbaFrames( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xFrames, const css::uno::Reference< css::frame::XModel >& xModel );
 
5719
+    virtual ~SwVbaFrames() {}
 
5720
+
 
5721
+    // XEnumerationAccess
 
5722
+    virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
 
5723
+    virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
 
5724
+
 
5725
+    // SwVbaFrames_BASE
 
5726
+    virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); 
 
5727
+    virtual rtl::OUString& getServiceImplName();
 
5728
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
5729
+
 
5730
+};    
 
5731
+
 
5732
+#endif /* SW_VBA_FRAMES_HXX */
 
5733
diff --git sw/source/ui/vba/vbaglobals.cxx sw/source/ui/vba/vbaglobals.cxx
 
5734
index 935a95c..ff56a9b 100644
 
5735
--- sw/source/ui/vba/vbaglobals.cxx
 
5736
+++ sw/source/ui/vba/vbaglobals.cxx
 
5737
@@ -132,6 +132,12 @@ SwVbaGlobals::Dialogs( const uno::Any& index ) throw (uno::RuntimeException)
 
5738
     return getApplication()->Dialogs( index );
 
5739
 }
 
5740
 
 
5741
+uno::Any SAL_CALL
 
5742
+SwVbaGlobals::ListGalleries( const uno::Any& index ) throw (uno::RuntimeException)
 
5743
+{
 
5744
+    return getApplication()->ListGalleries( index );
 
5745
+}
 
5746
+
 
5747
 uno::Reference<word::XSelection > SAL_CALL
 
5748
 SwVbaGlobals::getSelection() throw (uno::RuntimeException)
 
5749
 {
 
5750
diff --git sw/source/ui/vba/vbaglobals.hxx sw/source/ui/vba/vbaglobals.hxx
 
5751
index 066282e..2a2e328 100644
 
5752
--- sw/source/ui/vba/vbaglobals.hxx
 
5753
+++ sw/source/ui/vba/vbaglobals.hxx
 
5754
@@ -72,6 +72,7 @@ public:
 
5755
     virtual css::uno::Any SAL_CALL Documents( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);  
 
5756
     virtual css::uno::Any SAL_CALL Addins( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);  
 
5757
     virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);  
 
5758
+    virtual css::uno::Any SAL_CALL ListGalleries( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);  
 
5759
     virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException);
 
5760
     // XMultiServiceFactory
 
5761
     virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames(  ) throw (css::uno::RuntimeException);
 
5762
diff --git sw/source/ui/vba/vbaheaderfooter.cxx sw/source/ui/vba/vbaheaderfooter.cxx
 
5763
index 0176edf..138e90d 100644
 
5764
--- sw/source/ui/vba/vbaheaderfooter.cxx
 
5765
+++ sw/source/ui/vba/vbaheaderfooter.cxx
 
5766
@@ -84,6 +84,7 @@ uno::Reference< word::XRange > SAL_CALL SwVbaHeaderFooter::getRange() throw (uno
 
5767
 uno::Any SAL_CALL
 
5768
 SwVbaHeaderFooter::Shapes( const uno::Any& index ) throw (uno::RuntimeException)
 
5769
 {
 
5770
+    // #FIXME: only get the shapes in the current header/footer 
 
5771
     uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW );
 
5772
     //uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
 
5773
     uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
 
5774
diff --git sw/source/ui/vba/vbaheaderfooterhelper.cxx sw/source/ui/vba/vbaheaderfooterhelper.cxx
 
5775
index 4069b85..0f8f194 100644
 
5776
--- sw/source/ui/vba/vbaheaderfooterhelper.cxx
 
5777
+++ sw/source/ui/vba/vbaheaderfooterhelper.cxx
 
5778
@@ -32,8 +32,12 @@
 
5779
 #include <comphelper/processfactory.hxx>
 
5780
 #include <com/sun/star/frame/XController.hpp>
 
5781
 #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
 
5782
+#include <com/sun/star/text/XTextRangeCompare.hpp>
 
5783
+#include <com/sun/star/text/XTextRange.hpp>
 
5784
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 
5785
 #include <com/sun/star/container/XNameAccess.hpp>
 
5786
+#include <com/sun/star/lang/XServiceInfo.hpp>
 
5787
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
 
5788
 
 
5789
 using namespace ::com::sun::star;
 
5790
 using namespace ::ooo::vba;
 
5791
@@ -41,41 +45,61 @@ using namespace ::ooo::vba;
 
5792
 #define FIRST_PAGE 1;
 
5793
 
 
5794
 // Class HeaderFooterHelper 
 
5795
+sal_Bool HeaderFooterHelper::isHeaderFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
 
5796
+{
 
5797
+    return isHeaderFooter( word::getCurrentXText( xModel ) );
 
5798
+}
 
5799
 
 
5800
-sal_Bool HeaderFooterHelper::isHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
 
5801
+sal_Bool HeaderFooterHelper::isHeaderFooter( const uno::Reference< text::XText >& xText ) throw (uno::RuntimeException)
 
5802
 {
 
5803
-    uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
 
5804
-    uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
 
5805
-    
 
5806
-    sal_Bool isOn = sal_False;
 
5807
-    xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isOn;
 
5808
-    if( !isOn )
 
5809
-        return sal_False;
 
5810
+    uno::Reference< lang::XServiceInfo > xServiceInfo( xText, uno::UNO_QUERY_THROW );
 
5811
+    rtl::OUString aImplName = xServiceInfo->getImplementationName();
 
5812
+    if( aImplName.equalsAscii("SwXHeadFootText") )
 
5813
+        return sal_True;
 
5814
+    return sal_False;     
 
5815
+}
 
5816
 
 
5817
-    sal_Bool isShared = sal_False;
 
5818
-    xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared"))) >>= isShared;
 
5819
+sal_Bool HeaderFooterHelper::isHeader( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
 
5820
+{
 
5821
+    const uno::Reference< text::XText > xCurrentText = word::getCurrentXText( xModel );
 
5822
+    if( !isHeaderFooter( xCurrentText ) )
 
5823
+        return sal_False;
 
5824
 
 
5825
+    rtl::OUString aPropIsShared = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared") );
 
5826
     rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") );
 
5827
+    uno::Reference< style::XStyle > xPageStyle = word::getCurrentPageStyle( xModel );
 
5828
+    uno::Reference< beans::XPropertySet > xPageProps( xPageStyle, uno::UNO_QUERY_THROW );
 
5829
+    sal_Bool isShared = sal_True;
 
5830
+    xPageProps->getPropertyValue( aPropIsShared ) >>= isShared;
 
5831
     if( !isShared )
 
5832
     {
 
5833
+        uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
 
5834
         if( 0 == xPageCursor->getPage() % 2 )
 
5835
-        {
 
5836
             aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextLeft") );
 
5837
-        }
 
5838
         else
 
5839
-        {
 
5840
             aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextRight") );
 
5841
-        }
 
5842
     }
 
5843
-    
 
5844
-    uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
 
5845
-    //FIXME: can not compare in this way?
 
5846
-    return ( xText == xCurrentText );
 
5847
+
 
5848
+    uno::Reference< text::XText > xHeaderText( xPageProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
 
5849
+    uno::Reference< text::XTextRangeCompare > xTRC( xHeaderText, uno::UNO_QUERY_THROW ); 
 
5850
+    uno::Reference< text::XTextRange > xTR1( xCurrentText, uno::UNO_QUERY_THROW );
 
5851
+    uno::Reference< text::XTextRange > xTR2( xHeaderText, uno::UNO_QUERY_THROW );
 
5852
+    try
 
5853
+    {
 
5854
+        if( xTRC->compareRegionStarts( xTR1, xTR2 ) == 0 )
 
5855
+            return sal_True;
 
5856
+    }
 
5857
+    catch( lang::IllegalArgumentException& )
 
5858
+    {
 
5859
+        return sal_False;
 
5860
+    }
 
5861
+
 
5862
+    return sal_False;    
 
5863
 }
 
5864
 
 
5865
-sal_Bool HeaderFooterHelper::isFirstPageHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
 
5866
+sal_Bool HeaderFooterHelper::isFirstPageHeader( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
 
5867
 {
 
5868
-    if( isHeader( xModel, xCurrentText ) )
 
5869
+    if( isHeader( xModel ) )
 
5870
     {
 
5871
         uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
 
5872
         // FIXME: getPage allways returns 1
 
5873
@@ -85,9 +109,9 @@ sal_Bool HeaderFooterHelper::isFirstPageHeader( const uno::Reference< frame::XMo
 
5874
     return sal_False;
 
5875
 }
 
5876
 
 
5877
-sal_Bool HeaderFooterHelper::isEvenPagesHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
 
5878
+sal_Bool HeaderFooterHelper::isEvenPagesHeader( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
 
5879
 {
 
5880
-    if( isHeader( xModel, xCurrentText ) )
 
5881
+    if( isHeader( xModel ) )
 
5882
     {
 
5883
         uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
 
5884
         sal_Bool isShared = sal_False;
 
5885
@@ -101,40 +125,47 @@ sal_Bool HeaderFooterHelper::isEvenPagesHeader( const uno::Reference< frame::XMo
 
5886
     return sal_False;
 
5887
 }
 
5888
 
 
5889
-sal_Bool HeaderFooterHelper::isFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
 
5890
+sal_Bool HeaderFooterHelper::isFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
 
5891
 {
 
5892
-    uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
 
5893
-    uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
 
5894
-    
 
5895
-    sal_Bool isOn = sal_False;
 
5896
-    xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isOn;
 
5897
-    if( !isOn )
 
5898
+    const uno::Reference< text::XText > xCurrentText = word::getCurrentXText( xModel );
 
5899
+    if( !isHeaderFooter( xCurrentText ) )
 
5900
         return sal_False;
 
5901
 
 
5902
-    sal_Bool isShared = sal_False;
 
5903
-    xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared;
 
5904
-
 
5905
+    rtl::OUString aPropIsShared = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared") );
 
5906
     rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") );
 
5907
+    uno::Reference< style::XStyle > xPageStyle = word::getCurrentPageStyle( xModel );
 
5908
+    uno::Reference< beans::XPropertySet > xPageProps( xPageStyle, uno::UNO_QUERY_THROW );
 
5909
+    sal_Bool isShared = sal_True;
 
5910
+    xPageProps->getPropertyValue( aPropIsShared ) >>= isShared;
 
5911
     if( !isShared )
 
5912
     {
 
5913
+        uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
 
5914
         if( 0 == xPageCursor->getPage() % 2 )
 
5915
-        {
 
5916
             aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextLeft") );
 
5917
-        }
 
5918
         else
 
5919
-        {
 
5920
             aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextRight") );
 
5921
-        }
 
5922
     }
 
5923
-    
 
5924
-    uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
 
5925
 
 
5926
-    return ( xText == xCurrentText );
 
5927
+    uno::Reference< text::XText > xFooterText( xPageProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
 
5928
+    uno::Reference< text::XTextRangeCompare > xTRC( xFooterText, uno::UNO_QUERY_THROW ); 
 
5929
+    uno::Reference< text::XTextRange > xTR1( xCurrentText, uno::UNO_QUERY_THROW );
 
5930
+    uno::Reference< text::XTextRange > xTR2( xFooterText, uno::UNO_QUERY_THROW );
 
5931
+    try
 
5932
+    {
 
5933
+        if( xTRC->compareRegionStarts( xTR1, xTR2 ) == 0 )
 
5934
+            return sal_True;
 
5935
+    }
 
5936
+    catch( lang::IllegalArgumentException& )
 
5937
+    {
 
5938
+        return sal_False;
 
5939
+    }
 
5940
+
 
5941
+    return sal_False;    
 
5942
 }
 
5943
 
 
5944
-sal_Bool HeaderFooterHelper::isFirstPageFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
 
5945
+sal_Bool HeaderFooterHelper::isFirstPageFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
 
5946
 {
 
5947
-    if( isFooter( xModel, xCurrentText ) )
 
5948
+    if( isFooter( xModel ) )
 
5949
     {
 
5950
         uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
 
5951
         sal_Int32 nPage = xPageCursor->getPage();
 
5952
@@ -143,9 +174,9 @@ sal_Bool HeaderFooterHelper::isFirstPageFooter( const uno::Reference< frame::XMo
 
5953
     return sal_False;
 
5954
 }
 
5955
 
 
5956
-sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
 
5957
+sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
 
5958
 {
 
5959
-    if( isFooter( xModel, xCurrentText ) )
 
5960
+    if( isFooter( xModel ) )
 
5961
     {
 
5962
         uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
 
5963
         sal_Bool isShared = sal_False;
 
5964
@@ -159,20 +190,20 @@ sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XMo
 
5965
     return sal_False;
 
5966
 }
 
5967
 
 
5968
-sal_Bool HeaderFooterHelper::isPrimaryHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
 
5969
+sal_Bool HeaderFooterHelper::isPrimaryHeader( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
 
5970
 {
 
5971
-    if( isHeader( xModel, xCurrentText ) )
 
5972
+    if( isHeader( xModel ) )
 
5973
     {
 
5974
-        return( !( isFirstPageHeader( xModel, xCurrentText ) && isEvenPagesHeader( xModel, xCurrentText ) ) );
 
5975
+        return( !( isFirstPageHeader( xModel ) && isEvenPagesHeader( xModel ) ) );
 
5976
     }
 
5977
     return sal_False;
 
5978
 }
 
5979
 
 
5980
-sal_Bool HeaderFooterHelper::isPrimaryFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
 
5981
+sal_Bool HeaderFooterHelper::isPrimaryFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
 
5982
 {
 
5983
-    if( isHeader( xModel, xCurrentText ) )
 
5984
+    if( isHeader( xModel ) )
 
5985
     {
 
5986
-        return( !( isFirstPageFooter( xModel, xCurrentText ) && isEvenPagesFooter( xModel, xCurrentText ) ) );
 
5987
+        return( !( isFirstPageFooter( xModel ) && isEvenPagesFooter( xModel ) ) );
 
5988
     }
 
5989
     return sal_False;
 
5990
 }
 
5991
diff --git sw/source/ui/vba/vbaheaderfooterhelper.hxx sw/source/ui/vba/vbaheaderfooterhelper.hxx
 
5992
index 2dffc59..e95aaa3 100644
 
5993
--- sw/source/ui/vba/vbaheaderfooterhelper.hxx
 
5994
+++ sw/source/ui/vba/vbaheaderfooterhelper.hxx
 
5995
@@ -39,14 +39,16 @@
 
5996
 class HeaderFooterHelper
 
5997
 {
 
5998
 public:
 
5999
-    static sal_Bool isHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
 
6000
-    static sal_Bool isFirstPageHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
 
6001
-    static sal_Bool isEvenPagesHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
 
6002
-    static sal_Bool isFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
 
6003
-    static sal_Bool isFirstPageFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
 
6004
-    static sal_Bool isEvenPagesFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
 
6005
-    static sal_Bool isPrimaryHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
 
6006
-    static sal_Bool isPrimaryFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
 
6007
+    static sal_Bool isHeaderFooter( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
 
6008
+    static sal_Bool isHeaderFooter( const css::uno::Reference< css::text::XText >& xText ) throw (css::uno::RuntimeException);
 
6009
+    static sal_Bool isHeader( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
 
6010
+    static sal_Bool isFirstPageHeader( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
 
6011
+    static sal_Bool isEvenPagesHeader( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
 
6012
+    static sal_Bool isFooter( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
 
6013
+    static sal_Bool isFirstPageFooter( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
 
6014
+    static sal_Bool isEvenPagesFooter( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
 
6015
+    static sal_Bool isPrimaryHeader( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
 
6016
+    static sal_Bool isPrimaryFooter( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
 
6017
 };
 
6018
 
 
6019
 #endif
 
6020
diff --git sw/source/ui/vba/vbaheadersfooters.cxx sw/source/ui/vba/vbaheadersfooters.cxx
 
6021
new file mode 100644
 
6022
index 0000000..295314a
 
6023
--- /dev/null
 
6024
+++ sw/source/ui/vba/vbaheadersfooters.cxx
 
6025
@@ -0,0 +1,150 @@
 
6026
+/*************************************************************************
 
6027
+ *
 
6028
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
6029
+ * 
 
6030
+ * Copyright 2008 by Sun Microsystems, Inc.
 
6031
+ *
 
6032
+ * OpenOffice.org - a multi-platform office productivity suite
 
6033
+ *
 
6034
+ * $RCSfile: 
 
6035
+ * $Revision: 
 
6036
+ *
 
6037
+ * This file is part of OpenOffice.org.
 
6038
+ *
 
6039
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
6040
+ * it under the terms of the GNU Lesser General Public License version 3
 
6041
+ * only, as published by the Free Software Foundation.
 
6042
+ *
 
6043
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
6044
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
6045
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
6046
+ * GNU Lesser General Public License version 3 for more details
 
6047
+ * (a copy is included in the LICENSE file that accompanied this code).
 
6048
+ *
 
6049
+ * You should have received a copy of the GNU Lesser General Public License
 
6050
+ * version 3 along with OpenOffice.org.  If not, see
 
6051
+ * <http://www.openoffice.org/license.html>
 
6052
+ * for a copy of the LGPLv3 License.
 
6053
+ *
 
6054
+ ************************************************************************/
 
6055
+#include "vbaheadersfooters.hxx"
 
6056
+#include "vbaheaderfooter.hxx"
 
6057
+#include <ooo/vba/word/WdHeaderFooterIndex.hpp>
 
6058
+
 
6059
+using namespace ::ooo::vba;
 
6060
+using namespace ::com::sun::star;
 
6061
+
 
6062
+// I assume there is only one headersfooters in Writer
 
6063
+typedef ::cppu::WeakImplHelper1<container::XIndexAccess > HeadersFootersIndexAccess_Base;
 
6064
+class HeadersFootersIndexAccess : public HeadersFootersIndexAccess_Base
 
6065
+{
 
6066
+private:
 
6067
+    uno::Reference< XHelperInterface > mxParent;
 
6068
+    uno::Reference< uno::XComponentContext > mxContext;
 
6069
+    uno::Reference< frame::XModel > mxModel;
 
6070
+    uno::Reference< beans::XPropertySet > mxPageStyleProps;
 
6071
+    sal_Bool mbHeader;
 
6072
+
 
6073
+public:
 
6074
+    HeadersFootersIndexAccess( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xPageStyleProps, sal_Bool bHeader ) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ), mxPageStyleProps( xPageStyleProps ), mbHeader( bHeader ) {}
 
6075
+    ~HeadersFootersIndexAccess(){}
 
6076
+
 
6077
+    // XIndexAccess
 
6078
+    virtual sal_Int32 SAL_CALL getCount(  ) throw (uno::RuntimeException)
 
6079
+    {
 
6080
+        // first page, evenpages and primary page
 
6081
+        return 3;
 
6082
+    }
 
6083
+    virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
 
6084
+    {
 
6085
+        if( Index < 1 || Index > 3 )
 
6086
+            throw container::NoSuchElementException();
 
6087
+        return uno::makeAny( uno::Reference< word::XHeaderFooter >( new SwVbaHeaderFooter( mxParent,  mxContext, mxModel, mxPageStyleProps, mbHeader, Index ) ) );    
 
6088
+    }
 
6089
+    virtual uno::Type SAL_CALL getElementType(  ) throw (uno::RuntimeException)
 
6090
+    {
 
6091
+        return word::XHeaderFooter::static_type(0);
 
6092
+    }
 
6093
+    virtual sal_Bool SAL_CALL hasElements(  ) throw (uno::RuntimeException)
 
6094
+    {
 
6095
+        return sal_True;
 
6096
+    }
 
6097
+};
 
6098
+
 
6099
+class HeadersFootersEnumWrapper : public EnumerationHelper_BASE
 
6100
+{
 
6101
+    SwVbaHeadersFooters* pHeadersFooters;
 
6102
+    sal_Int32 nIndex;
 
6103
+public:
 
6104
+    HeadersFootersEnumWrapper( SwVbaHeadersFooters* _pHeadersFooters ) : pHeadersFooters( _pHeadersFooters ), nIndex( 0 ) {}
 
6105
+    virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException)
 
6106
+    {
 
6107
+        return ( nIndex < pHeadersFooters->getCount() );
 
6108
+    }
 
6109
+
 
6110
+    virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
 
6111
+    {
 
6112
+        if ( nIndex < pHeadersFooters->getCount() )
 
6113
+            return pHeadersFooters->Item( uno::makeAny( ++nIndex ), uno::Any() );
 
6114
+        throw container::NoSuchElementException();
 
6115
+    }
 
6116
+};
 
6117
+
 
6118
+SwVbaHeadersFooters::SwVbaHeadersFooters( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xPageStyleProps, sal_Bool isHeader ): SwVbaHeadersFooters_BASE( xParent, xContext, new HeadersFootersIndexAccess( xParent, xContext, xModel, xPageStyleProps, isHeader ) ),  mxModel( xModel ), mxPageStyleProps( xPageStyleProps ), mbHeader( isHeader )
 
6119
+{
 
6120
+}
 
6121
+
 
6122
+::sal_Int32 SAL_CALL SwVbaHeadersFooters::getCount() throw (uno::RuntimeException)
 
6123
+{
 
6124
+    // wdHeaderFooterFirstPage, wdHeaderFooterPrimary and wdHeaderFooterEvenPages
 
6125
+    return 3;
 
6126
+}
 
6127
+
 
6128
+uno::Any SAL_CALL SwVbaHeadersFooters::Item( const uno::Any& Index1, const uno::Any& ) throw (uno::RuntimeException)
 
6129
+{
 
6130
+    sal_Int32 nIndex = 0;
 
6131
+    Index1 >>= nIndex;
 
6132
+    if( ( nIndex < 1 ) || ( nIndex > 3 ) )
 
6133
+    {
 
6134
+        throw container::NoSuchElementException();
 
6135
+    }
 
6136
+    return uno::makeAny( uno::Reference< word::XHeaderFooter >( new SwVbaHeaderFooter( this,  mxContext, mxModel, mxPageStyleProps, mbHeader, nIndex ) ) );    
 
6137
+}
 
6138
+
 
6139
+// XEnumerationAccess
 
6140
+uno::Type
 
6141
+SwVbaHeadersFooters::getElementType() throw (uno::RuntimeException)
 
6142
+{
 
6143
+    return word::XHeaderFooter::static_type(0);
 
6144
+}
 
6145
+uno::Reference< container::XEnumeration >
 
6146
+
 
6147
+SwVbaHeadersFooters::createEnumeration() throw (uno::RuntimeException)
 
6148
+{
 
6149
+    return new HeadersFootersEnumWrapper( this );
 
6150
+}
 
6151
+
 
6152
+uno::Any
 
6153
+SwVbaHeadersFooters::createCollectionObject( const uno::Any& aSource )
 
6154
+{
 
6155
+    return aSource;
 
6156
+}
 
6157
+
 
6158
+rtl::OUString& 
 
6159
+SwVbaHeadersFooters::getServiceImplName()
 
6160
+{
 
6161
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaHeadersFooters") );
 
6162
+    return sImplName;
 
6163
+}
 
6164
+
 
6165
+uno::Sequence<rtl::OUString> 
 
6166
+SwVbaHeadersFooters::getServiceNames()
 
6167
+{
 
6168
+    static uno::Sequence< rtl::OUString > sNames;
 
6169
+    if ( sNames.getLength() == 0 )
 
6170
+    {
 
6171
+        sNames.realloc( 1 );
 
6172
+        sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.HeadersFooters") );
 
6173
+    }
 
6174
+    return sNames;
 
6175
+}
 
6176
diff --git sw/source/ui/vba/vbaheadersfooters.hxx sw/source/ui/vba/vbaheadersfooters.hxx
 
6177
new file mode 100644
 
6178
index 0000000..9bd7683
 
6179
--- /dev/null
 
6180
+++ sw/source/ui/vba/vbaheadersfooters.hxx
 
6181
@@ -0,0 +1,62 @@
 
6182
+/*************************************************************************
 
6183
+ *
 
6184
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
6185
+ * 
 
6186
+ * Copyright 2008 by Sun Microsystems, Inc.
 
6187
+ *
 
6188
+ * OpenOffice.org - a multi-platform office productivity suite
 
6189
+ *
 
6190
+ * $RCSfile: 
 
6191
+ * $Revision: 
 
6192
+ *
 
6193
+ * This file is part of OpenOffice.org.
 
6194
+ *
 
6195
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
6196
+ * it under the terms of the GNU Lesser General Public License version 3
 
6197
+ * only, as published by the Free Software Foundation.
 
6198
+ *
 
6199
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
6200
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
6201
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
6202
+ * GNU Lesser General Public License version 3 for more details
 
6203
+ * (a copy is included in the LICENSE file that accompanied this code).
 
6204
+ *
 
6205
+ * You should have received a copy of the GNU Lesser General Public License
 
6206
+ * version 3 along with OpenOffice.org.  If not, see
 
6207
+ * <http://www.openoffice.org/license.html>
 
6208
+ * for a copy of the LGPLv3 License.
 
6209
+ *
 
6210
+ ************************************************************************/
 
6211
+#ifndef SW_VBA_HEADERSFOOTERS_HXX
 
6212
+#define SW_VBA_HEADERSFOOTERS_HXX
 
6213
+
 
6214
+#include <vbahelper/vbacollectionimpl.hxx>
 
6215
+#include <ooo/vba/word/XHeadersFooters.hpp>
 
6216
+#include <vbahelper/vbahelperinterface.hxx>
 
6217
+
 
6218
+typedef CollTestImplHelper< ooo::vba::word::XHeadersFooters > SwVbaHeadersFooters_BASE;
 
6219
+
 
6220
+class SwVbaHeadersFooters : public SwVbaHeadersFooters_BASE
 
6221
+{
 
6222
+private:
 
6223
+    css::uno::Reference< css::frame::XModel > mxModel;
 
6224
+    css::uno::Reference< css::beans::XPropertySet > mxPageStyleProps;
 
6225
+    sal_Bool mbHeader;
 
6226
+
 
6227
+public:
 
6228
+    SwVbaHeadersFooters( 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, sal_Bool isHeader );
 
6229
+    virtual ~SwVbaHeadersFooters() {}
 
6230
+
 
6231
+    virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
 
6232
+    virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& )throw (css::uno::RuntimeException);
 
6233
+    // XEnumerationAccess
 
6234
+    virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
 
6235
+    virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
 
6236
+
 
6237
+    // SwVbaHeadersFooters_BASE
 
6238
+    virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); 
 
6239
+    virtual rtl::OUString& getServiceImplName();
 
6240
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
6241
+};    
 
6242
+
 
6243
+#endif /* SW_VBA_HEADERSFOOTERS_HXX */
 
6244
diff --git sw/source/ui/vba/vbalistformat.cxx sw/source/ui/vba/vbalistformat.cxx
 
6245
new file mode 100644
 
6246
index 0000000..05d9380
 
6247
--- /dev/null
 
6248
+++ sw/source/ui/vba/vbalistformat.cxx
 
6249
@@ -0,0 +1,121 @@
 
6250
+/*************************************************************************
 
6251
+ *
 
6252
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
6253
+ * 
 
6254
+ * Copyright 2008 by Sun Microsystems, Inc.
 
6255
+ *
 
6256
+ * OpenOffice.org - a multi-platform office productivity suite
 
6257
+ *
 
6258
+ * $RCSfile: 
 
6259
+ * $Revision: 
 
6260
+ *
 
6261
+ * This file is part of OpenOffice.org.
 
6262
+ *
 
6263
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
6264
+ * it under the terms of the GNU Lesser General Public License version 3
 
6265
+ * only, as published by the Free Software Foundation.
 
6266
+ *
 
6267
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
6268
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
6269
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
6270
+ * GNU Lesser General Public License version 3 for more details
 
6271
+ * (a copy is included in the LICENSE file that accompanied this code).
 
6272
+ *
 
6273
+ * You should have received a copy of the GNU Lesser General Public License
 
6274
+ * version 3 along with OpenOffice.org.  If not, see
 
6275
+ * <http://www.openoffice.org/license.html>
 
6276
+ * for a copy of the LGPLv3 License.
 
6277
+ *
 
6278
+ ************************************************************************/
 
6279
+#include "vbalistformat.hxx"
 
6280
+#include <vbahelper/vbahelper.hxx>
 
6281
+#include <tools/diagnose_ex.h>
 
6282
+#include <ooo/vba/word/WdListApplyTo.hpp>
 
6283
+#include <ooo/vba/word/WdDefaultListBehavior.hpp>
 
6284
+#include <com/sun/star/container/XEnumerationAccess.hpp>
 
6285
+#include <com/sun/star/container/XEnumeration.hpp>
 
6286
+#include <com/sun/star/beans/XPropertySet.hpp>
 
6287
+#include "vbalisttemplate.hxx"
 
6288
+
 
6289
+using namespace ::ooo::vba;
 
6290
+using namespace ::com::sun::star;
 
6291
+
 
6292
+SwVbaListFormat::SwVbaListFormat( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextRange >& xTextRange ) throw ( uno::RuntimeException ) : SwVbaListFormat_BASE( rParent, rContext ), mxTextRange( xTextRange )
 
6293
+{
 
6294
+}
 
6295
+
 
6296
+SwVbaListFormat::~SwVbaListFormat()
 
6297
+{
 
6298
+}
 
6299
+
 
6300
+void SAL_CALL SwVbaListFormat::ApplyListTemplate( const css::uno::Reference< word::XListTemplate >& ListTemplate, const css::uno::Any& ContinuePreviousList, const css::uno::Any& ApplyTo, const css::uno::Any& DefaultListBehavior ) throw (css::uno::RuntimeException)
 
6301
+{
 
6302
+    sal_Bool bContinuePreviousList = sal_True;
 
6303
+    if( ContinuePreviousList.hasValue() )
 
6304
+        ContinuePreviousList >>= bContinuePreviousList;
 
6305
+    
 
6306
+    // "applyto" must be current selection
 
6307
+    sal_Int32 bApplyTo = word::WdListApplyTo::wdListApplyToSelection;
 
6308
+    if( ApplyTo.hasValue() )
 
6309
+        ApplyTo >>= bApplyTo;
 
6310
+    if( bApplyTo != word::WdListApplyTo::wdListApplyToSelection )
 
6311
+        throw uno::RuntimeException();
 
6312
+
 
6313
+    // default behaviour must be wdWord8ListBehavior
 
6314
+    sal_Int32 nDefaultListBehavior = word::WdDefaultListBehavior::wdWord8ListBehavior;
 
6315
+    if( DefaultListBehavior.hasValue() )
 
6316
+        DefaultListBehavior >>= nDefaultListBehavior;
 
6317
+    if( nDefaultListBehavior != word::WdDefaultListBehavior::wdWord8ListBehavior )
 
6318
+        throw uno::RuntimeException();
 
6319
+    
 
6320
+    SwVbaListTemplate* pListTemplate = dynamic_cast< SwVbaListTemplate* >( ListTemplate.get() );
 
6321
+
 
6322
+    uno::Reference< container::XEnumerationAccess > xEnumAccess( mxTextRange, uno::UNO_QUERY_THROW );
 
6323
+    uno::Reference< container::XEnumeration > xEnum = xEnumAccess->createEnumeration();
 
6324
+    sal_Bool isFirstElement = sal_True;
 
6325
+    while( xEnum->hasMoreElements() )
 
6326
+    {
 
6327
+        uno::Reference< beans::XPropertySet > xProps( xEnum->nextElement(), uno::UNO_QUERY_THROW );
 
6328
+        if( isFirstElement )
 
6329
+        {
 
6330
+            sal_Bool isNumberingRestart = !bContinuePreviousList;
 
6331
+            xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsNumberingRestart") ), uno::makeAny( isNumberingRestart ) );
 
6332
+            if( isNumberingRestart )
 
6333
+            {
 
6334
+                sal_Int16 nStartValue = 1;
 
6335
+                xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStartValue") ), uno::makeAny( nStartValue ) );
 
6336
+            }
 
6337
+            isFirstElement = sal_False;
 
6338
+        }
 
6339
+        else
 
6340
+        {
 
6341
+            xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsNumberingRestart") ), uno::makeAny( sal_False ) );
 
6342
+        }
 
6343
+        pListTemplate->applyListTemplate( xProps );
 
6344
+    }
 
6345
+}
 
6346
+
 
6347
+void SAL_CALL SwVbaListFormat::ConvertNumbersToText(  ) throw (css::uno::RuntimeException)
 
6348
+{
 
6349
+    throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
6350
+}
 
6351
+
 
6352
+rtl::OUString& 
 
6353
+SwVbaListFormat::getServiceImplName()
 
6354
+{
 
6355
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListFormat") );
 
6356
+    return sImplName;
 
6357
+}
 
6358
+
 
6359
+uno::Sequence< rtl::OUString > 
 
6360
+SwVbaListFormat::getServiceNames()
 
6361
+{
 
6362
+    static uno::Sequence< rtl::OUString > aServiceNames;
 
6363
+    if ( aServiceNames.getLength() == 0 )
 
6364
+    {
 
6365
+        aServiceNames.realloc( 1 );
 
6366
+        aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListFormat" ) );
 
6367
+    }
 
6368
+    return aServiceNames;
 
6369
+}
 
6370
+
 
6371
diff --git sw/source/ui/vba/vbalistformat.hxx sw/source/ui/vba/vbalistformat.hxx
 
6372
new file mode 100644
 
6373
index 0000000..184312a
 
6374
--- /dev/null
 
6375
+++ sw/source/ui/vba/vbalistformat.hxx
 
6376
@@ -0,0 +1,60 @@
 
6377
+/*************************************************************************
 
6378
+ *
 
6379
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
6380
+ * 
 
6381
+ * Copyright 2008 by Sun Microsystems, Inc.
 
6382
+ *
 
6383
+ * OpenOffice.org - a multi-platform office productivity suite
 
6384
+ *
 
6385
+ * $RCSfile: 
 
6386
+ * $Revision: 
 
6387
+ *
 
6388
+ * This file is part of OpenOffice.org.
 
6389
+ *
 
6390
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
6391
+ * it under the terms of the GNU Lesser General Public License version 3
 
6392
+ * only, as published by the Free Software Foundation.
 
6393
+ *
 
6394
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
6395
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
6396
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
6397
+ * GNU Lesser General Public License version 3 for more details
 
6398
+ * (a copy is included in the LICENSE file that accompanied this code).
 
6399
+ *
 
6400
+ * You should have received a copy of the GNU Lesser General Public License
 
6401
+ * version 3 along with OpenOffice.org.  If not, see
 
6402
+ * <http://www.openoffice.org/license.html>
 
6403
+ * for a copy of the LGPLv3 License.
 
6404
+ *
 
6405
+ ************************************************************************/
 
6406
+#ifndef SW_VBA_LISTFORMAT_HXX
 
6407
+#define SW_VBA_LISTFORMAT_HXX
 
6408
+
 
6409
+#include <ooo/vba/word/XListFormat.hpp>
 
6410
+#include <ooo/vba/word/XListTemplate.hpp>
 
6411
+#include <vbahelper/vbahelperinterface.hxx>
 
6412
+#include <cppuhelper/implbase1.hxx>
 
6413
+#include <com/sun/star/text/XTextRange.hpp>
 
6414
+#include "vbalisthelper.hxx"
 
6415
+
 
6416
+
 
6417
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XListFormat > SwVbaListFormat_BASE;
 
6418
+
 
6419
+class SwVbaListFormat : public SwVbaListFormat_BASE
 
6420
+{
 
6421
+private:
 
6422
+    css::uno::Reference< css::text::XTextRange > mxTextRange;
 
6423
+
 
6424
+public:
 
6425
+    SwVbaListFormat( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException );
 
6426
+    virtual ~SwVbaListFormat();
 
6427
+
 
6428
+    // Methods
 
6429
+    virtual void SAL_CALL ApplyListTemplate( const css::uno::Reference< ::ooo::vba::word::XListTemplate >& ListTemplate, const css::uno::Any& ContinuePreviousList, const css::uno::Any& ApplyTo, const css::uno::Any& DefaultListBehavior ) throw (css::uno::RuntimeException);
 
6430
+    virtual void SAL_CALL ConvertNumbersToText(  ) throw (css::uno::RuntimeException);
 
6431
+
 
6432
+    // XHelperInterface
 
6433
+    virtual rtl::OUString& getServiceImplName();
 
6434
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
6435
+};
 
6436
+#endif /* SW_VBA_LISTFORMAT_HXX */
 
6437
diff --git sw/source/ui/vba/vbalistgalleries.cxx sw/source/ui/vba/vbalistgalleries.cxx
 
6438
new file mode 100644
 
6439
index 0000000..ff09ae2
 
6440
--- /dev/null
 
6441
+++ sw/source/ui/vba/vbalistgalleries.cxx
 
6442
@@ -0,0 +1,115 @@
 
6443
+/*************************************************************************
 
6444
+ *
 
6445
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
6446
+ * 
 
6447
+ * Copyright 2008 by Sun Microsystems, Inc.
 
6448
+ *
 
6449
+ * OpenOffice.org - a multi-platform office productivity suite
 
6450
+ *
 
6451
+ * $RCSfile: 
 
6452
+ * $Revision: 
 
6453
+ *
 
6454
+ * This file is part of OpenOffice.org.
 
6455
+ *
 
6456
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
6457
+ * it under the terms of the GNU Lesser General Public License version 3
 
6458
+ * only, as published by the Free Software Foundation.
 
6459
+ *
 
6460
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
6461
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
6462
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
6463
+ * GNU Lesser General Public License version 3 for more details
 
6464
+ * (a copy is included in the LICENSE file that accompanied this code).
 
6465
+ *
 
6466
+ * You should have received a copy of the GNU Lesser General Public License
 
6467
+ * version 3 along with OpenOffice.org.  If not, see
 
6468
+ * <http://www.openoffice.org/license.html>
 
6469
+ * for a copy of the LGPLv3 License.
 
6470
+ *
 
6471
+ ************************************************************************/
 
6472
+#include "vbalistgalleries.hxx"
 
6473
+#include "vbalistgallery.hxx"
 
6474
+#include <ooo/vba/word/WdListGalleryType.hpp>
 
6475
+
 
6476
+using namespace ::ooo::vba;
 
6477
+using namespace ::com::sun::star;
 
6478
+
 
6479
+class ListGalleriesEnumWrapper : public EnumerationHelper_BASE
 
6480
+{
 
6481
+    SwVbaListGalleries* pListGalleries;
 
6482
+    sal_Int32 nIndex;
 
6483
+public:
 
6484
+    ListGalleriesEnumWrapper( SwVbaListGalleries* pGalleries ) : pListGalleries( pGalleries ), nIndex( 1 ) {}
 
6485
+    virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException)
 
6486
+    {
 
6487
+        return ( nIndex <= pListGalleries->getCount() );
 
6488
+    }
 
6489
+
 
6490
+    virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
 
6491
+    {
 
6492
+        if ( nIndex <= pListGalleries->getCount() )
 
6493
+            return pListGalleries->Item( uno::makeAny( nIndex++ ), uno::Any() );
 
6494
+        throw container::NoSuchElementException();
 
6495
+    }
 
6496
+};
 
6497
+
 
6498
+SwVbaListGalleries::SwVbaListGalleries( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xTextDoc ) throw (uno::RuntimeException) : SwVbaListGalleries_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >() ),  mxTextDocument( xTextDoc )
 
6499
+{
 
6500
+}
 
6501
+
 
6502
+::sal_Int32 SAL_CALL SwVbaListGalleries::getCount() throw (uno::RuntimeException)
 
6503
+{
 
6504
+    // 3 types of list( bullet, numbered and outline )
 
6505
+    return 3;
 
6506
+}
 
6507
+
 
6508
+uno::Any SAL_CALL SwVbaListGalleries::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
 
6509
+{
 
6510
+    sal_Int32 nIndex = 0;
 
6511
+    if( ( Index1 >>= nIndex ) == sal_True )
 
6512
+    {
 
6513
+        if( nIndex == word::WdListGalleryType::wdBulletGallery
 
6514
+            || nIndex == word::WdListGalleryType::wdNumberGallery
 
6515
+            || nIndex == word::WdListGalleryType::wdOutlineNumberGallery )
 
6516
+            return uno::makeAny( uno::Reference< word::XListGallery >( new SwVbaListGallery( this, mxContext, mxTextDocument, nIndex ) ) );
 
6517
+    }
 
6518
+    throw  uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
 
6519
+}
 
6520
+
 
6521
+// XEnumerationAccess
 
6522
+uno::Type
 
6523
+SwVbaListGalleries::getElementType() throw (uno::RuntimeException)
 
6524
+{
 
6525
+    return word::XListGallery::static_type(0);
 
6526
+}
 
6527
+
 
6528
+uno::Reference< container::XEnumeration >
 
6529
+SwVbaListGalleries::createEnumeration() throw (uno::RuntimeException)
 
6530
+{
 
6531
+    return new ListGalleriesEnumWrapper( this );
 
6532
+}
 
6533
+
 
6534
+uno::Any
 
6535
+SwVbaListGalleries::createCollectionObject( const css::uno::Any& aSource )
 
6536
+{
 
6537
+    return aSource;
 
6538
+}
 
6539
+
 
6540
+rtl::OUString& 
 
6541
+SwVbaListGalleries::getServiceImplName()
 
6542
+{
 
6543
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListGalleries") );
 
6544
+    return sImplName;
 
6545
+}
 
6546
+
 
6547
+css::uno::Sequence<rtl::OUString> 
 
6548
+SwVbaListGalleries::getServiceNames()
 
6549
+{
 
6550
+    static uno::Sequence< rtl::OUString > sNames;
 
6551
+    if ( sNames.getLength() == 0 )
 
6552
+    {
 
6553
+        sNames.realloc( 1 );
 
6554
+        sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListGalleries") );
 
6555
+    }
 
6556
+    return sNames;
 
6557
+}
 
6558
diff --git sw/source/ui/vba/vbalistgalleries.hxx sw/source/ui/vba/vbalistgalleries.hxx
 
6559
new file mode 100644
 
6560
index 0000000..36cd0ba
 
6561
--- /dev/null
 
6562
+++ sw/source/ui/vba/vbalistgalleries.hxx
 
6563
@@ -0,0 +1,61 @@
 
6564
+/*************************************************************************
 
6565
+ *
 
6566
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
6567
+ * 
 
6568
+ * Copyright 2008 by Sun Microsystems, Inc.
 
6569
+ *
 
6570
+ * OpenOffice.org - a multi-platform office productivity suite
 
6571
+ *
 
6572
+ * $RCSfile: 
 
6573
+ * $Revision: 
 
6574
+ *
 
6575
+ * This file is part of OpenOffice.org.
 
6576
+ *
 
6577
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
6578
+ * it under the terms of the GNU Lesser General Public License version 3
 
6579
+ * only, as published by the Free Software Foundation.
 
6580
+ *
 
6581
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
6582
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
6583
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
6584
+ * GNU Lesser General Public License version 3 for more details
 
6585
+ * (a copy is included in the LICENSE file that accompanied this code).
 
6586
+ *
 
6587
+ * You should have received a copy of the GNU Lesser General Public License
 
6588
+ * version 3 along with OpenOffice.org.  If not, see
 
6589
+ * <http://www.openoffice.org/license.html>
 
6590
+ * for a copy of the LGPLv3 License.
 
6591
+ *
 
6592
+ ************************************************************************/
 
6593
+#ifndef SW_VBA_LISTGALLERIES_HXX
 
6594
+#define SW_VBA_LISTGALLERIES_HXX
 
6595
+
 
6596
+#include <vbahelper/vbacollectionimpl.hxx>
 
6597
+#include <ooo/vba/word/XListGalleries.hpp>
 
6598
+#include <vbahelper/vbahelperinterface.hxx>
 
6599
+#include <com/sun/star/text/XTextDocument.hpp>
 
6600
+
 
6601
+typedef CollTestImplHelper< ooo::vba::word::XListGalleries > SwVbaListGalleries_BASE;
 
6602
+
 
6603
+class SwVbaListGalleries : public SwVbaListGalleries_BASE
 
6604
+{
 
6605
+private:
 
6606
+    css::uno::Reference< css::text::XTextDocument > mxTextDocument;
 
6607
+
 
6608
+public:
 
6609
+    SwVbaListGalleries( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextDocument >& xTextDoc ) throw (css::uno::RuntimeException);
 
6610
+    virtual ~SwVbaListGalleries() {}
 
6611
+
 
6612
+    virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
 
6613
+    virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& /*not processed in this base class*/ ) throw ( css::uno::RuntimeException );
 
6614
+    // XEnumerationAccess
 
6615
+    virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
 
6616
+    virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
 
6617
+
 
6618
+    // SwVbaListGalleries_BASE
 
6619
+    virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); 
 
6620
+    virtual rtl::OUString& getServiceImplName();
 
6621
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
6622
+};    
 
6623
+
 
6624
+#endif /* SW_VBA_LISTGALLERIES_HXX */
 
6625
diff --git sw/source/ui/vba/vbalistgallery.cxx sw/source/ui/vba/vbalistgallery.cxx
 
6626
new file mode 100644
 
6627
index 0000000..6ac7e7c
 
6628
--- /dev/null
 
6629
+++ sw/source/ui/vba/vbalistgallery.cxx
 
6630
@@ -0,0 +1,73 @@
 
6631
+/*************************************************************************
 
6632
+ *
 
6633
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
6634
+ * 
 
6635
+ * Copyright 2008 by Sun Microsystems, Inc.
 
6636
+ *
 
6637
+ * OpenOffice.org - a multi-platform office productivity suite
 
6638
+ *
 
6639
+ * $RCSfile: 
 
6640
+ * $Revision: 
 
6641
+ *
 
6642
+ * This file is part of OpenOffice.org.
 
6643
+ *
 
6644
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
6645
+ * it under the terms of the GNU Lesser General Public License version 3
 
6646
+ * only, as published by the Free Software Foundation.
 
6647
+ *
 
6648
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
6649
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
6650
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
6651
+ * GNU Lesser General Public License version 3 for more details
 
6652
+ * (a copy is included in the LICENSE file that accompanied this code).
 
6653
+ *
 
6654
+ * You should have received a copy of the GNU Lesser General Public License
 
6655
+ * version 3 along with OpenOffice.org.  If not, see
 
6656
+ * <http://www.openoffice.org/license.html>
 
6657
+ * for a copy of the LGPLv3 License.
 
6658
+ *
 
6659
+ ************************************************************************/
 
6660
+#include "vbalistgallery.hxx"
 
6661
+#include <vbahelper/vbahelper.hxx>
 
6662
+#include <tools/diagnose_ex.h>
 
6663
+#include "vbalisttemplates.hxx"
 
6664
+
 
6665
+using namespace ::ooo::vba;
 
6666
+using namespace ::com::sun::star;
 
6667
+
 
6668
+SwVbaListGallery::SwVbaListGallery( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& xTextDoc, sal_Int32 nType ) throw ( uno::RuntimeException ) : SwVbaListGallery_BASE( rParent, rContext ), mxTextDocument( xTextDoc ), mnType( nType )
 
6669
+{
 
6670
+}
 
6671
+
 
6672
+SwVbaListGallery::~SwVbaListGallery()
 
6673
+{
 
6674
+}
 
6675
+
 
6676
+uno::Any SAL_CALL
 
6677
+SwVbaListGallery::ListTemplates( const uno::Any& index ) throw (uno::RuntimeException)
 
6678
+{
 
6679
+    uno::Reference< XCollection > xCol( new SwVbaListTemplates( mxParent, mxContext, mxTextDocument, mnType ) );
 
6680
+    if ( index.hasValue() )
 
6681
+        return xCol->Item( index, uno::Any() );
 
6682
+    return uno::makeAny( xCol );
 
6683
+}
 
6684
+
 
6685
+rtl::OUString& 
 
6686
+SwVbaListGallery::getServiceImplName()
 
6687
+{
 
6688
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListGallery") );
 
6689
+    return sImplName;
 
6690
+}
 
6691
+
 
6692
+uno::Sequence< rtl::OUString > 
 
6693
+SwVbaListGallery::getServiceNames()
 
6694
+{
 
6695
+    static uno::Sequence< rtl::OUString > aServiceNames;
 
6696
+    if ( aServiceNames.getLength() == 0 )
 
6697
+    {
 
6698
+        aServiceNames.realloc( 1 );
 
6699
+        aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListGallery" ) );
 
6700
+    }
 
6701
+    return aServiceNames;
 
6702
+}
 
6703
+
 
6704
diff --git sw/source/ui/vba/vbalistgallery.hxx sw/source/ui/vba/vbalistgallery.hxx
 
6705
new file mode 100644
 
6706
index 0000000..0ece178
 
6707
--- /dev/null
 
6708
+++ sw/source/ui/vba/vbalistgallery.hxx
 
6709
@@ -0,0 +1,58 @@
 
6710
+/*************************************************************************
 
6711
+ *
 
6712
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
6713
+ * 
 
6714
+ * Copyright 2008 by Sun Microsystems, Inc.
 
6715
+ *
 
6716
+ * OpenOffice.org - a multi-platform office productivity suite
 
6717
+ *
 
6718
+ * $RCSfile: 
 
6719
+ * $Revision: 
 
6720
+ *
 
6721
+ * This file is part of OpenOffice.org.
 
6722
+ *
 
6723
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
6724
+ * it under the terms of the GNU Lesser General Public License version 3
 
6725
+ * only, as published by the Free Software Foundation.
 
6726
+ *
 
6727
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
6728
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
6729
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
6730
+ * GNU Lesser General Public License version 3 for more details
 
6731
+ * (a copy is included in the LICENSE file that accompanied this code).
 
6732
+ *
 
6733
+ * You should have received a copy of the GNU Lesser General Public License
 
6734
+ * version 3 along with OpenOffice.org.  If not, see
 
6735
+ * <http://www.openoffice.org/license.html>
 
6736
+ * for a copy of the LGPLv3 License.
 
6737
+ *
 
6738
+ ************************************************************************/
 
6739
+#ifndef SW_VBA_LISTGALLERY_HXX
 
6740
+#define SW_VBA_LISTGALLERY_HXX
 
6741
+
 
6742
+#include <ooo/vba/word/XListGallery.hpp>
 
6743
+#include <vbahelper/vbahelperinterface.hxx>
 
6744
+#include <cppuhelper/implbase1.hxx>
 
6745
+#include <com/sun/star/text/XTextDocument.hpp>
 
6746
+
 
6747
+
 
6748
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XListGallery > SwVbaListGallery_BASE;
 
6749
+
 
6750
+class SwVbaListGallery : public SwVbaListGallery_BASE
 
6751
+{
 
6752
+private:
 
6753
+    css::uno::Reference< css::text::XTextDocument > mxTextDocument;
 
6754
+    sal_Int32 mnType;
 
6755
+
 
6756
+public:
 
6757
+    SwVbaListGallery( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nType ) throw ( css::uno::RuntimeException );
 
6758
+    virtual ~SwVbaListGallery();
 
6759
+
 
6760
+    // Methods
 
6761
+    virtual css::uno::Any SAL_CALL ListTemplates( const css::uno::Any& index ) throw ( css::uno::RuntimeException );
 
6762
+
 
6763
+    // XHelperInterface
 
6764
+    virtual rtl::OUString& getServiceImplName();
 
6765
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
6766
+};
 
6767
+#endif /* SW_VBA_LISTGALLERY_HXX */
 
6768
diff --git sw/source/ui/vba/vbalisthelper.cxx sw/source/ui/vba/vbalisthelper.cxx
 
6769
new file mode 100644
 
6770
index 0000000..34cd6be
 
6771
--- /dev/null
 
6772
+++ sw/source/ui/vba/vbalisthelper.cxx
 
6773
@@ -0,0 +1,707 @@
 
6774
+/*************************************************************************
 
6775
+ *
 
6776
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
6777
+ * 
 
6778
+ * Copyright 2008 by Sun Microsystems, Inc.
 
6779
+ *
 
6780
+ * OpenOffice.org - a multi-platform office productivity suite
 
6781
+ *
 
6782
+ * $RCSfile: 
 
6783
+ * $Revision: 
 
6784
+ *
 
6785
+ * This file is part of OpenOffice.org.
 
6786
+ *
 
6787
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
6788
+ * it under the terms of the GNU Lesser General Public License version 3
 
6789
+ * only, as published by the Free Software Foundation.
 
6790
+ *
 
6791
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
6792
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
6793
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
6794
+ * GNU Lesser General Public License version 3 for more details
 
6795
+ * (a copy is included in the LICENSE file that accompanied this code).
 
6796
+ *
 
6797
+ * You should have received a copy of the GNU Lesser General Public License
 
6798
+ * version 3 along with OpenOffice.org.  If not, see
 
6799
+ * <http://www.openoffice.org/license.html>
 
6800
+ * for a copy of the LGPLv3 License.
 
6801
+ *
 
6802
+ ************************************************************************/
 
6803
+#include "vbalisthelper.hxx"
 
6804
+#include <tools/diagnose_ex.h>
 
6805
+#include <ooo/vba/word/WdListGalleryType.hpp>
 
6806
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 
6807
+#include <com/sun/star/style/NumberingType.hpp>
 
6808
+#include <com/sun/star/container/XIndexReplace.hpp>
 
6809
+
 
6810
+using namespace ::ooo::vba;
 
6811
+using namespace ::com::sun::star;
 
6812
+
 
6813
+static const sal_Int32 LIST_LEVEL_COUNT = 9;
 
6814
+
 
6815
+static const char WORD_BULLET_GALLERY[] = "WdBullet";
 
6816
+static const char WORD_NUMBER_GALLERY[] = "WdNumber";
 
6817
+static const char WORD_OUTLINE_NUMBER_GALLERY[] = "WdOutlineNumber";
 
6818
+
 
6819
+static const char UNO_NAME_ADJUST[] = "Adjust";
 
6820
+static const char UNO_NAME_PARENT_NUMBERING[] = "ParentNumbering";
 
6821
+static const char UNO_NAME_PREFIX[] = "Prefix";
 
6822
+static const char UNO_NAME_SUFFIX[] = "Suffix";
 
6823
+static const char UNO_NAME_CHAR_STYLE_NAME[] = "CharStyleName";
 
6824
+static const char UNO_NAME_START_WITH[] = "StartWith";
 
6825
+static const char UNO_NAME_POSITION_AND_SPACE_MODE[] = "PositionAndSpaceMode";
 
6826
+static const char UNO_NAME_LABEL_FOLLOWED_BY[] = "LabelFollowedBy";
 
6827
+static const char UNO_NAME_LIST_TAB_STOP_POSITION[] = "ListtabStopPosition";
 
6828
+static const char UNO_NAME_FIRST_LINE_INDENT[] = "FirstLineIndent";
 
6829
+static const char UNO_NAME_INDENT_AT[] = "IndentAt";
 
6830
+static const char UNO_NAME_NUMBERING_TYPE[] = "NumberingType";
 
6831
+static const char UNO_NAME_BULLET_ID[] = "BulletId";
 
6832
+static const char UNO_NAME_BULLET_CHAR[] = "BulletChar";
 
6833
+static const char UNO_NAME_BULLET_FONT_NAME[] = "BulletFontName";
 
6834
+static const char UNO_NAME_BULLET_FONT[] = "BulletFont";
 
6835
+
 
6836
+static const sal_Int16 CHAR_CLOSED_DOT = 8226;
 
6837
+static const sal_Int16 CHAR_EMPTY_DOT = 111;
 
6838
+static const sal_Int16 CHAR_SQUARE = 9632;
 
6839
+static const sal_Int16 CHAR_STAR_SYMBOL = 10026;
 
6840
+static const sal_Int16 CHAR_FOUR_DIAMONDS = 10070;
 
6841
+static const sal_Int16 CHAR_DIAMOND = 10022;
 
6842
+static const sal_Int16 CHAR_ARROW = 10146;
 
6843
+static const sal_Int16 CHAR_CHECK_MARK = 10003;
 
6844
+
 
6845
+SwVbaListHelper::SwVbaListHelper( const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nGalleryType, sal_Int32 nTemplateType ) throw( css::uno::RuntimeException ) : mxTextDocument( xTextDoc ), mnGalleryType( nGalleryType ), mnTemplateType( nTemplateType )
 
6846
+{
 
6847
+    Init();
 
6848
+}
 
6849
+
 
6850
+void SwVbaListHelper::Init() throw( css::uno::RuntimeException )
 
6851
+{
 
6852
+    // set the numbering style name
 
6853
+    switch( mnGalleryType )
 
6854
+    {
 
6855
+        case word::WdListGalleryType::wdBulletGallery:
 
6856
+        {
 
6857
+            msStyleName = rtl::OUString::createFromAscii( WORD_BULLET_GALLERY );
 
6858
+            break;
 
6859
+        }
 
6860
+        case word::WdListGalleryType::wdNumberGallery:
 
6861
+        {
 
6862
+            msStyleName = rtl::OUString::createFromAscii( WORD_NUMBER_GALLERY );
 
6863
+            break;
 
6864
+        }
 
6865
+        case word::WdListGalleryType::wdOutlineNumberGallery:
 
6866
+        {
 
6867
+            msStyleName = rtl::OUString::createFromAscii( WORD_OUTLINE_NUMBER_GALLERY );
 
6868
+            break;
 
6869
+        }
 
6870
+        default:
 
6871
+        {
 
6872
+            throw uno::RuntimeException();
 
6873
+        }
 
6874
+    }
 
6875
+    msStyleName += rtl::OUString::valueOf( mnTemplateType );
 
6876
+
 
6877
+    // get the numbering style 
 
6878
+    uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxTextDocument, uno::UNO_QUERY_THROW );
 
6879
+    mxStyleFamily.set( xStyleSupplier->getStyleFamilies()->getByName(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") ) ), uno::UNO_QUERY_THROW );
 
6880
+    OSL_TRACE("SwVbaListHelper::Init: numbering style name: %s", rtl::OUStringToOString( msStyleName, RTL_TEXTENCODING_UTF8 ).getStr() );
 
6881
+    if( mxStyleFamily->hasByName( msStyleName ) )
 
6882
+    {
 
6883
+        mxStyleProps.set( mxStyleFamily->getByName( msStyleName ), uno::UNO_QUERY_THROW );
 
6884
+        mxNumberingRules.set( mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) ), uno::UNO_QUERY_THROW );
 
6885
+    }    
 
6886
+    else
 
6887
+    {
 
6888
+        // create new numbering style
 
6889
+        uno::Reference< lang::XMultiServiceFactory > xDocMSF( mxTextDocument, uno::UNO_QUERY_THROW );
 
6890
+        mxStyleProps.set( xDocMSF->createInstance(  rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.NumberingStyle") ) ), uno::UNO_QUERY_THROW );
 
6891
+        // insert this style into style family, or the property NumberingRules doesn't exist.
 
6892
+        mxStyleFamily->insertByName( msStyleName, uno::makeAny( mxStyleProps ) );
 
6893
+        mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) ) >>= mxNumberingRules;
 
6894
+        //mxNumberingRules.set( xDocMSF->createInstance(  rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.NumberingRules") ) ), uno::UNO_QUERY_THROW );
 
6895
+
 
6896
+        CreateListTemplate();
 
6897
+
 
6898
+        mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) , uno::makeAny( mxNumberingRules ) );
 
6899
+    }
 
6900
+}
 
6901
+
 
6902
+void SwVbaListHelper::CreateListTemplate() throw( css::uno::RuntimeException )
 
6903
+{
 
6904
+    switch( mnGalleryType )
 
6905
+    {
 
6906
+        case word::WdListGalleryType::wdBulletGallery:
 
6907
+        {
 
6908
+            CreateBulletListTemplate();
 
6909
+            break;
 
6910
+        }
 
6911
+        case word::WdListGalleryType::wdNumberGallery:
 
6912
+        {
 
6913
+            CreateNumberListTemplate();
 
6914
+            break;
 
6915
+        }
 
6916
+        case word::WdListGalleryType::wdOutlineNumberGallery:
 
6917
+        {
 
6918
+            CreateOutlineNumberListTemplate();
 
6919
+            break;
 
6920
+        }
 
6921
+        default:
 
6922
+        {
 
6923
+            throw uno::RuntimeException();
 
6924
+        }
 
6925
+    }
 
6926
+}
 
6927
+
 
6928
+void SwVbaListHelper::CreateBulletListTemplate() throw( css::uno::RuntimeException )
 
6929
+{
 
6930
+    // there is only 1 level for each bullet list in MSWord
 
6931
+    sal_Int32 nLevel = 0;
 
6932
+    uno::Sequence< beans::PropertyValue > aPropertyValues;
 
6933
+    mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
 
6934
+    rtl::OUString sCharStyleName( RTL_CONSTASCII_USTRINGPARAM("Bullet Symbols") );
 
6935
+    setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_CHAR_STYLE_NAME ), uno::makeAny( sCharStyleName ) );
 
6936
+    sal_Int16 nNumberingType = style::NumberingType::CHAR_SPECIAL;
 
6937
+    setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
 
6938
+
 
6939
+    rtl::OUString aBulletChar;
 
6940
+    switch( mnTemplateType )
 
6941
+    {
 
6942
+        case 1:
 
6943
+        {
 
6944
+            aBulletChar = rtl::OUString( sal_Unicode( CHAR_CLOSED_DOT ) );
 
6945
+            break;
 
6946
+        }
 
6947
+        case 2:
 
6948
+        {
 
6949
+            aBulletChar = rtl::OUString( sal_Unicode( CHAR_EMPTY_DOT ) );
 
6950
+            break;
 
6951
+        }
 
6952
+        case 3:
 
6953
+        {
 
6954
+            aBulletChar = rtl::OUString( sal_Unicode( CHAR_SQUARE ) );
 
6955
+            break;
 
6956
+        }
 
6957
+        case 4:
 
6958
+        {
 
6959
+            aBulletChar = rtl::OUString( sal_Unicode( CHAR_STAR_SYMBOL ) );
 
6960
+            break;
 
6961
+        }
 
6962
+        case 5:
 
6963
+        {
 
6964
+            aBulletChar = rtl::OUString( sal_Unicode( CHAR_FOUR_DIAMONDS ) );
 
6965
+            break;
 
6966
+        }
 
6967
+        case 6:
 
6968
+        {
 
6969
+            aBulletChar = rtl::OUString( sal_Unicode( CHAR_ARROW ) );
 
6970
+            break;
 
6971
+        }
 
6972
+        case 7:
 
6973
+        {
 
6974
+            aBulletChar = rtl::OUString( sal_Unicode( CHAR_CHECK_MARK ) );
 
6975
+            break;
 
6976
+        }
 
6977
+        default:
 
6978
+        {
 
6979
+            // we only support 7 types template now
 
6980
+            throw css::uno::RuntimeException();
 
6981
+        }
 
6982
+    }
 
6983
+    setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_BULLET_CHAR ), uno::makeAny( aBulletChar ) );
 
6984
+
 
6985
+    mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
 
6986
+}
 
6987
+
 
6988
+void SwVbaListHelper::CreateNumberListTemplate() throw( css::uno::RuntimeException )
 
6989
+{
 
6990
+    // there is only 1 level for each bullet list in MSWord
 
6991
+    sal_Int32 nLevel = 0;
 
6992
+    uno::Sequence< beans::PropertyValue > aPropertyValues;
 
6993
+    mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
 
6994
+
 
6995
+    sal_Int16 nNumberingType = 0;
 
6996
+    rtl::OUString sSuffix;
 
6997
+    switch( mnTemplateType )
 
6998
+    {
 
6999
+        case 1:
 
7000
+        {
 
7001
+            nNumberingType = style::NumberingType::ARABIC;
 
7002
+            sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
 
7003
+            break;
 
7004
+        }
 
7005
+        case 2:
 
7006
+        {
 
7007
+            nNumberingType = style::NumberingType::ARABIC;
 
7008
+            sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
 
7009
+            break;
 
7010
+        }
 
7011
+        case 3:
 
7012
+        {
 
7013
+            nNumberingType = style::NumberingType::ROMAN_UPPER;
 
7014
+            sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
 
7015
+            break;
 
7016
+        }
 
7017
+        case 4:
 
7018
+        {
 
7019
+            nNumberingType = style::NumberingType::CHARS_UPPER_LETTER;
 
7020
+            sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
 
7021
+            break;
 
7022
+        }
 
7023
+        case 5:
 
7024
+        {
 
7025
+            nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
 
7026
+            sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
 
7027
+            break;
 
7028
+        }
 
7029
+        case 6:
 
7030
+        {
 
7031
+            nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
 
7032
+            sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
 
7033
+            break;
 
7034
+        }
 
7035
+        case 7:
 
7036
+        {
 
7037
+            nNumberingType = style::NumberingType::ROMAN_LOWER;
 
7038
+            sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
 
7039
+            break;
 
7040
+        }
 
7041
+        default:
 
7042
+        {
 
7043
+            // we only support 7 types template now
 
7044
+            throw css::uno::RuntimeException();
 
7045
+        }
 
7046
+    }
 
7047
+    setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
 
7048
+    setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
 
7049
+
 
7050
+    mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
 
7051
+}
 
7052
+
 
7053
+void SwVbaListHelper::CreateOutlineNumberListTemplate() throw( css::uno::RuntimeException )
 
7054
+{
 
7055
+    switch( mnTemplateType )
 
7056
+    {
 
7057
+        case 1:
 
7058
+        {
 
7059
+            CreateOutlineNumberForType1();
 
7060
+            break;
 
7061
+        }
 
7062
+        case 2:
 
7063
+        {
 
7064
+            CreateOutlineNumberForType2();
 
7065
+            break;
 
7066
+        }
 
7067
+        case 3:
 
7068
+        {
 
7069
+            CreateOutlineNumberForType3();
 
7070
+            break;
 
7071
+        }
 
7072
+        case 4:
 
7073
+        {
 
7074
+            CreateOutlineNumberForType4();
 
7075
+            break;
 
7076
+        }
 
7077
+        case 5:
 
7078
+        {
 
7079
+            CreateOutlineNumberForType5();
 
7080
+            break;
 
7081
+        }
 
7082
+        case 6:
 
7083
+        {
 
7084
+            CreateOutlineNumberForType6();
 
7085
+            break;
 
7086
+        }
 
7087
+        case 7:
 
7088
+        {
 
7089
+            CreateOutlineNumberForType7();
 
7090
+            break;
 
7091
+        }
 
7092
+        default:
 
7093
+        {
 
7094
+            // we only support 7 types template now
 
7095
+            throw css::uno::RuntimeException();
 
7096
+        }
 
7097
+    }    
 
7098
+}
 
7099
+
 
7100
+void SwVbaListHelper::CreateOutlineNumberForType1() throw( css::uno::RuntimeException )
 
7101
+{
 
7102
+    sal_Int16 nNumberingType = 0;
 
7103
+    rtl::OUString sPrefix;
 
7104
+    rtl::OUString sSuffix;
 
7105
+    uno::Sequence< beans::PropertyValue > aPropertyValues;
 
7106
+
 
7107
+    for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
 
7108
+    {
 
7109
+        mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
 
7110
+        switch( nLevel )
 
7111
+        {
 
7112
+            case 0:
 
7113
+            case 1:
 
7114
+            {
 
7115
+                nNumberingType = style::NumberingType::ARABIC;
 
7116
+                sPrefix = rtl::OUString();
 
7117
+                sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
 
7118
+                break;
 
7119
+            }
 
7120
+            case 2:
 
7121
+            {
 
7122
+                nNumberingType = style::NumberingType::ROMAN_LOWER;
 
7123
+                sPrefix = rtl::OUString();
 
7124
+                sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
 
7125
+                break;
 
7126
+            }
 
7127
+            case 3:
 
7128
+            {
 
7129
+                nNumberingType = style::NumberingType::ARABIC;
 
7130
+                sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
 
7131
+                sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
 
7132
+                break;
 
7133
+            }
 
7134
+            case 4:
 
7135
+            {
 
7136
+                nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
 
7137
+                sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
 
7138
+                sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
 
7139
+                break;
 
7140
+            }
 
7141
+            case 5:
 
7142
+            {
 
7143
+                nNumberingType = style::NumberingType::ROMAN_LOWER;
 
7144
+                sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
 
7145
+                sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
 
7146
+                break;
 
7147
+            }
 
7148
+            case 6:
 
7149
+            {
 
7150
+                nNumberingType = style::NumberingType::ARABIC;
 
7151
+                sPrefix = rtl::OUString();
 
7152
+                sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
 
7153
+                break;
 
7154
+            }
 
7155
+            case 7:
 
7156
+            {
 
7157
+                nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
 
7158
+                sPrefix = rtl::OUString();
 
7159
+                sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
 
7160
+                break;
 
7161
+            }
 
7162
+            case 8:
 
7163
+            {
 
7164
+                nNumberingType = style::NumberingType::ROMAN_LOWER;
 
7165
+                sPrefix = rtl::OUString();
 
7166
+                sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
 
7167
+                break;
 
7168
+            }
 
7169
+            default:
 
7170
+            {
 
7171
+                throw uno::RuntimeException();
 
7172
+            }
 
7173
+        }
 
7174
+        setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
 
7175
+        setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PREFIX ), uno::makeAny( sPrefix ) );
 
7176
+        setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
 
7177
+        mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
 
7178
+    }
 
7179
+}
 
7180
+
 
7181
+void SwVbaListHelper::CreateOutlineNumberForType2() throw( css::uno::RuntimeException )
 
7182
+{
 
7183
+    sal_Int16 nNumberingType = style::NumberingType::ARABIC;
 
7184
+    sal_Int16 nParentNumbering = 0;
 
7185
+    rtl::OUString sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
 
7186
+    uno::Sequence< beans::PropertyValue > aPropertyValues;
 
7187
+
 
7188
+    for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
 
7189
+    {
 
7190
+        mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
 
7191
+        setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
 
7192
+        setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
 
7193
+        if( nLevel != 0 )
 
7194
+        {
 
7195
+            nParentNumbering = sal_Int16( nLevel - 1 );
 
7196
+            setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PARENT_NUMBERING ), uno::makeAny( nParentNumbering ) );
 
7197
+        }
 
7198
+        mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
 
7199
+    }    
 
7200
+}
 
7201
+
 
7202
+void SwVbaListHelper::CreateOutlineNumberForType3() throw( css::uno::RuntimeException )
 
7203
+{
 
7204
+    sal_Int16 nNumberingType = style::NumberingType::CHAR_SPECIAL;
 
7205
+    rtl::OUString sCharStyleName( RTL_CONSTASCII_USTRINGPARAM("Bullet Symbols") );
 
7206
+    rtl::OUString aBulletChar;
 
7207
+    uno::Sequence< beans::PropertyValue > aPropertyValues;
 
7208
+
 
7209
+    for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
 
7210
+    {
 
7211
+        mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
 
7212
+        setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
 
7213
+        setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_CHAR_STYLE_NAME ), uno::makeAny( sCharStyleName ) );
 
7214
+        switch( nLevel )
 
7215
+        {
 
7216
+            case 0:
 
7217
+            {
 
7218
+                aBulletChar = rtl::OUString( sal_Unicode( CHAR_FOUR_DIAMONDS ) );
 
7219
+                break;
 
7220
+            }
 
7221
+            case 1:
 
7222
+            case 5:
 
7223
+            {
 
7224
+                aBulletChar = rtl::OUString( sal_Unicode( CHAR_ARROW ) );
 
7225
+                break;
 
7226
+            }
 
7227
+            case 2:
 
7228
+            case 6:
 
7229
+            {
 
7230
+                aBulletChar = rtl::OUString( sal_Unicode( CHAR_SQUARE ) );
 
7231
+                break;
 
7232
+            }
 
7233
+            case 3:
 
7234
+            case 7:
 
7235
+            {
 
7236
+                aBulletChar = rtl::OUString( sal_Unicode( CHAR_CLOSED_DOT ) );
 
7237
+                break;
 
7238
+            }
 
7239
+            case 4:
 
7240
+            case 8:
 
7241
+            {
 
7242
+                aBulletChar = rtl::OUString( sal_Unicode( CHAR_DIAMOND ) );
 
7243
+                break;
 
7244
+            }
 
7245
+            default:
 
7246
+            {
 
7247
+                throw uno::RuntimeException();
 
7248
+            }
 
7249
+        }
 
7250
+        setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_BULLET_CHAR ), uno::makeAny( aBulletChar ) );
 
7251
+        mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
 
7252
+    }    
 
7253
+}
 
7254
+
 
7255
+void SwVbaListHelper::CreateOutlineNumberForType4() throw( css::uno::RuntimeException )
 
7256
+{
 
7257
+    sal_Int16 nNumberingType = 0;
 
7258
+    rtl::OUString sPrefix;
 
7259
+    rtl::OUString sSuffix;
 
7260
+    uno::Sequence< beans::PropertyValue > aPropertyValues;
 
7261
+
 
7262
+    for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
 
7263
+    {
 
7264
+        mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
 
7265
+        switch( nLevel )
 
7266
+        {
 
7267
+            case 0:
 
7268
+            {
 
7269
+                nNumberingType = style::NumberingType::ROMAN_UPPER;
 
7270
+                sPrefix = rtl::OUString();
 
7271
+                sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
 
7272
+                break;
 
7273
+            }
 
7274
+            case 1:
 
7275
+            {
 
7276
+                nNumberingType = style::NumberingType::ARABIC;
 
7277
+                sPrefix = rtl::OUString();
 
7278
+                sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
 
7279
+                sal_Int16 nParentNumbering = 0;
 
7280
+                setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PARENT_NUMBERING ), uno::makeAny( nParentNumbering ) );
 
7281
+                break;
 
7282
+            }
 
7283
+            case 2:
 
7284
+            {
 
7285
+                nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
 
7286
+                sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
 
7287
+                sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
 
7288
+                break;
 
7289
+            }
 
7290
+            case 3:
 
7291
+            {
 
7292
+                nNumberingType = style::NumberingType::ROMAN_LOWER;
 
7293
+                sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
 
7294
+                sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
 
7295
+                break;
 
7296
+            }
 
7297
+            case 4:
 
7298
+            {
 
7299
+                nNumberingType = style::NumberingType::ARABIC;
 
7300
+                sPrefix = rtl::OUString();
 
7301
+                sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
 
7302
+                break;
 
7303
+            }
 
7304
+            case 5:
 
7305
+            {
 
7306
+                nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
 
7307
+                sPrefix = rtl::OUString();
 
7308
+                sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
 
7309
+                break;
 
7310
+            }
 
7311
+            case 6:
 
7312
+            {
 
7313
+                nNumberingType = style::NumberingType::ROMAN_LOWER;
 
7314
+                sPrefix = rtl::OUString();
 
7315
+                sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
 
7316
+                break;
 
7317
+            }
 
7318
+            case 7:
 
7319
+            {
 
7320
+                nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
 
7321
+                sPrefix = rtl::OUString();
 
7322
+                sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
 
7323
+                break;
 
7324
+            }
 
7325
+            case 8:
 
7326
+            {
 
7327
+                nNumberingType = style::NumberingType::ROMAN_LOWER;
 
7328
+                sPrefix = rtl::OUString();
 
7329
+                sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
 
7330
+                break;
 
7331
+            }
 
7332
+            default:
 
7333
+            {
 
7334
+                throw uno::RuntimeException();
 
7335
+            }
 
7336
+        }
 
7337
+        setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
 
7338
+        setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PREFIX ), uno::makeAny( sPrefix ) );
 
7339
+        setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
 
7340
+        mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
 
7341
+    }
 
7342
+}
 
7343
+
 
7344
+void SwVbaListHelper::CreateOutlineNumberForType5() throw( css::uno::RuntimeException )
 
7345
+{
 
7346
+    sal_Int16 nNumberingType = style::NumberingType::ARABIC;
 
7347
+    sal_Int16 nParentNumbering = 0;
 
7348
+    uno::Sequence< beans::PropertyValue > aPropertyValues;
 
7349
+
 
7350
+    for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
 
7351
+    {
 
7352
+        mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
 
7353
+        setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
 
7354
+        if( nLevel != 0 )
 
7355
+        {
 
7356
+            nParentNumbering = sal_Int16( nLevel - 1 );
 
7357
+            setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PARENT_NUMBERING ), uno::makeAny( nParentNumbering ) );
 
7358
+        }
 
7359
+        mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
 
7360
+    }    
 
7361
+}
 
7362
+
 
7363
+void SwVbaListHelper::CreateOutlineNumberForType6() throw( css::uno::RuntimeException )
 
7364
+{
 
7365
+    sal_Int16 nNumberingType = 0;
 
7366
+    rtl::OUString sPrefix;
 
7367
+    rtl::OUString sSuffix;
 
7368
+    uno::Sequence< beans::PropertyValue > aPropertyValues;
 
7369
+
 
7370
+    for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
 
7371
+    {
 
7372
+        mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
 
7373
+        switch( nLevel )
 
7374
+        {
 
7375
+            case 0:
 
7376
+            {
 
7377
+                nNumberingType = style::NumberingType::ROMAN_UPPER;
 
7378
+                sPrefix = rtl::OUString();
 
7379
+                sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
 
7380
+                break;
 
7381
+            }
 
7382
+            case 1:
 
7383
+            {
 
7384
+                nNumberingType = style::NumberingType::CHARS_UPPER_LETTER;
 
7385
+                sPrefix = rtl::OUString();
 
7386
+                sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
 
7387
+                break;
 
7388
+            }
 
7389
+            case 2:
 
7390
+            {
 
7391
+                nNumberingType = style::NumberingType::ARABIC;
 
7392
+                sPrefix = rtl::OUString();
 
7393
+                sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
 
7394
+                break;
 
7395
+            }
 
7396
+            case 3:
 
7397
+            {
 
7398
+                nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
 
7399
+                sPrefix = rtl::OUString();
 
7400
+                sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
 
7401
+                break;
 
7402
+            }
 
7403
+            case 4:
 
7404
+            {
 
7405
+                nNumberingType = style::NumberingType::ARABIC;
 
7406
+                sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
 
7407
+                sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
 
7408
+                break;
 
7409
+            }
 
7410
+            case 5:
 
7411
+            {
 
7412
+                nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
 
7413
+                sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
 
7414
+                sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
 
7415
+                break;
 
7416
+            }
 
7417
+            case 6:
 
7418
+            {
 
7419
+                nNumberingType = style::NumberingType::ROMAN_LOWER;
 
7420
+                sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
 
7421
+                sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
 
7422
+                break;
 
7423
+            }
 
7424
+            case 7:
 
7425
+            {
 
7426
+                nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
 
7427
+                sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
 
7428
+                sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
 
7429
+                break;
 
7430
+            }
 
7431
+            case 8:
 
7432
+            {
 
7433
+                nNumberingType = style::NumberingType::ROMAN_LOWER;
 
7434
+                sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
 
7435
+                sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
 
7436
+                break;
 
7437
+            }
 
7438
+            default:
 
7439
+            {
 
7440
+                throw uno::RuntimeException();
 
7441
+            }
 
7442
+        }
 
7443
+        setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
 
7444
+        setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PREFIX ), uno::makeAny( sPrefix ) );
 
7445
+        setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
 
7446
+        mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
 
7447
+    }
 
7448
+}
 
7449
+
 
7450
+void SwVbaListHelper::CreateOutlineNumberForType7() throw( css::uno::RuntimeException )
 
7451
+{
 
7452
+    sal_Int16 nNumberingType = style::NumberingType::ARABIC;
 
7453
+    uno::Sequence< beans::PropertyValue > aPropertyValues;
 
7454
+    rtl::OUString sPrefix = rtl::OUString::createFromAscii("Chapter ");
 
7455
+
 
7456
+    for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
 
7457
+    {
 
7458
+        mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
 
7459
+        setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
 
7460
+        setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PREFIX ), uno::makeAny( sPrefix ) );
 
7461
+        mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
 
7462
+    }    
 
7463
+}
 
7464
+
 
7465
+uno::Any SwVbaListHelper::getPropertyValueWithNameAndLevel( sal_Int32 nLevel, const rtl::OUString& sName ) throw( css::uno::RuntimeException )
 
7466
+{
 
7467
+    uno::Sequence< beans::PropertyValue > aPropertyValues;   
 
7468
+    mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
 
7469
+    return getPropertyValue( aPropertyValues, sName );
 
7470
+}
 
7471
+
 
7472
+void SwVbaListHelper::setPropertyValueWithNameAndLevel( sal_Int32 nLevel, const rtl::OUString& sName, const css::uno::Any& aValue ) throw( css::uno::RuntimeException )
 
7473
+{
 
7474
+    uno::Sequence< beans::PropertyValue > aPropertyValues;   
 
7475
+    mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
 
7476
+    setOrAppendPropertyValue( aPropertyValues, sName, aValue );
 
7477
+    mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
 
7478
+    mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) , uno::makeAny( mxNumberingRules ) );
 
7479
+}
 
7480
+
 
7481
diff --git sw/source/ui/vba/vbalisthelper.hxx sw/source/ui/vba/vbalisthelper.hxx
 
7482
new file mode 100644
 
7483
index 0000000..0f5fa26
 
7484
--- /dev/null
 
7485
+++ sw/source/ui/vba/vbalisthelper.hxx
 
7486
@@ -0,0 +1,82 @@
 
7487
+/*************************************************************************
 
7488
+ *
 
7489
+ *  OpenOffice.org - a multi-platform office productivity suite
 
7490
+ *
 
7491
+ *  $RCSfile$
 
7492
+ *
 
7493
+ *  $Revision$
 
7494
+ *
 
7495
+ *  last change: $Author$ $Date$
 
7496
+ *
 
7497
+ *  The Contents of this file are made available subject to
 
7498
+ *  the terms of GNU Lesser General Public License Version 2.1.
 
7499
+ *
 
7500
+ *
 
7501
+ *    GNU Lesser General Public License Version 2.1
 
7502
+ *    =============================================
 
7503
+ *    Copyright 2005 by Sun Microsystems, Inc.
 
7504
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
 
7505
+ *
 
7506
+ *    This library is free software; you can redistribute it and/or
 
7507
+ *    modify it under the terms of the GNU Lesser General Public
 
7508
+ *    License version 2.1, as published by the Free Software Foundation.
 
7509
+ *
 
7510
+ *    This library is distributed in the hope that it will be useful,
 
7511
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
7512
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
7513
+ *    Lesser General Public License for more details.
 
7514
+ *
 
7515
+ *    You should have received a copy of the GNU Lesser General Public
 
7516
+ *    License along with this library; if not, write to the Free Software
 
7517
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 
7518
+ *    MA  02111-1307  USA
 
7519
+ *
 
7520
+ ************************************************************************/
 
7521
+#ifndef SW_VBA_LISTHELPER_HXX
 
7522
+#define SW_VBA_LISTHELPER_HXX
 
7523
+
 
7524
+#include <vbahelper/vbahelperinterface.hxx>
 
7525
+#include <com/sun/star/container/XIndexReplace.hpp>
 
7526
+#include <com/sun/star/container/XNameContainer.hpp>
 
7527
+#include <com/sun/star/text/XTextDocument.hpp>
 
7528
+#include <boost/shared_ptr.hpp>
 
7529
+
 
7530
+
 
7531
+class SwVbaListHelper;
 
7532
+typedef ::boost::shared_ptr< SwVbaListHelper > SwVbaListHelperRef;
 
7533
+
 
7534
+class SwVbaListHelper
 
7535
+{
 
7536
+private:
 
7537
+    css::uno::Reference< css::text::XTextDocument > mxTextDocument;
 
7538
+    css::uno::Reference< css::container::XIndexReplace > mxNumberingRules;
 
7539
+    css::uno::Reference< css::container::XNameContainer > mxStyleFamily;
 
7540
+    css::uno::Reference< css::beans::XPropertySet > mxStyleProps;
 
7541
+    sal_Int32 mnGalleryType;
 
7542
+    sal_Int32 mnTemplateType;
 
7543
+    rtl::OUString msStyleName;
 
7544
+
 
7545
+    void Init() throw( css::uno::RuntimeException );
 
7546
+    void CreateListTemplate() throw( css::uno::RuntimeException );
 
7547
+    void CreateBulletListTemplate() throw( css::uno::RuntimeException );
 
7548
+    void CreateNumberListTemplate() throw( css::uno::RuntimeException );
 
7549
+    void CreateOutlineNumberListTemplate() throw( css::uno::RuntimeException );
 
7550
+    void CreateOutlineNumberForType1() throw( css::uno::RuntimeException );
 
7551
+    void CreateOutlineNumberForType2() throw( css::uno::RuntimeException );
 
7552
+    void CreateOutlineNumberForType3() throw( css::uno::RuntimeException );
 
7553
+    void CreateOutlineNumberForType4() throw( css::uno::RuntimeException );
 
7554
+    void CreateOutlineNumberForType5() throw( css::uno::RuntimeException );
 
7555
+    void CreateOutlineNumberForType6() throw( css::uno::RuntimeException );
 
7556
+    void CreateOutlineNumberForType7() throw( css::uno::RuntimeException );
 
7557
+
 
7558
+public:
 
7559
+    SwVbaListHelper( const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nGalleryType, sal_Int32 nTemplateType ) throw( css::uno::RuntimeException );
 
7560
+
 
7561
+    sal_Int32 getGalleryType() { return mnGalleryType; }
 
7562
+    css::uno::Reference< css::container::XIndexReplace > getNumberingRules() { return mxNumberingRules; }
 
7563
+    css::uno::Any getPropertyValueWithNameAndLevel( sal_Int32 nLevel, const rtl::OUString& sName ) throw( css::uno::RuntimeException );
 
7564
+    void setPropertyValueWithNameAndLevel( sal_Int32 nLevel, const rtl::OUString& sName, const css::uno::Any& aValue ) throw( css::uno::RuntimeException );
 
7565
+
 
7566
+};
 
7567
+
 
7568
+#endif//SW_VBA_LISTHELPER_HXX
 
7569
diff --git sw/source/ui/vba/vbalistlevel.cxx sw/source/ui/vba/vbalistlevel.cxx
 
7570
new file mode 100644
 
7571
index 0000000..4dc0951
 
7572
--- /dev/null
 
7573
+++ sw/source/ui/vba/vbalistlevel.cxx
 
7574
@@ -0,0 +1,401 @@
 
7575
+/*************************************************************************
 
7576
+ *
 
7577
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
7578
+ * 
 
7579
+ * Copyright 2008 by Sun Microsystems, Inc.
 
7580
+ *
 
7581
+ * OpenOffice.org - a multi-platform office productivity suite
 
7582
+ *
 
7583
+ * $RCSfile: 
 
7584
+ * $Revision: 
 
7585
+ *
 
7586
+ * This file is part of OpenOffice.org.
 
7587
+ *
 
7588
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
7589
+ * it under the terms of the GNU Lesser General Public License version 3
 
7590
+ * only, as published by the Free Software Foundation.
 
7591
+ *
 
7592
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
7593
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
7594
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
7595
+ * GNU Lesser General Public License version 3 for more details
 
7596
+ * (a copy is included in the LICENSE file that accompanied this code).
 
7597
+ *
 
7598
+ * You should have received a copy of the GNU Lesser General Public License
 
7599
+ * version 3 along with OpenOffice.org.  If not, see
 
7600
+ * <http://www.openoffice.org/license.html>
 
7601
+ * for a copy of the LGPLv3 License.
 
7602
+ *
 
7603
+ ************************************************************************/
 
7604
+#include "vbalistlevel.hxx"
 
7605
+#include <vbahelper/vbahelper.hxx>
 
7606
+#include <tools/diagnose_ex.h>
 
7607
+#include <com/sun/star/style/NumberingType.hpp>
 
7608
+#include <ooo/vba/word/WdListNumberStyle.hpp>
 
7609
+#include <ooo/vba/word/WdTrailingCharacter.hpp>
 
7610
+#include <com/sun/star/text/HoriOrientation.hpp>
 
7611
+#include <ooo/vba/word/WdListLevelAlignment.hpp>
 
7612
+
 
7613
+using namespace ::ooo::vba;
 
7614
+using namespace ::com::sun::star;
 
7615
+
 
7616
+SwVbaListLevel::SwVbaListLevel( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, SwVbaListHelperRef pHelper, sal_Int32 nLevel ) throw ( uno::RuntimeException ) : SwVbaListLevel_BASE( rParent, rContext ), pListHelper( pHelper ), mnLevel( nLevel )
 
7617
+{
 
7618
+}
 
7619
+
 
7620
+SwVbaListLevel::~SwVbaListLevel()
 
7621
+{
 
7622
+}
 
7623
+
 
7624
+::sal_Int32 SAL_CALL SwVbaListLevel::getAlignment() throw (uno::RuntimeException)
 
7625
+{
 
7626
+    sal_Int16 nAlignment = 0;
 
7627
+    pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Adjust") ) ) >>= nAlignment;
 
7628
+    switch( nAlignment )
 
7629
+    {
 
7630
+        case text::HoriOrientation::LEFT:
 
7631
+        {
 
7632
+            nAlignment = word::WdListLevelAlignment::wdListLevelAlignLeft;
 
7633
+            break;
 
7634
+        }
 
7635
+        case text::HoriOrientation::RIGHT:
 
7636
+        {
 
7637
+            nAlignment = word::WdListLevelAlignment::wdListLevelAlignRight;
 
7638
+            break;
 
7639
+        }
 
7640
+        case text::HoriOrientation::CENTER:
 
7641
+        {
 
7642
+            nAlignment = word::WdListLevelAlignment::wdListLevelAlignCenter;
 
7643
+            break;
 
7644
+        }
 
7645
+        default:
 
7646
+        {
 
7647
+            throw uno::RuntimeException();
 
7648
+        }
 
7649
+    }
 
7650
+    return nAlignment;
 
7651
+}
 
7652
+
 
7653
+void SAL_CALL SwVbaListLevel::setAlignment( ::sal_Int32 _alignment ) throw (uno::RuntimeException)
 
7654
+{
 
7655
+    sal_Int16 nAlignment = text::HoriOrientation::LEFT;
 
7656
+    switch( _alignment )
 
7657
+    {
 
7658
+        case word::WdListLevelAlignment::wdListLevelAlignLeft:
 
7659
+        {
 
7660
+            nAlignment = text::HoriOrientation::LEFT;
 
7661
+            break;
 
7662
+        }
 
7663
+        case word::WdListLevelAlignment::wdListLevelAlignRight:
 
7664
+        {
 
7665
+            nAlignment = text::HoriOrientation::RIGHT;
 
7666
+            break;
 
7667
+        }
 
7668
+        case word::WdListLevelAlignment::wdListLevelAlignCenter:
 
7669
+        {
 
7670
+            nAlignment = text::HoriOrientation::CENTER;
 
7671
+            break;
 
7672
+        }
 
7673
+        default:
 
7674
+        {
 
7675
+            throw uno::RuntimeException();
 
7676
+        }
 
7677
+    }
 
7678
+    pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Adjust") ), uno::makeAny( nAlignment ) );
 
7679
+}
 
7680
+
 
7681
+uno::Reference< ::ooo::vba::word::XFont > SAL_CALL SwVbaListLevel::getFont() throw (uno::RuntimeException)
 
7682
+{
 
7683
+    throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
7684
+    return uno::Reference< word::XFont >();
 
7685
+}
 
7686
+
 
7687
+void SAL_CALL SwVbaListLevel::setFont( const uno::Reference< ::ooo::vba::word::XFont >& /*_font*/ ) throw (uno::RuntimeException)
 
7688
+{
 
7689
+    throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
7690
+}
 
7691
+
 
7692
+::sal_Int32 SAL_CALL SwVbaListLevel::getIndex() throw (uno::RuntimeException)
 
7693
+{
 
7694
+    return mnLevel + 1;
 
7695
+}
 
7696
+
 
7697
+::rtl::OUString SAL_CALL SwVbaListLevel::getLinkedStyle() throw (uno::RuntimeException)
 
7698
+{
 
7699
+    // TODO: 
 
7700
+    return rtl::OUString();
 
7701
+}
 
7702
+
 
7703
+void SAL_CALL SwVbaListLevel::setLinkedStyle( const ::rtl::OUString& _linkedstyle ) throw (uno::RuntimeException)
 
7704
+{
 
7705
+    // TODO: 
 
7706
+}
 
7707
+
 
7708
+::rtl::OUString SAL_CALL SwVbaListLevel::getNumberFormat() throw (uno::RuntimeException)
 
7709
+{
 
7710
+    // TODO::
 
7711
+    return rtl::OUString();
 
7712
+}
 
7713
+
 
7714
+void SAL_CALL SwVbaListLevel::setNumberFormat( const ::rtl::OUString& _numberformat ) throw (uno::RuntimeException)
 
7715
+{
 
7716
+    // TODO::
 
7717
+}
 
7718
+
 
7719
+float SAL_CALL SwVbaListLevel::getNumberPosition() throw (uno::RuntimeException)
 
7720
+{
 
7721
+    // indentAt + firstlineindent
 
7722
+    sal_Int32 nIndentAt = 0;
 
7723
+    sal_Int32 nFirstLineIndent = 0;
 
7724
+    pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ) ) >>= nIndentAt;
 
7725
+    pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent") ) ) >>= nFirstLineIndent;
 
7726
+
 
7727
+    sal_Int32 nResult = nIndentAt + nFirstLineIndent;
 
7728
+
 
7729
+    return static_cast< float >( Millimeter::getInPoints( nResult ) );
 
7730
+}
 
7731
+
 
7732
+void SAL_CALL SwVbaListLevel::setNumberPosition( float _numberposition ) throw (uno::RuntimeException)
 
7733
+{
 
7734
+    sal_Int32 nNumberPosition = Millimeter::getInHundredthsOfOneMillimeter( _numberposition );
 
7735
+
 
7736
+    sal_Int32 nIndentAt = 0;
 
7737
+    pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ) ) >>= nIndentAt;
 
7738
+
 
7739
+    sal_Int32 nFirstLineIndent = nNumberPosition - nIndentAt;
 
7740
+    pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent") ), uno::makeAny( nFirstLineIndent ) );
 
7741
+}
 
7742
+
 
7743
+::sal_Int32 SAL_CALL SwVbaListLevel::getNumberStyle() throw (uno::RuntimeException)
 
7744
+{
 
7745
+    sal_Int16 nNumberingType = 0;
 
7746
+    pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingType") ) ) >>= nNumberingType;
 
7747
+    switch( nNumberingType )
 
7748
+    {
 
7749
+        case style::NumberingType::CHAR_SPECIAL:
 
7750
+        {
 
7751
+            nNumberingType = word::WdListNumberStyle::wdListNumberStyleBullet;
 
7752
+            break;
 
7753
+        }
 
7754
+        case style::NumberingType::CHARS_UPPER_LETTER:
 
7755
+        {
 
7756
+            nNumberingType = word::WdListNumberStyle::wdListNumberStyleUppercaseLetter;
 
7757
+            break;
 
7758
+        }
 
7759
+        case style::NumberingType::CHARS_LOWER_LETTER:
 
7760
+        {
 
7761
+            nNumberingType = word::WdListNumberStyle::wdListNumberStyleLowercaseLetter;
 
7762
+            break;
 
7763
+        }
 
7764
+        case style::NumberingType::ROMAN_UPPER:
 
7765
+        {
 
7766
+            nNumberingType = word::WdListNumberStyle::wdListNumberStyleUppercaseRoman;
 
7767
+            break;
 
7768
+        }
 
7769
+        case style::NumberingType::ROMAN_LOWER:
 
7770
+        {
 
7771
+            nNumberingType = word::WdListNumberStyle::wdListNumberStyleLowercaseRoman;
 
7772
+            break;
 
7773
+        }
 
7774
+        case style::NumberingType::ARABIC:
 
7775
+        {
 
7776
+            nNumberingType = word::WdListNumberStyle::wdListNumberStyleArabic;
 
7777
+            break;
 
7778
+        }
 
7779
+        case style::NumberingType::NUMBER_NONE:
 
7780
+        {
 
7781
+            nNumberingType = word::WdListNumberStyle::wdListNumberStyleNone;
 
7782
+            break;
 
7783
+        }
 
7784
+        case style::NumberingType::FULLWIDTH_ARABIC:
 
7785
+        {
 
7786
+            nNumberingType = word::WdListNumberStyle::wdListNumberStyleArabicFullWidth;
 
7787
+            break;
 
7788
+        }
 
7789
+        case style::NumberingType::CIRCLE_NUMBER:
 
7790
+        {
 
7791
+            nNumberingType = word::WdListNumberStyle::wdListNumberStyleNumberInCircle;
 
7792
+            break;
 
7793
+        }
 
7794
+        case style::NumberingType::CHARS_ARABIC:
 
7795
+        {
 
7796
+            nNumberingType = word::WdListNumberStyle::wdListNumberStyleCardinalText;
 
7797
+            break;
 
7798
+        }
 
7799
+        default:
 
7800
+        {
 
7801
+            throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
7802
+        }
 
7803
+    }
 
7804
+    return nNumberingType;
 
7805
+}
 
7806
+
 
7807
+void SAL_CALL SwVbaListLevel::setNumberStyle( ::sal_Int32 _numberstyle ) throw (uno::RuntimeException)
 
7808
+{
 
7809
+    sal_Int16 nNumberingType = 0;
 
7810
+    switch( _numberstyle )
 
7811
+    {
 
7812
+        case word::WdListNumberStyle::wdListNumberStyleBullet:
 
7813
+        {
 
7814
+            nNumberingType = style::NumberingType::CHAR_SPECIAL;
 
7815
+            break;
 
7816
+        }
 
7817
+        case word::WdListNumberStyle::wdListNumberStyleUppercaseLetter:
 
7818
+        {
 
7819
+            nNumberingType = style::NumberingType::CHARS_UPPER_LETTER_N;
 
7820
+            break;
 
7821
+        }
 
7822
+        case word::WdListNumberStyle::wdListNumberStyleLowercaseLetter:
 
7823
+        {
 
7824
+            nNumberingType = style::NumberingType::CHARS_LOWER_LETTER_N;
 
7825
+            break;
 
7826
+        }
 
7827
+        case word::WdListNumberStyle::wdListNumberStyleUppercaseRoman:
 
7828
+        {
 
7829
+            nNumberingType = style::NumberingType::ROMAN_UPPER;
 
7830
+            break;
 
7831
+        }
 
7832
+        case word::WdListNumberStyle::wdListNumberStyleLowercaseRoman:
 
7833
+        {
 
7834
+            nNumberingType = style::NumberingType::ROMAN_LOWER;
 
7835
+            break;
 
7836
+        }
 
7837
+        case word::WdListNumberStyle::wdListNumberStyleArabic:
 
7838
+        {
 
7839
+            nNumberingType = style::NumberingType::ARABIC;
 
7840
+            break;
 
7841
+        }
 
7842
+        case word::WdListNumberStyle::wdListNumberStyleNone:
 
7843
+        {
 
7844
+            nNumberingType = style::NumberingType::NUMBER_NONE;
 
7845
+            break;
 
7846
+        }
 
7847
+        case word::WdListNumberStyle::wdListNumberStyleArabicFullWidth:
 
7848
+        {
 
7849
+            nNumberingType = style::NumberingType::FULLWIDTH_ARABIC;
 
7850
+            break;
 
7851
+        }
 
7852
+        case word::WdListNumberStyle::wdListNumberStyleNumberInCircle:
 
7853
+        {
 
7854
+            nNumberingType = style::NumberingType::CIRCLE_NUMBER;
 
7855
+            break;
 
7856
+        }
 
7857
+        case word::WdListNumberStyle::wdListNumberStyleCardinalText:
 
7858
+        {
 
7859
+            nNumberingType = style::NumberingType::CHARS_ARABIC;
 
7860
+            break;
 
7861
+        }
 
7862
+        case word::WdListNumberStyle::wdListNumberStyleOrdinal:
 
7863
+        case word::WdListNumberStyle::wdListNumberStyleOrdinalText:
 
7864
+        case word::WdListNumberStyle::wdListNumberStyleKanji:
 
7865
+        case word::WdListNumberStyle::wdListNumberStyleKanjiDigit:
 
7866
+        case word::WdListNumberStyle::wdListNumberStyleAiueoHalfWidth:
 
7867
+        case word::WdListNumberStyle::wdListNumberStyleIrohaHalfWidth:
 
7868
+        {
 
7869
+            nNumberingType = style::NumberingType::ARABIC;
 
7870
+            break;
 
7871
+        }
 
7872
+        default:
 
7873
+        {
 
7874
+            throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
7875
+        }
 
7876
+    }
 
7877
+
 
7878
+    pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingType") ), uno::makeAny( nNumberingType ) );
 
7879
+}
 
7880
+
 
7881
+::sal_Int32 SAL_CALL SwVbaListLevel::getResetOnHigher() throw (uno::RuntimeException)
 
7882
+{
 
7883
+    //seems not support?
 
7884
+    return 0;
 
7885
+}
 
7886
+
 
7887
+void SAL_CALL SwVbaListLevel::setResetOnHigher( ::sal_Int32 _resetonhigher ) throw (uno::RuntimeException)
 
7888
+{
 
7889
+    //seems not support?
 
7890
+}
 
7891
+
 
7892
+::sal_Int32 SAL_CALL SwVbaListLevel::getStartAt() throw (uno::RuntimeException)
 
7893
+{
 
7894
+    sal_Int16 nStartWith = 0;
 
7895
+    pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StartWith") ) ) >>= nStartWith;
 
7896
+    return nStartWith;
 
7897
+}
 
7898
+
 
7899
+void SAL_CALL SwVbaListLevel::setStartAt( ::sal_Int32 _startat ) throw (uno::RuntimeException)
 
7900
+{
 
7901
+    sal_Int16 nStartWith = (sal_Int16)_startat;
 
7902
+    pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StartWith") ), uno::makeAny( nStartWith ) );
 
7903
+}
 
7904
+
 
7905
+float SAL_CALL SwVbaListLevel::getTabPosition() throw (uno::RuntimeException)
 
7906
+{
 
7907
+    sal_Int32 nTabPosition = 0;
 
7908
+    pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ListtabStopPosition") ) ) >>= nTabPosition;
 
7909
+
 
7910
+    return static_cast< float >( Millimeter::getInPoints( nTabPosition ) );
 
7911
+}
 
7912
+
 
7913
+void SAL_CALL SwVbaListLevel::setTabPosition( float _tabposition ) throw (uno::RuntimeException)
 
7914
+{
 
7915
+    sal_Int32 nTabPosition = Millimeter::getInHundredthsOfOneMillimeter( _tabposition );
 
7916
+    pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ListtabStopPosition") ), uno::makeAny( nTabPosition ) );
 
7917
+}
 
7918
+
 
7919
+float SAL_CALL SwVbaListLevel::getTextPosition() throw (uno::RuntimeException)
 
7920
+{
 
7921
+    // indentAt
 
7922
+    sal_Int32 nIndentAt = 0;
 
7923
+    pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ) ) >>= nIndentAt;
 
7924
+
 
7925
+    return static_cast< float >( Millimeter::getInPoints( nIndentAt ) );
 
7926
+}
 
7927
+
 
7928
+void SAL_CALL SwVbaListLevel::setTextPosition( float _textposition ) throw (uno::RuntimeException)
 
7929
+{
 
7930
+    sal_Int32 nIndentAt = 0;
 
7931
+    sal_Int32 nFirstLineIndent = 0;
 
7932
+    pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ) ) >>= nIndentAt;
 
7933
+    pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent") ) ) >>= nFirstLineIndent;
 
7934
+
 
7935
+    sal_Int32 nAlignedAt = nIndentAt + nFirstLineIndent;
 
7936
+
 
7937
+    nIndentAt = Millimeter::getInHundredthsOfOneMillimeter( _textposition );
 
7938
+    nFirstLineIndent = nAlignedAt - nIndentAt;
 
7939
+    pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ), uno::makeAny( nIndentAt ) );
 
7940
+    pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent") ), uno::makeAny( nFirstLineIndent ) );
 
7941
+}
 
7942
+
 
7943
+::sal_Int32 SAL_CALL SwVbaListLevel::getTrailingCharacter() throw (uno::RuntimeException)
 
7944
+{
 
7945
+    sal_Int16 nLabelFollowedBy= 0;
 
7946
+    pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LabelFollowedBy") ) ) >>= nLabelFollowedBy;
 
7947
+
 
7948
+    return nLabelFollowedBy;
 
7949
+}
 
7950
+
 
7951
+void SAL_CALL SwVbaListLevel::setTrailingCharacter( ::sal_Int32 _trailingcharacter ) throw (uno::RuntimeException)
 
7952
+{
 
7953
+    sal_Int16 nLabelFollowedBy = (sal_Int16)_trailingcharacter;
 
7954
+    pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LabelFollowedBy") ), uno::makeAny( nLabelFollowedBy ) );
 
7955
+}
 
7956
+
 
7957
+rtl::OUString& 
 
7958
+SwVbaListLevel::getServiceImplName()
 
7959
+{
 
7960
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListLevel") );
 
7961
+    return sImplName;
 
7962
+}
 
7963
+
 
7964
+uno::Sequence< rtl::OUString > 
 
7965
+SwVbaListLevel::getServiceNames()
 
7966
+{
 
7967
+    static uno::Sequence< rtl::OUString > aServiceNames;
 
7968
+    if ( aServiceNames.getLength() == 0 )
 
7969
+    {
 
7970
+        aServiceNames.realloc( 1 );
 
7971
+        aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListLevel" ) );
 
7972
+    }
 
7973
+    return aServiceNames;
 
7974
+}
 
7975
+
 
7976
diff --git sw/source/ui/vba/vbalistlevel.hxx sw/source/ui/vba/vbalistlevel.hxx
 
7977
new file mode 100644
 
7978
index 0000000..4bcb147
 
7979
--- /dev/null
 
7980
+++ sw/source/ui/vba/vbalistlevel.hxx
 
7981
@@ -0,0 +1,81 @@
 
7982
+/*************************************************************************
 
7983
+ *
 
7984
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
7985
+ * 
 
7986
+ * Copyright 2008 by Sun Microsystems, Inc.
 
7987
+ *
 
7988
+ * OpenOffice.org - a multi-platform office productivity suite
 
7989
+ *
 
7990
+ * $RCSfile: 
 
7991
+ * $Revision: 
 
7992
+ *
 
7993
+ * This file is part of OpenOffice.org.
 
7994
+ *
 
7995
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
7996
+ * it under the terms of the GNU Lesser General Public License version 3
 
7997
+ * only, as published by the Free Software Foundation.
 
7998
+ *
 
7999
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
8000
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
8001
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
8002
+ * GNU Lesser General Public License version 3 for more details
 
8003
+ * (a copy is included in the LICENSE file that accompanied this code).
 
8004
+ *
 
8005
+ * You should have received a copy of the GNU Lesser General Public License
 
8006
+ * version 3 along with OpenOffice.org.  If not, see
 
8007
+ * <http://www.openoffice.org/license.html>
 
8008
+ * for a copy of the LGPLv3 License.
 
8009
+ *
 
8010
+ ************************************************************************/
 
8011
+#ifndef SW_VBA_LISTLEVEL_HXX
 
8012
+#define SW_VBA_LISTLEVEL_HXX
 
8013
+
 
8014
+#include <ooo/vba/word/XListLevel.hpp>
 
8015
+#include <vbahelper/vbahelperinterface.hxx>
 
8016
+#include <cppuhelper/implbase1.hxx>
 
8017
+#include <com/sun/star/text/XTextDocument.hpp>
 
8018
+#include "vbalisthelper.hxx"
 
8019
+
 
8020
+
 
8021
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XListLevel > SwVbaListLevel_BASE;
 
8022
+
 
8023
+class SwVbaListLevel : public SwVbaListLevel_BASE
 
8024
+{
 
8025
+private:
 
8026
+    SwVbaListHelperRef pListHelper;
 
8027
+    sal_Int32 mnLevel;
 
8028
+
 
8029
+public:
 
8030
+    SwVbaListLevel( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, SwVbaListHelperRef pHelper, sal_Int32 nLevel ) throw ( css::uno::RuntimeException );
 
8031
+    virtual ~SwVbaListLevel();
 
8032
+
 
8033
+    // Attributes
 
8034
+    virtual ::sal_Int32 SAL_CALL getAlignment() throw (css::uno::RuntimeException);
 
8035
+    virtual void SAL_CALL setAlignment( ::sal_Int32 _alignment ) throw (css::uno::RuntimeException);
 
8036
+    virtual css::uno::Reference< ::ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
 
8037
+    virtual void SAL_CALL setFont( const css::uno::Reference< ::ooo::vba::word::XFont >& _font ) throw (css::uno::RuntimeException);
 
8038
+    virtual ::sal_Int32 SAL_CALL getIndex() throw (css::uno::RuntimeException);
 
8039
+    virtual ::rtl::OUString SAL_CALL getLinkedStyle() throw (css::uno::RuntimeException);
 
8040
+    virtual void SAL_CALL setLinkedStyle( const ::rtl::OUString& _linkedstyle ) throw (css::uno::RuntimeException);
 
8041
+    virtual ::rtl::OUString SAL_CALL getNumberFormat() throw (css::uno::RuntimeException);
 
8042
+    virtual void SAL_CALL setNumberFormat( const ::rtl::OUString& _numberformat ) throw (css::uno::RuntimeException);
 
8043
+    virtual float SAL_CALL getNumberPosition() throw (css::uno::RuntimeException);
 
8044
+    virtual void SAL_CALL setNumberPosition( float _numberposition ) throw (css::uno::RuntimeException);
 
8045
+    virtual ::sal_Int32 SAL_CALL getNumberStyle() throw (css::uno::RuntimeException);
 
8046
+    virtual void SAL_CALL setNumberStyle( ::sal_Int32 _numberstyle ) throw (css::uno::RuntimeException);
 
8047
+    virtual ::sal_Int32 SAL_CALL getResetOnHigher() throw (css::uno::RuntimeException);
 
8048
+    virtual void SAL_CALL setResetOnHigher( ::sal_Int32 _resetonhigher ) throw (css::uno::RuntimeException);
 
8049
+    virtual ::sal_Int32 SAL_CALL getStartAt() throw (css::uno::RuntimeException);
 
8050
+    virtual void SAL_CALL setStartAt( ::sal_Int32 _startat ) throw (css::uno::RuntimeException);
 
8051
+    virtual float SAL_CALL getTabPosition() throw (css::uno::RuntimeException);
 
8052
+    virtual void SAL_CALL setTabPosition( float _tabposition ) throw (css::uno::RuntimeException);
 
8053
+    virtual float SAL_CALL getTextPosition() throw (css::uno::RuntimeException);
 
8054
+    virtual void SAL_CALL setTextPosition( float _textposition ) throw (css::uno::RuntimeException);
 
8055
+    virtual ::sal_Int32 SAL_CALL getTrailingCharacter() throw (css::uno::RuntimeException);
 
8056
+    virtual void SAL_CALL setTrailingCharacter( ::sal_Int32 _trailingcharacter ) throw (css::uno::RuntimeException);
 
8057
+
 
8058
+    // XHelperInterface
 
8059
+    virtual rtl::OUString& getServiceImplName();
 
8060
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
8061
+};
 
8062
+#endif /* SW_VBA_LISTLEVEL_HXX */
 
8063
diff --git sw/source/ui/vba/vbalistlevels.cxx sw/source/ui/vba/vbalistlevels.cxx
 
8064
new file mode 100644
 
8065
index 0000000..019b6f5
 
8066
--- /dev/null
 
8067
+++ sw/source/ui/vba/vbalistlevels.cxx
 
8068
@@ -0,0 +1,118 @@
 
8069
+/*************************************************************************
 
8070
+ *
 
8071
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
8072
+ * 
 
8073
+ * Copyright 2008 by Sun Microsystems, Inc.
 
8074
+ *
 
8075
+ * OpenOffice.org - a multi-platform office productivity suite
 
8076
+ *
 
8077
+ * $RCSfile: 
 
8078
+ * $Revision: 
 
8079
+ *
 
8080
+ * This file is part of OpenOffice.org.
 
8081
+ *
 
8082
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
8083
+ * it under the terms of the GNU Lesser General Public License version 3
 
8084
+ * only, as published by the Free Software Foundation.
 
8085
+ *
 
8086
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
8087
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
8088
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
8089
+ * GNU Lesser General Public License version 3 for more details
 
8090
+ * (a copy is included in the LICENSE file that accompanied this code).
 
8091
+ *
 
8092
+ * You should have received a copy of the GNU Lesser General Public License
 
8093
+ * version 3 along with OpenOffice.org.  If not, see
 
8094
+ * <http://www.openoffice.org/license.html>
 
8095
+ * for a copy of the LGPLv3 License.
 
8096
+ *
 
8097
+ ************************************************************************/
 
8098
+#include "vbalistlevels.hxx"
 
8099
+#include "vbalistlevel.hxx"
 
8100
+#include <ooo/vba/word/WdListGalleryType.hpp>
 
8101
+
 
8102
+using namespace ::ooo::vba;
 
8103
+using namespace ::com::sun::star;
 
8104
+
 
8105
+class ListLevelsEnumWrapper : public EnumerationHelper_BASE
 
8106
+{
 
8107
+    SwVbaListLevels* pListLevels;
 
8108
+    sal_Int32 nIndex;
 
8109
+public:
 
8110
+    ListLevelsEnumWrapper( SwVbaListLevels* pLevels ) : pListLevels( pLevels ), nIndex( 1 ) {}
 
8111
+    virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException)
 
8112
+    {
 
8113
+        return ( nIndex <= pListLevels->getCount() );
 
8114
+    }
 
8115
+
 
8116
+    virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
 
8117
+    {
 
8118
+        if ( nIndex <= pListLevels->getCount() )
 
8119
+            return pListLevels->Item( uno::makeAny( nIndex++ ), uno::Any() );
 
8120
+        throw container::NoSuchElementException();
 
8121
+    }
 
8122
+};
 
8123
+
 
8124
+SwVbaListLevels::SwVbaListLevels( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, SwVbaListHelperRef pHelper ) throw (uno::RuntimeException) : SwVbaListLevels_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >() ), pListHelper( pHelper ) 
 
8125
+{
 
8126
+}
 
8127
+
 
8128
+::sal_Int32 SAL_CALL SwVbaListLevels::getCount() throw (uno::RuntimeException)
 
8129
+{
 
8130
+    sal_Int32 nGalleryType = pListHelper->getGalleryType();
 
8131
+    if( nGalleryType == word::WdListGalleryType::wdBulletGallery
 
8132
+        || nGalleryType == word::WdListGalleryType::wdNumberGallery )
 
8133
+        return 1;
 
8134
+    else if( nGalleryType == word::WdListGalleryType::wdOutlineNumberGallery )
 
8135
+        return 9;
 
8136
+    return 0;    
 
8137
+}
 
8138
+
 
8139
+uno::Any SAL_CALL SwVbaListLevels::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
 
8140
+{
 
8141
+    sal_Int32 nIndex = 0;
 
8142
+    if( ( Index1 >>= nIndex ) == sal_False )
 
8143
+        throw uno::RuntimeException();
 
8144
+    if( nIndex <=0 || nIndex > getCount() )    
 
8145
+        throw  uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
 
8146
+        
 
8147
+    return uno::makeAny( uno::Reference< word::XListLevel >( new SwVbaListLevel( this, mxContext, pListHelper, nIndex - 1 ) ) );
 
8148
+}
 
8149
+
 
8150
+// XEnumerationAccess
 
8151
+uno::Type
 
8152
+SwVbaListLevels::getElementType() throw (uno::RuntimeException)
 
8153
+{
 
8154
+    return word::XListLevel::static_type(0);
 
8155
+}
 
8156
+
 
8157
+uno::Reference< container::XEnumeration >
 
8158
+SwVbaListLevels::createEnumeration() throw (uno::RuntimeException)
 
8159
+{
 
8160
+    return new ListLevelsEnumWrapper( this );
 
8161
+}
 
8162
+
 
8163
+uno::Any
 
8164
+SwVbaListLevels::createCollectionObject( const css::uno::Any& aSource )
 
8165
+{
 
8166
+    return aSource;
 
8167
+}
 
8168
+
 
8169
+rtl::OUString& 
 
8170
+SwVbaListLevels::getServiceImplName()
 
8171
+{
 
8172
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListLevels") );
 
8173
+    return sImplName;
 
8174
+}
 
8175
+
 
8176
+css::uno::Sequence<rtl::OUString> 
 
8177
+SwVbaListLevels::getServiceNames()
 
8178
+{
 
8179
+    static uno::Sequence< rtl::OUString > sNames;
 
8180
+    if ( sNames.getLength() == 0 )
 
8181
+    {
 
8182
+        sNames.realloc( 1 );
 
8183
+        sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListLevels") );
 
8184
+    }
 
8185
+    return sNames;
 
8186
+}
 
8187
diff --git sw/source/ui/vba/vbalistlevels.hxx sw/source/ui/vba/vbalistlevels.hxx
 
8188
new file mode 100644
 
8189
index 0000000..c57da55
 
8190
--- /dev/null
 
8191
+++ sw/source/ui/vba/vbalistlevels.hxx
 
8192
@@ -0,0 +1,62 @@
 
8193
+/*************************************************************************
 
8194
+ *
 
8195
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
8196
+ * 
 
8197
+ * Copyright 2008 by Sun Microsystems, Inc.
 
8198
+ *
 
8199
+ * OpenOffice.org - a multi-platform office productivity suite
 
8200
+ *
 
8201
+ * $RCSfile: 
 
8202
+ * $Revision: 
 
8203
+ *
 
8204
+ * This file is part of OpenOffice.org.
 
8205
+ *
 
8206
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
8207
+ * it under the terms of the GNU Lesser General Public License version 3
 
8208
+ * only, as published by the Free Software Foundation.
 
8209
+ *
 
8210
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
8211
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
8212
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
8213
+ * GNU Lesser General Public License version 3 for more details
 
8214
+ * (a copy is included in the LICENSE file that accompanied this code).
 
8215
+ *
 
8216
+ * You should have received a copy of the GNU Lesser General Public License
 
8217
+ * version 3 along with OpenOffice.org.  If not, see
 
8218
+ * <http://www.openoffice.org/license.html>
 
8219
+ * for a copy of the LGPLv3 License.
 
8220
+ *
 
8221
+ ************************************************************************/
 
8222
+#ifndef SW_VBA_LISTLEVELS_HXX
 
8223
+#define SW_VBA_LISTLEVELS_HXX
 
8224
+
 
8225
+#include <vbahelper/vbacollectionimpl.hxx>
 
8226
+#include <ooo/vba/word/XListLevels.hpp>
 
8227
+#include <vbahelper/vbahelperinterface.hxx>
 
8228
+#include "vbalisthelper.hxx"
 
8229
+
 
8230
+
 
8231
+typedef CollTestImplHelper< ooo::vba::word::XListLevels > SwVbaListLevels_BASE;
 
8232
+
 
8233
+class SwVbaListLevels : public SwVbaListLevels_BASE
 
8234
+{
 
8235
+private:
 
8236
+    SwVbaListHelperRef pListHelper;
 
8237
+
 
8238
+public:
 
8239
+    SwVbaListLevels( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, SwVbaListHelperRef pHelper ) throw ( css::uno::RuntimeException );
 
8240
+    virtual ~SwVbaListLevels() {}
 
8241
+
 
8242
+    virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
 
8243
+    virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& /*not processed in this base class*/ ) throw ( css::uno::RuntimeException );
 
8244
+    // XEnumerationAccess
 
8245
+    virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
 
8246
+    virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
 
8247
+
 
8248
+    // SwVbaListLevels_BASE
 
8249
+    virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); 
 
8250
+    virtual rtl::OUString& getServiceImplName();
 
8251
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
8252
+};    
 
8253
+
 
8254
+#endif /* SW_VBA_LISTLEVELS_HXX */
 
8255
diff --git sw/source/ui/vba/vbalisttemplate.cxx sw/source/ui/vba/vbalisttemplate.cxx
 
8256
new file mode 100644
 
8257
index 0000000..1ad091e
 
8258
--- /dev/null
 
8259
+++ sw/source/ui/vba/vbalisttemplate.cxx
 
8260
@@ -0,0 +1,80 @@
 
8261
+/*************************************************************************
 
8262
+ *
 
8263
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
8264
+ * 
 
8265
+ * Copyright 2008 by Sun Microsystems, Inc.
 
8266
+ *
 
8267
+ * OpenOffice.org - a multi-platform office productivity suite
 
8268
+ *
 
8269
+ * $RCSfile: 
 
8270
+ * $Revision: 
 
8271
+ *
 
8272
+ * This file is part of OpenOffice.org.
 
8273
+ *
 
8274
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
8275
+ * it under the terms of the GNU Lesser General Public License version 3
 
8276
+ * only, as published by the Free Software Foundation.
 
8277
+ *
 
8278
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
8279
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
8280
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
8281
+ * GNU Lesser General Public License version 3 for more details
 
8282
+ * (a copy is included in the LICENSE file that accompanied this code).
 
8283
+ *
 
8284
+ * You should have received a copy of the GNU Lesser General Public License
 
8285
+ * version 3 along with OpenOffice.org.  If not, see
 
8286
+ * <http://www.openoffice.org/license.html>
 
8287
+ * for a copy of the LGPLv3 License.
 
8288
+ *
 
8289
+ ************************************************************************/
 
8290
+#include "vbalisttemplate.hxx"
 
8291
+#include <vbahelper/vbahelper.hxx>
 
8292
+#include <tools/diagnose_ex.h>
 
8293
+#include "vbalistlevels.hxx"
 
8294
+
 
8295
+using namespace ::ooo::vba;
 
8296
+using namespace ::com::sun::star;
 
8297
+
 
8298
+SwVbaListTemplate::SwVbaListTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& xTextDoc, sal_Int32 nGalleryType, sal_Int32 nTemplateType ) throw ( uno::RuntimeException ) : SwVbaListTemplate_BASE( rParent, rContext )
 
8299
+{
 
8300
+    pListHelper.reset( new SwVbaListHelper( xTextDoc, nGalleryType, nTemplateType ) );
 
8301
+}
 
8302
+
 
8303
+SwVbaListTemplate::~SwVbaListTemplate()
 
8304
+{
 
8305
+}
 
8306
+
 
8307
+uno::Any SAL_CALL
 
8308
+SwVbaListTemplate::ListLevels( const uno::Any& index ) throw (uno::RuntimeException)
 
8309
+{
 
8310
+    uno::Reference< XCollection > xCol( new SwVbaListLevels( mxParent, mxContext, pListHelper ) );
 
8311
+    if ( index.hasValue() )
 
8312
+        return xCol->Item( index, uno::Any() );
 
8313
+    return uno::makeAny( xCol );
 
8314
+}
 
8315
+
 
8316
+void SwVbaListTemplate::applyListTemplate( uno::Reference< beans::XPropertySet >& xProps ) throw (uno::RuntimeException)
 
8317
+{
 
8318
+    uno::Reference< container::XIndexReplace > xNumberingRules = pListHelper->getNumberingRules();
 
8319
+    xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) , uno::makeAny( xNumberingRules ) );
 
8320
+}
 
8321
+
 
8322
+rtl::OUString& 
 
8323
+SwVbaListTemplate::getServiceImplName()
 
8324
+{
 
8325
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListTemplate") );
 
8326
+    return sImplName;
 
8327
+}
 
8328
+
 
8329
+uno::Sequence< rtl::OUString > 
 
8330
+SwVbaListTemplate::getServiceNames()
 
8331
+{
 
8332
+    static uno::Sequence< rtl::OUString > aServiceNames;
 
8333
+    if ( aServiceNames.getLength() == 0 )
 
8334
+    {
 
8335
+        aServiceNames.realloc( 1 );
 
8336
+        aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListTemplate" ) );
 
8337
+    }
 
8338
+    return aServiceNames;
 
8339
+}
 
8340
+
 
8341
diff --git sw/source/ui/vba/vbalisttemplate.hxx sw/source/ui/vba/vbalisttemplate.hxx
 
8342
new file mode 100644
 
8343
index 0000000..733ef76
 
8344
--- /dev/null
 
8345
+++ sw/source/ui/vba/vbalisttemplate.hxx
 
8346
@@ -0,0 +1,60 @@
 
8347
+/*************************************************************************
 
8348
+ *
 
8349
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
8350
+ * 
 
8351
+ * Copyright 2008 by Sun Microsystems, Inc.
 
8352
+ *
 
8353
+ * OpenOffice.org - a multi-platform office productivity suite
 
8354
+ *
 
8355
+ * $RCSfile: 
 
8356
+ * $Revision: 
 
8357
+ *
 
8358
+ * This file is part of OpenOffice.org.
 
8359
+ *
 
8360
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
8361
+ * it under the terms of the GNU Lesser General Public License version 3
 
8362
+ * only, as published by the Free Software Foundation.
 
8363
+ *
 
8364
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
8365
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
8366
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
8367
+ * GNU Lesser General Public License version 3 for more details
 
8368
+ * (a copy is included in the LICENSE file that accompanied this code).
 
8369
+ *
 
8370
+ * You should have received a copy of the GNU Lesser General Public License
 
8371
+ * version 3 along with OpenOffice.org.  If not, see
 
8372
+ * <http://www.openoffice.org/license.html>
 
8373
+ * for a copy of the LGPLv3 License.
 
8374
+ *
 
8375
+ ************************************************************************/
 
8376
+#ifndef SW_VBA_LISTTEMPLATE_HXX
 
8377
+#define SW_VBA_LISTTEMPLATE_HXX
 
8378
+
 
8379
+#include <ooo/vba/word/XListTemplate.hpp>
 
8380
+#include <vbahelper/vbahelperinterface.hxx>
 
8381
+#include <cppuhelper/implbase1.hxx>
 
8382
+#include <com/sun/star/text/XTextDocument.hpp>
 
8383
+#include "vbalisthelper.hxx"
 
8384
+
 
8385
+
 
8386
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XListTemplate > SwVbaListTemplate_BASE;
 
8387
+
 
8388
+class SwVbaListTemplate : public SwVbaListTemplate_BASE
 
8389
+{
 
8390
+private:
 
8391
+    SwVbaListHelperRef pListHelper;
 
8392
+
 
8393
+public:
 
8394
+    SwVbaListTemplate( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nGalleryType, sal_Int32 nTemplateType ) throw ( css::uno::RuntimeException );
 
8395
+    virtual ~SwVbaListTemplate();
 
8396
+
 
8397
+    void applyListTemplate( css::uno::Reference< css::beans::XPropertySet >& xProps ) throw ( css::uno::RuntimeException );
 
8398
+
 
8399
+    // Methods
 
8400
+    virtual css::uno::Any SAL_CALL ListLevels( const css::uno::Any& index ) throw ( css::uno::RuntimeException );
 
8401
+
 
8402
+    // XHelperInterface
 
8403
+    virtual rtl::OUString& getServiceImplName();
 
8404
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
8405
+};
 
8406
+#endif /* SW_VBA_LISTTEMPLATE_HXX */
 
8407
diff --git sw/source/ui/vba/vbalisttemplates.cxx sw/source/ui/vba/vbalisttemplates.cxx
 
8408
new file mode 100644
 
8409
index 0000000..ba560d3
 
8410
--- /dev/null
 
8411
+++ sw/source/ui/vba/vbalisttemplates.cxx
 
8412
@@ -0,0 +1,112 @@
 
8413
+/*************************************************************************
 
8414
+ *
 
8415
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
8416
+ * 
 
8417
+ * Copyright 2008 by Sun Microsystems, Inc.
 
8418
+ *
 
8419
+ * OpenOffice.org - a multi-platform office productivity suite
 
8420
+ *
 
8421
+ * $RCSfile: 
 
8422
+ * $Revision: 
 
8423
+ *
 
8424
+ * This file is part of OpenOffice.org.
 
8425
+ *
 
8426
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
8427
+ * it under the terms of the GNU Lesser General Public License version 3
 
8428
+ * only, as published by the Free Software Foundation.
 
8429
+ *
 
8430
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
8431
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
8432
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
8433
+ * GNU Lesser General Public License version 3 for more details
 
8434
+ * (a copy is included in the LICENSE file that accompanied this code).
 
8435
+ *
 
8436
+ * You should have received a copy of the GNU Lesser General Public License
 
8437
+ * version 3 along with OpenOffice.org.  If not, see
 
8438
+ * <http://www.openoffice.org/license.html>
 
8439
+ * for a copy of the LGPLv3 License.
 
8440
+ *
 
8441
+ ************************************************************************/
 
8442
+#include "vbalisttemplates.hxx"
 
8443
+#include "vbalisttemplate.hxx"
 
8444
+
 
8445
+using namespace ::ooo::vba;
 
8446
+using namespace ::com::sun::star;
 
8447
+
 
8448
+class ListTemplatesEnumWrapper : public EnumerationHelper_BASE
 
8449
+{
 
8450
+    SwVbaListTemplates* pListTemplates;
 
8451
+    sal_Int32 nIndex;
 
8452
+public:
 
8453
+    ListTemplatesEnumWrapper( SwVbaListTemplates* pTemplates ) : pListTemplates( pTemplates ), nIndex( 1 ) {}
 
8454
+    virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException)
 
8455
+    {
 
8456
+        return ( nIndex <= pListTemplates->getCount() );
 
8457
+    }
 
8458
+
 
8459
+    virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
 
8460
+    {
 
8461
+        if ( nIndex <= pListTemplates->getCount() )
 
8462
+            return pListTemplates->Item( uno::makeAny( nIndex++ ), uno::Any() );
 
8463
+        throw container::NoSuchElementException();
 
8464
+    }
 
8465
+};
 
8466
+
 
8467
+SwVbaListTemplates::SwVbaListTemplates( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xTextDoc, sal_Int32 nType ) throw (uno::RuntimeException) : SwVbaListTemplates_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >() ),  mxTextDocument( xTextDoc ), mnGalleryType( nType )
 
8468
+{
 
8469
+}
 
8470
+
 
8471
+::sal_Int32 SAL_CALL SwVbaListTemplates::getCount() throw (uno::RuntimeException)
 
8472
+{
 
8473
+    // 3 types of list( bullet, numbered and outline )
 
8474
+    return 7;
 
8475
+}
 
8476
+
 
8477
+uno::Any SAL_CALL SwVbaListTemplates::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
 
8478
+{
 
8479
+    sal_Int32 nIndex = 0;
 
8480
+    if( ( Index1 >>= nIndex ) == sal_False )
 
8481
+        throw uno::RuntimeException();
 
8482
+    if( nIndex <=0 || nIndex > getCount() )    
 
8483
+        throw  uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
 
8484
+        
 
8485
+    return uno::makeAny( uno::Reference< word::XListTemplate >( new SwVbaListTemplate( this, mxContext, mxTextDocument, mnGalleryType, nIndex ) ) );
 
8486
+}
 
8487
+
 
8488
+// XEnumerationAccess
 
8489
+uno::Type
 
8490
+SwVbaListTemplates::getElementType() throw (uno::RuntimeException)
 
8491
+{
 
8492
+    return word::XListTemplate::static_type(0);
 
8493
+}
 
8494
+
 
8495
+uno::Reference< container::XEnumeration >
 
8496
+SwVbaListTemplates::createEnumeration() throw (uno::RuntimeException)
 
8497
+{
 
8498
+    return new ListTemplatesEnumWrapper( this );
 
8499
+}
 
8500
+
 
8501
+uno::Any
 
8502
+SwVbaListTemplates::createCollectionObject( const css::uno::Any& aSource )
 
8503
+{
 
8504
+    return aSource;
 
8505
+}
 
8506
+
 
8507
+rtl::OUString& 
 
8508
+SwVbaListTemplates::getServiceImplName()
 
8509
+{
 
8510
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListTemplates") );
 
8511
+    return sImplName;
 
8512
+}
 
8513
+
 
8514
+css::uno::Sequence<rtl::OUString> 
 
8515
+SwVbaListTemplates::getServiceNames()
 
8516
+{
 
8517
+    static uno::Sequence< rtl::OUString > sNames;
 
8518
+    if ( sNames.getLength() == 0 )
 
8519
+    {
 
8520
+        sNames.realloc( 1 );
 
8521
+        sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListTemplates") );
 
8522
+    }
 
8523
+    return sNames;
 
8524
+}
 
8525
diff --git sw/source/ui/vba/vbalisttemplates.hxx sw/source/ui/vba/vbalisttemplates.hxx
 
8526
new file mode 100644
 
8527
index 0000000..214d01b
 
8528
--- /dev/null
 
8529
+++ sw/source/ui/vba/vbalisttemplates.hxx
 
8530
@@ -0,0 +1,62 @@
 
8531
+/*************************************************************************
 
8532
+ *
 
8533
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
8534
+ * 
 
8535
+ * Copyright 2008 by Sun Microsystems, Inc.
 
8536
+ *
 
8537
+ * OpenOffice.org - a multi-platform office productivity suite
 
8538
+ *
 
8539
+ * $RCSfile: 
 
8540
+ * $Revision: 
 
8541
+ *
 
8542
+ * This file is part of OpenOffice.org.
 
8543
+ *
 
8544
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
8545
+ * it under the terms of the GNU Lesser General Public License version 3
 
8546
+ * only, as published by the Free Software Foundation.
 
8547
+ *
 
8548
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
8549
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
8550
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
8551
+ * GNU Lesser General Public License version 3 for more details
 
8552
+ * (a copy is included in the LICENSE file that accompanied this code).
 
8553
+ *
 
8554
+ * You should have received a copy of the GNU Lesser General Public License
 
8555
+ * version 3 along with OpenOffice.org.  If not, see
 
8556
+ * <http://www.openoffice.org/license.html>
 
8557
+ * for a copy of the LGPLv3 License.
 
8558
+ *
 
8559
+ ************************************************************************/
 
8560
+#ifndef SW_VBA_LISTTEMPLATES_HXX
 
8561
+#define SW_VBA_LISTTEMPLATES_HXX
 
8562
+
 
8563
+#include <vbahelper/vbacollectionimpl.hxx>
 
8564
+#include <ooo/vba/word/XListTemplates.hpp>
 
8565
+#include <vbahelper/vbahelperinterface.hxx>
 
8566
+#include <com/sun/star/text/XTextDocument.hpp>
 
8567
+
 
8568
+typedef CollTestImplHelper< ooo::vba::word::XListTemplates > SwVbaListTemplates_BASE;
 
8569
+
 
8570
+class SwVbaListTemplates : public SwVbaListTemplates_BASE
 
8571
+{
 
8572
+private:
 
8573
+    css::uno::Reference< css::text::XTextDocument > mxTextDocument;
 
8574
+    sal_Int32 mnGalleryType;
 
8575
+
 
8576
+public:
 
8577
+    SwVbaListTemplates( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nType ) throw (css::uno::RuntimeException);
 
8578
+    virtual ~SwVbaListTemplates() {}
 
8579
+
 
8580
+    virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
 
8581
+    virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& /*not processed in this base class*/ ) throw ( css::uno::RuntimeException );
 
8582
+    // XEnumerationAccess
 
8583
+    virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
 
8584
+    virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
 
8585
+
 
8586
+    // SwVbaListTemplates_BASE
 
8587
+    virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); 
 
8588
+    virtual rtl::OUString& getServiceImplName();
 
8589
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
8590
+};    
 
8591
+
 
8592
+#endif /* SW_VBA_LISTTEMPLATES_HXX */
 
8593
diff --git sw/source/ui/vba/vbaparagraph.cxx sw/source/ui/vba/vbaparagraph.cxx
 
8594
index 107ff33..56db358 100644
 
8595
--- sw/source/ui/vba/vbaparagraph.cxx
 
8596
+++ sw/source/ui/vba/vbaparagraph.cxx
 
8597
@@ -51,6 +51,20 @@ SwVbaParagraph::getRange( ) throw ( uno::RuntimeException )
 
8598
     return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, mxTextDocument, mxTextRange->getStart(), mxTextRange->getEnd(), mxTextRange->getText(), sal_True ) );
 
8599
 }
 
8600
 
 
8601
+uno::Any SAL_CALL
 
8602
+SwVbaParagraph::getStyle( ) throw ( uno::RuntimeException )
 
8603
+{
 
8604
+    uno::Reference< word::XRange > xRange = getRange();
 
8605
+    return xRange->getStyle();
 
8606
+}
 
8607
+
 
8608
+void SAL_CALL
 
8609
+SwVbaParagraph::setStyle( const uno::Any& style ) throw ( uno::RuntimeException )
 
8610
+{
 
8611
+    uno::Reference< word::XRange > xRange = getRange();
 
8612
+    xRange->setStyle( style );
 
8613
+}
 
8614
+
 
8615
 rtl::OUString& 
 
8616
 SwVbaParagraph::getServiceImplName()
 
8617
 {
 
8618
diff --git sw/source/ui/vba/vbaparagraph.hxx sw/source/ui/vba/vbaparagraph.hxx
 
8619
index 979116d..bebafe0 100644
 
8620
--- sw/source/ui/vba/vbaparagraph.hxx
 
8621
+++ sw/source/ui/vba/vbaparagraph.hxx
 
8622
@@ -53,6 +53,8 @@ public:
 
8623
 
 
8624
     // XParagraph
 
8625
     virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL getRange() throw ( css::uno::RuntimeException );
 
8626
+    virtual css::uno::Any SAL_CALL getStyle() throw ( css::uno::RuntimeException );
 
8627
+    virtual void SAL_CALL setStyle( const css::uno::Any& style ) throw ( css::uno::RuntimeException );
 
8628
 
 
8629
        // XHelperInterface
 
8630
        virtual rtl::OUString& getServiceImplName();
 
8631
diff --git sw/source/ui/vba/vbaparagraphformat.cxx sw/source/ui/vba/vbaparagraphformat.cxx
 
8632
index 2959a23..6639ceb 100644
 
8633
--- sw/source/ui/vba/vbaparagraphformat.cxx
 
8634
+++ sw/source/ui/vba/vbaparagraphformat.cxx
 
8635
@@ -37,6 +37,7 @@
 
8636
 #include <ooo/vba/word/WdOutlineLevel.hpp>
 
8637
 #include <com/sun/star/style/ParagraphAdjust.hpp>
 
8638
 #include <com/sun/star/style/BreakType.hpp>
 
8639
+#include "vbatabstops.hxx"
 
8640
 
 
8641
 
 
8642
 using namespace ::ooo::vba;
 
8643
@@ -203,9 +204,12 @@ sal_Int32 SAL_CALL SwVbaParagraphFormat::getOutlineLevel() throw (uno::RuntimeEx
 
8644
     return nLevel;
 
8645
 }
 
8646
 
 
8647
-void SAL_CALL SwVbaParagraphFormat::setOutlineLevel( sal_Int32 /*_outlinelevel*/ ) throw (uno::RuntimeException)
 
8648
+void SAL_CALL SwVbaParagraphFormat::setOutlineLevel( sal_Int32 _outlinelevel ) throw (uno::RuntimeException)
 
8649
 {
 
8650
-    throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
8651
+    if( _outlinelevel != getOutlineLevel() )
 
8652
+    {
 
8653
+        // TODO: in my test in msword, there is no effect for this function.
 
8654
+    }
 
8655
 }
 
8656
 
 
8657
 uno::Any SAL_CALL SwVbaParagraphFormat::getPageBreakBefore() throw (uno::RuntimeException)
 
8658
@@ -299,7 +303,7 @@ void SAL_CALL SwVbaParagraphFormat::setRightIndent( float _rightindent ) throw (
 
8659
 
 
8660
 uno::Any SAL_CALL SwVbaParagraphFormat::getTabStops() throw (uno::RuntimeException)
 
8661
 {
 
8662
-    throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
8663
+    return uno::makeAny( uno::Reference< word::XTabStops >( new SwVbaTabStops( this, mxContext, mxParaProps ) ) );
 
8664
 }
 
8665
 
 
8666
 void SAL_CALL SwVbaParagraphFormat::setTabStops( const uno::Any& /*_tabstops*/ ) throw (uno::RuntimeException)
 
8667
diff --git sw/source/ui/vba/vbarange.cxx sw/source/ui/vba/vbarange.cxx
 
8668
index 7f166e9..057330b 100644
 
8669
--- sw/source/ui/vba/vbarange.cxx
 
8670
+++ sw/source/ui/vba/vbarange.cxx
 
8671
@@ -35,12 +35,21 @@
 
8672
 #include <com/sun/star/style/BreakType.hpp>
 
8673
 #include <com/sun/star/text/ControlCharacter.hpp>
 
8674
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 
8675
-#include "wordvbahelper.hxx"
 
8676
+#include <com/sun/star/text/XTextRangeCompare.hpp>
 
8677
+#include <com/sun/star/text/XWordCursor.hpp>
 
8678
+#include <com/sun/star/text/XParagraphCursor.hpp>
 
8679
+#include <ooo/vba/word/WdUnits.hpp>
 
8680
+#include <ooo/vba/word/WdMovementType.hpp>
 
8681
 #include "vbaparagraphformat.hxx"
 
8682
 #include "vbastyle.hxx"
 
8683
 #include "vbafont.hxx"
 
8684
 #include "vbapalette.hxx"
 
8685
 #include "vbapagesetup.hxx"
 
8686
+#include "vbalistformat.hxx"
 
8687
+#include "vbarevisions.hxx"
 
8688
+#include "vbabookmarks.hxx"
 
8689
+#include "vbasections.hxx"
 
8690
+#include "vbafield.hxx"
 
8691
 
 
8692
 using namespace ::ooo::vba;
 
8693
 using namespace ::com::sun::star;
 
8694
@@ -73,6 +82,8 @@ void SwVbaRange::initialize( const uno::Reference< text::XTextRange >& rStart, c
 
8695
     }    
 
8696
     
 
8697
     mxTextCursor = SwVbaRangeHelper::initCursor( rStart, mxText );
 
8698
+    if( !mxTextCursor.is() )
 
8699
+        throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Fails to create text cursor") ), uno::Reference< uno::XInterface >() );
 
8700
     mxTextCursor->collapseToStart();
 
8701
 
 
8702
     if( rEnd.is() )
 
8703
@@ -94,6 +105,67 @@ void SwVbaRange::setXTextRange( const uno::Reference< text::XTextRange >& xRange
 
8704
     mxTextCursor->gotoRange( xRange->getEnd(), sal_True );
 
8705
 }
 
8706
 
 
8707
+void
 
8708
+SwVbaRange::Move( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend, word::E_DIRECTION eDirection ) throw ( uno::RuntimeException )
 
8709
+{
 
8710
+    sal_Int32 nUnit = word::WdUnits::wdCharacter;
 
8711
+    sal_Int32 nCount = 1;
 
8712
+    sal_Int32 nExtend = word::WdMovementType::wdMove;
 
8713
+
 
8714
+    if( _unit.hasValue() )
 
8715
+        _unit >>= nUnit;
 
8716
+    if( _count.hasValue() )
 
8717
+        _count >>= nCount;
 
8718
+    if( _extend.hasValue() )
 
8719
+        _extend >>= nExtend;
 
8720
+    
 
8721
+    if( nCount == 0 )
 
8722
+        return;
 
8723
+
 
8724
+    sal_Bool bExpand = ( nExtend == word::WdMovementType::wdMove ) ? sal_False : sal_True;
 
8725
+    
 
8726
+    switch( nUnit )
 
8727
+    {
 
8728
+        case word::WdUnits::wdParagraph:
 
8729
+        {
 
8730
+            if( eDirection == word::MOVE_LEFT || eDirection == word::MOVE_RIGHT )
 
8731
+            {
 
8732
+                throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
8733
+            }
 
8734
+            uno::Reference< text::XParagraphCursor > xParagraphCursor( mxTextCursor, uno::UNO_QUERY_THROW );
 
8735
+            for( sal_Int32 i=0; i<nCount; i++ )
 
8736
+            {
 
8737
+                if( ( eDirection == word::MOVE_UP ) && ( xParagraphCursor->gotoPreviousParagraph( bExpand ) == sal_False ) )
 
8738
+                    break;
 
8739
+                else if( ( eDirection == word::MOVE_DOWN ) && ( xParagraphCursor->gotoNextParagraph( bExpand ) == sal_False ) )
 
8740
+                    break;
 
8741
+            }
 
8742
+            break;
 
8743
+        }
 
8744
+        case word::WdUnits::wdWord:
 
8745
+        {
 
8746
+            if( eDirection == word::MOVE_UP || eDirection == word::MOVE_DOWN )
 
8747
+            {
 
8748
+                throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
8749
+            }
 
8750
+            uno::Reference< text::XWordCursor > xWordCursor( mxTextCursor, uno::UNO_QUERY_THROW );
 
8751
+            for( sal_Int32 i=0; i<nCount; i++ )
 
8752
+            {
 
8753
+                if( (eDirection == word::MOVE_LEFT ) && ( xWordCursor->gotoPreviousWord( bExpand ) == sal_False ) )
 
8754
+                    break;
 
8755
+                else if( ( eDirection == word::MOVE_RIGHT ) && ( xWordCursor->gotoNextWord( bExpand ) == sal_False ) )
 
8756
+                    break;
 
8757
+            }
 
8758
+            break;
 
8759
+        }
 
8760
+        default:
 
8761
+        {
 
8762
+            throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
8763
+            break;
 
8764
+        }
 
8765
+    }
 
8766
+}
 
8767
+
 
8768
 /**
 
8769
 * The complexity in this method is because we need to workaround
 
8770
 * an issue that the last paragraph in a document does not have a trailing CRLF.
 
8771
@@ -131,17 +203,46 @@ SwVbaRange::getText() throw ( uno::RuntimeException )
 
8772
 void SAL_CALL
 
8773
 SwVbaRange::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
 
8774
 {
 
8775
+    // Emulate the MSWord behavior, Don't delete the bookmark
 
8776
+    // which contains no text string in current inserting position, 
 
8777
+    rtl::OUString sName;
 
8778
+    uno::Reference< text::XTextRange > xRange( mxTextCursor, uno::UNO_QUERY_THROW );
 
8779
+    try
 
8780
+    {
 
8781
+        uno::Reference< text::XTextContent > xBookmark = SwVbaRangeHelper::findBookmarkByPosition( mxTextDocument, xRange->getStart() );
 
8782
+        if( xBookmark.is() )
 
8783
+        {
 
8784
+            uno::Reference< container::XNamed > xNamed( xBookmark, uno::UNO_QUERY_THROW );
 
8785
+            sName = xNamed->getName();
 
8786
+        }
 
8787
+    }
 
8788
+    catch( uno::Exception& )
 
8789
+    {
 
8790
+        // do nothing
 
8791
+    }
 
8792
+    
 
8793
     if( rText.indexOf( '\n' )  != -1 )
 
8794
     {
 
8795
         mxTextCursor->setString( rtl::OUString() );
 
8796
         // process CR in strings
 
8797
-        uno::Reference< text::XTextRange > xRange( mxTextCursor, uno::UNO_QUERY_THROW );
 
8798
         SwVbaRangeHelper::insertString( xRange, mxText, rText, sal_True );
 
8799
     }
 
8800
     else
 
8801
     {
 
8802
         mxTextCursor->setString( rText );
 
8803
     }
 
8804
+
 
8805
+    // insert the bookmark if the bookmark is deleted during setting text string
 
8806
+    if( sName.getLength() )
 
8807
+    {
 
8808
+        uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( mxTextDocument, uno::UNO_QUERY_THROW );
 
8809
+        uno::Reference< container::XNameAccess > xNameAccess( xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY_THROW );
 
8810
+        if( !xNameAccess->hasByName( sName ) )
 
8811
+        {
 
8812
+            uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
 
8813
+            SwVbaBookmarks::addBookmarkByName( xModel, sName, xRange->getStart() );
 
8814
+        }
 
8815
+    }
 
8816
 }
 
8817
 
 
8818
 // FIXME: test is not pass
 
8819
@@ -232,11 +333,8 @@ SwVbaRange::setParagraphFormat( const uno::Reference< word::XParagraphFormat >&
 
8820
     throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
8821
 }
 
8822
 
 
8823
-uno::Reference< word::XStyle > SAL_CALL
 
8824
-SwVbaRange::getStyle() throw ( uno::RuntimeException )
 
8825
+void SwVbaRange::GetStyleInfo(rtl::OUString& aStyleName, rtl::OUString& aStyleType ) throw ( uno::RuntimeException )
 
8826
 {
 
8827
-    rtl::OUString aStyleName;
 
8828
-    rtl::OUString aStyleType;
 
8829
     uno::Reference< beans::XPropertySet > xProp( mxTextCursor, uno::UNO_QUERY_THROW );
 
8830
     if( ( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharStyleName") ) ) >>= aStyleName ) && aStyleName.getLength() )
 
8831
     {
 
8832
@@ -250,14 +348,23 @@ SwVbaRange::getStyle() throw ( uno::RuntimeException )
 
8833
     {
 
8834
         DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() );
 
8835
     }
 
8836
+}
 
8837
+
 
8838
+uno::Any SAL_CALL
 
8839
+SwVbaRange::getStyle() throw ( uno::RuntimeException )
 
8840
+{
 
8841
+    rtl::OUString aStyleName;
 
8842
+    rtl::OUString aStyleType;
 
8843
+    GetStyleInfo( aStyleName, aStyleType );
 
8844
     uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxTextDocument, uno::UNO_QUERY_THROW);
 
8845
     uno::Reference< container::XNameAccess > xStylesAccess( xStyleSupplier->getStyleFamilies()->getByName( aStyleType ), uno::UNO_QUERY_THROW );
 
8846
     uno::Reference< beans::XPropertySet > xStyleProps( xStylesAccess->getByName( aStyleName ), uno::UNO_QUERY_THROW );
 
8847
-    return uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProps ) ); 
 
8848
+    uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
 
8849
+    return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xModel, xStyleProps ) ) );
 
8850
 }
 
8851
 
 
8852
 void SAL_CALL
 
8853
-SwVbaRange::setStyle( const uno::Reference< word::XStyle >& rStyle ) throw ( uno::RuntimeException )
 
8854
+SwVbaRange::setStyle( const uno::Any& rStyle ) throw ( uno::RuntimeException )
 
8855
 {
 
8856
     uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW );
 
8857
     SwVbaStyle::setStyle( xParaProps, rStyle );
 
8858
@@ -270,6 +377,12 @@ SwVbaRange::getFont() throw ( uno::RuntimeException )
 
8859
     return new SwVbaFont( mxParent, mxContext, aColors.getPalette(), uno::Reference< beans::XPropertySet >( getXTextRange(), uno::UNO_QUERY_THROW ) );
 
8860
 }
 
8861
 
 
8862
+uno::Reference< word::XListFormat > SAL_CALL
 
8863
+SwVbaRange::getListFormat() throw ( uno::RuntimeException )
 
8864
+{
 
8865
+    return uno::Reference< word::XListFormat >( new SwVbaListFormat( this, mxContext, getXTextRange() ) );
 
8866
+}
 
8867
+
 
8868
 ::sal_Int32 SAL_CALL SwVbaRange::getLanguageID() throw (uno::RuntimeException)
 
8869
 {
 
8870
     uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW );
 
8871
@@ -327,6 +440,50 @@ void SAL_CALL SwVbaRange::setEnd( ::sal_Int32 _end ) throw (uno::RuntimeExceptio
 
8872
     mxTextCursor->gotoRange( xEnd, sal_True );
 
8873
 }
 
8874
 
 
8875
+::sal_Bool SAL_CALL SwVbaRange::InRange( const uno::Reference< ::ooo::vba::word::XRange >& Range ) throw (uno::RuntimeException)
 
8876
+{
 
8877
+    SwVbaRange* pRange = dynamic_cast< SwVbaRange* >( Range.get() );
 
8878
+    if( !pRange )
 
8879
+        throw uno::RuntimeException();
 
8880
+    uno::Reference< text::XTextRange > xTextRange = pRange->getXTextRange();    
 
8881
+    uno::Reference< text::XTextRangeCompare > xTRC( mxTextCursor->getText(), uno::UNO_QUERY_THROW );
 
8882
+    if( xTRC->compareRegionStarts( xTextRange, getXTextRange() ) >= 0 && xTRC->compareRegionEnds( xTextRange, getXTextRange() ) <= 0 )
 
8883
+        return sal_True;
 
8884
+    return sal_False;    
 
8885
+}
 
8886
+
 
8887
+uno::Any SAL_CALL
 
8888
+SwVbaRange::Revisions( const uno::Any& index ) throw (uno::RuntimeException)
 
8889
+{
 
8890
+    uno::Reference< text::XTextRange > xTextRange = getXTextRange();
 
8891
+    uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
 
8892
+    uno::Reference< XCollection > xCol( new SwVbaRevisions( mxParent, mxContext, xModel, xTextRange ) );
 
8893
+    if ( index.hasValue() )
 
8894
+        return xCol->Item( index, uno::Any() );
 
8895
+    return uno::makeAny( xCol );
 
8896
+}
 
8897
+
 
8898
+uno::Any SAL_CALL
 
8899
+SwVbaRange::Sections( const uno::Any& index ) throw (uno::RuntimeException)
 
8900
+{
 
8901
+    uno::Reference< text::XTextRange > xTextRange = getXTextRange();
 
8902
+    uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
 
8903
+    uno::Reference< XCollection > xCol( new SwVbaSections( mxParent, mxContext, xModel, xTextRange ) );
 
8904
+    if ( index.hasValue() )
 
8905
+        return xCol->Item( index, uno::Any() );
 
8906
+    return uno::makeAny( xCol );
 
8907
+}
 
8908
+
 
8909
+uno::Any SAL_CALL
 
8910
+SwVbaRange::Fields( const uno::Any& index ) throw (uno::RuntimeException)
 
8911
+{
 
8912
+    //FIXME: should be get the field in current range
 
8913
+    uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
 
8914
+    uno::Reference< XCollection > xCol( new SwVbaFields( mxParent, mxContext, xModel ) );
 
8915
+    if ( index.hasValue() )
 
8916
+        return xCol->Item( index, uno::Any() );
 
8917
+    return uno::makeAny( xCol );
 
8918
+}
 
8919
 rtl::OUString& 
 
8920
 SwVbaRange::getServiceImplName()
 
8921
 {
 
8922
diff --git sw/source/ui/vba/vbarange.hxx sw/source/ui/vba/vbarange.hxx
 
8923
index abce5b7..030007e 100644
 
8924
--- sw/source/ui/vba/vbarange.hxx
 
8925
+++ sw/source/ui/vba/vbarange.hxx
 
8926
@@ -38,6 +38,8 @@
 
8927
 #include <com/sun/star/text/XTextRange.hpp>
 
8928
 #include <com/sun/star/text/XTextDocument.hpp>
 
8929
 #include <ooo/vba/word/XStyle.hpp>
 
8930
+#include <ooo/vba/word/XListFormat.hpp>
 
8931
+#include "wordvbahelper.hxx"
 
8932
 
 
8933
 typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRange > SwVbaRange_BASE;
 
8934
 
 
8935
@@ -51,6 +53,7 @@ private:
 
8936
 
 
8937
 private:
 
8938
     void initialize( const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd ) throw (css::uno::RuntimeException);
 
8939
+    void GetStyleInfo(rtl::OUString& aStyleName, rtl::OUString& aStyleType ) throw ( css::uno::RuntimeException );
 
8940
 public:
 
8941
        SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, sal_Bool _bMaySpanEndOfDocument = sal_False ) throw (css::uno::RuntimeException);
 
8942
        SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd, sal_Bool _bMaySpanEndOfDocument = sal_False ) throw (css::uno::RuntimeException);
 
8943
@@ -62,16 +65,18 @@ public:
 
8944
     void setXTextRange( const css::uno::Reference< css::text::XTextRange >& xRange ) throw (css::uno::RuntimeException);
 
8945
     css::uno::Reference< css::text::XText > getXText() { return mxText; }
 
8946
     void setXTextCursor( const css::uno::Reference< css::text::XTextCursor >& xTextCursor ) { mxTextCursor = xTextCursor; }
 
8947
+    void Move( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend, ooo::vba::word::E_DIRECTION eDirection ) throw (css::uno::RuntimeException);
 
8948
 
 
8949
        // Attribute
 
8950
     virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
 
8951
     virtual void SAL_CALL setText( const rtl::OUString& rText ) throw (css::uno::RuntimeException);
 
8952
     virtual css::uno::Reference< ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() throw (css::uno::RuntimeException);
 
8953
     virtual void SAL_CALL setParagraphFormat( const css::uno::Reference< ooo::vba::word::XParagraphFormat >& rParagraphFormat ) throw (css::uno::RuntimeException);
 
8954
-    virtual css::uno::Reference< ooo::vba::word::XStyle > SAL_CALL getStyle() throw (css::uno::RuntimeException);
 
8955
-    virtual void SAL_CALL setStyle( const css::uno::Reference< ooo::vba::word::XStyle >& _xStyle ) throw (css::uno::RuntimeException);
 
8956
+    virtual css::uno::Any SAL_CALL getStyle() throw (css::uno::RuntimeException);
 
8957
+    virtual void SAL_CALL setStyle( const css::uno::Any& _xStyle ) throw (css::uno::RuntimeException);
 
8958
 
 
8959
     virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
 
8960
+    virtual css::uno::Reference< ooo::vba::word::XListFormat > SAL_CALL getListFormat() throw (css::uno::RuntimeException);
 
8961
     // Methods
 
8962
     virtual void SAL_CALL InsertBreak( const css::uno::Any& _breakType ) throw (css::uno::RuntimeException);
 
8963
     virtual void SAL_CALL Select() throw (css::uno::RuntimeException);
 
8964
@@ -85,6 +90,10 @@ public:
 
8965
     virtual void SAL_CALL setStart( ::sal_Int32 _start ) throw (css::uno::RuntimeException);
 
8966
     virtual ::sal_Int32 SAL_CALL getEnd() throw (css::uno::RuntimeException);
 
8967
     virtual void SAL_CALL setEnd( ::sal_Int32 _end ) throw (css::uno::RuntimeException);
 
8968
+    virtual ::sal_Bool SAL_CALL InRange( const css::uno::Reference< ::ooo::vba::word::XRange >& Range ) throw (css::uno::RuntimeException);
 
8969
+    virtual css::uno::Any SAL_CALL Revisions( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
 
8970
+    virtual css::uno::Any SAL_CALL Sections( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
 
8971
+    virtual css::uno::Any SAL_CALL Fields( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
 
8972
 
 
8973
        // XHelperInterface
 
8974
        virtual rtl::OUString& getServiceImplName();
 
8975
diff --git sw/source/ui/vba/vbarangehelper.cxx sw/source/ui/vba/vbarangehelper.cxx
 
8976
index 5df01b8..12aa933 100644
 
8977
--- sw/source/ui/vba/vbarangehelper.cxx
 
8978
+++ sw/source/ui/vba/vbarangehelper.cxx
 
8979
@@ -30,6 +30,7 @@
 
8980
 #include "vbarangehelper.hxx"
 
8981
 #include <com/sun/star/text/ControlCharacter.hpp>
 
8982
 #include <com/sun/star/text/XTextRangeCompare.hpp>
 
8983
+#include <com/sun/star/text/XBookmarksSupplier.hpp>
 
8984
 
 
8985
 using namespace ::ooo::vba;
 
8986
 using namespace ::com::sun::star;
 
8987
@@ -114,7 +115,7 @@ uno::Reference< text::XTextCursor > SwVbaRangeHelper::initCursor( const uno::Ref
 
8988
         DebugHelper::exception(e);
 
8989
     }
 
8990
 
 
8991
-    if( !bGotTextCursor )
 
8992
+    if( !bGotTextCursor || !xTextCursor.is() )
 
8993
     {
 
8994
         try
 
8995
         {
 
8996
@@ -128,7 +129,7 @@ uno::Reference< text::XTextCursor > SwVbaRangeHelper::initCursor( const uno::Ref
 
8997
         }
 
8998
     }
 
8999
 
 
9000
-    if( !bGotTextCursor )
 
9001
+    if( !bGotTextCursor || !xTextCursor.is() )
 
9002
     {
 
9003
         try
 
9004
         {
 
9005
@@ -172,3 +173,29 @@ sal_Int32 SwVbaRangeHelper::getPosition( const uno::Reference< text::XText >& rT
 
9006
 
 
9007
     return nPosition;
 
9008
 }
 
9009
+
 
9010
+uno::Reference< text::XTextContent > SwVbaRangeHelper::findBookmarkByPosition( const uno::Reference< text::XTextDocument >& xTextDoc, const uno::Reference< text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException )
 
9011
+{
 
9012
+    uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( xTextDoc, uno::UNO_QUERY_THROW );
 
9013
+    uno::Reference< container::XIndexAccess > xIndexAccess( xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY_THROW );
 
9014
+    for( sal_Int32 index = 0; index < xIndexAccess->getCount(); index++ )
 
9015
+    {
 
9016
+        uno::Reference< text::XTextContent > xBookmark( xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
 
9017
+        uno::Reference< text::XTextRange > xBkAnchor = xBookmark->getAnchor();
 
9018
+        uno::Reference< text::XTextRangeCompare > xCompare( xBkAnchor->getText(), uno::UNO_QUERY_THROW );
 
9019
+        if( xCompare->compareRegionStarts( xBkAnchor->getStart(), xBkAnchor->getEnd() ) == 0 )
 
9020
+        {
 
9021
+            try
 
9022
+            {
 
9023
+                if( xCompare->compareRegionStarts( xTextRange, xBkAnchor->getStart() ) == 0 )
 
9024
+                    return xBookmark;
 
9025
+            }
 
9026
+            catch( uno::Exception& )
 
9027
+            {
 
9028
+                continue;
 
9029
+            }
 
9030
+        }
 
9031
+    }
 
9032
+    return uno::Reference< text::XTextContent >();
 
9033
+}
 
9034
+
 
9035
diff --git sw/source/ui/vba/vbarangehelper.hxx sw/source/ui/vba/vbarangehelper.hxx
 
9036
index 5e47899..e17eb72 100644
 
9037
--- sw/source/ui/vba/vbarangehelper.hxx
 
9038
+++ sw/source/ui/vba/vbarangehelper.hxx
 
9039
@@ -33,6 +33,8 @@
 
9040
 #include <vbahelper/vbahelperinterface.hxx>
 
9041
 #include <com/sun/star/text/XTextViewCursor.hpp>
 
9042
 #include <com/sun/star/text/XText.hpp>
 
9043
+#include <com/sun/star/text/XTextRange.hpp>
 
9044
+#include <com/sun/star/text/XTextDocument.hpp>
 
9045
 
 
9046
 class SwVbaRangeHelper
 
9047
 {
 
9048
@@ -41,6 +43,7 @@ public:
 
9049
     static void insertString( css::uno::Reference< css::text::XTextRange >& rTextRange, css::uno::Reference< css::text::XText >& rText, const rtl::OUString& rStr, sal_Bool _bAbsorb ) throw ( css::uno::RuntimeException );
 
9050
     static css::uno::Reference< css::text::XTextCursor > initCursor( const css::uno::Reference< css::text::XTextRange >& rTextRange, const css::uno::Reference< css::text::XText >& rText ) throw ( css::uno::RuntimeException );
 
9051
     static sal_Int32 getPosition( const css::uno::Reference< css::text::XText >& rText, const css::uno::Reference< css::text::XTextRange >& rTextRange ) throw ( css::uno::RuntimeException );
 
9052
+    static css::uno::Reference< css::text::XTextContent > findBookmarkByPosition( const css::uno::Reference< css::text::XTextDocument >& xTextDoc, const css::uno::Reference< css::text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException );
 
9053
 
 
9054
 };
 
9055
 #endif /* SW_VBA_RANGEHELPER_HXX */
 
9056
diff --git sw/source/ui/vba/vbareplacement.cxx sw/source/ui/vba/vbareplacement.cxx
 
9057
index abf85f3..7a46f83 100644
 
9058
--- sw/source/ui/vba/vbareplacement.cxx
 
9059
+++ sw/source/ui/vba/vbareplacement.cxx
 
9060
@@ -53,6 +53,12 @@ void SAL_CALL SwVbaReplacement::setText( const ::rtl::OUString& _text ) throw (u
 
9061
     mxPropertyReplace->setReplaceString( _text );
 
9062
 }
 
9063
 
 
9064
+void SAL_CALL SwVbaReplacement::ClearFormatting( ) throw (uno::RuntimeException)
 
9065
+{
 
9066
+    uno::Sequence< beans::PropertyValue > aPropValues;
 
9067
+    mxPropertyReplace->setReplaceAttributes( aPropValues );
 
9068
+}
 
9069
+
 
9070
 rtl::OUString& 
 
9071
 SwVbaReplacement::getServiceImplName()
 
9072
 {
 
9073
diff --git sw/source/ui/vba/vbareplacement.hxx sw/source/ui/vba/vbareplacement.hxx
 
9074
index d590a1d..8d0ef8d 100644
 
9075
--- sw/source/ui/vba/vbareplacement.hxx
 
9076
+++ sw/source/ui/vba/vbareplacement.hxx
 
9077
@@ -50,6 +50,9 @@ public:
 
9078
     virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
 
9079
     virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
 
9080
 
 
9081
+    //Methods
 
9082
+    virtual void SAL_CALL ClearFormatting() throw (css::uno::RuntimeException);
 
9083
+
 
9084
        // XHelperInterface
 
9085
        virtual rtl::OUString& getServiceImplName();
 
9086
        virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
9087
diff --git sw/source/ui/vba/vbarevision.cxx sw/source/ui/vba/vbarevision.cxx
 
9088
new file mode 100644
 
9089
index 0000000..0c48b1d
 
9090
--- /dev/null
 
9091
+++ sw/source/ui/vba/vbarevision.cxx
 
9092
@@ -0,0 +1,105 @@
 
9093
+/*************************************************************************
 
9094
+ *
 
9095
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
9096
+ * 
 
9097
+ * Copyright 2008 by Sun Microsystems, Inc.
 
9098
+ *
 
9099
+ * OpenOffice.org - a multi-platform office productivity suite
 
9100
+ *
 
9101
+ * $RCSfile: 
 
9102
+ * $Revision: 
 
9103
+ *
 
9104
+ * This file is part of OpenOffice.org.
 
9105
+ *
 
9106
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
9107
+ * it under the terms of the GNU Lesser General Public License version 3
 
9108
+ * only, as published by the Free Software Foundation.
 
9109
+ *
 
9110
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
9111
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9112
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
9113
+ * GNU Lesser General Public License version 3 for more details
 
9114
+ * (a copy is included in the LICENSE file that accompanied this code).
 
9115
+ *
 
9116
+ * You should have received a copy of the GNU Lesser General Public License
 
9117
+ * version 3 along with OpenOffice.org.  If not, see
 
9118
+ * <http://www.openoffice.org/license.html>
 
9119
+ * for a copy of the LGPLv3 License.
 
9120
+ *
 
9121
+ ************************************************************************/
 
9122
+#include "vbarevision.hxx"
 
9123
+#include <vbahelper/vbahelper.hxx>
 
9124
+#include <tools/diagnose_ex.h>
 
9125
+#include <com/sun/star/document/XRedlinesSupplier.hpp>
 
9126
+#include "wordvbahelper.hxx"
 
9127
+#include <docsh.hxx>
 
9128
+#include <doc.hxx>
 
9129
+
 
9130
+using namespace ::ooo::vba;
 
9131
+using namespace ::com::sun::star;
 
9132
+
 
9133
+SwVbaRevision::SwVbaRevision( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xRedlineProps ) throw ( uno::RuntimeException ) : SwVbaRevision_BASE( rParent, rContext ), mxModel( xModel ), mxRedlineProps( xRedlineProps )
 
9134
+{
 
9135
+}
 
9136
+
 
9137
+SwVbaRevision::~SwVbaRevision()
 
9138
+{
 
9139
+}
 
9140
+
 
9141
+sal_Int32 SwVbaRevision::GetPosition() throw (css::uno::RuntimeException)
 
9142
+{
 
9143
+    sal_Int32 nPos = -1;
 
9144
+    uno::Reference< document::XRedlinesSupplier > xRedlinesSupp( mxModel, uno::UNO_QUERY_THROW );
 
9145
+    uno::Reference< container::XIndexAccess > xRedlines( xRedlinesSupp->getRedlines(), uno::UNO_QUERY_THROW );
 
9146
+    sal_Int32 nCount = xRedlines->getCount();
 
9147
+    for( sal_Int32 i = 0; i < nCount; i++ )
 
9148
+    {
 
9149
+        uno::Reference< beans::XPropertySet > xProps( xRedlines->getByIndex( i ), uno::UNO_QUERY_THROW );
 
9150
+        if( xProps == mxRedlineProps )
 
9151
+        {
 
9152
+            nPos = i;
 
9153
+            OSL_TRACE(" SwVbaRevision::SwVbaRevision, the redline position is %d, ", nPos );
 
9154
+            break;
 
9155
+        }
 
9156
+    }
 
9157
+    if( nPos == -1 )
 
9158
+        throw uno::RuntimeException();
 
9159
+    
 
9160
+    return nPos;
 
9161
+}
 
9162
+
 
9163
+void SAL_CALL
 
9164
+SwVbaRevision::Accept() throw ( css::uno::RuntimeException )
 
9165
+{
 
9166
+    SwDoc* pDoc = word::getDocShell( mxModel )->GetDoc();
 
9167
+    if( pDoc )
 
9168
+        pDoc->AcceptRedline( GetPosition(), sal_True );
 
9169
+}
 
9170
+
 
9171
+void SAL_CALL
 
9172
+SwVbaRevision::Reject( ) throw ( css::uno::RuntimeException )
 
9173
+{
 
9174
+    SwDoc* pDoc = word::getDocShell( mxModel )->GetDoc();
 
9175
+    if( pDoc )
 
9176
+        pDoc->RejectRedline( GetPosition(), sal_True );
 
9177
+}
 
9178
+
 
9179
+rtl::OUString& 
 
9180
+SwVbaRevision::getServiceImplName()
 
9181
+{
 
9182
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRevision") );
 
9183
+    return sImplName;
 
9184
+}
 
9185
+
 
9186
+uno::Sequence< rtl::OUString > 
 
9187
+SwVbaRevision::getServiceNames()
 
9188
+{
 
9189
+    static uno::Sequence< rtl::OUString > aServiceNames;
 
9190
+    if ( aServiceNames.getLength() == 0 )
 
9191
+    {
 
9192
+        aServiceNames.realloc( 1 );
 
9193
+        aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Revision" ) );
 
9194
+    }
 
9195
+    return aServiceNames;
 
9196
+}
 
9197
+
 
9198
diff --git sw/source/ui/vba/vbarevision.hxx sw/source/ui/vba/vbarevision.hxx
 
9199
new file mode 100644
 
9200
index 0000000..0384370
 
9201
--- /dev/null
 
9202
+++ sw/source/ui/vba/vbarevision.hxx
 
9203
@@ -0,0 +1,60 @@
 
9204
+/*************************************************************************
 
9205
+ *
 
9206
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
9207
+ * 
 
9208
+ * Copyright 2008 by Sun Microsystems, Inc.
 
9209
+ *
 
9210
+ * OpenOffice.org - a multi-platform office productivity suite
 
9211
+ *
 
9212
+ * $RCSfile: 
 
9213
+ * $Revision: 
 
9214
+ *
 
9215
+ * This file is part of OpenOffice.org.
 
9216
+ *
 
9217
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
9218
+ * it under the terms of the GNU Lesser General Public License version 3
 
9219
+ * only, as published by the Free Software Foundation.
 
9220
+ *
 
9221
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
9222
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9223
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
9224
+ * GNU Lesser General Public License version 3 for more details
 
9225
+ * (a copy is included in the LICENSE file that accompanied this code).
 
9226
+ *
 
9227
+ * You should have received a copy of the GNU Lesser General Public License
 
9228
+ * version 3 along with OpenOffice.org.  If not, see
 
9229
+ * <http://www.openoffice.org/license.html>
 
9230
+ * for a copy of the LGPLv3 License.
 
9231
+ *
 
9232
+ ************************************************************************/
 
9233
+#ifndef SW_VBA_REVISION_HXX
 
9234
+#define SW_VBA_REVISION_HXX
 
9235
+
 
9236
+#include <ooo/vba/word/XRevision.hpp>
 
9237
+#include <vbahelper/vbahelperinterface.hxx>
 
9238
+#include <cppuhelper/implbase1.hxx>
 
9239
+
 
9240
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRevision > SwVbaRevision_BASE;
 
9241
+
 
9242
+class SwVbaRevision : public SwVbaRevision_BASE
 
9243
+{
 
9244
+private:
 
9245
+    css::uno::Reference< css::frame::XModel > mxModel;
 
9246
+    css::uno::Reference< css::beans::XPropertySet > mxRedlineProps;
 
9247
+
 
9248
+private:
 
9249
+    sal_Int32 GetPosition() throw (css::uno::RuntimeException);
 
9250
+
 
9251
+public:
 
9252
+    SwVbaRevision( 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 >& xRedlineProps ) throw ( css::uno::RuntimeException );
 
9253
+    virtual ~SwVbaRevision();
 
9254
+
 
9255
+    // Methods
 
9256
+    virtual void SAL_CALL Accept(  ) throw (css::uno::RuntimeException);
 
9257
+    virtual void SAL_CALL Reject(  ) throw (css::uno::RuntimeException);
 
9258
+
 
9259
+    // XHelperInterface
 
9260
+    virtual rtl::OUString& getServiceImplName();
 
9261
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
9262
+};
 
9263
+#endif /* SW_VBA_REVISION_HXX */
 
9264
diff --git sw/source/ui/vba/vbarevisions.cxx sw/source/ui/vba/vbarevisions.cxx
 
9265
new file mode 100644
 
9266
index 0000000..9d3e921
 
9267
--- /dev/null
 
9268
+++ sw/source/ui/vba/vbarevisions.cxx
 
9269
@@ -0,0 +1,189 @@
 
9270
+/*************************************************************************
 
9271
+ *
 
9272
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
9273
+ * 
 
9274
+ * Copyright 2008 by Sun Microsystems, Inc.
 
9275
+ *
 
9276
+ * OpenOffice.org - a multi-platform office productivity suite
 
9277
+ *
 
9278
+ * $RCSfile: 
 
9279
+ * $Revision: 
 
9280
+ *
 
9281
+ * This file is part of OpenOffice.org.
 
9282
+ *
 
9283
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
9284
+ * it under the terms of the GNU Lesser General Public License version 3
 
9285
+ * only, as published by the Free Software Foundation.
 
9286
+ *
 
9287
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
9288
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9289
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
9290
+ * GNU Lesser General Public License version 3 for more details
 
9291
+ * (a copy is included in the LICENSE file that accompanied this code).
 
9292
+ *
 
9293
+ * You should have received a copy of the GNU Lesser General Public License
 
9294
+ * version 3 along with OpenOffice.org.  If not, see
 
9295
+ * <http://www.openoffice.org/license.html>
 
9296
+ * for a copy of the LGPLv3 License.
 
9297
+ *
 
9298
+ ************************************************************************/
 
9299
+#include "vbarevisions.hxx"
 
9300
+#include "vbarevision.hxx"
 
9301
+#include <cppuhelper/implbase2.hxx>
 
9302
+#include <com/sun/star/document/XRedlinesSupplier.hpp>
 
9303
+#include <com/sun/star/text/XTextRangeCompare.hpp>
 
9304
+
 
9305
+using namespace ::ooo::vba;
 
9306
+using namespace ::com::sun::star;
 
9307
+
 
9308
+typedef ::cppu::WeakImplHelper1< container::XEnumeration > RevisionEnumeration_BASE;
 
9309
+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > RevisionCollectionHelper_BASE;
 
9310
+typedef std::vector< uno::Reference< beans::XPropertySet > > RevisionMap;
 
9311
+
 
9312
+class RedlinesEnumeration : public RevisionEnumeration_BASE
 
9313
+{
 
9314
+    RevisionMap mRevisionMap;
 
9315
+    RevisionMap::iterator mIt;
 
9316
+public:
 
9317
+    RedlinesEnumeration( const RevisionMap& sMap ) : mRevisionMap( sMap ), mIt( mRevisionMap.begin() ) {}
 
9318
+    virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException)
 
9319
+    {
 
9320
+        return ( mIt != mRevisionMap.end() );
 
9321
+    }
 
9322
+    virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
 
9323
+    {
 
9324
+        if ( !hasMoreElements() )
 
9325
+            throw container::NoSuchElementException();
 
9326
+        uno::Reference< beans::XPropertySet > xRevision( *mIt++ );
 
9327
+        return uno::makeAny( xRevision ) ;
 
9328
+    }
 
9329
+};
 
9330
+
 
9331
+class RevisionCollectionHelper : public RevisionCollectionHelper_BASE
 
9332
+{
 
9333
+    RevisionMap mRevisionMap;
 
9334
+public:
 
9335
+RevisionCollectionHelper( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ) throw (uno::RuntimeException);
 
9336
+    
 
9337
+    // XElementAccess
 
9338
+    virtual uno::Type SAL_CALL getElementType(  ) throw (uno::RuntimeException) { return  beans::XPropertySet::static_type(0); }
 
9339
+    virtual ::sal_Bool SAL_CALL hasElements(  ) throw (uno::RuntimeException) { return ( mRevisionMap.size() > 0 ); }
 
9340
+    // XIndexAccess
 
9341
+    virtual ::sal_Int32 SAL_CALL getCount(  ) throw (uno::RuntimeException) { return mRevisionMap.size(); }    
 
9342
+    virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
 
9343
+    {
 
9344
+        if ( Index < 0 || Index >= getCount() )
 
9345
+            throw lang::IndexOutOfBoundsException();
 
9346
+    
 
9347
+        return uno::makeAny( mRevisionMap[ Index ] );
 
9348
+
 
9349
+    }
 
9350
+    // XEnumerationAccess
 
9351
+    virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration(  ) throw (uno::RuntimeException)
 
9352
+    {
 
9353
+        return new RedlinesEnumeration( mRevisionMap );
 
9354
+    }
 
9355
+};
 
9356
+
 
9357
+RevisionCollectionHelper::RevisionCollectionHelper( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ) throw (uno::RuntimeException)
 
9358
+    {
 
9359
+        uno::Reference< text::XTextRangeCompare > xTRC( xTextRange->getText(), uno::UNO_QUERY_THROW );
 
9360
+        uno::Reference< document::XRedlinesSupplier > xRedlinesSupp( xModel, uno::UNO_QUERY_THROW );
 
9361
+        uno::Reference< container::XIndexAccess > xRedlines( xRedlinesSupp->getRedlines(), uno::UNO_QUERY_THROW );
 
9362
+        sal_Int32 nCount = xRedlines->getCount();
 
9363
+        for( sal_Int32 index = 0; index < nCount; index++ )
 
9364
+        {
 
9365
+            uno::Reference< text::XTextRange > xRedlineRange( xRedlines->getByIndex( index ), uno::UNO_QUERY_THROW );
 
9366
+            if( xTRC->compareRegionStarts( xTextRange, xRedlineRange ) >= 0 && xTRC->compareRegionEnds( xTextRange, xRedlineRange ) <= 0 )
 
9367
+            {
 
9368
+                uno::Reference< beans::XPropertySet > xRedlineProps( xRedlineRange, uno::UNO_QUERY_THROW );
 
9369
+                mRevisionMap.push_back( xRedlineProps );
 
9370
+            }
 
9371
+        }
 
9372
+    }
 
9373
+class RevisionsEnumeration : public EnumerationHelperImpl
 
9374
+{
 
9375
+    uno::Reference< frame::XModel > m_xModel;
 
9376
+    uno::WeakReference< XHelperInterface > m_xParent;
 
9377
+public:
 
9378
+    RevisionsEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration,  const uno::Reference< frame::XModel >& xModel  ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), m_xModel( xModel ), m_xParent( xParent ){}
 
9379
+
 
9380
+    virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) 
 
9381
+    { 
 
9382
+        uno::Reference< beans::XPropertySet > xRevision( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
 
9383
+        return uno::makeAny( uno::Reference< word::XRevision > ( new SwVbaRevision( m_xParent, m_xContext, m_xModel, xRevision ) ) );
 
9384
+    }
 
9385
+
 
9386
+};
 
9387
+
 
9388
+SwVbaRevisions::SwVbaRevisions( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ): SwVbaRevisions_BASE( xParent, xContext, new RevisionCollectionHelper( xModel, xTextRange ) ),  mxModel( xModel )
 
9389
+{
 
9390
+}
 
9391
+
 
9392
+SwVbaRevisions::SwVbaRevisions( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< container::XIndexAccess >& xIndexAccess ): SwVbaRevisions_BASE( xParent, xContext, xIndexAccess ),  mxModel( xModel )
 
9393
+{
 
9394
+}
 
9395
+
 
9396
+// XEnumerationAccess
 
9397
+uno::Type
 
9398
+SwVbaRevisions::getElementType() throw (uno::RuntimeException)
 
9399
+{
 
9400
+    return word::XRevision::static_type(0);
 
9401
+}
 
9402
+uno::Reference< container::XEnumeration >
 
9403
+SwVbaRevisions::createEnumeration() throw (uno::RuntimeException)
 
9404
+{
 
9405
+    uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
 
9406
+    return new RevisionsEnumeration( this, mxContext, xEnumAccess->createEnumeration(), mxModel );
 
9407
+}
 
9408
+
 
9409
+uno::Any
 
9410
+SwVbaRevisions::createCollectionObject( const css::uno::Any& aSource )
 
9411
+{
 
9412
+    uno::Reference< beans::XPropertySet > xRevision( aSource, uno::UNO_QUERY_THROW );
 
9413
+    return uno::makeAny( uno::Reference< word::XRevision > ( new SwVbaRevision( this, mxContext, mxModel, xRevision ) ) );
 
9414
+}
 
9415
+
 
9416
+void SAL_CALL SwVbaRevisions::AcceptAll(  ) throw (css::uno::RuntimeException)
 
9417
+{
 
9418
+    // First we need to put all the redline into a vector, because if the redline is accepted,
 
9419
+    // it will auto delete in the document.
 
9420
+    std::vector< uno::Reference< word::XRevision > > aRevisions;
 
9421
+    uno::Reference< container::XEnumeration > xEnumeration = createEnumeration();
 
9422
+    while( xEnumeration->hasMoreElements() )
 
9423
+    {
 
9424
+        uno::Reference< word::XRevision > xRevision( xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
 
9425
+        aRevisions.push_back( xRevision );
 
9426
+    }
 
9427
+
 
9428
+    std::vector< uno::Reference< word::XRevision > >::iterator it = aRevisions.begin();
 
9429
+    for( ; it != aRevisions.end(); it++ )
 
9430
+    {
 
9431
+        uno::Reference< word::XRevision > xRevision( *it );
 
9432
+        xRevision->Accept();
 
9433
+    }
 
9434
+}
 
9435
+
 
9436
+void SAL_CALL SwVbaRevisions::RejectAll(  ) throw (css::uno::RuntimeException)
 
9437
+{
 
9438
+    throw uno::RuntimeException();
 
9439
+}
 
9440
+
 
9441
+rtl::OUString& 
 
9442
+SwVbaRevisions::getServiceImplName()
 
9443
+{
 
9444
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRevisions") );
 
9445
+    return sImplName;
 
9446
+}
 
9447
+
 
9448
+css::uno::Sequence<rtl::OUString> 
 
9449
+SwVbaRevisions::getServiceNames()
 
9450
+{
 
9451
+    static uno::Sequence< rtl::OUString > sNames;
 
9452
+    if ( sNames.getLength() == 0 )
 
9453
+    {
 
9454
+        sNames.realloc( 1 );
 
9455
+        sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Revisions") );
 
9456
+    }
 
9457
+    return sNames;
 
9458
+}
 
9459
diff --git sw/source/ui/vba/vbarevisions.hxx sw/source/ui/vba/vbarevisions.hxx
 
9460
new file mode 100644
 
9461
index 0000000..88db794
 
9462
--- /dev/null
 
9463
+++ sw/source/ui/vba/vbarevisions.hxx
 
9464
@@ -0,0 +1,66 @@
 
9465
+/*************************************************************************
 
9466
+ *
 
9467
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
9468
+ * 
 
9469
+ * Copyright 2008 by Sun Microsystems, Inc.
 
9470
+ *
 
9471
+ * OpenOffice.org - a multi-platform office productivity suite
 
9472
+ *
 
9473
+ * $RCSfile: 
 
9474
+ * $Revision: 
 
9475
+ *
 
9476
+ * This file is part of OpenOffice.org.
 
9477
+ *
 
9478
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
9479
+ * it under the terms of the GNU Lesser General Public License version 3
 
9480
+ * only, as published by the Free Software Foundation.
 
9481
+ *
 
9482
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
9483
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9484
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
9485
+ * GNU Lesser General Public License version 3 for more details
 
9486
+ * (a copy is included in the LICENSE file that accompanied this code).
 
9487
+ *
 
9488
+ * You should have received a copy of the GNU Lesser General Public License
 
9489
+ * version 3 along with OpenOffice.org.  If not, see
 
9490
+ * <http://www.openoffice.org/license.html>
 
9491
+ * for a copy of the LGPLv3 License.
 
9492
+ *
 
9493
+ ************************************************************************/
 
9494
+#ifndef SW_VBA_PANES_HXX
 
9495
+#define SW_VBA_PANES_HXX
 
9496
+
 
9497
+#include <vbahelper/vbacollectionimpl.hxx>
 
9498
+#include <ooo/vba/word/XRevisions.hpp>
 
9499
+#include <vbahelper/vbahelperinterface.hxx>
 
9500
+#include <com/sun/star/text/XTextRange.hpp>
 
9501
+
 
9502
+
 
9503
+typedef CollTestImplHelper< ooo::vba::word::XRevisions > SwVbaRevisions_BASE;
 
9504
+
 
9505
+class SwVbaRevisions : public SwVbaRevisions_BASE
 
9506
+{
 
9507
+private:
 
9508
+    css::uno::Reference< css::frame::XModel > mxModel;
 
9509
+
 
9510
+public:
 
9511
+    SwVbaRevisions( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextRange >& xTextRange );
 
9512
+
 
9513
+    SwVbaRevisions( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess );
 
9514
+    virtual ~SwVbaRevisions() {}
 
9515
+
 
9516
+    // Methods
 
9517
+    virtual void SAL_CALL AcceptAll(  ) throw (css::uno::RuntimeException);
 
9518
+    virtual void SAL_CALL RejectAll(  ) throw (css::uno::RuntimeException);
 
9519
+
 
9520
+    // XEnumerationAccess
 
9521
+    virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
 
9522
+    virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
 
9523
+
 
9524
+    // SwVbaRevisions_BASE
 
9525
+    virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); 
 
9526
+    virtual rtl::OUString& getServiceImplName();
 
9527
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
9528
+};    
 
9529
+
 
9530
+#endif /* SW_VBA_PANES_HXX */
 
9531
diff --git sw/source/ui/vba/vbarow.cxx sw/source/ui/vba/vbarow.cxx
 
9532
new file mode 100644
 
9533
index 0000000..2f4132b
 
9534
--- /dev/null
 
9535
+++ sw/source/ui/vba/vbarow.cxx
 
9536
@@ -0,0 +1,136 @@
 
9537
+/*************************************************************************
 
9538
+ *
 
9539
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
9540
+ * 
 
9541
+ * Copyright 2008 by Sun Microsystems, Inc.
 
9542
+ *
 
9543
+ * OpenOffice.org - a multi-platform office productivity suite
 
9544
+ *
 
9545
+ * $RCSfile: 
 
9546
+ * $Revision: 
 
9547
+ *
 
9548
+ * This file is part of OpenOffice.org.
 
9549
+ *
 
9550
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
9551
+ * it under the terms of the GNU Lesser General Public License version 3
 
9552
+ * only, as published by the Free Software Foundation.
 
9553
+ *
 
9554
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
9555
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9556
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
9557
+ * GNU Lesser General Public License version 3 for more details
 
9558
+ * (a copy is included in the LICENSE file that accompanied this code).
 
9559
+ *
 
9560
+ * You should have received a copy of the GNU Lesser General Public License
 
9561
+ * version 3 along with OpenOffice.org.  If not, see
 
9562
+ * <http://www.openoffice.org/license.html>
 
9563
+ * for a copy of the LGPLv3 License.
 
9564
+ *
 
9565
+ ************************************************************************/
 
9566
+#include "vbarow.hxx"
 
9567
+#include <vbahelper/vbahelper.hxx>
 
9568
+#include <tools/diagnose_ex.h>
 
9569
+#include <com/sun/star/table/XCellRange.hpp>
 
9570
+#include <com/sun/star/view/XSelectionSupplier.hpp>
 
9571
+#include <ooo/vba/word/WdRowHeightRule.hpp>
 
9572
+#include <ooo/vba/word/WdConstants.hpp>
 
9573
+#include <rtl/ustrbuf.hxx>
 
9574
+#include "wordvbahelper.hxx"
 
9575
+#include "vbatablehelper.hxx"
 
9576
+
 
9577
+using namespace ::ooo::vba;
 
9578
+using namespace ::com::sun::star;
 
9579
+
 
9580
+SwVbaRow::SwVbaRow( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nIndex ) throw ( uno::RuntimeException ) :
 
9581
+    SwVbaRow_BASE( rParent, rContext ), mxTextTable( xTextTable ), mnIndex( nIndex )
 
9582
+{
 
9583
+    mxTableRows = mxTextTable->getRows();
 
9584
+    mxRowProps.set( mxTableRows->getByIndex( mnIndex ), uno::UNO_QUERY_THROW );
 
9585
+}
 
9586
+
 
9587
+SwVbaRow::~SwVbaRow()
 
9588
+{
 
9589
+}
 
9590
+
 
9591
+uno::Any SAL_CALL SwVbaRow::getHeight() throw (css::uno::RuntimeException)
 
9592
+{
 
9593
+    if( getHeightRule() == word::WdRowHeightRule::wdRowHeightAuto )
 
9594
+        return uno::makeAny( sal_Int32( word::WdConstants::wdUndefined ) );
 
9595
+
 
9596
+    sal_Int32 nHeight = 0;
 
9597
+    mxRowProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ) ) >>= nHeight;
 
9598
+    return uno::makeAny( (float)Millimeter::getInPoints( nHeight ) );
 
9599
+}
 
9600
+
 
9601
+void SAL_CALL SwVbaRow::setHeight( const uno::Any& _height ) throw (css::uno::RuntimeException)
 
9602
+{
 
9603
+    float height = 0;
 
9604
+    _height >>= height;
 
9605
+
 
9606
+    sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( height );
 
9607
+    mxRowProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ), uno::makeAny( nHeight ) );
 
9608
+}
 
9609
+
 
9610
+::sal_Int32 SAL_CALL SwVbaRow::getHeightRule() throw (css::uno::RuntimeException)
 
9611
+{
 
9612
+    sal_Bool isAutoHeight = sal_False;
 
9613
+    mxRowProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoHeight") ) ) >>= isAutoHeight;
 
9614
+    return isAutoHeight ? word::WdRowHeightRule::wdRowHeightAuto : word::WdRowHeightRule::wdRowHeightExactly;
 
9615
+}
 
9616
+
 
9617
+void SAL_CALL SwVbaRow::setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException)
 
9618
+{
 
9619
+    sal_Bool isAutoHeight = ( _heightrule == word::WdRowHeightRule::wdRowHeightAuto );
 
9620
+    mxRowProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoHeight") ), uno::makeAny( isAutoHeight ) );
 
9621
+}
 
9622
+
 
9623
+void SAL_CALL
 
9624
+SwVbaRow::Select( ) throw ( uno::RuntimeException )
 
9625
+{
 
9626
+    SelectRow( getCurrentWordDoc(mxContext), mxTextTable, mnIndex, mnIndex );
 
9627
+}
 
9628
+
 
9629
+void SwVbaRow::SelectRow( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nStartRow, sal_Int32 nEndRow ) throw ( uno::RuntimeException )
 
9630
+{
 
9631
+    rtl::OUStringBuffer aRangeName;
 
9632
+    aRangeName.appendAscii("A").append(sal_Int32( nStartRow + 1 ) );
 
9633
+    SwVbaTableHelper aTableHelper( xTextTable );
 
9634
+    sal_Int32 nColCount = aTableHelper.getTabColumnsCount( nEndRow );
 
9635
+    // FIXME: the column count > 26
 
9636
+    //sal_Char cCol = 'A' + nColCount - 1;
 
9637
+    rtl::OUString sCol = aTableHelper.getColumnStr( nColCount - 1);
 
9638
+    aRangeName.appendAscii(":").append( sCol ).append( sal_Int32( nEndRow + 1 ) );
 
9639
+
 
9640
+    uno::Reference< table::XCellRange > xCellRange( xTextTable, uno::UNO_QUERY_THROW );
 
9641
+    rtl::OUString sSelRange = aRangeName.makeStringAndClear();
 
9642
+    uno::Reference< table::XCellRange > xSelRange = xCellRange->getCellRangeByName( sSelRange );
 
9643
+
 
9644
+    uno::Reference< view::XSelectionSupplier > xSelection( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
 
9645
+    xSelection->select( uno::makeAny( xSelRange ) );
 
9646
+}
 
9647
+
 
9648
+void SAL_CALL SwVbaRow::SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException)
 
9649
+{
 
9650
+    setHeightRule( heightrule );
 
9651
+    setHeight( uno::makeAny( height ) );
 
9652
+}
 
9653
+
 
9654
+rtl::OUString& 
 
9655
+SwVbaRow::getServiceImplName()
 
9656
+{
 
9657
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRow") );
 
9658
+    return sImplName;
 
9659
+}
 
9660
+
 
9661
+uno::Sequence< rtl::OUString > 
 
9662
+SwVbaRow::getServiceNames()
 
9663
+{
 
9664
+    static uno::Sequence< rtl::OUString > aServiceNames;
 
9665
+    if ( aServiceNames.getLength() == 0 )
 
9666
+    {
 
9667
+        aServiceNames.realloc( 1 );
 
9668
+        aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Row" ) );
 
9669
+    }
 
9670
+    return aServiceNames;
 
9671
+}
 
9672
+
 
9673
diff --git sw/source/ui/vba/vbarow.hxx sw/source/ui/vba/vbarow.hxx
 
9674
new file mode 100644
 
9675
index 0000000..cfbfb4d
 
9676
--- /dev/null
 
9677
+++ sw/source/ui/vba/vbarow.hxx
 
9678
@@ -0,0 +1,69 @@
 
9679
+/*************************************************************************
 
9680
+ *
 
9681
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
9682
+ * 
 
9683
+ * Copyright 2008 by Sun Microsystems, Inc.
 
9684
+ *
 
9685
+ * OpenOffice.org - a multi-platform office productivity suite
 
9686
+ *
 
9687
+ * $RCSfile: 
 
9688
+ * $Revision: 
 
9689
+ *
 
9690
+ * This file is part of OpenOffice.org.
 
9691
+ *
 
9692
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
9693
+ * it under the terms of the GNU Lesser General Public License version 3
 
9694
+ * only, as published by the Free Software Foundation.
 
9695
+ *
 
9696
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
9697
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9698
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
9699
+ * GNU Lesser General Public License version 3 for more details
 
9700
+ * (a copy is included in the LICENSE file that accompanied this code).
 
9701
+ *
 
9702
+ * You should have received a copy of the GNU Lesser General Public License
 
9703
+ * version 3 along with OpenOffice.org.  If not, see
 
9704
+ * <http://www.openoffice.org/license.html>
 
9705
+ * for a copy of the LGPLv3 License.
 
9706
+ *
 
9707
+ ************************************************************************/
 
9708
+#ifndef SW_VBA_ROW_HXX
 
9709
+#define SW_VBA_ROW_HXX
 
9710
+
 
9711
+#include <ooo/vba/word/XRow.hpp>
 
9712
+#include <vbahelper/vbahelperinterface.hxx>
 
9713
+#include <cppuhelper/implbase1.hxx>
 
9714
+#include <com/sun/star/table/XTableRows.hpp>
 
9715
+#include <com/sun/star/text/XTextTable.hpp>
 
9716
+
 
9717
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRow > SwVbaRow_BASE;
 
9718
+
 
9719
+class SwVbaRow : public SwVbaRow_BASE
 
9720
+{
 
9721
+private:
 
9722
+    css::uno::Reference< css::text::XTextTable > mxTextTable;
 
9723
+    css::uno::Reference< css::table::XTableRows > mxTableRows;
 
9724
+    css::uno::Reference< css::beans::XPropertySet > mxRowProps;
 
9725
+    sal_Int32 mnIndex;
 
9726
+
 
9727
+public:
 
9728
+    SwVbaRow( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nIndex ) throw ( css::uno::RuntimeException );
 
9729
+    virtual ~SwVbaRow();
 
9730
+
 
9731
+    // Attributes
 
9732
+    virtual css::uno::Any SAL_CALL getHeight() throw (css::uno::RuntimeException);
 
9733
+    virtual void SAL_CALL setHeight( const css::uno::Any& _height ) throw (css::uno::RuntimeException);
 
9734
+    virtual ::sal_Int32 SAL_CALL getHeightRule() throw (css::uno::RuntimeException);
 
9735
+    virtual void SAL_CALL setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException);
 
9736
+
 
9737
+    // Methods
 
9738
+    virtual void SAL_CALL Select(  ) throw (css::uno::RuntimeException);
 
9739
+    virtual void SAL_CALL SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException);
 
9740
+
 
9741
+    static void SelectRow( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nStartRow, sal_Int32 nEndRow ) throw (css::uno::RuntimeException);
 
9742
+
 
9743
+    // XHelperInterface
 
9744
+    virtual rtl::OUString& getServiceImplName();
 
9745
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
9746
+};
 
9747
+#endif /* SW_VBA_ROW_HXX */
 
9748
diff --git sw/source/ui/vba/vbarows.cxx sw/source/ui/vba/vbarows.cxx
 
9749
new file mode 100644
 
9750
index 0000000..875e024
 
9751
--- /dev/null
 
9752
+++ sw/source/ui/vba/vbarows.cxx
 
9753
@@ -0,0 +1,368 @@
 
9754
+/*************************************************************************
 
9755
+ *
 
9756
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
9757
+ * 
 
9758
+ * Copyright 2008 by Sun Microsystems, Inc.
 
9759
+ *
 
9760
+ * OpenOffice.org - a multi-platform office productivity suite
 
9761
+ *
 
9762
+ * $RCSfile: 
 
9763
+ * $Revision: 
 
9764
+ *
 
9765
+ * This file is part of OpenOffice.org.
 
9766
+ *
 
9767
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
9768
+ * it under the terms of the GNU Lesser General Public License version 3
 
9769
+ * only, as published by the Free Software Foundation.
 
9770
+ *
 
9771
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
9772
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9773
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
9774
+ * GNU Lesser General Public License version 3 for more details
 
9775
+ * (a copy is included in the LICENSE file that accompanied this code).
 
9776
+ *
 
9777
+ * You should have received a copy of the GNU Lesser General Public License
 
9778
+ * version 3 along with OpenOffice.org.  If not, see
 
9779
+ * <http://www.openoffice.org/license.html>
 
9780
+ * for a copy of the LGPLv3 License.
 
9781
+ *
 
9782
+ ************************************************************************/
 
9783
+#include "vbarows.hxx"
 
9784
+#include "vbarow.hxx"
 
9785
+#include <com/sun/star/text/HoriOrientation.hpp>
 
9786
+#include <com/sun/star/table/XCellRange.hpp>
 
9787
+#include <ooo/vba/word/WdRowAlignment.hpp>
 
9788
+#include <ooo/vba/word/WdConstants.hpp>
 
9789
+#include <ooo/vba/word/WdRulerStyle.hpp>
 
9790
+#include "wordvbahelper.hxx"
 
9791
+#include "vbacolumns.hxx"
 
9792
+#include "vbatablehelper.hxx"
 
9793
+
 
9794
+using namespace ::ooo::vba;
 
9795
+using namespace ::com::sun::star;
 
9796
+
 
9797
+class RowsEnumWrapper : public EnumerationHelper_BASE
 
9798
+{
 
9799
+    uno::Reference< text::XTextTable > mxTextTable;
 
9800
+    uno::Reference< container::XIndexAccess > mxIndexAccess;
 
9801
+    uno::WeakReference< XHelperInterface > mxParent;
 
9802
+    uno::Reference< uno::XComponentContext > mxContext;
 
9803
+    sal_Int32 nIndex;
 
9804
+
 
9805
+public:
 
9806
+    RowsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< text::XTextTable >& xTextTable ) : mxParent( xParent ), mxContext( xContext ), mxTextTable( xTextTable ), nIndex( 0 ) 
 
9807
+    {
 
9808
+        mxIndexAccess.set( mxTextTable->getRows(), uno::UNO_QUERY );
 
9809
+    }
 
9810
+    virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException)
 
9811
+    {
 
9812
+        return ( nIndex < mxIndexAccess->getCount() );
 
9813
+    }
 
9814
+
 
9815
+    virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
 
9816
+    {
 
9817
+        if( nIndex < mxIndexAccess->getCount() )
 
9818
+        {
 
9819
+            return uno::makeAny( uno::Reference< word::XRow > ( new SwVbaRow( mxParent, mxContext, mxTextTable, nIndex++ ) ) );
 
9820
+        }
 
9821
+        throw container::NoSuchElementException();
 
9822
+    }
 
9823
+};
 
9824
+
 
9825
+SwVbaRows::SwVbaRows( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, const uno::Reference< table::XTableRows >& xTableRows ) throw (uno::RuntimeException) : SwVbaRows_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xTableRows, uno::UNO_QUERY_THROW ) ), mxTextTable( xTextTable ), mxTableRows( xTableRows ) 
 
9826
+{
 
9827
+    mnStartRowIndex = 0;
 
9828
+    mnEndRowIndex = m_xIndexAccess->getCount() - 1;
 
9829
+}
 
9830
+
 
9831
+SwVbaRows::SwVbaRows( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, const uno::Reference< table::XTableRows >& xTableRows, sal_Int32 nStarIndex, sal_Int32 nEndIndex ) throw (uno::RuntimeException) : SwVbaRows_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xTableRows, uno::UNO_QUERY_THROW ) ), mxTextTable( xTextTable ), mxTableRows( xTableRows ), mnStartRowIndex( nStarIndex ), mnEndRowIndex( nEndIndex ) 
 
9832
+{
 
9833
+    if( mnEndRowIndex < mnStartRowIndex )
 
9834
+        throw uno::RuntimeException();
 
9835
+}
 
9836
+
 
9837
+/**
 
9838
+ * get the alignment of the rows: SO format com.sun.star.text.HoriOrientation
 
9839
+ * is mapped to WdRowAlignment in Word
 
9840
+ * @return the alignment
 
9841
+ */
 
9842
+::sal_Int32 SAL_CALL SwVbaRows::getAlignment() throw (uno::RuntimeException)
 
9843
+{
 
9844
+    sal_Int16 nAlignment = text::HoriOrientation::LEFT;
 
9845
+    uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
 
9846
+    xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrient") ) ) >>= nAlignment;
 
9847
+    sal_Int32 nRet = 0;
 
9848
+    switch( nAlignment )
 
9849
+    {
 
9850
+        case text::HoriOrientation::CENTER:
 
9851
+        {
 
9852
+           nRet = word::WdRowAlignment::wdAlignRowCenter;
 
9853
+           break;
 
9854
+        }
 
9855
+        case text::HoriOrientation::RIGHT:
 
9856
+        {
 
9857
+            nRet = word::WdRowAlignment::wdAlignRowRight;
 
9858
+            break;
 
9859
+        }
 
9860
+        default:
 
9861
+        {
 
9862
+            nRet = word::WdRowAlignment::wdAlignRowLeft;
 
9863
+        }
 
9864
+    }
 
9865
+    return nRet;
 
9866
+}
 
9867
+
 
9868
+void SAL_CALL SwVbaRows::setAlignment( ::sal_Int32 _alignment ) throw (uno::RuntimeException)
 
9869
+{
 
9870
+    sal_Int16 nAlignment = text::HoriOrientation::LEFT;
 
9871
+    switch( _alignment )
 
9872
+    {
 
9873
+        case word::WdRowAlignment::wdAlignRowCenter:
 
9874
+        {
 
9875
+            nAlignment = text::HoriOrientation::CENTER;
 
9876
+            break;
 
9877
+        }
 
9878
+        case word::WdRowAlignment::wdAlignRowRight:
 
9879
+        {
 
9880
+            nAlignment = text::HoriOrientation::RIGHT;
 
9881
+            break;
 
9882
+        }
 
9883
+        default:
 
9884
+        {
 
9885
+            nAlignment = text::HoriOrientation::LEFT;
 
9886
+        }
 
9887
+    }
 
9888
+    uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
 
9889
+    xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrient") ), uno::makeAny( nAlignment ) );
 
9890
+}
 
9891
+
 
9892
+uno::Any SAL_CALL SwVbaRows::getAllowBreakAcrossPages() throw (uno::RuntimeException)
 
9893
+{
 
9894
+    sal_Bool bAllowBreak = sal_False;
 
9895
+    uno::Reference< container::XIndexAccess > xRowsAccess( mxTableRows, uno::UNO_QUERY_THROW );
 
9896
+    for( sal_Int32 index = mnStartRowIndex; index <= mnEndRowIndex; ++index )
 
9897
+    {
 
9898
+        uno::Reference< beans::XPropertySet > xRowProps( xRowsAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
 
9899
+        sal_Bool bSplit = sal_False;
 
9900
+        xRowProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsSplitAllowed") ) ) >>= bSplit;
 
9901
+        if( index == 0 )
 
9902
+        {
 
9903
+            bAllowBreak = bSplit;
 
9904
+        }
 
9905
+        if( bSplit != bAllowBreak )
 
9906
+        {
 
9907
+            sal_Int32 nRet = word::WdConstants::wdUndefined;
 
9908
+            return uno::makeAny( nRet );
 
9909
+        }
 
9910
+    }
 
9911
+    return uno::makeAny( bAllowBreak );
 
9912
+}
 
9913
+
 
9914
+void SAL_CALL SwVbaRows::setAllowBreakAcrossPages( const uno::Any& _allowbreakacrosspages ) throw (uno::RuntimeException)
 
9915
+{
 
9916
+    sal_Bool bAllowBreak = sal_False;
 
9917
+    _allowbreakacrosspages >>= bAllowBreak;
 
9918
+    uno::Reference< container::XIndexAccess > xRowsAccess( mxTableRows, uno::UNO_QUERY_THROW );
 
9919
+    for( sal_Int32 index = mnStartRowIndex; index <= mnEndRowIndex; ++index )
 
9920
+    {
 
9921
+        uno::Reference< beans::XPropertySet > xRowProps( xRowsAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
 
9922
+        xRowProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsSplitAllowed") ), uno::makeAny( bAllowBreak ) );
 
9923
+    }    
 
9924
+}
 
9925
+
 
9926
+float SAL_CALL SwVbaRows::getSpaceBetweenColumns() throw (uno::RuntimeException)
 
9927
+{
 
9928
+    // just get the first spacing of the first cell
 
9929
+    uno::Reference< table::XCellRange > xCellRange( mxTextTable, uno::UNO_QUERY_THROW );
 
9930
+    uno::Reference< beans::XPropertySet > xCellProps( xCellRange->getCellByPosition( 0, mnStartRowIndex ), uno::UNO_QUERY_THROW );
 
9931
+    sal_Int32 nLeftBorderDistance = 0;
 
9932
+    sal_Int32 nRightBorderDistance = 0;
 
9933
+    xCellProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftBorderDistance") ) ) >>= nLeftBorderDistance;
 
9934
+    xCellProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightBorderDistance") ) ) >>= nRightBorderDistance;
 
9935
+    return static_cast< float >( Millimeter::getInPoints( nLeftBorderDistance + nRightBorderDistance ) );
 
9936
+}
 
9937
+
 
9938
+void SAL_CALL SwVbaRows::setSpaceBetweenColumns( float _spacebetweencolumns ) throw (uno::RuntimeException)
 
9939
+{
 
9940
+    sal_Int32 nSpace = Millimeter::getInHundredthsOfOneMillimeter( _spacebetweencolumns ) / 2;
 
9941
+    uno::Reference< container::XIndexAccess > xColumnAccess( mxTextTable->getColumns(), uno::UNO_QUERY_THROW );
 
9942
+    uno::Reference< table::XCellRange > xCellRange( mxTextTable, uno::UNO_QUERY_THROW );
 
9943
+    SwVbaTableHelper aTableHelper( mxTextTable );
 
9944
+    for( sal_Int32 row = mnStartRowIndex; row <= mnEndRowIndex; ++row )
 
9945
+    {
 
9946
+        sal_Int32 nColumns = aTableHelper.getTabColumnsCount( row );
 
9947
+        for( sal_Int32 column = 0; column < nColumns; ++column )
 
9948
+        {
 
9949
+            uno::Reference< beans::XPropertySet > xCellProps( xCellRange->getCellByPosition( column, row ), uno::UNO_QUERY_THROW );
 
9950
+            xCellProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftBorderDistance") ), uno::makeAny( nSpace ) );
 
9951
+            xCellProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightBorderDistance") ), uno::makeAny( nSpace ) );
 
9952
+        }
 
9953
+    }
 
9954
+}
 
9955
+
 
9956
+void SAL_CALL SwVbaRows::Delete(  ) throw (uno::RuntimeException)
 
9957
+{
 
9958
+    mxTableRows->removeByIndex( mnStartRowIndex, getCount() );
 
9959
+}
 
9960
+
 
9961
+void SAL_CALL SwVbaRows::SetLeftIndent( float LeftIndent, ::sal_Int32 RulerStyle ) throw (uno::RuntimeException)
 
9962
+{
 
9963
+    uno::Reference< word::XColumns > xColumns( new SwVbaColumns( getParent(), mxContext, mxTextTable, mxTextTable->getColumns() ) );
 
9964
+    sal_Int32 nIndent = (sal_Int32)( LeftIndent );
 
9965
+    switch( RulerStyle )
 
9966
+    {
 
9967
+        case word::WdRulerStyle::wdAdjustFirstColumn:
 
9968
+        {
 
9969
+            setIndentWithAdjustFirstColumn( xColumns, nIndent );
 
9970
+            break;
 
9971
+        }
 
9972
+        case word::WdRulerStyle::wdAdjustNone:
 
9973
+        {
 
9974
+            setIndentWithAdjustNone( nIndent );
 
9975
+            break;
 
9976
+        }
 
9977
+        case word::WdRulerStyle::wdAdjustProportional:
 
9978
+        {
 
9979
+            setIndentWithAdjustProportional( xColumns, nIndent );
 
9980
+            break;
 
9981
+        }
 
9982
+        case word::WdRulerStyle::wdAdjustSameWidth:
 
9983
+        {
 
9984
+            setIndentWithAdjustSameWidth( xColumns, nIndent );
 
9985
+            break;
 
9986
+        }
 
9987
+        default:
 
9988
+        {
 
9989
+            DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
 
9990
+        }
 
9991
+    }
 
9992
+}
 
9993
+
 
9994
+void SwVbaRows::setIndentWithAdjustNone( sal_Int32 indent ) throw (uno::RuntimeException)
 
9995
+{
 
9996
+    uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
 
9997
+    sal_Int32 nMargin = 0;
 
9998
+    xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ) ) >>= nMargin;
 
9999
+    nMargin += indent;
 
10000
+    xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ), uno::makeAny( nMargin ) );
 
10001
+}
 
10002
+
 
10003
+ void SwVbaRows::setIndentWithAdjustFirstColumn( const uno::Reference< word::XColumns >& xColumns, sal_Int32 indent ) throw (uno::RuntimeException)
 
10004
+ {
 
10005
+    sal_Int32 nIndex = 1;
 
10006
+    uno::Reference< XCollection > xCol( xColumns, uno::UNO_QUERY_THROW );
 
10007
+    uno::Reference< word::XColumn > xColumn( xCol->Item( uno::makeAny( nIndex ), uno::Any() ), uno::UNO_QUERY_THROW );
 
10008
+    sal_Int32 nWidth = xColumn->getWidth();
 
10009
+    nWidth -= indent;
 
10010
+    xColumn->setWidth( nWidth );
 
10011
+    setIndentWithAdjustNone( indent );
 
10012
+ }
 
10013
+
 
10014
+ void SwVbaRows::setIndentWithAdjustProportional( const uno::Reference< word::XColumns >& xColumns, sal_Int32 indent ) throw (uno::RuntimeException)
 
10015
+ {
 
10016
+    // calculate the new width and get the proportion between old and new
 
10017
+    uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
 
10018
+    sal_Int32 nWidth = 0;
 
10019
+    xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) ) >>= nWidth;
 
10020
+    sal_Int32 nNewWidth = nWidth - indent;
 
10021
+    double propFactor = (double)nNewWidth/(double)nWidth;
 
10022
+
 
10023
+    // get all columns, calculate and set the new width of the columns
 
10024
+    uno::Reference< XCollection > xCol( xColumns, uno::UNO_QUERY_THROW );
 
10025
+    sal_Int32 nColCount = xCol->getCount();
 
10026
+    for( sal_Int32 i = 0; i < nColCount; i++ )
 
10027
+    {
 
10028
+        uno::Reference< word::XColumn > xColumn( xCol->Item( uno::makeAny( i ), uno::Any() ), uno::UNO_QUERY_THROW );
 
10029
+        sal_Int32 nColWidth = xColumn->getWidth();
 
10030
+        sal_Int32 nNewColWidth = ( sal_Int32 )( propFactor * nColWidth );
 
10031
+        xColumn->setWidth( nNewColWidth );
 
10032
+    }
 
10033
+
 
10034
+    // set the width and position of the table
 
10035
+    setIndentWithAdjustNone( indent );
 
10036
+    xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ), uno::makeAny( nNewWidth ) );
 
10037
+ }
 
10038
+
 
10039
+ void SwVbaRows::setIndentWithAdjustSameWidth( const uno::Reference< word::XColumns >& xColumns, sal_Int32 indent ) throw (uno::RuntimeException)
 
10040
+ {
 
10041
+    // calculate the new width and get the width of all columns
 
10042
+    uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
 
10043
+    sal_Int32 nWidth = 0;
 
10044
+    xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) ) >>= nWidth;
 
10045
+    sal_Int32 nNewWidth = nWidth - indent;
 
10046
+
 
10047
+    // get all columns, calculate and set the new width of the columns
 
10048
+    uno::Reference< XCollection > xCol( xColumns, uno::UNO_QUERY_THROW );
 
10049
+    sal_Int32 nColCount = xCol->getCount();
 
10050
+    sal_Int32 nNewColWidth = (sal_Int32)( double( nNewWidth )/nColCount );
 
10051
+    for( sal_Int32 i = 0; i < nColCount; i++ )
 
10052
+    {
 
10053
+        uno::Reference< word::XColumn > xColumn( xCol->Item( uno::makeAny( i ), uno::Any() ), uno::UNO_QUERY_THROW );
 
10054
+        xColumn->setWidth( nNewColWidth );
 
10055
+    }
 
10056
+
 
10057
+    // set the width and position of the table
 
10058
+    setIndentWithAdjustNone( indent );
 
10059
+    xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ), uno::makeAny( nNewWidth ) );
 
10060
+ }
 
10061
+
 
10062
+void SAL_CALL SwVbaRows::Select(  ) throw (uno::RuntimeException)
 
10063
+{
 
10064
+    SwVbaRow::SelectRow( getCurrentWordDoc(mxContext), mxTextTable, mnStartRowIndex, mnEndRowIndex ); 
 
10065
+}
 
10066
+
 
10067
+::sal_Int32 SAL_CALL SwVbaRows::getCount() throw (uno::RuntimeException)
 
10068
+{
 
10069
+    return ( mnEndRowIndex - mnStartRowIndex + 1 );
 
10070
+}
 
10071
+
 
10072
+uno::Any SAL_CALL SwVbaRows::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
 
10073
+{
 
10074
+    sal_Int32 nIndex = 0;
 
10075
+    if( ( Index1 >>= nIndex ) == sal_True )
 
10076
+    {
 
10077
+        if( nIndex <= 0 || nIndex > getCount() )
 
10078
+        {
 
10079
+            throw  lang::IndexOutOfBoundsException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
 
10080
+        }
 
10081
+        return uno::makeAny( uno::Reference< word::XRow >( new SwVbaRow( this, mxContext, mxTextTable, nIndex - 1 ) ) );
 
10082
+    }
 
10083
+    throw  uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
 
10084
+}
 
10085
+
 
10086
+// XEnumerationAccess
 
10087
+uno::Type
 
10088
+SwVbaRows::getElementType() throw (uno::RuntimeException)
 
10089
+{
 
10090
+    return word::XRow::static_type(0);
 
10091
+}
 
10092
+uno::Reference< container::XEnumeration >
 
10093
+SwVbaRows::createEnumeration() throw (uno::RuntimeException)
 
10094
+{
 
10095
+    return new RowsEnumWrapper( this, mxContext, mxTextTable );
 
10096
+}
 
10097
+
 
10098
+uno::Any
 
10099
+SwVbaRows::createCollectionObject( const uno::Any& aSource )
 
10100
+{
 
10101
+    return aSource;
 
10102
+}
 
10103
+
 
10104
+rtl::OUString& 
 
10105
+SwVbaRows::getServiceImplName()
 
10106
+{
 
10107
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRows") );
 
10108
+    return sImplName;
 
10109
+}
 
10110
+
 
10111
+uno::Sequence<rtl::OUString> 
 
10112
+SwVbaRows::getServiceNames()
 
10113
+{
 
10114
+    static uno::Sequence< rtl::OUString > sNames;
 
10115
+    if ( sNames.getLength() == 0 )
 
10116
+    {
 
10117
+        sNames.realloc( 1 );
 
10118
+        sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Rows") );
 
10119
+    }
 
10120
+    return sNames;
 
10121
+}
 
10122
diff --git sw/source/ui/vba/vbarows.hxx sw/source/ui/vba/vbarows.hxx
 
10123
new file mode 100644
 
10124
index 0000000..ccff1ef
 
10125
--- /dev/null
 
10126
+++ sw/source/ui/vba/vbarows.hxx
 
10127
@@ -0,0 +1,87 @@
 
10128
+/*************************************************************************
 
10129
+ *
 
10130
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
10131
+ * 
 
10132
+ * Copyright 2008 by Sun Microsystems, Inc.
 
10133
+ *
 
10134
+ * OpenOffice.org - a multi-platform office productivity suite
 
10135
+ *
 
10136
+ * $RCSfile: 
 
10137
+ * $Revision: 
 
10138
+ *
 
10139
+ * This file is part of OpenOffice.org.
 
10140
+ *
 
10141
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
10142
+ * it under the terms of the GNU Lesser General Public License version 3
 
10143
+ * only, as published by the Free Software Foundation.
 
10144
+ *
 
10145
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
10146
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10147
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10148
+ * GNU Lesser General Public License version 3 for more details
 
10149
+ * (a copy is included in the LICENSE file that accompanied this code).
 
10150
+ *
 
10151
+ * You should have received a copy of the GNU Lesser General Public License
 
10152
+ * version 3 along with OpenOffice.org.  If not, see
 
10153
+ * <http://www.openoffice.org/license.html>
 
10154
+ * for a copy of the LGPLv3 License.
 
10155
+ *
 
10156
+ ************************************************************************/
 
10157
+#ifndef SW_VBA_ROWS_HXX
 
10158
+#define SW_VBA_ROWS_HXX
 
10159
+
 
10160
+#include <vbahelper/vbacollectionimpl.hxx>
 
10161
+#include <ooo/vba/word/XRows.hpp>
 
10162
+#include <ooo/vba/word/XColumns.hpp>
 
10163
+#include <vbahelper/vbahelperinterface.hxx>
 
10164
+#include <com/sun/star/table/XTableRows.hpp>
 
10165
+#include <com/sun/star/text/XTextTable.hpp>
 
10166
+
 
10167
+typedef CollTestImplHelper< ooo::vba::word::XRows > SwVbaRows_BASE;
 
10168
+
 
10169
+class SwVbaRows : public SwVbaRows_BASE
 
10170
+{
 
10171
+private:
 
10172
+    css::uno::Reference< css::text::XTextTable > mxTextTable;
 
10173
+    css::uno::Reference< css::table::XTableRows > mxTableRows;
 
10174
+    sal_Int32 mnStartRowIndex;
 
10175
+    sal_Int32 mnEndRowIndex;
 
10176
+
 
10177
+private:
 
10178
+    void setIndentWithAdjustNone( sal_Int32 indent ) throw (css::uno::RuntimeException);
 
10179
+    void setIndentWithAdjustFirstColumn( const css::uno::Reference< ooo::vba::word::XColumns >& xColumns, sal_Int32 indent ) throw (css::uno::RuntimeException);
 
10180
+    void setIndentWithAdjustProportional( const css::uno::Reference< ooo::vba::word::XColumns >& xColumns, sal_Int32 indent ) throw (css::uno::RuntimeException);
 
10181
+    void setIndentWithAdjustSameWidth( const css::uno::Reference< ooo::vba::word::XColumns >& xColumns, sal_Int32 indent ) throw (css::uno::RuntimeException);
 
10182
+
 
10183
+public:
 
10184
+    SwVbaRows( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, const css::uno::Reference< css::table::XTableRows >& xTableRows ) throw ( css::uno::RuntimeException );
 
10185
+    SwVbaRows( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, const css::uno::Reference< css::table::XTableRows >& xTableRows, sal_Int32 nStarIndex, sal_Int32 nEndIndex ) throw ( css::uno::RuntimeException );
 
10186
+    virtual ~SwVbaRows() {}
 
10187
+
 
10188
+    // Attributes
 
10189
+    virtual ::sal_Int32 SAL_CALL getAlignment() throw (css::uno::RuntimeException);
 
10190
+    virtual void SAL_CALL setAlignment( ::sal_Int32 _alignment ) throw (css::uno::RuntimeException);
 
10191
+    virtual css::uno::Any SAL_CALL getAllowBreakAcrossPages() throw (css::uno::RuntimeException);
 
10192
+    virtual void SAL_CALL setAllowBreakAcrossPages( const css::uno::Any& _allowbreakacrosspages ) throw (css::uno::RuntimeException);
 
10193
+    virtual float SAL_CALL getSpaceBetweenColumns() throw (css::uno::RuntimeException);
 
10194
+    virtual void SAL_CALL setSpaceBetweenColumns( float _spacebetweencolumns ) throw (css::uno::RuntimeException);
 
10195
+
 
10196
+    // Methods
 
10197
+    virtual void SAL_CALL Delete(  ) throw (css::uno::RuntimeException);
 
10198
+    virtual void SAL_CALL SetLeftIndent( float LeftIndent, ::sal_Int32 RulerStyle ) throw (css::uno::RuntimeException);
 
10199
+    virtual void SAL_CALL Select(  ) throw (css::uno::RuntimeException);
 
10200
+
 
10201
+    //XCollection
 
10202
+    virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
 
10203
+    virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& /*not processed in this base class*/ ) throw ( css::uno::RuntimeException );
 
10204
+    // XEnumerationAccess
 
10205
+    virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
 
10206
+    virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
 
10207
+
 
10208
+    // SwVbaRows_BASE
 
10209
+    virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); 
 
10210
+    virtual rtl::OUString& getServiceImplName();
 
10211
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
10212
+};    
 
10213
+
 
10214
+#endif /* SW_VBA_ROWS_HXX */
 
10215
diff --git sw/source/ui/vba/vbasection.cxx sw/source/ui/vba/vbasection.cxx
 
10216
index c30058a..1a61e10 100644
 
10217
--- sw/source/ui/vba/vbasection.cxx
 
10218
+++ sw/source/ui/vba/vbasection.cxx
 
10219
@@ -31,6 +31,7 @@
 
10220
 #include <vbahelper/vbahelper.hxx>
 
10221
 #include <tools/diagnose_ex.h>
 
10222
 #include "vbapagesetup.hxx"
 
10223
+#include "vbaheadersfooters.hxx"
 
10224
 
 
10225
 using namespace ::ooo::vba;
 
10226
 using namespace ::com::sun::star;
 
10227
@@ -53,14 +54,20 @@ void SAL_CALL SwVbaSection::setProtectedForForms( ::sal_Bool /*_protectedforform
 
10228
 {
 
10229
 }
 
10230
 
 
10231
-uno::Any SAL_CALL SwVbaSection::Headers(  ) throw (uno::RuntimeException)
 
10232
+uno::Any SAL_CALL SwVbaSection::Headers( const uno::Any& index ) throw (uno::RuntimeException)
 
10233
 {
 
10234
-    return uno::Any();
 
10235
+    uno::Reference< XCollection > xCol( new SwVbaHeadersFooters( this, mxContext, mxModel, mxPageProps, sal_True ) );
 
10236
+    if ( index.hasValue() )
 
10237
+        return xCol->Item( index, uno::Any() );
 
10238
+    return uno::makeAny( xCol );
 
10239
 }
 
10240
 
 
10241
-uno::Any SAL_CALL SwVbaSection::Footers(  ) throw (uno::RuntimeException)
 
10242
+uno::Any SAL_CALL SwVbaSection::Footers( const uno::Any& index ) throw (uno::RuntimeException)
 
10243
 {
 
10244
-    return uno::Any();
 
10245
+    uno::Reference< XCollection > xCol( new SwVbaHeadersFooters( this, mxContext, mxModel, mxPageProps, sal_False ) );
 
10246
+    if ( index.hasValue() )
 
10247
+        return xCol->Item( index, uno::Any() );
 
10248
+    return uno::makeAny( xCol );
 
10249
 }
 
10250
 
 
10251
 uno::Any SAL_CALL
 
10252
diff --git sw/source/ui/vba/vbasection.hxx sw/source/ui/vba/vbasection.hxx
 
10253
index 92a65f3..f30f5ad 100644
 
10254
--- sw/source/ui/vba/vbasection.hxx
 
10255
+++ sw/source/ui/vba/vbasection.hxx
 
10256
@@ -51,8 +51,8 @@ public:
 
10257
     virtual void SAL_CALL setProtectedForForms( ::sal_Bool _protectedforforms ) throw (css::uno::RuntimeException);
 
10258
 
 
10259
     // Methods
 
10260
-    virtual css::uno::Any SAL_CALL Headers(  ) throw (css::uno::RuntimeException);
 
10261
-    virtual css::uno::Any SAL_CALL Footers(  ) throw (css::uno::RuntimeException);
 
10262
+    virtual css::uno::Any SAL_CALL Headers( const css::uno::Any& index ) throw (css::uno::RuntimeException);
 
10263
+    virtual css::uno::Any SAL_CALL Footers( const css::uno::Any& index ) throw (css::uno::RuntimeException);
 
10264
     virtual css::uno::Any SAL_CALL PageSetup(  ) throw (css::uno::RuntimeException);
 
10265
 
 
10266
        // XHelperInterface
 
10267
diff --git sw/source/ui/vba/vbasections.cxx sw/source/ui/vba/vbasections.cxx
 
10268
index 8fca880..0223efe 100644
 
10269
--- sw/source/ui/vba/vbasections.cxx
 
10270
+++ sw/source/ui/vba/vbasections.cxx
 
10271
@@ -90,6 +90,15 @@ public:
 
10272
         }
 
10273
     }
 
10274
 
 
10275
+    SectionCollectionHelper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ) throw (uno::RuntimeException) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel )
 
10276
+    {
 
10277
+        // Hacky implementation of Range.Sections, only support 1 secction
 
10278
+        uno::Reference< beans::XPropertySet > xRangeProps( xTextRange, uno::UNO_QUERY_THROW );
 
10279
+        uno::Reference< style::XStyle > xStyle = word::getCurrentPageStyle( mxModel, xRangeProps );
 
10280
+        uno::Reference< beans::XPropertySet > xPageProps( xStyle, uno::UNO_QUERY_THROW );
 
10281
+        mxSections.push_back( xPageProps );
 
10282
+    }
 
10283
+
 
10284
     ~SectionCollectionHelper(){}
 
10285
 
 
10286
     // XIndexAccess
 
10287
@@ -138,6 +147,10 @@ SwVbaSections::SwVbaSections( const uno::Reference< XHelperInterface >& xParent,
 
10288
 {
 
10289
 }
 
10290
 
 
10291
+SwVbaSections::SwVbaSections( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ): SwVbaSections_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new SectionCollectionHelper( xParent, xContext, xModel, xTextRange ) ) ),  mxModel( xModel )
 
10292
+{
 
10293
+}
 
10294
+
 
10295
 uno::Any SAL_CALL
 
10296
 SwVbaSections::PageSetup( ) throw (uno::RuntimeException)
 
10297
 {
 
10298
diff --git sw/source/ui/vba/vbasections.hxx sw/source/ui/vba/vbasections.hxx
 
10299
index 1ff9e9e..29e8ce4 100644
 
10300
--- sw/source/ui/vba/vbasections.hxx
 
10301
+++ sw/source/ui/vba/vbasections.hxx
 
10302
@@ -34,6 +34,7 @@
 
10303
 #include <ooo/vba/word/XSections.hpp>
 
10304
 #include <com/sun/star/container/XEnumerationAccess.hpp>
 
10305
 #include <com/sun/star/container/XIndexAccess.hpp>
 
10306
+#include <com/sun/star/text/XTextRange.hpp>
 
10307
 #include <vbahelper/vbahelperinterface.hxx>
 
10308
 
 
10309
 typedef CollTestImplHelper< ooo::vba::word::XSections > SwVbaSections_BASE;
 
10310
@@ -45,6 +46,7 @@ private:
 
10311
 
 
10312
 public:
 
10313
        SwVbaSections( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel );
 
10314
+    SwVbaSections( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextRange >& xTextRange );
 
10315
        virtual ~SwVbaSections() {}
 
10316
 
 
10317
        // XEnumerationAccess
 
10318
diff --git sw/source/ui/vba/vbaselection.cxx sw/source/ui/vba/vbaselection.cxx
 
10319
index e510dd8..1a74d5c 100644
 
10320
--- sw/source/ui/vba/vbaselection.cxx
 
10321
+++ sw/source/ui/vba/vbaselection.cxx
 
10322
@@ -32,7 +32,6 @@
 
10323
 #include <tools/diagnose_ex.h>
 
10324
 #include "vbarange.hxx"
 
10325
 #include "vbafind.hxx"
 
10326
-#include "wordvbahelper.hxx"
 
10327
 #include <com/sun/star/text/XTextRange.hpp>
 
10328
 #include <com/sun/star/text/XTextTable.hpp>
 
10329
 #include <com/sun/star/text/XTextTableCursor.hpp>
 
10330
@@ -44,14 +43,19 @@
 
10331
 #include <ooo/vba/word/WdGoToDirection.hpp>
 
10332
 #include <ooo/vba/word/XBookmark.hpp>
 
10333
 #include <ooo/vba/word/XApplication.hpp>
 
10334
+#include <ooo/vba/word/WdCollapseDirection.hpp>
 
10335
 #include <com/sun/star/text/XPageCursor.hpp>
 
10336
 #include "unotbl.hxx"
 
10337
 #include "unocoll.hxx"
 
10338
 #include "vbatable.hxx"
 
10339
 #include <com/sun/star/view/XSelectionSupplier.hpp>
 
10340
 #include <com/sun/star/view/XViewCursor.hpp>
 
10341
+#include <com/sun/star/view/XLineCursor.hpp>
 
10342
+#include <com/sun/star/text/XWordCursor.hpp>
 
10343
+#include <com/sun/star/text/XParagraphCursor.hpp>
 
10344
 #include <ooo/vba/word/WdInformation.hpp>
 
10345
 #include <ooo/vba/word/WdHeaderFooterIndex.hpp>
 
10346
+#include <ooo/vba/word/WdSeekView.hpp>
 
10347
 #include "vbainformationhelper.hxx"
 
10348
 #include "vbafield.hxx"
 
10349
 #include "vbaheaderfooter.hxx"
 
10350
@@ -59,6 +63,17 @@
 
10351
 #include <vbahelper/vbashaperange.hxx>
 
10352
 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
 
10353
 #include <com/sun/star/drawing/XDrawPage.hpp>
 
10354
+#include <com/sun/star/text/ControlCharacter.hpp>
 
10355
+#include "vbarows.hxx"
 
10356
+#include "vbacolumns.hxx"
 
10357
+#include "vbatablehelper.hxx"
 
10358
+#include "vbacells.hxx"
 
10359
+#include "vbaview.hxx"
 
10360
+#include "vbaparagraph.hxx"
 
10361
+#include "vbastyle.hxx"
 
10362
+#include <docsh.hxx>
 
10363
+#include <tblenum.hxx>
 
10364
+#include <fesh.hxx>
 
10365
 
 
10366
 using namespace ::ooo::vba;
 
10367
 using namespace ::com::sun::star;
 
10368
@@ -126,23 +141,25 @@ SwVbaSelection::HomeKey( const uno::Any& _unit, const uno::Any& _extend ) throw
 
10369
     sal_Int32 nExtend = word::WdMovementType::wdMove;
 
10370
     _unit >>= nUnit;
 
10371
     _extend >>= nExtend;
 
10372
+    sal_Bool bExtend = ( nExtend == word::WdMovementType::wdExtend ) ? sal_True : sal_False;
 
10373
 
 
10374
     switch( nUnit )
 
10375
     {
 
10376
         case word::WdUnits::wdStory:
 
10377
         {
 
10378
+            // go to the valid text first so that the current view cursor is valid to call gotoRange.
 
10379
+            word::gotoSelectedObjectAnchor(mxModel);
 
10380
             // go to the begin of the document
 
10381
-            rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfDoc"));
 
10382
-            dispatchRequests( mxModel,url );
 
10383
-            // If something is selected, it needs to go twice
 
10384
-            dispatchRequests( mxModel,url );
 
10385
+            uno::Reference< text::XText > xCurrentText = word::getCurrentXText( mxModel );
 
10386
+            uno::Reference< text::XTextRange > xFirstRange = word::getFirstObjectPosition( xCurrentText );
 
10387
+            mxTextViewCursor->gotoRange( xFirstRange, bExtend );
 
10388
             break;
 
10389
         }
 
10390
         case word::WdUnits::wdLine:
 
10391
         {
 
10392
             // go to the begin of the Line
 
10393
-            rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfLine"));
 
10394
-            dispatchRequests( mxModel,url );
 
10395
+            uno::Reference< view::XLineCursor > xLineCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
 
10396
+            xLineCursor->gotoStartOfLine( bExtend );
 
10397
             break;
 
10398
         }
 
10399
         default:
 
10400
@@ -160,23 +177,25 @@ SwVbaSelection::EndKey( const uno::Any& _unit, const uno::Any& _extend ) throw (
 
10401
     sal_Int32 nExtend = word::WdMovementType::wdMove;
 
10402
     _unit >>= nUnit;
 
10403
     _extend >>= nExtend;
 
10404
+    sal_Bool bExtend = ( nExtend == word::WdMovementType::wdExtend ) ? sal_True : sal_False;
 
10405
 
 
10406
     switch( nUnit )
 
10407
     {
 
10408
         case word::WdUnits::wdStory:
 
10409
         {
 
10410
-            // go to the end of the document
 
10411
-            rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfDoc"));
 
10412
-            dispatchRequests( mxModel,url );
 
10413
-            // If something is selected, it needs to go twice
 
10414
-            dispatchRequests( mxModel,url );
 
10415
+            // go to the valid text first so that the current view cursor is valid to call gotoRange.
 
10416
+            word::gotoSelectedObjectAnchor(mxModel);
 
10417
+            // go to the end of the document                   
 
10418
+            uno::Reference< text::XText > xCurrentText = word::getCurrentXText( mxModel );
 
10419
+            uno::Reference< text::XTextRange > xEnd = xCurrentText->getEnd();
 
10420
+            mxTextViewCursor->gotoRange( xEnd, bExtend );
 
10421
             break;
 
10422
         }
 
10423
         case word::WdUnits::wdLine:
 
10424
         {
 
10425
             // go to the end of the Line
 
10426
-            rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfLine"));
 
10427
-            dispatchRequests( mxModel,url );
 
10428
+            uno::Reference< view::XLineCursor > xLineCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
 
10429
+            xLineCursor->gotoEndOfLine( bExtend );
 
10430
             break;
 
10431
         }
 
10432
         default:
 
10433
@@ -188,14 +207,161 @@ SwVbaSelection::EndKey( const uno::Any& _unit, const uno::Any& _extend ) throw (
 
10434
 }
 
10435
 
 
10436
 void SAL_CALL
 
10437
-SwVbaSelection::Delete( const uno::Any& /*_unit*/, const uno::Any& /*_count*/ ) throw ( uno::RuntimeException )
 
10438
+SwVbaSelection::Delete( const uno::Any& _unit, const uno::Any& _count ) throw ( uno::RuntimeException )
 
10439
 {
 
10440
-    // FIXME: handle the arguments: _unit and _count 
 
10441
+    sal_Int32 nUnit = word::WdUnits::wdLine;
 
10442
+    sal_Int32 nCount = 0;
 
10443
+    if( _count.hasValue() )
 
10444
+        _count >>= nCount;
 
10445
+    if( _unit.hasValue() && ( nCount > 0 ) )
 
10446
+    {
 
10447
+        _unit >>= nUnit;
 
10448
+        switch( nUnit )
 
10449
+        {
 
10450
+            case word::WdUnits::wdCharacter:
 
10451
+            {
 
10452
+                if( HasSelection() )
 
10453
+                    nCount--;
 
10454
+                mxTextViewCursor->goRight( nCount, sal_True );
 
10455
+                break;
 
10456
+            }
 
10457
+            default:
 
10458
+            {
 
10459
+                throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
10460
+            }    
 
10461
+        }
 
10462
+    }
 
10463
     rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Delete"));
 
10464
     dispatchRequests( mxModel,url );
 
10465
 }
 
10466
 
 
10467
-void SwVbaSelection::NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw ( uno::RuntimeException )
 
10468
+void
 
10469
+SwVbaSelection::Move( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend, word::E_DIRECTION eDirection ) throw ( uno::RuntimeException )
 
10470
+{
 
10471
+    sal_Int32 nUnit = word::WdUnits::wdCharacter;
 
10472
+    sal_Int32 nCount = 1;
 
10473
+    sal_Int32 nExtend = word::WdMovementType::wdMove;
 
10474
+
 
10475
+    if( _unit.hasValue() )
 
10476
+        _unit >>= nUnit;
 
10477
+    if( _count.hasValue() )
 
10478
+        _count >>= nCount;
 
10479
+    if( _extend.hasValue() )
 
10480
+        _extend >>= nExtend;
 
10481
+    
 
10482
+    if( nCount == 0 )
 
10483
+        return;
 
10484
+
 
10485
+    sal_Bool bExpand = ( nExtend == word::WdMovementType::wdMove ) ? sal_False : sal_True;
 
10486
+    
 
10487
+    switch( nUnit )
 
10488
+    {
 
10489
+        case word::WdUnits::wdCell:
 
10490
+        {
 
10491
+            if(  nExtend == word::WdMovementType::wdExtend )
 
10492
+            {
 
10493
+                DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
 
10494
+                return;
 
10495
+            }
 
10496
+            NextCell( nCount, eDirection );
 
10497
+            break;
 
10498
+        }
 
10499
+        case word::WdUnits::wdLine:
 
10500
+        {
 
10501
+            if( eDirection == word::MOVE_LEFT || eDirection == word::MOVE_RIGHT )
 
10502
+            {
 
10503
+                throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
10504
+            }
 
10505
+            uno::Reference< view::XViewCursor > xViewCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
 
10506
+            if( eDirection == word::MOVE_UP )
 
10507
+                xViewCursor->goUp( nCount, bExpand );
 
10508
+            else if( eDirection == word::MOVE_DOWN )
 
10509
+                xViewCursor->goDown( nCount, bExpand );
 
10510
+            break;
 
10511
+        }
 
10512
+        case word::WdUnits::wdCharacter:
 
10513
+        {
 
10514
+            if( eDirection == word::MOVE_UP || eDirection == word::MOVE_DOWN )
 
10515
+            {
 
10516
+                throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
10517
+            }
 
10518
+            if( word::gotoSelectedObjectAnchor( mxModel ) )
 
10519
+            {
 
10520
+                nCount--;
 
10521
+            }
 
10522
+            uno::Reference< view::XViewCursor > xViewCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
 
10523
+            if( eDirection == word::MOVE_LEFT )
 
10524
+            {
 
10525
+                // if current select is a cellrange or table, 
 
10526
+                // the first count of move should move to the first selected cell.
 
10527
+                uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
 
10528
+                if ( xTextTableCursor.is() )
 
10529
+                {
 
10530
+                    uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
 
10531
+                    uno::Reference< text::XTextTable > xTextTable;
 
10532
+                    xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
 
10533
+                    if( xTextTable.is() )
 
10534
+                    {
 
10535
+                        uno::Reference< text::XTextRange > xRange( xTextTable->getCellByName( xTextTableCursor->getRangeName()), uno::UNO_QUERY_THROW );
 
10536
+                        mxTextViewCursor->gotoRange( xRange->getStart(), bExpand );
 
10537
+                        nCount--;
 
10538
+                    }
 
10539
+                }
 
10540
+                xViewCursor->goLeft( nCount, bExpand );
 
10541
+            }    
 
10542
+            else if( eDirection == word::MOVE_RIGHT )
 
10543
+                xViewCursor->goRight( nCount, bExpand );
 
10544
+            break;
 
10545
+        }
 
10546
+        case word::WdUnits::wdWord:
 
10547
+        case word::WdUnits::wdParagraph:
 
10548
+        {
 
10549
+            uno::Reference< text::XTextRange > xRange = GetSelectedRange();
 
10550
+            uno::Reference< text::XText > xText = xRange->getText();
 
10551
+            uno::Reference< text::XTextCursor > xTextCursor = xText->createTextCursorByRange( xRange );
 
10552
+            if( nUnit == word::WdUnits::wdParagraph )
 
10553
+            {
 
10554
+                if( eDirection == word::MOVE_LEFT || eDirection == word::MOVE_RIGHT )
 
10555
+                {
 
10556
+                    throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
10557
+                }
 
10558
+                uno::Reference< text::XParagraphCursor > xParagraphCursor( xTextCursor, uno::UNO_QUERY_THROW );
 
10559
+                for( sal_Int32 i=0; i<nCount; i++ )
 
10560
+                {
 
10561
+                    if( ( eDirection == word::MOVE_UP ) && ( xParagraphCursor->gotoPreviousParagraph( bExpand ) == sal_False ) )
 
10562
+                        break;
 
10563
+                    else if( ( eDirection == word::MOVE_DOWN ) && ( xParagraphCursor->gotoNextParagraph( bExpand ) == sal_False ) )
 
10564
+                        break;
 
10565
+                }
 
10566
+            }
 
10567
+            else if( nUnit == word::WdUnits::wdWord )
 
10568
+            {
 
10569
+                if( eDirection == word::MOVE_UP || eDirection == word::MOVE_DOWN )
 
10570
+                {
 
10571
+                    throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
10572
+                }
 
10573
+                uno::Reference< text::XWordCursor > xWordCursor( xTextCursor, uno::UNO_QUERY_THROW );
 
10574
+                for( sal_Int32 i=0; i<nCount; i++ )
 
10575
+                {
 
10576
+                    if( (eDirection == word::MOVE_LEFT ) && ( xWordCursor->gotoPreviousWord( bExpand ) == sal_False ) )
 
10577
+                        break;
 
10578
+                    else if( ( eDirection == word::MOVE_RIGHT ) && ( xWordCursor->gotoNextWord( bExpand ) == sal_False ) )
 
10579
+                        break;
 
10580
+                }
 
10581
+            }
 
10582
+            mxTextViewCursor->gotoRange( xTextCursor->getStart(), sal_False );
 
10583
+            mxTextViewCursor->gotoRange( xTextCursor->getEnd(), sal_True );
 
10584
+            break;
 
10585
+        }
 
10586
+        default:
 
10587
+        {
 
10588
+            throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
10589
+            break;
 
10590
+        }
 
10591
+    }
 
10592
+}
 
10593
+
 
10594
+void SwVbaSelection::NextCell( sal_Int32 nCount, word::E_DIRECTION eDirection ) throw ( uno::RuntimeException )
 
10595
 {
 
10596
     uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
 
10597
     uno::Reference< text::XTextTable > xTextTable;
 
10598
@@ -214,22 +380,22 @@ void SwVbaSelection::NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw
 
10599
     // move the table cursor 
 
10600
     switch( eDirection )
 
10601
     {
 
10602
-        case MOVE_LEFT:
 
10603
+        case word::MOVE_LEFT:
 
10604
         {
 
10605
             xTextTableCursor->goLeft( nCount, sal_False );
 
10606
             break;
 
10607
         }
 
10608
-        case MOVE_RIGHT:
 
10609
+        case word::MOVE_RIGHT:
 
10610
         {
 
10611
             xTextTableCursor->goRight( nCount, sal_False );
 
10612
             break;
 
10613
         }
 
10614
-        case MOVE_UP:
 
10615
+        case word::MOVE_UP:
 
10616
         {
 
10617
             xTextTableCursor->goUp( nCount, sal_False );
 
10618
             break;
 
10619
         }
 
10620
-        case MOVE_DOWN:
 
10621
+        case word::MOVE_DOWN:
 
10622
         {
 
10623
             xTextTableCursor->goDown( nCount, sal_False );
 
10624
             break;
 
10625
@@ -248,61 +414,29 @@ void SwVbaSelection::NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw
 
10626
 void SAL_CALL
 
10627
 SwVbaSelection::MoveRight( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
 
10628
 {
 
10629
-    sal_Int32 nUnit = word::WdUnits::wdCharacter;
 
10630
     sal_Int32 nCount = 1;
 
10631
-    sal_Int32 nExtend = word::WdMovementType::wdMove;
 
10632
 
 
10633
-    if( _unit.hasValue() )
 
10634
-        _unit >>= nUnit;
 
10635
     if( _count.hasValue() )
 
10636
         _count >>= nCount;
 
10637
-    if( _extend.hasValue() )
 
10638
-        _extend >>= nExtend;
 
10639
     
 
10640
     if( nCount == 0 )
 
10641
         return;
 
10642
     
 
10643
     if( nCount < 0 )
 
10644
     {
 
10645
-        // TODO: call MoveLeft;
 
10646
         MoveLeft( _unit, uno::makeAny( -nCount ), _extend );
 
10647
         return;
 
10648
     }
 
10649
-    
 
10650
-    switch( nUnit )
 
10651
-    {
 
10652
-        case word::WdUnits::wdCell:
 
10653
-        {
 
10654
-            if(  nExtend == word::WdMovementType::wdExtend )
 
10655
-            {
 
10656
-                DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
 
10657
-                return;
 
10658
-            }
 
10659
-            NextCell( nCount, MOVE_RIGHT );
 
10660
-            break;
 
10661
-        }
 
10662
-        default:
 
10663
-        {
 
10664
-            throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
10665
-            break;
 
10666
-        }
 
10667
-    }
 
10668
 
 
10669
+    Move( _unit, _count, _extend, word::MOVE_RIGHT );
 
10670
 }
 
10671
 
 
10672
 void SAL_CALL
 
10673
 SwVbaSelection::MoveLeft( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
 
10674
 {
 
10675
-    sal_Int32 nUnit = word::WdUnits::wdCharacter;
 
10676
     sal_Int32 nCount = 1;
 
10677
-    sal_Int32 nExtend = word::WdMovementType::wdMove;
 
10678
-
 
10679
-    if( _unit.hasValue() )
 
10680
-        _unit >>= nUnit;
 
10681
     if( _count.hasValue() )
 
10682
         _count >>= nCount;
 
10683
-    if( _extend.hasValue() )
 
10684
-        _extend >>= nExtend;
 
10685
     
 
10686
     if( nCount == 0 )
 
10687
         return;
 
10688
@@ -313,67 +447,47 @@ SwVbaSelection::MoveLeft( const uno::Any& _unit, const uno::Any& _count, const u
 
10689
         return;
 
10690
     }
 
10691
     
 
10692
-    switch( nUnit )
 
10693
-    {
 
10694
-        case word::WdUnits::wdCell:
 
10695
-        {
 
10696
-            if(  nExtend == word::WdMovementType::wdExtend )
 
10697
-            {
 
10698
-                DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
 
10699
-                return;
 
10700
-            }
 
10701
-            NextCell( nCount, MOVE_LEFT );
 
10702
-            break;
 
10703
-        }
 
10704
-        default:
 
10705
-        {
 
10706
-            throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
10707
-            break;
 
10708
-        }
 
10709
-    }
 
10710
-
 
10711
+    Move( _unit, _count, _extend, word::MOVE_LEFT );
 
10712
 }
 
10713
 
 
10714
 void SAL_CALL
 
10715
 SwVbaSelection::MoveDown( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
 
10716
 {
 
10717
-    sal_Int32 nUnit = word::WdUnits::wdCharacter;
 
10718
     sal_Int32 nCount = 1;
 
10719
-    sal_Int32 nExtend = word::WdMovementType::wdMove;
 
10720
 
 
10721
-    if( _unit.hasValue() )
 
10722
-        _unit >>= nUnit;
 
10723
     if( _count.hasValue() )
 
10724
         _count >>= nCount;
 
10725
-    if( _extend.hasValue() )
 
10726
-        _extend >>= nExtend;
 
10727
     
 
10728
     if( nCount == 0 )
 
10729
         return;
 
10730
     
 
10731
     if( nCount < 0 )
 
10732
     {
 
10733
-        // TODO: call MoveLeft;
 
10734
-        //MoveUp( _unit, uno::makeAny( -nCount ), _extend );
 
10735
+        MoveUp( _unit, uno::makeAny( -nCount ), _extend );
 
10736
         return;
 
10737
     }
 
10738
     
 
10739
-    switch( nUnit )
 
10740
+    Move( _unit, _count, _extend, word::MOVE_DOWN );
 
10741
+}
 
10742
+
 
10743
+void SAL_CALL
 
10744
+SwVbaSelection::MoveUp( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
 
10745
+{
 
10746
+    sal_Int32 nCount = 1;
 
10747
+
 
10748
+    if( _count.hasValue() )
 
10749
+        _count >>= nCount;
 
10750
+    
 
10751
+    if( nCount == 0 )
 
10752
+        return;
 
10753
+    
 
10754
+    if( nCount < 0 )
 
10755
     {
 
10756
-        case word::WdUnits::wdLine:
 
10757
-        {
 
10758
-            uno::Reference< view::XViewCursor > xViewCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
 
10759
-            sal_Bool bExpand = ( nExtend == word::WdMovementType::wdMove ) ? sal_False : sal_True;
 
10760
-            xViewCursor->goDown( nCount, bExpand );
 
10761
-            break;
 
10762
-        }
 
10763
-        default:
 
10764
-        {
 
10765
-            throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
10766
-            break;
 
10767
-        }
 
10768
+        MoveDown( _unit, uno::makeAny( -nCount ), _extend );
 
10769
+        return;
 
10770
     }
 
10771
-
 
10772
+    
 
10773
+    Move( _unit, _count, _extend, word::MOVE_UP );
 
10774
 }
 
10775
 
 
10776
 void SAL_CALL
 
10777
@@ -425,16 +539,17 @@ SwVbaSelection::getFind() throw ( uno::RuntimeException )
 
10778
     return uno::Reference< word::XFind >( new SwVbaFind( this, mxContext, mxModel, xTextRange ) );
 
10779
 }
 
10780
 
 
10781
-uno::Reference< word::XStyle > SAL_CALL
 
10782
+uno::Any SAL_CALL
 
10783
 SwVbaSelection::getStyle() throw ( uno::RuntimeException )
 
10784
 {
 
10785
     return getRange()->getStyle();
 
10786
 }
 
10787
 
 
10788
 void SAL_CALL
 
10789
-SwVbaSelection::setStyle( const uno::Reference< word::XStyle >& rStyle ) throw ( uno::RuntimeException )
 
10790
+SwVbaSelection::setStyle( const uno::Any& rStyle ) throw ( uno::RuntimeException )
 
10791
 {
 
10792
-    return getRange()->setStyle( rStyle );
 
10793
+    uno::Reference< beans::XPropertySet > xParaProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
 
10794
+    return SwVbaStyle::setStyle( xParaProps, rStyle );
 
10795
 }
 
10796
 
 
10797
 uno::Reference< word::XFont > SAL_CALL
 
10798
@@ -477,39 +592,79 @@ uno::Reference< word::XRange > SAL_CALL SwVbaSelection::GoTo( const uno::Any& _w
 
10799
             sal_Int32 nWhich = 0;
 
10800
             if( _which.hasValue() )
 
10801
                 _which >>= nWhich;
 
10802
-             sal_Int32 nPage = 0;
 
10803
-             switch( nWhich )
 
10804
-             {
 
10805
-                case word::WdGoToDirection::wdGoToLast:
 
10806
-                {
 
10807
-                    nPage = nLastPage;
 
10808
-                    break;
 
10809
-                }
 
10810
-                case word::WdGoToDirection::wdGoToNext:
 
10811
-                {
 
10812
-                    nPage = nCurrPage + 1;
 
10813
-                    break;
 
10814
-                }
 
10815
-                case word::WdGoToDirection::wdGoToPrevious:
 
10816
-                {
 
10817
-                    nPage = nCurrPage - 1;
 
10818
-                    break;
 
10819
-                }
 
10820
-                default:
 
10821
-                {
 
10822
-                    nPage = nCount;
 
10823
-                }
 
10824
-             }
 
10825
-             if( nPage <= 0 )
 
10826
-                nPage = 1;
 
10827
-             if( nPage > nLastPage )
 
10828
-                nPage = nLastPage;
 
10829
-             xPageCursor->jumpToPage( ( sal_Int16 )( nPage ) );
 
10830
-             break;
 
10831
+            sal_Int32 nPage = 0;
 
10832
+            switch( nWhich )
 
10833
+            {
 
10834
+               case word::WdGoToDirection::wdGoToLast:
 
10835
+               {
 
10836
+                   nPage = nLastPage;
 
10837
+                   break;
 
10838
+               }
 
10839
+               case word::WdGoToDirection::wdGoToNext:
 
10840
+               {
 
10841
+                   if( nCount !=0 )
 
10842
+                       nPage = nCurrPage + nCount;
 
10843
+                   else    
 
10844
+                       nPage = nCurrPage + 1;
 
10845
+                   break;
 
10846
+               }
 
10847
+               case word::WdGoToDirection::wdGoToPrevious:
 
10848
+               {
 
10849
+                   if( nCount !=0 )
 
10850
+                       nPage = nCurrPage - nCount;
 
10851
+                   else    
 
10852
+                       nPage = nCurrPage - 1;
 
10853
+                   break;
 
10854
+               }
 
10855
+               default:
 
10856
+               {
 
10857
+                   nPage = nCount;
 
10858
+               }
 
10859
+            }
 
10860
+            if( _name.hasValue() )
 
10861
+            {
 
10862
+                rtl::OUString sName;
 
10863
+                _name >>= sName;
 
10864
+                sal_Int32 nName = sName.toInt32();
 
10865
+                if( nName !=0 )
 
10866
+                    nPage = nName;
 
10867
+            }
 
10868
+            if( nPage <= 0 )
 
10869
+               nPage = 1;
 
10870
+            if( nPage > nLastPage )
 
10871
+               nPage = nLastPage;
 
10872
+            xPageCursor->jumpToPage( ( sal_Int16 )( nPage ) );
 
10873
+            break;
 
10874
         }
 
10875
         case word::WdGoToItem::wdGoToSection:
 
10876
         {
 
10877
-            // TODO: implement Section object
 
10878
+            uno::Reference< text::XPageCursor > xPageCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
 
10879
+            sal_Int32 nCount = 0;
 
10880
+            if( _count.hasValue() )
 
10881
+                _count >>= nCount;
 
10882
+            sal_Int32 nWhich = 0;
 
10883
+            if( _which.hasValue() )
 
10884
+                _which >>= nWhich;
 
10885
+            sal_Int32 nPage = 0;    
 
10886
+            switch( nWhich )
 
10887
+            {
 
10888
+               case word::WdGoToDirection::wdGoToAbsolute:
 
10889
+               {
 
10890
+                    // currently only support this type
 
10891
+                    if( nCount == 1 )
 
10892
+                        nPage = 1;
 
10893
+                    break;
 
10894
+               }
 
10895
+               default:
 
10896
+               {
 
10897
+                    nPage = 0;
 
10898
+               }
 
10899
+            }   
 
10900
+            if( nPage != 0 )
 
10901
+                xPageCursor->jumpToPage( ( sal_Int16 )( nPage ) );
 
10902
+            else    
 
10903
+                throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
10904
+            break;    
 
10905
         }
 
10906
         default:
 
10907
             throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
10908
@@ -549,6 +704,82 @@ uno::Any SAL_CALL SwVbaSelection::Information( sal_Int32 _type ) throw (uno::Run
 
10909
             result = uno::makeAny( SwVbaInformationHelper::handleWdVerticalPositionRelativeToPage( mxModel, mxTextViewCursor ) );
 
10910
             break;
 
10911
         }
 
10912
+        case word::WdInformation::wdWithInTable:
 
10913
+        {
 
10914
+            uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
 
10915
+            uno::Reference< text::XTextTable > xTextTable;
 
10916
+            xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
 
10917
+            if( xTextTable.is() )
 
10918
+                result = uno::makeAny( sal_True );
 
10919
+            else
 
10920
+                result = uno::makeAny( sal_False );
 
10921
+            break;
 
10922
+        }
 
10923
+        case word::WdInformation::wdHeaderFooterType:
 
10924
+        {
 
10925
+            uno::Reference< word::XView > xView( new SwVbaView( this, mxContext, mxModel ) );
 
10926
+            sal_Int32 nView = xView->getSeekView();
 
10927
+            sal_Int32 nHeaderFooterType = 0;
 
10928
+            switch( nView )
 
10929
+            {
 
10930
+                case word::WdSeekView::wdSeekMainDocument:
 
10931
+                {
 
10932
+                    nHeaderFooterType = -1; // not in a header or footer
 
10933
+                    break;
 
10934
+                }
 
10935
+                case word::WdSeekView::wdSeekEvenPagesHeader:
 
10936
+                {
 
10937
+                    nHeaderFooterType = 0; // even page header
 
10938
+                    break;
 
10939
+                }
 
10940
+                case word::WdSeekView::wdSeekPrimaryHeader:
 
10941
+                {
 
10942
+                    nHeaderFooterType = 1; // odd page header
 
10943
+                    break;
 
10944
+                }
 
10945
+                case word::WdSeekView::wdSeekEvenPagesFooter:
 
10946
+                {
 
10947
+                    nHeaderFooterType = 2; // even page footer
 
10948
+                    break;
 
10949
+                }
 
10950
+                case word::WdSeekView::wdSeekPrimaryFooter:
 
10951
+                {
 
10952
+                    nHeaderFooterType = 3; // odd page footer
 
10953
+                    break;
 
10954
+                }
 
10955
+                case word::WdSeekView::wdSeekFirstPageHeader:
 
10956
+                case word::WdSeekView::wdSeekFirstPageFooter:
 
10957
+                {
 
10958
+                    uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
 
10959
+                    rtl::OUString aPageStyleName;
 
10960
+                    xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName;
 
10961
+                    sal_Bool bFirstPage = sal_False;
 
10962
+                    if( aPageStyleName.equalsAscii( "First Page" ) )
 
10963
+                        bFirstPage = sal_True;
 
10964
+                    if( nView == word::WdSeekView::wdSeekFirstPageHeader )
 
10965
+                    {
 
10966
+                        if( bFirstPage )
 
10967
+                            nHeaderFooterType = 4; 
 
10968
+                        else
 
10969
+                            nHeaderFooterType = 1;
 
10970
+                    }        
 
10971
+                    else        
 
10972
+                    {
 
10973
+                        if( bFirstPage )
 
10974
+                            nHeaderFooterType = 5; 
 
10975
+                        else
 
10976
+                            nHeaderFooterType = 3;
 
10977
+                    }        
 
10978
+                    break;
 
10979
+                }
 
10980
+                default:
 
10981
+                {
 
10982
+                    nHeaderFooterType = -1;
 
10983
+                }
 
10984
+            }
 
10985
+            result = uno::makeAny( nHeaderFooterType );
 
10986
+            break;
 
10987
+        }
 
10988
         default:
 
10989
             throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
10990
     }
 
10991
@@ -569,11 +800,6 @@ SwVbaSelection::Tables( const uno::Any& aIndex ) throw (uno::RuntimeException)
 
10992
     // we can only support a selection that is a single table
 
10993
     if ( !aIndex.hasValue() ) // currently we can't support multiple tables in a selection
 
10994
        throw uno::RuntimeException(); 
 
10995
-    // if the current selection is a XTextTableCursor and the index is 1 then we can service this request, otherwise we just have to throw
 
10996
-    uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
 
10997
-
 
10998
-    if ( !xTextTableCursor.is() )
 
10999
-       throw uno::RuntimeException(); 
 
11000
 
 
11001
     sal_Int32 nIndex = 0;
 
11002
     aIndex >>= nIndex;
 
11003
@@ -582,6 +808,24 @@ SwVbaSelection::Tables( const uno::Any& aIndex ) throw (uno::RuntimeException)
 
11004
 
 
11005
     if ( nIndex != 1 )
 
11006
        throw uno::RuntimeException(); 
 
11007
+
 
11008
+    uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
 
11009
+    uno::Reference< text::XTextTable > xTextTable;
 
11010
+    xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
 
11011
+    if( xTextTable.is() )
 
11012
+    {
 
11013
+            uno::Reference< css::text::XTextDocument > xTextDoc( mxModel, uno::UNO_QUERY_THROW );
 
11014
+            uno::Reference< word::XTable > xVBATbl = new SwVbaTable( mxParent, mxContext, xTextDoc, xTextTable ); 
 
11015
+            aRet <<= xVBATbl;
 
11016
+            return aRet;
 
11017
+    }
 
11018
+
 
11019
+    // if the current selection is a XTextTableCursor and the index is 1 then we can service this request, otherwise we just have to throw
 
11020
+    uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
 
11021
+
 
11022
+    if ( !xTextTableCursor.is() )
 
11023
+       throw uno::RuntimeException(); 
 
11024
+
 
11025
     SwXTextTableCursor* pTTCursor = dynamic_cast< SwXTextTableCursor* >( xTextTableCursor.get() );
 
11026
     if ( pTTCursor )
 
11027
     {
 
11028
@@ -611,15 +855,14 @@ SwVbaSelection::Fields( const uno::Any& index ) throw (uno::RuntimeException)
 
11029
 uno::Reference< word::XHeaderFooter > SAL_CALL
 
11030
 SwVbaSelection::getHeaderFooter() throw ( uno::RuntimeException )
 
11031
 {
 
11032
-    uno::Reference< text::XText > xCurrentText = word::getXTextViewCursor( mxModel )->getText();
 
11033
-    if( HeaderFooterHelper::isHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isFooter( mxModel, xCurrentText ) )
 
11034
+    if( HeaderFooterHelper::isHeaderFooter( mxModel ) )
 
11035
     {
 
11036
         uno::Reference< beans::XPropertySet > xPageStyleProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
 
11037
         sal_Int32 nIndex = word::WdHeaderFooterIndex::wdHeaderFooterPrimary;
 
11038
-        sal_Bool isHeader = HeaderFooterHelper::isHeader( mxModel, xCurrentText );
 
11039
-        if( HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) )
 
11040
+        sal_Bool isHeader = HeaderFooterHelper::isHeader( mxModel );
 
11041
+        if( HeaderFooterHelper::isEvenPagesHeader( mxModel ) || HeaderFooterHelper::isEvenPagesFooter( mxModel ) )
 
11042
             nIndex = word::WdHeaderFooterIndex::wdHeaderFooterEvenPages;
 
11043
-        else if( HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) )
 
11044
+        else if( HeaderFooterHelper::isFirstPageHeader( mxModel ) || HeaderFooterHelper::isFirstPageFooter( mxModel ) )
 
11045
             nIndex = word::WdHeaderFooterIndex::wdHeaderFooterFirstPage;
 
11046
         
 
11047
         return uno::Reference< word::XHeaderFooter >( new SwVbaHeaderFooter( this, mxContext, mxModel, xPageStyleProps, isHeader, nIndex ) );
 
11048
@@ -632,9 +875,13 @@ uno::Any SAL_CALL
 
11049
 SwVbaSelection::ShapeRange( ) throw (uno::RuntimeException)
 
11050
 {
 
11051
     uno::Reference< drawing::XShapes > xShapes( mxModel->getCurrentSelection(), uno::UNO_QUERY );
 
11052
-
 
11053
     if ( !xShapes.is() )
 
11054
-       throw uno::RuntimeException(); 
 
11055
+    {
 
11056
+        uno::Reference< drawing::XShape > xShape( mxModel->getCurrentSelection(), uno::UNO_QUERY_THROW );
 
11057
+        uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
 
11058
+        xShapes.set( xMSF->createInstance( rtl::OUString::createFromAscii( "com.sun.star.drawing.ShapeCollection" ) ), uno::UNO_QUERY_THROW );
 
11059
+        xShapes->add( xShape );
 
11060
+    }   
 
11061
 
 
11062
     uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW );
 
11063
     uno::Reference< drawing::XDrawPage > xDrawPage = xDrawPageSupplier->getDrawPage();
 
11064
@@ -661,6 +908,281 @@ void SAL_CALL SwVbaSelection::setEnd( ::sal_Int32 _end ) throw (uno::RuntimeExce
 
11065
     getRange()->setEnd( _end );
 
11066
 }
 
11067
 
 
11068
+void SAL_CALL SwVbaSelection::SelectRow() throw (uno::RuntimeException)
 
11069
+{
 
11070
+    uno::Reference< word::XRows > xRows( Rows( uno::Any() ), uno::UNO_QUERY_THROW );
 
11071
+    xRows->Select();
 
11072
+}
 
11073
+
 
11074
+void SAL_CALL SwVbaSelection::SelectColumn() throw (uno::RuntimeException)
 
11075
+{
 
11076
+    uno::Reference< word::XColumns > xColumns( Columns( uno::Any() ), uno::UNO_QUERY_THROW );
 
11077
+    xColumns->Select();
 
11078
+}
 
11079
+
 
11080
+uno::Any SAL_CALL SwVbaSelection::Rows( const uno::Any& index ) throw (uno::RuntimeException)
 
11081
+{
 
11082
+    rtl::OUString sTLName;
 
11083
+    rtl::OUString sBRName;
 
11084
+    GetSelectedCellRange( sTLName, sBRName );
 
11085
+    
 
11086
+    sal_Int32 nStartRow = 0;
 
11087
+    sal_Int32 nEndRow = 0;
 
11088
+    uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
 
11089
+    SwVbaTableHelper aTableHelper( xTextTable );
 
11090
+    nStartRow = aTableHelper.getTabRowIndex( sTLName );
 
11091
+    if( sBRName.getLength() > 0 )
 
11092
+    {
 
11093
+        nEndRow = aTableHelper.getTabRowIndex( sBRName );
 
11094
+    }
 
11095
+    else
 
11096
+    {
 
11097
+        nEndRow = nStartRow;
 
11098
+    }
 
11099
+
 
11100
+    uno::Reference< XCollection > xCol( new SwVbaRows( this, mxContext, xTextTable, xTextTable->getRows(), nStartRow, nEndRow ) );
 
11101
+    if ( index.hasValue() )
 
11102
+        return xCol->Item( index, uno::Any() );
 
11103
+    return uno::makeAny( xCol );
 
11104
+}
 
11105
+
 
11106
+uno::Any SAL_CALL SwVbaSelection::Columns( const uno::Any& index ) throw (uno::RuntimeException)
 
11107
+{
 
11108
+    rtl::OUString sTLName;
 
11109
+    rtl::OUString sBRName;
 
11110
+    GetSelectedCellRange( sTLName, sBRName );
 
11111
+    sal_Int32 nStartColumn = 0;
 
11112
+    sal_Int32 nEndColumn = 0;
 
11113
+
 
11114
+    uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
 
11115
+    SwVbaTableHelper aTableHelper( xTextTable );
 
11116
+    nStartColumn = aTableHelper.getTabColIndex( sTLName );
 
11117
+    if( sBRName.getLength() > 0 )
 
11118
+    {
 
11119
+        nEndColumn = aTableHelper.getTabColIndex( sBRName );
 
11120
+    }
 
11121
+    else
 
11122
+    {
 
11123
+        nEndColumn = nStartColumn;
 
11124
+    }
 
11125
+
 
11126
+    uno::Reference< XCollection > xCol( new SwVbaColumns( this, mxContext, xTextTable, xTextTable->getColumns(), nStartColumn, nEndColumn ) );
 
11127
+    if ( index.hasValue() )
 
11128
+        return xCol->Item( index, uno::Any() );
 
11129
+    return uno::makeAny( xCol );
 
11130
+}
 
11131
+
 
11132
+uno::Reference< text::XTextTable > SwVbaSelection::GetXTextTable() throw( uno::RuntimeException )
 
11133
+{
 
11134
+    uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
 
11135
+    uno::Reference< text::XTextTable > xTextTable;
 
11136
+    xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
 
11137
+    return xTextTable;
 
11138
+}
 
11139
+
 
11140
+sal_Bool SwVbaSelection::IsInTable() throw( uno::RuntimeException )
 
11141
+{
 
11142
+    uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
 
11143
+    if( xTextTable.is() )
 
11144
+        return sal_True;
 
11145
+    return sal_False;    
 
11146
+}
 
11147
+
 
11148
+sal_Bool SwVbaSelection::HasSelection() throw( uno::RuntimeException )
 
11149
+{
 
11150
+    uno::Reference< text::XTextRange > xStart = mxTextViewCursor->getStart();
 
11151
+    uno::Reference< text::XTextRange > xEnd = mxTextViewCursor->getEnd();
 
11152
+    uno::Reference< text::XTextRangeCompare > xTRC( mxTextViewCursor->getText(), uno::UNO_QUERY_THROW );
 
11153
+    if( xTRC->compareRegionStarts( xStart, xEnd ) == 0 && xTRC->compareRegionEnds( xStart, xEnd ) == 0 )
 
11154
+        return sal_False;
 
11155
+    return sal_True;    
 
11156
+}
 
11157
+
 
11158
+void SwVbaSelection::GetSelectedCellRange( rtl::OUString& sTLName, rtl::OUString& sBRName ) throw( uno::RuntimeException )
 
11159
+{
 
11160
+    uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
 
11161
+    uno::Reference< text::XTextTable > xTextTable;
 
11162
+    xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
 
11163
+    if( !xTextTable.is() )
 
11164
+        throw uno::RuntimeException( );
 
11165
+
 
11166
+    uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
 
11167
+    if( xTextTableCursor.is() )
 
11168
+    {
 
11169
+        String sRange( xTextTableCursor->getRangeName() );
 
11170
+        if( sRange.GetTokenCount(':') > 0 )
 
11171
+        {
 
11172
+            sTLName = sRange.GetToken(0, ':');
 
11173
+            sBRName = sRange.GetToken(1, ':');
 
11174
+        }
 
11175
+    }    
 
11176
+    if( !sTLName.getLength() )
 
11177
+    {
 
11178
+        uno::Reference< table::XCell > xCell;
 
11179
+        xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cell") ) ) >>= xCell;
 
11180
+        if( !xCell.is() )
 
11181
+        {
 
11182
+            throw uno::RuntimeException( );
 
11183
+        }
 
11184
+        uno::Reference< beans::XPropertySet > xCellProps( xCell, uno::UNO_QUERY_THROW );
 
11185
+        xCellProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellName") ) ) >>= sTLName;
 
11186
+    }
 
11187
+}
 
11188
+
 
11189
+uno::Any SAL_CALL SwVbaSelection::Cells( const uno::Any& index ) throw (uno::RuntimeException)
 
11190
+{
 
11191
+    rtl::OUString sTLName;
 
11192
+    rtl::OUString sBRName;
 
11193
+    GetSelectedCellRange( sTLName, sBRName );
 
11194
+    sal_Int32 nLeft = 0;
 
11195
+    sal_Int32 nTop = 0;
 
11196
+    sal_Int32 nRight = 0;
 
11197
+    sal_Int32 nBottom = 0;
 
11198
+
 
11199
+    uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
 
11200
+    SwVbaTableHelper aTableHelper( xTextTable );
 
11201
+    nLeft = aTableHelper.getTabColIndex( sTLName );
 
11202
+    nTop = aTableHelper.getTabRowIndex( sTLName );
 
11203
+    if( sBRName.getLength() > 0 )
 
11204
+    {
 
11205
+        nRight = aTableHelper.getTabColIndex( sBRName );
 
11206
+        nBottom = aTableHelper.getTabRowIndex( sBRName );
 
11207
+    }
 
11208
+    else
 
11209
+    {
 
11210
+        nRight = nLeft;
 
11211
+        nBottom = nTop;
 
11212
+    }
 
11213
+
 
11214
+    uno::Reference< XCollection > xCol( new SwVbaCells( this, mxContext, xTextTable, nLeft, nTop, nRight, nBottom ) );
 
11215
+    if ( index.hasValue() )
 
11216
+        return xCol->Item( index, uno::Any() );
 
11217
+    return uno::makeAny( xCol );
 
11218
+}
 
11219
+
 
11220
+void SAL_CALL SwVbaSelection::Copy(  ) throw (uno::RuntimeException)
 
11221
+{
 
11222
+    rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Copy"));
 
11223
+    dispatchRequests( mxModel,url );
 
11224
+}
 
11225
+
 
11226
+void SAL_CALL SwVbaSelection::CopyAsPicture(  ) throw (uno::RuntimeException)
 
11227
+{
 
11228
+    // seems not support in Writer
 
11229
+    Copy();
 
11230
+}
 
11231
+
 
11232
+void SAL_CALL SwVbaSelection::Paste(  ) throw (uno::RuntimeException)
 
11233
+{
 
11234
+    rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Paste"));
 
11235
+    dispatchRequests( mxModel,url );
 
11236
+}
 
11237
+
 
11238
+void SAL_CALL SwVbaSelection::Collapse( const uno::Any& Direction ) throw (uno::RuntimeException)
 
11239
+{
 
11240
+    if( word::gotoSelectedObjectAnchor( mxModel ) )
 
11241
+        return;
 
11242
+
 
11243
+    sal_Int32 nDirection = word::WdCollapseDirection::wdCollapseStart;
 
11244
+    if( Direction.hasValue() )
 
11245
+        Direction >>= nDirection;
 
11246
+    
 
11247
+    uno::Reference< text::XTextViewCursor > xTextViewCursor = word::getXTextViewCursor( mxModel );
 
11248
+    if( nDirection == word::WdCollapseDirection::wdCollapseStart )
 
11249
+    {
 
11250
+        // it is inaccurate if current seleciton is multipul cells, so it needs to go to start
 
11251
+        uno::Reference< text::XTextRange > xTextRange = mxTextViewCursor->getStart();
 
11252
+        xTextViewCursor->gotoRange( xTextRange, sal_False );
 
11253
+        xTextViewCursor->collapseToStart();
 
11254
+    }
 
11255
+    else if( nDirection == word::WdCollapseDirection::wdCollapseEnd )
 
11256
+    {
 
11257
+        uno::Reference< text::XTextRange > xTextRange = mxTextViewCursor->getEnd();
 
11258
+        xTextViewCursor->gotoRange( xTextRange, sal_False );
 
11259
+        xTextViewCursor->collapseToEnd();
 
11260
+    }
 
11261
+    else
 
11262
+    {
 
11263
+        throw uno::RuntimeException();
 
11264
+    }
 
11265
+}
 
11266
+
 
11267
+void SAL_CALL SwVbaSelection::WholeStory(  ) throw (uno::RuntimeException)
 
11268
+{
 
11269
+    uno::Reference< text::XText > xText = word::getCurrentXText( mxModel );
 
11270
+    // FIXME: for i#7747,if the first line is a table, it fails to select all the contents in the story.
 
11271
+    // Temporary solution, insert an empty line before the table so that it could select all the contents.
 
11272
+    uno::Reference< container::XEnumerationAccess > xParaAccess( xText, uno::UNO_QUERY_THROW );
 
11273
+    uno::Reference< container::XEnumeration> xParaEnum = xParaAccess->createEnumeration();
 
11274
+    if( xParaEnum->hasMoreElements() )
 
11275
+    {
 
11276
+        uno::Reference< text::XTextTable > xTextTable( xParaEnum->nextElement(), uno::UNO_QUERY );
 
11277
+        if( xTextTable.is() )
 
11278
+        {
 
11279
+            // insert an empty line
 
11280
+            uno::Reference< text::XTextRange > xFirstCellRange = word::getFirstObjectPosition( xText );
 
11281
+            mxTextViewCursor->gotoRange( xFirstCellRange, sal_False );
 
11282
+            rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertPara"));
 
11283
+            dispatchRequests( mxModel,url );
 
11284
+        }
 
11285
+    }
 
11286
+    uno::Reference< text::XTextRange > xStart = xText->getStart();
 
11287
+    uno::Reference< text::XTextRange > xEnd = xText->getEnd();
 
11288
+    mxTextViewCursor->gotoRange( xStart, sal_False );
 
11289
+    mxTextViewCursor->gotoRange( xEnd, sal_True );
 
11290
+}
 
11291
+
 
11292
+::sal_Bool SAL_CALL SwVbaSelection::InRange( const uno::Reference< ::ooo::vba::word::XRange >& Range ) throw (uno::RuntimeException)
 
11293
+{
 
11294
+    return getRange()->InRange( Range );
 
11295
+}
 
11296
+
 
11297
+void SAL_CALL SwVbaSelection::SplitTable(  ) throw (uno::RuntimeException)
 
11298
+{
 
11299
+    if( !IsInTable() )
 
11300
+        throw uno::RuntimeException();
 
11301
+
 
11302
+    SwDocShell* pDocShell = word::getDocShell( mxModel );
 
11303
+    if( pDocShell )
 
11304
+    {
 
11305
+        SwFEShell* pFEShell = pDocShell->GetFEShell();
 
11306
+        if( pFEShell )
 
11307
+        {
 
11308
+            pFEShell->SplitTable( HEADLINE_CNTNTCOPY );
 
11309
+        }
 
11310
+    }
 
11311
+}
 
11312
+
 
11313
+uno::Any SAL_CALL
 
11314
+SwVbaSelection::Paragraphs( const uno::Any& aIndex ) throw (uno::RuntimeException)
 
11315
+{
 
11316
+    // Hacky implementation due to missing api ( and lack of knowledge )
 
11317
+    // we can only support a selection that is a single paragraph 
 
11318
+    if ( !aIndex.hasValue() ) // currently we can't support multiple paragraphs in a selection
 
11319
+       throw uno::RuntimeException(); 
 
11320
+
 
11321
+    sal_Int32 nIndex = 0;
 
11322
+    aIndex >>= nIndex;
 
11323
+
 
11324
+    uno::Any aRet;
 
11325
+
 
11326
+    if ( nIndex != 1 )
 
11327
+       throw uno::RuntimeException(); 
 
11328
+
 
11329
+    uno::Reference< text::XTextRange > xTextRange = mxTextViewCursor->getStart();
 
11330
+    uno::Reference< text::XText > xText = xTextRange->getText();
 
11331
+    uno::Reference< text::XParagraphCursor > xParaCursor( xText->createTextCursor(), uno::UNO_QUERY_THROW );
 
11332
+    xParaCursor->gotoStartOfParagraph( sal_False );
 
11333
+    xParaCursor->gotoStartOfParagraph( sal_True );
 
11334
+
 
11335
+    uno::Reference< text::XTextDocument > xTextDoc( mxModel, uno::UNO_QUERY_THROW );
 
11336
+    uno::Reference< text::XTextRange > xParaRange( xParaCursor, uno::UNO_QUERY_THROW );
 
11337
+    uno::Reference< word::XParagraph > xParagraph = new SwVbaParagraph( mxParent, mxContext, xTextDoc, xParaRange );
 
11338
+
 
11339
+    aRet <<= xParagraph;
 
11340
+    return aRet;
 
11341
+}
 
11342
+
 
11343
 rtl::OUString& 
 
11344
 SwVbaSelection::getServiceImplName()
 
11345
 {
 
11346
diff --git sw/source/ui/vba/vbaselection.hxx sw/source/ui/vba/vbaselection.hxx
 
11347
index 83994f6..c10bf2c 100644
 
11348
--- sw/source/ui/vba/vbaselection.hxx
 
11349
+++ sw/source/ui/vba/vbaselection.hxx
 
11350
@@ -34,11 +34,13 @@
 
11351
 #include <ooo/vba/word/XRange.hpp>
 
11352
 #include <vbahelper/vbahelperinterface.hxx>
 
11353
 #include <com/sun/star/text/XTextViewCursor.hpp>
 
11354
+#include <com/sun/star/text/XTextTable.hpp>
 
11355
 #include <ooo/vba/word/XParagraphFormat.hpp>
 
11356
 #include <ooo/vba/word/XFind.hpp>
 
11357
 #include <ooo/vba/word/XStyle.hpp>
 
11358
 #include <ooo/vba/word/XFont.hpp>
 
11359
 #include <ooo/vba/word/XHeaderFooter.hpp>
 
11360
+#include "wordvbahelper.hxx"
 
11361
 
 
11362
 typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XSelection > SwVbaSelection_BASE;
 
11363
 
 
11364
@@ -49,17 +51,14 @@ private:
 
11365
     css::uno::Reference< css::text::XTextViewCursor > mxTextViewCursor;
 
11366
     css::uno::Reference< ooo::vba::word::XRange > mxRange;
 
11367
 
 
11368
-    enum E_DIRECTION
 
11369
-    {
 
11370
-        MOVE_LEFT = 1,
 
11371
-        MOVE_RIGHT,
 
11372
-        MOVE_UP,
 
11373
-        MOVE_DOWN
 
11374
-    };
 
11375
-
 
11376
 private:
 
11377
-    void NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw ( css::uno::RuntimeException );
 
11378
+    void Move( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend, ooo::vba::word::E_DIRECTION eDirection ) throw (css::uno::RuntimeException);
 
11379
+    void NextCell( sal_Int32 nCount, ooo::vba::word::E_DIRECTION eDirection ) throw ( css::uno::RuntimeException );
 
11380
     css::uno::Reference< css::text::XTextRange > GetSelectedRange() throw ( css::uno::RuntimeException );
 
11381
+    void GetSelectedCellRange( rtl::OUString& sTLName, rtl::OUString& sBRName ) throw ( css::uno::RuntimeException );
 
11382
+    css::uno::Reference< css::text::XTextTable > GetXTextTable() throw ( css::uno::RuntimeException );
 
11383
+    sal_Bool IsInTable() throw ( css::uno::RuntimeException );
 
11384
+    sal_Bool HasSelection() throw ( css::uno::RuntimeException );
 
11385
 
 
11386
 public:
 
11387
        SwVbaSelection( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel ) throw ( css::uno::RuntimeException );
 
11388
@@ -76,6 +75,7 @@ public:
 
11389
     virtual void SAL_CALL MoveRight( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
 
11390
     virtual void SAL_CALL MoveLeft( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
 
11391
     virtual void SAL_CALL MoveDown( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
 
11392
+    virtual void SAL_CALL MoveUp( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
 
11393
     virtual void SAL_CALL TypeParagraph() throw (css::uno::RuntimeException);
 
11394
     virtual void SAL_CALL InsertParagraph() throw (css::uno::RuntimeException);
 
11395
     virtual void SAL_CALL InsertParagraphBefore() throw (css::uno::RuntimeException);
 
11396
@@ -83,8 +83,8 @@ public:
 
11397
     virtual css::uno::Reference< ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() throw (css::uno::RuntimeException);
 
11398
     virtual void SAL_CALL setParagraphFormat( const css::uno::Reference< ooo::vba::word::XParagraphFormat >& rParagraphFormat ) throw (css::uno::RuntimeException);
 
11399
     virtual css::uno::Reference< ooo::vba::word::XFind > SAL_CALL getFind() throw (css::uno::RuntimeException);
 
11400
-    virtual css::uno::Reference< ooo::vba::word::XStyle > SAL_CALL getStyle() throw (css::uno::RuntimeException);
 
11401
-    virtual void SAL_CALL setStyle( const css::uno::Reference< ooo::vba::word::XStyle >& _xStyle ) throw (css::uno::RuntimeException);
 
11402
+    virtual css::uno::Any SAL_CALL getStyle() throw (css::uno::RuntimeException);
 
11403
+    virtual void SAL_CALL setStyle( const css::uno::Any& _xStyle ) throw (css::uno::RuntimeException);
 
11404
     virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
 
11405
     virtual void SAL_CALL TypeBackspace() throw (css::uno::RuntimeException);
 
11406
     virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL GoTo( const css::uno::Any& _what, const css::uno::Any& _which, const css::uno::Any& _count, const css::uno::Any& _name ) throw (css::uno::RuntimeException);
 
11407
@@ -100,6 +100,19 @@ public:
 
11408
     virtual void SAL_CALL setStart( ::sal_Int32 _start ) throw (css::uno::RuntimeException);
 
11409
     virtual ::sal_Int32 SAL_CALL getEnd() throw (css::uno::RuntimeException);
 
11410
     virtual void SAL_CALL setEnd( ::sal_Int32 _end ) throw (css::uno::RuntimeException);
 
11411
+    virtual void SAL_CALL SelectRow() throw (css::uno::RuntimeException);
 
11412
+    virtual void SAL_CALL SelectColumn() throw (css::uno::RuntimeException);
 
11413
+    virtual css::uno::Any SAL_CALL Rows( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
 
11414
+    virtual css::uno::Any SAL_CALL Columns( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
 
11415
+    virtual css::uno::Any SAL_CALL Cells( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
 
11416
+    virtual void SAL_CALL Copy(  ) throw (css::uno::RuntimeException);
 
11417
+    virtual void SAL_CALL CopyAsPicture(  ) throw (css::uno::RuntimeException);
 
11418
+    virtual void SAL_CALL Paste(  ) throw (css::uno::RuntimeException);
 
11419
+    virtual void SAL_CALL Collapse( const css::uno::Any& Direction ) throw (css::uno::RuntimeException);
 
11420
+    virtual void SAL_CALL WholeStory(  ) throw (css::uno::RuntimeException);
 
11421
+    virtual ::sal_Bool SAL_CALL InRange( const css::uno::Reference< ::ooo::vba::word::XRange >& Range ) throw (css::uno::RuntimeException);
 
11422
+    virtual void SAL_CALL SplitTable(  ) throw (css::uno::RuntimeException);
 
11423
+    virtual css::uno::Any SAL_CALL Paragraphs( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
 
11424
 
 
11425
        // XHelperInterface
 
11426
        virtual rtl::OUString& getServiceImplName();
 
11427
diff --git sw/source/ui/vba/vbastyle.cxx sw/source/ui/vba/vbastyle.cxx
 
11428
index 0fe8875..03b27ff 100644
 
11429
--- sw/source/ui/vba/vbastyle.cxx
 
11430
+++ sw/source/ui/vba/vbastyle.cxx
 
11431
@@ -31,15 +31,18 @@
 
11432
 #include "vbastyle.hxx"
 
11433
 #include <ooo/vba/word/WdStyleType.hpp>
 
11434
 #include <com/sun/star/lang/Locale.hpp>
 
11435
+#include <com/sun/star/text/XTextDocument.hpp>
 
11436
 #include <i18npool/mslangid.hxx>
 
11437
 #include "vbafont.hxx"
 
11438
 #include "vbapalette.hxx"
 
11439
+#include "vbaparagraphformat.hxx"
 
11440
+#include "vbastyles.hxx"
 
11441
 
 
11442
 using namespace ::ooo::vba;
 
11443
 using namespace ::com::sun::star;
 
11444
 
 
11445
 
 
11446
-SwVbaStyle::SwVbaStyle( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& _xPropertySet ) throw ( script::BasicErrorException, uno::RuntimeException ) : SwVbaStyle_BASE( xParent, xContext ) , mxStyleProps( _xPropertySet )
 
11447
+SwVbaStyle::SwVbaStyle( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel>& xModel, const uno::Reference< beans::XPropertySet >& _xPropertySet ) throw ( script::BasicErrorException, uno::RuntimeException ) : SwVbaStyle_BASE( xParent, xContext ) , mxModel( xModel ), mxStyleProps( _xPropertySet )
 
11448
 {
 
11449
     mxStyle.set( _xPropertySet, uno::UNO_QUERY_THROW );
 
11450
 }
 
11451
@@ -87,7 +90,7 @@ void SAL_CALL SwVbaStyle::setLanguageID( ::sal_Int32 _languageid ) throw (uno::R
 
11452
         nType = word::WdStyleType::wdStyleTypeParagraph;
 
11453
     else if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.CharacterStyle") ) ) )    
 
11454
         nType = word::WdStyleType::wdStyleTypeCharacter;
 
11455
-    else // if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.NumberingStyle") ) ) )    
 
11456
+    else
 
11457
         nType = word::WdStyleType::wdStyleTypeList;
 
11458
     return nType;
 
11459
 }
 
11460
@@ -99,10 +102,31 @@ SwVbaStyle::getFont() throw ( uno::RuntimeException )
 
11461
     return new SwVbaFont( mxParent, mxContext, aColors.getPalette(), mxStyleProps );
 
11462
 }
 
11463
 
 
11464
-void SwVbaStyle::setStyle( const uno::Reference< beans::XPropertySet >& xTCProps, const uno::Reference< ooo::vba::word::XStyle >& xStyle )throw (uno::RuntimeException)
 
11465
+
 
11466
+void SAL_CALL SwVbaStyle::LinkToListTemplate( const uno::Reference< word::XListTemplate >& /*ListTemplate*/, const uno::Any& /*ListLevelNumber*/ ) throw (uno::RuntimeException)
 
11467
+{
 
11468
+}
 
11469
+
 
11470
+void SwVbaStyle::setStyle( const uno::Reference< beans::XPropertySet >& xParaProps, const uno::Any& rStyle )throw (uno::RuntimeException)
 
11471
 {
 
11472
-    rtl::OUString aStyleType = getOOoStyleTypeFromMSWord( xStyle->getType() );
 
11473
-    xTCProps->setPropertyValue( aStyleType, uno::makeAny( xStyle->getName() ) );
 
11474
+    rtl::OUString sStyle;
 
11475
+    uno::Reference< word::XStyle > xStyle;
 
11476
+    if( rStyle >>= xStyle )
 
11477
+    {
 
11478
+        sStyle = xStyle->getName();
 
11479
+    }
 
11480
+    else
 
11481
+    {
 
11482
+        rStyle >>= sStyle;
 
11483
+    }
 
11484
+
 
11485
+    if( sStyle.getLength() )
 
11486
+    {
 
11487
+        xParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaStyleName") ), uno::makeAny( sStyle ) );
 
11488
+        return;
 
11489
+    }
 
11490
+
 
11491
+    throw uno::RuntimeException();
 
11492
 }
 
11493
 
 
11494
 rtl::OUString SwVbaStyle::getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType )
 
11495
@@ -132,6 +156,115 @@ rtl::OUString SwVbaStyle::getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType )
 
11496
     return aStyleType;
 
11497
 }
 
11498
 
 
11499
+::rtl::OUString SAL_CALL SwVbaStyle::getNameLocal() throw (uno::RuntimeException)
 
11500
+{
 
11501
+    rtl::OUString sNameLocal;
 
11502
+    mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DisplayName") ) ) >>= sNameLocal;
 
11503
+    return sNameLocal;
 
11504
+}
 
11505
+
 
11506
+void SAL_CALL SwVbaStyle::setNameLocal( const ::rtl::OUString& _namelocal ) throw (uno::RuntimeException)
 
11507
+{
 
11508
+    mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DisplayName") ), uno::makeAny( _namelocal ) );
 
11509
+}
 
11510
+
 
11511
+uno::Reference< word::XParagraphFormat > SAL_CALL SwVbaStyle::getParagraphFormat() throw (uno::RuntimeException)
 
11512
+{
 
11513
+    if( word::WdStyleType::wdStyleTypeParagraph == getType() )
 
11514
+    {
 
11515
+        uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW );
 
11516
+        return uno::Reference< word::XParagraphFormat >( new SwVbaParagraphFormat( this, mxContext, xTextDocument, mxStyleProps ) );
 
11517
+    }
 
11518
+    else
 
11519
+    {
 
11520
+        throw uno::RuntimeException();
 
11521
+    }
 
11522
+    return uno::Reference< word::XParagraphFormat >();
 
11523
+}
 
11524
+
 
11525
+::sal_Bool SAL_CALL SwVbaStyle::getAutomaticallyUpdate() throw (uno::RuntimeException)
 
11526
+{
 
11527
+    sal_Bool isAutoUpdate = sal_False;
 
11528
+    mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoUpdate") ) ) >>= isAutoUpdate;
 
11529
+    return isAutoUpdate;
 
11530
+}
 
11531
+
 
11532
+void SAL_CALL SwVbaStyle::setAutomaticallyUpdate( ::sal_Bool _automaticallyupdate ) throw (uno::RuntimeException)
 
11533
+{
 
11534
+    mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoUpdate") ), uno::makeAny( _automaticallyupdate ) );
 
11535
+}
 
11536
+
 
11537
+uno::Any SAL_CALL SwVbaStyle::getBaseStyle() throw (uno::RuntimeException)
 
11538
+{
 
11539
+    // ParentStyle
 
11540
+    rtl::OUString sBaseStyle;
 
11541
+    mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParentStyle") ) ) >>= sBaseStyle;
 
11542
+    if( sBaseStyle.getLength() > 0 )
 
11543
+    {
 
11544
+        uno::Reference< XCollection > xCol( new SwVbaStyles( this, mxContext, mxModel ) );
 
11545
+        return xCol->Item( uno::makeAny( sBaseStyle ), uno::Any() );
 
11546
+    }
 
11547
+    else
 
11548
+    {
 
11549
+        throw uno::RuntimeException();
 
11550
+    }
 
11551
+    return uno::Any();
 
11552
+}
 
11553
+
 
11554
+void SAL_CALL SwVbaStyle::setBaseStyle( const uno::Any& _basestyle ) throw (uno::RuntimeException)
 
11555
+{
 
11556
+    uno::Reference< word::XStyle > xStyle;
 
11557
+    _basestyle >>= xStyle;
 
11558
+    if( xStyle.is() )
 
11559
+    {
 
11560
+        rtl::OUString sBaseStyle = xStyle->getName();
 
11561
+        mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParentStyle") ), uno::makeAny( sBaseStyle ) );
 
11562
+    }
 
11563
+    else
 
11564
+    {
 
11565
+        throw uno::RuntimeException();
 
11566
+    }
 
11567
+}
 
11568
+
 
11569
+uno::Any SAL_CALL SwVbaStyle::getNextParagraphStyle() throw (uno::RuntimeException)
 
11570
+{
 
11571
+    //FollowStyle
 
11572
+    rtl::OUString sFollowStyle;
 
11573
+    mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FollowStyle") ) ) >>= sFollowStyle;
 
11574
+    if( sFollowStyle.getLength() > 0 )
 
11575
+    {
 
11576
+        uno::Reference< XCollection > xCol( new SwVbaStyles( this, mxContext, mxModel ) );
 
11577
+        return xCol->Item( uno::makeAny( sFollowStyle ), uno::Any() );
 
11578
+    }
 
11579
+    else
 
11580
+    {
 
11581
+        throw uno::RuntimeException();
 
11582
+    }
 
11583
+    return uno::Any();
 
11584
+}
 
11585
+
 
11586
+void SAL_CALL SwVbaStyle::setNextParagraphStyle( const uno::Any& _nextparagraphstyle ) throw (uno::RuntimeException)
 
11587
+{
 
11588
+    uno::Reference< word::XStyle > xStyle;
 
11589
+    _nextparagraphstyle >>= xStyle;
 
11590
+    if( xStyle.is() )
 
11591
+    {
 
11592
+        rtl::OUString sFollowStyle = xStyle->getName();
 
11593
+        mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FollowStyle") ), uno::makeAny( sFollowStyle ) );
 
11594
+    }
 
11595
+    else
 
11596
+    {
 
11597
+        throw uno::RuntimeException();
 
11598
+    }
 
11599
+}
 
11600
+
 
11601
+::sal_Int32 SAL_CALL SwVbaStyle::getListLevelNumber() throw (uno::RuntimeException)
 
11602
+{
 
11603
+    sal_Int16 nNumberingLevel = 0;
 
11604
+    mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingLevel") ) ) >>= nNumberingLevel;
 
11605
+    return nNumberingLevel;
 
11606
+}
 
11607
+
 
11608
 rtl::OUString&
 
11609
 SwVbaStyle::getServiceImplName()
 
11610
 {
 
11611
diff --git sw/source/ui/vba/vbastyle.hxx sw/source/ui/vba/vbastyle.hxx
 
11612
index 9a7f349..49eb7e2 100644
 
11613
--- sw/source/ui/vba/vbastyle.hxx
 
11614
+++ sw/source/ui/vba/vbastyle.hxx
 
11615
@@ -36,6 +36,7 @@
 
11616
 #include <com/sun/star/container/XNameContainer.hpp>
 
11617
 #include <com/sun/star/style/XStyle.hpp>
 
11618
 #include <ooo/vba/word/XFont.hpp>
 
11619
+#include <ooo/vba/word/XListTemplate.hpp>
 
11620
 
 
11621
 
 
11622
 typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XStyle > SwVbaStyle_BASE;
 
11623
@@ -43,13 +44,14 @@ typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XStyle > SwVbaStyle_BASE;
 
11624
 class SwVbaStyle : public SwVbaStyle_BASE
 
11625
 {
 
11626
 private:
 
11627
+    css::uno::Reference< css::frame::XModel > mxModel;
 
11628
        css::uno::Reference< css::beans::XPropertySet > mxStyleProps;
 
11629
        css::uno::Reference< css::style::XStyle > mxStyle;
 
11630
 public:
 
11631
-       SwVbaStyle( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet ) throw ( css::script::BasicErrorException, css::uno::RuntimeException );
 
11632
+    SwVbaStyle( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet ) throw ( css::script::BasicErrorException, css::uno::RuntimeException );
 
11633
        virtual ~SwVbaStyle(){}
 
11634
 
 
11635
-    static void setStyle( const css::uno::Reference< css::beans::XPropertySet >& xTCProps, const css::uno::Reference< ooo::vba::word::XStyle >& xStyle ) throw (css::uno::RuntimeException);
 
11636
+    static void setStyle( const css::uno::Reference< css::beans::XPropertySet >& xParaProps, const css::uno::Any& xStyle ) throw (css::uno::RuntimeException);
 
11637
     static rtl::OUString getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType );
 
11638
     static sal_Int32 getLanguageID( const css::uno::Reference< css::beans::XPropertySet >& xTCProps ) throw (css::uno::RuntimeException);
 
11639
     static void setLanguageID( const css::uno::Reference< css::beans::XPropertySet >& xTCProps, sal_Int32 _languageid ) throw (css::uno::RuntimeException);
 
11640
@@ -61,6 +63,20 @@ public:
 
11641
     virtual void SAL_CALL setLanguageID( ::sal_Int32 _languageid ) throw (css::uno::RuntimeException);
 
11642
     virtual ::sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException);
 
11643
     virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
 
11644
+    virtual void SAL_CALL LinkToListTemplate( const css::uno::Reference< ooo::vba::word::XListTemplate >& ListTemplate, const css::uno::Any& ListLevelNumber ) throw (css::uno::RuntimeException);
 
11645
+    virtual ::rtl::OUString SAL_CALL getNameLocal() throw (css::uno::RuntimeException);
 
11646
+    virtual void SAL_CALL setNameLocal( const ::rtl::OUString& _namelocal ) throw (css::uno::RuntimeException);
 
11647
+    virtual css::uno::Reference< ::ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() throw (css::uno::RuntimeException);
 
11648
+    virtual ::sal_Bool SAL_CALL getAutomaticallyUpdate() throw (css::uno::RuntimeException);
 
11649
+    virtual void SAL_CALL setAutomaticallyUpdate( ::sal_Bool _automaticallyupdate ) throw (css::uno::RuntimeException);
 
11650
+    virtual css::uno::Any SAL_CALL getBaseStyle() throw (css::uno::RuntimeException);
 
11651
+    virtual void SAL_CALL setBaseStyle( const css::uno::Any& _basestyle ) throw (css::uno::RuntimeException);
 
11652
+    virtual css::uno::Any SAL_CALL getNextParagraphStyle() throw (css::uno::RuntimeException);
 
11653
+    virtual void SAL_CALL setNextParagraphStyle( const css::uno::Any& _nextparagraphstyle ) throw (css::uno::RuntimeException);
 
11654
+    virtual ::sal_Int32 SAL_CALL getListLevelNumber() throw (css::uno::RuntimeException);
 
11655
+
 
11656
+    //XDefaultProperty
 
11657
+    virtual ::rtl::OUString SAL_CALL getDefaultPropertyName(  ) throw (css::uno::RuntimeException) { return rtl::OUString::createFromAscii("Name"); }
 
11658
 
 
11659
        // XHelperInterface
 
11660
        virtual rtl::OUString& getServiceImplName();
 
11661
diff --git sw/source/ui/vba/vbastyles.cxx sw/source/ui/vba/vbastyles.cxx
 
11662
index c13ba74..3ca80e8 100644
 
11663
--- sw/source/ui/vba/vbastyles.cxx
 
11664
+++ sw/source/ui/vba/vbastyles.cxx
 
11665
@@ -47,7 +47,7 @@ struct BuiltinStyleTable
 
11666
     sal_Int32 wdStyleType;
 
11667
 };
 
11668
 
 
11669
-const BuiltinStyleTable aBuiltinStyleTable[] =
 
11670
+static const BuiltinStyleTable aBuiltinStyleTable[] =
 
11671
 {
 
11672
     { word::WdBuiltinStyle::wdStyleBlockQuotation, "", word::WdStyleType::wdStyleTypeParagraph },
 
11673
     { word::WdBuiltinStyle::wdStyleBodyText, "Text body", word::WdStyleType::wdStyleTypeParagraph },
 
11674
@@ -155,6 +155,18 @@ const BuiltinStyleTable aBuiltinStyleTable[] =
 
11675
     { 0, 0, 0 }
 
11676
 };
 
11677
 
 
11678
+struct MSOStyleNameTable
 
11679
+{
 
11680
+    const sal_Char* pMSOStyleName;
 
11681
+    const sal_Char* pOOoStyleName;
 
11682
+    const sal_Char* pOOoStyleType;
 
11683
+};
 
11684
+
 
11685
+static const MSOStyleNameTable aMSOStyleNameTable[] =
 
11686
+{
 
11687
+    { "Normal", "Default", "ParagraphStyles" },
 
11688
+    { 0, 0, 0 }
 
11689
+};
 
11690
 
 
11691
 static uno::Sequence< rtl::OUString > getStyleTypes()
 
11692
 {
 
11693
@@ -168,38 +180,21 @@ static uno::Sequence< rtl::OUString > getStyleTypes()
 
11694
 
 
11695
 typedef ::cppu::WeakImplHelper1< container::XEnumeration > StyleEnumeration_BASE;
 
11696
 typedef ::cppu::WeakImplHelper3< container::XNameAccess, container::XIndexAccess, container::XEnumerationAccess > StyleCollectionHelper_BASE;
 
11697
-/*
 
11698
-class StylesEnumeration : public StyleEnumeration_BASE
 
11699
-{
 
11700
-public:
 
11701
-       StylesEnumeration( const SheetMap& sMap ) : mSheetMap( sMap ), mIt( mSheetMap.begin() ) {}
 
11702
-       virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException)
 
11703
-       {
 
11704
-               return ( mIt != mSheetMap.end() );
 
11705
-       }
 
11706
-       virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
 
11707
-       {
 
11708
-               if ( !hasMoreElements() )
 
11709
-                       throw container::NoSuchElementException();
 
11710
-               uno::Reference< sheet::XSpreadsheet > xSheet( *mIt++ );
 
11711
-               return uno::makeAny( xSheet ) ;
 
11712
-       }
 
11713
-};
 
11714
-*/
 
11715
+
 
11716
 class StyleCollectionHelper : public StyleCollectionHelper_BASE
 
11717
 {
 
11718
 private:
 
11719
     uno::Reference< frame::XModel > mxModel;
 
11720
-    uno::Reference< container::XNameAccess > mxStyleFamilies;
 
11721
-    uno::Reference< container::XNameContainer > mxCurrentStyleFamily;
 
11722
+    uno::Reference< container::XNameAccess > mxParaStyles;
 
11723
     uno::Any cachePos;
 
11724
 public:
 
11725
        StyleCollectionHelper( const uno::Reference< frame::XModel >& _xModel ) : mxModel( _xModel )
 
11726
     {
 
11727
+        // we only concern about the Paragraph styles
 
11728
         uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( _xModel, uno::UNO_QUERY_THROW);
 
11729
-        mxStyleFamilies = xStyleSupplier->getStyleFamilies();
 
11730
+        uno::Reference< container::XNameAccess > xStyleFamilies = xStyleSupplier->getStyleFamilies();
 
11731
+        mxParaStyles.set( xStyleFamilies->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") ) ), uno::UNO_QUERY_THROW  );
 
11732
     }
 
11733
-    uno::Reference< container::XNameContainer > getCurrentStyleFamily(){ return mxCurrentStyleFamily; }
 
11734
        // XElementAccess
 
11735
        virtual uno::Type SAL_CALL getElementType(  ) throw (uno::RuntimeException) { return  style::XStyle::static_type(0); }
 
11736
        virtual ::sal_Bool SAL_CALL hasElements(  ) throw (uno::RuntimeException) { return getCount() > 0; }
 
11737
@@ -212,32 +207,42 @@ public:
 
11738
        }
 
11739
        virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw (uno::RuntimeException)
 
11740
        {
 
11741
-               uno::Sequence< rtl::OUString > sNames( getCount() );
 
11742
-               rtl::OUString* pString = sNames.getArray();
 
11743
-        uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
 
11744
-        sal_Int32 nCount = 0;
 
11745
-        for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
 
11746
+        return mxParaStyles->getElementNames();
 
11747
+    }
 
11748
+    virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
 
11749
+    {
 
11750
+        // search in the MSOStyleName table first
 
11751
+        for( const MSOStyleNameTable* pTable = aMSOStyleNameTable; pTable->pMSOStyleName != NULL; pTable++ )
 
11752
         {
 
11753
-            uno::Reference< container::XNameAccess > xNameAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
 
11754
-            uno::Sequence< rtl::OUString > sElementNames = xNameAccess->getElementNames();
 
11755
-            for( sal_Int32 j = 0; j < sElementNames.getLength(); j++ )
 
11756
+            if( aName.equalsIgnoreAsciiCaseAscii( pTable->pMSOStyleName ) )
 
11757
             {
 
11758
-                pString[nCount++] = sElementNames[j];
 
11759
+                //Found it
 
11760
+                rtl::OUString sStyleName = rtl::OUString::createFromAscii( pTable->pOOoStyleName );
 
11761
+                if( mxParaStyles->hasByName( sStyleName ) )
 
11762
+                {
 
11763
+                    cachePos = mxParaStyles->getByName( sStyleName );
 
11764
+                    return sal_True;
 
11765
+                }
 
11766
+                return sal_False;
 
11767
             }
 
11768
         }
 
11769
-               return sNames;
 
11770
-       }
 
11771
-       virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
 
11772
-       {
 
11773
-        uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
 
11774
-        for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
 
11775
+
 
11776
+        if( mxParaStyles->hasByName( aName ) )
 
11777
+        {
 
11778
+            cachePos = mxParaStyles->getByName( aName );
 
11779
+            return sal_True;
 
11780
+        }
 
11781
+        else
 
11782
         {
 
11783
-            uno::Reference< container::XNameAccess > xNameAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
 
11784
-            if( xNameAccess->hasByName( aName ) )
 
11785
+            uno::Sequence< rtl::OUString > sElementNames = mxParaStyles->getElementNames();
 
11786
+            for( sal_Int32 j = 0; j < sElementNames.getLength(); j++ )
 
11787
             {
 
11788
-                cachePos = xNameAccess->getByName( aName );
 
11789
-                mxCurrentStyleFamily.set( xNameAccess, uno::UNO_QUERY_THROW );
 
11790
-                return sal_True;
 
11791
+                rtl::OUString aStyleName = sElementNames[j];
 
11792
+                if( aStyleName.equalsIgnoreAsciiCase( aName ) )
 
11793
+                {
 
11794
+                    cachePos = mxParaStyles->getByName( aStyleName );
 
11795
+                    return sal_True;
 
11796
+                }
 
11797
             }
 
11798
         }
 
11799
         return sal_False;
 
11800
@@ -246,44 +251,43 @@ public:
 
11801
        // XIndexAccess
 
11802
        virtual ::sal_Int32 SAL_CALL getCount(  ) throw (uno::RuntimeException)
 
11803
     { 
 
11804
-        uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
 
11805
-        sal_Int32 nCount = 0;
 
11806
-        for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
 
11807
-        {
 
11808
-            uno::Reference< container::XIndexAccess > xIndexAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
 
11809
-            nCount += xIndexAccess->getCount();
 
11810
-        }
 
11811
-        return nCount;
 
11812
+        uno::Reference< container::XIndexAccess > xIndexAccess( mxParaStyles, uno::UNO_QUERY_THROW );
 
11813
+        return xIndexAccess->getCount();
 
11814
     }  
 
11815
        virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
 
11816
        {
 
11817
                if ( Index < 0 || Index >= getCount() )
 
11818
                        throw lang::IndexOutOfBoundsException();
 
11819
        
 
11820
-        // FIXME: need to make a alphabetically sorted list of style names
 
11821
-        uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
 
11822
-        for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
 
11823
-        {
 
11824
-            uno::Reference< container::XIndexAccess > xIndexAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
 
11825
-            sal_Int32 nCount = xIndexAccess->getCount();
 
11826
-            if( Index >= nCount )
 
11827
-                Index -= nCount;
 
11828
-            else
 
11829
-            {
 
11830
-                mxCurrentStyleFamily.set( xIndexAccess, uno::UNO_QUERY_THROW );
 
11831
-                return xIndexAccess->getByIndex( Index );
 
11832
-            }
 
11833
-        }
 
11834
-               throw lang::IndexOutOfBoundsException();
 
11835
+        uno::Reference< container::XIndexAccess > xIndexAccess( mxParaStyles, uno::UNO_QUERY_THROW );
 
11836
+        return xIndexAccess->getByIndex( Index );
 
11837
        }
 
11838
        // XEnumerationAccess
 
11839
        virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration(  ) throw (uno::RuntimeException)
 
11840
        {
 
11841
-        // FIXME:
 
11842
         throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
11843
        }
 
11844
 };
 
11845
 
 
11846
+class StylesEnumWrapper : public EnumerationHelper_BASE
 
11847
+{
 
11848
+    SwVbaStyles* pStyles;
 
11849
+    sal_Int32 nIndex;
 
11850
+public:
 
11851
+    StylesEnumWrapper( SwVbaStyles* _pStyles ) : pStyles( _pStyles ), nIndex( 1 ) {}
 
11852
+    virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException)
 
11853
+    {
 
11854
+        return ( nIndex <= pStyles->getCount() );
 
11855
+    }
 
11856
+
 
11857
+    virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
 
11858
+    {
 
11859
+        if ( nIndex <= pStyles->getCount() )
 
11860
+            return pStyles->Item( uno::makeAny( nIndex++ ), uno::Any() );
 
11861
+        throw container::NoSuchElementException();
 
11862
+    }
 
11863
+};
 
11864
+
 
11865
 SwVbaStyles::SwVbaStyles( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ) throw ( script::BasicErrorException ) : SwVbaStyles_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new StyleCollectionHelper( xModel )  ) ), mxModel( xModel )
 
11866
 {
 
11867
     mxMSF.set( mxModel, uno::UNO_QUERY_THROW );
 
11868
@@ -293,7 +297,7 @@ uno::Any
 
11869
 SwVbaStyles::createCollectionObject(const uno::Any& aObject)
 
11870
 {
 
11871
     uno::Reference< beans::XPropertySet > xStyleProp( aObject, uno::UNO_QUERY_THROW );
 
11872
-    return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProp ) ) );
 
11873
+    return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, mxModel, xStyleProp ) ) );
 
11874
 }
 
11875
 
 
11876
 uno::Type SAL_CALL 
 
11877
@@ -305,7 +309,7 @@ SwVbaStyles::getElementType() throw (uno::RuntimeException)
 
11878
 uno::Reference< container::XEnumeration > SAL_CALL 
 
11879
 SwVbaStyles::createEnumeration() throw (uno::RuntimeException)
 
11880
 {
 
11881
-    throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
 
11882
+    return new StylesEnumWrapper( this );
 
11883
 }
 
11884
 
 
11885
 uno::Any SAL_CALL
 
11886
@@ -322,7 +326,8 @@ SwVbaStyles::Item( const uno::Any& Index1, const uno::Any& Index2 ) throw (uno::
 
11887
                 rtl::OUString aStyleName = rtl::OUString::createFromAscii( pTable->pOOoStyleName );
 
11888
                 if( aStyleName.getLength() > 0 )
 
11889
                 {
 
11890
-                    rtl::OUString aStyleType = SwVbaStyle::getOOoStyleTypeFromMSWord( pTable->wdStyleType );
 
11891
+                    //rtl::OUString aStyleType = SwVbaStyle::getOOoStyleTypeFromMSWord( pTable->wdStyleType );
 
11892
+                    rtl::OUString aStyleType;
 
11893
                     switch( pTable->wdStyleType )
 
11894
                     {
 
11895
                         case word::WdStyleType::wdStyleTypeParagraph:
 
11896
@@ -338,7 +343,8 @@ SwVbaStyles::Item( const uno::Any& Index1, const uno::Any& Index2 ) throw (uno::
 
11897
                         }
 
11898
                         case word::WdStyleType::wdStyleTypeList:
 
11899
                         {
 
11900
-                            aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") );
 
11901
+                            // should use Paragraph style and set the property "NumberingStyleName"
 
11902
+                            aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") );
 
11903
                             break;
 
11904
                         }
 
11905
                         default:
 
11906
@@ -347,7 +353,12 @@ SwVbaStyles::Item( const uno::Any& Index1, const uno::Any& Index2 ) throw (uno::
 
11907
                     uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxModel, uno::UNO_QUERY_THROW);
 
11908
                     uno::Reference< container::XNameAccess > xStylesAccess( xStyleSupplier->getStyleFamilies()->getByName( aStyleType ), uno::UNO_QUERY_THROW );
 
11909
                     uno::Reference< beans::XPropertySet > xStyleProps( xStylesAccess->getByName( aStyleName ), uno::UNO_QUERY_THROW );
 
11910
-                    return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProps ) ) );
 
11911
+                    // set the property "NumberingStyleName" if it is a listbullet
 
11912
+                    if( pTable->wdStyleType == word::WdStyleType::wdStyleTypeList )
 
11913
+                    {
 
11914
+                        xStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyleName") ), uno::makeAny( aStyleName ) );
 
11915
+                    }
 
11916
+                    return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, mxModel, xStyleProps ) ) );
 
11917
                 }
 
11918
                 else
 
11919
                 {
 
11920
diff --git sw/source/ui/vba/vbasystem.cxx sw/source/ui/vba/vbasystem.cxx
 
11921
index 3a16e23..7466894 100644
 
11922
--- sw/source/ui/vba/vbasystem.cxx
 
11923
+++ sw/source/ui/vba/vbasystem.cxx
 
11924
@@ -37,6 +37,13 @@
 
11925
 #include <tools/urlobj.hxx>
 
11926
 #include <tools/string.hxx>
 
11927
 
 
11928
+#ifdef WNT
 
11929
+#include <tools/prewin.h>
 
11930
+#include <windows.h>
 
11931
+#include <tools/postwin.h>
 
11932
+#include <tchar.h>
 
11933
+#endif
 
11934
+
 
11935
 using namespace ::ooo::vba;
 
11936
 using namespace ::com::sun::star;
 
11937
 
 
11938
@@ -55,13 +62,79 @@ void PrivateProfileStringListener::Initialize( const rtl::OUString& rFileName, c
 
11939
     maGroupName = rGroupName;
 
11940
     maKey = rKey;
 
11941
 }
 
11942
+#ifdef WNT
 
11943
+void lcl_getRegKeyInfo( const ByteString& sKeyInfo, HKEY& hBaseKey, ByteString& sSubKey )
 
11944
+{
 
11945
+    sal_Int32 nBaseKeyIndex = sKeyInfo.Search('\\');
 
11946
+    if( nBaseKeyIndex > 0 )
 
11947
+    {
 
11948
+        ByteString sBaseKey = sKeyInfo.Copy( 0, nBaseKeyIndex );
 
11949
+        sSubKey = sKeyInfo.Copy( nBaseKeyIndex + 1 );        
 
11950
+        if( sBaseKey.Equals("HKEY_CURRENT_USER") )
 
11951
+        {
 
11952
+            hBaseKey = HKEY_CURRENT_USER;
 
11953
+        }
 
11954
+        else if( sBaseKey.Equals("HKEY_LOCAL_MACHINE") )
 
11955
+        {
 
11956
+            hBaseKey = HKEY_LOCAL_MACHINE;
 
11957
+        }
 
11958
+        else if( sBaseKey.Equals("HKEY_CLASSES_ROOT") )
 
11959
+        {
 
11960
+            hBaseKey = HKEY_CLASSES_ROOT;
 
11961
+        }
 
11962
+        else if( sBaseKey.Equals("HKEY_USERS") )
 
11963
+        {
 
11964
+            hBaseKey = HKEY_USERS;
 
11965
+        }
 
11966
+        else if( sBaseKey.Equals("HKEY_CURRENT_CONFIG") )
 
11967
+        {
 
11968
+            hBaseKey = HKEY_CURRENT_CONFIG;
 
11969
+        }
 
11970
+    }
 
11971
+}
 
11972
+#endif
 
11973
 
 
11974
 uno::Any PrivateProfileStringListener::getValueEvent()
 
11975
 {
 
11976
     // get the private profile string
 
11977
-    Config aCfg( maFileName );
 
11978
-    aCfg.SetGroup( maGroupName );
 
11979
-    rtl::OUString sValue = String( aCfg.ReadKey( maKey ), RTL_TEXTENCODING_DONTKNOW );
 
11980
+    rtl::OUString sValue;
 
11981
+    if(maFileName.getLength())
 
11982
+    {
 
11983
+        // get key/value from a file
 
11984
+        Config aCfg( maFileName );
 
11985
+        aCfg.SetGroup( maGroupName );
 
11986
+        sValue = String( aCfg.ReadKey( maKey ), RTL_TEXTENCODING_DONTKNOW );
 
11987
+    }
 
11988
+    else
 
11989
+    {
 
11990
+        // get key/value from windows register
 
11991
+#ifdef WNT
 
11992
+        HKEY hBaseKey = NULL;
 
11993
+        ByteString sSubKey;
 
11994
+        sal_Int32 nBaseKeyIndex = maGroupName.Search('\\');
 
11995
+        lcl_getRegKeyInfo( maGroupName, hBaseKey, sSubKey );
 
11996
+        if( hBaseKey != NULL )
 
11997
+        {
 
11998
+            HKEY hKey = NULL;
 
11999
+            LONG lResult;
 
12000
+            LPCTSTR lpSubKey = TEXT( sSubKey.GetBuffer());
 
12001
+            TCHAR szBuffer[1024];
 
12002
+            DWORD cbData = sizeof( szBuffer );
 
12003
+            lResult = RegOpenKeyEx( hBaseKey, lpSubKey, 0, KEY_QUERY_VALUE, &hKey );
 
12004
+            if( ERROR_SUCCESS == lResult )
 
12005
+            {
 
12006
+                LPCTSTR lpValueName = TEXT(maKey.GetBuffer());
 
12007
+                lResult = RegQueryValueEx( hKey, lpValueName, NULL, NULL, (LPBYTE)szBuffer, &cbData );
 
12008
+                RegCloseKey( hKey );
 
12009
+                sValue = rtl::OUString::createFromAscii(szBuffer);
 
12010
+            }
 
12011
+        }
 
12012
+        
 
12013
+        return uno::makeAny( sValue );
 
12014
+#endif
 
12015
+        throw uno::RuntimeException( rtl::OUString( 
 
12016
+                        RTL_CONSTASCII_USTRINGPARAM("Only support on Windows")), uno::Reference< uno::XInterface >() );
 
12017
+    }    
 
12018
 
 
12019
     return uno::makeAny( sValue );
 
12020
 }
 
12021
@@ -69,12 +142,44 @@ uno::Any PrivateProfileStringListener::getValueEvent()
 
12022
 void PrivateProfileStringListener::setValueEvent( const css::uno::Any& value )
 
12023
 {
 
12024
     // set the private profile string
 
12025
-    Config aCfg( maFileName );
 
12026
-    aCfg.SetGroup( maGroupName );
 
12027
-
 
12028
     rtl::OUString aValue;
 
12029
     value >>= aValue;
 
12030
-    aCfg.WriteKey( maKey, ByteString( aValue.getStr(), RTL_TEXTENCODING_DONTKNOW ) );
 
12031
+    if(maFileName.getLength())
 
12032
+    {
 
12033
+        // set value into a file
 
12034
+        Config aCfg( maFileName );
 
12035
+        aCfg.SetGroup( maGroupName );    
 
12036
+        aCfg.WriteKey( maKey, ByteString( aValue.getStr(), RTL_TEXTENCODING_DONTKNOW ) );
 
12037
+    }
 
12038
+    else
 
12039
+    {
 
12040
+        //set value into windows register
 
12041
+#ifdef WNT
 
12042
+        HKEY hBaseKey = NULL;
 
12043
+        ByteString sSubKey;
 
12044
+        sal_Int32 nBaseKeyIndex = maGroupName.Search('\\');
 
12045
+        lcl_getRegKeyInfo( maGroupName, hBaseKey, sSubKey );
 
12046
+        if( hBaseKey != NULL )
 
12047
+        {
 
12048
+            HKEY hKey = NULL;
 
12049
+            LONG lResult;
 
12050
+            LPCTSTR lpSubKey = TEXT( sSubKey.GetBuffer());            
 
12051
+            lResult = RegCreateKeyEx( hBaseKey, lpSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL );
 
12052
+            if( ERROR_SUCCESS == lResult )
 
12053
+            {
 
12054
+                LPCTSTR szValue = TEXT( rtl::OUStringToOString( aValue, RTL_TEXTENCODING_UTF8 ).getStr() );
 
12055
+                DWORD cbData = sizeof(TCHAR) * (_tcslen(szValue) + 1);
 
12056
+                LPCTSTR lpValueName = TEXT(maKey.GetBuffer());                 
 
12057
+                lResult = RegSetValueEx( hKey, lpValueName, NULL, REG_SZ, (LPBYTE)szValue, cbData );
 
12058
+                RegCloseKey( hKey );
 
12059
+            }
 
12060
+        }
 
12061
+        return;
 
12062
+#endif
 
12063
+        throw uno::RuntimeException( rtl::OUString( 
 
12064
+                        RTL_CONSTASCII_USTRINGPARAM("Not implemented")), uno::Reference< uno::XInterface >() );
 
12065
+    }
 
12066
+    
 
12067
 }
 
12068
 
 
12069
 SwVbaSystem::SwVbaSystem( uno::Reference<uno::XComponentContext >& xContext ): SwVbaSystem_BASE( uno::Reference< XHelperInterface >(), xContext )
 
12070
@@ -154,19 +259,19 @@ SwVbaSystem::setCursor( sal_Int32 _cursor ) throw (uno::RuntimeException)
 
12071
 uno::Any SAL_CALL 
 
12072
 SwVbaSystem::PrivateProfileString( const rtl::OUString& rFilename, const rtl::OUString& rSection, const rtl::OUString& rKey ) throw ( uno::RuntimeException )
 
12073
 {
 
12074
-    if( rFilename.getLength() == 0 )
 
12075
-        throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access document from shell" ) ), uno::Reference< uno::XInterface >() );
 
12076
-
 
12077
     // FIXME: need to detect whether it is a relative file path
 
12078
     // we need to detect if this is a URL, if not then assume its a file path
 
12079
     rtl::OUString sFileUrl;
 
12080
-    INetURLObject aObj;
 
12081
-       aObj.SetURL( rFilename );
 
12082
-       bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
 
12083
-       if ( bIsURL )
 
12084
-               sFileUrl = rFilename;
 
12085
-       else
 
12086
-               osl::FileBase::getFileURLFromSystemPath( rFilename, sFileUrl);
 
12087
+    if( rFilename.getLength() )
 
12088
+    {
 
12089
+        INetURLObject aObj;
 
12090
+        aObj.SetURL( rFilename );
 
12091
+        bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
 
12092
+        if ( bIsURL )
 
12093
+            sFileUrl = rFilename;
 
12094
+        else
 
12095
+            osl::FileBase::getFileURLFromSystemPath( rFilename, sFileUrl);
 
12096
+    }    
 
12097
 
 
12098
     ByteString aGroupName = ByteString( rSection.getStr(), RTL_TEXTENCODING_DONTKNOW);
 
12099
     ByteString aKey = ByteString( rKey.getStr(), RTL_TEXTENCODING_DONTKNOW);
 
12100
diff --git sw/source/ui/vba/vbatable.cxx sw/source/ui/vba/vbatable.cxx
 
12101
index 7598dfc..1ff9294 100644
 
12102
--- sw/source/ui/vba/vbatable.cxx
 
12103
+++ sw/source/ui/vba/vbatable.cxx
 
12104
@@ -9,11 +9,13 @@
 
12105
 #include <com/sun/star/container/XNamed.hpp>
 
12106
 #include "vbaborders.hxx"
 
12107
 #include "vbapalette.hxx"
 
12108
+#include "vbarows.hxx"
 
12109
+#include "vbacolumns.hxx"
 
12110
 
 
12111
 using namespace ::ooo::vba;
 
12112
 using namespace ::com::sun::star;
 
12113
 
 
12114
-SwVbaTable::SwVbaTable(  const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const  uno::Reference< css::text::XTextTable >& xTextTable) throw ( uno::RuntimeException ) : SwVbaTable_BASE( rParent, rContext ), mxTextDocument( rDocument )
 
12115
+SwVbaTable::SwVbaTable(  const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rDocument, const  uno::Reference< text::XTextTable >& xTextTable) throw ( uno::RuntimeException ) : SwVbaTable_BASE( rParent, rContext ), mxTextDocument( rDocument )
 
12116
 {
 
12117
     mxTextTable.set( xTextTable, uno::UNO_QUERY_THROW );
 
12118
 }
 
12119
@@ -75,6 +77,26 @@ SwVbaTable::Borders( const uno::Any& index ) throw (uno::RuntimeException)
 
12120
     return uno::makeAny( xCol );
 
12121
 }
 
12122
 
 
12123
+uno::Any SAL_CALL
 
12124
+SwVbaTable::Rows( const uno::Any& index ) throw (uno::RuntimeException)
 
12125
+{
 
12126
+    uno::Reference< table::XTableRows > xTableRows( mxTextTable->getRows(), uno::UNO_QUERY_THROW );
 
12127
+    uno::Reference< XCollection > xCol( new SwVbaRows( this, mxContext, mxTextTable, xTableRows ) );
 
12128
+    if ( index.hasValue() )
 
12129
+        return xCol->Item( index, uno::Any() );
 
12130
+    return uno::makeAny( xCol );
 
12131
+}
 
12132
+
 
12133
+uno::Any SAL_CALL
 
12134
+SwVbaTable::Columns( const uno::Any& index ) throw (uno::RuntimeException)
 
12135
+{
 
12136
+    uno::Reference< table::XTableColumns > xTableColumns( mxTextTable->getColumns(), uno::UNO_QUERY_THROW );
 
12137
+    uno::Reference< XCollection > xCol( new SwVbaColumns( this, mxContext, mxTextTable, xTableColumns ) );
 
12138
+    if ( index.hasValue() )
 
12139
+        return xCol->Item( index, uno::Any() );
 
12140
+    return uno::makeAny( xCol );
 
12141
+}
 
12142
+
 
12143
 // XHelperInterface
 
12144
 rtl::OUString& 
 
12145
 SwVbaTable::getServiceImplName()
 
12146
diff --git sw/source/ui/vba/vbatable.hxx sw/source/ui/vba/vbatable.hxx
 
12147
index c28a3cd..1348c60 100644
 
12148
--- sw/source/ui/vba/vbatable.hxx
 
12149
+++ sw/source/ui/vba/vbatable.hxx
 
12150
@@ -21,6 +21,9 @@ public:
 
12151
     virtual css::uno::Reference< ::ooo::vba::word::XRange > SAL_CALL ConvertToText( const css::uno::Any& Separator, const css::uno::Any& NestedTables ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
 
12152
     virtual rtl::OUString SAL_CALL getName( ) throw (css::uno::RuntimeException);
 
12153
     virtual css::uno::Any SAL_CALL Borders( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
 
12154
+    virtual css::uno::Any SAL_CALL Rows( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
 
12155
+    virtual css::uno::Any SAL_CALL Columns( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
 
12156
+
 
12157
     // XHelperInterface
 
12158
     virtual rtl::OUString& getServiceImplName();
 
12159
     virtual css::uno::Sequence<rtl::OUString> getServiceNames();  
 
12160
diff --git sw/source/ui/vba/vbatablehelper.cxx sw/source/ui/vba/vbatablehelper.cxx
 
12161
new file mode 100644
 
12162
index 0000000..2fcae2f
 
12163
--- /dev/null
 
12164
+++ sw/source/ui/vba/vbatablehelper.cxx
 
12165
@@ -0,0 +1,306 @@
 
12166
+/*************************************************************************
 
12167
+ *
 
12168
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
12169
+ * 
 
12170
+ * Copyright 2008 by Sun Microsystems, Inc.
 
12171
+ *
 
12172
+ * OpenOffice.org - a multi-platform office productivity suite
 
12173
+ *
 
12174
+ * $RCSfile: 
 
12175
+ * $Revision: 
 
12176
+ *
 
12177
+ * This file is part of OpenOffice.org.
 
12178
+ *
 
12179
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
12180
+ * it under the terms of the GNU Lesser General Public License version 3
 
12181
+ * only, as published by the Free Software Foundation.
 
12182
+ *
 
12183
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
12184
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12185
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12186
+ * GNU Lesser General Public License version 3 for more details
 
12187
+ * (a copy is included in the LICENSE file that accompanied this code).
 
12188
+ *
 
12189
+ * You should have received a copy of the GNU Lesser General Public License
 
12190
+ * version 3 along with OpenOffice.org.  If not, see
 
12191
+ * <http://www.openoffice.org/license.html>
 
12192
+ * for a copy of the LGPLv3 License.
 
12193
+ *
 
12194
+ ************************************************************************/
 
12195
+#include "vbatablehelper.hxx"
 
12196
+#include <swtable.hxx>
 
12197
+#include <unotbl.hxx>
 
12198
+#include <docsh.hxx>
 
12199
+
 
12200
+using namespace ::com::sun::star;
 
12201
+using namespace ::ooo::vba;
 
12202
+
 
12203
+#define UNO_TABLE_COLUMN_SUM    10000
 
12204
+
 
12205
+SwVbaTableHelper::SwVbaTableHelper( const uno::Reference< text::XTextTable >& xTextTable ) throw (uno::RuntimeException) : mxTextTable( xTextTable ), pDoc( NULL )
 
12206
+{
 
12207
+    pTable = GetSwTable( mxTextTable );
 
12208
+}
 
12209
+
 
12210
+SwTable* SwVbaTableHelper::GetSwTable( const uno::Reference< text::XTextTable >& xTextTable ) throw (uno::RuntimeException)
 
12211
+{
 
12212
+    uno::Reference< lang::XUnoTunnel > xTunnel( xTextTable, uno::UNO_QUERY_THROW );
 
12213
+    SwXTextTable* pXTextTable = reinterpret_cast< SwXTextTable * >( sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething(SwXTextTable::getUnoTunnelId())));
 
12214
+    if( !pXTextTable )
 
12215
+        throw uno::RuntimeException();
 
12216
+        
 
12217
+    SwFrmFmt* pFrmFmt = pXTextTable->GetFrmFmt();
 
12218
+    if( !pFrmFmt )
 
12219
+        throw uno::RuntimeException();
 
12220
+    
 
12221
+    SwTable* pTable = SwTable::FindTable( pFrmFmt );
 
12222
+    return pTable;
 
12223
+}
 
12224
+
 
12225
+sal_Int32 SwVbaTableHelper::getTabColumnsCount( sal_Int32 nRowIndex ) throw (uno::RuntimeException)
 
12226
+{
 
12227
+    sal_Int32 nRet = 0;
 
12228
+    if(!pTable->IsTblComplex())
 
12229
+    {
 
12230
+        SwTableLines& rLines = pTable->GetTabLines();
 
12231
+        SwTableLine* pLine = rLines.GetObject( nRowIndex );
 
12232
+        nRet = pLine->GetTabBoxes().Count();
 
12233
+    }    
 
12234
+    return nRet;
 
12235
+}
 
12236
+
 
12237
+sal_Int32 SwVbaTableHelper::getTabColumnsMaxCount( ) throw (uno::RuntimeException)
 
12238
+{
 
12239
+    sal_Int32 nRet = 0;
 
12240
+    //sal_Int32 nRowCount = mxTextTable->getRows()->getCount();
 
12241
+    sal_Int32 nRowCount = pTable->GetTabLines().Count();
 
12242
+    for( sal_Int32 index = 0; index < nRowCount; index++ )
 
12243
+    {
 
12244
+        sal_Int32 nColCount = getTabColumnsCount( index );
 
12245
+        if( nRet < nColCount )
 
12246
+            nRet = nColCount;
 
12247
+    }
 
12248
+    return nRet;
 
12249
+}
 
12250
+
 
12251
+sal_Int32 SwVbaTableHelper::getTabRowIndex( const rtl::OUString& CellName ) throw (uno::RuntimeException)
 
12252
+{
 
12253
+    sal_Int32 nRet = 0;
 
12254
+    String sCellName(CellName);
 
12255
+    SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
 
12256
+    if( !pBox )
 
12257
+        throw uno::RuntimeException();
 
12258
+        
 
12259
+    const SwTableLine* pLine = pBox->GetUpper();
 
12260
+    const SwTableLines* pLines = pLine->GetUpper()
 
12261
+                     ? &pLine->GetUpper()->GetTabLines() : &pTable->GetTabLines();
 
12262
+    nRet = pLines->GetPos( pLine );
 
12263
+    return nRet;
 
12264
+}
 
12265
+
 
12266
+sal_Int32 SwVbaTableHelper::getTabColIndex( const rtl::OUString& CellName ) throw (uno::RuntimeException)
 
12267
+{
 
12268
+    sal_Int32 nRet = 0;
 
12269
+    String sCellName(CellName);
 
12270
+    const SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
 
12271
+    if( !pBox )
 
12272
+        throw uno::RuntimeException();
 
12273
+    const SwTableBoxes* pBoxes = &pBox->GetUpper()->GetTabBoxes();
 
12274
+    nRet = pBoxes->GetPos( pBox );
 
12275
+    return nRet;
 
12276
+}
 
12277
+
 
12278
+rtl::OUString SwVbaTableHelper::getColumnStr( sal_Int32 nCol )
 
12279
+{
 
12280
+    const sal_Int32 coDiff = 52; // 'A'-'Z' 'a' - 'z'
 
12281
+    sal_Int32 nCalc = 0;
 
12282
+
 
12283
+    String sRet;
 
12284
+    do{
 
12285
+        nCalc = nCol % coDiff;
 
12286
+        if( nCalc >= 26 )
 
12287
+            sRet.Insert( sal_Unicode('a' - 26 + nCalc ), 0 );
 
12288
+        else    
 
12289
+            sRet.Insert( sal_Unicode('A' + nCalc ), 0 );
 
12290
+        
 
12291
+        if( 0 == ( nCol = nCol - nCalc ) )
 
12292
+            break;
 
12293
+        nCol /= coDiff;
 
12294
+        --nCol;
 
12295
+    }while(1);
 
12296
+    return sRet;
 
12297
+}
 
12298
+
 
12299
+sal_Int32 SwVbaTableHelper::getTableWidth( ) throw (uno::RuntimeException)
 
12300
+{
 
12301
+    sal_Int32 nWidth = 0;
 
12302
+    sal_Bool isWidthRelatvie = sal_False; 
 
12303
+    uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
 
12304
+    xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsWidthRelative") ) ) >>= isWidthRelatvie;
 
12305
+    if( isWidthRelatvie )
 
12306
+    {
 
12307
+        xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RelativeWidth") ) ) >>= nWidth;
 
12308
+    }
 
12309
+    else
 
12310
+    {
 
12311
+        xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) ) >>= nWidth;
 
12312
+    }
 
12313
+    return nWidth;
 
12314
+}
 
12315
+
 
12316
+void SwVbaTableHelper::setTableWidth( sal_Int32 _width ) throw (uno::RuntimeException)
 
12317
+{
 
12318
+    sal_Bool isWidthRelatvie = sal_False;
 
12319
+    uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
 
12320
+    xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsWidthRelative") ) ) >>= isWidthRelatvie;
 
12321
+    if( isWidthRelatvie )
 
12322
+    {
 
12323
+        xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RelativeWidth") ), uno::makeAny( _width ));
 
12324
+    }
 
12325
+    else
 
12326
+    {
 
12327
+        xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ), uno::makeAny( _width ) );
 
12328
+    }
 
12329
+}
 
12330
+
 
12331
+SwTableBox* SwVbaTableHelper::GetTabBox( sal_Int32 nCol, sal_Int32 nRow ) throw (css::uno::RuntimeException)
 
12332
+{
 
12333
+    SwTableLines& rLines = pTable->GetTabLines();
 
12334
+    sal_Int32 nRowCount = rLines.Count();
 
12335
+    if( nRowCount < nRow )
 
12336
+        throw uno::RuntimeException();
 
12337
+
 
12338
+    SwTableBox* pStart = NULL;
 
12339
+    SwTableLine* pLine = rLines.GetObject( nRow );
 
12340
+    if( pLine->GetTabBoxes().Count() < nCol )
 
12341
+        throw uno::RuntimeException();
 
12342
+        
 
12343
+    pStart = pLine->GetTabBoxes()[ nCol ];
 
12344
+
 
12345
+    if( !pStart )
 
12346
+        throw uno::RuntimeException();
 
12347
+    
 
12348
+    return pStart;
 
12349
+}
 
12350
+
 
12351
+void SwVbaTableHelper::InitTabCols( SwTabCols& rCols, const SwTableBox *pStart, BOOL bCurRowOnly )
 
12352
+{
 
12353
+    rCols.SetLeftMin ( 0 );
 
12354
+    rCols.SetLeft    ( 0 );
 
12355
+    rCols.SetRight   ( UNO_TABLE_COLUMN_SUM );
 
12356
+    rCols.SetRightMax( UNO_TABLE_COLUMN_SUM );
 
12357
+
 
12358
+    //if( !pDoc )
 
12359
+   // {
 
12360
+     //   pDoc = word::getDocShell( getCurrentDocument() )->GetDoc();
 
12361
+   // }
 
12362
+    pTable->GetTabCols( rCols, pStart, sal_False, sal_False );
 
12363
+}
 
12364
+
 
12365
+sal_Int32 SwVbaTableHelper::GetColCount( SwTabCols& rCols ) const
 
12366
+{
 
12367
+    sal_Int32 nCount = 0;
 
12368
+    for(sal_Int32 i = 0; i < rCols.Count(); i++ )
 
12369
+        if(rCols.IsHidden(i))
 
12370
+            nCount ++;
 
12371
+    return rCols.Count() - nCount;
 
12372
+}
 
12373
+
 
12374
+sal_Int32 SwVbaTableHelper::GetRightSeparator( SwTabCols& rCols, sal_Int32 nNum) const
 
12375
+{
 
12376
+    DBG_ASSERT( nNum < (sal_Int32)GetColCount( rCols ) ,"Index out of range");
 
12377
+    sal_Int32 i = 0;
 
12378
+    while( nNum >= 0 )
 
12379
+    {
 
12380
+        if( !rCols.IsHidden( static_cast< USHORT >(i)) )
 
12381
+            nNum--;
 
12382
+        i++;
 
12383
+    }
 
12384
+    return i - 1;
 
12385
+}
 
12386
+
 
12387
+sal_Int32 SwVbaTableHelper::GetColWidth( sal_Int32 nCol, sal_Int32 nRow, sal_Bool bCurRowOnly ) throw (uno::RuntimeException)
 
12388
+{
 
12389
+    SwTableBox* pStart = GetTabBox( nCol, nRow );
 
12390
+    SwTabCols aCols;
 
12391
+    InitTabCols( aCols, pStart, bCurRowOnly );
 
12392
+    sal_Int32 nWidth = GetColWidth( aCols, nCol );
 
12393
+
 
12394
+    sal_Int32 nTableWidth = getTableWidth( );
 
12395
+    double dAbsWidth = ( (double)nWidth / UNO_TABLE_COLUMN_SUM ) * (double) nTableWidth;
 
12396
+    return ( sal_Int32 )Millimeter::getInPoints( dAbsWidth );
 
12397
+}
 
12398
+
 
12399
+sal_Int32 SwVbaTableHelper::GetColWidth( SwTabCols& rCols, sal_Int32 nNum ) throw (uno::RuntimeException)
 
12400
+{
 
12401
+    SwTwips nWidth = 0;
 
12402
+
 
12403
+    if( rCols.Count() > 0 )
 
12404
+    {
 
12405
+        if(rCols.Count() == GetColCount( rCols ))
 
12406
+        {
 
12407
+            nWidth = (SwTwips)((nNum == rCols.Count()) ?
 
12408
+                    rCols.GetRight() - rCols[nNum-1] :
 
12409
+                    nNum == 0 ? rCols[nNum] - rCols.GetLeft() :
 
12410
+                                rCols[nNum] - rCols[nNum-1]);
 
12411
+        }
 
12412
+        else
 
12413
+        {
 
12414
+            SwTwips nRValid = nNum < GetColCount( rCols ) ?
 
12415
+                            rCols[(USHORT)GetRightSeparator( rCols, nNum)]:
 
12416
+                                    rCols.GetRight();
 
12417
+            SwTwips nLValid = nNum ?
 
12418
+                            rCols[(USHORT)GetRightSeparator( rCols, nNum - 1)]:
 
12419
+                                    rCols.GetLeft();
 
12420
+            nWidth = nRValid - nLValid;
 
12421
+        }
 
12422
+    }
 
12423
+    else
 
12424
+        nWidth = rCols.GetRight();
 
12425
+
 
12426
+    return nWidth;
 
12427
+}
 
12428
+
 
12429
+void SwVbaTableHelper::SetColWidth( sal_Int32 _width, sal_Int32 nCol, sal_Int32 nRow, sal_Bool bCurRowOnly ) throw (css::uno::RuntimeException)
 
12430
+{
 
12431
+    double dAbsWidth = Millimeter::getInHundredthsOfOneMillimeter( _width );
 
12432
+    sal_Int32 nTableWidth = getTableWidth( );
 
12433
+    sal_Int32 nNewWidth = (sal_Int32)( dAbsWidth/nTableWidth * UNO_TABLE_COLUMN_SUM );
 
12434
+
 
12435
+    SwTableBox* pStart = GetTabBox( nCol, nRow );
 
12436
+    SwTabCols aOldCols;
 
12437
+    InitTabCols( aOldCols, pStart, bCurRowOnly );
 
12438
+
 
12439
+    //BOOL bCurRowOnly = FALSE;
 
12440
+    SwTwips nWidth = 0;
 
12441
+
 
12442
+    SwTabCols aCols( aOldCols );
 
12443
+    if ( aCols.Count() > 0 )
 
12444
+    {
 
12445
+    // if(aCols.Count() != GetColCount( aCols ))
 
12446
+    //         bCurRowOnly = TRUE;
 
12447
+        nWidth = GetColWidth( aCols, nCol);
 
12448
+
 
12449
+        int nDiff = (int)(nNewWidth - nWidth);
 
12450
+        if( !nCol )
 
12451
+            aCols[ static_cast< USHORT >(GetRightSeparator(aCols, 0)) ] += nDiff;
 
12452
+        else if( nCol < GetColCount( aCols )  )
 
12453
+        {
 
12454
+            if(nDiff < GetColWidth( aCols, nCol + 1) - MINLAY)
 
12455
+                aCols[ static_cast< USHORT >(GetRightSeparator( aCols, nCol)) ] += nDiff;
 
12456
+            else
 
12457
+            {
 
12458
+                int nDiffLeft = nDiff - (int)GetColWidth( aCols, nCol + 1) + (int)MINLAY;
 
12459
+                aCols[ static_cast< USHORT >(GetRightSeparator( aCols, nCol)) ] += (nDiff - nDiffLeft);
 
12460
+                aCols[ static_cast< USHORT >(GetRightSeparator( aCols, nCol - 1)) ] -= nDiffLeft;
 
12461
+            }
 
12462
+        }
 
12463
+        else
 
12464
+            aCols[ static_cast< USHORT >(GetRightSeparator( aCols, nCol-1)) ] -= nDiff;
 
12465
+    }
 
12466
+    else
 
12467
+        aCols.SetRight( Min( (long)nNewWidth, aCols.GetRightMax()) );
 
12468
+
 
12469
+    //pDoc->SetTabCols(*pTable, aCols, aOldCols, pStartBox, bCurRowOnly );
 
12470
+    pTable->SetTabCols(aCols, aOldCols, pStart, bCurRowOnly );
 
12471
+}
 
12472
diff --git sw/source/ui/vba/vbatablehelper.hxx sw/source/ui/vba/vbatablehelper.hxx
 
12473
new file mode 100644
 
12474
index 0000000..73425d4
 
12475
--- /dev/null
 
12476
+++ sw/source/ui/vba/vbatablehelper.hxx
 
12477
@@ -0,0 +1,70 @@
 
12478
+/*************************************************************************
 
12479
+ *
 
12480
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
12481
+ * 
 
12482
+ * Copyright 2008 by Sun Microsystems, Inc.
 
12483
+ *
 
12484
+ * OpenOffice.org - a multi-platform office productivity suite
 
12485
+ *
 
12486
+ * $RCSfile: vbahelper.hxx,v $
 
12487
+ * $Revision: 1.5.32.1 $
 
12488
+ *
 
12489
+ * This file is part of OpenOffice.org.
 
12490
+ *
 
12491
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
12492
+ * it under the terms of the GNU Lesser General Public License version 3
 
12493
+ * only, as published by the Free Software Foundation.
 
12494
+ *
 
12495
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
12496
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12497
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12498
+ * GNU Lesser General Public License version 3 for more details
 
12499
+ * (a copy is included in the LICENSE file that accompanied this code).
 
12500
+ *
 
12501
+ * You should have received a copy of the GNU Lesser General Public License
 
12502
+ * version 3 along with OpenOffice.org.  If not, see
 
12503
+ * <http://www.openoffice.org/license.html>
 
12504
+ * for a copy of the LGPLv3 License.
 
12505
+ *
 
12506
+ ************************************************************************/
 
12507
+#ifndef SW_WORD_VBA_TABLEHELPER_HXX
 
12508
+#define SW_WORD_VBA_TABLEHELPER_HXX
 
12509
+
 
12510
+#include <com/sun/star/text/XTextTable.hpp>
 
12511
+#include "wordvbahelper.hxx"
 
12512
+#include <swtable.hxx>
 
12513
+#include <tabcol.hxx>
 
12514
+#include <doc.hxx>
 
12515
+
 
12516
+class SwVbaTableHelper 
 
12517
+{
 
12518
+private:
 
12519
+    css::uno::Reference< css::text::XTextTable > mxTextTable;
 
12520
+    SwTable* pTable;
 
12521
+    SwDoc* pDoc;
 
12522
+
 
12523
+private:
 
12524
+    SwTableBox* GetTabBox( sal_Int32 nCol, sal_Int32 nRow ) throw (css::uno::RuntimeException);
 
12525
+    void    InitTabCols( SwTabCols& rCols, const SwTableBox *pStart, sal_Bool bCurRowOnly  = FALSE );
 
12526
+    sal_Int32 GetRightSeparator( SwTabCols& rCols, sal_Int32 nNum) const;
 
12527
+    sal_Int32 GetColCount( SwTabCols& rCols ) const;
 
12528
+    sal_Int32 GetColWidth( SwTabCols& rCols, sal_Int32 nNum ) throw (css::uno::RuntimeException);
 
12529
+    
 
12530
+public:
 
12531
+    SwVbaTableHelper( const css::uno::Reference< css::text::XTextTable >& xTextTable ) throw (css::uno::RuntimeException);
 
12532
+    ~SwVbaTableHelper() {}
 
12533
+    sal_Int32 getTabColumnsCount( sal_Int32 nRowIndex ) throw (css::uno::RuntimeException);
 
12534
+    sal_Int32 getTabColumnsMaxCount( ) throw (css::uno::RuntimeException);
 
12535
+    sal_Int32 getTabRowIndex( const rtl::OUString& sCellName ) throw (css::uno::RuntimeException);
 
12536
+    sal_Int32 getTabColIndex( const rtl::OUString& sCellName ) throw (css::uno::RuntimeException);
 
12537
+    sal_Int32 getTableWidth( ) throw (css::uno::RuntimeException);
 
12538
+    void  setTableWidth( sal_Int32 _width ) throw (css::uno::RuntimeException);
 
12539
+
 
12540
+    sal_Int32 GetColWidth( sal_Int32 nCol, sal_Int32 nRow = 0, sal_Bool bCurRowOnly  = FALSE ) throw (css::uno::RuntimeException);
 
12541
+    void SetColWidth( sal_Int32 _width, sal_Int32 nCol, sal_Int32 nRow = 0, sal_Bool bCurRowOnly  = FALSE ) throw (css::uno::RuntimeException);
 
12542
+
 
12543
+    static SwTable* GetSwTable( const css::uno::Reference< css::text::XTextTable >& xTextTable ) throw (css::uno::RuntimeException);
 
12544
+    static rtl::OUString getColumnStr( sal_Int32 nCol );
 
12545
+};
 
12546
+
 
12547
+#endif
 
12548
diff --git sw/source/ui/vba/vbatableofcontents.cxx sw/source/ui/vba/vbatableofcontents.cxx
 
12549
new file mode 100644
 
12550
index 0000000..1c37e96
 
12551
--- /dev/null
 
12552
+++ sw/source/ui/vba/vbatableofcontents.cxx
 
12553
@@ -0,0 +1,125 @@
 
12554
+/*************************************************************************
 
12555
+ *
 
12556
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
12557
+ * 
 
12558
+ * Copyright 2008 by Sun Microsystems, Inc.
 
12559
+ *
 
12560
+ * OpenOffice.org - a multi-platform office productivity suite
 
12561
+ *
 
12562
+ * $RCSfile: 
 
12563
+ * $Revision: 
 
12564
+ *
 
12565
+ * This file is part of OpenOffice.org.
 
12566
+ *
 
12567
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
12568
+ * it under the terms of the GNU Lesser General Public License version 3
 
12569
+ * only, as published by the Free Software Foundation.
 
12570
+ *
 
12571
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
12572
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12573
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12574
+ * GNU Lesser General Public License version 3 for more details
 
12575
+ * (a copy is included in the LICENSE file that accompanied this code).
 
12576
+ *
 
12577
+ * You should have received a copy of the GNU Lesser General Public License
 
12578
+ * version 3 along with OpenOffice.org.  If not, see
 
12579
+ * <http://www.openoffice.org/license.html>
 
12580
+ * for a copy of the LGPLv3 License.
 
12581
+ *
 
12582
+ ************************************************************************/
 
12583
+#include "vbatableofcontents.hxx"
 
12584
+#include <vbahelper/vbahelper.hxx>
 
12585
+#include <tools/diagnose_ex.h>
 
12586
+#include <ooo/vba/word/WdTabLeader.hpp>
 
12587
+
 
12588
+using namespace ::ooo::vba;
 
12589
+using namespace ::com::sun::star;
 
12590
+
 
12591
+SwVbaTableOfContents::SwVbaTableOfContents( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& xDoc, const uno::Reference< text::XDocumentIndex >& xDocumentIndex ) throw ( uno::RuntimeException ) :
 
12592
+    SwVbaTableOfContents_BASE( rParent, rContext ), mxTextDocument( xDoc ), mxDocumentIndex( xDocumentIndex )
 
12593
+{
 
12594
+    mxTocProps.set( mxDocumentIndex, uno::UNO_QUERY_THROW );
 
12595
+}
 
12596
+
 
12597
+
 
12598
+SwVbaTableOfContents::~SwVbaTableOfContents()
 
12599
+{
 
12600
+}
 
12601
+
 
12602
+::sal_Int32 SAL_CALL SwVbaTableOfContents::getLowerHeadingLevel() throw (uno::RuntimeException)
 
12603
+{
 
12604
+    sal_Int16 nLevel = 0;
 
12605
+    mxTocProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Level") ) ) >>= nLevel;
 
12606
+    return nLevel;
 
12607
+}
 
12608
+
 
12609
+void SAL_CALL SwVbaTableOfContents::setLowerHeadingLevel( ::sal_Int32 _lowerheadinglevel ) throw (uno::RuntimeException)
 
12610
+{
 
12611
+    mxTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Level") ), uno::makeAny( sal_Int8( _lowerheadinglevel ) ) );
 
12612
+}
 
12613
+
 
12614
+::sal_Int32 SAL_CALL SwVbaTableOfContents::getTabLeader() throw (uno::RuntimeException)
 
12615
+{
 
12616
+    // not support in Writer
 
12617
+    return word::WdTabLeader::wdTabLeaderDots;
 
12618
+}
 
12619
+
 
12620
+void SAL_CALL SwVbaTableOfContents::setTabLeader( ::sal_Int32 /*_tableader*/ ) throw (uno::RuntimeException)
 
12621
+{
 
12622
+    // not support in Writer
 
12623
+}
 
12624
+
 
12625
+::sal_Bool SAL_CALL SwVbaTableOfContents::getUseFields() throw (css::uno::RuntimeException)
 
12626
+{
 
12627
+    sal_Bool bUseFields = sal_False;
 
12628
+    mxTocProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromMarks") ) ) >>= bUseFields;
 
12629
+    return bUseFields;
 
12630
+}
 
12631
+
 
12632
+void SAL_CALL SwVbaTableOfContents::setUseFields( ::sal_Bool _useFields ) throw (css::uno::RuntimeException)
 
12633
+{
 
12634
+    mxTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromMarks") ), uno::makeAny( _useFields ) );
 
12635
+}
 
12636
+
 
12637
+::sal_Bool SAL_CALL SwVbaTableOfContents::getUseOutlineLevels() throw (css::uno::RuntimeException)
 
12638
+{
 
12639
+    sal_Bool bUseOutlineLevels = sal_False;
 
12640
+    mxTocProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromOutline") ) ) >>= bUseOutlineLevels;
 
12641
+    return bUseOutlineLevels;
 
12642
+}
 
12643
+
 
12644
+void SAL_CALL SwVbaTableOfContents::setUseOutlineLevels( ::sal_Bool _useOutlineLevels ) throw (css::uno::RuntimeException)
 
12645
+{
 
12646
+    mxTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromOutline") ), uno::makeAny( _useOutlineLevels ) );
 
12647
+}
 
12648
+
 
12649
+void SAL_CALL SwVbaTableOfContents::Delete(  ) throw (uno::RuntimeException)
 
12650
+{
 
12651
+    uno::Reference< text::XTextContent > xTextContent( mxDocumentIndex, uno::UNO_QUERY_THROW );
 
12652
+    mxTextDocument->getText()->removeTextContent( xTextContent );
 
12653
+}
 
12654
+
 
12655
+void SAL_CALL SwVbaTableOfContents::Update(  ) throw (uno::RuntimeException)
 
12656
+{
 
12657
+    mxDocumentIndex->update();
 
12658
+}
 
12659
+
 
12660
+rtl::OUString& 
 
12661
+SwVbaTableOfContents::getServiceImplName()
 
12662
+{
 
12663
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTableOfContents") );
 
12664
+    return sImplName;
 
12665
+}
 
12666
+
 
12667
+uno::Sequence< rtl::OUString > 
 
12668
+SwVbaTableOfContents::getServiceNames()
 
12669
+{
 
12670
+    static uno::Sequence< rtl::OUString > aServiceNames;
 
12671
+    if ( aServiceNames.getLength() == 0 )
 
12672
+    {
 
12673
+        aServiceNames.realloc( 1 );
 
12674
+        aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TableOfContents" ) );
 
12675
+    }
 
12676
+    return aServiceNames;
 
12677
+}
 
12678
+
 
12679
diff --git sw/source/ui/vba/vbatableofcontents.hxx sw/source/ui/vba/vbatableofcontents.hxx
 
12680
new file mode 100644
 
12681
index 0000000..8e9394a
 
12682
--- /dev/null
 
12683
+++ sw/source/ui/vba/vbatableofcontents.hxx
 
12684
@@ -0,0 +1,70 @@
 
12685
+/*************************************************************************
 
12686
+ *
 
12687
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
12688
+ * 
 
12689
+ * Copyright 2008 by Sun Microsystems, Inc.
 
12690
+ *
 
12691
+ * OpenOffice.org - a multi-platform office productivity suite
 
12692
+ *
 
12693
+ * $RCSfile: 
 
12694
+ * $Revision: 
 
12695
+ *
 
12696
+ * This file is part of OpenOffice.org.
 
12697
+ *
 
12698
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
12699
+ * it under the terms of the GNU Lesser General Public License version 3
 
12700
+ * only, as published by the Free Software Foundation.
 
12701
+ *
 
12702
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
12703
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12704
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12705
+ * GNU Lesser General Public License version 3 for more details
 
12706
+ * (a copy is included in the LICENSE file that accompanied this code).
 
12707
+ *
 
12708
+ * You should have received a copy of the GNU Lesser General Public License
 
12709
+ * version 3 along with OpenOffice.org.  If not, see
 
12710
+ * <http://www.openoffice.org/license.html>
 
12711
+ * for a copy of the LGPLv3 License.
 
12712
+ *
 
12713
+ ************************************************************************/
 
12714
+#ifndef SW_VBA_TABLEOFCONTENTS_HXX
 
12715
+#define SW_VBA_TABLEOFCONTENTS_HXX
 
12716
+
 
12717
+#include <ooo/vba/word/XTableOfContents.hpp>
 
12718
+#include <vbahelper/vbahelperinterface.hxx>
 
12719
+#include <cppuhelper/implbase1.hxx>
 
12720
+#include <com/sun/star/text/XTextDocument.hpp>
 
12721
+#include <com/sun/star/text/XDocumentIndex.hpp>
 
12722
+
 
12723
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XTableOfContents > SwVbaTableOfContents_BASE;
 
12724
+
 
12725
+class SwVbaTableOfContents : public SwVbaTableOfContents_BASE
 
12726
+{
 
12727
+private:
 
12728
+    css::uno::Reference< css::text::XTextDocument > mxTextDocument;
 
12729
+    css::uno::Reference< css::text::XDocumentIndex > mxDocumentIndex;
 
12730
+    css::uno::Reference< css::beans::XPropertySet > mxTocProps;
 
12731
+
 
12732
+public:
 
12733
+    SwVbaTableOfContents( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& xDoc, const css::uno::Reference< css::text::XDocumentIndex >& xDocumentIndex ) throw ( css::uno::RuntimeException );
 
12734
+    virtual ~SwVbaTableOfContents();
 
12735
+
 
12736
+    // Attributes
 
12737
+    virtual ::sal_Int32 SAL_CALL getLowerHeadingLevel() throw (css::uno::RuntimeException);
 
12738
+    virtual void SAL_CALL setLowerHeadingLevel( ::sal_Int32 _lowerheadinglevel ) throw (css::uno::RuntimeException);
 
12739
+    virtual ::sal_Int32 SAL_CALL getTabLeader() throw (css::uno::RuntimeException);
 
12740
+    virtual void SAL_CALL setTabLeader( ::sal_Int32 _tableader ) throw (css::uno::RuntimeException);
 
12741
+    virtual ::sal_Bool SAL_CALL getUseFields() throw (css::uno::RuntimeException);
 
12742
+    virtual void SAL_CALL setUseFields( ::sal_Bool _useFields ) throw (css::uno::RuntimeException);
 
12743
+    virtual ::sal_Bool SAL_CALL getUseOutlineLevels() throw (css::uno::RuntimeException);
 
12744
+    virtual void SAL_CALL setUseOutlineLevels( ::sal_Bool _useOutlineLevels ) throw (css::uno::RuntimeException);
 
12745
+
 
12746
+    // Methods
 
12747
+    virtual void SAL_CALL Delete(  ) throw (css::uno::RuntimeException);
 
12748
+    virtual void SAL_CALL Update(  ) throw (css::uno::RuntimeException);
 
12749
+
 
12750
+    // XHelperInterface
 
12751
+    virtual rtl::OUString& getServiceImplName();
 
12752
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
12753
+};
 
12754
+#endif /* SW_VBA_TABLEOFCONTENTS_HXX */
 
12755
diff --git sw/source/ui/vba/vbatables.cxx sw/source/ui/vba/vbatables.cxx
 
12756
index 53178d1..7423216 100644
 
12757
--- sw/source/ui/vba/vbatables.cxx
 
12758
+++ sw/source/ui/vba/vbatables.cxx
 
12759
@@ -4,6 +4,9 @@
 
12760
 #include <com/sun/star/text/XTextTable.hpp>
 
12761
 #include <com/sun/star/text/XTextTablesSupplier.hpp>
 
12762
 #include <com/sun/star/text/XTextDocument.hpp>
 
12763
+#include <com/sun/star/lang/XServiceInfo.hpp>
 
12764
+#include <com/sun/star/text/XText.hpp>
 
12765
+#include <com/sun/star/table/XCellRange.hpp>
 
12766
 #include <comphelper/componentcontext.hxx>
 
12767
 
 
12768
 using namespace ::ooo::vba;
 
12769
@@ -26,7 +29,89 @@ uno::Any lcl_createTable( const uno::Reference< XHelperInterface >& xParent, con
 
12770
     return uno::makeAny( xTable );
 
12771
 }
 
12772
 
 
12773
+sal_Bool lcl_isInHeaderFooter( const uno::Reference< text::XTextTable >& xTable )
 
12774
+{
 
12775
+    uno::Reference< text::XTextContent > xTextContent( xTable, uno::UNO_QUERY_THROW );
 
12776
+    uno::Reference< text::XText > xText = xTextContent->getAnchor()->getText();
 
12777
+    uno::Reference< lang::XServiceInfo > xServiceInfo( xText, uno::UNO_QUERY_THROW );
 
12778
+    rtl::OUString aImplName = xServiceInfo->getImplementationName();
 
12779
+    if( aImplName.equalsAscii("SwXHeadFootText") )
 
12780
+        return sal_True;
 
12781
+    return sal_False;    
 
12782
+}
 
12783
+
 
12784
 typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumBase;
 
12785
+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XNameAccess > TableCollectionHelper_Base;
 
12786
+typedef std::vector< uno::Reference< text::XTextTable > > XTextTableVec;
 
12787
+
 
12788
+class TableCollectionHelper : public TableCollectionHelper_Base
 
12789
+{
 
12790
+    XTextTableVec mxTables;
 
12791
+    XTextTableVec::iterator cachePos;
 
12792
+
 
12793
+public:
 
12794
+    TableCollectionHelper( const uno::Reference< frame::XModel >& xDocument )
 
12795
+    {
 
12796
+        // only count the tables in the body text, not in the header/footer
 
12797
+        uno::Reference< container::XIndexAccess > xTables = lcl_getTables( xDocument );
 
12798
+        sal_Int32 nCount = xTables->getCount();
 
12799
+        for( sal_Int32 i = 0; i < nCount; i++ )
 
12800
+        {
 
12801
+            uno::Reference< text::XTextTable > xTable( xTables->getByIndex( i ) , uno::UNO_QUERY_THROW );
 
12802
+            if( !lcl_isInHeaderFooter( xTable ) )
 
12803
+                mxTables.push_back( xTable );
 
12804
+        }
 
12805
+        cachePos = mxTables.begin();
 
12806
+    }
 
12807
+    // XIndexAccess
 
12808
+    virtual sal_Int32 SAL_CALL getCount(  ) throw (uno::RuntimeException)
 
12809
+    {
 
12810
+        return mxTables.size();
 
12811
+    }
 
12812
+    virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
 
12813
+    {
 
12814
+        if ( Index < 0 || Index >= getCount() )
 
12815
+            throw lang::IndexOutOfBoundsException();
 
12816
+        uno::Reference< text::XTextTable > xTable( mxTables[ Index ], uno::UNO_QUERY_THROW );
 
12817
+        return uno::makeAny( xTable );
 
12818
+    }
 
12819
+    // XElementAccess
 
12820
+    virtual uno::Type SAL_CALL getElementType(  ) throw (uno::RuntimeException) { return  text::XTextTable::static_type(0); }
 
12821
+    virtual ::sal_Bool SAL_CALL hasElements(  ) throw (uno::RuntimeException) { return getCount() > 0 ; }
 
12822
+    // XNameAcess 
 
12823
+    virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
 
12824
+    {
 
12825
+        if ( !hasByName(aName) )
 
12826
+            throw container::NoSuchElementException();
 
12827
+        uno::Reference< text::XTextTable > xTable( *cachePos, uno::UNO_QUERY_THROW );
 
12828
+        return uno::makeAny( xTable );
 
12829
+    }
 
12830
+    virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw (uno::RuntimeException)
 
12831
+    {
 
12832
+        uno::Sequence< rtl::OUString > sNames( mxTables.size() );
 
12833
+        rtl::OUString* pString = sNames.getArray();
 
12834
+        XTextTableVec::iterator it = mxTables.begin();
 
12835
+        XTextTableVec::iterator it_end = mxTables.end();
 
12836
+        for ( ; it != it_end; ++it, ++pString )
 
12837
+        {
 
12838
+            uno::Reference< container::XNamed > xName( *it, uno::UNO_QUERY_THROW );
 
12839
+            *pString = xName->getName();
 
12840
+        }
 
12841
+        return sNames;
 
12842
+    }
 
12843
+    virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
 
12844
+    {
 
12845
+        cachePos = mxTables.begin();
 
12846
+        XTextTableVec::iterator it_end = mxTables.end();
 
12847
+        for ( ; cachePos != it_end; ++cachePos )
 
12848
+        {
 
12849
+            uno::Reference< container::XNamed > xName( *cachePos, uno::UNO_QUERY_THROW );
 
12850
+            if ( aName.equalsIgnoreAsciiCase( xName->getName() ) )
 
12851
+                break;
 
12852
+        }
 
12853
+        return ( cachePos != it_end );
 
12854
+    }
 
12855
+};
 
12856
 
 
12857
 class TableEnumerationImpl : public EnumBase
 
12858
 {
 
12859
@@ -52,7 +137,7 @@ public:
 
12860
     
 
12861
 };
 
12862
  
 
12863
-SwVbaTables::SwVbaTables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xDocument ) : SwVbaTables_BASE( xParent, xContext , lcl_getTables( xDocument ) ), mxDocument( xDocument )
 
12864
+SwVbaTables::SwVbaTables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xDocument ) : SwVbaTables_BASE( xParent, xContext , uno::Reference< container::XIndexAccess >( new TableCollectionHelper( xDocument ) ) ), mxDocument( xDocument )
 
12865
 {
 
12866
 }
 
12867
 
 
12868
@@ -85,6 +170,12 @@ SwVbaTables::Add( const uno::Reference< word::XRange >& Range, const uno::Any& N
 
12869
     uno::Reference< text::XTextContent > xContext( xTable, uno::UNO_QUERY_THROW );     
 
12870
     
 
12871
     xText->insertTextContent( xTextRange, xContext, true );
 
12872
+
 
12873
+    // move the current cursor to the first table cell
 
12874
+    uno::Reference< table::XCellRange > xCellRange( xTable, uno::UNO_QUERY_THROW );
 
12875
+    uno::Reference< text::XText> xFirstCellText( xCellRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
 
12876
+    word::getXTextViewCursor( mxDocument )->gotoRange( xFirstCellText->getStart(), sal_False ); 
 
12877
+    
 
12878
     uno::Reference< word::XTable > xVBATable( new SwVbaTable( mxParent, mxContext,  pVbaRange->getDocument(), xTable ) );
 
12879
     return xVBATable;
 
12880
 }
 
12881
diff --git sw/source/ui/vba/vbatablesofcontents.cxx sw/source/ui/vba/vbatablesofcontents.cxx
 
12882
new file mode 100644
 
12883
index 0000000..fd81978
 
12884
--- /dev/null
 
12885
+++ sw/source/ui/vba/vbatablesofcontents.cxx
 
12886
@@ -0,0 +1,197 @@
 
12887
+/*************************************************************************
 
12888
+ *
 
12889
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
12890
+ * 
 
12891
+ * Copyright 2008 by Sun Microsystems, Inc.
 
12892
+ *
 
12893
+ * OpenOffice.org - a multi-platform office productivity suite
 
12894
+ *
 
12895
+ * $RCSfile: 
 
12896
+ * $Revision: 
 
12897
+ *
 
12898
+ * This file is part of OpenOffice.org.
 
12899
+ *
 
12900
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
12901
+ * it under the terms of the GNU Lesser General Public License version 3
 
12902
+ * only, as published by the Free Software Foundation.
 
12903
+ *
 
12904
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
12905
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12906
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12907
+ * GNU Lesser General Public License version 3 for more details
 
12908
+ * (a copy is included in the LICENSE file that accompanied this code).
 
12909
+ *
 
12910
+ * You should have received a copy of the GNU Lesser General Public License
 
12911
+ * version 3 along with OpenOffice.org.  If not, see
 
12912
+ * <http://www.openoffice.org/license.html>
 
12913
+ * for a copy of the LGPLv3 License.
 
12914
+ *
 
12915
+ ************************************************************************/
 
12916
+#include "vbatablesofcontents.hxx"
 
12917
+#include "vbatableofcontents.hxx"
 
12918
+#include "vbarange.hxx"
 
12919
+#include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
 
12920
+
 
12921
+using namespace ::ooo::vba;
 
12922
+using namespace ::com::sun::star;
 
12923
+
 
12924
+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > TableOfContentsCollectionHelper_Base;
 
12925
+typedef std::vector< uno::Reference< text::XDocumentIndex > > XTocVec;
 
12926
+
 
12927
+class TablesOfContentsEnumWrapper : public EnumerationHelper_BASE
 
12928
+{
 
12929
+    uno::Reference< container::XIndexAccess > mxIndexAccess;
 
12930
+    sal_Int32 nIndex;
 
12931
+
 
12932
+public:
 
12933
+    TablesOfContentsEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : mxIndexAccess( xIndexAccess ), nIndex( 0 )
 
12934
+    {
 
12935
+    }
 
12936
+    virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException)
 
12937
+    {
 
12938
+        return ( nIndex < mxIndexAccess->getCount() );
 
12939
+    }
 
12940
+
 
12941
+    virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
 
12942
+    {
 
12943
+        if( nIndex < mxIndexAccess->getCount() )
 
12944
+        {
 
12945
+            return mxIndexAccess->getByIndex( nIndex++ );
 
12946
+        }
 
12947
+        throw container::NoSuchElementException();
 
12948
+    }
 
12949
+};
 
12950
+
 
12951
+class TableOfContentsCollectionHelper : public TableOfContentsCollectionHelper_Base
 
12952
+{
 
12953
+private:
 
12954
+    uno::Reference< XHelperInterface > mxParent;
 
12955
+    uno::Reference< uno::XComponentContext > mxContext;
 
12956
+    uno::Reference< text::XTextDocument > mxTextDocument;
 
12957
+    XTocVec maToc;
 
12958
+
 
12959
+public:
 
12960
+    TableOfContentsCollectionHelper( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xDoc ) throw ( uno::RuntimeException ): mxParent( xParent ), mxContext( xContext ), mxTextDocument( xDoc )
 
12961
+    {
 
12962
+        uno::Reference< text::XDocumentIndexesSupplier > xDocIndexSupp( mxTextDocument, uno::UNO_QUERY_THROW );
 
12963
+        uno::Reference< container::XIndexAccess > xDocIndexes = xDocIndexSupp->getDocumentIndexes();
 
12964
+        sal_Int32 nCount = xDocIndexes->getCount();
 
12965
+        for( sal_Int32 i = 0; i < nCount; i++ )
 
12966
+        {
 
12967
+            uno::Reference< text::XDocumentIndex > xToc( xDocIndexes->getByIndex(i), uno::UNO_QUERY_THROW );
 
12968
+            if( xToc->getServiceName().equalsAscii("com.sun.star.text.ContentIndex") )
 
12969
+            {
 
12970
+                maToc.push_back( xToc );
 
12971
+            }
 
12972
+        }
 
12973
+    }
 
12974
+
 
12975
+    virtual ~TableOfContentsCollectionHelper() {}
 
12976
+
 
12977
+    virtual sal_Int32 SAL_CALL getCount(  ) throw (uno::RuntimeException)
 
12978
+    {
 
12979
+        return maToc.size();
 
12980
+    }
 
12981
+    virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
 
12982
+    {
 
12983
+        if ( Index < 0 || Index >= getCount() )    
 
12984
+            throw lang::IndexOutOfBoundsException();
 
12985
+        
 
12986
+        uno::Reference< text::XDocumentIndex > xToc( maToc[Index], uno::UNO_QUERY_THROW );
 
12987
+        return uno::makeAny( uno::Reference< word::XTableOfContents >( new SwVbaTableOfContents( mxParent, mxContext, mxTextDocument, xToc ) ) );
 
12988
+    }
 
12989
+    virtual uno::Type SAL_CALL getElementType(  ) throw (uno::RuntimeException)
 
12990
+    {
 
12991
+        return word::XTableOfContents::static_type(0);
 
12992
+    }
 
12993
+    virtual sal_Bool SAL_CALL hasElements(  ) throw (uno::RuntimeException)
 
12994
+    {
 
12995
+        return sal_True;
 
12996
+    }
 
12997
+    // XEnumerationAccess
 
12998
+    virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration(  ) throw (uno::RuntimeException)
 
12999
+    {
 
13000
+        return new TablesOfContentsEnumWrapper( this );
 
13001
+    }
 
13002
+};
 
13003
+
 
13004
+SwVbaTablesOfContents::SwVbaTablesOfContents( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xDoc ) throw (uno::RuntimeException) : SwVbaTablesOfContents_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new TableOfContentsCollectionHelper( xParent, xContext, xDoc ) ) ),  mxTextDocument( xDoc )
 
13005
+{
 
13006
+}
 
13007
+
 
13008
+uno::Reference< word::XTableOfContents > SAL_CALL 
 
13009
+SwVbaTablesOfContents::Add( const uno::Reference< word::XRange >& Range, const uno::Any& UseHeadingStyles, const uno::Any& UpperHeadingLevel, const uno::Any& LowerHeadingLevel, const uno::Any& UseFields, const uno::Any& TableID, const uno::Any& RightAlignPageNumbers, const uno::Any& IncludePageNumbers, const uno::Any& AddedStyles, const uno::Any& UseHyperlinks, const uno::Any& HidePageNumbersInWeb, const uno::Any& UseOutlineLevels ) throw (uno::RuntimeException)
 
13010
+{
 
13011
+    uno::Reference< lang::XMultiServiceFactory > xDocMSF( mxTextDocument, uno::UNO_QUERY_THROW );
 
13012
+    uno::Reference< text::XDocumentIndex > xDocumentIndex( xDocMSF->createInstance(  rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.ContentIndex")) ), uno::UNO_QUERY_THROW );
 
13013
+
 
13014
+    uno::Reference< beans::XPropertySet > xTocProps( xDocumentIndex, uno::UNO_QUERY_THROW );
 
13015
+    sal_Bool isProtected = sal_False;
 
13016
+    xTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsProtected") ), uno::makeAny( isProtected ) );
 
13017
+
 
13018
+    uno::Reference< word::XTableOfContents > xToc( new SwVbaTableOfContents( this, mxContext, mxTextDocument, xDocumentIndex ) );
 
13019
+    
 
13020
+    sal_Int32 nLowerHeadingLevel = 9;
 
13021
+    if( LowerHeadingLevel.hasValue() )
 
13022
+        LowerHeadingLevel >>= nLowerHeadingLevel;
 
13023
+    xToc->setLowerHeadingLevel( nLowerHeadingLevel );
 
13024
+
 
13025
+    sal_Bool bUseFields = sal_False;
 
13026
+    if( UseFields.hasValue() )
 
13027
+        UseFields >>= bUseFields;
 
13028
+    xToc->setUseFields( bUseFields );
 
13029
+
 
13030
+    sal_Bool bUseOutlineLevels = sal_True;
 
13031
+    //if( UseOutlineLevels.hasValue() )
 
13032
+    //    UseOutlineLevels >>= bUseOutlineLevels;
 
13033
+    xToc->setUseOutlineLevels( bUseOutlineLevels );
 
13034
+
 
13035
+    SwVbaRange* pVbaRange = dynamic_cast<SwVbaRange*>( Range.get() );
 
13036
+    if( !pVbaRange )
 
13037
+        throw uno::RuntimeException();
 
13038
+    
 
13039
+    uno::Reference< text::XTextRange > xTextRange = pVbaRange->getXTextRange();
 
13040
+    uno::Reference< text::XText > xText = pVbaRange->getXText();
 
13041
+    uno::Reference< text::XTextContent > xTextContent( xDocumentIndex, uno::UNO_QUERY_THROW );
 
13042
+    xText->insertTextContent( xTextRange, xTextContent, sal_False );
 
13043
+    xToc->Update();
 
13044
+
 
13045
+    return xToc;
 
13046
+}
 
13047
+
 
13048
+// XEnumerationAccess
 
13049
+uno::Type
 
13050
+SwVbaTablesOfContents::getElementType() throw (uno::RuntimeException)
 
13051
+{
 
13052
+    return word::XTableOfContents::static_type(0);
 
13053
+}
 
13054
+uno::Reference< container::XEnumeration >
 
13055
+SwVbaTablesOfContents::createEnumeration() throw (uno::RuntimeException)
 
13056
+{
 
13057
+    return new TablesOfContentsEnumWrapper( m_xIndexAccess );
 
13058
+}
 
13059
+
 
13060
+uno::Any
 
13061
+SwVbaTablesOfContents::createCollectionObject( const uno::Any& aSource )
 
13062
+{
 
13063
+    return aSource;
 
13064
+}
 
13065
+
 
13066
+rtl::OUString& 
 
13067
+SwVbaTablesOfContents::getServiceImplName()
 
13068
+{
 
13069
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTablesOfContents") );
 
13070
+    return sImplName;
 
13071
+}
 
13072
+
 
13073
+uno::Sequence<rtl::OUString> 
 
13074
+SwVbaTablesOfContents::getServiceNames()
 
13075
+{
 
13076
+    static uno::Sequence< rtl::OUString > sNames;
 
13077
+    if ( sNames.getLength() == 0 )
 
13078
+    {
 
13079
+        sNames.realloc( 1 );
 
13080
+        sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TablesOfContents") );
 
13081
+    }
 
13082
+    return sNames;
 
13083
+}
 
13084
diff --git sw/source/ui/vba/vbatablesofcontents.hxx sw/source/ui/vba/vbatablesofcontents.hxx
 
13085
new file mode 100644
 
13086
index 0000000..e193df7
 
13087
--- /dev/null
 
13088
+++ sw/source/ui/vba/vbatablesofcontents.hxx
 
13089
@@ -0,0 +1,64 @@
 
13090
+/*************************************************************************
 
13091
+ *
 
13092
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
13093
+ * 
 
13094
+ * Copyright 2008 by Sun Microsystems, Inc.
 
13095
+ *
 
13096
+ * OpenOffice.org - a multi-platform office productivity suite
 
13097
+ *
 
13098
+ * $RCSfile: 
 
13099
+ * $Revision: 
 
13100
+ *
 
13101
+ * This file is part of OpenOffice.org.
 
13102
+ *
 
13103
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
13104
+ * it under the terms of the GNU Lesser General Public License version 3
 
13105
+ * only, as published by the Free Software Foundation.
 
13106
+ *
 
13107
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
13108
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13109
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13110
+ * GNU Lesser General Public License version 3 for more details
 
13111
+ * (a copy is included in the LICENSE file that accompanied this code).
 
13112
+ *
 
13113
+ * You should have received a copy of the GNU Lesser General Public License
 
13114
+ * version 3 along with OpenOffice.org.  If not, see
 
13115
+ * <http://www.openoffice.org/license.html>
 
13116
+ * for a copy of the LGPLv3 License.
 
13117
+ *
 
13118
+ ************************************************************************/
 
13119
+#ifndef SW_VBA_TABLESOFCONTENTS_HXX
 
13120
+#define SW_VBA_TABLESOFCONTENTS_HXX
 
13121
+
 
13122
+#include <vbahelper/vbacollectionimpl.hxx>
 
13123
+#include <ooo/vba/word/XTablesOfContents.hpp>
 
13124
+#include <vbahelper/vbahelperinterface.hxx>
 
13125
+#include <com/sun/star/text/XTextDocument.hpp>
 
13126
+#include <ooo/vba/word/XTableOfContents.hpp>
 
13127
+#include <ooo/vba/word/XRange.hpp>
 
13128
+
 
13129
+typedef CollTestImplHelper< ooo::vba::word::XTablesOfContents > SwVbaTablesOfContents_BASE;
 
13130
+
 
13131
+class SwVbaTablesOfContents : public SwVbaTablesOfContents_BASE
 
13132
+{
 
13133
+private:
 
13134
+    css::uno::Reference< css::text::XTextDocument > mxTextDocument;
 
13135
+
 
13136
+public:
 
13137
+    SwVbaTablesOfContents( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextDocument >& xDoc ) throw ( css::uno::RuntimeException );
 
13138
+    virtual ~SwVbaTablesOfContents() {}
 
13139
+
 
13140
+    // Methods
 
13141
+    virtual css::uno::Reference< ::ooo::vba::word::XTableOfContents > SAL_CALL Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range, const css::uno::Any& UseHeadingStyles, const css::uno::Any& UpperHeadingLevel, const css::uno::Any& LowerHeadingLevel, const css::uno::Any& UseFields, const css::uno::Any& TableID, const css::uno::Any& RightAlignPageNumbers, const css::uno::Any& IncludePageNumbers, const css::uno::Any& AddedStyles, const css::uno::Any& UseHyperlinks, const css::uno::Any& HidePageNumbersInWeb, const css::uno::Any& UseOutlineLevels ) throw (css::uno::RuntimeException);
 
13142
+
 
13143
+    // XEnumerationAccess
 
13144
+    virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
 
13145
+    virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
 
13146
+
 
13147
+    // SwVbaTablesOfContents_BASE
 
13148
+    virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); 
 
13149
+    virtual rtl::OUString& getServiceImplName();
 
13150
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
13151
+};    
 
13152
+
 
13153
+#endif /* SW_VBA_TABLESOFCONTENTS_HXX */
 
13154
diff --git sw/source/ui/vba/vbatabstop.cxx sw/source/ui/vba/vbatabstop.cxx
 
13155
new file mode 100644
 
13156
index 0000000..259c508
 
13157
--- /dev/null
 
13158
+++ sw/source/ui/vba/vbatabstop.cxx
 
13159
@@ -0,0 +1,63 @@
 
13160
+/*************************************************************************
 
13161
+ *
 
13162
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
13163
+ * 
 
13164
+ * Copyright 2008 by Sun Microsystems, Inc.
 
13165
+ *
 
13166
+ * OpenOffice.org - a multi-platform office productivity suite
 
13167
+ *
 
13168
+ * $RCSfile: 
 
13169
+ * $Revision: 
 
13170
+ *
 
13171
+ * This file is part of OpenOffice.org.
 
13172
+ *
 
13173
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
13174
+ * it under the terms of the GNU Lesser General Public License version 3
 
13175
+ * only, as published by the Free Software Foundation.
 
13176
+ *
 
13177
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
13178
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13179
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13180
+ * GNU Lesser General Public License version 3 for more details
 
13181
+ * (a copy is included in the LICENSE file that accompanied this code).
 
13182
+ *
 
13183
+ * You should have received a copy of the GNU Lesser General Public License
 
13184
+ * version 3 along with OpenOffice.org.  If not, see
 
13185
+ * <http://www.openoffice.org/license.html>
 
13186
+ * for a copy of the LGPLv3 License.
 
13187
+ *
 
13188
+ ************************************************************************/
 
13189
+#include "vbatabstop.hxx"
 
13190
+#include <vbahelper/vbahelper.hxx>
 
13191
+#include <tools/diagnose_ex.h>
 
13192
+
 
13193
+using namespace ::ooo::vba;
 
13194
+using namespace ::com::sun::star;
 
13195
+
 
13196
+SwVbaTabStop::SwVbaTabStop( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< beans::XPropertySet >& xParaProps, const style::TabStop& aTabStop ) throw ( uno::RuntimeException ) : SwVbaTabStop_BASE( rParent, rContext ), mxParaProps( xParaProps ), maTabStop( aTabStop )
 
13197
+{
 
13198
+}
 
13199
+
 
13200
+SwVbaTabStop::~SwVbaTabStop()
 
13201
+{
 
13202
+}
 
13203
+
 
13204
+rtl::OUString& 
 
13205
+SwVbaTabStop::getServiceImplName()
 
13206
+{
 
13207
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTabStop") );
 
13208
+    return sImplName;
 
13209
+}
 
13210
+
 
13211
+uno::Sequence< rtl::OUString > 
 
13212
+SwVbaTabStop::getServiceNames()
 
13213
+{
 
13214
+    static uno::Sequence< rtl::OUString > aServiceNames;
 
13215
+    if ( aServiceNames.getLength() == 0 )
 
13216
+    {
 
13217
+        aServiceNames.realloc( 1 );
 
13218
+        aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TabStop" ) );
 
13219
+    }
 
13220
+    return aServiceNames;
 
13221
+}
 
13222
+
 
13223
diff --git sw/source/ui/vba/vbatabstop.hxx sw/source/ui/vba/vbatabstop.hxx
 
13224
new file mode 100644
 
13225
index 0000000..77780c7
 
13226
--- /dev/null
 
13227
+++ sw/source/ui/vba/vbatabstop.hxx
 
13228
@@ -0,0 +1,54 @@
 
13229
+/*************************************************************************
 
13230
+ *
 
13231
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
13232
+ * 
 
13233
+ * Copyright 2008 by Sun Microsystems, Inc.
 
13234
+ *
 
13235
+ * OpenOffice.org - a multi-platform office productivity suite
 
13236
+ *
 
13237
+ * $RCSfile: 
 
13238
+ * $Revision: 
 
13239
+ *
 
13240
+ * This file is part of OpenOffice.org.
 
13241
+ *
 
13242
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
13243
+ * it under the terms of the GNU Lesser General Public License version 3
 
13244
+ * only, as published by the Free Software Foundation.
 
13245
+ *
 
13246
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
13247
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13248
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13249
+ * GNU Lesser General Public License version 3 for more details
 
13250
+ * (a copy is included in the LICENSE file that accompanied this code).
 
13251
+ *
 
13252
+ * You should have received a copy of the GNU Lesser General Public License
 
13253
+ * version 3 along with OpenOffice.org.  If not, see
 
13254
+ * <http://www.openoffice.org/license.html>
 
13255
+ * for a copy of the LGPLv3 License.
 
13256
+ *
 
13257
+ ************************************************************************/
 
13258
+#ifndef SW_VBA_TABSTOP_HXX
 
13259
+#define SW_VBA_TABSTOP_HXX
 
13260
+
 
13261
+#include <ooo/vba/word/XTabStop.hpp>
 
13262
+#include <vbahelper/vbahelperinterface.hxx>
 
13263
+#include <cppuhelper/implbase1.hxx>
 
13264
+#include <com/sun/star/style/TabStop.hpp>
 
13265
+
 
13266
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XTabStop > SwVbaTabStop_BASE;
 
13267
+
 
13268
+class SwVbaTabStop : public SwVbaTabStop_BASE
 
13269
+{
 
13270
+private:
 
13271
+    css::uno::Reference< css::beans::XPropertySet > mxParaProps;
 
13272
+    css::style::TabStop maTabStop;
 
13273
+
 
13274
+public:
 
13275
+    SwVbaTabStop( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::beans::XPropertySet >& xParaProps, const css::style::TabStop& aTabStop ) throw ( css::uno::RuntimeException );
 
13276
+    virtual ~SwVbaTabStop();
 
13277
+
 
13278
+    // XHelperInterface
 
13279
+    virtual rtl::OUString& getServiceImplName();
 
13280
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
13281
+};
 
13282
+#endif /* SW_VBA_TABSTOP_HXX */
 
13283
diff --git sw/source/ui/vba/vbatabstops.cxx sw/source/ui/vba/vbatabstops.cxx
 
13284
new file mode 100644
 
13285
index 0000000..8d19875
 
13286
--- /dev/null
 
13287
+++ sw/source/ui/vba/vbatabstops.cxx
 
13288
@@ -0,0 +1,280 @@
 
13289
+/*************************************************************************
 
13290
+ *
 
13291
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
13292
+ * 
 
13293
+ * Copyright 2008 by Sun Microsystems, Inc.
 
13294
+ *
 
13295
+ * OpenOffice.org - a multi-platform office productivity suite
 
13296
+ *
 
13297
+ * $RCSfile: 
 
13298
+ * $Revision: 
 
13299
+ *
 
13300
+ * This file is part of OpenOffice.org.
 
13301
+ *
 
13302
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
13303
+ * it under the terms of the GNU Lesser General Public License version 3
 
13304
+ * only, as published by the Free Software Foundation.
 
13305
+ *
 
13306
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
13307
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13308
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13309
+ * GNU Lesser General Public License version 3 for more details
 
13310
+ * (a copy is included in the LICENSE file that accompanied this code).
 
13311
+ *
 
13312
+ * You should have received a copy of the GNU Lesser General Public License
 
13313
+ * version 3 along with OpenOffice.org.  If not, see
 
13314
+ * <http://www.openoffice.org/license.html>
 
13315
+ * for a copy of the LGPLv3 License.
 
13316
+ *
 
13317
+ ************************************************************************/
 
13318
+#include "vbatabstops.hxx"
 
13319
+#include "vbatabstop.hxx"
 
13320
+#include <com/sun/star/style/TabAlign.hpp>
 
13321
+#include <ooo/vba/word/WdTabLeader.hpp>
 
13322
+#include <ooo/vba/word/WdTabAlignment.hpp>
 
13323
+
 
13324
+using namespace ::ooo::vba;
 
13325
+using namespace ::com::sun::star;
 
13326
+
 
13327
+uno::Sequence< style::TabStop > lcl_getTabStops( const uno::Reference< beans::XPropertySet >& xParaProps ) throw (uno::RuntimeException)
 
13328
+{
 
13329
+    uno::Sequence< style::TabStop > aSeq;
 
13330
+    xParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaTabStops") ) ) >>= aSeq;
 
13331
+    return aSeq;
 
13332
+}
 
13333
+
 
13334
+void lcl_setTabStops( const uno::Reference< beans::XPropertySet >& xParaProps, const uno::Sequence< style::TabStop >& aSeq ) throw (uno::RuntimeException)
 
13335
+{
 
13336
+    xParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaTabStops") ), uno::makeAny( aSeq ) );
 
13337
+}
 
13338
+
 
13339
+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > TabStopCollectionHelper_Base;
 
13340
+
 
13341
+class TabStopsEnumWrapper : public EnumerationHelper_BASE
 
13342
+{
 
13343
+    uno::Reference< container::XIndexAccess > mxIndexAccess;
 
13344
+    sal_Int32 nIndex;
 
13345
+
 
13346
+public:
 
13347
+    TabStopsEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : mxIndexAccess( xIndexAccess ), nIndex( 0 )
 
13348
+    {
 
13349
+    }
 
13350
+    virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException)
 
13351
+    {
 
13352
+        return ( nIndex < mxIndexAccess->getCount() );
 
13353
+    }
 
13354
+
 
13355
+    virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
 
13356
+    {
 
13357
+        if( nIndex < mxIndexAccess->getCount() )
 
13358
+        {
 
13359
+            return mxIndexAccess->getByIndex( nIndex++ );
 
13360
+        }
 
13361
+        throw container::NoSuchElementException();
 
13362
+    }
 
13363
+};
 
13364
+
 
13365
+class TabStopCollectionHelper : public TabStopCollectionHelper_Base
 
13366
+{
 
13367
+private:
 
13368
+    uno::Reference< XHelperInterface > mxParent;
 
13369
+    uno::Reference< uno::XComponentContext > mxContext;
 
13370
+    uno::Reference< beans::XPropertySet > mxParaProps;
 
13371
+    uno::Sequence< style::TabStop > maTabStops;
 
13372
+
 
13373
+public:
 
13374
+    TabStopCollectionHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& xParaProps ) throw ( css::uno::RuntimeException ): mxParent( xParent ), mxContext( xContext ), mxParaProps( xParaProps )
 
13375
+    {
 
13376
+        maTabStops = lcl_getTabStops( xParaProps );
 
13377
+    }
 
13378
+
 
13379
+    virtual ~TabStopCollectionHelper() {}
 
13380
+
 
13381
+    virtual sal_Int32 SAL_CALL getCount(  ) throw (uno::RuntimeException)
 
13382
+    {
 
13383
+        return maTabStops.getLength();
 
13384
+    }
 
13385
+    virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
 
13386
+    {
 
13387
+        if ( Index < 0 || Index >= getCount() )    
 
13388
+            throw css::lang::IndexOutOfBoundsException();
 
13389
+        
 
13390
+        const style::TabStop* pTabs = maTabStops.getConstArray();
 
13391
+        return uno::makeAny( uno::Reference< word::XTabStop >( new SwVbaTabStop( mxParent, mxContext, mxParaProps, pTabs[ Index ] ) ) );
 
13392
+    }
 
13393
+    virtual uno::Type SAL_CALL getElementType(  ) throw (uno::RuntimeException)
 
13394
+    {
 
13395
+        return word::XTabStop::static_type(0);
 
13396
+    }
 
13397
+    virtual sal_Bool SAL_CALL hasElements(  ) throw (uno::RuntimeException)
 
13398
+    {
 
13399
+        return sal_True;
 
13400
+    }
 
13401
+    // XEnumerationAccess
 
13402
+    virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration(  ) throw (uno::RuntimeException)
 
13403
+    {
 
13404
+        return new TabStopsEnumWrapper( this );
 
13405
+    }
 
13406
+};
 
13407
+
 
13408
+SwVbaTabStops::SwVbaTabStops( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& xParaProps ) throw (uno::RuntimeException) : SwVbaTabStops_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new TabStopCollectionHelper( xParent, xContext, xParaProps ) ) ), mxParaProps( xParaProps ) 
 
13409
+{
 
13410
+}
 
13411
+
 
13412
+uno::Reference< word::XTabStop > SAL_CALL SwVbaTabStops::Add( float Position, const uno::Any& Alignment, const uno::Any& Leader ) throw (uno::RuntimeException)
 
13413
+{
 
13414
+    sal_Int32 nPosition = Millimeter::getInHundredthsOfOneMillimeter( Position );
 
13415
+
 
13416
+    style::TabAlign nAlign = style::TabAlign_LEFT;
 
13417
+    if( Alignment.hasValue() )
 
13418
+    {
 
13419
+        sal_Int32 wdAlign = word::WdTabAlignment::wdAlignTabLeft;
 
13420
+        Alignment >>= wdAlign;
 
13421
+        switch( wdAlign )
 
13422
+        {
 
13423
+            case word::WdTabAlignment::wdAlignTabLeft:
 
13424
+            {
 
13425
+                nAlign = style::TabAlign_LEFT;
 
13426
+                break;
 
13427
+            }
 
13428
+            case word::WdTabAlignment::wdAlignTabRight:
 
13429
+            {
 
13430
+                nAlign = style::TabAlign_RIGHT;
 
13431
+                break;
 
13432
+            }
 
13433
+            case word::WdTabAlignment::wdAlignTabCenter:
 
13434
+            {
 
13435
+                nAlign = style::TabAlign_CENTER;
 
13436
+                break;
 
13437
+            }
 
13438
+            case word::WdTabAlignment::wdAlignTabDecimal:
 
13439
+            {
 
13440
+                nAlign = style::TabAlign_DECIMAL;
 
13441
+                break;
 
13442
+            }
 
13443
+            case word::WdTabAlignment::wdAlignTabBar:
 
13444
+            case word::WdTabAlignment::wdAlignTabList:
 
13445
+            {
 
13446
+                DebugHelper::exception( SbERR_NOT_IMPLEMENTED, rtl::OUString() );
 
13447
+                break;
 
13448
+            }
 
13449
+            default:
 
13450
+            {
 
13451
+                //left
 
13452
+            }
 
13453
+        }
 
13454
+    }
 
13455
+
 
13456
+    sal_Char cLeader = ' '; // default is space
 
13457
+    if( Leader.hasValue() )
 
13458
+    {
 
13459
+        sal_Int32 wdLeader = word::WdTabLeader::wdTabLeaderSpaces;
 
13460
+        Leader >>= wdLeader;
 
13461
+        switch( wdLeader )
 
13462
+        {
 
13463
+            case word::WdTabLeader::wdTabLeaderSpaces:
 
13464
+            {
 
13465
+                cLeader = ' ';
 
13466
+                break;
 
13467
+            }
 
13468
+            case word::WdTabLeader::wdTabLeaderMiddleDot:
 
13469
+            {
 
13470
+                cLeader = 183;
 
13471
+                break;
 
13472
+            }
 
13473
+            case word::WdTabLeader::wdTabLeaderDots:
 
13474
+            {
 
13475
+                cLeader = '.';
 
13476
+                break;
 
13477
+            }
 
13478
+            case word::WdTabLeader::wdTabLeaderDashes:
 
13479
+            case word::WdTabLeader::wdTabLeaderHeavy:
 
13480
+            case word::WdTabLeader::wdTabLeaderLines:
 
13481
+            {
 
13482
+                cLeader = '_';
 
13483
+                break;
 
13484
+            }
 
13485
+            default:
 
13486
+            {
 
13487
+                //left
 
13488
+            }
 
13489
+        }
 
13490
+    }
 
13491
+
 
13492
+    sal_Char cDecimal = '.'; // default value
 
13493
+
 
13494
+    style::TabStop aTab;
 
13495
+    aTab.Position = nPosition;
 
13496
+    aTab.Alignment = nAlign;
 
13497
+    aTab.DecimalChar = cDecimal;
 
13498
+    aTab.FillChar = cLeader;
 
13499
+
 
13500
+    uno::Sequence< style::TabStop > aOldTabs = lcl_getTabStops( mxParaProps );
 
13501
+    sal_Bool bOverWriter = sal_False;
 
13502
+
 
13503
+    sal_Int32 nTabs = aOldTabs.getLength();
 
13504
+    uno::Sequence< style::TabStop > aNewTabs( nTabs + 1 );
 
13505
+
 
13506
+    style::TabStop* pOldTab = aOldTabs.getArray();
 
13507
+    style::TabStop* pNewTab = aNewTabs.getArray();
 
13508
+    pNewTab[0] = aTab;
 
13509
+    for( sal_Int32 nIndex = 0; nIndex < nTabs && !bOverWriter; nIndex++ )
 
13510
+    {
 
13511
+        if( pOldTab[nIndex].Position == nPosition )
 
13512
+        {
 
13513
+            bOverWriter = sal_True;
 
13514
+            pOldTab[nIndex] = aTab;
 
13515
+            break;
 
13516
+        }
 
13517
+        pNewTab[ nIndex+1 ] = pOldTab[ nIndex ];
 
13518
+    }
 
13519
+    if( bOverWriter )
 
13520
+        lcl_setTabStops( mxParaProps, aOldTabs );
 
13521
+    else    
 
13522
+        lcl_setTabStops( mxParaProps, aNewTabs );
 
13523
+    
 
13524
+    return uno::Reference< word::XTabStop >( new SwVbaTabStop( this, mxContext, mxParaProps, aTab ) );
 
13525
+}
 
13526
+
 
13527
+void SAL_CALL SwVbaTabStops::ClearAll() throw (uno::RuntimeException)
 
13528
+{
 
13529
+    uno::Sequence< style::TabStop > aSeq;
 
13530
+    lcl_setTabStops( mxParaProps, aSeq );
 
13531
+}
 
13532
+
 
13533
+// XEnumerationAccess
 
13534
+uno::Type
 
13535
+SwVbaTabStops::getElementType() throw (uno::RuntimeException)
 
13536
+{
 
13537
+    return word::XTabStop::static_type(0);
 
13538
+}
 
13539
+uno::Reference< container::XEnumeration >
 
13540
+SwVbaTabStops::createEnumeration() throw (uno::RuntimeException)
 
13541
+{
 
13542
+    return new TabStopsEnumWrapper( m_xIndexAccess );
 
13543
+}
 
13544
+
 
13545
+uno::Any
 
13546
+SwVbaTabStops::createCollectionObject( const css::uno::Any& aSource )
 
13547
+{
 
13548
+    return aSource;
 
13549
+}
 
13550
+
 
13551
+rtl::OUString& 
 
13552
+SwVbaTabStops::getServiceImplName()
 
13553
+{
 
13554
+    static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTabStops") );
 
13555
+    return sImplName;
 
13556
+}
 
13557
+
 
13558
+css::uno::Sequence<rtl::OUString> 
 
13559
+SwVbaTabStops::getServiceNames()
 
13560
+{
 
13561
+    static uno::Sequence< rtl::OUString > sNames;
 
13562
+    if ( sNames.getLength() == 0 )
 
13563
+    {
 
13564
+        sNames.realloc( 1 );
 
13565
+        sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TabStops") );
 
13566
+    }
 
13567
+    return sNames;
 
13568
+}
 
13569
diff --git sw/source/ui/vba/vbatabstops.hxx sw/source/ui/vba/vbatabstops.hxx
 
13570
new file mode 100644
 
13571
index 0000000..913e12b
 
13572
--- /dev/null
 
13573
+++ sw/source/ui/vba/vbatabstops.hxx
 
13574
@@ -0,0 +1,65 @@
 
13575
+/*************************************************************************
 
13576
+ *
 
13577
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
13578
+ * 
 
13579
+ * Copyright 2008 by Sun Microsystems, Inc.
 
13580
+ *
 
13581
+ * OpenOffice.org - a multi-platform office productivity suite
 
13582
+ *
 
13583
+ * $RCSfile: 
 
13584
+ * $Revision: 
 
13585
+ *
 
13586
+ * This file is part of OpenOffice.org.
 
13587
+ *
 
13588
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
13589
+ * it under the terms of the GNU Lesser General Public License version 3
 
13590
+ * only, as published by the Free Software Foundation.
 
13591
+ *
 
13592
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
13593
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13594
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13595
+ * GNU Lesser General Public License version 3 for more details
 
13596
+ * (a copy is included in the LICENSE file that accompanied this code).
 
13597
+ *
 
13598
+ * You should have received a copy of the GNU Lesser General Public License
 
13599
+ * version 3 along with OpenOffice.org.  If not, see
 
13600
+ * <http://www.openoffice.org/license.html>
 
13601
+ * for a copy of the LGPLv3 License.
 
13602
+ *
 
13603
+ ************************************************************************/
 
13604
+#ifndef SW_VBA_TABSTOPS_HXX
 
13605
+#define SW_VBA_TABSTOPS_HXX
 
13606
+
 
13607
+#include <vbahelper/vbacollectionimpl.hxx>
 
13608
+#include <ooo/vba/word/XTabStops.hpp>
 
13609
+#include <ooo/vba/word/XTabStop.hpp>
 
13610
+#include <com/sun/star/container/XEnumerationAccess.hpp>
 
13611
+#include <com/sun/star/container/XIndexAccess.hpp>
 
13612
+#include <vbahelper/vbahelperinterface.hxx>
 
13613
+
 
13614
+typedef CollTestImplHelper< ooo::vba::word::XTabStops > SwVbaTabStops_BASE;
 
13615
+
 
13616
+class SwVbaTabStops : public SwVbaTabStops_BASE
 
13617
+{
 
13618
+private:
 
13619
+    css::uno::Reference< css::beans::XPropertySet > mxParaProps;
 
13620
+
 
13621
+public:
 
13622
+    SwVbaTabStops( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& xParaProps ) throw ( css::uno::RuntimeException );
 
13623
+    virtual ~SwVbaTabStops() {}
 
13624
+
 
13625
+    // Methods
 
13626
+    virtual css::uno::Reference< ::ooo::vba::word::XTabStop > SAL_CALL Add( float Position, const css::uno::Any& Alignment, const css::uno::Any& Leader ) throw (css::uno::RuntimeException);
 
13627
+    virtual void SAL_CALL ClearAll(  ) throw (css::uno::RuntimeException);
 
13628
+
 
13629
+    // XEnumerationAccess
 
13630
+    virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
 
13631
+    virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
 
13632
+
 
13633
+    // SwVbaTabStops_BASE
 
13634
+    virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); 
 
13635
+    virtual rtl::OUString& getServiceImplName();
 
13636
+    virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
13637
+};    
 
13638
+
 
13639
+#endif /* SW_VBA_TABSTOPS_HXX */
 
13640
diff --git sw/source/ui/vba/vbatemplate.cxx sw/source/ui/vba/vbatemplate.cxx
 
13641
index 136a9ec..a7a1a6c 100644
 
13642
--- sw/source/ui/vba/vbatemplate.cxx
 
13643
+++ sw/source/ui/vba/vbatemplate.cxx
 
13644
@@ -33,12 +33,35 @@
 
13645
 #include "vbaautotextentry.hxx"
 
13646
 #include <comphelper/processfactory.hxx>
 
13647
 #include <com/sun/star/text/XAutoTextContainer.hpp>
 
13648
+#include <tools/urlobj.hxx>
 
13649
+#include <osl/file.hxx>
 
13650
 
 
13651
 using namespace ::ooo::vba;
 
13652
 using namespace ::com::sun::star;
 
13653
 
 
13654
-SwVbaTemplate::SwVbaTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& rName )
 
13655
-    : SwVbaTemplate_BASE( rParent, rContext ), mxModel( rModel ), msName( rName )
 
13656
+String lcl_CheckGroupName( const String& rGroupName )
 
13657
+{
 
13658
+    String sRet;
 
13659
+    //group name should contain only A-Z and a-z and spaces
 
13660
+    for( xub_StrLen i = 0; i < rGroupName.Len(); i++ )
 
13661
+    {
 
13662
+        sal_Unicode cChar = rGroupName.GetChar(i);
 
13663
+        if(    (cChar >= 'A' && cChar <= 'Z') ||
 
13664
+            (cChar >= 'a' && cChar <= 'z') ||
 
13665
+            (cChar >= '0' && cChar <= '9') ||
 
13666
+            cChar == '_' || cChar == 0x20 )
 
13667
+        {
 
13668
+            sRet += cChar;
 
13669
+        }
 
13670
+    }
 
13671
+    sRet.EraseLeadingChars();
 
13672
+    sRet.EraseTrailingChars();
 
13673
+    return sRet;
 
13674
+}
 
13675
+
 
13676
+
 
13677
+SwVbaTemplate::SwVbaTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& rFullUrl )
 
13678
+    : SwVbaTemplate_BASE( rParent, rContext ), mxModel( rModel ), msFullUrl( rFullUrl )
 
13679
 {
 
13680
 }
 
13681
 
 
13682
@@ -50,7 +73,27 @@ SwVbaTemplate::~SwVbaTemplate()
 
13683
 rtl::OUString
 
13684
 SwVbaTemplate::getName() throw ( css::uno::RuntimeException )
 
13685
 {
 
13686
-    return msName;
 
13687
+    rtl::OUString sName;
 
13688
+    if( msFullUrl.getLength() )
 
13689
+    {
 
13690
+        INetURLObject aURL( msFullUrl );
 
13691
+        ::osl::File::getSystemPathFromFileURL( aURL.GetLastName(), sName );
 
13692
+    }
 
13693
+    return sName;
 
13694
+}
 
13695
+
 
13696
+rtl::OUString
 
13697
+SwVbaTemplate::getPath() throw ( css::uno::RuntimeException )
 
13698
+{
 
13699
+    rtl::OUString sPath;
 
13700
+    if( msFullUrl.getLength() )
 
13701
+    {
 
13702
+        INetURLObject aURL( msFullUrl );
 
13703
+        rtl::OUString sURL( aURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) );
 
13704
+        sURL = sURL.copy( 0, sURL.getLength() - aURL.GetLastName().getLength() - 1 );
 
13705
+        ::osl::File::getSystemPathFromFileURL( sURL, sPath );
 
13706
+    }
 
13707
+    return sPath;
 
13708
 }
 
13709
 
 
13710
 uno::Any SAL_CALL
 
13711
@@ -61,17 +104,18 @@ SwVbaTemplate::AutoTextEntries( const uno::Any& index ) throw (uno::RuntimeExcep
 
13712
 
 
13713
     // the default template is "Normal.dot" in Word.
 
13714
     rtl::OUString sGroup( RTL_CONSTASCII_USTRINGPARAM("Normal") );
 
13715
-    sal_Int32 nIndex = msName.lastIndexOf( sal_Unicode('.') );
 
13716
+    rtl::OUString sName = getName();
 
13717
+    sal_Int32 nIndex = sName.lastIndexOf( sal_Unicode('.') );
 
13718
     if( nIndex > 0 )
 
13719
     {
 
13720
-        sGroup = msName.copy( 0, msName.lastIndexOf( sal_Unicode('.') ) );
 
13721
-       // OSL_TRACE("SwVbaTemplate::AutoTextEntries: %s", rtl::OUStringToOString( sGroup, RTL_TEXTENCODING_UTF8 ).getStr() );
 
13722
+        sGroup = sName.copy( 0, sName.lastIndexOf( sal_Unicode('.') ) );
 
13723
     }
 
13724
-    
 
13725
+    String sNewGroup = lcl_CheckGroupName( sGroup );
 
13726
+
 
13727
     uno::Reference< container::XIndexAccess > xGroup;
 
13728
-    if( xAutoTextContainer->hasByName( sGroup ) )
 
13729
+    if( xAutoTextContainer->hasByName( sNewGroup ) )
 
13730
     {
 
13731
-        xGroup.set( xAutoTextContainer->getByName( sGroup ), uno::UNO_QUERY_THROW );
 
13732
+        xGroup.set( xAutoTextContainer->getByName( sNewGroup ), uno::UNO_QUERY_THROW );
 
13733
     }
 
13734
     else
 
13735
     {
 
13736
diff --git sw/source/ui/vba/vbatemplate.hxx sw/source/ui/vba/vbatemplate.hxx
 
13737
index df8848b..502e9be 100644
 
13738
--- sw/source/ui/vba/vbatemplate.hxx
 
13739
+++ sw/source/ui/vba/vbatemplate.hxx
 
13740
@@ -39,7 +39,7 @@ class SwVbaTemplate : public SwVbaTemplate_BASE
 
13741
 {
 
13742
 private:
 
13743
     css::uno::Reference< css::frame::XModel > mxModel;
 
13744
-    rtl::OUString msName;
 
13745
+    rtl::OUString msFullUrl;
 
13746
 public:
 
13747
        SwVbaTemplate( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, 
 
13748
         const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& );
 
13749
@@ -47,6 +47,7 @@ public:
 
13750
 
 
13751
    // XTemplate
 
13752
     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
 
13753
+    virtual rtl::OUString SAL_CALL getPath() throw (css::uno::RuntimeException);
 
13754
     virtual css::uno::Any SAL_CALL AutoTextEntries( const css::uno::Any& index ) throw (css::uno::RuntimeException);
 
13755
        // XHelperInterface
 
13756
        virtual rtl::OUString& getServiceImplName();
 
13757
diff --git sw/source/ui/vba/vbaview.cxx sw/source/ui/vba/vbaview.cxx
 
13758
index bc7b9b4..df9a524 100644
 
13759
--- sw/source/ui/vba/vbaview.cxx
 
13760
+++ sw/source/ui/vba/vbaview.cxx
 
13761
@@ -95,20 +95,20 @@ SwVbaView::getSeekView() throw (css::uno::RuntimeException)
 
13762
     }
 
13763
     else if( aImplName.equalsAscii("SwXHeadFootText") )
 
13764
     {
 
13765
-        if( HeaderFooterHelper::isHeader( mxModel, xCurrentText ) )
 
13766
+        if( HeaderFooterHelper::isHeader( mxModel ) )
 
13767
         {
 
13768
-            if( HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) )
 
13769
+            if( HeaderFooterHelper::isFirstPageHeader( mxModel ) )
 
13770
                 return word::WdSeekView::wdSeekFirstPageHeader;
 
13771
-            else if( HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) )
 
13772
+            else if( HeaderFooterHelper::isEvenPagesHeader( mxModel ) )
 
13773
                 return word::WdSeekView::wdSeekEvenPagesHeader;
 
13774
             else
 
13775
                 return word::WdSeekView::wdSeekPrimaryHeader;
 
13776
         }
 
13777
         else
 
13778
         {
 
13779
-            if( HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) )
 
13780
+            if( HeaderFooterHelper::isFirstPageFooter( mxModel ) )
 
13781
                 return word::WdSeekView::wdSeekFirstPageFooter;
 
13782
-            else if( HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) )
 
13783
+            else if( HeaderFooterHelper::isEvenPagesFooter( mxModel ) )
 
13784
                 return word::WdSeekView::wdSeekEvenPagesFooter;
 
13785
             else
 
13786
                 return word::WdSeekView::wdSeekPrimaryFooter;
 
13787
@@ -135,6 +135,7 @@ SwVbaView::setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeExceptio
 
13788
     // if( _seekview == getSeekView() )
 
13789
     //    return;
 
13790
 
 
13791
+    word::gotoSelectedObjectAnchor( mxModel );
 
13792
     switch( _seekview )
 
13793
     {
 
13794
         case word::WdSeekView::wdSeekFirstPageFooter:
 
13795
@@ -184,7 +185,7 @@ SwVbaView::setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeExceptio
 
13796
         {
 
13797
             uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW );
 
13798
             uno::Reference< text::XText > xText = xTextDocument->getText();
 
13799
-            mxViewCursor->gotoRange( getFirstObjectPosition( xText ), sal_False );
 
13800
+            mxViewCursor->gotoRange( word::getFirstObjectPosition( xText ), sal_False );
 
13801
             break;
 
13802
         }
 
13803
     }
 
13804
@@ -379,28 +380,7 @@ uno::Reference< text::XTextRange > SwVbaView::getHFTextRange( sal_Int32 nType )
 
13805
     {
 
13806
         DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() );
 
13807
     }
 
13808
-    uno::Reference< text::XTextRange > xTextRange = getFirstObjectPosition( xText );
 
13809
-    return xTextRange;
 
13810
-}
 
13811
-
 
13812
-uno::Reference< text::XTextRange > SwVbaView::getFirstObjectPosition( const uno::Reference< text::XText >& xText ) throw (uno::RuntimeException)
 
13813
-{
 
13814
-    // if the first object is table, get the position of first cell 
 
13815
-    uno::Reference< text::XTextRange > xTextRange;
 
13816
-    uno::Reference< container::XEnumerationAccess > xParaAccess( xText, uno::UNO_QUERY_THROW );
 
13817
-    uno::Reference< container::XEnumeration> xParaEnum = xParaAccess->createEnumeration();
 
13818
-    if( xParaEnum->hasMoreElements() )
 
13819
-    {
 
13820
-        uno::Reference< lang::XServiceInfo > xServiceInfo( xParaEnum->nextElement(), uno::UNO_QUERY_THROW );
 
13821
-        if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable") ) ) )
 
13822
-        {
 
13823
-            uno::Reference< table::XCellRange > xCellRange( xServiceInfo, uno::UNO_QUERY_THROW );
 
13824
-            uno::Reference< text::XText> xFirstCellText( xCellRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
 
13825
-            xTextRange = xFirstCellText->getStart();
 
13826
-        }
 
13827
-    }
 
13828
-    if( !xTextRange.is() )
 
13829
-        xTextRange = xText->getStart();
 
13830
+    uno::Reference< text::XTextRange > xTextRange = word::getFirstObjectPosition( xText );
 
13831
     return xTextRange;
 
13832
 }
 
13833
 
 
13834
diff --git sw/source/ui/vba/vbawindow.cxx sw/source/ui/vba/vbawindow.cxx
 
13835
index abdf3d5..a0ac99d 100644
 
13836
--- sw/source/ui/vba/vbawindow.cxx
 
13837
+++ sw/source/ui/vba/vbawindow.cxx
 
13838
@@ -28,12 +28,16 @@
 
13839
  *
 
13840
  ************************************************************************/
 
13841
 #include <vbahelper/helperdecl.hxx>
 
13842
+#include <ooo/vba/word/WdWindowState.hpp>
 
13843
 #include "vbawindow.hxx"
 
13844
 #include "vbaglobals.hxx"
 
13845
 #include "vbadocument.hxx"
 
13846
 #include "vbaview.hxx"
 
13847
 #include "vbapanes.hxx"
 
13848
 #include "vbapane.hxx"
 
13849
+#include "wordvbahelper.hxx"
 
13850
+#include <view.hxx>
 
13851
+#include <sfx2/topfrm.hxx>
 
13852
 
 
13853
 using namespace ::com::sun::star;
 
13854
 using namespace ::ooo::vba;
 
13855
@@ -81,6 +85,52 @@ void SAL_CALL SwVbaWindow::setView( const uno::Any& _view ) throw (uno::RuntimeE
 
13856
 }
 
13857
 
 
13858
 uno::Any SAL_CALL 
 
13859
+SwVbaWindow::getWindowState() throw (uno::RuntimeException)
 
13860
+{      
 
13861
+    sal_Int32 nwindowState = word::WdWindowState::wdWindowStateNormal;
 
13862
+    SwView* pView = word::getView( m_xModel );
 
13863
+    SfxViewFrame* pViewFrame = pView -> GetViewFrame();
 
13864
+    SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, pViewFrame -> GetTopViewFrame() );
 
13865
+    if ( pTop )
 
13866
+    {
 
13867
+        WorkWindow* pWork = (WorkWindow*) pTop->GetTopFrame_Impl()->GetSystemWindow();
 
13868
+        if ( pWork )
 
13869
+        {
 
13870
+            if ( pWork -> IsMaximized())
 
13871
+                nwindowState = word::WdWindowState::wdWindowStateMaximize;
 
13872
+            else if (pWork -> IsMinimized())
 
13873
+                nwindowState = word::WdWindowState::wdWindowStateMinimize;
 
13874
+        }
 
13875
+    }
 
13876
+    return uno::makeAny( nwindowState );
 
13877
+}
 
13878
+
 
13879
+void SAL_CALL 
 
13880
+SwVbaWindow::setWindowState( const uno::Any& _windowstate ) throw (uno::RuntimeException)
 
13881
+{
 
13882
+    sal_Int32 nwindowState = word::WdWindowState::wdWindowStateMaximize;
 
13883
+    _windowstate >>= nwindowState;
 
13884
+    SwView* pView = word::getView( m_xModel );
 
13885
+    SfxViewFrame* pViewFrame = pView -> GetViewFrame();
 
13886
+    SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, pViewFrame -> GetTopViewFrame() );
 
13887
+    if ( pTop )
 
13888
+    {
 
13889
+        WorkWindow* pWork = (WorkWindow*) pTop->GetTopFrame_Impl()->GetSystemWindow();
 
13890
+        if ( pWork )
 
13891
+        {
 
13892
+            if ( nwindowState == word::WdWindowState::wdWindowStateMaximize )
 
13893
+                pWork -> Maximize();
 
13894
+            else if (nwindowState == word::WdWindowState::wdWindowStateMinimize)
 
13895
+                pWork -> Minimize();
 
13896
+            else if (nwindowState == word::WdWindowState::wdWindowStateNormal)
 
13897
+                pWork -> Restore();
 
13898
+            else
 
13899
+                throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Invalid Parameter" ) ), uno::Reference< uno::XInterface >() );
 
13900
+        }
 
13901
+    }
 
13902
+}
 
13903
+
 
13904
+uno::Any SAL_CALL 
 
13905
 SwVbaWindow::Panes( const uno::Any& aIndex ) throw (uno::RuntimeException)
 
13906
 {
 
13907
     uno::Reference< XCollection > xPanes( new SwVbaPanes( this,  mxContext, m_xModel ) );
 
13908
diff --git sw/source/ui/vba/vbawindow.hxx sw/source/ui/vba/vbawindow.hxx
 
13909
index 11a1a36..7e30d2c 100644
 
13910
--- sw/source/ui/vba/vbawindow.hxx
 
13911
+++ sw/source/ui/vba/vbawindow.hxx
 
13912
@@ -48,6 +48,8 @@ public:
 
13913
     // Attributes
 
13914
     virtual css::uno::Any SAL_CALL getView() throw (css::uno::RuntimeException);
 
13915
     virtual void SAL_CALL setView( const css::uno::Any& _view ) throw (css::uno::RuntimeException);
 
13916
+    virtual css::uno::Any SAL_CALL getWindowState() throw (css::uno::RuntimeException);
 
13917
+    virtual void SAL_CALL setWindowState( const css::uno::Any& _windowstate ) throw (css::uno::RuntimeException);
 
13918
        // Methods
 
13919
        virtual void SAL_CALL Activate(  ) throw (css::uno::RuntimeException);
 
13920
        virtual void SAL_CALL Close( const css::uno::Any& SaveChanges, const css::uno::Any& RouteDocument ) throw (css::uno::RuntimeException);
 
13921
diff --git sw/source/ui/vba/wordvbahelper.cxx sw/source/ui/vba/wordvbahelper.cxx
 
13922
index 409b8bd..0772d07 100644
 
13923
--- sw/source/ui/vba/wordvbahelper.cxx
 
13924
+++ sw/source/ui/vba/wordvbahelper.cxx
 
13925
@@ -32,11 +32,16 @@
 
13926
 #include <comphelper/processfactory.hxx>
 
13927
 #include <com/sun/star/frame/XController.hpp>
 
13928
 #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
 
13929
+#include <com/sun/star/text/XTextTable.hpp>
 
13930
+#include <com/sun/star/table/XCellRange.hpp>
 
13931
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 
13932
 #include <com/sun/star/container/XNameAccess.hpp>
 
13933
+#include <com/sun/star/container/XIndexAccess.hpp>
 
13934
 #include <com/sun/star/lang/XUnoTunnel.hpp>
 
13935
+#include <com/sun/star/view/XSelectionSupplier.hpp>
 
13936
 #include <unotxdoc.hxx>
 
13937
 #include <doc.hxx>
 
13938
+#include <view.hxx>
 
13939
 
 
13940
 using namespace ::com::sun::star;
 
13941
 using namespace ::ooo::vba;
 
13942
@@ -74,8 +79,13 @@ uno::Reference< text::XTextViewCursor > getXTextViewCursor( const uno::Reference
 
13943
 uno::Reference< style::XStyle > getCurrentPageStyle( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
 
13944
 {
 
13945
     uno::Reference< beans::XPropertySet > xCursorProps( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
 
13946
+    return getCurrentPageStyle( xModel, xCursorProps );
 
13947
+}
 
13948
+
 
13949
+uno::Reference< style::XStyle > getCurrentPageStyle( const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xProps ) throw (uno::RuntimeException)
 
13950
+{
 
13951
     rtl::OUString aPageStyleName;
 
13952
-    xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName;
 
13953
+    xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName;
 
13954
     uno::Reference< style::XStyleFamiliesSupplier > xSytleFamSupp( xModel, uno::UNO_QUERY_THROW );
 
13955
     uno::Reference< container::XNameAccess > xSytleFamNames( xSytleFamSupp->getStyleFamilies(), uno::UNO_QUERY_THROW );
 
13956
     uno::Reference< container::XNameAccess > xPageStyles( xSytleFamNames->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyles") ) ), uno::UNO_QUERY_THROW );
 
13957
@@ -90,6 +100,92 @@ sal_Int32 getPageCount( const uno::Reference< frame::XModel>& xModel ) throw (un
 
13958
     return pDocShell ? pDocShell->GetDoc()->GetPageCount() : 0;
 
13959
 }
 
13960
 
 
13961
+uno::Reference< style::XStyle > getDefaultParagraphStyle( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
 
13962
+{
 
13963
+    uno::Reference< style::XStyleFamiliesSupplier > xSytleFamSupp( xModel, uno::UNO_QUERY_THROW );
 
13964
+    uno::Reference< container::XNameAccess > xSytleFamNames( xSytleFamSupp->getStyleFamilies(), uno::UNO_QUERY_THROW );
 
13965
+    uno::Reference< container::XNameAccess > xParaStyles( xSytleFamNames->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") ) ), uno::UNO_QUERY_THROW );
 
13966
+    uno::Reference< style::XStyle > xStyle( xParaStyles->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ) ), uno::UNO_QUERY_THROW );
 
13967
+
 
13968
+    return xStyle;
 
13969
+}
 
13970
+
 
13971
+uno::Reference< text::XTextRange > getFirstObjectPosition( const uno::Reference< text::XText >& xText ) throw (uno::RuntimeException)
 
13972
+{
 
13973
+    // if the first object is table, get the position of first cell 
 
13974
+    uno::Reference< text::XTextRange > xTextRange;
 
13975
+    uno::Reference< container::XEnumerationAccess > xParaAccess( xText, uno::UNO_QUERY_THROW );
 
13976
+    uno::Reference< container::XEnumeration> xParaEnum = xParaAccess->createEnumeration();
 
13977
+    if( xParaEnum->hasMoreElements() )
 
13978
+    {
 
13979
+        uno::Reference< lang::XServiceInfo > xServiceInfo( xParaEnum->nextElement(), uno::UNO_QUERY_THROW );
 
13980
+        if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable") ) ) )
 
13981
+        {
 
13982
+            uno::Reference< table::XCellRange > xCellRange( xServiceInfo, uno::UNO_QUERY_THROW );
 
13983
+            uno::Reference< text::XText> xFirstCellText( xCellRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
 
13984
+            xTextRange = xFirstCellText->getStart();
 
13985
+        }
 
13986
+    }
 
13987
+    if( !xTextRange.is() )
 
13988
+        xTextRange = xText->getStart();
 
13989
+    return xTextRange;
 
13990
+}
 
13991
+
 
13992
+uno::Reference< text::XText > getCurrentXText( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
 
13993
+{
 
13994
+    uno::Reference< text::XTextRange > xTextRange;
 
13995
+    uno::Reference< text::XTextContent > xTextContent( xModel->getCurrentSelection(), uno::UNO_QUERY );
 
13996
+    if( !xTextContent.is() )
 
13997
+    {
 
13998
+        uno::Reference< container::XIndexAccess > xIndexAccess( xModel->getCurrentSelection(), uno::UNO_QUERY );
 
13999
+        if( xIndexAccess.is() )
 
14000
+        {
 
14001
+            xTextContent.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY );
 
14002
+        }
 
14003
+    }    
 
14004
+
 
14005
+    if( xTextContent.is() )
 
14006
+        xTextRange.set( xTextContent->getAnchor(), uno::UNO_QUERY );
 
14007
+
 
14008
+    if( !xTextRange.is() )    
 
14009
+        xTextRange.set( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); 
 
14010
+        
 
14011
+    uno::Reference< text::XText > xText;
 
14012
+    try
 
14013
+    {
 
14014
+        xText.set( xTextRange->getText(), uno::UNO_QUERY );
 
14015
+    }
 
14016
+    catch( uno::RuntimeException& )
 
14017
+    {
 
14018
+        //catch exception "no text selection" 
 
14019
+    }
 
14020
+    uno::Reference< beans::XPropertySet > xVCProps( xTextRange, uno::UNO_QUERY_THROW );
 
14021
+    while( xVCProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextContent )
 
14022
+    {
 
14023
+        xText = xTextContent->getAnchor()->getText();
 
14024
+        xVCProps.set( xText->createTextCursor(), uno::UNO_QUERY_THROW );
 
14025
+    }
 
14026
+
 
14027
+    if( !xText.is() )
 
14028
+        throw  uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), uno::Reference< uno::XInterface >() );
 
14029
+
 
14030
+    return xText;
 
14031
+}
 
14032
+
 
14033
+sal_Bool gotoSelectedObjectAnchor( const uno::Reference< frame::XModel>& xModel ) throw (uno::RuntimeException)
 
14034
+{
 
14035
+    sal_Bool isObjectSelected = sal_False;
 
14036
+    uno::Reference< text::XTextContent > xTextContent( xModel->getCurrentSelection(), uno::UNO_QUERY );
 
14037
+    if( xTextContent.is() )
 
14038
+    {
 
14039
+        uno::Reference< text::XTextRange > xTextRange( xTextContent->getAnchor(), uno::UNO_QUERY_THROW );
 
14040
+        uno::Reference< view::XSelectionSupplier > xSelectSupp( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
 
14041
+        xSelectSupp->select( uno::makeAny( xTextRange ) );
 
14042
+        isObjectSelected = sal_True;
 
14043
+    }
 
14044
+    return isObjectSelected;
 
14045
+}
 
14046
+
 
14047
 } // word
 
14048
 } // 
 
14049
 } //
 
14050
diff --git sw/source/ui/vba/wordvbahelper.hxx sw/source/ui/vba/wordvbahelper.hxx
 
14051
index 88aa3c1..1f9835b 100644
 
14052
--- sw/source/ui/vba/wordvbahelper.hxx
 
14053
+++ sw/source/ui/vba/wordvbahelper.hxx
 
14054
@@ -35,6 +35,8 @@
 
14055
 #include <com/sun/star/text/XTextViewCursor.hpp>
 
14056
 #include <com/sun/star/text/XPageCursor.hpp>
 
14057
 #include <com/sun/star/style/XStyle.hpp>
 
14058
+#include <com/sun/star/text/XTextTable.hpp>
 
14059
+#include <com/sun/star/beans/XPropertySet.hpp>
 
14060
 
 
14061
 class SwDocShell;
 
14062
 class SwView;
 
14063
@@ -49,7 +51,20 @@ namespace ooo
 
14064
         SwView* getView( const css::uno::Reference< css::frame::XModel>& xModel );
 
14065
         css::uno::Reference< css::text::XTextViewCursor > getXTextViewCursor( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
 
14066
         css::uno::Reference< css::style::XStyle > getCurrentPageStyle( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
 
14067
+        css::uno::Reference< css::style::XStyle > getCurrentPageStyle( const css::uno::Reference< css::frame::XModel>& xModel, const css::uno::Reference< css::beans::XPropertySet >& xProps ) throw (css::uno::RuntimeException);
 
14068
         sal_Int32 getPageCount( const css::uno::Reference< css::frame::XModel>& xModel ) throw (css::uno::RuntimeException);
 
14069
+        css::uno::Reference< css::style::XStyle > getDefaultParagraphStyle( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
 
14070
+        css::uno::Reference< css::text::XTextRange > getFirstObjectPosition( const css::uno::Reference< css::text::XText >& xText ) throw (css::uno::RuntimeException);
 
14071
+        css::uno::Reference< css::text::XText > getCurrentXText( const css::uno::Reference< css::frame::XModel>& xModel ) throw (css::uno::RuntimeException);
 
14072
+        sal_Bool gotoSelectedObjectAnchor( const css::uno::Reference< css::frame::XModel>& xModel ) throw (css::uno::RuntimeException);
 
14073
+
 
14074
+    enum E_DIRECTION
 
14075
+    {
 
14076
+        MOVE_LEFT = 1,
 
14077
+        MOVE_RIGHT,
 
14078
+        MOVE_UP,
 
14079
+        MOVE_DOWN
 
14080
+    };
 
14081
 
 
14082
 } // word
 
14083
 } // vba
 
14084
diff --git sw/util/makefile.mk sw/util/makefile.mk
 
14085
index b4e1127..b726149 100644
 
14086
--- sw/util/makefile.mk
 
14087
+++ sw/util/makefile.mk
 
14088
@@ -375,6 +375,10 @@ SHL5STDLIBS= \
 
14089
                    $(SVXCORELIB) \
 
14090
                 $(SVXMSFILTERLIB) \
 
14091
 
 
14092
+.IF "$(GUI)"=="WNT"
 
14093
+SHL5STDLIBS+=$(SHELLLIB)
 
14094
+.ENDIF #WNT
 
14095
+
 
14096
 SHL5DEPN=$(SHL1TARGETN)
 
14097
 SHL5LIBS=$(SLB)$/$(TARGET_VBA).lib
 
14098
 
 
14099
diff --git vbahelper/inc/vbahelper/vbacollectionimpl.hxx vbahelper/inc/vbahelper/vbacollectionimpl.hxx
 
14100
index bc60cf1..9dbd9f7 100644
 
14101
--- vbahelper/inc/vbahelper/vbacollectionimpl.hxx
 
14102
+++ vbahelper/inc/vbahelper/vbacollectionimpl.hxx
 
14103
@@ -161,12 +161,25 @@ typedef InheritedHelperInterfaceImpl< Ifc1 > BaseColBase;
 
14104
 protected:
 
14105
        css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess;
 
14106
        css::uno::Reference< css::container::XNameAccess > m_xNameAccess;
 
14107
+    sal_Bool mbIgnoreCase;
 
14108
 
 
14109
        virtual css::uno::Any getItemByStringIndex( const rtl::OUString& sIndex ) throw (css::uno::RuntimeException)
 
14110
        {
 
14111
                if ( !m_xNameAccess.is() )
 
14112
                        throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBase string index access not supported by this object") ), css::uno::Reference< css::uno::XInterface >() );
 
14113
        
 
14114
+        if( mbIgnoreCase )
 
14115
+        {
 
14116
+            css::uno::Sequence< rtl::OUString > sElementNames = m_xNameAccess->getElementNames();
 
14117
+            for( sal_Int32 i = 0; i < sElementNames.getLength(); i++ )
 
14118
+            {
 
14119
+                rtl::OUString aName = sElementNames[i];
 
14120
+                if( aName.equalsIgnoreAsciiCase( sIndex ) )
 
14121
+                {
 
14122
+                    return createCollectionObject( m_xNameAccess->getByName( aName ) );
 
14123
+                }
 
14124
+            }
 
14125
+        }
 
14126
                return createCollectionObject( m_xNameAccess->getByName( sIndex ) );    
 
14127
        }               
 
14128
 
 
14129
@@ -185,7 +198,7 @@ protected:
 
14130
                return createCollectionObject( m_xIndexAccess->getByIndex( nIndex - 1 ) );              
 
14131
        }
 
14132
 public:
 
14133
-       ScVbaCollectionBase( const css::uno::Reference< ov::XHelperInterface >& xParent,   const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) : BaseColBase( xParent, xContext ), m_xIndexAccess( xIndexAccess ){ m_xNameAccess.set(m_xIndexAccess, css::uno::UNO_QUERY); }
 
14134
+    ScVbaCollectionBase( const css::uno::Reference< ov::XHelperInterface >& xParent,   const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, sal_Bool bIgnoreCase = sal_False ) : BaseColBase( xParent, xContext ), m_xIndexAccess( xIndexAccess ), mbIgnoreCase( bIgnoreCase ) { m_xNameAccess.set(m_xIndexAccess, css::uno::UNO_QUERY); }
 
14135
        //XCollection
 
14136
        virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException)
 
14137
        {
 
14138
@@ -250,7 +263,7 @@ class VBAHELPER_DLLPUBLIC CollTestImplHelper :  public ScVbaCollectionBase< ::cp
 
14139
 typedef ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc >  > ImplBase1;
 
14140
 
 
14141
 public:
 
14142
-       CollTestImplHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,  const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw( css::uno::RuntimeException ) : ImplBase1( xParent, xContext, xIndexAccess ) {}
 
14143
+    CollTestImplHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,  const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, sal_Bool bIgnoreCase = sal_False ) throw( css::uno::RuntimeException ) : ImplBase1( xParent, xContext, xIndexAccess, bIgnoreCase ) {}
 
14144
 };
 
14145
 
 
14146
 
 
14147
diff --git vbahelper/inc/vbahelper/vbadocumentbase.hxx vbahelper/inc/vbahelper/vbadocumentbase.hxx
 
14148
index 9576510..3880a46 100644
 
14149
--- vbahelper/inc/vbahelper/vbadocumentbase.hxx
 
14150
+++ vbahelper/inc/vbahelper/vbadocumentbase.hxx
 
14151
@@ -60,7 +60,7 @@ public:
 
14152
        virtual void SAL_CALL Close( const css::uno::Any &bSaveChanges,
 
14153
                                                                 const css::uno::Any &aFileName,
 
14154
                                                                 const css::uno::Any &bRouteWorkbook ) throw (css::uno::RuntimeException);
 
14155
-       virtual void SAL_CALL Protect( const css::uno::Any & aPassword ) throw (css::uno::RuntimeException);
 
14156
+    virtual void SAL_CALL Protect( const css::uno::Any &aPassword ) throw (css::uno::RuntimeException);
 
14157
        virtual void SAL_CALL Unprotect( const css::uno::Any &aPassword ) throw (css::uno::RuntimeException);
 
14158
        virtual void SAL_CALL Save() throw (css::uno::RuntimeException);
 
14159
        virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
 
14160
diff --git vbahelper/inc/vbahelper/vbaeventshelperbase.hxx vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
 
14161
new file mode 100644
 
14162
index 0000000..461cfbc
 
14163
--- /dev/null
 
14164
+++ vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
 
14165
@@ -0,0 +1,54 @@
 
14166
+/*************************************************************************
 
14167
+ *
 
14168
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
14169
+ * 
 
14170
+ * Copyright 2008 by Sun Microsystems, Inc.
 
14171
+ *
 
14172
+ * OpenOffice.org - a multi-platform office productivity suite
 
14173
+ *
 
14174
+ * $RCSfile: 
 
14175
+ * $Revision: 
 
14176
+ *
 
14177
+ * This file is part of OpenOffice.org.
 
14178
+ *
 
14179
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
14180
+ * it under the terms of the GNU Lesser General Public License version 3
 
14181
+ * only, as published by the Free Software Foundation.
 
14182
+ *
 
14183
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
14184
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14185
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14186
+ * GNU Lesser General Public License version 3 for more details
 
14187
+ * (a copy is included in the LICENSE file that accompanied this code).
 
14188
+ *
 
14189
+ * You should have received a copy of the GNU Lesser General Public License
 
14190
+ * version 3 along with OpenOffice.org.  If not, see
 
14191
+ * <http://www.openoffice.org/license.html>
 
14192
+ * for a copy of the LGPLv3 License.
 
14193
+ *
 
14194
+ ************************************************************************/
 
14195
+#ifndef VBAEVENTS_HELPER_BASE_HXX
 
14196
+#define VBAEVENTS_HELPER_BASE_HXX
 
14197
+
 
14198
+#include <com/sun/star/uno/XComponentContext.hpp>
 
14199
+#include <vbahelper/vbahelperinterface.hxx>
 
14200
+#include <map>
 
14201
+
 
14202
+class VBAHELPER_DLLPUBLIC VbaEventsHelperBase
 
14203
+{
 
14204
+protected:
 
14205
+    css::uno::Reference< css::uno::XComponentContext > m_xContext;
 
14206
+    sal_Bool mbIgnoreEvents;
 
14207
+    std::map< sal_Int32, rtl::OUString > m_aEventNameMap;
 
14208
+
 
14209
+protected:    
 
14210
+    void insert( const sal_Int32 nId, const rtl::OUString& sEventName );
 
14211
+    rtl::OUString getEventName( const sal_Int32 nEventId );
 
14212
+
 
14213
+public:    
 
14214
+    VbaEventsHelperBase( const css::uno::Reference< css::uno::XComponentContext >& xContext );
 
14215
+    virtual void SAL_CALL setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (css::uno::RuntimeException);
 
14216
+    virtual ::sal_Bool SAL_CALL getIgnoreEvents() throw (css::uno::RuntimeException);
 
14217
+};
 
14218
+
 
14219
+#endif /* VBAEVENTS_HELPER_BASE_HXX */
 
14220
diff --git vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/inc/vbahelper/vbahelper.hxx
 
14221
index 5d97b81..54ab0ad 100644
 
14222
--- vbahelper/inc/vbahelper/vbahelper.hxx
 
14223
+++ vbahelper/inc/vbahelper/vbahelper.hxx
 
14224
@@ -97,6 +97,7 @@ namespace ooo
 
14225
         VBAHELPER_DLLPUBLIC void setDefaultPropByIntrospection( const css::uno::Any& aObj, const css::uno::Any& aValue  ) throw ( css::uno::RuntimeException );
 
14226
         VBAHELPER_DLLPUBLIC css::uno::Any getPropertyValue( const css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName );
 
14227
         VBAHELPER_DLLPUBLIC sal_Bool setPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName, const css::uno::Any& aValue );
 
14228
+        VBAHELPER_DLLPUBLIC void setOrAppendPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName, const css::uno::Any& aValue );
 
14229
 
 
14230
 class VBAHELPER_DLLPUBLIC Millimeter
 
14231
 {
 
14232
diff --git vbahelper/inc/vbahelper/vbashaperange.hxx vbahelper/inc/vbahelper/vbashaperange.hxx
 
14233
index 0d29c3a..8f79b10 100644
 
14234
--- vbahelper/inc/vbahelper/vbashaperange.hxx
 
14235
+++ vbahelper/inc/vbahelper/vbashaperange.hxx
 
14236
@@ -59,6 +59,8 @@ public:
 
14237
     virtual void SAL_CALL IncrementRotation( double Increment ) throw (css::uno::RuntimeException);
 
14238
     virtual void SAL_CALL IncrementLeft( double Increment ) throw (css::uno::RuntimeException) ;
 
14239
     virtual void SAL_CALL IncrementTop( double Increment ) throw (css::uno::RuntimeException);
 
14240
+    virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
 
14241
+    virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException);
 
14242
     virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException);
 
14243
     virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException);
 
14244
     virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException);
 
14245
@@ -79,6 +81,7 @@ public:
 
14246
     virtual void SAL_CALL setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (css::uno::RuntimeException);
 
14247
     virtual css::uno::Any SAL_CALL SAL_CALL TextFrame(  ) throw (css::uno::RuntimeException);
 
14248
     virtual css::uno::Any SAL_CALL SAL_CALL WrapFormat(  ) throw (css::uno::RuntimeException);
 
14249
+    virtual void SAL_CALL ZOrder( sal_Int32 ZOrderCmd ) throw (css::uno::RuntimeException);
 
14250
     //XEnumerationAccess
 
14251
     virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
 
14252
     virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); 
 
14253
diff --git vbahelper/prj/d.lst vbahelper/prj/d.lst
 
14254
index d7b61d1..db11559 100644
 
14255
--- vbahelper/prj/d.lst
 
14256
+++ vbahelper/prj/d.lst
 
14257
@@ -25,3 +25,4 @@ mkdir: %_DEST%\inc%_EXT%\basic
 
14258
 ..\inc\vbahelper\vbatextframe.hxx %_DEST%\inc%_EXT%\vbahelper\vbatextframe.hxx
 
14259
 ..\inc\vbahelper\vbashaperange.hxx %_DEST%\inc%_EXT%\vbahelper\vbashaperange.hxx
 
14260
 ..\inc\vbahelper\vbapagesetupbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbapagesetupbase.hxx
 
14261
+..\inc\vbahelper\vbaeventshelperbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaeventshelperbase.hxx
 
14262
diff --git vbahelper/source/msforms/vbacheckbox.hxx vbahelper/source/msforms/vbacheckbox.hxx
 
14263
index f3374db..71d45ae 100644
 
14264
--- vbahelper/source/msforms/vbacheckbox.hxx
 
14265
+++ vbahelper/source/msforms/vbacheckbox.hxx
 
14266
@@ -35,12 +35,12 @@
 
14267
 #ifndef SC_VBA_CHECKBOX_HXX
 
14268
 #define SC_VBA_CHECKBOX_HXX
 
14269
 #include <cppuhelper/implbase2.hxx>
 
14270
-#include <ooo/vba/msforms/XRadioButton.hpp>
 
14271
+#include <ooo/vba/msforms/XCheckBox.hpp>
 
14272
 
 
14273
 #include "vbacontrol.hxx"
 
14274
 #include <vbahelper/vbahelper.hxx>
 
14275
 
 
14276
-typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > CheckBoxImpl_BASE;
 
14277
+typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XCheckBox, css::script::XDefaultProperty > CheckBoxImpl_BASE;
 
14278
 
 
14279
 class ScVbaCheckbox : public CheckBoxImpl_BASE
 
14280
 {
 
14281
diff --git vbahelper/source/msforms/vbacontrol.cxx vbahelper/source/msforms/vbacontrol.cxx
 
14282
index 353a24f..284bf99 100644
 
14283
--- vbahelper/source/msforms/vbacontrol.cxx
 
14284
+++ vbahelper/source/msforms/vbacontrol.cxx
 
14285
@@ -371,6 +371,18 @@ ScVbaControl::setControlTipText( const rtl::OUString& rsToolTip ) throw (css::un
 
14286
        m_xProps->setPropertyValue
 
14287
             (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) ), uno::makeAny( rsToolTip ) );
 
14288
 }
 
14289
+
 
14290
+::sal_Int32 SAL_CALL ScVbaControl::getForeColor() throw (::com::sun::star::uno::RuntimeException)
 
14291
+{
 
14292
+    sal_Int32 nForeColor;
 
14293
+    m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ) ) >>= nForeColor; 
 
14294
+    return OORGBToXLRGB( nForeColor );
 
14295
+}
 
14296
+
 
14297
+void SAL_CALL ScVbaControl::setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException)
 
14298
+{      
 
14299
+     m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ), uno::makeAny( XLRGBToOORGB( _forecolor ) ) );
 
14300
+}
 
14301
 //ScVbaControlFactory
 
14302
 
 
14303
 ScVbaControlFactory::ScVbaControlFactory( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel ): m_xContext( xContext ), m_xControl( xControl ), m_xModel( xModel )
 
14304
diff --git vbahelper/source/msforms/vbacontrol.hxx vbahelper/source/msforms/vbacontrol.hxx
 
14305
index 3c9a128..3d7f67f 100644
 
14306
--- vbahelper/source/msforms/vbacontrol.hxx
 
14307
+++ vbahelper/source/msforms/vbacontrol.hxx
 
14308
@@ -90,6 +90,8 @@ public:
 
14309
     virtual void SAL_CALL setControlTipText( const rtl::OUString& ) throw (css::uno::RuntimeException);
 
14310
     //remove resouce because ooo.vba.excel.XControl is a wrapper of com.sun.star.drawing.XControlShape
 
14311
     virtual void removeResouce() throw( css::uno::RuntimeException );
 
14312
+    virtual ::sal_Int32 SAL_CALL getForeColor() throw (::com::sun::star::uno::RuntimeException);
 
14313
+    virtual void SAL_CALL setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException);
 
14314
     //XHelperInterface
 
14315
     virtual rtl::OUString& getServiceImplName();
 
14316
     virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
14317
diff --git vbahelper/source/msforms/vbaframe.cxx vbahelper/source/msforms/vbaframe.cxx
 
14318
index d765d9b..e3a586e 100644
 
14319
--- vbahelper/source/msforms/vbaframe.cxx
 
14320
+++ vbahelper/source/msforms/vbaframe.cxx
 
14321
@@ -84,6 +84,19 @@ void SAL_CALL ScVbaFrame::setForeColor( ::sal_Int32 /*_forecolor*/ ) throw (::co
 
14322
 }
 
14323
 //liuchen 2009-7-6 end
 
14324
 
 
14325
+rtl::OUString SAL_CALL 
 
14326
+ScVbaFrame::getAccelerator() throw (css::uno::RuntimeException)
 
14327
+{
 
14328
+    //FIXME: seems not support?
 
14329
+    return rtl::OUString();
 
14330
+}
 
14331
+
 
14332
+void SAL_CALL 
 
14333
+ScVbaFrame::setAccelerator( const rtl::OUString& /*_accelerator*/ ) throw (::com::sun::star::uno::RuntimeException)
 
14334
+{
 
14335
+    //FIXME: seems not support?
 
14336
+}
 
14337
+
 
14338
 rtl::OUString& 
 
14339
 ScVbaFrame::getServiceImplName()
 
14340
 {
 
14341
diff --git vbahelper/source/msforms/vbaframe.hxx vbahelper/source/msforms/vbaframe.hxx
 
14342
index 9b1b6bb..a9346a0 100644
 
14343
--- vbahelper/source/msforms/vbaframe.hxx
 
14344
+++ vbahelper/source/msforms/vbaframe.hxx
 
14345
@@ -55,6 +55,8 @@ public:
 
14346
        virtual ::sal_Int32 SAL_CALL getForeColor() throw (::com::sun::star::uno::RuntimeException);
 
14347
        virtual void SAL_CALL setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException);
 
14348
        //liuchen 2009-7-6 end
 
14349
+    virtual rtl::OUString SAL_CALL getAccelerator() throw (css::uno::RuntimeException);
 
14350
+    virtual void SAL_CALL setAccelerator( const rtl::OUString& _accelerator ) throw (css::uno::RuntimeException);
 
14351
     //XHelperInterface
 
14352
     virtual rtl::OUString& getServiceImplName();
 
14353
     virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
14354
diff --git vbahelper/source/msforms/vbalabel.cxx vbahelper/source/msforms/vbalabel.cxx
 
14355
index a9869f7..93fb8c8 100644
 
14356
--- vbahelper/source/msforms/vbalabel.cxx
 
14357
+++ vbahelper/source/msforms/vbalabel.cxx
 
14358
@@ -35,7 +35,6 @@ using namespace ooo::vba;
 
14359
 
 
14360
 
 
14361
 const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
 
14362
-const static rtl::OUString FORECOLOR( RTL_CONSTASCII_USTRINGPARAM("TextColor") ); //liuchen 2009-7-6
 
14363
 ScVbaLabel::ScVbaLabel(  const css::uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : LabelImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
 
14364
 {
 
14365
 }
 
14366
@@ -68,20 +67,18 @@ ScVbaLabel::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::Run
 
14367
     setCaption( sCaption ); 
 
14368
 }
 
14369
 
 
14370
-
 
14371
-//liuchen 2009-7-6
 
14372
-::sal_Int32 SAL_CALL ScVbaLabel::getForeColor() throw (::com::sun::star::uno::RuntimeException)
 
14373
+rtl::OUString SAL_CALL 
 
14374
+ScVbaLabel::getAccelerator() throw (css::uno::RuntimeException)
 
14375
 {
 
14376
-       sal_Int32 nForeColor;
 
14377
-       m_xProps->getPropertyValue( FORECOLOR ) >>= nForeColor; 
 
14378
-       return OORGBToXLRGB( nForeColor );
 
14379
+    //FIXME: seems not support?
 
14380
+    return rtl::OUString();
 
14381
 }
 
14382
 
 
14383
-void SAL_CALL ScVbaLabel::setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException)
 
14384
-{      
 
14385
-        m_xProps->setPropertyValue( FORECOLOR, uno::makeAny( XLRGBToOORGB( _forecolor ) ) );
 
14386
+void SAL_CALL 
 
14387
+ScVbaLabel::setAccelerator( const rtl::OUString& /*_accelerator*/ ) throw (::com::sun::star::uno::RuntimeException)
 
14388
+{
 
14389
+    //FIXME: seems not support?
 
14390
 }
 
14391
-//liuchenn 2009-7-6
 
14392
 
 
14393
 rtl::OUString& 
 
14394
 ScVbaLabel::getServiceImplName()
 
14395
diff --git vbahelper/source/msforms/vbalabel.hxx vbahelper/source/msforms/vbalabel.hxx
 
14396
index 9c8766d..01f4d9b 100644
 
14397
--- vbahelper/source/msforms/vbalabel.hxx
 
14398
+++ vbahelper/source/msforms/vbalabel.hxx
 
14399
@@ -47,10 +47,8 @@ public:
 
14400
     virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
 
14401
     virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
 
14402
     virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
 
14403
-       //liuchen 2009-7-6 
 
14404
-       virtual ::sal_Int32 SAL_CALL getForeColor() throw (::com::sun::star::uno::RuntimeException);
 
14405
-       virtual void SAL_CALL setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException);
 
14406
-       //liuchen 2009-7-6 end
 
14407
+    virtual rtl::OUString SAL_CALL getAccelerator() throw (css::uno::RuntimeException);
 
14408
+    virtual void SAL_CALL setAccelerator( const rtl::OUString& _accelerator ) throw (css::uno::RuntimeException);
 
14409
     //XHelperInterface
 
14410
     virtual rtl::OUString& getServiceImplName();
 
14411
     virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 
14412
diff --git vbahelper/source/msforms/vbalistcontrolhelper.cxx vbahelper/source/msforms/vbalistcontrolhelper.cxx
 
14413
index 8582821..2aed7f1 100644
 
14414
--- vbahelper/source/msforms/vbalistcontrolhelper.cxx
 
14415
+++ vbahelper/source/msforms/vbalistcontrolhelper.cxx
 
14416
@@ -1,11 +1,69 @@
 
14417
 #include <vbalistcontrolhelper.hxx>
 
14418
 #include <vector>
 
14419
+#include <vbahelper/vbapropvalue.hxx>
 
14420
 
 
14421
 using namespace com::sun::star;
 
14422
 using namespace ooo::vba;
 
14423
 
 
14424
 const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
 
14425
 
 
14426
+class ListPropListener : public PropListener
 
14427
+{
 
14428
+private:
 
14429
+    uno::Reference< beans::XPropertySet > m_xProps;
 
14430
+    uno::Any m_pvargIndex; 
 
14431
+    uno::Any m_pvarColumn;
 
14432
+
 
14433
+public:
 
14434
+    ListPropListener( const uno::Reference< beans::XPropertySet >& xProps, const uno::Any& pvargIndex, const uno::Any& pvarColumn );
 
14435
+    virtual void setValueEvent( const css::uno::Any& value );
 
14436
+    virtual css::uno::Any getValueEvent();
 
14437
+};
 
14438
+
 
14439
+ListPropListener::ListPropListener( const uno::Reference< beans::XPropertySet >& xProps, const uno::Any& pvargIndex, const uno::Any& pvarColumn ) : m_xProps( xProps ), m_pvargIndex( pvargIndex ), m_pvarColumn( pvarColumn )
 
14440
+{
 
14441
+}
 
14442
+
 
14443
+void ListPropListener::setValueEvent( const uno::Any& value )
 
14444
+{
 
14445
+    if( m_pvargIndex.hasValue() || m_pvarColumn.hasValue() )
 
14446
+        throw uno::RuntimeException( rtl::OUString::createFromAscii(
 
14447
+                "Bad argument" ), uno::Reference< uno::XInterface >() );       
 
14448
+
 
14449
+    m_xProps->setPropertyValue( ITEMS, value );
 
14450
+}
 
14451
+
 
14452
+uno::Any ListPropListener::getValueEvent()
 
14453
+{
 
14454
+    uno::Sequence< rtl::OUString > sList;
 
14455
+    m_xProps->getPropertyValue( ITEMS ) >>= sList;
 
14456
+    sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
 
14457
+    uno::Any aRet;
 
14458
+    if ( m_pvargIndex.hasValue() )
 
14459
+    {
 
14460
+        sal_Int16 nIndex = -1;
 
14461
+        m_pvargIndex >>= nIndex;
 
14462
+        if( nIndex < 0 || nIndex >= nLength )
 
14463
+            throw uno::RuntimeException( rtl::OUString::createFromAscii(
 
14464
+                    "Bad row Index" ), uno::Reference< uno::XInterface >() );       
 
14465
+        aRet <<= sList[ nIndex ];
 
14466
+    }
 
14467
+    else if ( m_pvarColumn.hasValue() ) // pvarColumn on its own would be bad
 
14468
+            throw uno::RuntimeException( rtl::OUString::createFromAscii(
 
14469
+                    "Bad column Index" ), uno::Reference< uno::XInterface >() );       
 
14470
+    else // List() ( e.g. no args )
 
14471
+    {
 
14472
+        uno::Sequence< uno::Sequence< rtl::OUString > > sReturnArray( nLength );
 
14473
+        for ( sal_Int32 i = 0; i < nLength; ++i )
 
14474
+        {
 
14475
+            sReturnArray[ i ].realloc( 10 );
 
14476
+            sReturnArray[ i ][ 0 ] = sList[ i ];
 
14477
+        }        
 
14478
+        aRet = uno::makeAny( sReturnArray );
 
14479
+    }
 
14480
+    return aRet;
 
14481
+}
 
14482
+
 
14483
 void SAL_CALL 
 
14484
 ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
 
14485
 {
 
14486
@@ -116,31 +174,5 @@ ListControlHelper::getListCount() throw (uno::RuntimeException)
 
14487
 uno::Any SAL_CALL 
 
14488
 ListControlHelper::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
 
14489
 {
 
14490
-    uno::Sequence< rtl::OUString > sList;
 
14491
-    m_xProps->getPropertyValue( ITEMS ) >>= sList;
 
14492
-    sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
 
14493
-    uno::Any aRet;
 
14494
-    if ( pvargIndex.hasValue() )
 
14495
-    {
 
14496
-        sal_Int16 nIndex = -1;
 
14497
-        pvargIndex >>= nIndex;
 
14498
-        if( nIndex < 0 || nIndex >= nLength )
 
14499
-            throw uno::RuntimeException( rtl::OUString::createFromAscii(
 
14500
-                    "Bad row Index" ), uno::Reference< uno::XInterface >() );       
 
14501
-        aRet <<= sList[ nIndex ];
 
14502
-    }
 
14503
-    else if ( pvarColumn.hasValue() ) // pvarColumn on its own would be bad
 
14504
-            throw uno::RuntimeException( rtl::OUString::createFromAscii(
 
14505
-                    "Bad column Index" ), uno::Reference< uno::XInterface >() );       
 
14506
-    else // List() ( e.g. no args )
 
14507
-    {
 
14508
-        uno::Sequence< uno::Sequence< rtl::OUString > > sReturnArray( nLength );
 
14509
-        for ( sal_Int32 i = 0; i < nLength; ++i )
 
14510
-        {
 
14511
-            sReturnArray[ i ].realloc( 10 );
 
14512
-            sReturnArray[ i ][ 0 ] = sList[ i ];
 
14513
-        }        
 
14514
-        aRet = uno::makeAny( sReturnArray );
 
14515
-    }
 
14516
-    return aRet;
 
14517
+    return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( new ListPropListener( m_xProps, pvargIndex, pvarColumn ) ) ) );
 
14518
 }
 
14519
diff --git vbahelper/source/vbahelper/makefile.mk vbahelper/source/vbahelper/makefile.mk
 
14520
index bd57415..53e14dc 100644
 
14521
--- vbahelper/source/vbahelper/makefile.mk
 
14522
+++ vbahelper/source/vbahelper/makefile.mk
 
14523
@@ -64,6 +64,7 @@ SLOFILES=\
 
14524
     $(SLO)$/vbashaperange.obj \
 
14525
     $(SLO)$/vbatextframe.obj \
 
14526
     $(SLO)$/vbapagesetupbase.obj \
 
14527
+    $(SLO)$/vbaeventshelperbase.obj \
 
14528
 
 
14529
 # --- Targets -------------------------------------------------------
 
14530
 
 
14531
diff --git vbahelper/source/vbahelper/vbaapplicationbase.cxx vbahelper/source/vbahelper/vbaapplicationbase.cxx
 
14532
index 81ff270..5468339 100644
 
14533
--- vbahelper/source/vbahelper/vbaapplicationbase.cxx
 
14534
+++ vbahelper/source/vbahelper/vbaapplicationbase.cxx
 
14535
@@ -76,6 +76,8 @@ void SAL_CALL
 
14536
 VbaApplicationBase::setScreenUpdating(sal_Bool bUpdate) throw (uno::RuntimeException)
 
14537
 {
 
14538
        uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
 
14539
+    if( bUpdate != xModel->hasControllersLocked() )
 
14540
+        return;
 
14541
        if (bUpdate)
 
14542
                xModel->unlockControllers();
 
14543
        else
 
14544
@@ -141,7 +143,8 @@ VbaApplicationBase::getVersion() throw (uno::RuntimeException)
 
14545
 
 
14546
 void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException)
 
14547
 {
 
14548
-    VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( getCurrentDocument() ), MacroName );
 
14549
+    // search the global tempalte
 
14550
+    VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( getCurrentDocument() ), MacroName, sal_True );
 
14551
     if( aMacroInfo.IsResolved() )
 
14552
     {
 
14553
         // handle the arguments
 
14554
diff --git vbahelper/source/vbahelper/vbadocumentbase.cxx vbahelper/source/vbahelper/vbadocumentbase.cxx
 
14555
index 3830fe9..87a7e68 100644
 
14556
--- vbahelper/source/vbahelper/vbadocumentbase.cxx
 
14557
+++ vbahelper/source/vbahelper/vbadocumentbase.cxx
 
14558
@@ -36,6 +36,7 @@
 
14559
 #include <com/sun/star/util/XCloseable.hpp>
 
14560
 #include <com/sun/star/frame/XStorable.hpp>
 
14561
 #include <com/sun/star/frame/XFrame.hpp>
 
14562
+#include <com/sun/star/frame/XTitle.hpp>
 
14563
 #include <com/sun/star/beans/XPropertySet.hpp>
 
14564
 
 
14565
 #include <tools/urlobj.hxx>
 
14566
@@ -69,13 +70,8 @@ VbaDocumentBase::getName() throw (uno::RuntimeException)
 
14567
        }
 
14568
        else
 
14569
        {
 
14570
-               const static rtl::OUString sTitle( RTL_CONSTASCII_USTRINGPARAM("Title" ) );
 
14571
-               // process "UntitledX - $(PRODUCTNAME)"
 
14572
-               uno::Reference< frame::XFrame > xFrame( getModel()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
 
14573
-               uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW );
 
14574
-               xProps->getPropertyValue(sTitle ) >>= sName;
 
14575
-               sal_Int32 pos = 0;
 
14576
-               sName = sName.getToken(0,' ',pos);      
 
14577
+        uno::Reference< frame::XTitle > xTitle( getModel(), uno::UNO_QUERY_THROW );
 
14578
+        sName = xTitle->getTitle();
 
14579
        }
 
14580
        return sName;
 
14581
 }
 
14582
@@ -136,7 +132,13 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
 
14583
                // The boolean parameter DeliverOwnership tells objects vetoing the close process that they may
 
14584
                // assume ownership if they object the closure by throwing a CloseVetoException
 
14585
                // Here we give up ownership. To be on the safe side, catch possible veto exception anyway.
 
14586
-               xCloseable->close(sal_True);
 
14587
+        try
 
14588
+        {
 
14589
+            xCloseable->close(sal_True);
 
14590
+        }
 
14591
+        catch( uno::Exception& )
 
14592
+        {
 
14593
+        }
 
14594
        // If close is not supported by this model - try to dispose it.
 
14595
        // But if the model disagree with a reset request for the modify state
 
14596
        // we shouldn't do so. Otherwhise some strange things can happen.
 
14597
@@ -144,7 +146,16 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
 
14598
        {
 
14599
                uno::Reference< lang::XComponent > xDisposable ( getModel(), uno::UNO_QUERY );
 
14600
                if ( xDisposable.is() )
 
14601
-                       xDisposable->dispose();
 
14602
+        {
 
14603
+            // To be on the safe side, catch possible veto exception anyway.
 
14604
+            try
 
14605
+            {
 
14606
+                xDisposable->dispose();
 
14607
+            }
 
14608
+            catch( uno::Exception& )
 
14609
+            {
 
14610
+            }
 
14611
+        }    
 
14612
        }
 
14613
 }
 
14614
 
 
14615
diff --git vbahelper/source/vbahelper/vbadocumentsbase.cxx vbahelper/source/vbahelper/vbadocumentsbase.cxx
 
14616
index e7907b7..d8a9df7 100644
 
14617
--- vbahelper/source/vbahelper/vbadocumentsbase.cxx
 
14618
+++ vbahelper/source/vbahelper/vbadocumentsbase.cxx
 
14619
@@ -37,6 +37,7 @@
 
14620
 #include <com/sun/star/lang/XComponent.hpp>
 
14621
 #include <com/sun/star/frame/XModel.hpp>
 
14622
 #include <com/sun/star/frame/XFrame.hpp>
 
14623
+#include <com/sun/star/frame/XTitle.hpp>
 
14624
 #include <com/sun/star/frame/FrameSearchFlag.hpp>
 
14625
 #include <com/sun/star/util/XModifiable.hpp>
 
14626
 #include <com/sun/star/frame/XStorable.hpp>
 
14627
@@ -146,8 +147,18 @@ public:
 
14628
                        {
 
14629
                                uno::Reference< frame::XModel > xModel( xServiceInfo, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given
 
14630
                                m_documents.push_back( xModel );
 
14631
-                               INetURLObject aURL( xModel->getURL() );
 
14632
-                               namesToIndices[ aURL.GetLastName() ] = nIndex++;
 
14633
+                rtl::OUString sName = xModel->getURL();
 
14634
+                if( sName.getLength() )
 
14635
+                {
 
14636
+                    INetURLObject aURL( xModel->getURL() );
 
14637
+                    namesToIndices[ aURL.GetLastName() ] = nIndex++;
 
14638
+                }    
 
14639
+                else
 
14640
+                {
 
14641
+                    uno::Reference< frame::XTitle > xTitle( xModel, uno::UNO_QUERY_THROW );
 
14642
+                    sName = xTitle->getTitle();
 
14643
+                    namesToIndices[ sName ] = nIndex++;
 
14644
+                }
 
14645
                        }
 
14646
                }
 
14647
                        
 
14648
diff --git vbahelper/source/vbahelper/vbaeventshelperbase.cxx vbahelper/source/vbahelper/vbaeventshelperbase.cxx
 
14649
new file mode 100644
 
14650
index 0000000..52aba1f
 
14651
--- /dev/null
 
14652
+++ vbahelper/source/vbahelper/vbaeventshelperbase.cxx
 
14653
@@ -0,0 +1,60 @@
 
14654
+/*************************************************************************
 
14655
+ *
 
14656
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
14657
+ * 
 
14658
+ * Copyright 2008 by Sun Microsystems, Inc.
 
14659
+ *
 
14660
+ * OpenOffice.org - a multi-platform office productivity suite
 
14661
+ *
 
14662
+ * $RCSfile: 
 
14663
+ * $Revision: 
 
14664
+ *
 
14665
+ * This file is part of OpenOffice.org.
 
14666
+ *
 
14667
+ * OpenOffice.org is free software: you can redistribute it and/or modify
 
14668
+ * it under the terms of the GNU Lesser General Public License version 3
 
14669
+ * only, as published by the Free Software Foundation.
 
14670
+ *
 
14671
+ * OpenOffice.org is distributed in the hope that it will be useful,
 
14672
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14673
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14674
+ * GNU Lesser General Public License version 3 for more details
 
14675
+ * (a copy is included in the LICENSE file that accompanied this code).
 
14676
+ *
 
14677
+ * You should have received a copy of the GNU Lesser General Public License
 
14678
+ * version 3 along with OpenOffice.org.  If not, see
 
14679
+ * <http://www.openoffice.org/license.html>
 
14680
+ * for a copy of the LGPLv3 License.
 
14681
+ *
 
14682
+ ************************************************************************/
 
14683
+#include <vbahelper/vbaeventshelperbase.hxx>
 
14684
+
 
14685
+using namespace ::com::sun::star;
 
14686
+
 
14687
+VbaEventsHelperBase::VbaEventsHelperBase( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : m_xContext( xContext ), mbIgnoreEvents( sal_False )
 
14688
+{
 
14689
+}
 
14690
+
 
14691
+void VbaEventsHelperBase::insert( const sal_Int32 nId, const rtl::OUString& sEventName )
 
14692
+{
 
14693
+    m_aEventNameMap.insert( std::make_pair( nId, sEventName ) );
 
14694
+}
 
14695
+
 
14696
+rtl::OUString VbaEventsHelperBase::getEventName( const sal_Int32 nId )
 
14697
+{
 
14698
+    std::map< sal_Int32, rtl::OUString >::iterator iter = m_aEventNameMap.find( nId );
 
14699
+    if( iter != m_aEventNameMap.end() )
 
14700
+        return iter->second;
 
14701
+    return rtl::OUString();    
 
14702
+}
 
14703
+
 
14704
+void SAL_CALL VbaEventsHelperBase::setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (css::uno::RuntimeException)
 
14705
+{
 
14706
+    mbIgnoreEvents = _ignoreevents;
 
14707
+}
 
14708
+
 
14709
+::sal_Bool SAL_CALL VbaEventsHelperBase::getIgnoreEvents() throw (css::uno::RuntimeException)
 
14710
+{
 
14711
+    return mbIgnoreEvents;
 
14712
+}
 
14713
+
 
14714
diff --git vbahelper/source/vbahelper/vbahelper.cxx vbahelper/source/vbahelper/vbahelper.cxx
 
14715
index 901cc71..1290b25 100644
 
14716
--- vbahelper/source/vbahelper/vbahelper.cxx
 
14717
+++ vbahelper/source/vbahelper/vbahelper.cxx
 
14718
@@ -970,6 +970,18 @@ sal_Bool setPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, const r
 
14719
     return sal_False;
 
14720
 }
 
14721
 
 
14722
+void setOrAppendPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, const rtl::OUString& aName, const uno::Any& aValue )
 
14723
+{
 
14724
+   if( setPropertyValue( aProp, aName, aValue ) )
 
14725
+    return;
 
14726
+  
 
14727
+  // append the property
 
14728
+  sal_Int32 nLength = aProp.getLength();
 
14729
+  aProp.realloc( nLength + 1 );
 
14730
+  aProp[ nLength ].Name = aName;
 
14731
+  aProp[ nLength ].Value = aValue;
 
14732
+}
 
14733
+
 
14734
 #define VBA_LEFT "PositionX"
 
14735
 #define VBA_TOP "PositionY"
 
14736
 UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
 
14737
diff --git vbahelper/source/vbahelper/vbashape.cxx vbahelper/source/vbahelper/vbashape.cxx
 
14738
index c35745b..c0c6ba3 100644
 
14739
--- vbahelper/source/vbahelper/vbashape.cxx
 
14740
+++ vbahelper/source/vbahelper/vbashape.cxx
 
14741
@@ -38,6 +38,7 @@
 
14742
 #include <com/sun/star/lang/XServiceInfo.hpp>
 
14743
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 
14744
 #include <com/sun/star/text/TextContentAnchorType.hpp>
 
14745
+#include <com/sun/star/text/RelOrientation.hpp>
 
14746
 #include <ooo/vba/word/WdRelativeHorizontalPosition.hpp>
 
14747
 #include <ooo/vba/word/WdRelativeVerticalPosition.hpp>
 
14748
 
 
14749
@@ -222,25 +223,66 @@ ScVbaShape::setWidth( double _width ) throw (uno::RuntimeException)
 
14750
 double SAL_CALL 
 
14751
 ScVbaShape::getLeft() throw (uno::RuntimeException)
 
14752
 {
 
14753
-    return m_pShapeHelper->getLeft();
 
14754
+    double left = 0;
 
14755
+    try
 
14756
+    {
 
14757
+        left = m_pShapeHelper->getLeft();
 
14758
+    }
 
14759
+    catch( uno::Exception& )
 
14760
+    {
 
14761
+        // fail to get position by using XShape::getPosition()
 
14762
+        sal_Int32 nLeft = 0;
 
14763
+        m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition") ) ) >>= nLeft;
 
14764
+        left = Millimeter::getInPoints( nLeft );
 
14765
+    }
 
14766
+    return left;
 
14767
 }
 
14768
 
 
14769
 void SAL_CALL 
 
14770
 ScVbaShape::setLeft( double _left ) throw (uno::RuntimeException)
 
14771
 {
 
14772
-    m_pShapeHelper->setLeft( _left );
 
14773
+    try
 
14774
+    {
 
14775
+        m_pShapeHelper->setLeft( _left );
 
14776
+    }
 
14777
+    catch( uno::Exception& )
 
14778
+    {
 
14779
+        sal_Int32 nLeft = 0;
 
14780
+        nLeft = Millimeter::getInHundredthsOfOneMillimeter( _left );
 
14781
+        m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrientPosition" ), uno::makeAny( nLeft ) );
 
14782
+    }
 
14783
 }
 
14784
 
 
14785
 double SAL_CALL 
 
14786
 ScVbaShape::getTop() throw (uno::RuntimeException)
 
14787
 {
 
14788
-    return m_pShapeHelper->getTop();
 
14789
+    double top = 0;
 
14790
+    try
 
14791
+    {
 
14792
+        top = m_pShapeHelper->getTop();
 
14793
+    }
 
14794
+    catch( uno::Exception& )
 
14795
+    {
 
14796
+        sal_Int32 nTop = 0;
 
14797
+        m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition") ) ) >>= nTop;
 
14798
+        top = Millimeter::getInPoints( nTop );
 
14799
+    }    
 
14800
+    return top;
 
14801
 }
 
14802
 
 
14803
 void SAL_CALL 
 
14804
 ScVbaShape::setTop( double _top ) throw (uno::RuntimeException)
 
14805
 {
 
14806
-    return m_pShapeHelper->setTop( _top );
 
14807
+    try
 
14808
+    {
 
14809
+        m_pShapeHelper->setTop( _top );
 
14810
+    }    
 
14811
+    catch( uno::Exception& )
 
14812
+    {
 
14813
+        sal_Int32 nTop = 0;
 
14814
+        nTop = Millimeter::getInHundredthsOfOneMillimeter( _top );
 
14815
+        m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "VertOrientPosition" ), uno::makeAny( nTop ) );
 
14816
+    }
 
14817
 }
 
14818
 
 
14819
 sal_Bool SAL_CALL 
 
14820
@@ -507,35 +549,34 @@ sal_Int32 SAL_CALL
 
14821
 ScVbaShape::getRelativeHorizontalPosition() throw (uno::RuntimeException)
 
14822
 {
 
14823
     sal_Int32 nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
 
14824
-    text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
 
14825
-    m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType;
 
14826
+    sal_Int16 nType = text::RelOrientation::PAGE_LEFT;
 
14827
+    m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientRelation") ) ) >>= nType;
 
14828
     
 
14829
-    switch( eType )
 
14830
+    switch( nType )
 
14831
     {
 
14832
-        case text::TextContentAnchorType_AT_PARAGRAPH:
 
14833
+        case text::RelOrientation::FRAME:
 
14834
         {
 
14835
             nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn;
 
14836
             break;
 
14837
         }
 
14838
-        case text::TextContentAnchorType_AT_PAGE:
 
14839
+        case text::RelOrientation::PAGE_FRAME:
 
14840
         {
 
14841
             nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage;
 
14842
             break;
 
14843
         }
 
14844
-        case text::TextContentAnchorType_AT_CHARACTER:
 
14845
+        case text::RelOrientation::CHAR:
 
14846
         {
 
14847
             nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter;
 
14848
             break;
 
14849
         }
 
14850
-        case text::TextContentAnchorType_AT_FRAME:
 
14851
-        case text::TextContentAnchorType_AS_CHARACTER:
 
14852
+        case text::RelOrientation::PAGE_PRINT_AREA:
 
14853
         {
 
14854
             nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
 
14855
             break;
 
14856
         }
 
14857
         default:
 
14858
         {
 
14859
-            nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
 
14860
+            throw  uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Shape::RelativeHorizontalPosition: not implemented" ) ), uno::Reference< uno::XInterface >() );
 
14861
         }
 
14862
     }
 
14863
     return nRelativeHorizontalPosition;
 
14864
@@ -544,23 +585,27 @@ ScVbaShape::getRelativeHorizontalPosition() throw (uno::RuntimeException)
 
14865
 void SAL_CALL 
 
14866
 ScVbaShape::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (uno::RuntimeException)
 
14867
 {
 
14868
-    text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
 
14869
+    sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
 
14870
     switch( _relativehorizontalposition )
 
14871
     {
 
14872
         case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter:
 
14873
         {
 
14874
-            eType = text::TextContentAnchorType_AT_CHARACTER;
 
14875
+            nType = text::RelOrientation::CHAR;
 
14876
             break;
 
14877
         }
 
14878
         case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn:
 
14879
+        {
 
14880
+            nType = text::RelOrientation::PAGE_FRAME;
 
14881
+            break;
 
14882
+        }
 
14883
         case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin:
 
14884
         {
 
14885
-            eType = text::TextContentAnchorType_AT_PARAGRAPH;
 
14886
+            nType = text::RelOrientation::PAGE_PRINT_AREA;
 
14887
             break;
 
14888
         }
 
14889
         case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage:
 
14890
         {
 
14891
-            eType = text::TextContentAnchorType_AT_PAGE;
 
14892
+            nType = text::RelOrientation::PAGE_FRAME;
 
14893
             break;
 
14894
         }
 
14895
         default:
 
14896
@@ -568,42 +613,41 @@ ScVbaShape::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalpositi
 
14897
             DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
 
14898
         }
 
14899
     }
 
14900
-    m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) );
 
14901
+    m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientRelation") ), uno::makeAny( nType ) );
 
14902
 }
 
14903
 
 
14904
 sal_Int32 SAL_CALL 
 
14905
 ScVbaShape::getRelativeVerticalPosition() throw (uno::RuntimeException)
 
14906
 {
 
14907
     sal_Int32 nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
 
14908
-    text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
 
14909
-    m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType;
 
14910
+    sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
 
14911
+    m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientRelation") ) ) >>= nType;
 
14912
     
 
14913
-    switch( eType )
 
14914
+    switch( nType )
 
14915
     {
 
14916
-        case text::TextContentAnchorType_AT_PARAGRAPH:
 
14917
+        case text::RelOrientation::FRAME:
 
14918
         {
 
14919
             nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph;
 
14920
             break;
 
14921
         }
 
14922
-        case text::TextContentAnchorType_AT_PAGE:
 
14923
+        case text::RelOrientation::PAGE_FRAME:
 
14924
         {
 
14925
             nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage;
 
14926
             break;
 
14927
         }
 
14928
-        case text::TextContentAnchorType_AT_CHARACTER:
 
14929
+        case text::RelOrientation::TEXT_LINE:
 
14930
         {
 
14931
             nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine;
 
14932
             break;
 
14933
         }
 
14934
-        case text::TextContentAnchorType_AT_FRAME:
 
14935
-        case text::TextContentAnchorType_AS_CHARACTER:
 
14936
+        case text::RelOrientation::PAGE_PRINT_AREA:
 
14937
         {
 
14938
             nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
 
14939
             break;
 
14940
         }
 
14941
         default:
 
14942
         {
 
14943
-            nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
 
14944
+            throw  uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Shape::RelativeVerticalPosition: not implemented" ) ), uno::Reference< uno::XInterface >() );
 
14945
         }
 
14946
     }
 
14947
     return nRelativeVerticalPosition;
 
14948
@@ -612,23 +656,27 @@ ScVbaShape::getRelativeVerticalPosition() throw (uno::RuntimeException)
 
14949
 void SAL_CALL 
 
14950
 ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (uno::RuntimeException)
 
14951
 {
 
14952
-    text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
 
14953
+    sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
 
14954
     switch( _relativeverticalposition )
 
14955
     {
 
14956
         case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine:
 
14957
         {
 
14958
-            eType = text::TextContentAnchorType_AT_CHARACTER;
 
14959
+            nType = text::RelOrientation::TEXT_LINE;
 
14960
             break;
 
14961
         }
 
14962
         case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph:
 
14963
+        {
 
14964
+            nType = text::RelOrientation::FRAME;
 
14965
+            break;
 
14966
+        }
 
14967
         case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin:
 
14968
         {
 
14969
-            eType = text::TextContentAnchorType_AT_PARAGRAPH;
 
14970
+            nType = text::RelOrientation::PAGE_PRINT_AREA;
 
14971
             break;
 
14972
         }
 
14973
         case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage:
 
14974
         {
 
14975
-            eType = text::TextContentAnchorType_AT_PAGE;
 
14976
+            nType = text::RelOrientation::PAGE_FRAME;
 
14977
             break;
 
14978
         }
 
14979
         default:
 
14980
@@ -636,7 +684,7 @@ ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition )
 
14981
             DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
 
14982
         }
 
14983
     }
 
14984
-    m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) );
 
14985
+    m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientRelation") ), uno::makeAny( nType ) );
 
14986
 }
 
14987
 
 
14988
 uno::Any SAL_CALL 
 
14989
diff --git vbahelper/source/vbahelper/vbashaperange.cxx vbahelper/source/vbahelper/vbashaperange.cxx
 
14990
index 0c3535b..b088adf 100644
 
14991
--- vbahelper/source/vbahelper/vbashaperange.cxx
 
14992
+++ vbahelper/source/vbahelper/vbashaperange.cxx
 
14993
@@ -128,6 +128,27 @@ ScVbaShapeRange::IncrementTop( double Increment ) throw (uno::RuntimeException)
 
14994
        }
 
14995
 }
 
14996
 
 
14997
+rtl::OUString SAL_CALL ScVbaShapeRange::getName() throw (uno::RuntimeException)
 
14998
+{
 
14999
+    sal_Int32 nLen = getCount();
 
15000
+    for ( sal_Int32 index = 1; index <= nLen; ++index )
 
15001
+    {
 
15002
+        uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW );
 
15003
+        return xShape->getName( );
 
15004
+    }
 
15005
+    throw uno::RuntimeException();
 
15006
+}
 
15007
+
 
15008
+void SAL_CALL ScVbaShapeRange::setName( const rtl::OUString& _name ) throw (uno::RuntimeException)
 
15009
+{
 
15010
+    sal_Int32 nLen = getCount();
 
15011
+    for ( sal_Int32 index = 1; index <= nLen; ++index )
 
15012
+    {
 
15013
+        uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW );
 
15014
+        xShape->setName( _name );
 
15015
+    }
 
15016
+}
 
15017
+
 
15018
 double SAL_CALL ScVbaShapeRange::getHeight() throw (uno::RuntimeException)
 
15019
 {
 
15020
        sal_Int32 nLen = getCount();
 
15021
@@ -340,6 +361,16 @@ uno::Any SAL_CALL ScVbaShapeRange::WrapFormat(  ) throw (css::uno::RuntimeExcept
 
15022
     throw uno::RuntimeException();
 
15023
 }
 
15024
 
 
15025
+void SAL_CALL ScVbaShapeRange::ZOrder( sal_Int32 ZOrderCmd ) throw (uno::RuntimeException)
 
15026
+{
 
15027
+    sal_Int32 nLen = getCount();
 
15028
+    for ( sal_Int32 index = 1; index <= nLen; ++index )
 
15029
+    {
 
15030
+        uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW );
 
15031
+        xShape->ZOrder( ZOrderCmd );
 
15032
+    }
 
15033
+}
 
15034
+
 
15035
 uno::Type SAL_CALL
 
15036
 ScVbaShapeRange::getElementType() throw (uno::RuntimeException)
 
15037
 {
 
15038
diff --git vbahelper/source/vbahelper/vbashapes.cxx vbahelper/source/vbahelper/vbashapes.cxx
 
15039
index 5302f92..0b09fcc 100644
 
15040
--- vbahelper/source/vbahelper/vbashapes.cxx
 
15041
+++ vbahelper/source/vbahelper/vbashapes.cxx
 
15042
@@ -89,7 +89,7 @@ void ScVbaShapes::initBaseCollection()
 
15043
        m_xNameAccess.set( xShapes, uno::UNO_QUERY );
 
15044
 }
 
15045
 
 
15046
-ScVbaShapes::ScVbaShapes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess > xShapes, const uno::Reference< frame::XModel>& xModel ): ScVbaShapes_BASE( xParent, xContext, xShapes ), m_nNewShapeCount(0), m_xModel( xModel )
 
15047
+ScVbaShapes::ScVbaShapes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess > xShapes, const uno::Reference< frame::XModel>& xModel ): ScVbaShapes_BASE( xParent, xContext, xShapes, sal_True ), m_nNewShapeCount(0), m_xModel( xModel )
 
15048
 {
 
15049
     m_xShapes.set( xShapes, uno::UNO_QUERY_THROW );
 
15050
     m_xDrawPage.set( xShapes, uno::UNO_QUERY_THROW );