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;
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;
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
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__
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
36
index 0000000..b08a58c
38
+++ offapi/com/sun/star/sheet/SpreadsheetDocumentVbaEventsHelper.idl
40
+/*************************************************************************
42
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
+ * Copyright 2008 by Sun Microsystems, Inc.
46
+ * OpenOffice.org - a multi-platform office productivity suite
48
+ * $RCSfile: TextDocument.idl,v $
51
+ * This file is part of OpenOffice.org.
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.
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).
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.
68
+ ************************************************************************/
69
+#ifndef __com_sun_star_sheet_SpreadsheetDocumentVbaEventsHelper_idl__
70
+#define __com_sun_star_sheet_SpreadsheetDocumentVbaEventsHelper_idl__
72
+#ifndef __com_sun_star_document_VbaEventsHelper_idl__
73
+#include <com/sun/star/document/VbaEventsHelper.idl>
76
+//=============================================================================
78
+ module com { module sun { module star { module sheet {
80
+//=============================================================================
82
+service SpreadsheetDocumentVbaEventsHelper
84
+ service com::sun::star::document::VbaEventsHelper;
87
+//=============================================================================
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=\
98
SpreadsheetDocument.idl\
99
SpreadsheetDocumentSettings.idl\
100
+ SpreadsheetDocumentVbaEventsHelper.idl\
101
SpreadsheetDrawPage.idl\
103
SpreadsheetViewPane.idl\
104
diff --git offapi/com/sun/star/text/TextDocumentVbaEventsHelper.idl offapi/com/sun/star/text/TextDocumentVbaEventsHelper.idl
106
index 0000000..b4f2707
108
+++ offapi/com/sun/star/text/TextDocumentVbaEventsHelper.idl
110
+/*************************************************************************
112
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
114
+ * Copyright 2008 by Sun Microsystems, Inc.
116
+ * OpenOffice.org - a multi-platform office productivity suite
118
+ * $RCSfile: TextDocument.idl,v $
119
+ * $Revision: 1.18 $
121
+ * This file is part of OpenOffice.org.
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.
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).
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.
138
+ ************************************************************************/
139
+#ifndef __com_sun_star_text_TextDocumentVbaEventsHelper_idl__
140
+#define __com_sun_star_text_TextDocumentVbaEventsHelper_idl__
142
+#ifndef __com_sun_star_document_VbaEventsHelper_idl__
143
+#include <com/sun/star/document/VbaEventsHelper.idl>
146
+//=============================================================================
148
+ module com { module sun { module star { module text {
150
+//=============================================================================
152
+service TextDocumentVbaEventsHelper
154
+ service com::sun::star::document::VbaEventsHelper;
157
+//=============================================================================
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\
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);
182
- void Protect( [in] any Password );
183
void Unprotect( [in] any Password );
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 );
198
diff --git oovbaapi/ooo/vba/msforms/XCheckBox.idl oovbaapi/ooo/vba/msforms/XCheckBox.idl
200
index 0000000..30bdee0
202
+++ oovbaapi/ooo/vba/msforms/XCheckBox.idl
204
+/*************************************************************************
206
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
208
+ * Copyright 2008 by Sun Microsystems, Inc.
210
+ * OpenOffice.org - a multi-platform office productivity suite
212
+ * $RCSfile: XCheckBox.idl,v $
215
+ * This file is part of OpenOffice.org.
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.
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).
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.
232
+ ************************************************************************/
233
+#ifndef __ooo_vba_msforms_XCheckBox_idl__
234
+#define __ooo_vba_msforms_XCheckBox_idl__
236
+#ifndef __com_sun_star_uno_XInterface_idl__
237
+#include <com/sun/star/uno/XInterface.idl>
239
+//=============================================================================
241
+module ooo { module vba { module msforms {
243
+//=============================================================================
244
+interface XCheckBox: com::sun::star::uno::XInterface
246
+ [attribute] string Caption;
247
+ [attribute] any Value;
250
+//=============================================================================
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 );
265
+ any List( [in] any pvargIndex, [in] any pvarColumn );
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;
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
287
[attribute] string Caption;
288
[attribute] any Value;
289
- [attribute] long ForeColor; //liuchen 2009-7-3
290
+ [attribute] string Accelerator;
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
300
interface ooo::vba::XCollection;
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 );
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=\
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 );
338
diff --git oovbaapi/ooo/vba/word/XCell.idl oovbaapi/ooo/vba/word/XCell.idl
340
index 0000000..700b9dc
342
+++ oovbaapi/ooo/vba/word/XCell.idl
344
+/*************************************************************************
346
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
348
+ * Copyright 2008 by Sun Microsystems, Inc.
350
+ * OpenOffice.org - a multi-platform office productivity suite
355
+ * This file is part of OpenOffice.org.
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.
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).
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.
372
+ ************************************************************************/
373
+#ifndef __ooo_vba_word_XCell_idl__
374
+#define __ooo_vba_word_XCell_idl__
376
+#ifndef __com_sun_star_uno_XInterface_idl__
377
+#include <com/sun/star/uno/XInterface.idl>
380
+#ifndef __ooo_vba_XHelperInterface_idl__
381
+#include <ooo/vba/XHelperInterface.idl>
384
+module ooo { module vba { module word {
388
+ interface ooo::vba::XHelperInterface;
390
+ [attribute] long Width;
391
+ [attribute] any Height;
392
+ [attribute] long HeightRule;
394
+ void SetWidth( [in] float ColumnWidth, [in] long RulerStyle );
395
+ void SetHeight( [in] float RowHeight, [in] long HeightRule );
403
diff --git oovbaapi/ooo/vba/word/XCells.idl oovbaapi/ooo/vba/word/XCells.idl
405
index 0000000..9a18c55
407
+++ oovbaapi/ooo/vba/word/XCells.idl
409
+/*************************************************************************
411
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
413
+ * Copyright 2008 by Sun Microsystems, Inc.
415
+ * OpenOffice.org - a multi-platform office productivity suite
420
+ * This file is part of OpenOffice.org.
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.
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).
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.
437
+ ************************************************************************/
438
+#ifndef __ooo_vba_word_XCells_idl__
439
+#define __ooo_vba_word_XCells_idl__
441
+#ifndef __com_sun_star_uno_XInterface_idl__
442
+#include <com/sun/star/uno/XInterface.idl>
445
+#ifndef __ooo_vba_XCollection_idl__
446
+#include <ooo/vba/XCollection.idl>
450
+//=============================================================================
452
+module ooo { module vba { module word {
454
+//=============================================================================
458
+ interface ::ooo::vba::XCollection;
460
+ [attribute] long Width;
461
+ [attribute] any Height;
462
+ [attribute] long HeightRule;
464
+ void SetWidth( [in] float ColumnWidth, [in] long RulerStyle );
465
+ void SetHeight( [in] float RowHeight, [in] long HeightRule );
471
diff --git oovbaapi/ooo/vba/word/XCheckBox.idl oovbaapi/ooo/vba/word/XCheckBox.idl
473
index 0000000..1baafe5
475
+++ oovbaapi/ooo/vba/word/XCheckBox.idl
477
+/*************************************************************************
479
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
481
+ * Copyright 2008 by Sun Microsystems, Inc.
483
+ * OpenOffice.org - a multi-platform office productivity suite
488
+ * This file is part of OpenOffice.org.
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.
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).
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.
505
+ ************************************************************************/
506
+#ifndef __ooo_vba_word_XCheckBox_idl__
507
+#define __ooo_vba_word_XCheckBox_idl__
509
+#ifndef __com_sun_star_uno_XInterface_idl__
510
+#include <com/sun/star/uno/XInterface.idl>
513
+#ifndef __ooo_vba_XHelperInterface_idl__
514
+#include <ooo/vba/XHelperInterface.idl>
517
+module ooo { module vba { module word {
521
+ interface ooo::vba::XHelperInterface;
523
+ [attribute] boolean Value;
531
diff --git oovbaapi/ooo/vba/word/XColumn.idl oovbaapi/ooo/vba/word/XColumn.idl
533
index 0000000..78266fc
535
+++ oovbaapi/ooo/vba/word/XColumn.idl
537
+/*************************************************************************
539
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
541
+ * Copyright 2008 by Sun Microsystems, Inc.
543
+ * OpenOffice.org - a multi-platform office productivity suite
548
+ * This file is part of OpenOffice.org.
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.
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).
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.
565
+ ************************************************************************/
566
+#ifndef __ooo_vba_word_XColumn_idl__
567
+#define __ooo_vba_word_XColumn_idl__
569
+#ifndef __com_sun_star_uno_XInterface_idl__
570
+#include <com/sun/star/uno/XInterface.idl>
573
+#ifndef __ooo_vba_XHelperInterface_idl__
574
+#include <ooo/vba/XHelperInterface.idl>
577
+module ooo { module vba { module word {
581
+ interface ooo::vba::XHelperInterface;
583
+ [attribute] long Width;
593
diff --git oovbaapi/ooo/vba/word/XColumns.idl oovbaapi/ooo/vba/word/XColumns.idl
595
index 0000000..84ed9cb
597
+++ oovbaapi/ooo/vba/word/XColumns.idl
599
+/*************************************************************************
601
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
603
+ * Copyright 2008 by Sun Microsystems, Inc.
605
+ * OpenOffice.org - a multi-platform office productivity suite
610
+ * This file is part of OpenOffice.org.
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.
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).
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.
627
+ ************************************************************************/
628
+#ifndef __ooo_vba_word_XColumns_idl__
629
+#define __ooo_vba_word_XColumns_idl__
631
+#ifndef __com_sun_star_uno_XInterface_idl__
632
+#include <com/sun/star/uno/XInterface.idl>
635
+#ifndef __ooo_vba_XCollection_idl__
636
+#include <ooo/vba/XCollection.idl>
640
+//=============================================================================
642
+module ooo { module vba { module word {
644
+//=============================================================================
648
+ interface ::ooo::vba::XCollection;
650
+ [attribute] long Width;
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
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;
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);
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 );
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 {
696
interface ::ooo::vba::XHelperInterface;
702
diff --git oovbaapi/ooo/vba/word/XFormField.idl oovbaapi/ooo/vba/word/XFormField.idl
704
index 0000000..23d2a83
706
+++ oovbaapi/ooo/vba/word/XFormField.idl
708
+/*************************************************************************
710
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
712
+ * Copyright 2008 by Sun Microsystems, Inc.
714
+ * OpenOffice.org - a multi-platform office productivity suite
719
+ * This file is part of OpenOffice.org.
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.
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).
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.
736
+ ************************************************************************/
737
+#ifndef __ooo_vba_word_XFormField_idl__
738
+#define __ooo_vba_word_XFormField_idl__
740
+#ifndef __com_sun_star_uno_XInterface_idl__
741
+#include <com/sun/star/uno/XInterface.idl>
744
+#ifndef __ooo_vba_XHelperInterface_idl__
745
+#include <ooo/vba/XHelperInterface.idl>
748
+module ooo { module vba { module word {
750
+interface XFormField
752
+ interface ooo::vba::XHelperInterface;
754
+ [attribute] string Result;
755
+ [attribute] boolean Enabled;
766
diff --git oovbaapi/ooo/vba/word/XFormFields.idl oovbaapi/ooo/vba/word/XFormFields.idl
768
index 0000000..7a19d3b
770
+++ oovbaapi/ooo/vba/word/XFormFields.idl
772
+/*************************************************************************
774
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
776
+ * Copyright 2008 by Sun Microsystems, Inc.
778
+ * OpenOffice.org - a multi-platform office productivity suite
783
+ * This file is part of OpenOffice.org.
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.
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).
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.
800
+ ************************************************************************/
801
+#ifndef __ooo_vba_word_XFormFields_idl__
802
+#define __ooo_vba_word_XFormFields_idl__
804
+#ifndef __com_sun_star_uno_XInterface_idl__
805
+#include <com/sun/star/uno/XInterface.idl>
808
+#ifndef __ooo_vba_XCollection_idl__
809
+#include <ooo/vba/XCollection.idl>
813
+//=============================================================================
815
+module ooo { module vba { module word {
817
+//=============================================================================
819
+interface XFormFields
821
+ interface ::ooo::vba::XCollection;
827
diff --git oovbaapi/ooo/vba/word/XFrame.idl oovbaapi/ooo/vba/word/XFrame.idl
829
index 0000000..5007405
831
+++ oovbaapi/ooo/vba/word/XFrame.idl
833
+/*************************************************************************
835
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
837
+ * Copyright 2008 by Sun Microsystems, Inc.
839
+ * OpenOffice.org - a multi-platform office productivity suite
844
+ * This file is part of OpenOffice.org.
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.
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).
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.
861
+ ************************************************************************/
862
+#ifndef __ooo_vba_word_XFrame_idl__
863
+#define __ooo_vba_word_XFrame_idl__
865
+#ifndef __com_sun_star_uno_XInterface_idl__
866
+#include <com/sun/star/uno/XInterface.idl>
869
+#ifndef __ooo_vba_XHelperInterface_idl__
870
+#include <ooo/vba/XHelperInterface.idl>
873
+#ifndef __com_sun_star_container_XNamed_idl__
874
+#include <com/sun/star/container/XNamed.idl>
877
+module ooo { module vba { module word {
881
+ interface ooo::vba::XHelperInterface;
891
diff --git oovbaapi/ooo/vba/word/XFrames.idl oovbaapi/ooo/vba/word/XFrames.idl
893
index 0000000..4c81545
895
+++ oovbaapi/ooo/vba/word/XFrames.idl
897
+/*************************************************************************
899
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
901
+ * Copyright 2008 by Sun Microsystems, Inc.
903
+ * OpenOffice.org - a multi-platform office productivity suite
908
+ * This file is part of OpenOffice.org.
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.
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).
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.
925
+ ************************************************************************/
926
+#ifndef __ooo_vba_word_XFrames_idl__
927
+#define __ooo_vba_word_XFrames_idl__
929
+#ifndef __com_sun_star_uno_XInterface_idl__
930
+#include <com/sun/star/uno/XInterface.idl>
933
+#ifndef __ooo_vba_XCollection_idl__
934
+#include <ooo/vba/XCollection.idl>
938
+//=============================================================================
940
+module ooo { module vba { module word {
942
+//=============================================================================
946
+ interface ::ooo::vba::XCollection;
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 );
964
diff --git oovbaapi/ooo/vba/word/XHeadersFooters.idl oovbaapi/ooo/vba/word/XHeadersFooters.idl
966
index 0000000..22066e8
968
+++ oovbaapi/ooo/vba/word/XHeadersFooters.idl
970
+/*************************************************************************
972
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
974
+ * Copyright 2008 by Sun Microsystems, Inc.
976
+ * OpenOffice.org - a multi-platform office productivity suite
981
+ * This file is part of OpenOffice.org.
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.
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).
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.
998
+ ************************************************************************/
999
+#ifndef __ooo_vba_word_XHeadersFooters_idl__
1000
+#define __ooo_vba_word_XHeadersFooters_idl__
1002
+#ifndef __com_sun_star_uno_XInterface_idl__
1003
+#include <com/sun/star/uno/XInterface.idl>
1006
+#ifndef __ooo_vba_XCollection_idl__
1007
+#include <ooo/vba/XCollection.idl>
1011
+//=============================================================================
1013
+module ooo { module vba { module word {
1015
+//=============================================================================
1017
+interface XHeadersFooters
1019
+ interface ::ooo::vba::XCollection;
1025
diff --git oovbaapi/ooo/vba/word/XListFormat.idl oovbaapi/ooo/vba/word/XListFormat.idl
1026
new file mode 100644
1027
index 0000000..d9aa65a
1029
+++ oovbaapi/ooo/vba/word/XListFormat.idl
1031
+/*************************************************************************
1033
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1035
+ * Copyright 2008 by Sun Microsystems, Inc.
1037
+ * OpenOffice.org - a multi-platform office productivity suite
1042
+ * This file is part of OpenOffice.org.
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.
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).
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.
1059
+ ************************************************************************/
1060
+#ifndef __ooo_vba_word_XListFormat_idl__
1061
+#define __ooo_vba_word_XListFormat_idl__
1063
+#ifndef __com_sun_star_uno_XInterface_idl__
1064
+#include <com/sun/star/uno/XInterface.idl>
1067
+#ifndef __ooo_vba_XHelperInterface_idl__
1068
+#include <ooo/vba/XHelperInterface.idl>
1071
+module ooo { module vba { module word {
1073
+interface XListTemplate;
1074
+interface XListFormat
1076
+ interface ooo::vba::XHelperInterface;
1078
+ void ApplyListTemplate([in] XListTemplate ListTemplate,
1079
+ [in] any /* optional */ ContinuePreviousList,
1080
+ [in] any /* optional */ ApplyTo,
1081
+ [in] any /* optional */ DefaultListBehavior);
1083
+ void ConvertNumbersToText();
1091
diff --git oovbaapi/ooo/vba/word/XListGalleries.idl oovbaapi/ooo/vba/word/XListGalleries.idl
1092
new file mode 100644
1093
index 0000000..9268afc
1095
+++ oovbaapi/ooo/vba/word/XListGalleries.idl
1097
+/*************************************************************************
1099
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1101
+ * Copyright 2008 by Sun Microsystems, Inc.
1103
+ * OpenOffice.org - a multi-platform office productivity suite
1108
+ * This file is part of OpenOffice.org.
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.
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).
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.
1125
+ ************************************************************************/
1126
+#ifndef __ooo_vba_word_XListGalleries_idl__
1127
+#define __ooo_vba_word_XListGalleries_idl__
1129
+#ifndef __com_sun_star_uno_XInterface_idl__
1130
+#include <com/sun/star/uno/XInterface.idl>
1133
+#ifndef __ooo_vba_XCollection_idl__
1134
+#include <ooo/vba/XCollection.idl>
1138
+//=============================================================================
1140
+module ooo { module vba { module word {
1142
+//=============================================================================
1144
+interface XListGalleries
1146
+ interface ::ooo::vba::XCollection;
1152
diff --git oovbaapi/ooo/vba/word/XListGallery.idl oovbaapi/ooo/vba/word/XListGallery.idl
1153
new file mode 100644
1154
index 0000000..4bd83b9
1156
+++ oovbaapi/ooo/vba/word/XListGallery.idl
1158
+/*************************************************************************
1160
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1162
+ * Copyright 2008 by Sun Microsystems, Inc.
1164
+ * OpenOffice.org - a multi-platform office productivity suite
1169
+ * This file is part of OpenOffice.org.
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.
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).
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.
1186
+ ************************************************************************/
1187
+#ifndef __ooo_vba_word_XListGallery_idl__
1188
+#define __ooo_vba_word_XListGallery_idl__
1190
+#ifndef __com_sun_star_uno_XInterface_idl__
1191
+#include <com/sun/star/uno/XInterface.idl>
1194
+#ifndef __ooo_vba_XHelperInterface_idl__
1195
+#include <ooo/vba/XHelperInterface.idl>
1198
+module ooo { module vba { module word {
1200
+interface XListGallery
1202
+ interface ooo::vba::XHelperInterface;
1204
+ any ListTemplates( [in] any aIndex );
1212
diff --git oovbaapi/ooo/vba/word/XListLevel.idl oovbaapi/ooo/vba/word/XListLevel.idl
1213
new file mode 100644
1214
index 0000000..0ea1be7
1216
+++ oovbaapi/ooo/vba/word/XListLevel.idl
1218
+/*************************************************************************
1220
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1222
+ * Copyright 2008 by Sun Microsystems, Inc.
1224
+ * OpenOffice.org - a multi-platform office productivity suite
1229
+ * This file is part of OpenOffice.org.
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.
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).
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.
1246
+ ************************************************************************/
1247
+#ifndef __ooo_vba_word_XListLevel_idl__
1248
+#define __ooo_vba_word_XListLevel_idl__
1250
+#ifndef __com_sun_star_uno_XInterface_idl__
1251
+#include <com/sun/star/uno/XInterface.idl>
1254
+#ifndef __ooo_vba_XHelperInterface_idl__
1255
+#include <ooo/vba/XHelperInterface.idl>
1258
+module ooo { module vba { module word {
1261
+interface XListLevel
1263
+ interface ooo::vba::XHelperInterface;
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;
1284
diff --git oovbaapi/ooo/vba/word/XListLevels.idl oovbaapi/ooo/vba/word/XListLevels.idl
1285
new file mode 100644
1286
index 0000000..522d474
1288
+++ oovbaapi/ooo/vba/word/XListLevels.idl
1290
+/*************************************************************************
1292
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1294
+ * Copyright 2008 by Sun Microsystems, Inc.
1296
+ * OpenOffice.org - a multi-platform office productivity suite
1301
+ * This file is part of OpenOffice.org.
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.
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).
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.
1318
+ ************************************************************************/
1319
+#ifndef __ooo_vba_word_XListLevels_idl__
1320
+#define __ooo_vba_word_XListLevels_idl__
1322
+#ifndef __com_sun_star_uno_XInterface_idl__
1323
+#include <com/sun/star/uno/XInterface.idl>
1326
+#ifndef __ooo_vba_XCollection_idl__
1327
+#include <ooo/vba/XCollection.idl>
1331
+//=============================================================================
1333
+module ooo { module vba { module word {
1335
+//=============================================================================
1337
+interface XListLevels
1339
+ interface ::ooo::vba::XCollection;
1345
diff --git oovbaapi/ooo/vba/word/XListTemplate.idl oovbaapi/ooo/vba/word/XListTemplate.idl
1346
new file mode 100644
1347
index 0000000..403bfa9
1349
+++ oovbaapi/ooo/vba/word/XListTemplate.idl
1351
+/*************************************************************************
1353
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1355
+ * Copyright 2008 by Sun Microsystems, Inc.
1357
+ * OpenOffice.org - a multi-platform office productivity suite
1362
+ * This file is part of OpenOffice.org.
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.
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).
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.
1379
+ ************************************************************************/
1380
+#ifndef __ooo_vba_word_XListTemplate_idl__
1381
+#define __ooo_vba_word_XListTemplate_idl__
1383
+#ifndef __com_sun_star_uno_XInterface_idl__
1384
+#include <com/sun/star/uno/XInterface.idl>
1387
+#ifndef __ooo_vba_XHelperInterface_idl__
1388
+#include <ooo/vba/XHelperInterface.idl>
1391
+module ooo { module vba { module word {
1393
+interface XListTemplate
1395
+ interface ooo::vba::XHelperInterface;
1397
+ any ListLevels( [in] any aIndex );
1405
diff --git oovbaapi/ooo/vba/word/XListTemplates.idl oovbaapi/ooo/vba/word/XListTemplates.idl
1406
new file mode 100644
1407
index 0000000..d6ec96d
1409
+++ oovbaapi/ooo/vba/word/XListTemplates.idl
1411
+/*************************************************************************
1413
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1415
+ * Copyright 2008 by Sun Microsystems, Inc.
1417
+ * OpenOffice.org - a multi-platform office productivity suite
1422
+ * This file is part of OpenOffice.org.
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.
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).
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.
1439
+ ************************************************************************/
1440
+#ifndef __ooo_vba_word_XListTemplates_idl__
1441
+#define __ooo_vba_word_XListTemplates_idl__
1443
+#ifndef __com_sun_star_uno_XInterface_idl__
1444
+#include <com/sun/star/uno/XInterface.idl>
1447
+#ifndef __ooo_vba_XCollection_idl__
1448
+#include <ooo/vba/XCollection.idl>
1452
+//=============================================================================
1454
+module ooo { module vba { module word {
1456
+//=============================================================================
1458
+interface XListTemplates
1460
+ interface ::ooo::vba::XCollection;
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;
1473
[attribute, readonly] XRange Range;
1474
+ [attribute] any Style;
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;
1486
+interface XListFormat;
1489
interface ooo::vba::XHelperInterface;
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;
1504
void InsertBreak( [in] any Type );
1506
@@ -69,6 +71,10 @@ interface XRange
1507
void InsertParagraphBefore();
1508
void InsertParagraphAfter();
1510
+ boolean InRange( [in] XRange Range );
1511
+ any Revisions( [in] any index );
1512
+ any Sections( [in] any index );
1513
+ any Fields( [in] any index );
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;
1524
[attribute] string Text;
1526
+ void ClearFormatting();
1530
diff --git oovbaapi/ooo/vba/word/XRevision.idl oovbaapi/ooo/vba/word/XRevision.idl
1531
new file mode 100644
1532
index 0000000..bb3e570
1534
+++ oovbaapi/ooo/vba/word/XRevision.idl
1536
+/*************************************************************************
1538
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1540
+ * Copyright 2008 by Sun Microsystems, Inc.
1542
+ * OpenOffice.org - a multi-platform office productivity suite
1547
+ * This file is part of OpenOffice.org.
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.
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).
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.
1564
+ ************************************************************************/
1565
+#ifndef __ooo_vba_word_XRevision_idl__
1566
+#define __ooo_vba_word_XRevision_idl__
1568
+#ifndef __com_sun_star_uno_XInterface_idl__
1569
+#include <com/sun/star/uno/XInterface.idl>
1572
+#ifndef __ooo_vba_XHelperInterface_idl__
1573
+#include <ooo/vba/XHelperInterface.idl>
1576
+module ooo { module vba { module word {
1579
+interface XRevision
1581
+ interface ooo::vba::XHelperInterface;
1592
diff --git oovbaapi/ooo/vba/word/XRevisions.idl oovbaapi/ooo/vba/word/XRevisions.idl
1593
new file mode 100644
1594
index 0000000..358face
1596
+++ oovbaapi/ooo/vba/word/XRevisions.idl
1598
+/*************************************************************************
1600
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1602
+ * Copyright 2008 by Sun Microsystems, Inc.
1604
+ * OpenOffice.org - a multi-platform office productivity suite
1609
+ * This file is part of OpenOffice.org.
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.
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).
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.
1626
+ ************************************************************************/
1627
+#ifndef __ooo_vba_word_XRevisions_idl__
1628
+#define __ooo_vba_word_XRevisions_idl__
1630
+#ifndef __com_sun_star_uno_XInterface_idl__
1631
+#include <com/sun/star/uno/XInterface.idl>
1634
+#ifndef __ooo_vba_XCollection_idl__
1635
+#include <ooo/vba/XCollection.idl>
1639
+//=============================================================================
1641
+module ooo { module vba { module word {
1643
+//=============================================================================
1645
+interface XRevisions
1647
+ interface ::ooo::vba::XCollection;
1656
diff --git oovbaapi/ooo/vba/word/XRow.idl oovbaapi/ooo/vba/word/XRow.idl
1657
new file mode 100644
1658
index 0000000..2c54828
1660
+++ oovbaapi/ooo/vba/word/XRow.idl
1662
+/*************************************************************************
1664
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1666
+ * Copyright 2008 by Sun Microsystems, Inc.
1668
+ * OpenOffice.org - a multi-platform office productivity suite
1673
+ * This file is part of OpenOffice.org.
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.
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).
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.
1690
+ ************************************************************************/
1691
+#ifndef __ooo_vba_word_XRow_idl__
1692
+#define __ooo_vba_word_XRow_idl__
1694
+#ifndef __com_sun_star_uno_XInterface_idl__
1695
+#include <com/sun/star/uno/XInterface.idl>
1698
+#ifndef __ooo_vba_XHelperInterface_idl__
1699
+#include <ooo/vba/XHelperInterface.idl>
1702
+module ooo { module vba { module word {
1706
+ interface ooo::vba::XHelperInterface;
1708
+ [attribute] any Height;
1709
+ [attribute] long HeightRule;
1712
+ void SetHeight( [in] float RowHeight, [in] long HeightRule );
1720
diff --git oovbaapi/ooo/vba/word/XRows.idl oovbaapi/ooo/vba/word/XRows.idl
1721
new file mode 100644
1722
index 0000000..8d0ae61
1724
+++ oovbaapi/ooo/vba/word/XRows.idl
1726
+/*************************************************************************
1728
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1730
+ * Copyright 2008 by Sun Microsystems, Inc.
1732
+ * OpenOffice.org - a multi-platform office productivity suite
1737
+ * This file is part of OpenOffice.org.
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.
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).
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.
1754
+ ************************************************************************/
1755
+#ifndef __ooo_vba_word_XRows_idl__
1756
+#define __ooo_vba_word_XRows_idl__
1758
+#ifndef __com_sun_star_uno_XInterface_idl__
1759
+#include <com/sun/star/uno/XInterface.idl>
1762
+#ifndef __ooo_vba_XCollection_idl__
1763
+#include <ooo/vba/XCollection.idl>
1767
+//=============================================================================
1769
+module ooo { module vba { module word {
1771
+//=============================================================================
1775
+ interface ::ooo::vba::XCollection;
1777
+ [attribute] long Alignment;
1778
+ [attribute] any AllowBreakAcrossPages;
1779
+ [attribute] float SpaceBetweenColumns;
1782
+ void SetLeftIndent( [in] float LeftIndent, [in] long RulerStyle );
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
1795
[attribute] boolean ProtectedForForms;
1799
+ any Headers( [in] any aIndex );
1800
+ any Footers( [in] any aIndex );
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 );
1829
+ void SelectColumn();
1831
+ any Rows( [in] any aIndex );
1832
+ any Columns( [in] any aIndex );
1833
+ any Cells( [in] any aIndex );
1835
+ void CopyAsPicture();
1837
+ void Collapse([in] any Direction);
1838
+ void WholeStory();
1839
+ boolean InRange( [in] XRange Range );
1840
+ void SplitTable();
1841
+ any Paragraphs( [in] any aIndex );
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
1850
#include <ooo/vba/XHelperInterface.idl>
1853
+#ifndef __com_sun_star_script_XDefaultProperty_idl__
1854
+#include <com/sun/star/script/XDefaultProperty.idl>
1857
module ooo { module vba { module word {
1860
+interface XListTemplate;
1861
+interface XParagraphFormat;
1864
interface ooo::vba::XHelperInterface;
1865
+ interface com::sun::star::script::XDefaultProperty;
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;
1878
+ void LinkToListTemplate( [in] XListTemplate ListTemplate, [in] any ListLevelNumber );
1882
diff --git oovbaapi/ooo/vba/word/XTabStop.idl oovbaapi/ooo/vba/word/XTabStop.idl
1883
new file mode 100644
1884
index 0000000..b9cf94d
1886
+++ oovbaapi/ooo/vba/word/XTabStop.idl
1888
+/*************************************************************************
1890
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1892
+ * Copyright 2008 by Sun Microsystems, Inc.
1894
+ * OpenOffice.org - a multi-platform office productivity suite
1899
+ * This file is part of OpenOffice.org.
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.
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).
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.
1916
+ ************************************************************************/
1917
+#ifndef __ooo_vba_word_XTabStop_idl__
1918
+#define __ooo_vba_word_XTabStop_idl__
1920
+#ifndef __com_sun_star_uno_XInterface_idl__
1921
+#include <com/sun/star/uno/XInterface.idl>
1924
+#ifndef __ooo_vba_XHelperInterface_idl__
1925
+#include <ooo/vba/XHelperInterface.idl>
1928
+module ooo { module vba { module word {
1932
+ interface ooo::vba::XHelperInterface;
1940
diff --git oovbaapi/ooo/vba/word/XTabStops.idl oovbaapi/ooo/vba/word/XTabStops.idl
1941
new file mode 100644
1942
index 0000000..318d492
1944
+++ oovbaapi/ooo/vba/word/XTabStops.idl
1946
+/*************************************************************************
1948
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1950
+ * Copyright 2008 by Sun Microsystems, Inc.
1952
+ * OpenOffice.org - a multi-platform office productivity suite
1957
+ * This file is part of OpenOffice.org.
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.
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).
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.
1974
+ ************************************************************************/
1975
+#ifndef __ooo_vba_word_XTabStops_idl__
1976
+#define __ooo_vba_word_XTabStops_idl__
1978
+#ifndef __com_sun_star_uno_XInterface_idl__
1979
+#include <com/sun/star/uno/XInterface.idl>
1982
+#ifndef __ooo_vba_XCollection_idl__
1983
+#include <ooo/vba/XCollection.idl>
1987
+//=============================================================================
1989
+module ooo { module vba { module word {
1991
+//=============================================================================
1993
+interface XTabStop;
1994
+interface XTabStops
1996
+ interface ::ooo::vba::XCollection;
1998
+ XTabStop Add([in] float Position, [in] any Alignment, [in] any Leader );
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);
2012
any Borders( [in] any aIndex );
2015
+ any Rows([in] any aIndex );
2016
+ any Columns([in] any aIndex );
2020
diff --git oovbaapi/ooo/vba/word/XTableOfContents.idl oovbaapi/ooo/vba/word/XTableOfContents.idl
2021
new file mode 100644
2022
index 0000000..dcb7e8a
2024
+++ oovbaapi/ooo/vba/word/XTableOfContents.idl
2026
+/*************************************************************************
2028
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2030
+ * Copyright 2008 by Sun Microsystems, Inc.
2032
+ * OpenOffice.org - a multi-platform office productivity suite
2037
+ * This file is part of OpenOffice.org.
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.
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).
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.
2054
+ ************************************************************************/
2055
+#ifndef __ooo_vba_word_XTableOfContents_idl__
2056
+#define __ooo_vba_word_XTableOfContents_idl__
2058
+#ifndef __com_sun_star_uno_XInterface_idl__
2059
+#include <com/sun/star/uno/XInterface.idl>
2062
+#ifndef __ooo_vba_XHelperInterface_idl__
2063
+#include <ooo/vba/XHelperInterface.idl>
2066
+module ooo { module vba { module word {
2068
+interface XTableOfContents
2070
+ interface ooo::vba::XHelperInterface;
2072
+ [attribute] long LowerHeadingLevel;
2073
+ [attribute] long TabLeader;
2074
+ [attribute] boolean UseFields;
2075
+ [attribute] boolean UseOutlineLevels;
2086
diff --git oovbaapi/ooo/vba/word/XTablesOfContents.idl oovbaapi/ooo/vba/word/XTablesOfContents.idl
2087
new file mode 100644
2088
index 0000000..53c557b
2090
+++ oovbaapi/ooo/vba/word/XTablesOfContents.idl
2092
+/*************************************************************************
2094
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2096
+ * Copyright 2008 by Sun Microsystems, Inc.
2098
+ * OpenOffice.org - a multi-platform office productivity suite
2103
+ * This file is part of OpenOffice.org.
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.
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).
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.
2120
+ ************************************************************************/
2121
+#ifndef __ooo_vba_word_XTablesOfContents_idl__
2122
+#define __ooo_vba_word_XTablesOfContents_idl__
2124
+#ifndef __com_sun_star_uno_XInterface_idl__
2125
+#include <com/sun/star/uno/XInterface.idl>
2128
+#ifndef __ooo_vba_XCollection_idl__
2129
+#include <ooo/vba/XCollection.idl>
2133
+//=============================================================================
2135
+module ooo { module vba { module word {
2137
+//=============================================================================
2139
+interface XTableOfContents;
2141
+interface XTablesOfContents
2143
+ interface ::ooo::vba::XCollection;
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 );
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;
2158
[attribute, readonly] string Name;
2159
+ [attribute, readonly] string Path;
2161
any AutoTextEntries( [in] any aIndex );
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
2170
[attribute] any View;
2171
+ [attribute] any WindowState;
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\
2191
+ XTableOfContents.idl \
2192
+ XTablesOfContents.idl \
2194
+ XListGalleries.idl \
2195
+ XListGallery.idl \
2196
+ XListTemplate.idl \
2197
+ XListTemplates.idl \
2207
+ XHeadersFooters.idl \
2209
# ------------------------------------------------------------------
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 );
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 >&
2232
-class ImplVbaEventNameInfo
2233
+ScVbaEventsHelper::ScVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArgs, uno::Reference< uno::XComponentContext > const& xContext ) : VbaEventsHelperBase( xContext ), mbOpened( sal_False )
2236
- map< sal_Int32, rtl::OUString > m_aEventNameMap;
2239
- static ImplVbaEventNameInfo* pImplVbaEventNameInfo;
2240
- ImplVbaEventNameInfo() { InitImplVbaEventNameInfo(); }
2242
- void insert( const sal_Int32 nId, const rtl::OUString& sEventName )
2244
- m_aEventNameMap.insert( make_pair( nId, sEventName ) );
2246
- void InitImplVbaEventNameInfo();
2248
- virtual ~ImplVbaEventNameInfo();
2249
- rtl::OUString getEventName( const sal_Int32 nId )
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();
2256
- static ImplVbaEventNameInfo* GetImplVbaEventNameInfo();
2258
-ImplVbaEventNameInfo* ImplVbaEventNameInfo::pImplVbaEventNameInfo = NULL;
2260
-ImplVbaEventNameInfo::~ImplVbaEventNameInfo()
2262
- if( pImplVbaEventNameInfo )
2264
- delete pImplVbaEventNameInfo;
2265
- pImplVbaEventNameInfo = NULL;
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 ) ) );
2277
-ImplVbaEventNameInfo*
2278
-ImplVbaEventNameInfo::GetImplVbaEventNameInfo()
2279
+ScVbaEventsHelper::~ScVbaEventsHelper()
2281
- if( !pImplVbaEventNameInfo )
2283
- pImplVbaEventNameInfo = new ImplVbaEventNameInfo;
2285
- return pImplVbaEventNameInfo;
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 )
2293
-void ImplVbaEventNameInfo::InitImplVbaEventNameInfo()
2294
+void ScVbaEventsHelper::Initilize()
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" );
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 )
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 ) ) );
2314
-ScVbaEventsHelper::~ScVbaEventsHelper()
2319
-ScVbaEventsHelper::getEventName( const sal_Int32 nId )
2321
- rtl::OUString sEventName;
2322
- ImplVbaEventNameInfo* pEventInfo = ImplVbaEventNameInfo::GetImplVbaEventNameInfo();
2324
- sEventName = pEventInfo->getEventName( nId );
2325
- return sEventName;
2328
uno::Any ScVbaEventsHelper::createWorkSheet( SfxObjectShell* pShell, SCTAB nTab )
2331
@@ -1049,16 +993,15 @@ ScVbaEventsHelper::ProcessCompatibleVbaEvent( sal_Int32 nEventId, const uno::Seq
2333
ScVbaEventsHelper::getIgnoreEvents() throw (uno::RuntimeException)
2335
- return mbIgnoreEvents;
2336
+ return VbaEventsHelperBase::getIgnoreEvents();
2340
ScVbaEventsHelper::setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (uno::RuntimeException)
2342
- mbIgnoreEvents = _ignoreevents;
2343
+ VbaEventsHelperBase::setIgnoreEvents( _ignoreevents );
2347
namespace vbaeventshelper
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(
2353
"ScVbaEventsHelper",
2354
- "com.sun.star.document.VbaEventsHelper" );
2355
+ "com.sun.star.sheet.SpreadsheetDocumentVbaEventsHelper" );
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
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>
2367
#define INVALID_TAB -1
2369
@@ -49,15 +50,13 @@ typedef ::cppu::WeakImplHelper1< com::sun::star::document::XVbaEventsHelper > VB
2371
class VbaEventsListener;
2373
-class ScVbaEventsHelper : public VBAWorkbookEvent_BASE
2374
+class ScVbaEventsHelper : public VBAWorkbookEvent_BASE, public VbaEventsHelperBase
2378
ScDocShell* pDocShell;
2379
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
2380
css::uno::Reference< css::awt::XWindowListener > m_xVbaEventsListener;
2382
- sal_Bool mbIgnoreEvents;
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 );
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();
2410
+ScVbaWorkbook::Protect( const uno::Any &aPassword ) throw (uno::RuntimeException)
2412
+ VbaDocumentBase::Protect( aPassword );
2416
ScVbaWorkbook::getProtectStructure() throw (uno::RuntimeException)
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);
2428
virtual css::uno::Any SAL_CALL Names( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
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
2435
#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
2436
#include <tools/urlobj.hxx>
2437
#include <osl/file.hxx>
2438
+#include <svtools/pathoptions.hxx>
2440
using namespace ::com::sun::star;
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 )
2450
+ SvtPathOptions aPathOpt;
2451
+ String aAddinPath = aPathOpt.GetAddinPath();
2452
+ if( rtl::OUString( sDocUrlOrPath ).indexOf( aAddinPath ) == 0 )
2453
+ pFoundShell = pShell;
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 );
2464
diff --git sw/inc/doc.hxx sw/inc/doc.hxx
2465
index 7666665..5052f96 100644
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>
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;
2482
// --> OD 2007-10-26 #i83479#
2484
@@ -2118,6 +2120,7 @@ public:
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();
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);
2500
- static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
2501
+ SW_DLLPUBLIC static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
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()
2513
+uno::Reference< document::XVbaEventsHelper >
2514
+SwDoc::GetVbaEventsHelper()
2516
+ if( !mxVbaEventsHelper.is() )
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 );
2528
+ catch( uno::Exception& e )
2532
+ return mxVbaEventsHelper;
2535
void SwDoc::setExternalData(::sw::tExternalDataType eType,
2536
::sw::tExternalDataPointer pPayload)
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>
2546
-const static String sThisDocument( RTL_CONSTASCII_USTRINGPARAM("ThisDocument"));
2548
-struct DocEventNameTable
2550
- const sal_Char* sEventName;
2551
- const sal_Char* sMacroName;
2554
-const DocEventNameTable aEventNameTable[] =
2556
- {"OnNew", "Document_New"},
2557
- {"OnLoad", "Document_Open"},
2558
- {"OnPrepareUnload", "Document_Close"},
2562
-bool registerDocEvent( SfxObjectShell* pShell )
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() )
2570
- uno::Reference< container::XNameReplace > xEvts( xEvtSupplier->getEvents(), uno::UNO_QUERY );
2573
- for( const DocEventNameTable* pTable = aEventNameTable; pTable->sEventName != NULL; pTable++ )
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() )
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();
2592
- sal_Int32 nNewSize = aEvents.getLength() + aOpenEvt.getLength();
2593
- if ( nNewSize > aEvents.getLength() )
2594
- aEvents.realloc( nNewSize );
2596
- for ( sal_Int32 nIndex = nPos, nCpyIndex = 0; nIndex<nNewSize; nIndex++, nCpyIndex++ )
2597
- aEvents[ nIndex ] = aOpenEvt[ nCpyIndex ];
2599
- uno::Any aParam = uno::makeAny( aEvents );
2601
- xEvts->replaceByName( sEvt, aParam );
2611
@@ -4363,10 +4301,6 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
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 );
2619
maTracer.LeaveEnvironment(sw::log::eMacros);
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
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>
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;
2641
extern BOOL FindPhyStyle( SwDoc& , const String& , SfxStyleFamily );
2643
@@ -222,6 +225,31 @@ void SwDocShell::DoFlushDocInfo()
2647
+void lcl_processCompatibleSfxHint( const uno::Reference< document::XVbaEventsHelper >& xVbaEventsHelper, const SfxHint& rHint )
2649
+ if ( rHint.ISA( SfxEventHint ) )
2651
+ uno::Sequence< uno::Any > aArgs;
2652
+ ULONG nEventId = ((SfxEventHint&)rHint).GetEventId();
2653
+ switch( nEventId )
2655
+ case SFX_EVENT_CREATEDOC:
2657
+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_DOCUMENT_NEW, aArgs );
2660
+ case SFX_EVENT_OPENDOC:
2662
+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_DOCUMENT_OPEN, aArgs );
2673
/*--------------------------------------------------------------------
2674
Beschreibung: Benachrichtigung bei geaenderter DocInfo
2675
@@ -233,15 +261,18 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
2677
//MA: Kommt bei der OLE-Registration vor!
2678
// ASSERT( !this, "DocShell ist nicht richtig initialisiert!" );
2682
- USHORT nAction = 0;
2683
- if( rHint.ISA(SfxSimpleHint) )
2685
- // swithc for more actions
2686
- switch( ((SfxSimpleHint&) rHint).GetId() )
2690
+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper = pDoc->GetVbaEventsHelper();
2691
+ if( xVbaEventsHelper.is() )
2692
+ lcl_processCompatibleSfxHint( xVbaEventsHelper, rHint );
2694
+ USHORT nAction = 0;
2695
+ if( rHint.ISA(SfxSimpleHint) )
2697
+ // swithc for more actions
2698
+ switch( ((SfxSimpleHint&) rHint).GetId() )
2700
case SFX_HINT_TITLECHANGED:
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 );
2708
+ if( pDoc && IsInPrepareClose() )
2710
+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper = pDoc->GetVbaEventsHelper();
2711
+ if( xVbaEventsHelper.is() )
2713
+ uno::Sequence< uno::Any > aArgs;
2714
+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_DOCUMENT_CLOSE, aArgs );
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 \
2766
# --- Targets ------------------------------------------------------
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;
2776
+namespace vbaeventshelper
2778
+extern sdecl::ServiceDecl const serviceDecl;
2783
void SAL_CALL component_getImplementationEnvironment(
2784
@@ -71,7 +76,7 @@ extern "C"
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 );
2792
void * SAL_CALL component_getFactory(
2793
@@ -80,7 +85,7 @@ extern "C"
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);
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
2807
#include <svx/acorrcfg.hxx>
2808
#include "wordvbahelper.hxx"
2809
#include <docsh.hxx>
2810
+#include "vbalistgalleries.hxx"
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 );
2819
+SwVbaApplication::ListGalleries( const uno::Any& index ) throw (uno::RuntimeException)
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 );
2828
sal_Bool SAL_CALL SwVbaApplication::getDisplayAutoCompleteTips() throw (css::uno::RuntimeException)
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
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"
2856
using namespace ::ooo::vba;
2857
@@ -44,7 +46,7 @@ SwVbaAutoTextEntry::~SwVbaAutoTextEntry()
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 )
2864
SwVbaRange* pWhere = dynamic_cast<SwVbaRange*>( _where.get() );
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;
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() )
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 );
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 );
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)
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 >() );
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
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"
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 )
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 ) );
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();
2947
// XEnumerationAccess
2949
@@ -149,16 +149,16 @@ SwVbaBookmarks::createCollectionObject( const css::uno::Any& aSource )
2950
void SwVbaBookmarks::removeBookmarkByName( const rtl::OUString& rName ) throw (uno::RuntimeException)
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 );
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)
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 );
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 );
2974
- addBookmarkByName( aName, xTextRange );
2975
+ addBookmarkByName( mxModel, aName, xTextRange );
2977
return uno::makeAny( uno::Reference< word::XBookmark >( new SwVbaBookmark( getParent(), mxContext, mxModel, aName ) ) );
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:
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);
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() {}
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
3003
sal_Bool SAL_CALL SwVbaBorders::getShadow() throw (uno::RuntimeException)
3006
table::ShadowFormat aShadowFormat;
3007
m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShadowFormat") ) ) >>= aShadowFormat;
3008
return ( aShadowFormat.Location != table::ShadowLocation_NONE );
3010
+ // always return False for table border in MS Word
3014
void SAL_CALL SwVbaBorders::setShadow( sal_Bool /*_shadow*/ ) throw (uno::RuntimeException)
3016
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
3017
+ // not support in Table border in Word
3022
diff --git sw/source/ui/vba/vbacell.cxx sw/source/ui/vba/vbacell.cxx
3023
new file mode 100644
3024
index 0000000..59e2f22
3026
+++ sw/source/ui/vba/vbacell.cxx
3028
+/*************************************************************************
3030
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3032
+ * Copyright 2008 by Sun Microsystems, Inc.
3034
+ * OpenOffice.org - a multi-platform office productivity suite
3039
+ * This file is part of OpenOffice.org.
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.
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).
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.
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"
3068
+using namespace ::ooo::vba;
3069
+using namespace ::com::sun::star;
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 )
3076
+SwVbaCell::~SwVbaCell()
3080
+::sal_Int32 SAL_CALL SwVbaCell::getWidth() throw (css::uno::RuntimeException)
3082
+ SwVbaTableHelper aTableHelper( mxTextTable );
3083
+ return aTableHelper.GetColWidth( mnColumn, mnRow, sal_True );
3086
+void SAL_CALL SwVbaCell::setWidth( ::sal_Int32 _width ) throw (css::uno::RuntimeException)
3088
+ SwVbaTableHelper aTableHelper( mxTextTable );
3089
+ aTableHelper.SetColWidth( _width, mnColumn, mnRow, sal_True );
3092
+uno::Any SAL_CALL SwVbaCell::getHeight() throw (css::uno::RuntimeException)
3094
+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
3095
+ return xRow->getHeight();
3098
+void SAL_CALL SwVbaCell::setHeight( const uno::Any& _height ) throw (css::uno::RuntimeException)
3100
+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
3101
+ xRow->setHeight( _height );
3104
+::sal_Int32 SAL_CALL SwVbaCell::getHeightRule() throw (css::uno::RuntimeException)
3106
+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
3107
+ return xRow->getHeightRule();
3110
+void SAL_CALL SwVbaCell::setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException)
3112
+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
3113
+ xRow->setHeightRule( _heightrule );
3116
+void SAL_CALL SwVbaCell::SetWidth( float width, sal_Int32 rulestyle ) throw (css::uno::RuntimeException)
3118
+ // FIXME: handle the argument: rulestyle
3119
+ setWidth( width );
3122
+void SAL_CALL SwVbaCell::SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException)
3124
+ // FIXME: handle the argument: heightrule
3125
+ setHeightRule( heightrule );
3126
+ setHeight( uno::makeAny( height ) );
3130
+SwVbaCell::getServiceImplName()
3132
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaCell") );
3136
+uno::Sequence< rtl::OUString >
3137
+SwVbaCell::getServiceNames()
3139
+ static uno::Sequence< rtl::OUString > aServiceNames;
3140
+ if ( aServiceNames.getLength() == 0 )
3142
+ aServiceNames.realloc( 1 );
3143
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Cell" ) );
3145
+ return aServiceNames;
3148
diff --git sw/source/ui/vba/vbacell.hxx sw/source/ui/vba/vbacell.hxx
3149
new file mode 100644
3150
index 0000000..1350288
3152
+++ sw/source/ui/vba/vbacell.hxx
3154
+/*************************************************************************
3156
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3158
+ * Copyright 2008 by Sun Microsystems, Inc.
3160
+ * OpenOffice.org - a multi-platform office productivity suite
3165
+ * This file is part of OpenOffice.org.
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.
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).
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.
3182
+ ************************************************************************/
3183
+#ifndef SW_VBA_CELL_HXX
3184
+#define SW_VBA_CELL_HXX
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>
3191
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XCell > SwVbaCell_BASE;
3193
+class SwVbaCell : public SwVbaCell_BASE
3196
+ css::uno::Reference< css::text::XTextTable > mxTextTable;
3197
+ sal_Int32 mnColumn;
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();
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);
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);
3216
+ // XHelperInterface
3217
+ virtual rtl::OUString& getServiceImplName();
3218
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
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
3225
+++ sw/source/ui/vba/vbacells.cxx
3227
+/*************************************************************************
3229
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3231
+ * Copyright 2008 by Sun Microsystems, Inc.
3233
+ * OpenOffice.org - a multi-platform office productivity suite
3238
+ * This file is part of OpenOffice.org.
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.
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).
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.
3255
+ ************************************************************************/
3256
+#include "vbacells.hxx"
3257
+#include "vbacell.hxx"
3258
+#include "wordvbahelper.hxx"
3259
+#include "vbatablehelper.hxx"
3260
+#include "vbarow.hxx"
3262
+using namespace ::ooo::vba;
3263
+using namespace ::com::sun::star;
3265
+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > CellCollectionHelper_Base;
3267
+class CellsEnumWrapper : public EnumerationHelper_BASE
3269
+ uno::Reference< container::XIndexAccess > mxIndexAccess;
3273
+ CellsEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : mxIndexAccess( xIndexAccess ), nIndex( 0 )
3276
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
3278
+ return ( nIndex < mxIndexAccess->getCount() );
3281
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
3283
+ if( nIndex < mxIndexAccess->getCount() )
3285
+ return mxIndexAccess->getByIndex( nIndex++ );
3287
+ throw container::NoSuchElementException();
3291
+class CellCollectionHelper : public CellCollectionHelper_Base
3294
+ uno::Reference< XHelperInterface > mxParent;
3295
+ uno::Reference< uno::XComponentContext > mxContext;
3296
+ uno::Reference< css::text::XTextTable > mxTextTable;
3299
+ sal_Int32 mnRight;
3300
+ sal_Int32 mnBottom;
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 )
3306
+ virtual ~CellCollectionHelper() {}
3308
+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
3310
+ return ( mnRight - mnLeft + 1 ) * ( mnBottom - mnTop + 1 );
3312
+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
3314
+ if ( Index < 0 || Index >= getCount() )
3315
+ throw css::lang::IndexOutOfBoundsException();
3317
+ for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
3319
+ for( sal_Int32 col = mnLeft; col <= mnRight; col++ )
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 ) ) );
3325
+ throw css::lang::IndexOutOfBoundsException();
3328
+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
3330
+ return word::XCell::static_type(0);
3332
+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
3336
+ // XEnumerationAccess
3337
+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
3339
+ return new CellsEnumWrapper( this );
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 )
3347
+::sal_Int32 SAL_CALL SwVbaCells::getWidth() throw (css::uno::RuntimeException)
3349
+ uno::Reference< word::XCell > xCell( m_xIndexAccess->getByIndex( 0 ), uno::UNO_QUERY_THROW );
3350
+ return xCell->getWidth();
3353
+void SAL_CALL SwVbaCells::setWidth( ::sal_Int32 _width ) throw (css::uno::RuntimeException)
3355
+ sal_Int32 nIndex = 0;
3356
+ while( nIndex < m_xIndexAccess->getCount() )
3358
+ uno::Reference< word::XCell > xCell( m_xIndexAccess->getByIndex( nIndex++ ), uno::UNO_QUERY_THROW );
3359
+ xCell->setWidth( _width );
3363
+uno::Any SAL_CALL SwVbaCells::getHeight() throw (css::uno::RuntimeException)
3365
+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnTop ) );
3366
+ return xRow->getHeight();
3369
+void SAL_CALL SwVbaCells::setHeight( const uno::Any& _height ) throw (css::uno::RuntimeException)
3371
+ for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
3373
+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, row ) );
3374
+ xRow->setHeight( _height );
3378
+::sal_Int32 SAL_CALL SwVbaCells::getHeightRule() throw (css::uno::RuntimeException)
3380
+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnTop ) );
3381
+ return xRow->getHeightRule();
3384
+void SAL_CALL SwVbaCells::setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException)
3386
+ for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
3388
+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, row ) );
3389
+ xRow->setHeightRule( _heightrule );
3393
+void SAL_CALL SwVbaCells::SetWidth( float width, sal_Int32 rulestyle ) throw (css::uno::RuntimeException)
3395
+ sal_Int32 nIndex = 0;
3396
+ while( nIndex < m_xIndexAccess->getCount() )
3398
+ uno::Reference< word::XCell > xCell( m_xIndexAccess->getByIndex( nIndex++ ), uno::UNO_QUERY_THROW );
3399
+ xCell->SetWidth( width, rulestyle );
3403
+void SAL_CALL SwVbaCells::SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException)
3405
+ for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
3407
+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, row ) );
3408
+ xRow->SetHeight( height, heightrule );
3412
+// XEnumerationAccess
3414
+SwVbaCells::getElementType() throw (uno::RuntimeException)
3416
+ return word::XCell::static_type(0);
3419
+uno::Reference< container::XEnumeration >
3420
+SwVbaCells::createEnumeration() throw (uno::RuntimeException)
3422
+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
3423
+ return xEnumAccess->createEnumeration();
3427
+SwVbaCells::createCollectionObject( const uno::Any& aSource )
3433
+SwVbaCells::getServiceImplName()
3435
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaCells") );
3439
+uno::Sequence<rtl::OUString>
3440
+SwVbaCells::getServiceNames()
3442
+ static uno::Sequence< rtl::OUString > sNames;
3443
+ if ( sNames.getLength() == 0 )
3445
+ sNames.realloc( 1 );
3446
+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Cells") );
3450
diff --git sw/source/ui/vba/vbacells.hxx sw/source/ui/vba/vbacells.hxx
3451
new file mode 100644
3452
index 0000000..3468b29
3454
+++ sw/source/ui/vba/vbacells.hxx
3456
+/*************************************************************************
3458
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3460
+ * Copyright 2008 by Sun Microsystems, Inc.
3462
+ * OpenOffice.org - a multi-platform office productivity suite
3467
+ * This file is part of OpenOffice.org.
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.
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).
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.
3484
+ ************************************************************************/
3485
+#ifndef SW_VBA_CELLS_HXX
3486
+#define SW_VBA_CELLS_HXX
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>
3493
+typedef CollTestImplHelper< ooo::vba::word::XCells > SwVbaCells_BASE;
3495
+class SwVbaCells : public SwVbaCells_BASE
3498
+ css::uno::Reference< css::text::XTextTable > mxTextTable;
3501
+ sal_Int32 mnRight;
3502
+ sal_Int32 mnBottom;
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() {}
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);
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);
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);
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();
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
3535
+++ sw/source/ui/vba/vbacheckbox.cxx
3537
+/*************************************************************************
3539
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3541
+ * Copyright 2008 by Sun Microsystems, Inc.
3543
+ * OpenOffice.org - a multi-platform office productivity suite
3548
+ * This file is part of OpenOffice.org.
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.
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).
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.
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>
3575
+using namespace ::ooo::vba;
3576
+using namespace ::com::sun::star;
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 )
3580
+ rtl::OUString sType = mxFormField->getFieldType();
3581
+ if( !sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX ) )
3583
+ throw uno::RuntimeException( rtl::OUString(
3584
+ RTL_CONSTASCII_USTRINGPARAM("It is not a CheckBox")), uno::Reference< uno::XInterface >() );
3588
+SwVbaCheckBox::~SwVbaCheckBox()
3592
+sal_Bool SAL_CALL SwVbaCheckBox::getValue() throw ( uno::RuntimeException )
3594
+ sal_Bool bValue = sal_False;
3595
+ sal_Int32 nCount = mxFormField->getParamCount();
3596
+ for( sal_Int32 i = 0; i < nCount; i++ )
3598
+ if( mxFormField->getParamName(i).equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX_CHECKED ) )
3600
+ if( mxFormField->getParamValue(i).equalsIgnoreAsciiCaseAscii("on") )
3601
+ bValue = sal_True;
3603
+ bValue = sal_False;
3610
+void SAL_CALL SwVbaCheckBox::setValue( sal_Bool value ) throw ( uno::RuntimeException )
3612
+ rtl::OUString sValue = rtl::OUString::createFromAscii( value ? "on" : "off" );
3613
+ mxFormField->addParam( rtl::OUString::createFromAscii( ECMA_FORMCHECKBOX_CHECKED ), sValue, sal_True );
3617
+SwVbaCheckBox::getServiceImplName()
3619
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaCheckBox") );
3623
+uno::Sequence< rtl::OUString >
3624
+SwVbaCheckBox::getServiceNames()
3626
+ static uno::Sequence< rtl::OUString > aServiceNames;
3627
+ if ( aServiceNames.getLength() == 0 )
3629
+ aServiceNames.realloc( 1 );
3630
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.CheckBox" ) );
3632
+ return aServiceNames;
3635
diff --git sw/source/ui/vba/vbacheckbox.hxx sw/source/ui/vba/vbacheckbox.hxx
3636
new file mode 100644
3637
index 0000000..7b12ed5
3639
+++ sw/source/ui/vba/vbacheckbox.hxx
3641
+/*************************************************************************
3643
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3645
+ * Copyright 2008 by Sun Microsystems, Inc.
3647
+ * OpenOffice.org - a multi-platform office productivity suite
3652
+ * This file is part of OpenOffice.org.
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.
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).
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.
3669
+ ************************************************************************/
3670
+#ifndef SW_VBA_CHECKBOX_HXX
3671
+#define SW_VBA_CHECKBOX_HXX
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>
3678
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XCheckBox > SwVbaCheckBox_BASE;
3680
+class SwVbaCheckBox : public SwVbaCheckBox_BASE
3683
+ css::uno::Reference< css::frame::XModel > mxModel;
3684
+ css::uno::Reference< css::text::XFormField > mxFormField;
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();
3691
+ sal_Bool SAL_CALL getValue() throw ( css::uno::RuntimeException );
3692
+ void SAL_CALL setValue( sal_Bool value ) throw ( css::uno::RuntimeException );
3694
+ // XHelperInterface
3695
+ virtual rtl::OUString& getServiceImplName();
3696
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
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
3703
+++ sw/source/ui/vba/vbacolumn.cxx
3705
+/*************************************************************************
3707
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3709
+ * Copyright 2008 by Sun Microsystems, Inc.
3711
+ * OpenOffice.org - a multi-platform office productivity suite
3716
+ * This file is part of OpenOffice.org.
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.
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).
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.
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"
3744
+#define RELATIVE_TABLE_WIDTH 10000
3746
+using namespace ::ooo::vba;
3747
+using namespace ::com::sun::star;
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 )
3752
+ mxTableColumns = mxTextTable->getColumns();
3755
+SwVbaColumn::~SwVbaColumn()
3759
+void SwVbaColumn::calculateAbsoluteColumnWidth( sal_Int32 nTableWidth, const css::uno::Sequence< css::text::TableColumnSeparator >& aSeparators, double* pAbsWidth )
3761
+ const text::TableColumnSeparator* pArray = aSeparators.getConstArray();
3762
+ sal_Int32 nSepCount = aSeparators.getLength();
3763
+ for( sal_Int32 i = 0; i <= nSepCount; i++ )
3765
+ sal_Int32 nRelColWidth = 0;
3768
+ if( nSepCount != 0 )
3770
+ nRelColWidth = pArray[0].Position;
3774
+ nRelColWidth = RELATIVE_TABLE_WIDTH;
3779
+ if( i == nSepCount )
3781
+ nRelColWidth = RELATIVE_TABLE_WIDTH - pArray[i-1].Position;
3785
+ nRelColWidth = pArray[i].Position - pArray[i-1].Position;
3788
+ pAbsWidth[i] = ( (double)nRelColWidth / RELATIVE_TABLE_WIDTH ) * (double) nTableWidth;
3792
+void SwVbaColumn::calculateRelativeColumnWidth( const double* pAbsWidth, double* pRelWidth, sal_Int32 nCount )
3794
+ double tableWidth = 0.0;
3795
+ for( sal_Int32 i = 0; i < nCount; i++ )
3797
+ tableWidth += pAbsWidth[i];
3800
+ pRelWidth[ nCount - 1 ] = tableWidth;
3801
+ for( sal_Int32 i = 0; i < nCount - 1; i++ )
3805
+ pRelWidth[i] = ( pAbsWidth[i] * RELATIVE_TABLE_WIDTH ) / tableWidth;
3809
+ pRelWidth[i] = pRelWidth[i-1] + ( pAbsWidth[i] * RELATIVE_TABLE_WIDTH ) / tableWidth;
3815
+SwVbaColumn::getWidth( ) throw ( css::uno::RuntimeException )
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 ] ) );
3826
+ SwVbaTableHelper aTableHelper( mxTextTable );
3827
+ return aTableHelper.GetColWidth( mnIndex );
3831
+SwVbaColumn::setWidth( sal_Int32 _width ) throw ( css::uno::RuntimeException )
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++ )
3844
+ tableWidth += dAbsColWidth[i];
3847
+ double dRelColWidth[ nColCont ];
3848
+ calculateRelativeColumnWidth( dAbsColWidth, dRelColWidth, nColCont);
3850
+ text::TableColumnSeparator* pArray = aSeparators.getArray();
3851
+ for( sal_Int32 i = 0; i < nColCont - 1; i++ )
3853
+ pArray[i].Position = (sal_Int16)(dRelColWidth[i]);
3856
+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TableColumnSeparators") ), uno::makeAny( aSeparators ) );
3857
+ SwVbaTable::setTableWidth( xTableProps, (sal_Int32)( tableWidth ) );
3860
+ SwVbaTableHelper aTableHelper( mxTextTable );
3861
+ aTableHelper.SetColWidth( _width, mnIndex );
3865
+SwVbaColumn::Select( ) throw ( uno::RuntimeException )
3867
+ SelectColumn( getCurrentWordDoc(mxContext), mxTextTable, mnIndex, mnIndex );
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 )
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 ) );
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 );
3883
+ uno::Reference< view::XSelectionSupplier > xSelection( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
3884
+ xSelection->select( uno::makeAny( xSelRange ) );
3888
+SwVbaColumn::getServiceImplName()
3890
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaColumn") );
3894
+uno::Sequence< rtl::OUString >
3895
+SwVbaColumn::getServiceNames()
3897
+ static uno::Sequence< rtl::OUString > aServiceNames;
3898
+ if ( aServiceNames.getLength() == 0 )
3900
+ aServiceNames.realloc( 1 );
3901
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Column" ) );
3903
+ return aServiceNames;
3906
diff --git sw/source/ui/vba/vbacolumn.hxx sw/source/ui/vba/vbacolumn.hxx
3907
new file mode 100644
3908
index 0000000..6d67bdd
3910
+++ sw/source/ui/vba/vbacolumn.hxx
3912
+/*************************************************************************
3914
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3916
+ * Copyright 2008 by Sun Microsystems, Inc.
3918
+ * OpenOffice.org - a multi-platform office productivity suite
3923
+ * This file is part of OpenOffice.org.
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.
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).
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.
3940
+ ************************************************************************/
3941
+#ifndef SW_VBA_COLUMN_HXX
3942
+#define SW_VBA_COLUMN_HXX
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>
3951
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XColumn > SwVbaColumn_BASE;
3953
+class SwVbaColumn : public SwVbaColumn_BASE
3956
+ css::uno::Reference< css::text::XTextTable > mxTextTable;
3957
+ css::uno::Reference< css::table::XTableColumns > mxTableColumns;
3958
+ sal_Int32 mnIndex;
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 );
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();
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);
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);
3975
+ // XHelperInterface
3976
+ virtual rtl::OUString& getServiceImplName();
3977
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
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
3984
+++ sw/source/ui/vba/vbacolumns.cxx
3986
+/*************************************************************************
3988
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3990
+ * Copyright 2008 by Sun Microsystems, Inc.
3992
+ * OpenOffice.org - a multi-platform office productivity suite
3997
+ * This file is part of OpenOffice.org.
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.
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).
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.
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"
4024
+using namespace ::ooo::vba;
4025
+using namespace ::com::sun::star;
4027
+class ColumnsEnumWrapper : public EnumerationHelper_BASE
4029
+ uno::Reference< text::XTextTable > mxTextTable;
4030
+ uno::Reference< container::XIndexAccess > mxIndexAccess;
4031
+ uno::WeakReference< XHelperInterface > mxParent;
4032
+ uno::Reference< uno::XComponentContext > mxContext;
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 )
4038
+ mxIndexAccess.set( mxTextTable->getColumns(), uno::UNO_QUERY );
4040
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
4042
+ return ( nIndex < mxIndexAccess->getCount() );
4045
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
4047
+ if( nIndex < mxIndexAccess->getCount() )
4049
+ return uno::makeAny( uno::Reference< word::XColumn > ( new SwVbaColumn( mxParent, mxContext, mxTextTable, nIndex++ ) ) );
4051
+ throw container::NoSuchElementException();
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 )
4057
+ mnStartColumnIndex = 0;
4058
+ SwVbaTableHelper aTableHelper( mxTextTable );
4059
+ mnEndColumnIndex = aTableHelper.getTabColumnsMaxCount( ) - 1;
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 )
4064
+ if( mnEndColumnIndex < mnStartColumnIndex )
4065
+ throw uno::RuntimeException();
4068
+uno::Reference< word::XColumn > SwVbaColumns::getColumnAtIndex( sal_Int32 index ) throw (uno::RuntimeException)
4070
+ return uno::Reference< word::XColumn >( new SwVbaColumn( this, mxContext, mxTextTable, index ) );
4073
+::sal_Int32 SAL_CALL SwVbaColumns::getWidth() throw (uno::RuntimeException)
4075
+ return getColumnAtIndex( mnStartColumnIndex )->getWidth();
4078
+void SAL_CALL SwVbaColumns::setWidth( ::sal_Int32 _width ) throw (uno::RuntimeException)
4080
+ for( sal_Int32 index = mnStartColumnIndex; index <= mnEndColumnIndex; index++ )
4082
+ getColumnAtIndex( index )->setWidth( _width );
4086
+void SAL_CALL SwVbaColumns::Select( ) throw (uno::RuntimeException)
4088
+ SwVbaColumn::SelectColumn( getCurrentWordDoc(mxContext), mxTextTable, mnStartColumnIndex, mnEndColumnIndex );
4091
+::sal_Int32 SAL_CALL SwVbaColumns::getCount() throw (uno::RuntimeException)
4093
+ return ( mnEndColumnIndex - mnStartColumnIndex + 1 );
4096
+uno::Any SAL_CALL SwVbaColumns::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
4098
+ sal_Int32 nIndex = 0;
4099
+ if( ( Index1 >>= nIndex ) == sal_True )
4101
+ if( nIndex <= 0 || nIndex > getCount() )
4103
+ throw lang::IndexOutOfBoundsException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
4105
+ return uno::makeAny( uno::Reference< word::XColumn >( new SwVbaColumn( this, mxContext, mxTextTable, nIndex - 1 ) ) );
4107
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
4110
+// XEnumerationAccess
4112
+SwVbaColumns::getElementType() throw (uno::RuntimeException)
4114
+ return word::XColumn::static_type(0);
4116
+uno::Reference< container::XEnumeration >
4117
+SwVbaColumns::createEnumeration() throw (uno::RuntimeException)
4119
+ return new ColumnsEnumWrapper( this, mxContext, mxTextTable );
4123
+SwVbaColumns::createCollectionObject( const uno::Any& aSource )
4129
+SwVbaColumns::getServiceImplName()
4131
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaColumns") );
4135
+uno::Sequence<rtl::OUString>
4136
+SwVbaColumns::getServiceNames()
4138
+ static uno::Sequence< rtl::OUString > sNames;
4139
+ if ( sNames.getLength() == 0 )
4141
+ sNames.realloc( 1 );
4142
+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Columns") );
4146
diff --git sw/source/ui/vba/vbacolumns.hxx sw/source/ui/vba/vbacolumns.hxx
4147
new file mode 100644
4148
index 0000000..3fd2b4a
4150
+++ sw/source/ui/vba/vbacolumns.hxx
4152
+/*************************************************************************
4154
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4156
+ * Copyright 2008 by Sun Microsystems, Inc.
4158
+ * OpenOffice.org - a multi-platform office productivity suite
4163
+ * This file is part of OpenOffice.org.
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.
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).
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.
4180
+ ************************************************************************/
4181
+#ifndef SW_VBA_COLUMNS_HXX
4182
+#define SW_VBA_COLUMNS_HXX
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>
4191
+typedef CollTestImplHelper< ooo::vba::word::XColumns > SwVbaColumns_BASE;
4193
+class SwVbaColumns : public SwVbaColumns_BASE
4196
+ css::uno::Reference< css::text::XTextTable > mxTextTable;
4197
+ css::uno::Reference< css::table::XTableColumns > mxTableColumns;
4198
+ sal_Int32 mnStartColumnIndex;
4199
+ sal_Int32 mnEndColumnIndex;
4202
+ css::uno::Reference< ooo::vba::word::XColumn > getColumnAtIndex( sal_Int32 index ) throw (css::uno::RuntimeException);
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() {}
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);
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);
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();
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
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>
4239
#include <vbahelper/helperdecl.hxx>
4240
#include <wordvbahelper.hxx>
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>
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)
4259
+SwVbaDocument::TablesOfContents( const uno::Any& index ) throw (uno::RuntimeException)
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 );
4268
+SwVbaDocument::FormFields( const uno::Any& index ) throw (uno::RuntimeException)
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 );
4277
SwVbaDocument::PageSetup( ) throw (uno::RuntimeException)
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();
4287
- xTemplate = new SwVbaTemplate( this, mxContext, getModel(), sTemplateName );
4288
+ xTemplate = new SwVbaTemplate( this, mxContext, getModel(), sTemplateUrl );
4289
return uno::makeAny( xTemplate );
4293
-SwVbaDocument::setAttachedTemplate( const css::uno::Any& /*_attachedtemplate*/ ) throw (uno::RuntimeException)
4294
+SwVbaDocument::setAttachedTemplate( const css::uno::Any& _attachedtemplate ) throw (uno::RuntimeException)
4296
- throw uno::RuntimeException();
4297
+ rtl::OUString sTemplate;
4298
+ if( !( _attachedtemplate >>= sTemplate ) )
4300
+ throw uno::RuntimeException();
4302
+ rtl::OUString aURL;
4303
+ INetURLObject aObj;
4304
+ aObj.SetURL( sTemplate );
4305
+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
4309
+ osl::FileBase::getFileURLFromSystemPath( sTemplate, aURL );
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 );
4320
@@ -270,6 +315,116 @@ void SAL_CALL SwVbaDocument::Activate() throw (uno::RuntimeException)
4321
VbaDocumentBase::Activate();
4324
+::sal_Int32 SAL_CALL SwVbaDocument::getProtectionType() throw (css::uno::RuntimeException)
4327
+ return word::WdProtectionType::wdNoProtection;
4330
+void SAL_CALL SwVbaDocument::setProtectionType( ::sal_Int32 _protectiontype ) throw (css::uno::RuntimeException)
4335
+::sal_Bool SAL_CALL SwVbaDocument::getUpdateStylesOnOpen() throw (css::uno::RuntimeException)
4341
+void SAL_CALL SwVbaDocument::setUpdateStylesOnOpen( ::sal_Bool _updatestylesonopen ) throw (uno::RuntimeException)
4346
+::sal_Bool SAL_CALL SwVbaDocument::getAutoHyphenation() throw (uno::RuntimeException)
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;
4355
+void SAL_CALL SwVbaDocument::setAutoHyphenation( ::sal_Bool _autohyphenation ) throw (uno::RuntimeException)
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 ) );
4362
+::sal_Int32 SAL_CALL SwVbaDocument::getHyphenationZone() throw (uno::RuntimeException)
4368
+void SAL_CALL SwVbaDocument::setHyphenationZone( ::sal_Int32 _hyphenationzone ) throw (uno::RuntimeException)
4373
+::sal_Int32 SAL_CALL SwVbaDocument::getConsecutiveHyphensLimit() throw (uno::RuntimeException)
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;
4382
+void SAL_CALL SwVbaDocument::setConsecutiveHyphensLimit( ::sal_Int32 _consecutivehyphenslimit ) throw (uno::RuntimeException)
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 ) );
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)
4391
+ // Seems not support in Writer
4392
+ // VbaDocumentBase::Protect( Password );
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)
4400
+void SAL_CALL SwVbaDocument::PrintPreview( ) throw (uno::RuntimeException)
4402
+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PrintPreview"));
4403
+ dispatchRequests( mxModel,url );
4406
+void SAL_CALL SwVbaDocument::ClosePrintPreview( ) throw (uno::RuntimeException)
4408
+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ClosePreview"));
4409
+ dispatchRequests( mxModel,url );
4413
+SwVbaDocument::Revisions( const uno::Any& index ) throw (uno::RuntimeException)
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 );
4424
+SwVbaDocument::Frames( const uno::Any& index ) throw (uno::RuntimeException)
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 );
4435
SwVbaDocument::getControlShape( const ::rtl::OUString& sName )
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);
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:
4473
static DocPropInfo createDocPropInfo( const rtl::OUString& sDesc, const rtl::OUString& sPropName, boost::shared_ptr< PropertGetSetHelper >& rHelper )
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;
4483
static DocPropInfo createDocPropInfo( const sal_Char* sDesc, const sal_Char* sPropName, boost::shared_ptr< PropertGetSetHelper >& rHelper )
4485
- DocPropInfo aItem;
4486
- aItem.msMSODesc = rtl::OUString::createFromAscii( sDesc );
4487
- aItem.msOOOPropName = rtl::OUString::createFromAscii( sPropName );
4488
- aItem.mpPropGetSetHelper = rHelper;
4490
+ return createDocPropInfo( rtl::OUString::createFromAscii( sDesc ), rtl::OUString::createFromAscii( sPropName ), rHelper );
4494
diff --git sw/source/ui/vba/vbaeventshelper.cxx sw/source/ui/vba/vbaeventshelper.cxx
4495
new file mode 100644
4496
index 0000000..384a81f
4498
+++ sw/source/ui/vba/vbaeventshelper.cxx
4500
+/*************************************************************************
4502
+ * OpenOffice.org - a multi-platform office productivity suite
4504
+ * $RCSfile: vbaeventshelper.cxx,v $
4506
+ * $Revision: 1.0 $
4508
+ * last change: $Author: vg $ $Date: 2007/12/07 10:42:26 $
4510
+ * The Contents of this file are made available subject to
4511
+ * the terms of GNU Lesser General Public License Version 2.1.
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
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.
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.
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
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"
4542
+using namespace com::sun::star;
4543
+using namespace ooo::vba;
4544
+using namespace com::sun::star::document::VbaEventId;
4546
+const static String sThisDocument( RTL_CONSTASCII_USTRINGPARAM("ThisDocument"));
4548
+SwVbaEventsHelper::SwVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArgs, uno::Reference< uno::XComponentContext > const& xContext ) : VbaEventsHelperBase( xContext )
4551
+ uno::Reference< frame::XModel > xModel ( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ), uno::UNO_QUERY );
4552
+ pDocShell = word::getDocShell( xModel );
4555
+SwVbaEventsHelper::~SwVbaEventsHelper()
4559
+void SwVbaEventsHelper::Initilize()
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") ) );
4569
+SwVbaEventsHelper::getMacroPath( const sal_Int32 nEventId )
4571
+ String sMacroName = getEventName( nEventId );
4572
+ VBAMacroResolvedInfo sMacroResolvedInfo;
4573
+ switch( nEventId )
4575
+ // Document events
4576
+ case VBAEVENT_DOCUMENT_NEW:
4577
+ case VBAEVENT_DOCUMENT_OPEN:
4578
+ case VBAEVENT_DOCUMENT_CLOSE:
4580
+ sMacroName.Insert( '.', 0 ).Insert( sThisDocument, 0);
4581
+ sMacroResolvedInfo = resolveVBAMacro( pDocShell, sMacroName );
4584
+ case VBAEVENT_DOCUMENT_AUTONEW:
4585
+ case VBAEVENT_DOCUMENT_AUTOOPEN:
4587
+ sMacroResolvedInfo = resolveVBAMacro( pDocShell, sMacroName );
4593
+ return sMacroResolvedInfo.ResolvedMacro();
4596
+sal_Bool SwVbaEventsHelper::processVbaEvent( const sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs )
4598
+ sal_Bool result = sal_False;
4599
+ uno::Sequence< uno::Any > aArgs;
4601
+ uno::Any aDummyCaller;
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() )
4608
+ // excute the macro
4609
+ result = executeMacro( pDocShell, sMacroPath, aArgs, aRet, aDummyCaller );
4616
+SwVbaEventsHelper::ProcessCompatibleVbaEvent( sal_Int32 nEventId, const uno::Sequence< uno::Any >& aArgs ) throw (uno::RuntimeException)
4618
+ if( !pDocShell || mbIgnoreEvents)
4621
+ // In order to better support "withevents" in the future,
4622
+ // it is better to process a event at a time
4623
+ switch( nEventId )
4625
+ case VBAEVENT_DOCUMENT_NEW:
4627
+ processVbaEvent( VBAEVENT_DOCUMENT_AUTONEW, aArgs );
4628
+ processVbaEvent( nEventId, aArgs );
4631
+ case VBAEVENT_DOCUMENT_OPEN:
4633
+ processVbaEvent( VBAEVENT_DOCUMENT_AUTOOPEN, aArgs );
4634
+ processVbaEvent( nEventId, aArgs );
4637
+ case VBAEVENT_DOCUMENT_CLOSE:
4639
+ return processVbaEvent( nEventId, aArgs );
4642
+ OSL_TRACE( "Invalid Event" );
4648
+::sal_Bool SAL_CALL
4649
+SwVbaEventsHelper::getIgnoreEvents() throw (uno::RuntimeException)
4651
+ return VbaEventsHelperBase::getIgnoreEvents();
4655
+SwVbaEventsHelper::setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (uno::RuntimeException)
4657
+ VbaEventsHelperBase::setIgnoreEvents( _ignoreevents );
4660
+namespace vbaeventshelper
4662
+namespace sdecl = comphelper::service_decl;
4663
+sdecl::class_<SwVbaEventsHelper, sdecl::with_args<true> > serviceImpl;
4664
+extern sdecl::ServiceDecl const serviceDecl(
4666
+ "SwVbaEventsHelper",
4667
+ "com.sun.star.text.TextDocumentVbaEventsHelper" );
4669
diff --git sw/source/ui/vba/vbaeventshelper.hxx sw/source/ui/vba/vbaeventshelper.hxx
4670
new file mode 100644
4671
index 0000000..02dd648
4673
+++ sw/source/ui/vba/vbaeventshelper.hxx
4675
+/*************************************************************************
4677
+ * OpenOffice.org - a multi-platform office productivity suite
4679
+ * $RCSfile: vbaeventshelper.hxx,v $
4681
+ * $Revision: 1.0 $
4683
+ * last change: $Author: vg $ $Date: 2007/12/07 10:42:26 $
4685
+ * The Contents of this file are made available subject to
4686
+ * the terms of GNU Lesser General Public License Version 2.1.
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
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.
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.
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
4708
+ ************************************************************************/
4710
+#ifndef SW_VBAEVENTS_HXX
4711
+#define SW_VBAEVENTS_HXX
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>
4718
+#include <docsh.hxx>
4720
+typedef ::cppu::WeakImplHelper1< com::sun::star::document::XVbaEventsHelper > VBADocumentEvent_BASE;
4722
+class SwVbaEventsHelper : public VBADocumentEvent_BASE, public VbaEventsHelperBase
4725
+ SwDocShell* pDocShell;
4727
+ rtl::OUString getMacroPath( const sal_Int32 nEventId );
4728
+ sal_Bool processVbaEvent( const sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs );
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);
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
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>
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 );
4758
+sal_Bool SAL_CALL SwVbaField::Update() throw (uno::RuntimeException)
4760
+ uno::Reference< util::XUpdatable > xUpdatable( mxTextField, uno::UNO_QUERY );
4761
+ if( xUpdatable.is() )
4763
+ xUpdatable->update();
4771
SwVbaField::getServiceImplName()
4772
@@ -371,6 +383,7 @@ SwVbaFields::Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range,
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() );
4779
uno::Reference< text::XTextContent > xTextField;
4780
@@ -378,6 +391,10 @@ SwVbaFields::Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range,
4782
xTextField.set( Create_Field_FileName( sText ), uno::UNO_QUERY_THROW );
4784
+ else if( nType == word::WdFieldType::wdFieldDocProperty || sFieldName.EqualsIgnoreCaseAscii("DOCPROPERTY") )
4786
+ xTextField.set( Create_Field_DocProperty( sText ), uno::UNO_QUERY_THROW );
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
4795
+struct DocPropertyTable
4797
+ const char* sDocPropertyName;
4798
+ const char* sFieldService;
4801
+static const DocPropertyTable aDocPropertyTables[] =
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" },
4832
+uno::Reference< text::XTextField > SwVbaFields::Create_Field_DocProperty( const rtl::OUString _text ) throw (uno::RuntimeException)
4834
+ String aDocProperty;
4835
+ _ReadFieldParams aReadParam( _text );
4837
+ while( -1 != ( nRet = aReadParam.SkipToNextToken() ))
4842
+ if( !aDocProperty.Len() )
4843
+ aDocProperty = aReadParam.GetResult();
4846
+ //Skip over MERGEFORMAT
4847
+ aReadParam.SkipToNextToken();
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 )
4855
+ throw uno::RuntimeException();
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++ )
4863
+ if( aDocProperty.EqualsIgnoreCaseAscii( pTable->sDocPropertyName ) )
4865
+ if( pTable->sFieldService != NULL )
4866
+ sFieldService = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( pTable->sFieldService ) );
4867
+ bCustom = sal_False;
4874
+ sFieldService = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.textfield.docinfo.Custom" ) );
4876
+ else if( sFieldService.getLength() == 0 )
4878
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
4881
+ uno::Reference< text::XTextField > xTextField( mxMSF->createInstance( sFieldService ), uno::UNO_QUERY_THROW );
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 ) );
4890
+ return xTextField;
4893
uno::Reference< container::XEnumeration > SAL_CALL
4894
SwVbaFields::createEnumeration() throw (uno::RuntimeException)
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;
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);
4906
+ virtual sal_Bool SAL_CALL Update() throw ( css::uno::RuntimeException);
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;
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);
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
4922
+++ sw/source/ui/vba/vbaformfield.cxx
4924
+/*************************************************************************
4926
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4928
+ * Copyright 2008 by Sun Microsystems, Inc.
4930
+ * OpenOffice.org - a multi-platform office productivity suite
4935
+ * This file is part of OpenOffice.org.
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.
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).
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.
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"
4963
+using namespace ::ooo::vba;
4964
+using namespace ::com::sun::star;
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 )
4970
+SwVbaFormField::~SwVbaFormField()
4974
+rtl::OUString SAL_CALL SwVbaFormField::getResult() throw ( uno::RuntimeException )
4976
+ rtl::OUString sResult;
4977
+ rtl::OUString sType = mxFormField->getFieldType();
4978
+ if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMTEXT ) )
4980
+ uno::Reference< text::XTextContent > xTextContent( mxFormField, uno::UNO_QUERY_THROW );
4981
+ uno::Reference< text::XTextRange > xTextRange = xTextContent->getAnchor();
4982
+ sResult = xTextRange->getString();
4984
+ else if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX ) )
4986
+ sal_Int32 nValue = 0;
4987
+ sal_Int32 nCount = mxFormField->getParamCount();
4988
+ for( sal_Int32 i = 0; i < nCount; i++ )
4990
+ if( mxFormField->getParamName(i).equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX_CHECKED ) )
4992
+ if( mxFormField->getParamValue(i).equalsIgnoreAsciiCaseAscii("on") )
5000
+ sResult = rtl::OUString::valueOf( nValue );
5004
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
5009
+void SAL_CALL SwVbaFormField::setResult( const rtl::OUString& result ) throw ( uno::RuntimeException )
5011
+ rtl::OUString sType = mxFormField->getFieldType();
5012
+ if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMTEXT ) )
5014
+ uno::Reference< text::XTextContent > xTextContent( mxFormField, uno::UNO_QUERY_THROW );
5015
+ uno::Reference< text::XTextRange > xTextRange = xTextContent->getAnchor();
5016
+ xTextRange->setString( result );
5018
+ else if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX ) )
5024
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
5028
+sal_Bool SAL_CALL SwVbaFormField::getEnabled() throw ( uno::RuntimeException )
5030
+ //allways return true
5034
+void SAL_CALL SwVbaFormField::setEnabled( sal_Bool/* enabled */ ) throw ( uno::RuntimeException )
5036
+ // not support in Writer
5039
+uno::Any SAL_CALL SwVbaFormField::CheckBox() throw ( uno::RuntimeException )
5041
+ return uno::makeAny( uno::Reference< word::XCheckBox >( new SwVbaCheckBox( this, mxContext, mxModel, mxFormField ) ) );
5045
+SwVbaFormField::getServiceImplName()
5047
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFormField") );
5051
+uno::Sequence< rtl::OUString >
5052
+SwVbaFormField::getServiceNames()
5054
+ static uno::Sequence< rtl::OUString > aServiceNames;
5055
+ if ( aServiceNames.getLength() == 0 )
5057
+ aServiceNames.realloc( 1 );
5058
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.FormField" ) );
5060
+ return aServiceNames;
5063
diff --git sw/source/ui/vba/vbaformfield.hxx sw/source/ui/vba/vbaformfield.hxx
5064
new file mode 100644
5065
index 0000000..e3a2d7f
5067
+++ sw/source/ui/vba/vbaformfield.hxx
5069
+/*************************************************************************
5071
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5073
+ * Copyright 2008 by Sun Microsystems, Inc.
5075
+ * OpenOffice.org - a multi-platform office productivity suite
5080
+ * This file is part of OpenOffice.org.
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.
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).
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.
5097
+ ************************************************************************/
5098
+#ifndef SW_VBA_FORMFIELD_HXX
5099
+#define SW_VBA_FORMFIELD_HXX
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>
5106
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XFormField > SwVbaFormField_BASE;
5108
+class SwVbaFormField : public SwVbaFormField_BASE
5111
+ css::uno::Reference< css::frame::XModel > mxModel;
5112
+ css::uno::Reference< css::text::XFormField > mxFormField;
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();
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 );
5125
+ // XHelperInterface
5126
+ virtual rtl::OUString& getServiceImplName();
5127
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
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
5134
+++ sw/source/ui/vba/vbaformfields.cxx
5136
+/*************************************************************************
5138
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5140
+ * Copyright 2008 by Sun Microsystems, Inc.
5142
+ * OpenOffice.org - a multi-platform office productivity suite
5147
+ * This file is part of OpenOffice.org.
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.
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).
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.
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>
5174
+using namespace ::ooo::vba;
5175
+using namespace ::com::sun::star;
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;
5181
+rtl::OUString lcl_getFormFieldName( const uno::Reference< text::XFormField >& xFormField )
5183
+ rtl::OUString sName;
5184
+ sal_Int32 nCount = xFormField->getParamCount();
5185
+ for( sal_Int32 i = 0; i < nCount; i++ )
5187
+ if( xFormField->getParamName(i).equalsIgnoreAsciiCaseAscii( "Name" ) )
5189
+ sName = xFormField->getParamValue(i);
5190
+ OSL_TRACE("lcl_getFormFieldName: %s", rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() );
5197
+class FormFieldsEnumeration : public FormFiledEnumeration_BASE
5200
+ uno::Reference< XHelperInterface > mxParent;
5201
+ uno::Reference< uno::XComponentContext > mxContext;
5202
+ uno::Reference< frame::XModel > mxModel;
5203
+ XFormFieldVec mxFormFields;
5204
+ XFormFieldVec::iterator cachePos;
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() )
5209
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
5211
+ return ( cachePos != mxFormFields.end() );
5214
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
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 ) ) );
5224
+class FormFieldCollectionHelper : public FormFieldCollectionHelper_BASE
5227
+ uno::Reference< XHelperInterface > mxParent;
5228
+ uno::Reference< uno::XComponentContext > mxContext;
5229
+ uno::Reference< frame::XModel > mxModel;
5230
+ XFormFieldVec mxFormFields;
5231
+ XFormFieldVec::iterator cachePos;
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 )
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++ )
5240
+ uno::Reference< text::XFormField > xFormField( xIndexAccess->getByIndex( i ), uno::UNO_QUERY );
5241
+ if( xFormField.is() )
5242
+ mxFormFields.push_back( xFormField );
5244
+ cachePos = mxFormFields.begin();
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 ; }
5250
+ virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
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 ) ) );
5257
+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
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 )
5265
+ uno::Reference< text::XFormField > xFormField( *cachePos, uno::UNO_QUERY_THROW );
5266
+ *pString = lcl_getFormFieldName( xFormField );
5270
+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
5272
+ cachePos = mxFormFields.begin();
5273
+ XFormFieldVec::iterator it_end = mxFormFields.end();
5274
+ for ( ; cachePos != it_end; ++cachePos )
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 )) )
5281
+ return ( cachePos != it_end );
5284
+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
5286
+ return mxFormFields.size();
5288
+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
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 ] ) ) );
5294
+ // XEnumerationAccess
5295
+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
5297
+ return new FormFieldsEnumeration( mxParent, mxContext, mxModel, mxFormFields );
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 )
5304
+// XEnumerationAccess
5306
+SwVbaFormFields::getElementType() throw (uno::RuntimeException)
5308
+ return word::XFormField::static_type(0);
5310
+uno::Reference< container::XEnumeration >
5311
+SwVbaFormFields::createEnumeration() throw (uno::RuntimeException)
5313
+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
5314
+ return xEnumAccess->createEnumeration();
5318
+SwVbaFormFields::createCollectionObject( const css::uno::Any& aSource )
5324
+SwVbaFormFields::getServiceImplName()
5326
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFormFields") );
5330
+css::uno::Sequence<rtl::OUString>
5331
+SwVbaFormFields::getServiceNames()
5333
+ static uno::Sequence< rtl::OUString > sNames;
5334
+ if ( sNames.getLength() == 0 )
5336
+ sNames.realloc( 1 );
5337
+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.FormFields") );
5341
diff --git sw/source/ui/vba/vbaformfields.hxx sw/source/ui/vba/vbaformfields.hxx
5342
new file mode 100644
5343
index 0000000..76ef6bb
5345
+++ sw/source/ui/vba/vbaformfields.hxx
5347
+/*************************************************************************
5349
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5351
+ * Copyright 2008 by Sun Microsystems, Inc.
5353
+ * OpenOffice.org - a multi-platform office productivity suite
5358
+ * This file is part of OpenOffice.org.
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.
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).
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.
5375
+ ************************************************************************/
5376
+#ifndef SW_VBA_FORMFIELDS_HXX
5377
+#define SW_VBA_FORMFIELDS_HXX
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>
5385
+typedef CollTestImplHelper< ooo::vba::word::XFormFields > SwVbaFormFields_BASE;
5387
+class SwVbaFormFields : public SwVbaFormFields_BASE
5390
+ css::uno::Reference< css::frame::XModel > mxModel;
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() {}
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);
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();
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
5411
+++ sw/source/ui/vba/vbaframe.cxx
5413
+/*************************************************************************
5415
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5417
+ * Copyright 2008 by Sun Microsystems, Inc.
5419
+ * OpenOffice.org - a multi-platform office productivity suite
5424
+ * This file is part of OpenOffice.org.
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.
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).
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.
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>
5451
+using namespace ::ooo::vba;
5452
+using namespace ::com::sun::star;
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 )
5459
+SwVbaFrame::~SwVbaFrame()
5463
+void SAL_CALL SwVbaFrame::Select() throw ( uno::RuntimeException )
5465
+ uno::Reference< view::XSelectionSupplier > xSelectSupp( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
5466
+ xSelectSupp->select( uno::makeAny( mxTextFrame ) );
5470
+SwVbaFrame::getServiceImplName()
5472
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFrame") );
5476
+uno::Sequence< rtl::OUString >
5477
+SwVbaFrame::getServiceNames()
5479
+ static uno::Sequence< rtl::OUString > aServiceNames;
5480
+ if ( aServiceNames.getLength() == 0 )
5482
+ aServiceNames.realloc( 1 );
5483
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Frame" ) );
5485
+ return aServiceNames;
5488
diff --git sw/source/ui/vba/vbaframe.hxx sw/source/ui/vba/vbaframe.hxx
5489
new file mode 100644
5490
index 0000000..a36ebf8
5492
+++ sw/source/ui/vba/vbaframe.hxx
5494
+/*************************************************************************
5496
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5498
+ * Copyright 2008 by Sun Microsystems, Inc.
5500
+ * OpenOffice.org - a multi-platform office productivity suite
5505
+ * This file is part of OpenOffice.org.
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.
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).
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.
5522
+ ************************************************************************/
5523
+#ifndef SW_VBA_FRAME_HXX
5524
+#define SW_VBA_FRAME_HXX
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>
5531
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XFrame > SwVbaFrame_BASE;
5533
+class SwVbaFrame : public SwVbaFrame_BASE
5536
+ css::uno::Reference< css::frame::XModel > mxModel;
5537
+ css::uno::Reference< css::text::XTextFrame > mxTextFrame;
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();
5544
+ virtual void SAL_CALL Select() throw ( css::uno::RuntimeException );
5546
+ // XHelperInterface
5547
+ virtual rtl::OUString& getServiceImplName();
5548
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
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
5555
+++ sw/source/ui/vba/vbaframes.cxx
5557
+/*************************************************************************
5559
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5561
+ * Copyright 2008 by Sun Microsystems, Inc.
5563
+ * OpenOffice.org - a multi-platform office productivity suite
5568
+ * This file is part of OpenOffice.org.
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.
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).
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.
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"
5593
+using namespace ::ooo::vba;
5594
+using namespace ::com::sun::star;
5596
+typedef ::cppu::WeakImplHelper1< container::XEnumeration > FramesEnumeration_Base;
5597
+class FramesEnumeration : public FramesEnumeration_Base
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;
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)
5609
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
5611
+ return ( nCurrentPos < mxIndexAccess->getCount() );
5614
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
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 ) ) );
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 )
5626
+ mxFramesSupplier.set( mxModel, uno::UNO_QUERY_THROW );
5628
+// XEnumerationAccess
5630
+SwVbaFrames::getElementType() throw (uno::RuntimeException)
5632
+ return word::XFrame::static_type(0);
5635
+uno::Reference< container::XEnumeration >
5636
+SwVbaFrames::createEnumeration() throw (uno::RuntimeException)
5638
+ return new FramesEnumeration( this, mxContext,m_xIndexAccess, mxModel );
5642
+SwVbaFrames::createCollectionObject( const css::uno::Any& aSource )
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 ) ) );
5649
+SwVbaFrames::getServiceImplName()
5651
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFrames") );
5655
+css::uno::Sequence<rtl::OUString>
5656
+SwVbaFrames::getServiceNames()
5658
+ static uno::Sequence< rtl::OUString > sNames;
5659
+ if ( sNames.getLength() == 0 )
5661
+ sNames.realloc( 1 );
5662
+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Frames") );
5666
diff --git sw/source/ui/vba/vbaframes.hxx sw/source/ui/vba/vbaframes.hxx
5667
new file mode 100644
5668
index 0000000..0957820
5670
+++ sw/source/ui/vba/vbaframes.hxx
5672
+/*************************************************************************
5674
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5676
+ * Copyright 2008 by Sun Microsystems, Inc.
5678
+ * OpenOffice.org - a multi-platform office productivity suite
5683
+ * This file is part of OpenOffice.org.
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.
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).
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.
5700
+ ************************************************************************/
5701
+#ifndef SW_VBA_FRAMES_HXX
5702
+#define SW_VBA_FRAMES_HXX
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>
5709
+typedef CollTestImplHelper< ooo::vba::word::XFrames > SwVbaFrames_BASE;
5711
+class SwVbaFrames : public SwVbaFrames_BASE
5714
+ css::uno::Reference< css::frame::XModel > mxModel;
5715
+ css::uno::Reference< css::text::XTextFramesSupplier > mxFramesSupplier;
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() {}
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);
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();
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 );
5742
+SwVbaGlobals::ListGalleries( const uno::Any& index ) throw (uno::RuntimeException)
5744
+ return getApplication()->ListGalleries( index );
5747
uno::Reference<word::XSelection > SAL_CALL
5748
SwVbaGlobals::getSelection() throw (uno::RuntimeException)
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
5768
SwVbaHeaderFooter::Shapes( const uno::Any& index ) throw (uno::RuntimeException)
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
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>
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;
5794
// Class HeaderFooterHelper
5795
+sal_Bool HeaderFooterHelper::isHeaderFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
5797
+ return isHeaderFooter( word::getCurrentXText( xModel ) );
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)
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 );
5806
- sal_Bool isOn = sal_False;
5807
- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isOn;
5810
+ uno::Reference< lang::XServiceInfo > xServiceInfo( xText, uno::UNO_QUERY_THROW );
5811
+ rtl::OUString aImplName = xServiceInfo->getImplementationName();
5812
+ if( aImplName.equalsAscii("SwXHeadFootText") )
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)
5821
+ const uno::Reference< text::XText > xCurrentText = word::getCurrentXText( xModel );
5822
+ if( !isHeaderFooter( xCurrentText ) )
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;
5833
+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
5834
if( 0 == xPageCursor->getPage() % 2 )
5836
aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextLeft") );
5840
aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextRight") );
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 );
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 );
5854
+ if( xTRC->compareRegionStarts( xTR1, xTR2 ) == 0 )
5857
+ catch( lang::IllegalArgumentException& )
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)
5868
- if( isHeader( xModel, xCurrentText ) )
5869
+ if( isHeader( xModel ) )
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
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)
5880
- if( isHeader( xModel, xCurrentText ) )
5881
+ if( isHeader( xModel ) )
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
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)
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 );
5895
- sal_Bool isOn = sal_False;
5896
- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isOn;
5898
+ const uno::Reference< text::XText > xCurrentText = word::getCurrentXText( xModel );
5899
+ if( !isHeaderFooter( xCurrentText ) )
5902
- sal_Bool isShared = sal_False;
5903
- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared;
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;
5913
+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
5914
if( 0 == xPageCursor->getPage() % 2 )
5916
aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextLeft") );
5920
aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextRight") );
5924
- uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
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 );
5933
+ if( xTRC->compareRegionStarts( xTR1, xTR2 ) == 0 )
5936
+ catch( lang::IllegalArgumentException& )
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)
5947
- if( isFooter( xModel, xCurrentText ) )
5948
+ if( isFooter( xModel ) )
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
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)
5959
- if( isFooter( xModel, xCurrentText ) )
5960
+ if( isFooter( xModel ) )
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
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)
5971
- if( isHeader( xModel, xCurrentText ) )
5972
+ if( isHeader( xModel ) )
5974
- return( !( isFirstPageHeader( xModel, xCurrentText ) && isEvenPagesHeader( xModel, xCurrentText ) ) );
5975
+ return( !( isFirstPageHeader( xModel ) && isEvenPagesHeader( xModel ) ) );
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)
5983
- if( isHeader( xModel, xCurrentText ) )
5984
+ if( isHeader( xModel ) )
5986
- return( !( isFirstPageFooter( xModel, xCurrentText ) && isEvenPagesFooter( xModel, xCurrentText ) ) );
5987
+ return( !( isFirstPageFooter( xModel ) && isEvenPagesFooter( xModel ) ) );
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
5996
class HeaderFooterHelper
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);
6020
diff --git sw/source/ui/vba/vbaheadersfooters.cxx sw/source/ui/vba/vbaheadersfooters.cxx
6021
new file mode 100644
6022
index 0000000..295314a
6024
+++ sw/source/ui/vba/vbaheadersfooters.cxx
6026
+/*************************************************************************
6028
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6030
+ * Copyright 2008 by Sun Microsystems, Inc.
6032
+ * OpenOffice.org - a multi-platform office productivity suite
6037
+ * This file is part of OpenOffice.org.
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.
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).
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.
6054
+ ************************************************************************/
6055
+#include "vbaheadersfooters.hxx"
6056
+#include "vbaheaderfooter.hxx"
6057
+#include <ooo/vba/word/WdHeaderFooterIndex.hpp>
6059
+using namespace ::ooo::vba;
6060
+using namespace ::com::sun::star;
6062
+// I assume there is only one headersfooters in Writer
6063
+typedef ::cppu::WeakImplHelper1<container::XIndexAccess > HeadersFootersIndexAccess_Base;
6064
+class HeadersFootersIndexAccess : public HeadersFootersIndexAccess_Base
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;
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(){}
6078
+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
6080
+ // first page, evenpages and primary page
6083
+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
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 ) ) );
6089
+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
6091
+ return word::XHeaderFooter::static_type(0);
6093
+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
6099
+class HeadersFootersEnumWrapper : public EnumerationHelper_BASE
6101
+ SwVbaHeadersFooters* pHeadersFooters;
6104
+ HeadersFootersEnumWrapper( SwVbaHeadersFooters* _pHeadersFooters ) : pHeadersFooters( _pHeadersFooters ), nIndex( 0 ) {}
6105
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
6107
+ return ( nIndex < pHeadersFooters->getCount() );
6110
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
6112
+ if ( nIndex < pHeadersFooters->getCount() )
6113
+ return pHeadersFooters->Item( uno::makeAny( ++nIndex ), uno::Any() );
6114
+ throw container::NoSuchElementException();
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 )
6122
+::sal_Int32 SAL_CALL SwVbaHeadersFooters::getCount() throw (uno::RuntimeException)
6124
+ // wdHeaderFooterFirstPage, wdHeaderFooterPrimary and wdHeaderFooterEvenPages
6128
+uno::Any SAL_CALL SwVbaHeadersFooters::Item( const uno::Any& Index1, const uno::Any& ) throw (uno::RuntimeException)
6130
+ sal_Int32 nIndex = 0;
6131
+ Index1 >>= nIndex;
6132
+ if( ( nIndex < 1 ) || ( nIndex > 3 ) )
6134
+ throw container::NoSuchElementException();
6136
+ return uno::makeAny( uno::Reference< word::XHeaderFooter >( new SwVbaHeaderFooter( this, mxContext, mxModel, mxPageStyleProps, mbHeader, nIndex ) ) );
6139
+// XEnumerationAccess
6141
+SwVbaHeadersFooters::getElementType() throw (uno::RuntimeException)
6143
+ return word::XHeaderFooter::static_type(0);
6145
+uno::Reference< container::XEnumeration >
6147
+SwVbaHeadersFooters::createEnumeration() throw (uno::RuntimeException)
6149
+ return new HeadersFootersEnumWrapper( this );
6153
+SwVbaHeadersFooters::createCollectionObject( const uno::Any& aSource )
6159
+SwVbaHeadersFooters::getServiceImplName()
6161
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaHeadersFooters") );
6165
+uno::Sequence<rtl::OUString>
6166
+SwVbaHeadersFooters::getServiceNames()
6168
+ static uno::Sequence< rtl::OUString > sNames;
6169
+ if ( sNames.getLength() == 0 )
6171
+ sNames.realloc( 1 );
6172
+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.HeadersFooters") );
6176
diff --git sw/source/ui/vba/vbaheadersfooters.hxx sw/source/ui/vba/vbaheadersfooters.hxx
6177
new file mode 100644
6178
index 0000000..9bd7683
6180
+++ sw/source/ui/vba/vbaheadersfooters.hxx
6182
+/*************************************************************************
6184
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6186
+ * Copyright 2008 by Sun Microsystems, Inc.
6188
+ * OpenOffice.org - a multi-platform office productivity suite
6193
+ * This file is part of OpenOffice.org.
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.
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).
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.
6210
+ ************************************************************************/
6211
+#ifndef SW_VBA_HEADERSFOOTERS_HXX
6212
+#define SW_VBA_HEADERSFOOTERS_HXX
6214
+#include <vbahelper/vbacollectionimpl.hxx>
6215
+#include <ooo/vba/word/XHeadersFooters.hpp>
6216
+#include <vbahelper/vbahelperinterface.hxx>
6218
+typedef CollTestImplHelper< ooo::vba::word::XHeadersFooters > SwVbaHeadersFooters_BASE;
6220
+class SwVbaHeadersFooters : public SwVbaHeadersFooters_BASE
6223
+ css::uno::Reference< css::frame::XModel > mxModel;
6224
+ css::uno::Reference< css::beans::XPropertySet > mxPageStyleProps;
6225
+ sal_Bool mbHeader;
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() {}
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);
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();
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
6248
+++ sw/source/ui/vba/vbalistformat.cxx
6250
+/*************************************************************************
6252
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6254
+ * Copyright 2008 by Sun Microsystems, Inc.
6256
+ * OpenOffice.org - a multi-platform office productivity suite
6261
+ * This file is part of OpenOffice.org.
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.
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).
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.
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"
6289
+using namespace ::ooo::vba;
6290
+using namespace ::com::sun::star;
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 )
6296
+SwVbaListFormat::~SwVbaListFormat()
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)
6302
+ sal_Bool bContinuePreviousList = sal_True;
6303
+ if( ContinuePreviousList.hasValue() )
6304
+ ContinuePreviousList >>= bContinuePreviousList;
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();
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();
6320
+ SwVbaListTemplate* pListTemplate = dynamic_cast< SwVbaListTemplate* >( ListTemplate.get() );
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() )
6327
+ uno::Reference< beans::XPropertySet > xProps( xEnum->nextElement(), uno::UNO_QUERY_THROW );
6328
+ if( isFirstElement )
6330
+ sal_Bool isNumberingRestart = !bContinuePreviousList;
6331
+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsNumberingRestart") ), uno::makeAny( isNumberingRestart ) );
6332
+ if( isNumberingRestart )
6334
+ sal_Int16 nStartValue = 1;
6335
+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStartValue") ), uno::makeAny( nStartValue ) );
6337
+ isFirstElement = sal_False;
6341
+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsNumberingRestart") ), uno::makeAny( sal_False ) );
6343
+ pListTemplate->applyListTemplate( xProps );
6347
+void SAL_CALL SwVbaListFormat::ConvertNumbersToText( ) throw (css::uno::RuntimeException)
6349
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
6353
+SwVbaListFormat::getServiceImplName()
6355
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListFormat") );
6359
+uno::Sequence< rtl::OUString >
6360
+SwVbaListFormat::getServiceNames()
6362
+ static uno::Sequence< rtl::OUString > aServiceNames;
6363
+ if ( aServiceNames.getLength() == 0 )
6365
+ aServiceNames.realloc( 1 );
6366
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListFormat" ) );
6368
+ return aServiceNames;
6371
diff --git sw/source/ui/vba/vbalistformat.hxx sw/source/ui/vba/vbalistformat.hxx
6372
new file mode 100644
6373
index 0000000..184312a
6375
+++ sw/source/ui/vba/vbalistformat.hxx
6377
+/*************************************************************************
6379
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6381
+ * Copyright 2008 by Sun Microsystems, Inc.
6383
+ * OpenOffice.org - a multi-platform office productivity suite
6388
+ * This file is part of OpenOffice.org.
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.
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).
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.
6405
+ ************************************************************************/
6406
+#ifndef SW_VBA_LISTFORMAT_HXX
6407
+#define SW_VBA_LISTFORMAT_HXX
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"
6417
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XListFormat > SwVbaListFormat_BASE;
6419
+class SwVbaListFormat : public SwVbaListFormat_BASE
6422
+ css::uno::Reference< css::text::XTextRange > mxTextRange;
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();
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);
6432
+ // XHelperInterface
6433
+ virtual rtl::OUString& getServiceImplName();
6434
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
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
6441
+++ sw/source/ui/vba/vbalistgalleries.cxx
6443
+/*************************************************************************
6445
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6447
+ * Copyright 2008 by Sun Microsystems, Inc.
6449
+ * OpenOffice.org - a multi-platform office productivity suite
6454
+ * This file is part of OpenOffice.org.
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.
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).
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.
6471
+ ************************************************************************/
6472
+#include "vbalistgalleries.hxx"
6473
+#include "vbalistgallery.hxx"
6474
+#include <ooo/vba/word/WdListGalleryType.hpp>
6476
+using namespace ::ooo::vba;
6477
+using namespace ::com::sun::star;
6479
+class ListGalleriesEnumWrapper : public EnumerationHelper_BASE
6481
+ SwVbaListGalleries* pListGalleries;
6484
+ ListGalleriesEnumWrapper( SwVbaListGalleries* pGalleries ) : pListGalleries( pGalleries ), nIndex( 1 ) {}
6485
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
6487
+ return ( nIndex <= pListGalleries->getCount() );
6490
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
6492
+ if ( nIndex <= pListGalleries->getCount() )
6493
+ return pListGalleries->Item( uno::makeAny( nIndex++ ), uno::Any() );
6494
+ throw container::NoSuchElementException();
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 )
6502
+::sal_Int32 SAL_CALL SwVbaListGalleries::getCount() throw (uno::RuntimeException)
6504
+ // 3 types of list( bullet, numbered and outline )
6508
+uno::Any SAL_CALL SwVbaListGalleries::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
6510
+ sal_Int32 nIndex = 0;
6511
+ if( ( Index1 >>= nIndex ) == sal_True )
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 ) ) );
6518
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
6521
+// XEnumerationAccess
6523
+SwVbaListGalleries::getElementType() throw (uno::RuntimeException)
6525
+ return word::XListGallery::static_type(0);
6528
+uno::Reference< container::XEnumeration >
6529
+SwVbaListGalleries::createEnumeration() throw (uno::RuntimeException)
6531
+ return new ListGalleriesEnumWrapper( this );
6535
+SwVbaListGalleries::createCollectionObject( const css::uno::Any& aSource )
6541
+SwVbaListGalleries::getServiceImplName()
6543
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListGalleries") );
6547
+css::uno::Sequence<rtl::OUString>
6548
+SwVbaListGalleries::getServiceNames()
6550
+ static uno::Sequence< rtl::OUString > sNames;
6551
+ if ( sNames.getLength() == 0 )
6553
+ sNames.realloc( 1 );
6554
+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListGalleries") );
6558
diff --git sw/source/ui/vba/vbalistgalleries.hxx sw/source/ui/vba/vbalistgalleries.hxx
6559
new file mode 100644
6560
index 0000000..36cd0ba
6562
+++ sw/source/ui/vba/vbalistgalleries.hxx
6564
+/*************************************************************************
6566
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6568
+ * Copyright 2008 by Sun Microsystems, Inc.
6570
+ * OpenOffice.org - a multi-platform office productivity suite
6575
+ * This file is part of OpenOffice.org.
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.
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).
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.
6592
+ ************************************************************************/
6593
+#ifndef SW_VBA_LISTGALLERIES_HXX
6594
+#define SW_VBA_LISTGALLERIES_HXX
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>
6601
+typedef CollTestImplHelper< ooo::vba::word::XListGalleries > SwVbaListGalleries_BASE;
6603
+class SwVbaListGalleries : public SwVbaListGalleries_BASE
6606
+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
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() {}
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);
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();
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
6629
+++ sw/source/ui/vba/vbalistgallery.cxx
6631
+/*************************************************************************
6633
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6635
+ * Copyright 2008 by Sun Microsystems, Inc.
6637
+ * OpenOffice.org - a multi-platform office productivity suite
6642
+ * This file is part of OpenOffice.org.
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.
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).
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.
6659
+ ************************************************************************/
6660
+#include "vbalistgallery.hxx"
6661
+#include <vbahelper/vbahelper.hxx>
6662
+#include <tools/diagnose_ex.h>
6663
+#include "vbalisttemplates.hxx"
6665
+using namespace ::ooo::vba;
6666
+using namespace ::com::sun::star;
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 )
6672
+SwVbaListGallery::~SwVbaListGallery()
6677
+SwVbaListGallery::ListTemplates( const uno::Any& index ) throw (uno::RuntimeException)
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 );
6686
+SwVbaListGallery::getServiceImplName()
6688
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListGallery") );
6692
+uno::Sequence< rtl::OUString >
6693
+SwVbaListGallery::getServiceNames()
6695
+ static uno::Sequence< rtl::OUString > aServiceNames;
6696
+ if ( aServiceNames.getLength() == 0 )
6698
+ aServiceNames.realloc( 1 );
6699
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListGallery" ) );
6701
+ return aServiceNames;
6704
diff --git sw/source/ui/vba/vbalistgallery.hxx sw/source/ui/vba/vbalistgallery.hxx
6705
new file mode 100644
6706
index 0000000..0ece178
6708
+++ sw/source/ui/vba/vbalistgallery.hxx
6710
+/*************************************************************************
6712
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6714
+ * Copyright 2008 by Sun Microsystems, Inc.
6716
+ * OpenOffice.org - a multi-platform office productivity suite
6721
+ * This file is part of OpenOffice.org.
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.
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).
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.
6738
+ ************************************************************************/
6739
+#ifndef SW_VBA_LISTGALLERY_HXX
6740
+#define SW_VBA_LISTGALLERY_HXX
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>
6748
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XListGallery > SwVbaListGallery_BASE;
6750
+class SwVbaListGallery : public SwVbaListGallery_BASE
6753
+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
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();
6761
+ virtual css::uno::Any SAL_CALL ListTemplates( const css::uno::Any& index ) throw ( css::uno::RuntimeException );
6763
+ // XHelperInterface
6764
+ virtual rtl::OUString& getServiceImplName();
6765
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
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
6772
+++ sw/source/ui/vba/vbalisthelper.cxx
6774
+/*************************************************************************
6776
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6778
+ * Copyright 2008 by Sun Microsystems, Inc.
6780
+ * OpenOffice.org - a multi-platform office productivity suite
6785
+ * This file is part of OpenOffice.org.
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.
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).
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.
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>
6810
+using namespace ::ooo::vba;
6811
+using namespace ::com::sun::star;
6813
+static const sal_Int32 LIST_LEVEL_COUNT = 9;
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";
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";
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;
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 )
6850
+void SwVbaListHelper::Init() throw( css::uno::RuntimeException )
6852
+ // set the numbering style name
6853
+ switch( mnGalleryType )
6855
+ case word::WdListGalleryType::wdBulletGallery:
6857
+ msStyleName = rtl::OUString::createFromAscii( WORD_BULLET_GALLERY );
6860
+ case word::WdListGalleryType::wdNumberGallery:
6862
+ msStyleName = rtl::OUString::createFromAscii( WORD_NUMBER_GALLERY );
6865
+ case word::WdListGalleryType::wdOutlineNumberGallery:
6867
+ msStyleName = rtl::OUString::createFromAscii( WORD_OUTLINE_NUMBER_GALLERY );
6872
+ throw uno::RuntimeException();
6875
+ msStyleName += rtl::OUString::valueOf( mnTemplateType );
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 ) )
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 );
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 );
6896
+ CreateListTemplate();
6898
+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) , uno::makeAny( mxNumberingRules ) );
6902
+void SwVbaListHelper::CreateListTemplate() throw( css::uno::RuntimeException )
6904
+ switch( mnGalleryType )
6906
+ case word::WdListGalleryType::wdBulletGallery:
6908
+ CreateBulletListTemplate();
6911
+ case word::WdListGalleryType::wdNumberGallery:
6913
+ CreateNumberListTemplate();
6916
+ case word::WdListGalleryType::wdOutlineNumberGallery:
6918
+ CreateOutlineNumberListTemplate();
6923
+ throw uno::RuntimeException();
6928
+void SwVbaListHelper::CreateBulletListTemplate() throw( css::uno::RuntimeException )
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 ) );
6939
+ rtl::OUString aBulletChar;
6940
+ switch( mnTemplateType )
6944
+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_CLOSED_DOT ) );
6949
+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_EMPTY_DOT ) );
6954
+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_SQUARE ) );
6959
+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_STAR_SYMBOL ) );
6964
+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_FOUR_DIAMONDS ) );
6969
+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_ARROW ) );
6974
+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_CHECK_MARK ) );
6979
+ // we only support 7 types template now
6980
+ throw css::uno::RuntimeException();
6983
+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_BULLET_CHAR ), uno::makeAny( aBulletChar ) );
6985
+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
6988
+void SwVbaListHelper::CreateNumberListTemplate() throw( css::uno::RuntimeException )
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;
6995
+ sal_Int16 nNumberingType = 0;
6996
+ rtl::OUString sSuffix;
6997
+ switch( mnTemplateType )
7001
+ nNumberingType = style::NumberingType::ARABIC;
7002
+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
7007
+ nNumberingType = style::NumberingType::ARABIC;
7008
+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
7013
+ nNumberingType = style::NumberingType::ROMAN_UPPER;
7014
+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
7019
+ nNumberingType = style::NumberingType::CHARS_UPPER_LETTER;
7020
+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
7025
+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
7026
+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
7031
+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
7032
+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
7037
+ nNumberingType = style::NumberingType::ROMAN_LOWER;
7038
+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
7043
+ // we only support 7 types template now
7044
+ throw css::uno::RuntimeException();
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 ) );
7050
+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
7053
+void SwVbaListHelper::CreateOutlineNumberListTemplate() throw( css::uno::RuntimeException )
7055
+ switch( mnTemplateType )
7059
+ CreateOutlineNumberForType1();
7064
+ CreateOutlineNumberForType2();
7069
+ CreateOutlineNumberForType3();
7074
+ CreateOutlineNumberForType4();
7079
+ CreateOutlineNumberForType5();
7084
+ CreateOutlineNumberForType6();
7089
+ CreateOutlineNumberForType7();
7094
+ // we only support 7 types template now
7095
+ throw css::uno::RuntimeException();
7100
+void SwVbaListHelper::CreateOutlineNumberForType1() throw( css::uno::RuntimeException )
7102
+ sal_Int16 nNumberingType = 0;
7103
+ rtl::OUString sPrefix;
7104
+ rtl::OUString sSuffix;
7105
+ uno::Sequence< beans::PropertyValue > aPropertyValues;
7107
+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
7109
+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
7115
+ nNumberingType = style::NumberingType::ARABIC;
7116
+ sPrefix = rtl::OUString();
7117
+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
7122
+ nNumberingType = style::NumberingType::ROMAN_LOWER;
7123
+ sPrefix = rtl::OUString();
7124
+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
7129
+ nNumberingType = style::NumberingType::ARABIC;
7130
+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
7131
+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
7136
+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
7137
+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
7138
+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
7143
+ nNumberingType = style::NumberingType::ROMAN_LOWER;
7144
+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
7145
+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
7150
+ nNumberingType = style::NumberingType::ARABIC;
7151
+ sPrefix = rtl::OUString();
7152
+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
7157
+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
7158
+ sPrefix = rtl::OUString();
7159
+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
7164
+ nNumberingType = style::NumberingType::ROMAN_LOWER;
7165
+ sPrefix = rtl::OUString();
7166
+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
7171
+ throw uno::RuntimeException();
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 ) );
7181
+void SwVbaListHelper::CreateOutlineNumberForType2() throw( css::uno::RuntimeException )
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;
7188
+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
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 ) );
7195
+ nParentNumbering = sal_Int16( nLevel - 1 );
7196
+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PARENT_NUMBERING ), uno::makeAny( nParentNumbering ) );
7198
+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
7202
+void SwVbaListHelper::CreateOutlineNumberForType3() throw( css::uno::RuntimeException )
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;
7209
+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
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 ) );
7218
+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_FOUR_DIAMONDS ) );
7224
+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_ARROW ) );
7230
+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_SQUARE ) );
7236
+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_CLOSED_DOT ) );
7242
+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_DIAMOND ) );
7247
+ throw uno::RuntimeException();
7250
+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_BULLET_CHAR ), uno::makeAny( aBulletChar ) );
7251
+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
7255
+void SwVbaListHelper::CreateOutlineNumberForType4() throw( css::uno::RuntimeException )
7257
+ sal_Int16 nNumberingType = 0;
7258
+ rtl::OUString sPrefix;
7259
+ rtl::OUString sSuffix;
7260
+ uno::Sequence< beans::PropertyValue > aPropertyValues;
7262
+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
7264
+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
7269
+ nNumberingType = style::NumberingType::ROMAN_UPPER;
7270
+ sPrefix = rtl::OUString();
7271
+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
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 ) );
7285
+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
7286
+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
7287
+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
7292
+ nNumberingType = style::NumberingType::ROMAN_LOWER;
7293
+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
7294
+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
7299
+ nNumberingType = style::NumberingType::ARABIC;
7300
+ sPrefix = rtl::OUString();
7301
+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
7306
+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
7307
+ sPrefix = rtl::OUString();
7308
+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
7313
+ nNumberingType = style::NumberingType::ROMAN_LOWER;
7314
+ sPrefix = rtl::OUString();
7315
+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
7320
+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
7321
+ sPrefix = rtl::OUString();
7322
+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
7327
+ nNumberingType = style::NumberingType::ROMAN_LOWER;
7328
+ sPrefix = rtl::OUString();
7329
+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
7334
+ throw uno::RuntimeException();
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 ) );
7344
+void SwVbaListHelper::CreateOutlineNumberForType5() throw( css::uno::RuntimeException )
7346
+ sal_Int16 nNumberingType = style::NumberingType::ARABIC;
7347
+ sal_Int16 nParentNumbering = 0;
7348
+ uno::Sequence< beans::PropertyValue > aPropertyValues;
7350
+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
7352
+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
7353
+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
7356
+ nParentNumbering = sal_Int16( nLevel - 1 );
7357
+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PARENT_NUMBERING ), uno::makeAny( nParentNumbering ) );
7359
+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
7363
+void SwVbaListHelper::CreateOutlineNumberForType6() throw( css::uno::RuntimeException )
7365
+ sal_Int16 nNumberingType = 0;
7366
+ rtl::OUString sPrefix;
7367
+ rtl::OUString sSuffix;
7368
+ uno::Sequence< beans::PropertyValue > aPropertyValues;
7370
+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
7372
+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
7377
+ nNumberingType = style::NumberingType::ROMAN_UPPER;
7378
+ sPrefix = rtl::OUString();
7379
+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
7384
+ nNumberingType = style::NumberingType::CHARS_UPPER_LETTER;
7385
+ sPrefix = rtl::OUString();
7386
+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
7391
+ nNumberingType = style::NumberingType::ARABIC;
7392
+ sPrefix = rtl::OUString();
7393
+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
7398
+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
7399
+ sPrefix = rtl::OUString();
7400
+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
7405
+ nNumberingType = style::NumberingType::ARABIC;
7406
+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
7407
+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
7412
+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
7413
+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
7414
+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
7419
+ nNumberingType = style::NumberingType::ROMAN_LOWER;
7420
+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
7421
+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
7426
+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
7427
+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
7428
+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
7433
+ nNumberingType = style::NumberingType::ROMAN_LOWER;
7434
+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
7435
+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
7440
+ throw uno::RuntimeException();
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 ) );
7450
+void SwVbaListHelper::CreateOutlineNumberForType7() throw( css::uno::RuntimeException )
7452
+ sal_Int16 nNumberingType = style::NumberingType::ARABIC;
7453
+ uno::Sequence< beans::PropertyValue > aPropertyValues;
7454
+ rtl::OUString sPrefix = rtl::OUString::createFromAscii("Chapter ");
7456
+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
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 ) );
7465
+uno::Any SwVbaListHelper::getPropertyValueWithNameAndLevel( sal_Int32 nLevel, const rtl::OUString& sName ) throw( css::uno::RuntimeException )
7467
+ uno::Sequence< beans::PropertyValue > aPropertyValues;
7468
+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
7469
+ return getPropertyValue( aPropertyValues, sName );
7472
+void SwVbaListHelper::setPropertyValueWithNameAndLevel( sal_Int32 nLevel, const rtl::OUString& sName, const css::uno::Any& aValue ) throw( css::uno::RuntimeException )
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 ) );
7481
diff --git sw/source/ui/vba/vbalisthelper.hxx sw/source/ui/vba/vbalisthelper.hxx
7482
new file mode 100644
7483
index 0000000..0f5fa26
7485
+++ sw/source/ui/vba/vbalisthelper.hxx
7487
+/*************************************************************************
7489
+ * OpenOffice.org - a multi-platform office productivity suite
7495
+ * last change: $Author$ $Date$
7497
+ * The Contents of this file are made available subject to
7498
+ * the terms of GNU Lesser General Public License Version 2.1.
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
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.
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.
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
7520
+ ************************************************************************/
7521
+#ifndef SW_VBA_LISTHELPER_HXX
7522
+#define SW_VBA_LISTHELPER_HXX
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>
7531
+class SwVbaListHelper;
7532
+typedef ::boost::shared_ptr< SwVbaListHelper > SwVbaListHelperRef;
7534
+class SwVbaListHelper
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;
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 );
7559
+ SwVbaListHelper( const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nGalleryType, sal_Int32 nTemplateType ) throw( css::uno::RuntimeException );
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 );
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
7573
+++ sw/source/ui/vba/vbalistlevel.cxx
7575
+/*************************************************************************
7577
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7579
+ * Copyright 2008 by Sun Microsystems, Inc.
7581
+ * OpenOffice.org - a multi-platform office productivity suite
7586
+ * This file is part of OpenOffice.org.
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.
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).
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.
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>
7613
+using namespace ::ooo::vba;
7614
+using namespace ::com::sun::star;
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 )
7620
+SwVbaListLevel::~SwVbaListLevel()
7624
+::sal_Int32 SAL_CALL SwVbaListLevel::getAlignment() throw (uno::RuntimeException)
7626
+ sal_Int16 nAlignment = 0;
7627
+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Adjust") ) ) >>= nAlignment;
7628
+ switch( nAlignment )
7630
+ case text::HoriOrientation::LEFT:
7632
+ nAlignment = word::WdListLevelAlignment::wdListLevelAlignLeft;
7635
+ case text::HoriOrientation::RIGHT:
7637
+ nAlignment = word::WdListLevelAlignment::wdListLevelAlignRight;
7640
+ case text::HoriOrientation::CENTER:
7642
+ nAlignment = word::WdListLevelAlignment::wdListLevelAlignCenter;
7647
+ throw uno::RuntimeException();
7650
+ return nAlignment;
7653
+void SAL_CALL SwVbaListLevel::setAlignment( ::sal_Int32 _alignment ) throw (uno::RuntimeException)
7655
+ sal_Int16 nAlignment = text::HoriOrientation::LEFT;
7656
+ switch( _alignment )
7658
+ case word::WdListLevelAlignment::wdListLevelAlignLeft:
7660
+ nAlignment = text::HoriOrientation::LEFT;
7663
+ case word::WdListLevelAlignment::wdListLevelAlignRight:
7665
+ nAlignment = text::HoriOrientation::RIGHT;
7668
+ case word::WdListLevelAlignment::wdListLevelAlignCenter:
7670
+ nAlignment = text::HoriOrientation::CENTER;
7675
+ throw uno::RuntimeException();
7678
+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Adjust") ), uno::makeAny( nAlignment ) );
7681
+uno::Reference< ::ooo::vba::word::XFont > SAL_CALL SwVbaListLevel::getFont() throw (uno::RuntimeException)
7683
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
7684
+ return uno::Reference< word::XFont >();
7687
+void SAL_CALL SwVbaListLevel::setFont( const uno::Reference< ::ooo::vba::word::XFont >& /*_font*/ ) throw (uno::RuntimeException)
7689
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
7692
+::sal_Int32 SAL_CALL SwVbaListLevel::getIndex() throw (uno::RuntimeException)
7694
+ return mnLevel + 1;
7697
+::rtl::OUString SAL_CALL SwVbaListLevel::getLinkedStyle() throw (uno::RuntimeException)
7700
+ return rtl::OUString();
7703
+void SAL_CALL SwVbaListLevel::setLinkedStyle( const ::rtl::OUString& _linkedstyle ) throw (uno::RuntimeException)
7708
+::rtl::OUString SAL_CALL SwVbaListLevel::getNumberFormat() throw (uno::RuntimeException)
7711
+ return rtl::OUString();
7714
+void SAL_CALL SwVbaListLevel::setNumberFormat( const ::rtl::OUString& _numberformat ) throw (uno::RuntimeException)
7719
+float SAL_CALL SwVbaListLevel::getNumberPosition() throw (uno::RuntimeException)
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;
7727
+ sal_Int32 nResult = nIndentAt + nFirstLineIndent;
7729
+ return static_cast< float >( Millimeter::getInPoints( nResult ) );
7732
+void SAL_CALL SwVbaListLevel::setNumberPosition( float _numberposition ) throw (uno::RuntimeException)
7734
+ sal_Int32 nNumberPosition = Millimeter::getInHundredthsOfOneMillimeter( _numberposition );
7736
+ sal_Int32 nIndentAt = 0;
7737
+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ) ) >>= nIndentAt;
7739
+ sal_Int32 nFirstLineIndent = nNumberPosition - nIndentAt;
7740
+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent") ), uno::makeAny( nFirstLineIndent ) );
7743
+::sal_Int32 SAL_CALL SwVbaListLevel::getNumberStyle() throw (uno::RuntimeException)
7745
+ sal_Int16 nNumberingType = 0;
7746
+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingType") ) ) >>= nNumberingType;
7747
+ switch( nNumberingType )
7749
+ case style::NumberingType::CHAR_SPECIAL:
7751
+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleBullet;
7754
+ case style::NumberingType::CHARS_UPPER_LETTER:
7756
+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleUppercaseLetter;
7759
+ case style::NumberingType::CHARS_LOWER_LETTER:
7761
+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleLowercaseLetter;
7764
+ case style::NumberingType::ROMAN_UPPER:
7766
+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleUppercaseRoman;
7769
+ case style::NumberingType::ROMAN_LOWER:
7771
+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleLowercaseRoman;
7774
+ case style::NumberingType::ARABIC:
7776
+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleArabic;
7779
+ case style::NumberingType::NUMBER_NONE:
7781
+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleNone;
7784
+ case style::NumberingType::FULLWIDTH_ARABIC:
7786
+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleArabicFullWidth;
7789
+ case style::NumberingType::CIRCLE_NUMBER:
7791
+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleNumberInCircle;
7794
+ case style::NumberingType::CHARS_ARABIC:
7796
+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleCardinalText;
7801
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
7804
+ return nNumberingType;
7807
+void SAL_CALL SwVbaListLevel::setNumberStyle( ::sal_Int32 _numberstyle ) throw (uno::RuntimeException)
7809
+ sal_Int16 nNumberingType = 0;
7810
+ switch( _numberstyle )
7812
+ case word::WdListNumberStyle::wdListNumberStyleBullet:
7814
+ nNumberingType = style::NumberingType::CHAR_SPECIAL;
7817
+ case word::WdListNumberStyle::wdListNumberStyleUppercaseLetter:
7819
+ nNumberingType = style::NumberingType::CHARS_UPPER_LETTER_N;
7822
+ case word::WdListNumberStyle::wdListNumberStyleLowercaseLetter:
7824
+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER_N;
7827
+ case word::WdListNumberStyle::wdListNumberStyleUppercaseRoman:
7829
+ nNumberingType = style::NumberingType::ROMAN_UPPER;
7832
+ case word::WdListNumberStyle::wdListNumberStyleLowercaseRoman:
7834
+ nNumberingType = style::NumberingType::ROMAN_LOWER;
7837
+ case word::WdListNumberStyle::wdListNumberStyleArabic:
7839
+ nNumberingType = style::NumberingType::ARABIC;
7842
+ case word::WdListNumberStyle::wdListNumberStyleNone:
7844
+ nNumberingType = style::NumberingType::NUMBER_NONE;
7847
+ case word::WdListNumberStyle::wdListNumberStyleArabicFullWidth:
7849
+ nNumberingType = style::NumberingType::FULLWIDTH_ARABIC;
7852
+ case word::WdListNumberStyle::wdListNumberStyleNumberInCircle:
7854
+ nNumberingType = style::NumberingType::CIRCLE_NUMBER;
7857
+ case word::WdListNumberStyle::wdListNumberStyleCardinalText:
7859
+ nNumberingType = style::NumberingType::CHARS_ARABIC;
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:
7869
+ nNumberingType = style::NumberingType::ARABIC;
7874
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
7878
+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingType") ), uno::makeAny( nNumberingType ) );
7881
+::sal_Int32 SAL_CALL SwVbaListLevel::getResetOnHigher() throw (uno::RuntimeException)
7883
+ //seems not support?
7887
+void SAL_CALL SwVbaListLevel::setResetOnHigher( ::sal_Int32 _resetonhigher ) throw (uno::RuntimeException)
7889
+ //seems not support?
7892
+::sal_Int32 SAL_CALL SwVbaListLevel::getStartAt() throw (uno::RuntimeException)
7894
+ sal_Int16 nStartWith = 0;
7895
+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StartWith") ) ) >>= nStartWith;
7896
+ return nStartWith;
7899
+void SAL_CALL SwVbaListLevel::setStartAt( ::sal_Int32 _startat ) throw (uno::RuntimeException)
7901
+ sal_Int16 nStartWith = (sal_Int16)_startat;
7902
+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StartWith") ), uno::makeAny( nStartWith ) );
7905
+float SAL_CALL SwVbaListLevel::getTabPosition() throw (uno::RuntimeException)
7907
+ sal_Int32 nTabPosition = 0;
7908
+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ListtabStopPosition") ) ) >>= nTabPosition;
7910
+ return static_cast< float >( Millimeter::getInPoints( nTabPosition ) );
7913
+void SAL_CALL SwVbaListLevel::setTabPosition( float _tabposition ) throw (uno::RuntimeException)
7915
+ sal_Int32 nTabPosition = Millimeter::getInHundredthsOfOneMillimeter( _tabposition );
7916
+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ListtabStopPosition") ), uno::makeAny( nTabPosition ) );
7919
+float SAL_CALL SwVbaListLevel::getTextPosition() throw (uno::RuntimeException)
7922
+ sal_Int32 nIndentAt = 0;
7923
+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ) ) >>= nIndentAt;
7925
+ return static_cast< float >( Millimeter::getInPoints( nIndentAt ) );
7928
+void SAL_CALL SwVbaListLevel::setTextPosition( float _textposition ) throw (uno::RuntimeException)
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;
7935
+ sal_Int32 nAlignedAt = nIndentAt + nFirstLineIndent;
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 ) );
7943
+::sal_Int32 SAL_CALL SwVbaListLevel::getTrailingCharacter() throw (uno::RuntimeException)
7945
+ sal_Int16 nLabelFollowedBy= 0;
7946
+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LabelFollowedBy") ) ) >>= nLabelFollowedBy;
7948
+ return nLabelFollowedBy;
7951
+void SAL_CALL SwVbaListLevel::setTrailingCharacter( ::sal_Int32 _trailingcharacter ) throw (uno::RuntimeException)
7953
+ sal_Int16 nLabelFollowedBy = (sal_Int16)_trailingcharacter;
7954
+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LabelFollowedBy") ), uno::makeAny( nLabelFollowedBy ) );
7958
+SwVbaListLevel::getServiceImplName()
7960
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListLevel") );
7964
+uno::Sequence< rtl::OUString >
7965
+SwVbaListLevel::getServiceNames()
7967
+ static uno::Sequence< rtl::OUString > aServiceNames;
7968
+ if ( aServiceNames.getLength() == 0 )
7970
+ aServiceNames.realloc( 1 );
7971
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListLevel" ) );
7973
+ return aServiceNames;
7976
diff --git sw/source/ui/vba/vbalistlevel.hxx sw/source/ui/vba/vbalistlevel.hxx
7977
new file mode 100644
7978
index 0000000..4bcb147
7980
+++ sw/source/ui/vba/vbalistlevel.hxx
7982
+/*************************************************************************
7984
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7986
+ * Copyright 2008 by Sun Microsystems, Inc.
7988
+ * OpenOffice.org - a multi-platform office productivity suite
7993
+ * This file is part of OpenOffice.org.
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.
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).
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.
8010
+ ************************************************************************/
8011
+#ifndef SW_VBA_LISTLEVEL_HXX
8012
+#define SW_VBA_LISTLEVEL_HXX
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"
8021
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XListLevel > SwVbaListLevel_BASE;
8023
+class SwVbaListLevel : public SwVbaListLevel_BASE
8026
+ SwVbaListHelperRef pListHelper;
8027
+ sal_Int32 mnLevel;
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();
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);
8058
+ // XHelperInterface
8059
+ virtual rtl::OUString& getServiceImplName();
8060
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
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
8067
+++ sw/source/ui/vba/vbalistlevels.cxx
8069
+/*************************************************************************
8071
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8073
+ * Copyright 2008 by Sun Microsystems, Inc.
8075
+ * OpenOffice.org - a multi-platform office productivity suite
8080
+ * This file is part of OpenOffice.org.
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.
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).
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.
8097
+ ************************************************************************/
8098
+#include "vbalistlevels.hxx"
8099
+#include "vbalistlevel.hxx"
8100
+#include <ooo/vba/word/WdListGalleryType.hpp>
8102
+using namespace ::ooo::vba;
8103
+using namespace ::com::sun::star;
8105
+class ListLevelsEnumWrapper : public EnumerationHelper_BASE
8107
+ SwVbaListLevels* pListLevels;
8110
+ ListLevelsEnumWrapper( SwVbaListLevels* pLevels ) : pListLevels( pLevels ), nIndex( 1 ) {}
8111
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
8113
+ return ( nIndex <= pListLevels->getCount() );
8116
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
8118
+ if ( nIndex <= pListLevels->getCount() )
8119
+ return pListLevels->Item( uno::makeAny( nIndex++ ), uno::Any() );
8120
+ throw container::NoSuchElementException();
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 )
8128
+::sal_Int32 SAL_CALL SwVbaListLevels::getCount() throw (uno::RuntimeException)
8130
+ sal_Int32 nGalleryType = pListHelper->getGalleryType();
8131
+ if( nGalleryType == word::WdListGalleryType::wdBulletGallery
8132
+ || nGalleryType == word::WdListGalleryType::wdNumberGallery )
8134
+ else if( nGalleryType == word::WdListGalleryType::wdOutlineNumberGallery )
8139
+uno::Any SAL_CALL SwVbaListLevels::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
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 >() );
8147
+ return uno::makeAny( uno::Reference< word::XListLevel >( new SwVbaListLevel( this, mxContext, pListHelper, nIndex - 1 ) ) );
8150
+// XEnumerationAccess
8152
+SwVbaListLevels::getElementType() throw (uno::RuntimeException)
8154
+ return word::XListLevel::static_type(0);
8157
+uno::Reference< container::XEnumeration >
8158
+SwVbaListLevels::createEnumeration() throw (uno::RuntimeException)
8160
+ return new ListLevelsEnumWrapper( this );
8164
+SwVbaListLevels::createCollectionObject( const css::uno::Any& aSource )
8170
+SwVbaListLevels::getServiceImplName()
8172
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListLevels") );
8176
+css::uno::Sequence<rtl::OUString>
8177
+SwVbaListLevels::getServiceNames()
8179
+ static uno::Sequence< rtl::OUString > sNames;
8180
+ if ( sNames.getLength() == 0 )
8182
+ sNames.realloc( 1 );
8183
+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListLevels") );
8187
diff --git sw/source/ui/vba/vbalistlevels.hxx sw/source/ui/vba/vbalistlevels.hxx
8188
new file mode 100644
8189
index 0000000..c57da55
8191
+++ sw/source/ui/vba/vbalistlevels.hxx
8193
+/*************************************************************************
8195
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8197
+ * Copyright 2008 by Sun Microsystems, Inc.
8199
+ * OpenOffice.org - a multi-platform office productivity suite
8204
+ * This file is part of OpenOffice.org.
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.
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).
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.
8221
+ ************************************************************************/
8222
+#ifndef SW_VBA_LISTLEVELS_HXX
8223
+#define SW_VBA_LISTLEVELS_HXX
8225
+#include <vbahelper/vbacollectionimpl.hxx>
8226
+#include <ooo/vba/word/XListLevels.hpp>
8227
+#include <vbahelper/vbahelperinterface.hxx>
8228
+#include "vbalisthelper.hxx"
8231
+typedef CollTestImplHelper< ooo::vba::word::XListLevels > SwVbaListLevels_BASE;
8233
+class SwVbaListLevels : public SwVbaListLevels_BASE
8236
+ SwVbaListHelperRef pListHelper;
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() {}
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);
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();
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
8259
+++ sw/source/ui/vba/vbalisttemplate.cxx
8261
+/*************************************************************************
8263
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8265
+ * Copyright 2008 by Sun Microsystems, Inc.
8267
+ * OpenOffice.org - a multi-platform office productivity suite
8272
+ * This file is part of OpenOffice.org.
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.
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).
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.
8289
+ ************************************************************************/
8290
+#include "vbalisttemplate.hxx"
8291
+#include <vbahelper/vbahelper.hxx>
8292
+#include <tools/diagnose_ex.h>
8293
+#include "vbalistlevels.hxx"
8295
+using namespace ::ooo::vba;
8296
+using namespace ::com::sun::star;
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 )
8300
+ pListHelper.reset( new SwVbaListHelper( xTextDoc, nGalleryType, nTemplateType ) );
8303
+SwVbaListTemplate::~SwVbaListTemplate()
8308
+SwVbaListTemplate::ListLevels( const uno::Any& index ) throw (uno::RuntimeException)
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 );
8316
+void SwVbaListTemplate::applyListTemplate( uno::Reference< beans::XPropertySet >& xProps ) throw (uno::RuntimeException)
8318
+ uno::Reference< container::XIndexReplace > xNumberingRules = pListHelper->getNumberingRules();
8319
+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) , uno::makeAny( xNumberingRules ) );
8323
+SwVbaListTemplate::getServiceImplName()
8325
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListTemplate") );
8329
+uno::Sequence< rtl::OUString >
8330
+SwVbaListTemplate::getServiceNames()
8332
+ static uno::Sequence< rtl::OUString > aServiceNames;
8333
+ if ( aServiceNames.getLength() == 0 )
8335
+ aServiceNames.realloc( 1 );
8336
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListTemplate" ) );
8338
+ return aServiceNames;
8341
diff --git sw/source/ui/vba/vbalisttemplate.hxx sw/source/ui/vba/vbalisttemplate.hxx
8342
new file mode 100644
8343
index 0000000..733ef76
8345
+++ sw/source/ui/vba/vbalisttemplate.hxx
8347
+/*************************************************************************
8349
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8351
+ * Copyright 2008 by Sun Microsystems, Inc.
8353
+ * OpenOffice.org - a multi-platform office productivity suite
8358
+ * This file is part of OpenOffice.org.
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.
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).
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.
8375
+ ************************************************************************/
8376
+#ifndef SW_VBA_LISTTEMPLATE_HXX
8377
+#define SW_VBA_LISTTEMPLATE_HXX
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"
8386
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XListTemplate > SwVbaListTemplate_BASE;
8388
+class SwVbaListTemplate : public SwVbaListTemplate_BASE
8391
+ SwVbaListHelperRef pListHelper;
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();
8397
+ void applyListTemplate( css::uno::Reference< css::beans::XPropertySet >& xProps ) throw ( css::uno::RuntimeException );
8400
+ virtual css::uno::Any SAL_CALL ListLevels( const css::uno::Any& index ) throw ( css::uno::RuntimeException );
8402
+ // XHelperInterface
8403
+ virtual rtl::OUString& getServiceImplName();
8404
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
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
8411
+++ sw/source/ui/vba/vbalisttemplates.cxx
8413
+/*************************************************************************
8415
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8417
+ * Copyright 2008 by Sun Microsystems, Inc.
8419
+ * OpenOffice.org - a multi-platform office productivity suite
8424
+ * This file is part of OpenOffice.org.
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.
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).
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.
8441
+ ************************************************************************/
8442
+#include "vbalisttemplates.hxx"
8443
+#include "vbalisttemplate.hxx"
8445
+using namespace ::ooo::vba;
8446
+using namespace ::com::sun::star;
8448
+class ListTemplatesEnumWrapper : public EnumerationHelper_BASE
8450
+ SwVbaListTemplates* pListTemplates;
8453
+ ListTemplatesEnumWrapper( SwVbaListTemplates* pTemplates ) : pListTemplates( pTemplates ), nIndex( 1 ) {}
8454
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
8456
+ return ( nIndex <= pListTemplates->getCount() );
8459
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
8461
+ if ( nIndex <= pListTemplates->getCount() )
8462
+ return pListTemplates->Item( uno::makeAny( nIndex++ ), uno::Any() );
8463
+ throw container::NoSuchElementException();
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 )
8471
+::sal_Int32 SAL_CALL SwVbaListTemplates::getCount() throw (uno::RuntimeException)
8473
+ // 3 types of list( bullet, numbered and outline )
8477
+uno::Any SAL_CALL SwVbaListTemplates::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
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 >() );
8485
+ return uno::makeAny( uno::Reference< word::XListTemplate >( new SwVbaListTemplate( this, mxContext, mxTextDocument, mnGalleryType, nIndex ) ) );
8488
+// XEnumerationAccess
8490
+SwVbaListTemplates::getElementType() throw (uno::RuntimeException)
8492
+ return word::XListTemplate::static_type(0);
8495
+uno::Reference< container::XEnumeration >
8496
+SwVbaListTemplates::createEnumeration() throw (uno::RuntimeException)
8498
+ return new ListTemplatesEnumWrapper( this );
8502
+SwVbaListTemplates::createCollectionObject( const css::uno::Any& aSource )
8508
+SwVbaListTemplates::getServiceImplName()
8510
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListTemplates") );
8514
+css::uno::Sequence<rtl::OUString>
8515
+SwVbaListTemplates::getServiceNames()
8517
+ static uno::Sequence< rtl::OUString > sNames;
8518
+ if ( sNames.getLength() == 0 )
8520
+ sNames.realloc( 1 );
8521
+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListTemplates") );
8525
diff --git sw/source/ui/vba/vbalisttemplates.hxx sw/source/ui/vba/vbalisttemplates.hxx
8526
new file mode 100644
8527
index 0000000..214d01b
8529
+++ sw/source/ui/vba/vbalisttemplates.hxx
8531
+/*************************************************************************
8533
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8535
+ * Copyright 2008 by Sun Microsystems, Inc.
8537
+ * OpenOffice.org - a multi-platform office productivity suite
8542
+ * This file is part of OpenOffice.org.
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.
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).
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.
8559
+ ************************************************************************/
8560
+#ifndef SW_VBA_LISTTEMPLATES_HXX
8561
+#define SW_VBA_LISTTEMPLATES_HXX
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>
8568
+typedef CollTestImplHelper< ooo::vba::word::XListTemplates > SwVbaListTemplates_BASE;
8570
+class SwVbaListTemplates : public SwVbaListTemplates_BASE
8573
+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
8574
+ sal_Int32 mnGalleryType;
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() {}
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);
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();
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 ) );
8602
+SwVbaParagraph::getStyle( ) throw ( uno::RuntimeException )
8604
+ uno::Reference< word::XRange > xRange = getRange();
8605
+ return xRange->getStyle();
8609
+SwVbaParagraph::setStyle( const uno::Any& style ) throw ( uno::RuntimeException )
8611
+ uno::Reference< word::XRange > xRange = getRange();
8612
+ xRange->setStyle( style );
8616
SwVbaParagraph::getServiceImplName()
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:
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 );
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
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"
8642
using namespace ::ooo::vba;
8643
@@ -203,9 +204,12 @@ sal_Int32 SAL_CALL SwVbaParagraphFormat::getOutlineLevel() throw (uno::RuntimeEx
8647
-void SAL_CALL SwVbaParagraphFormat::setOutlineLevel( sal_Int32 /*_outlinelevel*/ ) throw (uno::RuntimeException)
8648
+void SAL_CALL SwVbaParagraphFormat::setOutlineLevel( sal_Int32 _outlinelevel ) throw (uno::RuntimeException)
8650
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
8651
+ if( _outlinelevel != getOutlineLevel() )
8653
+ // TODO: in my test in msword, there is no effect for this function.
8657
uno::Any SAL_CALL SwVbaParagraphFormat::getPageBreakBefore() throw (uno::RuntimeException)
8658
@@ -299,7 +303,7 @@ void SAL_CALL SwVbaParagraphFormat::setRightIndent( float _rightindent ) throw (
8660
uno::Any SAL_CALL SwVbaParagraphFormat::getTabStops() throw (uno::RuntimeException)
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 ) ) );
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
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"
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
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();
8703
@@ -94,6 +105,67 @@ void SwVbaRange::setXTextRange( const uno::Reference< text::XTextRange >& xRange
8704
mxTextCursor->gotoRange( xRange->getEnd(), sal_True );
8708
+SwVbaRange::Move( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend, word::E_DIRECTION eDirection ) throw ( uno::RuntimeException )
8710
+ sal_Int32 nUnit = word::WdUnits::wdCharacter;
8711
+ sal_Int32 nCount = 1;
8712
+ sal_Int32 nExtend = word::WdMovementType::wdMove;
8714
+ if( _unit.hasValue() )
8716
+ if( _count.hasValue() )
8717
+ _count >>= nCount;
8718
+ if( _extend.hasValue() )
8719
+ _extend >>= nExtend;
8724
+ sal_Bool bExpand = ( nExtend == word::WdMovementType::wdMove ) ? sal_False : sal_True;
8728
+ case word::WdUnits::wdParagraph:
8730
+ if( eDirection == word::MOVE_LEFT || eDirection == word::MOVE_RIGHT )
8732
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
8734
+ uno::Reference< text::XParagraphCursor > xParagraphCursor( mxTextCursor, uno::UNO_QUERY_THROW );
8735
+ for( sal_Int32 i=0; i<nCount; i++ )
8737
+ if( ( eDirection == word::MOVE_UP ) && ( xParagraphCursor->gotoPreviousParagraph( bExpand ) == sal_False ) )
8739
+ else if( ( eDirection == word::MOVE_DOWN ) && ( xParagraphCursor->gotoNextParagraph( bExpand ) == sal_False ) )
8744
+ case word::WdUnits::wdWord:
8746
+ if( eDirection == word::MOVE_UP || eDirection == word::MOVE_DOWN )
8748
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
8750
+ uno::Reference< text::XWordCursor > xWordCursor( mxTextCursor, uno::UNO_QUERY_THROW );
8751
+ for( sal_Int32 i=0; i<nCount; i++ )
8753
+ if( (eDirection == word::MOVE_LEFT ) && ( xWordCursor->gotoPreviousWord( bExpand ) == sal_False ) )
8755
+ else if( ( eDirection == word::MOVE_RIGHT ) && ( xWordCursor->gotoNextWord( bExpand ) == sal_False ) )
8762
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
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 )
8773
SwVbaRange::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
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 );
8781
+ uno::Reference< text::XTextContent > xBookmark = SwVbaRangeHelper::findBookmarkByPosition( mxTextDocument, xRange->getStart() );
8782
+ if( xBookmark.is() )
8784
+ uno::Reference< container::XNamed > xNamed( xBookmark, uno::UNO_QUERY_THROW );
8785
+ sName = xNamed->getName();
8788
+ catch( uno::Exception& )
8793
if( rText.indexOf( '\n' ) != -1 )
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 );
8802
mxTextCursor->setString( rText );
8805
+ // insert the bookmark if the bookmark is deleted during setting text string
8806
+ if( sName.getLength() )
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 ) )
8812
+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
8813
+ SwVbaBookmarks::addBookmarkByName( xModel, sName, xRange->getStart() );
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 >() );
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 )
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() )
8832
@@ -250,14 +348,23 @@ SwVbaRange::getStyle() throw ( uno::RuntimeException )
8834
DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() );
8839
+SwVbaRange::getStyle() throw ( uno::RuntimeException )
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 ) ) );
8853
-SwVbaRange::setStyle( const uno::Reference< word::XStyle >& rStyle ) throw ( uno::RuntimeException )
8854
+SwVbaRange::setStyle( const uno::Any& rStyle ) throw ( uno::RuntimeException )
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 ) );
8862
+uno::Reference< word::XListFormat > SAL_CALL
8863
+SwVbaRange::getListFormat() throw ( uno::RuntimeException )
8865
+ return uno::Reference< word::XListFormat >( new SwVbaListFormat( this, mxContext, getXTextRange() ) );
8868
::sal_Int32 SAL_CALL SwVbaRange::getLanguageID() throw (uno::RuntimeException)
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 );
8875
+::sal_Bool SAL_CALL SwVbaRange::InRange( const uno::Reference< ::ooo::vba::word::XRange >& Range ) throw (uno::RuntimeException)
8877
+ SwVbaRange* pRange = dynamic_cast< SwVbaRange* >( Range.get() );
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 )
8888
+SwVbaRange::Revisions( const uno::Any& index ) throw (uno::RuntimeException)
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 );
8899
+SwVbaRange::Sections( const uno::Any& index ) throw (uno::RuntimeException)
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 );
8910
+SwVbaRange::Fields( const uno::Any& index ) throw (uno::RuntimeException)
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 );
8920
SwVbaRange::getServiceImplName()
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
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"
8933
typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRange > SwVbaRange_BASE;
8935
@@ -51,6 +53,7 @@ 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 );
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);
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);
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);
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);
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
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>
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);
8991
- if( !bGotTextCursor )
8992
+ if( !bGotTextCursor || !xTextCursor.is() )
8996
@@ -128,7 +129,7 @@ uno::Reference< text::XTextCursor > SwVbaRangeHelper::initCursor( const uno::Ref
9000
- if( !bGotTextCursor )
9001
+ if( !bGotTextCursor || !xTextCursor.is() )
9005
@@ -172,3 +173,29 @@ sal_Int32 SwVbaRangeHelper::getPosition( const uno::Reference< text::XText >& rT
9010
+uno::Reference< text::XTextContent > SwVbaRangeHelper::findBookmarkByPosition( const uno::Reference< text::XTextDocument >& xTextDoc, const uno::Reference< text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException )
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++ )
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 )
9023
+ if( xCompare->compareRegionStarts( xTextRange, xBkAnchor->getStart() ) == 0 )
9026
+ catch( uno::Exception& )
9032
+ return uno::Reference< text::XTextContent >();
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
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>
9046
class SwVbaRangeHelper
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 );
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 );
9064
+void SAL_CALL SwVbaReplacement::ClearFormatting( ) throw (uno::RuntimeException)
9066
+ uno::Sequence< beans::PropertyValue > aPropValues;
9067
+ mxPropertyReplace->setReplaceAttributes( aPropValues );
9071
SwVbaReplacement::getServiceImplName()
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);
9082
+ virtual void SAL_CALL ClearFormatting() throw (css::uno::RuntimeException);
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
9091
+++ sw/source/ui/vba/vbarevision.cxx
9093
+/*************************************************************************
9095
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9097
+ * Copyright 2008 by Sun Microsystems, Inc.
9099
+ * OpenOffice.org - a multi-platform office productivity suite
9104
+ * This file is part of OpenOffice.org.
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.
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).
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.
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>
9130
+using namespace ::ooo::vba;
9131
+using namespace ::com::sun::star;
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 )
9137
+SwVbaRevision::~SwVbaRevision()
9141
+sal_Int32 SwVbaRevision::GetPosition() throw (css::uno::RuntimeException)
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++ )
9149
+ uno::Reference< beans::XPropertySet > xProps( xRedlines->getByIndex( i ), uno::UNO_QUERY_THROW );
9150
+ if( xProps == mxRedlineProps )
9153
+ OSL_TRACE(" SwVbaRevision::SwVbaRevision, the redline position is %d, ", nPos );
9158
+ throw uno::RuntimeException();
9164
+SwVbaRevision::Accept() throw ( css::uno::RuntimeException )
9166
+ SwDoc* pDoc = word::getDocShell( mxModel )->GetDoc();
9168
+ pDoc->AcceptRedline( GetPosition(), sal_True );
9172
+SwVbaRevision::Reject( ) throw ( css::uno::RuntimeException )
9174
+ SwDoc* pDoc = word::getDocShell( mxModel )->GetDoc();
9176
+ pDoc->RejectRedline( GetPosition(), sal_True );
9180
+SwVbaRevision::getServiceImplName()
9182
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRevision") );
9186
+uno::Sequence< rtl::OUString >
9187
+SwVbaRevision::getServiceNames()
9189
+ static uno::Sequence< rtl::OUString > aServiceNames;
9190
+ if ( aServiceNames.getLength() == 0 )
9192
+ aServiceNames.realloc( 1 );
9193
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Revision" ) );
9195
+ return aServiceNames;
9198
diff --git sw/source/ui/vba/vbarevision.hxx sw/source/ui/vba/vbarevision.hxx
9199
new file mode 100644
9200
index 0000000..0384370
9202
+++ sw/source/ui/vba/vbarevision.hxx
9204
+/*************************************************************************
9206
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9208
+ * Copyright 2008 by Sun Microsystems, Inc.
9210
+ * OpenOffice.org - a multi-platform office productivity suite
9215
+ * This file is part of OpenOffice.org.
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.
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).
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.
9232
+ ************************************************************************/
9233
+#ifndef SW_VBA_REVISION_HXX
9234
+#define SW_VBA_REVISION_HXX
9236
+#include <ooo/vba/word/XRevision.hpp>
9237
+#include <vbahelper/vbahelperinterface.hxx>
9238
+#include <cppuhelper/implbase1.hxx>
9240
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRevision > SwVbaRevision_BASE;
9242
+class SwVbaRevision : public SwVbaRevision_BASE
9245
+ css::uno::Reference< css::frame::XModel > mxModel;
9246
+ css::uno::Reference< css::beans::XPropertySet > mxRedlineProps;
9249
+ sal_Int32 GetPosition() throw (css::uno::RuntimeException);
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();
9256
+ virtual void SAL_CALL Accept( ) throw (css::uno::RuntimeException);
9257
+ virtual void SAL_CALL Reject( ) throw (css::uno::RuntimeException);
9259
+ // XHelperInterface
9260
+ virtual rtl::OUString& getServiceImplName();
9261
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
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
9268
+++ sw/source/ui/vba/vbarevisions.cxx
9270
+/*************************************************************************
9272
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9274
+ * Copyright 2008 by Sun Microsystems, Inc.
9276
+ * OpenOffice.org - a multi-platform office productivity suite
9281
+ * This file is part of OpenOffice.org.
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.
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).
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.
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>
9305
+using namespace ::ooo::vba;
9306
+using namespace ::com::sun::star;
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;
9312
+class RedlinesEnumeration : public RevisionEnumeration_BASE
9314
+ RevisionMap mRevisionMap;
9315
+ RevisionMap::iterator mIt;
9317
+ RedlinesEnumeration( const RevisionMap& sMap ) : mRevisionMap( sMap ), mIt( mRevisionMap.begin() ) {}
9318
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
9320
+ return ( mIt != mRevisionMap.end() );
9322
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
9324
+ if ( !hasMoreElements() )
9325
+ throw container::NoSuchElementException();
9326
+ uno::Reference< beans::XPropertySet > xRevision( *mIt++ );
9327
+ return uno::makeAny( xRevision ) ;
9331
+class RevisionCollectionHelper : public RevisionCollectionHelper_BASE
9333
+ RevisionMap mRevisionMap;
9335
+RevisionCollectionHelper( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ) throw (uno::RuntimeException);
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 ); }
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 )
9344
+ if ( Index < 0 || Index >= getCount() )
9345
+ throw lang::IndexOutOfBoundsException();
9347
+ return uno::makeAny( mRevisionMap[ Index ] );
9350
+ // XEnumerationAccess
9351
+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
9353
+ return new RedlinesEnumeration( mRevisionMap );
9357
+RevisionCollectionHelper::RevisionCollectionHelper( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ) throw (uno::RuntimeException)
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++ )
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 )
9368
+ uno::Reference< beans::XPropertySet > xRedlineProps( xRedlineRange, uno::UNO_QUERY_THROW );
9369
+ mRevisionMap.push_back( xRedlineProps );
9373
+class RevisionsEnumeration : public EnumerationHelperImpl
9375
+ uno::Reference< frame::XModel > m_xModel;
9376
+ uno::WeakReference< XHelperInterface > m_xParent;
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 ){}
9380
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
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 ) ) );
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 )
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 )
9396
+// XEnumerationAccess
9398
+SwVbaRevisions::getElementType() throw (uno::RuntimeException)
9400
+ return word::XRevision::static_type(0);
9402
+uno::Reference< container::XEnumeration >
9403
+SwVbaRevisions::createEnumeration() throw (uno::RuntimeException)
9405
+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
9406
+ return new RevisionsEnumeration( this, mxContext, xEnumAccess->createEnumeration(), mxModel );
9410
+SwVbaRevisions::createCollectionObject( const css::uno::Any& aSource )
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 ) ) );
9416
+void SAL_CALL SwVbaRevisions::AcceptAll( ) throw (css::uno::RuntimeException)
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() )
9424
+ uno::Reference< word::XRevision > xRevision( xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
9425
+ aRevisions.push_back( xRevision );
9428
+ std::vector< uno::Reference< word::XRevision > >::iterator it = aRevisions.begin();
9429
+ for( ; it != aRevisions.end(); it++ )
9431
+ uno::Reference< word::XRevision > xRevision( *it );
9432
+ xRevision->Accept();
9436
+void SAL_CALL SwVbaRevisions::RejectAll( ) throw (css::uno::RuntimeException)
9438
+ throw uno::RuntimeException();
9442
+SwVbaRevisions::getServiceImplName()
9444
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRevisions") );
9448
+css::uno::Sequence<rtl::OUString>
9449
+SwVbaRevisions::getServiceNames()
9451
+ static uno::Sequence< rtl::OUString > sNames;
9452
+ if ( sNames.getLength() == 0 )
9454
+ sNames.realloc( 1 );
9455
+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Revisions") );
9459
diff --git sw/source/ui/vba/vbarevisions.hxx sw/source/ui/vba/vbarevisions.hxx
9460
new file mode 100644
9461
index 0000000..88db794
9463
+++ sw/source/ui/vba/vbarevisions.hxx
9465
+/*************************************************************************
9467
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9469
+ * Copyright 2008 by Sun Microsystems, Inc.
9471
+ * OpenOffice.org - a multi-platform office productivity suite
9476
+ * This file is part of OpenOffice.org.
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.
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).
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.
9493
+ ************************************************************************/
9494
+#ifndef SW_VBA_PANES_HXX
9495
+#define SW_VBA_PANES_HXX
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>
9503
+typedef CollTestImplHelper< ooo::vba::word::XRevisions > SwVbaRevisions_BASE;
9505
+class SwVbaRevisions : public SwVbaRevisions_BASE
9508
+ css::uno::Reference< css::frame::XModel > mxModel;
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 );
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() {}
9517
+ virtual void SAL_CALL AcceptAll( ) throw (css::uno::RuntimeException);
9518
+ virtual void SAL_CALL RejectAll( ) throw (css::uno::RuntimeException);
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);
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();
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
9535
+++ sw/source/ui/vba/vbarow.cxx
9537
+/*************************************************************************
9539
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9541
+ * Copyright 2008 by Sun Microsystems, Inc.
9543
+ * OpenOffice.org - a multi-platform office productivity suite
9548
+ * This file is part of OpenOffice.org.
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.
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).
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.
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"
9577
+using namespace ::ooo::vba;
9578
+using namespace ::com::sun::star;
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 )
9583
+ mxTableRows = mxTextTable->getRows();
9584
+ mxRowProps.set( mxTableRows->getByIndex( mnIndex ), uno::UNO_QUERY_THROW );
9587
+SwVbaRow::~SwVbaRow()
9591
+uno::Any SAL_CALL SwVbaRow::getHeight() throw (css::uno::RuntimeException)
9593
+ if( getHeightRule() == word::WdRowHeightRule::wdRowHeightAuto )
9594
+ return uno::makeAny( sal_Int32( word::WdConstants::wdUndefined ) );
9596
+ sal_Int32 nHeight = 0;
9597
+ mxRowProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ) ) >>= nHeight;
9598
+ return uno::makeAny( (float)Millimeter::getInPoints( nHeight ) );
9601
+void SAL_CALL SwVbaRow::setHeight( const uno::Any& _height ) throw (css::uno::RuntimeException)
9604
+ _height >>= height;
9606
+ sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( height );
9607
+ mxRowProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ), uno::makeAny( nHeight ) );
9610
+::sal_Int32 SAL_CALL SwVbaRow::getHeightRule() throw (css::uno::RuntimeException)
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;
9617
+void SAL_CALL SwVbaRow::setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException)
9619
+ sal_Bool isAutoHeight = ( _heightrule == word::WdRowHeightRule::wdRowHeightAuto );
9620
+ mxRowProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoHeight") ), uno::makeAny( isAutoHeight ) );
9624
+SwVbaRow::Select( ) throw ( uno::RuntimeException )
9626
+ SelectRow( getCurrentWordDoc(mxContext), mxTextTable, mnIndex, mnIndex );
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 )
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 ) );
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 );
9644
+ uno::Reference< view::XSelectionSupplier > xSelection( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
9645
+ xSelection->select( uno::makeAny( xSelRange ) );
9648
+void SAL_CALL SwVbaRow::SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException)
9650
+ setHeightRule( heightrule );
9651
+ setHeight( uno::makeAny( height ) );
9655
+SwVbaRow::getServiceImplName()
9657
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRow") );
9661
+uno::Sequence< rtl::OUString >
9662
+SwVbaRow::getServiceNames()
9664
+ static uno::Sequence< rtl::OUString > aServiceNames;
9665
+ if ( aServiceNames.getLength() == 0 )
9667
+ aServiceNames.realloc( 1 );
9668
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Row" ) );
9670
+ return aServiceNames;
9673
diff --git sw/source/ui/vba/vbarow.hxx sw/source/ui/vba/vbarow.hxx
9674
new file mode 100644
9675
index 0000000..cfbfb4d
9677
+++ sw/source/ui/vba/vbarow.hxx
9679
+/*************************************************************************
9681
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9683
+ * Copyright 2008 by Sun Microsystems, Inc.
9685
+ * OpenOffice.org - a multi-platform office productivity suite
9690
+ * This file is part of OpenOffice.org.
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.
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).
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.
9707
+ ************************************************************************/
9708
+#ifndef SW_VBA_ROW_HXX
9709
+#define SW_VBA_ROW_HXX
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>
9717
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRow > SwVbaRow_BASE;
9719
+class SwVbaRow : public SwVbaRow_BASE
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;
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();
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);
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);
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);
9743
+ // XHelperInterface
9744
+ virtual rtl::OUString& getServiceImplName();
9745
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
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
9752
+++ sw/source/ui/vba/vbarows.cxx
9754
+/*************************************************************************
9756
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9758
+ * Copyright 2008 by Sun Microsystems, Inc.
9760
+ * OpenOffice.org - a multi-platform office productivity suite
9765
+ * This file is part of OpenOffice.org.
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.
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).
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.
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"
9794
+using namespace ::ooo::vba;
9795
+using namespace ::com::sun::star;
9797
+class RowsEnumWrapper : public EnumerationHelper_BASE
9799
+ uno::Reference< text::XTextTable > mxTextTable;
9800
+ uno::Reference< container::XIndexAccess > mxIndexAccess;
9801
+ uno::WeakReference< XHelperInterface > mxParent;
9802
+ uno::Reference< uno::XComponentContext > mxContext;
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 )
9808
+ mxIndexAccess.set( mxTextTable->getRows(), uno::UNO_QUERY );
9810
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
9812
+ return ( nIndex < mxIndexAccess->getCount() );
9815
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
9817
+ if( nIndex < mxIndexAccess->getCount() )
9819
+ return uno::makeAny( uno::Reference< word::XRow > ( new SwVbaRow( mxParent, mxContext, mxTextTable, nIndex++ ) ) );
9821
+ throw container::NoSuchElementException();
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 )
9827
+ mnStartRowIndex = 0;
9828
+ mnEndRowIndex = m_xIndexAccess->getCount() - 1;
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 )
9833
+ if( mnEndRowIndex < mnStartRowIndex )
9834
+ throw uno::RuntimeException();
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
9842
+::sal_Int32 SAL_CALL SwVbaRows::getAlignment() throw (uno::RuntimeException)
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 )
9850
+ case text::HoriOrientation::CENTER:
9852
+ nRet = word::WdRowAlignment::wdAlignRowCenter;
9855
+ case text::HoriOrientation::RIGHT:
9857
+ nRet = word::WdRowAlignment::wdAlignRowRight;
9862
+ nRet = word::WdRowAlignment::wdAlignRowLeft;
9868
+void SAL_CALL SwVbaRows::setAlignment( ::sal_Int32 _alignment ) throw (uno::RuntimeException)
9870
+ sal_Int16 nAlignment = text::HoriOrientation::LEFT;
9871
+ switch( _alignment )
9873
+ case word::WdRowAlignment::wdAlignRowCenter:
9875
+ nAlignment = text::HoriOrientation::CENTER;
9878
+ case word::WdRowAlignment::wdAlignRowRight:
9880
+ nAlignment = text::HoriOrientation::RIGHT;
9885
+ nAlignment = text::HoriOrientation::LEFT;
9888
+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
9889
+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrient") ), uno::makeAny( nAlignment ) );
9892
+uno::Any SAL_CALL SwVbaRows::getAllowBreakAcrossPages() throw (uno::RuntimeException)
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 )
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;
9903
+ bAllowBreak = bSplit;
9905
+ if( bSplit != bAllowBreak )
9907
+ sal_Int32 nRet = word::WdConstants::wdUndefined;
9908
+ return uno::makeAny( nRet );
9911
+ return uno::makeAny( bAllowBreak );
9914
+void SAL_CALL SwVbaRows::setAllowBreakAcrossPages( const uno::Any& _allowbreakacrosspages ) throw (uno::RuntimeException)
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 )
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 ) );
9926
+float SAL_CALL SwVbaRows::getSpaceBetweenColumns() throw (uno::RuntimeException)
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 ) );
9938
+void SAL_CALL SwVbaRows::setSpaceBetweenColumns( float _spacebetweencolumns ) throw (uno::RuntimeException)
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 )
9946
+ sal_Int32 nColumns = aTableHelper.getTabColumnsCount( row );
9947
+ for( sal_Int32 column = 0; column < nColumns; ++column )
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 ) );
9956
+void SAL_CALL SwVbaRows::Delete( ) throw (uno::RuntimeException)
9958
+ mxTableRows->removeByIndex( mnStartRowIndex, getCount() );
9961
+void SAL_CALL SwVbaRows::SetLeftIndent( float LeftIndent, ::sal_Int32 RulerStyle ) throw (uno::RuntimeException)
9963
+ uno::Reference< word::XColumns > xColumns( new SwVbaColumns( getParent(), mxContext, mxTextTable, mxTextTable->getColumns() ) );
9964
+ sal_Int32 nIndent = (sal_Int32)( LeftIndent );
9965
+ switch( RulerStyle )
9967
+ case word::WdRulerStyle::wdAdjustFirstColumn:
9969
+ setIndentWithAdjustFirstColumn( xColumns, nIndent );
9972
+ case word::WdRulerStyle::wdAdjustNone:
9974
+ setIndentWithAdjustNone( nIndent );
9977
+ case word::WdRulerStyle::wdAdjustProportional:
9979
+ setIndentWithAdjustProportional( xColumns, nIndent );
9982
+ case word::WdRulerStyle::wdAdjustSameWidth:
9984
+ setIndentWithAdjustSameWidth( xColumns, nIndent );
9989
+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
9994
+void SwVbaRows::setIndentWithAdjustNone( sal_Int32 indent ) throw (uno::RuntimeException)
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 ) );
10003
+ void SwVbaRows::setIndentWithAdjustFirstColumn( const uno::Reference< word::XColumns >& xColumns, sal_Int32 indent ) throw (uno::RuntimeException)
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 );
10014
+ void SwVbaRows::setIndentWithAdjustProportional( const uno::Reference< word::XColumns >& xColumns, sal_Int32 indent ) throw (uno::RuntimeException)
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;
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++ )
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 );
10034
+ // set the width and position of the table
10035
+ setIndentWithAdjustNone( indent );
10036
+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ), uno::makeAny( nNewWidth ) );
10039
+ void SwVbaRows::setIndentWithAdjustSameWidth( const uno::Reference< word::XColumns >& xColumns, sal_Int32 indent ) throw (uno::RuntimeException)
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;
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++ )
10053
+ uno::Reference< word::XColumn > xColumn( xCol->Item( uno::makeAny( i ), uno::Any() ), uno::UNO_QUERY_THROW );
10054
+ xColumn->setWidth( nNewColWidth );
10057
+ // set the width and position of the table
10058
+ setIndentWithAdjustNone( indent );
10059
+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ), uno::makeAny( nNewWidth ) );
10062
+void SAL_CALL SwVbaRows::Select( ) throw (uno::RuntimeException)
10064
+ SwVbaRow::SelectRow( getCurrentWordDoc(mxContext), mxTextTable, mnStartRowIndex, mnEndRowIndex );
10067
+::sal_Int32 SAL_CALL SwVbaRows::getCount() throw (uno::RuntimeException)
10069
+ return ( mnEndRowIndex - mnStartRowIndex + 1 );
10072
+uno::Any SAL_CALL SwVbaRows::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
10074
+ sal_Int32 nIndex = 0;
10075
+ if( ( Index1 >>= nIndex ) == sal_True )
10077
+ if( nIndex <= 0 || nIndex > getCount() )
10079
+ throw lang::IndexOutOfBoundsException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
10081
+ return uno::makeAny( uno::Reference< word::XRow >( new SwVbaRow( this, mxContext, mxTextTable, nIndex - 1 ) ) );
10083
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
10086
+// XEnumerationAccess
10088
+SwVbaRows::getElementType() throw (uno::RuntimeException)
10090
+ return word::XRow::static_type(0);
10092
+uno::Reference< container::XEnumeration >
10093
+SwVbaRows::createEnumeration() throw (uno::RuntimeException)
10095
+ return new RowsEnumWrapper( this, mxContext, mxTextTable );
10099
+SwVbaRows::createCollectionObject( const uno::Any& aSource )
10105
+SwVbaRows::getServiceImplName()
10107
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRows") );
10108
+ return sImplName;
10111
+uno::Sequence<rtl::OUString>
10112
+SwVbaRows::getServiceNames()
10114
+ static uno::Sequence< rtl::OUString > sNames;
10115
+ if ( sNames.getLength() == 0 )
10117
+ sNames.realloc( 1 );
10118
+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Rows") );
10122
diff --git sw/source/ui/vba/vbarows.hxx sw/source/ui/vba/vbarows.hxx
10123
new file mode 100644
10124
index 0000000..ccff1ef
10126
+++ sw/source/ui/vba/vbarows.hxx
10128
+/*************************************************************************
10130
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10132
+ * Copyright 2008 by Sun Microsystems, Inc.
10134
+ * OpenOffice.org - a multi-platform office productivity suite
10139
+ * This file is part of OpenOffice.org.
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.
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).
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.
10156
+ ************************************************************************/
10157
+#ifndef SW_VBA_ROWS_HXX
10158
+#define SW_VBA_ROWS_HXX
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>
10167
+typedef CollTestImplHelper< ooo::vba::word::XRows > SwVbaRows_BASE;
10169
+class SwVbaRows : public SwVbaRows_BASE
10172
+ css::uno::Reference< css::text::XTextTable > mxTextTable;
10173
+ css::uno::Reference< css::table::XTableRows > mxTableRows;
10174
+ sal_Int32 mnStartRowIndex;
10175
+ sal_Int32 mnEndRowIndex;
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);
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() {}
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);
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);
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);
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();
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
10220
#include <vbahelper/vbahelper.hxx>
10221
#include <tools/diagnose_ex.h>
10222
#include "vbapagesetup.hxx"
10223
+#include "vbaheadersfooters.hxx"
10225
using namespace ::ooo::vba;
10226
using namespace ::com::sun::star;
10227
@@ -53,14 +54,20 @@ void SAL_CALL SwVbaSection::setProtectedForForms( ::sal_Bool /*_protectedforform
10231
-uno::Any SAL_CALL SwVbaSection::Headers( ) throw (uno::RuntimeException)
10232
+uno::Any SAL_CALL SwVbaSection::Headers( const uno::Any& index ) throw (uno::RuntimeException)
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 );
10241
-uno::Any SAL_CALL SwVbaSection::Footers( ) throw (uno::RuntimeException)
10242
+uno::Any SAL_CALL SwVbaSection::Footers( const uno::Any& index ) throw (uno::RuntimeException)
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 );
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);
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);
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:
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 )
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 );
10284
~SectionCollectionHelper(){}
10287
@@ -138,6 +147,10 @@ SwVbaSections::SwVbaSections( const uno::Reference< XHelperInterface >& xParent,
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 )
10296
SwVbaSections::PageSetup( ) throw (uno::RuntimeException)
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
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>
10309
typedef CollTestImplHelper< ooo::vba::word::XSections > SwVbaSections_BASE;
10310
@@ -45,6 +46,7 @@ private:
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() {}
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
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"
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>
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;
10371
_extend >>= nExtend;
10372
+ sal_Bool bExtend = ( nExtend == word::WdMovementType::wdExtend ) ? sal_True : sal_False;
10376
case word::WdUnits::wdStory:
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 );
10390
case word::WdUnits::wdLine:
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 );
10400
@@ -160,23 +177,25 @@ SwVbaSelection::EndKey( const uno::Any& _unit, const uno::Any& _extend ) throw (
10401
sal_Int32 nExtend = word::WdMovementType::wdMove;
10403
_extend >>= nExtend;
10404
+ sal_Bool bExtend = ( nExtend == word::WdMovementType::wdExtend ) ? sal_True : sal_False;
10408
case word::WdUnits::wdStory:
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 );
10423
case word::WdUnits::wdLine:
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 );
10433
@@ -188,14 +207,161 @@ SwVbaSelection::EndKey( const uno::Any& _unit, const uno::Any& _extend ) throw (
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 )
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 ) )
10450
+ case word::WdUnits::wdCharacter:
10452
+ if( HasSelection() )
10454
+ mxTextViewCursor->goRight( nCount, sal_True );
10459
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
10463
rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Delete"));
10464
dispatchRequests( mxModel,url );
10467
-void SwVbaSelection::NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw ( uno::RuntimeException )
10469
+SwVbaSelection::Move( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend, word::E_DIRECTION eDirection ) throw ( uno::RuntimeException )
10471
+ sal_Int32 nUnit = word::WdUnits::wdCharacter;
10472
+ sal_Int32 nCount = 1;
10473
+ sal_Int32 nExtend = word::WdMovementType::wdMove;
10475
+ if( _unit.hasValue() )
10477
+ if( _count.hasValue() )
10478
+ _count >>= nCount;
10479
+ if( _extend.hasValue() )
10480
+ _extend >>= nExtend;
10482
+ if( nCount == 0 )
10485
+ sal_Bool bExpand = ( nExtend == word::WdMovementType::wdMove ) ? sal_False : sal_True;
10489
+ case word::WdUnits::wdCell:
10491
+ if( nExtend == word::WdMovementType::wdExtend )
10493
+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
10496
+ NextCell( nCount, eDirection );
10499
+ case word::WdUnits::wdLine:
10501
+ if( eDirection == word::MOVE_LEFT || eDirection == word::MOVE_RIGHT )
10503
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
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 );
10512
+ case word::WdUnits::wdCharacter:
10514
+ if( eDirection == word::MOVE_UP || eDirection == word::MOVE_DOWN )
10516
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
10518
+ if( word::gotoSelectedObjectAnchor( mxModel ) )
10522
+ uno::Reference< view::XViewCursor > xViewCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
10523
+ if( eDirection == word::MOVE_LEFT )
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() )
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() )
10535
+ uno::Reference< text::XTextRange > xRange( xTextTable->getCellByName( xTextTableCursor->getRangeName()), uno::UNO_QUERY_THROW );
10536
+ mxTextViewCursor->gotoRange( xRange->getStart(), bExpand );
10540
+ xViewCursor->goLeft( nCount, bExpand );
10542
+ else if( eDirection == word::MOVE_RIGHT )
10543
+ xViewCursor->goRight( nCount, bExpand );
10546
+ case word::WdUnits::wdWord:
10547
+ case word::WdUnits::wdParagraph:
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 )
10554
+ if( eDirection == word::MOVE_LEFT || eDirection == word::MOVE_RIGHT )
10556
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
10558
+ uno::Reference< text::XParagraphCursor > xParagraphCursor( xTextCursor, uno::UNO_QUERY_THROW );
10559
+ for( sal_Int32 i=0; i<nCount; i++ )
10561
+ if( ( eDirection == word::MOVE_UP ) && ( xParagraphCursor->gotoPreviousParagraph( bExpand ) == sal_False ) )
10563
+ else if( ( eDirection == word::MOVE_DOWN ) && ( xParagraphCursor->gotoNextParagraph( bExpand ) == sal_False ) )
10567
+ else if( nUnit == word::WdUnits::wdWord )
10569
+ if( eDirection == word::MOVE_UP || eDirection == word::MOVE_DOWN )
10571
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
10573
+ uno::Reference< text::XWordCursor > xWordCursor( xTextCursor, uno::UNO_QUERY_THROW );
10574
+ for( sal_Int32 i=0; i<nCount; i++ )
10576
+ if( (eDirection == word::MOVE_LEFT ) && ( xWordCursor->gotoPreviousWord( bExpand ) == sal_False ) )
10578
+ else if( ( eDirection == word::MOVE_RIGHT ) && ( xWordCursor->gotoNextWord( bExpand ) == sal_False ) )
10582
+ mxTextViewCursor->gotoRange( xTextCursor->getStart(), sal_False );
10583
+ mxTextViewCursor->gotoRange( xTextCursor->getEnd(), sal_True );
10588
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
10594
+void SwVbaSelection::NextCell( sal_Int32 nCount, word::E_DIRECTION eDirection ) throw ( uno::RuntimeException )
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 )
10603
+ case word::MOVE_LEFT:
10605
xTextTableCursor->goLeft( nCount, sal_False );
10609
+ case word::MOVE_RIGHT:
10611
xTextTableCursor->goRight( nCount, sal_False );
10615
+ case word::MOVE_UP:
10617
xTextTableCursor->goUp( nCount, sal_False );
10621
+ case word::MOVE_DOWN:
10623
xTextTableCursor->goDown( nCount, sal_False );
10625
@@ -248,61 +414,29 @@ void SwVbaSelection::NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw
10627
SwVbaSelection::MoveRight( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
10629
- sal_Int32 nUnit = word::WdUnits::wdCharacter;
10630
sal_Int32 nCount = 1;
10631
- sal_Int32 nExtend = word::WdMovementType::wdMove;
10633
- if( _unit.hasValue() )
10635
if( _count.hasValue() )
10637
- if( _extend.hasValue() )
10638
- _extend >>= nExtend;
10645
- // TODO: call MoveLeft;
10646
MoveLeft( _unit, uno::makeAny( -nCount ), _extend );
10652
- case word::WdUnits::wdCell:
10654
- if( nExtend == word::WdMovementType::wdExtend )
10656
- DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
10659
- NextCell( nCount, MOVE_RIGHT );
10664
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
10669
+ Move( _unit, _count, _extend, word::MOVE_RIGHT );
10673
SwVbaSelection::MoveLeft( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
10675
- sal_Int32 nUnit = word::WdUnits::wdCharacter;
10676
sal_Int32 nCount = 1;
10677
- sal_Int32 nExtend = word::WdMovementType::wdMove;
10679
- if( _unit.hasValue() )
10681
if( _count.hasValue() )
10683
- if( _extend.hasValue() )
10684
- _extend >>= nExtend;
10688
@@ -313,67 +447,47 @@ SwVbaSelection::MoveLeft( const uno::Any& _unit, const uno::Any& _count, const u
10694
- case word::WdUnits::wdCell:
10696
- if( nExtend == word::WdMovementType::wdExtend )
10698
- DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
10701
- NextCell( nCount, MOVE_LEFT );
10706
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
10711
+ Move( _unit, _count, _extend, word::MOVE_LEFT );
10715
SwVbaSelection::MoveDown( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
10717
- sal_Int32 nUnit = word::WdUnits::wdCharacter;
10718
sal_Int32 nCount = 1;
10719
- sal_Int32 nExtend = word::WdMovementType::wdMove;
10721
- if( _unit.hasValue() )
10723
if( _count.hasValue() )
10725
- if( _extend.hasValue() )
10726
- _extend >>= nExtend;
10733
- // TODO: call MoveLeft;
10734
- //MoveUp( _unit, uno::makeAny( -nCount ), _extend );
10735
+ MoveUp( _unit, uno::makeAny( -nCount ), _extend );
10740
+ Move( _unit, _count, _extend, word::MOVE_DOWN );
10744
+SwVbaSelection::MoveUp( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
10746
+ sal_Int32 nCount = 1;
10748
+ if( _count.hasValue() )
10749
+ _count >>= nCount;
10751
+ if( nCount == 0 )
10756
- case word::WdUnits::wdLine:
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 );
10765
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
10768
+ MoveDown( _unit, uno::makeAny( -nCount ), _extend );
10773
+ Move( _unit, _count, _extend, word::MOVE_UP );
10777
@@ -425,16 +539,17 @@ SwVbaSelection::getFind() throw ( uno::RuntimeException )
10778
return uno::Reference< word::XFind >( new SwVbaFind( this, mxContext, mxModel, xTextRange ) );
10781
-uno::Reference< word::XStyle > SAL_CALL
10783
SwVbaSelection::getStyle() throw ( uno::RuntimeException )
10785
return getRange()->getStyle();
10789
-SwVbaSelection::setStyle( const uno::Reference< word::XStyle >& rStyle ) throw ( uno::RuntimeException )
10790
+SwVbaSelection::setStyle( const uno::Any& rStyle ) throw ( uno::RuntimeException )
10792
- return getRange()->setStyle( rStyle );
10793
+ uno::Reference< beans::XPropertySet > xParaProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
10794
+ return SwVbaStyle::setStyle( xParaProps, rStyle );
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() )
10802
- sal_Int32 nPage = 0;
10805
- case word::WdGoToDirection::wdGoToLast:
10807
- nPage = nLastPage;
10810
- case word::WdGoToDirection::wdGoToNext:
10812
- nPage = nCurrPage + 1;
10815
- case word::WdGoToDirection::wdGoToPrevious:
10817
- nPage = nCurrPage - 1;
10827
- if( nPage > nLastPage )
10828
- nPage = nLastPage;
10829
- xPageCursor->jumpToPage( ( sal_Int16 )( nPage ) );
10831
+ sal_Int32 nPage = 0;
10834
+ case word::WdGoToDirection::wdGoToLast:
10836
+ nPage = nLastPage;
10839
+ case word::WdGoToDirection::wdGoToNext:
10842
+ nPage = nCurrPage + nCount;
10844
+ nPage = nCurrPage + 1;
10847
+ case word::WdGoToDirection::wdGoToPrevious:
10850
+ nPage = nCurrPage - nCount;
10852
+ nPage = nCurrPage - 1;
10860
+ if( _name.hasValue() )
10862
+ rtl::OUString sName;
10864
+ sal_Int32 nName = sName.toInt32();
10870
+ if( nPage > nLastPage )
10871
+ nPage = nLastPage;
10872
+ xPageCursor->jumpToPage( ( sal_Int16 )( nPage ) );
10875
case word::WdGoToItem::wdGoToSection:
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;
10888
+ case word::WdGoToDirection::wdGoToAbsolute:
10890
+ // currently only support this type
10891
+ if( nCount == 1 )
10901
+ xPageCursor->jumpToPage( ( sal_Int16 )( nPage ) );
10903
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
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 ) );
10912
+ case word::WdInformation::wdWithInTable:
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 );
10920
+ result = uno::makeAny( sal_False );
10923
+ case word::WdInformation::wdHeaderFooterType:
10925
+ uno::Reference< word::XView > xView( new SwVbaView( this, mxContext, mxModel ) );
10926
+ sal_Int32 nView = xView->getSeekView();
10927
+ sal_Int32 nHeaderFooterType = 0;
10930
+ case word::WdSeekView::wdSeekMainDocument:
10932
+ nHeaderFooterType = -1; // not in a header or footer
10935
+ case word::WdSeekView::wdSeekEvenPagesHeader:
10937
+ nHeaderFooterType = 0; // even page header
10940
+ case word::WdSeekView::wdSeekPrimaryHeader:
10942
+ nHeaderFooterType = 1; // odd page header
10945
+ case word::WdSeekView::wdSeekEvenPagesFooter:
10947
+ nHeaderFooterType = 2; // even page footer
10950
+ case word::WdSeekView::wdSeekPrimaryFooter:
10952
+ nHeaderFooterType = 3; // odd page footer
10955
+ case word::WdSeekView::wdSeekFirstPageHeader:
10956
+ case word::WdSeekView::wdSeekFirstPageFooter:
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 )
10967
+ nHeaderFooterType = 4;
10969
+ nHeaderFooterType = 1;
10974
+ nHeaderFooterType = 5;
10976
+ nHeaderFooterType = 3;
10982
+ nHeaderFooterType = -1;
10985
+ result = uno::makeAny( nHeaderFooterType );
10989
throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
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 );
10998
- if ( !xTextTableCursor.is() )
10999
- throw uno::RuntimeException();
11001
sal_Int32 nIndex = 0;
11003
@@ -582,6 +808,24 @@ SwVbaSelection::Tables( const uno::Any& aIndex ) throw (uno::RuntimeException)
11006
throw uno::RuntimeException();
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() )
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;
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 );
11022
+ if ( !xTextTableCursor.is() )
11023
+ throw uno::RuntimeException();
11025
SwXTextTableCursor* pTTCursor = dynamic_cast< SwXTextTableCursor* >( xTextTableCursor.get() );
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 )
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 ) )
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;
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)
11051
uno::Reference< drawing::XShapes > xShapes( mxModel->getCurrentSelection(), uno::UNO_QUERY );
11053
if ( !xShapes.is() )
11054
- throw uno::RuntimeException();
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 );
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 );
11068
+void SAL_CALL SwVbaSelection::SelectRow() throw (uno::RuntimeException)
11070
+ uno::Reference< word::XRows > xRows( Rows( uno::Any() ), uno::UNO_QUERY_THROW );
11074
+void SAL_CALL SwVbaSelection::SelectColumn() throw (uno::RuntimeException)
11076
+ uno::Reference< word::XColumns > xColumns( Columns( uno::Any() ), uno::UNO_QUERY_THROW );
11077
+ xColumns->Select();
11080
+uno::Any SAL_CALL SwVbaSelection::Rows( const uno::Any& index ) throw (uno::RuntimeException)
11082
+ rtl::OUString sTLName;
11083
+ rtl::OUString sBRName;
11084
+ GetSelectedCellRange( sTLName, sBRName );
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 )
11093
+ nEndRow = aTableHelper.getTabRowIndex( sBRName );
11097
+ nEndRow = nStartRow;
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 );
11106
+uno::Any SAL_CALL SwVbaSelection::Columns( const uno::Any& index ) throw (uno::RuntimeException)
11108
+ rtl::OUString sTLName;
11109
+ rtl::OUString sBRName;
11110
+ GetSelectedCellRange( sTLName, sBRName );
11111
+ sal_Int32 nStartColumn = 0;
11112
+ sal_Int32 nEndColumn = 0;
11114
+ uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
11115
+ SwVbaTableHelper aTableHelper( xTextTable );
11116
+ nStartColumn = aTableHelper.getTabColIndex( sTLName );
11117
+ if( sBRName.getLength() > 0 )
11119
+ nEndColumn = aTableHelper.getTabColIndex( sBRName );
11123
+ nEndColumn = nStartColumn;
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 );
11132
+uno::Reference< text::XTextTable > SwVbaSelection::GetXTextTable() throw( uno::RuntimeException )
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;
11140
+sal_Bool SwVbaSelection::IsInTable() throw( uno::RuntimeException )
11142
+ uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
11143
+ if( xTextTable.is() )
11145
+ return sal_False;
11148
+sal_Bool SwVbaSelection::HasSelection() throw( uno::RuntimeException )
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;
11158
+void SwVbaSelection::GetSelectedCellRange( rtl::OUString& sTLName, rtl::OUString& sBRName ) throw( uno::RuntimeException )
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( );
11166
+ uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
11167
+ if( xTextTableCursor.is() )
11169
+ String sRange( xTextTableCursor->getRangeName() );
11170
+ if( sRange.GetTokenCount(':') > 0 )
11172
+ sTLName = sRange.GetToken(0, ':');
11173
+ sBRName = sRange.GetToken(1, ':');
11176
+ if( !sTLName.getLength() )
11178
+ uno::Reference< table::XCell > xCell;
11179
+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cell") ) ) >>= xCell;
11180
+ if( !xCell.is() )
11182
+ throw uno::RuntimeException( );
11184
+ uno::Reference< beans::XPropertySet > xCellProps( xCell, uno::UNO_QUERY_THROW );
11185
+ xCellProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellName") ) ) >>= sTLName;
11189
+uno::Any SAL_CALL SwVbaSelection::Cells( const uno::Any& index ) throw (uno::RuntimeException)
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;
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 )
11205
+ nRight = aTableHelper.getTabColIndex( sBRName );
11206
+ nBottom = aTableHelper.getTabRowIndex( sBRName );
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 );
11220
+void SAL_CALL SwVbaSelection::Copy( ) throw (uno::RuntimeException)
11222
+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Copy"));
11223
+ dispatchRequests( mxModel,url );
11226
+void SAL_CALL SwVbaSelection::CopyAsPicture( ) throw (uno::RuntimeException)
11228
+ // seems not support in Writer
11232
+void SAL_CALL SwVbaSelection::Paste( ) throw (uno::RuntimeException)
11234
+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Paste"));
11235
+ dispatchRequests( mxModel,url );
11238
+void SAL_CALL SwVbaSelection::Collapse( const uno::Any& Direction ) throw (uno::RuntimeException)
11240
+ if( word::gotoSelectedObjectAnchor( mxModel ) )
11243
+ sal_Int32 nDirection = word::WdCollapseDirection::wdCollapseStart;
11244
+ if( Direction.hasValue() )
11245
+ Direction >>= nDirection;
11247
+ uno::Reference< text::XTextViewCursor > xTextViewCursor = word::getXTextViewCursor( mxModel );
11248
+ if( nDirection == word::WdCollapseDirection::wdCollapseStart )
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();
11255
+ else if( nDirection == word::WdCollapseDirection::wdCollapseEnd )
11257
+ uno::Reference< text::XTextRange > xTextRange = mxTextViewCursor->getEnd();
11258
+ xTextViewCursor->gotoRange( xTextRange, sal_False );
11259
+ xTextViewCursor->collapseToEnd();
11263
+ throw uno::RuntimeException();
11267
+void SAL_CALL SwVbaSelection::WholeStory( ) throw (uno::RuntimeException)
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() )
11276
+ uno::Reference< text::XTextTable > xTextTable( xParaEnum->nextElement(), uno::UNO_QUERY );
11277
+ if( xTextTable.is() )
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 );
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 );
11292
+::sal_Bool SAL_CALL SwVbaSelection::InRange( const uno::Reference< ::ooo::vba::word::XRange >& Range ) throw (uno::RuntimeException)
11294
+ return getRange()->InRange( Range );
11297
+void SAL_CALL SwVbaSelection::SplitTable( ) throw (uno::RuntimeException)
11299
+ if( !IsInTable() )
11300
+ throw uno::RuntimeException();
11302
+ SwDocShell* pDocShell = word::getDocShell( mxModel );
11305
+ SwFEShell* pFEShell = pDocShell->GetFEShell();
11308
+ pFEShell->SplitTable( HEADLINE_CNTNTCOPY );
11314
+SwVbaSelection::Paragraphs( const uno::Any& aIndex ) throw (uno::RuntimeException)
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();
11321
+ sal_Int32 nIndex = 0;
11322
+ aIndex >>= nIndex;
11326
+ if ( nIndex != 1 )
11327
+ throw uno::RuntimeException();
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 );
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 );
11339
+ aRet <<= xParagraph;
11344
SwVbaSelection::getServiceImplName()
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"
11362
typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XSelection > SwVbaSelection_BASE;
11364
@@ -49,17 +51,14 @@ private:
11365
css::uno::Reference< css::text::XTextViewCursor > mxTextViewCursor;
11366
css::uno::Reference< ooo::vba::word::XRange > mxRange;
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 );
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);
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"
11442
using namespace ::ooo::vba;
11443
using namespace ::com::sun::star;
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 )
11449
mxStyle.set( _xPropertySet, uno::UNO_QUERY_THROW );
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") ) ) )
11457
nType = word::WdStyleType::wdStyleTypeList;
11460
@@ -99,10 +102,31 @@ SwVbaStyle::getFont() throw ( uno::RuntimeException )
11461
return new SwVbaFont( mxParent, mxContext, aColors.getPalette(), mxStyleProps );
11464
-void SwVbaStyle::setStyle( const uno::Reference< beans::XPropertySet >& xTCProps, const uno::Reference< ooo::vba::word::XStyle >& xStyle )throw (uno::RuntimeException)
11466
+void SAL_CALL SwVbaStyle::LinkToListTemplate( const uno::Reference< word::XListTemplate >& /*ListTemplate*/, const uno::Any& /*ListLevelNumber*/ ) throw (uno::RuntimeException)
11470
+void SwVbaStyle::setStyle( const uno::Reference< beans::XPropertySet >& xParaProps, const uno::Any& rStyle )throw (uno::RuntimeException)
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 )
11478
+ sStyle = xStyle->getName();
11482
+ rStyle >>= sStyle;
11485
+ if( sStyle.getLength() )
11487
+ xParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaStyleName") ), uno::makeAny( sStyle ) );
11491
+ throw uno::RuntimeException();
11494
rtl::OUString SwVbaStyle::getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType )
11495
@@ -132,6 +156,115 @@ rtl::OUString SwVbaStyle::getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType )
11499
+::rtl::OUString SAL_CALL SwVbaStyle::getNameLocal() throw (uno::RuntimeException)
11501
+ rtl::OUString sNameLocal;
11502
+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DisplayName") ) ) >>= sNameLocal;
11503
+ return sNameLocal;
11506
+void SAL_CALL SwVbaStyle::setNameLocal( const ::rtl::OUString& _namelocal ) throw (uno::RuntimeException)
11508
+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DisplayName") ), uno::makeAny( _namelocal ) );
11511
+uno::Reference< word::XParagraphFormat > SAL_CALL SwVbaStyle::getParagraphFormat() throw (uno::RuntimeException)
11513
+ if( word::WdStyleType::wdStyleTypeParagraph == getType() )
11515
+ uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW );
11516
+ return uno::Reference< word::XParagraphFormat >( new SwVbaParagraphFormat( this, mxContext, xTextDocument, mxStyleProps ) );
11520
+ throw uno::RuntimeException();
11522
+ return uno::Reference< word::XParagraphFormat >();
11525
+::sal_Bool SAL_CALL SwVbaStyle::getAutomaticallyUpdate() throw (uno::RuntimeException)
11527
+ sal_Bool isAutoUpdate = sal_False;
11528
+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoUpdate") ) ) >>= isAutoUpdate;
11529
+ return isAutoUpdate;
11532
+void SAL_CALL SwVbaStyle::setAutomaticallyUpdate( ::sal_Bool _automaticallyupdate ) throw (uno::RuntimeException)
11534
+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoUpdate") ), uno::makeAny( _automaticallyupdate ) );
11537
+uno::Any SAL_CALL SwVbaStyle::getBaseStyle() throw (uno::RuntimeException)
11540
+ rtl::OUString sBaseStyle;
11541
+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParentStyle") ) ) >>= sBaseStyle;
11542
+ if( sBaseStyle.getLength() > 0 )
11544
+ uno::Reference< XCollection > xCol( new SwVbaStyles( this, mxContext, mxModel ) );
11545
+ return xCol->Item( uno::makeAny( sBaseStyle ), uno::Any() );
11549
+ throw uno::RuntimeException();
11551
+ return uno::Any();
11554
+void SAL_CALL SwVbaStyle::setBaseStyle( const uno::Any& _basestyle ) throw (uno::RuntimeException)
11556
+ uno::Reference< word::XStyle > xStyle;
11557
+ _basestyle >>= xStyle;
11558
+ if( xStyle.is() )
11560
+ rtl::OUString sBaseStyle = xStyle->getName();
11561
+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParentStyle") ), uno::makeAny( sBaseStyle ) );
11565
+ throw uno::RuntimeException();
11569
+uno::Any SAL_CALL SwVbaStyle::getNextParagraphStyle() throw (uno::RuntimeException)
11572
+ rtl::OUString sFollowStyle;
11573
+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FollowStyle") ) ) >>= sFollowStyle;
11574
+ if( sFollowStyle.getLength() > 0 )
11576
+ uno::Reference< XCollection > xCol( new SwVbaStyles( this, mxContext, mxModel ) );
11577
+ return xCol->Item( uno::makeAny( sFollowStyle ), uno::Any() );
11581
+ throw uno::RuntimeException();
11583
+ return uno::Any();
11586
+void SAL_CALL SwVbaStyle::setNextParagraphStyle( const uno::Any& _nextparagraphstyle ) throw (uno::RuntimeException)
11588
+ uno::Reference< word::XStyle > xStyle;
11589
+ _nextparagraphstyle >>= xStyle;
11590
+ if( xStyle.is() )
11592
+ rtl::OUString sFollowStyle = xStyle->getName();
11593
+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FollowStyle") ), uno::makeAny( sFollowStyle ) );
11597
+ throw uno::RuntimeException();
11601
+::sal_Int32 SAL_CALL SwVbaStyle::getListLevelNumber() throw (uno::RuntimeException)
11603
+ sal_Int16 nNumberingLevel = 0;
11604
+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingLevel") ) ) >>= nNumberingLevel;
11605
+ return nNumberingLevel;
11609
SwVbaStyle::getServiceImplName()
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
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>
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
11627
+ css::uno::Reference< css::frame::XModel > mxModel;
11628
css::uno::Reference< css::beans::XPropertySet > mxStyleProps;
11629
css::uno::Reference< css::style::XStyle > mxStyle;
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(){}
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);
11656
+ //XDefaultProperty
11657
+ virtual ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return rtl::OUString::createFromAscii("Name"); }
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;
11669
-const BuiltinStyleTable aBuiltinStyleTable[] =
11670
+static const BuiltinStyleTable aBuiltinStyleTable[] =
11672
{ word::WdBuiltinStyle::wdStyleBlockQuotation, "", word::WdStyleType::wdStyleTypeParagraph },
11673
{ word::WdBuiltinStyle::wdStyleBodyText, "Text body", word::WdStyleType::wdStyleTypeParagraph },
11674
@@ -155,6 +155,18 @@ const BuiltinStyleTable aBuiltinStyleTable[] =
11678
+struct MSOStyleNameTable
11680
+ const sal_Char* pMSOStyleName;
11681
+ const sal_Char* pOOoStyleName;
11682
+ const sal_Char* pOOoStyleType;
11685
+static const MSOStyleNameTable aMSOStyleNameTable[] =
11687
+ { "Normal", "Default", "ParagraphStyles" },
11691
static uno::Sequence< rtl::OUString > getStyleTypes()
11693
@@ -168,38 +180,21 @@ static uno::Sequence< rtl::OUString > getStyleTypes()
11695
typedef ::cppu::WeakImplHelper1< container::XEnumeration > StyleEnumeration_BASE;
11696
typedef ::cppu::WeakImplHelper3< container::XNameAccess, container::XIndexAccess, container::XEnumerationAccess > StyleCollectionHelper_BASE;
11698
-class StylesEnumeration : public StyleEnumeration_BASE
11701
- StylesEnumeration( const SheetMap& sMap ) : mSheetMap( sMap ), mIt( mSheetMap.begin() ) {}
11702
- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
11704
- return ( mIt != mSheetMap.end() );
11706
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
11708
- if ( !hasMoreElements() )
11709
- throw container::NoSuchElementException();
11710
- uno::Reference< sheet::XSpreadsheet > xSheet( *mIt++ );
11711
- return uno::makeAny( xSheet ) ;
11716
class StyleCollectionHelper : public StyleCollectionHelper_BASE
11719
uno::Reference< frame::XModel > mxModel;
11720
- uno::Reference< container::XNameAccess > mxStyleFamilies;
11721
- uno::Reference< container::XNameContainer > mxCurrentStyleFamily;
11722
+ uno::Reference< container::XNameAccess > mxParaStyles;
11725
StyleCollectionHelper( const uno::Reference< frame::XModel >& _xModel ) : mxModel( _xModel )
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 );
11733
- uno::Reference< container::XNameContainer > getCurrentStyleFamily(){ return mxCurrentStyleFamily; }
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:
11739
virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
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();
11748
+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
11750
+ // search in the MSOStyleName table first
11751
+ for( const MSOStyleNameTable* pTable = aMSOStyleNameTable; pTable->pMSOStyleName != NULL; pTable++ )
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 ) )
11758
- pString[nCount++] = sElementNames[j];
11760
+ rtl::OUString sStyleName = rtl::OUString::createFromAscii( pTable->pOOoStyleName );
11761
+ if( mxParaStyles->hasByName( sStyleName ) )
11763
+ cachePos = mxParaStyles->getByName( sStyleName );
11766
+ return sal_False;
11771
- virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
11773
- uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
11774
- for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
11776
+ if( mxParaStyles->hasByName( aName ) )
11778
+ cachePos = mxParaStyles->getByName( aName );
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++ )
11788
- cachePos = xNameAccess->getByName( aName );
11789
- mxCurrentStyleFamily.set( xNameAccess, uno::UNO_QUERY_THROW );
11791
+ rtl::OUString aStyleName = sElementNames[j];
11792
+ if( aStyleName.equalsIgnoreAsciiCase( aName ) )
11794
+ cachePos = mxParaStyles->getByName( aStyleName );
11800
@@ -246,44 +251,43 @@ public:
11802
virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
11804
- uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
11805
- sal_Int32 nCount = 0;
11806
- for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
11808
- uno::Reference< container::XIndexAccess > xIndexAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
11809
- nCount += xIndexAccess->getCount();
11812
+ uno::Reference< container::XIndexAccess > xIndexAccess( mxParaStyles, uno::UNO_QUERY_THROW );
11813
+ return xIndexAccess->getCount();
11815
virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
11817
if ( Index < 0 || Index >= getCount() )
11818
throw lang::IndexOutOfBoundsException();
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++ )
11824
- uno::Reference< container::XIndexAccess > xIndexAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
11825
- sal_Int32 nCount = xIndexAccess->getCount();
11826
- if( Index >= nCount )
11830
- mxCurrentStyleFamily.set( xIndexAccess, uno::UNO_QUERY_THROW );
11831
- return xIndexAccess->getByIndex( Index );
11834
- throw lang::IndexOutOfBoundsException();
11835
+ uno::Reference< container::XIndexAccess > xIndexAccess( mxParaStyles, uno::UNO_QUERY_THROW );
11836
+ return xIndexAccess->getByIndex( Index );
11838
// XEnumerationAccess
11839
virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
11842
throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
11846
+class StylesEnumWrapper : public EnumerationHelper_BASE
11848
+ SwVbaStyles* pStyles;
11849
+ sal_Int32 nIndex;
11851
+ StylesEnumWrapper( SwVbaStyles* _pStyles ) : pStyles( _pStyles ), nIndex( 1 ) {}
11852
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
11854
+ return ( nIndex <= pStyles->getCount() );
11857
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
11859
+ if ( nIndex <= pStyles->getCount() )
11860
+ return pStyles->Item( uno::makeAny( nIndex++ ), uno::Any() );
11861
+ throw container::NoSuchElementException();
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 )
11867
mxMSF.set( mxModel, uno::UNO_QUERY_THROW );
11868
@@ -293,7 +297,7 @@ uno::Any
11869
SwVbaStyles::createCollectionObject(const uno::Any& aObject)
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 ) ) );
11877
@@ -305,7 +309,7 @@ SwVbaStyles::getElementType() throw (uno::RuntimeException)
11878
uno::Reference< container::XEnumeration > SAL_CALL
11879
SwVbaStyles::createEnumeration() throw (uno::RuntimeException)
11881
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
11882
+ return new StylesEnumWrapper( this );
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 )
11890
- rtl::OUString aStyleType = SwVbaStyle::getOOoStyleTypeFromMSWord( pTable->wdStyleType );
11891
+ //rtl::OUString aStyleType = SwVbaStyle::getOOoStyleTypeFromMSWord( pTable->wdStyleType );
11892
+ rtl::OUString aStyleType;
11893
switch( pTable->wdStyleType )
11895
case word::WdStyleType::wdStyleTypeParagraph:
11896
@@ -338,7 +343,8 @@ SwVbaStyles::Item( const uno::Any& Index1, const uno::Any& Index2 ) throw (uno::
11898
case word::WdStyleType::wdStyleTypeList:
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") );
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 )
11914
+ xStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyleName") ), uno::makeAny( aStyleName ) );
11916
+ return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, mxModel, xStyleProps ) ) );
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
11925
#include <tools/urlobj.hxx>
11926
#include <tools/string.hxx>
11929
+#include <tools/prewin.h>
11930
+#include <windows.h>
11931
+#include <tools/postwin.h>
11932
+#include <tchar.h>
11935
using namespace ::ooo::vba;
11936
using namespace ::com::sun::star;
11938
@@ -55,13 +62,79 @@ void PrivateProfileStringListener::Initialize( const rtl::OUString& rFileName, c
11939
maGroupName = rGroupName;
11943
+void lcl_getRegKeyInfo( const ByteString& sKeyInfo, HKEY& hBaseKey, ByteString& sSubKey )
11945
+ sal_Int32 nBaseKeyIndex = sKeyInfo.Search('\\');
11946
+ if( nBaseKeyIndex > 0 )
11948
+ ByteString sBaseKey = sKeyInfo.Copy( 0, nBaseKeyIndex );
11949
+ sSubKey = sKeyInfo.Copy( nBaseKeyIndex + 1 );
11950
+ if( sBaseKey.Equals("HKEY_CURRENT_USER") )
11952
+ hBaseKey = HKEY_CURRENT_USER;
11954
+ else if( sBaseKey.Equals("HKEY_LOCAL_MACHINE") )
11956
+ hBaseKey = HKEY_LOCAL_MACHINE;
11958
+ else if( sBaseKey.Equals("HKEY_CLASSES_ROOT") )
11960
+ hBaseKey = HKEY_CLASSES_ROOT;
11962
+ else if( sBaseKey.Equals("HKEY_USERS") )
11964
+ hBaseKey = HKEY_USERS;
11966
+ else if( sBaseKey.Equals("HKEY_CURRENT_CONFIG") )
11968
+ hBaseKey = HKEY_CURRENT_CONFIG;
11974
uno::Any PrivateProfileStringListener::getValueEvent()
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())
11983
+ // get key/value from a file
11984
+ Config aCfg( maFileName );
11985
+ aCfg.SetGroup( maGroupName );
11986
+ sValue = String( aCfg.ReadKey( maKey ), RTL_TEXTENCODING_DONTKNOW );
11990
+ // get key/value from windows register
11992
+ HKEY hBaseKey = NULL;
11993
+ ByteString sSubKey;
11994
+ sal_Int32 nBaseKeyIndex = maGroupName.Search('\\');
11995
+ lcl_getRegKeyInfo( maGroupName, hBaseKey, sSubKey );
11996
+ if( hBaseKey != NULL )
11998
+ HKEY hKey = NULL;
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 )
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);
12013
+ return uno::makeAny( sValue );
12015
+ throw uno::RuntimeException( rtl::OUString(
12016
+ RTL_CONSTASCII_USTRINGPARAM("Only support on Windows")), uno::Reference< uno::XInterface >() );
12019
return uno::makeAny( sValue );
12021
@@ -69,12 +142,44 @@ uno::Any PrivateProfileStringListener::getValueEvent()
12022
void PrivateProfileStringListener::setValueEvent( const css::uno::Any& value )
12024
// set the private profile string
12025
- Config aCfg( maFileName );
12026
- aCfg.SetGroup( maGroupName );
12028
rtl::OUString aValue;
12030
- aCfg.WriteKey( maKey, ByteString( aValue.getStr(), RTL_TEXTENCODING_DONTKNOW ) );
12031
+ if(maFileName.getLength())
12033
+ // set value into a file
12034
+ Config aCfg( maFileName );
12035
+ aCfg.SetGroup( maGroupName );
12036
+ aCfg.WriteKey( maKey, ByteString( aValue.getStr(), RTL_TEXTENCODING_DONTKNOW ) );
12040
+ //set value into windows register
12042
+ HKEY hBaseKey = NULL;
12043
+ ByteString sSubKey;
12044
+ sal_Int32 nBaseKeyIndex = maGroupName.Search('\\');
12045
+ lcl_getRegKeyInfo( maGroupName, hBaseKey, sSubKey );
12046
+ if( hBaseKey != NULL )
12048
+ HKEY hKey = NULL;
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 )
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 );
12063
+ throw uno::RuntimeException( rtl::OUString(
12064
+ RTL_CONSTASCII_USTRINGPARAM("Not implemented")), uno::Reference< uno::XInterface >() );
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)
12072
SwVbaSystem::PrivateProfileString( const rtl::OUString& rFilename, const rtl::OUString& rSection, const rtl::OUString& rKey ) throw ( uno::RuntimeException )
12074
- if( rFilename.getLength() == 0 )
12075
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access document from shell" ) ), uno::Reference< uno::XInterface >() );
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;
12084
- sFileUrl = rFilename;
12086
- osl::FileBase::getFileURLFromSystemPath( rFilename, sFileUrl);
12087
+ if( rFilename.getLength() )
12089
+ INetURLObject aObj;
12090
+ aObj.SetURL( rFilename );
12091
+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
12093
+ sFileUrl = rFilename;
12095
+ osl::FileBase::getFileURLFromSystemPath( rFilename, sFileUrl);
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
12105
#include <com/sun/star/container/XNamed.hpp>
12106
#include "vbaborders.hxx"
12107
#include "vbapalette.hxx"
12108
+#include "vbarows.hxx"
12109
+#include "vbacolumns.hxx"
12111
using namespace ::ooo::vba;
12112
using namespace ::com::sun::star;
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 )
12117
mxTextTable.set( xTextTable, uno::UNO_QUERY_THROW );
12119
@@ -75,6 +77,26 @@ SwVbaTable::Borders( const uno::Any& index ) throw (uno::RuntimeException)
12120
return uno::makeAny( xCol );
12124
+SwVbaTable::Rows( const uno::Any& index ) throw (uno::RuntimeException)
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 );
12134
+SwVbaTable::Columns( const uno::Any& index ) throw (uno::RuntimeException)
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 );
12143
// XHelperInterface
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);
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
12164
+++ sw/source/ui/vba/vbatablehelper.cxx
12166
+/*************************************************************************
12168
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
12170
+ * Copyright 2008 by Sun Microsystems, Inc.
12172
+ * OpenOffice.org - a multi-platform office productivity suite
12177
+ * This file is part of OpenOffice.org.
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.
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).
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.
12194
+ ************************************************************************/
12195
+#include "vbatablehelper.hxx"
12196
+#include <swtable.hxx>
12197
+#include <unotbl.hxx>
12198
+#include <docsh.hxx>
12200
+using namespace ::com::sun::star;
12201
+using namespace ::ooo::vba;
12203
+#define UNO_TABLE_COLUMN_SUM 10000
12205
+SwVbaTableHelper::SwVbaTableHelper( const uno::Reference< text::XTextTable >& xTextTable ) throw (uno::RuntimeException) : mxTextTable( xTextTable ), pDoc( NULL )
12207
+ pTable = GetSwTable( mxTextTable );
12210
+SwTable* SwVbaTableHelper::GetSwTable( const uno::Reference< text::XTextTable >& xTextTable ) throw (uno::RuntimeException)
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();
12217
+ SwFrmFmt* pFrmFmt = pXTextTable->GetFrmFmt();
12219
+ throw uno::RuntimeException();
12221
+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
12225
+sal_Int32 SwVbaTableHelper::getTabColumnsCount( sal_Int32 nRowIndex ) throw (uno::RuntimeException)
12227
+ sal_Int32 nRet = 0;
12228
+ if(!pTable->IsTblComplex())
12230
+ SwTableLines& rLines = pTable->GetTabLines();
12231
+ SwTableLine* pLine = rLines.GetObject( nRowIndex );
12232
+ nRet = pLine->GetTabBoxes().Count();
12237
+sal_Int32 SwVbaTableHelper::getTabColumnsMaxCount( ) throw (uno::RuntimeException)
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++ )
12244
+ sal_Int32 nColCount = getTabColumnsCount( index );
12245
+ if( nRet < nColCount )
12246
+ nRet = nColCount;
12251
+sal_Int32 SwVbaTableHelper::getTabRowIndex( const rtl::OUString& CellName ) throw (uno::RuntimeException)
12253
+ sal_Int32 nRet = 0;
12254
+ String sCellName(CellName);
12255
+ SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
12257
+ throw uno::RuntimeException();
12259
+ const SwTableLine* pLine = pBox->GetUpper();
12260
+ const SwTableLines* pLines = pLine->GetUpper()
12261
+ ? &pLine->GetUpper()->GetTabLines() : &pTable->GetTabLines();
12262
+ nRet = pLines->GetPos( pLine );
12266
+sal_Int32 SwVbaTableHelper::getTabColIndex( const rtl::OUString& CellName ) throw (uno::RuntimeException)
12268
+ sal_Int32 nRet = 0;
12269
+ String sCellName(CellName);
12270
+ const SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
12272
+ throw uno::RuntimeException();
12273
+ const SwTableBoxes* pBoxes = &pBox->GetUpper()->GetTabBoxes();
12274
+ nRet = pBoxes->GetPos( pBox );
12278
+rtl::OUString SwVbaTableHelper::getColumnStr( sal_Int32 nCol )
12280
+ const sal_Int32 coDiff = 52; // 'A'-'Z' 'a' - 'z'
12281
+ sal_Int32 nCalc = 0;
12285
+ nCalc = nCol % coDiff;
12286
+ if( nCalc >= 26 )
12287
+ sRet.Insert( sal_Unicode('a' - 26 + nCalc ), 0 );
12289
+ sRet.Insert( sal_Unicode('A' + nCalc ), 0 );
12291
+ if( 0 == ( nCol = nCol - nCalc ) )
12299
+sal_Int32 SwVbaTableHelper::getTableWidth( ) throw (uno::RuntimeException)
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 )
12307
+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RelativeWidth") ) ) >>= nWidth;
12311
+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) ) >>= nWidth;
12316
+void SwVbaTableHelper::setTableWidth( sal_Int32 _width ) throw (uno::RuntimeException)
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 )
12323
+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RelativeWidth") ), uno::makeAny( _width ));
12327
+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ), uno::makeAny( _width ) );
12331
+SwTableBox* SwVbaTableHelper::GetTabBox( sal_Int32 nCol, sal_Int32 nRow ) throw (css::uno::RuntimeException)
12333
+ SwTableLines& rLines = pTable->GetTabLines();
12334
+ sal_Int32 nRowCount = rLines.Count();
12335
+ if( nRowCount < nRow )
12336
+ throw uno::RuntimeException();
12338
+ SwTableBox* pStart = NULL;
12339
+ SwTableLine* pLine = rLines.GetObject( nRow );
12340
+ if( pLine->GetTabBoxes().Count() < nCol )
12341
+ throw uno::RuntimeException();
12343
+ pStart = pLine->GetTabBoxes()[ nCol ];
12346
+ throw uno::RuntimeException();
12351
+void SwVbaTableHelper::InitTabCols( SwTabCols& rCols, const SwTableBox *pStart, BOOL bCurRowOnly )
12353
+ rCols.SetLeftMin ( 0 );
12354
+ rCols.SetLeft ( 0 );
12355
+ rCols.SetRight ( UNO_TABLE_COLUMN_SUM );
12356
+ rCols.SetRightMax( UNO_TABLE_COLUMN_SUM );
12360
+ // pDoc = word::getDocShell( getCurrentDocument() )->GetDoc();
12362
+ pTable->GetTabCols( rCols, pStart, sal_False, sal_False );
12365
+sal_Int32 SwVbaTableHelper::GetColCount( SwTabCols& rCols ) const
12367
+ sal_Int32 nCount = 0;
12368
+ for(sal_Int32 i = 0; i < rCols.Count(); i++ )
12369
+ if(rCols.IsHidden(i))
12371
+ return rCols.Count() - nCount;
12374
+sal_Int32 SwVbaTableHelper::GetRightSeparator( SwTabCols& rCols, sal_Int32 nNum) const
12376
+ DBG_ASSERT( nNum < (sal_Int32)GetColCount( rCols ) ,"Index out of range");
12378
+ while( nNum >= 0 )
12380
+ if( !rCols.IsHidden( static_cast< USHORT >(i)) )
12387
+sal_Int32 SwVbaTableHelper::GetColWidth( sal_Int32 nCol, sal_Int32 nRow, sal_Bool bCurRowOnly ) throw (uno::RuntimeException)
12389
+ SwTableBox* pStart = GetTabBox( nCol, nRow );
12391
+ InitTabCols( aCols, pStart, bCurRowOnly );
12392
+ sal_Int32 nWidth = GetColWidth( aCols, nCol );
12394
+ sal_Int32 nTableWidth = getTableWidth( );
12395
+ double dAbsWidth = ( (double)nWidth / UNO_TABLE_COLUMN_SUM ) * (double) nTableWidth;
12396
+ return ( sal_Int32 )Millimeter::getInPoints( dAbsWidth );
12399
+sal_Int32 SwVbaTableHelper::GetColWidth( SwTabCols& rCols, sal_Int32 nNum ) throw (uno::RuntimeException)
12401
+ SwTwips nWidth = 0;
12403
+ if( rCols.Count() > 0 )
12405
+ if(rCols.Count() == GetColCount( rCols ))
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]);
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)]:
12420
+ nWidth = nRValid - nLValid;
12424
+ nWidth = rCols.GetRight();
12429
+void SwVbaTableHelper::SetColWidth( sal_Int32 _width, sal_Int32 nCol, sal_Int32 nRow, sal_Bool bCurRowOnly ) throw (css::uno::RuntimeException)
12431
+ double dAbsWidth = Millimeter::getInHundredthsOfOneMillimeter( _width );
12432
+ sal_Int32 nTableWidth = getTableWidth( );
12433
+ sal_Int32 nNewWidth = (sal_Int32)( dAbsWidth/nTableWidth * UNO_TABLE_COLUMN_SUM );
12435
+ SwTableBox* pStart = GetTabBox( nCol, nRow );
12436
+ SwTabCols aOldCols;
12437
+ InitTabCols( aOldCols, pStart, bCurRowOnly );
12439
+ //BOOL bCurRowOnly = FALSE;
12440
+ SwTwips nWidth = 0;
12442
+ SwTabCols aCols( aOldCols );
12443
+ if ( aCols.Count() > 0 )
12445
+ // if(aCols.Count() != GetColCount( aCols ))
12446
+ // bCurRowOnly = TRUE;
12447
+ nWidth = GetColWidth( aCols, nCol);
12449
+ int nDiff = (int)(nNewWidth - nWidth);
12451
+ aCols[ static_cast< USHORT >(GetRightSeparator(aCols, 0)) ] += nDiff;
12452
+ else if( nCol < GetColCount( aCols ) )
12454
+ if(nDiff < GetColWidth( aCols, nCol + 1) - MINLAY)
12455
+ aCols[ static_cast< USHORT >(GetRightSeparator( aCols, nCol)) ] += nDiff;
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;
12464
+ aCols[ static_cast< USHORT >(GetRightSeparator( aCols, nCol-1)) ] -= nDiff;
12467
+ aCols.SetRight( Min( (long)nNewWidth, aCols.GetRightMax()) );
12469
+ //pDoc->SetTabCols(*pTable, aCols, aOldCols, pStartBox, bCurRowOnly );
12470
+ pTable->SetTabCols(aCols, aOldCols, pStart, bCurRowOnly );
12472
diff --git sw/source/ui/vba/vbatablehelper.hxx sw/source/ui/vba/vbatablehelper.hxx
12473
new file mode 100644
12474
index 0000000..73425d4
12476
+++ sw/source/ui/vba/vbatablehelper.hxx
12478
+/*************************************************************************
12480
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
12482
+ * Copyright 2008 by Sun Microsystems, Inc.
12484
+ * OpenOffice.org - a multi-platform office productivity suite
12486
+ * $RCSfile: vbahelper.hxx,v $
12487
+ * $Revision: 1.5.32.1 $
12489
+ * This file is part of OpenOffice.org.
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.
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).
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.
12506
+ ************************************************************************/
12507
+#ifndef SW_WORD_VBA_TABLEHELPER_HXX
12508
+#define SW_WORD_VBA_TABLEHELPER_HXX
12510
+#include <com/sun/star/text/XTextTable.hpp>
12511
+#include "wordvbahelper.hxx"
12512
+#include <swtable.hxx>
12513
+#include <tabcol.hxx>
12514
+#include <doc.hxx>
12516
+class SwVbaTableHelper
12519
+ css::uno::Reference< css::text::XTextTable > mxTextTable;
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);
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);
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);
12543
+ static SwTable* GetSwTable( const css::uno::Reference< css::text::XTextTable >& xTextTable ) throw (css::uno::RuntimeException);
12544
+ static rtl::OUString getColumnStr( sal_Int32 nCol );
12548
diff --git sw/source/ui/vba/vbatableofcontents.cxx sw/source/ui/vba/vbatableofcontents.cxx
12549
new file mode 100644
12550
index 0000000..1c37e96
12552
+++ sw/source/ui/vba/vbatableofcontents.cxx
12554
+/*************************************************************************
12556
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
12558
+ * Copyright 2008 by Sun Microsystems, Inc.
12560
+ * OpenOffice.org - a multi-platform office productivity suite
12565
+ * This file is part of OpenOffice.org.
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.
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).
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.
12582
+ ************************************************************************/
12583
+#include "vbatableofcontents.hxx"
12584
+#include <vbahelper/vbahelper.hxx>
12585
+#include <tools/diagnose_ex.h>
12586
+#include <ooo/vba/word/WdTabLeader.hpp>
12588
+using namespace ::ooo::vba;
12589
+using namespace ::com::sun::star;
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 )
12594
+ mxTocProps.set( mxDocumentIndex, uno::UNO_QUERY_THROW );
12598
+SwVbaTableOfContents::~SwVbaTableOfContents()
12602
+::sal_Int32 SAL_CALL SwVbaTableOfContents::getLowerHeadingLevel() throw (uno::RuntimeException)
12604
+ sal_Int16 nLevel = 0;
12605
+ mxTocProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Level") ) ) >>= nLevel;
12609
+void SAL_CALL SwVbaTableOfContents::setLowerHeadingLevel( ::sal_Int32 _lowerheadinglevel ) throw (uno::RuntimeException)
12611
+ mxTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Level") ), uno::makeAny( sal_Int8( _lowerheadinglevel ) ) );
12614
+::sal_Int32 SAL_CALL SwVbaTableOfContents::getTabLeader() throw (uno::RuntimeException)
12616
+ // not support in Writer
12617
+ return word::WdTabLeader::wdTabLeaderDots;
12620
+void SAL_CALL SwVbaTableOfContents::setTabLeader( ::sal_Int32 /*_tableader*/ ) throw (uno::RuntimeException)
12622
+ // not support in Writer
12625
+::sal_Bool SAL_CALL SwVbaTableOfContents::getUseFields() throw (css::uno::RuntimeException)
12627
+ sal_Bool bUseFields = sal_False;
12628
+ mxTocProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromMarks") ) ) >>= bUseFields;
12629
+ return bUseFields;
12632
+void SAL_CALL SwVbaTableOfContents::setUseFields( ::sal_Bool _useFields ) throw (css::uno::RuntimeException)
12634
+ mxTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromMarks") ), uno::makeAny( _useFields ) );
12637
+::sal_Bool SAL_CALL SwVbaTableOfContents::getUseOutlineLevels() throw (css::uno::RuntimeException)
12639
+ sal_Bool bUseOutlineLevels = sal_False;
12640
+ mxTocProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromOutline") ) ) >>= bUseOutlineLevels;
12641
+ return bUseOutlineLevels;
12644
+void SAL_CALL SwVbaTableOfContents::setUseOutlineLevels( ::sal_Bool _useOutlineLevels ) throw (css::uno::RuntimeException)
12646
+ mxTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromOutline") ), uno::makeAny( _useOutlineLevels ) );
12649
+void SAL_CALL SwVbaTableOfContents::Delete( ) throw (uno::RuntimeException)
12651
+ uno::Reference< text::XTextContent > xTextContent( mxDocumentIndex, uno::UNO_QUERY_THROW );
12652
+ mxTextDocument->getText()->removeTextContent( xTextContent );
12655
+void SAL_CALL SwVbaTableOfContents::Update( ) throw (uno::RuntimeException)
12657
+ mxDocumentIndex->update();
12661
+SwVbaTableOfContents::getServiceImplName()
12663
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTableOfContents") );
12664
+ return sImplName;
12667
+uno::Sequence< rtl::OUString >
12668
+SwVbaTableOfContents::getServiceNames()
12670
+ static uno::Sequence< rtl::OUString > aServiceNames;
12671
+ if ( aServiceNames.getLength() == 0 )
12673
+ aServiceNames.realloc( 1 );
12674
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TableOfContents" ) );
12676
+ return aServiceNames;
12679
diff --git sw/source/ui/vba/vbatableofcontents.hxx sw/source/ui/vba/vbatableofcontents.hxx
12680
new file mode 100644
12681
index 0000000..8e9394a
12683
+++ sw/source/ui/vba/vbatableofcontents.hxx
12685
+/*************************************************************************
12687
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
12689
+ * Copyright 2008 by Sun Microsystems, Inc.
12691
+ * OpenOffice.org - a multi-platform office productivity suite
12696
+ * This file is part of OpenOffice.org.
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.
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).
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.
12713
+ ************************************************************************/
12714
+#ifndef SW_VBA_TABLEOFCONTENTS_HXX
12715
+#define SW_VBA_TABLEOFCONTENTS_HXX
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>
12723
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XTableOfContents > SwVbaTableOfContents_BASE;
12725
+class SwVbaTableOfContents : public SwVbaTableOfContents_BASE
12728
+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
12729
+ css::uno::Reference< css::text::XDocumentIndex > mxDocumentIndex;
12730
+ css::uno::Reference< css::beans::XPropertySet > mxTocProps;
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();
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);
12747
+ virtual void SAL_CALL Delete( ) throw (css::uno::RuntimeException);
12748
+ virtual void SAL_CALL Update( ) throw (css::uno::RuntimeException);
12750
+ // XHelperInterface
12751
+ virtual rtl::OUString& getServiceImplName();
12752
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
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
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>
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 );
12773
+sal_Bool lcl_isInHeaderFooter( const uno::Reference< text::XTextTable >& xTable )
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") )
12781
+ return sal_False;
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;
12788
+class TableCollectionHelper : public TableCollectionHelper_Base
12790
+ XTextTableVec mxTables;
12791
+ XTextTableVec::iterator cachePos;
12794
+ TableCollectionHelper( const uno::Reference< frame::XModel >& xDocument )
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++ )
12801
+ uno::Reference< text::XTextTable > xTable( xTables->getByIndex( i ) , uno::UNO_QUERY_THROW );
12802
+ if( !lcl_isInHeaderFooter( xTable ) )
12803
+ mxTables.push_back( xTable );
12805
+ cachePos = mxTables.begin();
12808
+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
12810
+ return mxTables.size();
12812
+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
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 );
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 ; }
12823
+ virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
12825
+ if ( !hasByName(aName) )
12826
+ throw container::NoSuchElementException();
12827
+ uno::Reference< text::XTextTable > xTable( *cachePos, uno::UNO_QUERY_THROW );
12828
+ return uno::makeAny( xTable );
12830
+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
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 )
12838
+ uno::Reference< container::XNamed > xName( *it, uno::UNO_QUERY_THROW );
12839
+ *pString = xName->getName();
12843
+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
12845
+ cachePos = mxTables.begin();
12846
+ XTextTableVec::iterator it_end = mxTables.end();
12847
+ for ( ; cachePos != it_end; ++cachePos )
12849
+ uno::Reference< container::XNamed > xName( *cachePos, uno::UNO_QUERY_THROW );
12850
+ if ( aName.equalsIgnoreAsciiCase( xName->getName() ) )
12853
+ return ( cachePos != it_end );
12857
class TableEnumerationImpl : public EnumBase
12859
@@ -52,7 +137,7 @@ public:
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 )
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 );
12871
xText->insertTextContent( xTextRange, xContext, true );
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 );
12878
uno::Reference< word::XTable > xVBATable( new SwVbaTable( mxParent, mxContext, pVbaRange->getDocument(), xTable ) );
12881
diff --git sw/source/ui/vba/vbatablesofcontents.cxx sw/source/ui/vba/vbatablesofcontents.cxx
12882
new file mode 100644
12883
index 0000000..fd81978
12885
+++ sw/source/ui/vba/vbatablesofcontents.cxx
12887
+/*************************************************************************
12889
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
12891
+ * Copyright 2008 by Sun Microsystems, Inc.
12893
+ * OpenOffice.org - a multi-platform office productivity suite
12898
+ * This file is part of OpenOffice.org.
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.
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).
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.
12915
+ ************************************************************************/
12916
+#include "vbatablesofcontents.hxx"
12917
+#include "vbatableofcontents.hxx"
12918
+#include "vbarange.hxx"
12919
+#include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
12921
+using namespace ::ooo::vba;
12922
+using namespace ::com::sun::star;
12924
+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > TableOfContentsCollectionHelper_Base;
12925
+typedef std::vector< uno::Reference< text::XDocumentIndex > > XTocVec;
12927
+class TablesOfContentsEnumWrapper : public EnumerationHelper_BASE
12929
+ uno::Reference< container::XIndexAccess > mxIndexAccess;
12930
+ sal_Int32 nIndex;
12933
+ TablesOfContentsEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : mxIndexAccess( xIndexAccess ), nIndex( 0 )
12936
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
12938
+ return ( nIndex < mxIndexAccess->getCount() );
12941
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
12943
+ if( nIndex < mxIndexAccess->getCount() )
12945
+ return mxIndexAccess->getByIndex( nIndex++ );
12947
+ throw container::NoSuchElementException();
12951
+class TableOfContentsCollectionHelper : public TableOfContentsCollectionHelper_Base
12954
+ uno::Reference< XHelperInterface > mxParent;
12955
+ uno::Reference< uno::XComponentContext > mxContext;
12956
+ uno::Reference< text::XTextDocument > mxTextDocument;
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 )
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++ )
12967
+ uno::Reference< text::XDocumentIndex > xToc( xDocIndexes->getByIndex(i), uno::UNO_QUERY_THROW );
12968
+ if( xToc->getServiceName().equalsAscii("com.sun.star.text.ContentIndex") )
12970
+ maToc.push_back( xToc );
12975
+ virtual ~TableOfContentsCollectionHelper() {}
12977
+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
12979
+ return maToc.size();
12981
+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
12983
+ if ( Index < 0 || Index >= getCount() )
12984
+ throw lang::IndexOutOfBoundsException();
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 ) ) );
12989
+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
12991
+ return word::XTableOfContents::static_type(0);
12993
+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
12997
+ // XEnumerationAccess
12998
+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
13000
+ return new TablesOfContentsEnumWrapper( this );
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 )
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)
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 );
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 ) );
13018
+ uno::Reference< word::XTableOfContents > xToc( new SwVbaTableOfContents( this, mxContext, mxTextDocument, xDocumentIndex ) );
13020
+ sal_Int32 nLowerHeadingLevel = 9;
13021
+ if( LowerHeadingLevel.hasValue() )
13022
+ LowerHeadingLevel >>= nLowerHeadingLevel;
13023
+ xToc->setLowerHeadingLevel( nLowerHeadingLevel );
13025
+ sal_Bool bUseFields = sal_False;
13026
+ if( UseFields.hasValue() )
13027
+ UseFields >>= bUseFields;
13028
+ xToc->setUseFields( bUseFields );
13030
+ sal_Bool bUseOutlineLevels = sal_True;
13031
+ //if( UseOutlineLevels.hasValue() )
13032
+ // UseOutlineLevels >>= bUseOutlineLevels;
13033
+ xToc->setUseOutlineLevels( bUseOutlineLevels );
13035
+ SwVbaRange* pVbaRange = dynamic_cast<SwVbaRange*>( Range.get() );
13037
+ throw uno::RuntimeException();
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 );
13048
+// XEnumerationAccess
13050
+SwVbaTablesOfContents::getElementType() throw (uno::RuntimeException)
13052
+ return word::XTableOfContents::static_type(0);
13054
+uno::Reference< container::XEnumeration >
13055
+SwVbaTablesOfContents::createEnumeration() throw (uno::RuntimeException)
13057
+ return new TablesOfContentsEnumWrapper( m_xIndexAccess );
13061
+SwVbaTablesOfContents::createCollectionObject( const uno::Any& aSource )
13067
+SwVbaTablesOfContents::getServiceImplName()
13069
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTablesOfContents") );
13070
+ return sImplName;
13073
+uno::Sequence<rtl::OUString>
13074
+SwVbaTablesOfContents::getServiceNames()
13076
+ static uno::Sequence< rtl::OUString > sNames;
13077
+ if ( sNames.getLength() == 0 )
13079
+ sNames.realloc( 1 );
13080
+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TablesOfContents") );
13084
diff --git sw/source/ui/vba/vbatablesofcontents.hxx sw/source/ui/vba/vbatablesofcontents.hxx
13085
new file mode 100644
13086
index 0000000..e193df7
13088
+++ sw/source/ui/vba/vbatablesofcontents.hxx
13090
+/*************************************************************************
13092
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13094
+ * Copyright 2008 by Sun Microsystems, Inc.
13096
+ * OpenOffice.org - a multi-platform office productivity suite
13101
+ * This file is part of OpenOffice.org.
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.
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).
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.
13118
+ ************************************************************************/
13119
+#ifndef SW_VBA_TABLESOFCONTENTS_HXX
13120
+#define SW_VBA_TABLESOFCONTENTS_HXX
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>
13129
+typedef CollTestImplHelper< ooo::vba::word::XTablesOfContents > SwVbaTablesOfContents_BASE;
13131
+class SwVbaTablesOfContents : public SwVbaTablesOfContents_BASE
13134
+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
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() {}
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);
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);
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();
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
13158
+++ sw/source/ui/vba/vbatabstop.cxx
13160
+/*************************************************************************
13162
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13164
+ * Copyright 2008 by Sun Microsystems, Inc.
13166
+ * OpenOffice.org - a multi-platform office productivity suite
13171
+ * This file is part of OpenOffice.org.
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.
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).
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.
13188
+ ************************************************************************/
13189
+#include "vbatabstop.hxx"
13190
+#include <vbahelper/vbahelper.hxx>
13191
+#include <tools/diagnose_ex.h>
13193
+using namespace ::ooo::vba;
13194
+using namespace ::com::sun::star;
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 )
13200
+SwVbaTabStop::~SwVbaTabStop()
13205
+SwVbaTabStop::getServiceImplName()
13207
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTabStop") );
13208
+ return sImplName;
13211
+uno::Sequence< rtl::OUString >
13212
+SwVbaTabStop::getServiceNames()
13214
+ static uno::Sequence< rtl::OUString > aServiceNames;
13215
+ if ( aServiceNames.getLength() == 0 )
13217
+ aServiceNames.realloc( 1 );
13218
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TabStop" ) );
13220
+ return aServiceNames;
13223
diff --git sw/source/ui/vba/vbatabstop.hxx sw/source/ui/vba/vbatabstop.hxx
13224
new file mode 100644
13225
index 0000000..77780c7
13227
+++ sw/source/ui/vba/vbatabstop.hxx
13229
+/*************************************************************************
13231
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13233
+ * Copyright 2008 by Sun Microsystems, Inc.
13235
+ * OpenOffice.org - a multi-platform office productivity suite
13240
+ * This file is part of OpenOffice.org.
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.
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).
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.
13257
+ ************************************************************************/
13258
+#ifndef SW_VBA_TABSTOP_HXX
13259
+#define SW_VBA_TABSTOP_HXX
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>
13266
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XTabStop > SwVbaTabStop_BASE;
13268
+class SwVbaTabStop : public SwVbaTabStop_BASE
13271
+ css::uno::Reference< css::beans::XPropertySet > mxParaProps;
13272
+ css::style::TabStop maTabStop;
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();
13278
+ // XHelperInterface
13279
+ virtual rtl::OUString& getServiceImplName();
13280
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
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
13287
+++ sw/source/ui/vba/vbatabstops.cxx
13289
+/*************************************************************************
13291
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13293
+ * Copyright 2008 by Sun Microsystems, Inc.
13295
+ * OpenOffice.org - a multi-platform office productivity suite
13300
+ * This file is part of OpenOffice.org.
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.
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).
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.
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>
13324
+using namespace ::ooo::vba;
13325
+using namespace ::com::sun::star;
13327
+uno::Sequence< style::TabStop > lcl_getTabStops( const uno::Reference< beans::XPropertySet >& xParaProps ) throw (uno::RuntimeException)
13329
+ uno::Sequence< style::TabStop > aSeq;
13330
+ xParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaTabStops") ) ) >>= aSeq;
13334
+void lcl_setTabStops( const uno::Reference< beans::XPropertySet >& xParaProps, const uno::Sequence< style::TabStop >& aSeq ) throw (uno::RuntimeException)
13336
+ xParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaTabStops") ), uno::makeAny( aSeq ) );
13339
+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > TabStopCollectionHelper_Base;
13341
+class TabStopsEnumWrapper : public EnumerationHelper_BASE
13343
+ uno::Reference< container::XIndexAccess > mxIndexAccess;
13344
+ sal_Int32 nIndex;
13347
+ TabStopsEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : mxIndexAccess( xIndexAccess ), nIndex( 0 )
13350
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
13352
+ return ( nIndex < mxIndexAccess->getCount() );
13355
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
13357
+ if( nIndex < mxIndexAccess->getCount() )
13359
+ return mxIndexAccess->getByIndex( nIndex++ );
13361
+ throw container::NoSuchElementException();
13365
+class TabStopCollectionHelper : public TabStopCollectionHelper_Base
13368
+ uno::Reference< XHelperInterface > mxParent;
13369
+ uno::Reference< uno::XComponentContext > mxContext;
13370
+ uno::Reference< beans::XPropertySet > mxParaProps;
13371
+ uno::Sequence< style::TabStop > maTabStops;
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 )
13376
+ maTabStops = lcl_getTabStops( xParaProps );
13379
+ virtual ~TabStopCollectionHelper() {}
13381
+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
13383
+ return maTabStops.getLength();
13385
+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
13387
+ if ( Index < 0 || Index >= getCount() )
13388
+ throw css::lang::IndexOutOfBoundsException();
13390
+ const style::TabStop* pTabs = maTabStops.getConstArray();
13391
+ return uno::makeAny( uno::Reference< word::XTabStop >( new SwVbaTabStop( mxParent, mxContext, mxParaProps, pTabs[ Index ] ) ) );
13393
+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
13395
+ return word::XTabStop::static_type(0);
13397
+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
13401
+ // XEnumerationAccess
13402
+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
13404
+ return new TabStopsEnumWrapper( this );
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 )
13412
+uno::Reference< word::XTabStop > SAL_CALL SwVbaTabStops::Add( float Position, const uno::Any& Alignment, const uno::Any& Leader ) throw (uno::RuntimeException)
13414
+ sal_Int32 nPosition = Millimeter::getInHundredthsOfOneMillimeter( Position );
13416
+ style::TabAlign nAlign = style::TabAlign_LEFT;
13417
+ if( Alignment.hasValue() )
13419
+ sal_Int32 wdAlign = word::WdTabAlignment::wdAlignTabLeft;
13420
+ Alignment >>= wdAlign;
13421
+ switch( wdAlign )
13423
+ case word::WdTabAlignment::wdAlignTabLeft:
13425
+ nAlign = style::TabAlign_LEFT;
13428
+ case word::WdTabAlignment::wdAlignTabRight:
13430
+ nAlign = style::TabAlign_RIGHT;
13433
+ case word::WdTabAlignment::wdAlignTabCenter:
13435
+ nAlign = style::TabAlign_CENTER;
13438
+ case word::WdTabAlignment::wdAlignTabDecimal:
13440
+ nAlign = style::TabAlign_DECIMAL;
13443
+ case word::WdTabAlignment::wdAlignTabBar:
13444
+ case word::WdTabAlignment::wdAlignTabList:
13446
+ DebugHelper::exception( SbERR_NOT_IMPLEMENTED, rtl::OUString() );
13456
+ sal_Char cLeader = ' '; // default is space
13457
+ if( Leader.hasValue() )
13459
+ sal_Int32 wdLeader = word::WdTabLeader::wdTabLeaderSpaces;
13460
+ Leader >>= wdLeader;
13461
+ switch( wdLeader )
13463
+ case word::WdTabLeader::wdTabLeaderSpaces:
13468
+ case word::WdTabLeader::wdTabLeaderMiddleDot:
13473
+ case word::WdTabLeader::wdTabLeaderDots:
13478
+ case word::WdTabLeader::wdTabLeaderDashes:
13479
+ case word::WdTabLeader::wdTabLeaderHeavy:
13480
+ case word::WdTabLeader::wdTabLeaderLines:
13492
+ sal_Char cDecimal = '.'; // default value
13494
+ style::TabStop aTab;
13495
+ aTab.Position = nPosition;
13496
+ aTab.Alignment = nAlign;
13497
+ aTab.DecimalChar = cDecimal;
13498
+ aTab.FillChar = cLeader;
13500
+ uno::Sequence< style::TabStop > aOldTabs = lcl_getTabStops( mxParaProps );
13501
+ sal_Bool bOverWriter = sal_False;
13503
+ sal_Int32 nTabs = aOldTabs.getLength();
13504
+ uno::Sequence< style::TabStop > aNewTabs( nTabs + 1 );
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++ )
13511
+ if( pOldTab[nIndex].Position == nPosition )
13513
+ bOverWriter = sal_True;
13514
+ pOldTab[nIndex] = aTab;
13517
+ pNewTab[ nIndex+1 ] = pOldTab[ nIndex ];
13519
+ if( bOverWriter )
13520
+ lcl_setTabStops( mxParaProps, aOldTabs );
13522
+ lcl_setTabStops( mxParaProps, aNewTabs );
13524
+ return uno::Reference< word::XTabStop >( new SwVbaTabStop( this, mxContext, mxParaProps, aTab ) );
13527
+void SAL_CALL SwVbaTabStops::ClearAll() throw (uno::RuntimeException)
13529
+ uno::Sequence< style::TabStop > aSeq;
13530
+ lcl_setTabStops( mxParaProps, aSeq );
13533
+// XEnumerationAccess
13535
+SwVbaTabStops::getElementType() throw (uno::RuntimeException)
13537
+ return word::XTabStop::static_type(0);
13539
+uno::Reference< container::XEnumeration >
13540
+SwVbaTabStops::createEnumeration() throw (uno::RuntimeException)
13542
+ return new TabStopsEnumWrapper( m_xIndexAccess );
13546
+SwVbaTabStops::createCollectionObject( const css::uno::Any& aSource )
13552
+SwVbaTabStops::getServiceImplName()
13554
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTabStops") );
13555
+ return sImplName;
13558
+css::uno::Sequence<rtl::OUString>
13559
+SwVbaTabStops::getServiceNames()
13561
+ static uno::Sequence< rtl::OUString > sNames;
13562
+ if ( sNames.getLength() == 0 )
13564
+ sNames.realloc( 1 );
13565
+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TabStops") );
13569
diff --git sw/source/ui/vba/vbatabstops.hxx sw/source/ui/vba/vbatabstops.hxx
13570
new file mode 100644
13571
index 0000000..913e12b
13573
+++ sw/source/ui/vba/vbatabstops.hxx
13575
+/*************************************************************************
13577
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13579
+ * Copyright 2008 by Sun Microsystems, Inc.
13581
+ * OpenOffice.org - a multi-platform office productivity suite
13586
+ * This file is part of OpenOffice.org.
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.
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).
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.
13603
+ ************************************************************************/
13604
+#ifndef SW_VBA_TABSTOPS_HXX
13605
+#define SW_VBA_TABSTOPS_HXX
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>
13614
+typedef CollTestImplHelper< ooo::vba::word::XTabStops > SwVbaTabStops_BASE;
13616
+class SwVbaTabStops : public SwVbaTabStops_BASE
13619
+ css::uno::Reference< css::beans::XPropertySet > mxParaProps;
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() {}
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);
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);
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();
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>
13651
using namespace ::ooo::vba;
13652
using namespace ::com::sun::star;
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 )
13659
+ //group name should contain only A-Z and a-z and spaces
13660
+ for( xub_StrLen i = 0; i < rGroupName.Len(); i++ )
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 )
13671
+ sRet.EraseLeadingChars();
13672
+ sRet.EraseTrailingChars();
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 )
13682
@@ -50,7 +73,27 @@ SwVbaTemplate::~SwVbaTemplate()
13684
SwVbaTemplate::getName() throw ( css::uno::RuntimeException )
13687
+ rtl::OUString sName;
13688
+ if( msFullUrl.getLength() )
13690
+ INetURLObject aURL( msFullUrl );
13691
+ ::osl::File::getSystemPathFromFileURL( aURL.GetLastName(), sName );
13697
+SwVbaTemplate::getPath() throw ( css::uno::RuntimeException )
13699
+ rtl::OUString sPath;
13700
+ if( msFullUrl.getLength() )
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 );
13711
@@ -61,17 +104,18 @@ SwVbaTemplate::AutoTextEntries( const uno::Any& index ) throw (uno::RuntimeExcep
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('.') );
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('.') ) );
13725
+ String sNewGroup = lcl_CheckGroupName( sGroup );
13727
uno::Reference< container::XIndexAccess > xGroup;
13728
- if( xAutoTextContainer->hasByName( sGroup ) )
13729
+ if( xAutoTextContainer->hasByName( sNewGroup ) )
13731
- xGroup.set( xAutoTextContainer->getByName( sGroup ), uno::UNO_QUERY_THROW );
13732
+ xGroup.set( xAutoTextContainer->getByName( sNewGroup ), uno::UNO_QUERY_THROW );
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
13743
css::uno::Reference< css::frame::XModel > mxModel;
13744
- rtl::OUString msName;
13745
+ rtl::OUString msFullUrl;
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:
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)
13763
else if( aImplName.equalsAscii("SwXHeadFootText") )
13765
- if( HeaderFooterHelper::isHeader( mxModel, xCurrentText ) )
13766
+ if( HeaderFooterHelper::isHeader( mxModel ) )
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;
13775
return word::WdSeekView::wdSeekPrimaryHeader;
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;
13786
return word::WdSeekView::wdSeekPrimaryFooter;
13787
@@ -135,6 +135,7 @@ SwVbaView::setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeExceptio
13788
// if( _seekview == getSeekView() )
13791
+ word::gotoSelectedObjectAnchor( mxModel );
13792
switch( _seekview )
13794
case word::WdSeekView::wdSeekFirstPageFooter:
13795
@@ -184,7 +185,7 @@ SwVbaView::setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeExceptio
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 );
13804
@@ -379,28 +380,7 @@ uno::Reference< text::XTextRange > SwVbaView::getHFTextRange( sal_Int32 nType )
13806
DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() );
13808
- uno::Reference< text::XTextRange > xTextRange = getFirstObjectPosition( xText );
13809
- return xTextRange;
13812
-uno::Reference< text::XTextRange > SwVbaView::getFirstObjectPosition( const uno::Reference< text::XText >& xText ) throw (uno::RuntimeException)
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() )
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") ) ) )
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();
13828
- if( !xTextRange.is() )
13829
- xTextRange = xText->getStart();
13830
+ uno::Reference< text::XTextRange > xTextRange = word::getFirstObjectPosition( xText );
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 @@
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>
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
13859
+SwVbaWindow::getWindowState() throw (uno::RuntimeException)
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() );
13867
+ WorkWindow* pWork = (WorkWindow*) pTop->GetTopFrame_Impl()->GetSystemWindow();
13870
+ if ( pWork -> IsMaximized())
13871
+ nwindowState = word::WdWindowState::wdWindowStateMaximize;
13872
+ else if (pWork -> IsMinimized())
13873
+ nwindowState = word::WdWindowState::wdWindowStateMinimize;
13876
+ return uno::makeAny( nwindowState );
13880
+SwVbaWindow::setWindowState( const uno::Any& _windowstate ) throw (uno::RuntimeException)
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() );
13889
+ WorkWindow* pWork = (WorkWindow*) pTop->GetTopFrame_Impl()->GetSystemWindow();
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();
13899
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Invalid Parameter" ) ), uno::Reference< uno::XInterface >() );
13905
SwVbaWindow::Panes( const uno::Any& aIndex ) throw (uno::RuntimeException)
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:
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);
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>
13938
+#include <view.hxx>
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)
13945
uno::Reference< beans::XPropertySet > xCursorProps( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
13946
+ return getCurrentPageStyle( xModel, xCursorProps );
13949
+uno::Reference< style::XStyle > getCurrentPageStyle( const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xProps ) throw (uno::RuntimeException)
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;
13961
+uno::Reference< style::XStyle > getDefaultParagraphStyle( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
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 );
13971
+uno::Reference< text::XTextRange > getFirstObjectPosition( const uno::Reference< text::XText >& xText ) throw (uno::RuntimeException)
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() )
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") ) ) )
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();
13987
+ if( !xTextRange.is() )
13988
+ xTextRange = xText->getStart();
13989
+ return xTextRange;
13992
+uno::Reference< text::XText > getCurrentXText( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
13994
+ uno::Reference< text::XTextRange > xTextRange;
13995
+ uno::Reference< text::XTextContent > xTextContent( xModel->getCurrentSelection(), uno::UNO_QUERY );
13996
+ if( !xTextContent.is() )
13998
+ uno::Reference< container::XIndexAccess > xIndexAccess( xModel->getCurrentSelection(), uno::UNO_QUERY );
13999
+ if( xIndexAccess.is() )
14001
+ xTextContent.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY );
14005
+ if( xTextContent.is() )
14006
+ xTextRange.set( xTextContent->getAnchor(), uno::UNO_QUERY );
14008
+ if( !xTextRange.is() )
14009
+ xTextRange.set( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
14011
+ uno::Reference< text::XText > xText;
14014
+ xText.set( xTextRange->getText(), uno::UNO_QUERY );
14016
+ catch( uno::RuntimeException& )
14018
+ //catch exception "no text selection"
14020
+ uno::Reference< beans::XPropertySet > xVCProps( xTextRange, uno::UNO_QUERY_THROW );
14021
+ while( xVCProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextContent )
14023
+ xText = xTextContent->getAnchor()->getText();
14024
+ xVCProps.set( xText->createTextCursor(), uno::UNO_QUERY_THROW );
14027
+ if( !xText.is() )
14028
+ throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), uno::Reference< uno::XInterface >() );
14033
+sal_Bool gotoSelectedObjectAnchor( const uno::Reference< frame::XModel>& xModel ) throw (uno::RuntimeException)
14035
+ sal_Bool isObjectSelected = sal_False;
14036
+ uno::Reference< text::XTextContent > xTextContent( xModel->getCurrentSelection(), uno::UNO_QUERY );
14037
+ if( xTextContent.is() )
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;
14044
+ return isObjectSelected;
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
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>
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);
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= \
14090
$(SVXMSFILTERLIB) \
14092
+.IF "$(GUI)"=="WNT"
14093
+SHL5STDLIBS+=$(SHELLLIB)
14096
SHL5DEPN=$(SHL1TARGETN)
14097
SHL5LIBS=$(SLB)$/$(TARGET_VBA).lib
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;
14105
css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess;
14106
css::uno::Reference< css::container::XNameAccess > m_xNameAccess;
14107
+ sal_Bool mbIgnoreCase;
14109
virtual css::uno::Any getItemByStringIndex( const rtl::OUString& sIndex ) throw (css::uno::RuntimeException)
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 >() );
14114
+ if( mbIgnoreCase )
14116
+ css::uno::Sequence< rtl::OUString > sElementNames = m_xNameAccess->getElementNames();
14117
+ for( sal_Int32 i = 0; i < sElementNames.getLength(); i++ )
14119
+ rtl::OUString aName = sElementNames[i];
14120
+ if( aName.equalsIgnoreAsciiCase( sIndex ) )
14122
+ return createCollectionObject( m_xNameAccess->getByName( aName ) );
14126
return createCollectionObject( m_xNameAccess->getByName( sIndex ) );
14129
@@ -185,7 +198,7 @@ protected:
14130
return createCollectionObject( m_xIndexAccess->getByIndex( nIndex - 1 ) );
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); }
14136
virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException)
14138
@@ -250,7 +263,7 @@ class VBAHELPER_DLLPUBLIC CollTestImplHelper : public ScVbaCollectionBase< ::cp
14139
typedef ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > > ImplBase1;
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 ) {}
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
14164
+++ vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
14166
+/*************************************************************************
14168
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
14170
+ * Copyright 2008 by Sun Microsystems, Inc.
14172
+ * OpenOffice.org - a multi-platform office productivity suite
14177
+ * This file is part of OpenOffice.org.
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.
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).
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.
14194
+ ************************************************************************/
14195
+#ifndef VBAEVENTS_HELPER_BASE_HXX
14196
+#define VBAEVENTS_HELPER_BASE_HXX
14198
+#include <com/sun/star/uno/XComponentContext.hpp>
14199
+#include <vbahelper/vbahelperinterface.hxx>
14202
+class VBAHELPER_DLLPUBLIC VbaEventsHelperBase
14205
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
14206
+ sal_Bool mbIgnoreEvents;
14207
+ std::map< sal_Int32, rtl::OUString > m_aEventNameMap;
14210
+ void insert( const sal_Int32 nId, const rtl::OUString& sEventName );
14211
+ rtl::OUString getEventName( const sal_Int32 nEventId );
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);
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 );
14230
class VBAHELPER_DLLPUBLIC Millimeter
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>
14273
#include "vbacontrol.hxx"
14274
#include <vbahelper/vbahelper.hxx>
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;
14279
class ScVbaCheckbox : public CheckBoxImpl_BASE
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 ) );
14290
+::sal_Int32 SAL_CALL ScVbaControl::getForeColor() throw (::com::sun::star::uno::RuntimeException)
14292
+ sal_Int32 nForeColor;
14293
+ m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ) ) >>= nForeColor;
14294
+ return OORGBToXLRGB( nForeColor );
14297
+void SAL_CALL ScVbaControl::setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException)
14299
+ m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ), uno::makeAny( XLRGBToOORGB( _forecolor ) ) );
14301
//ScVbaControlFactory
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);
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
14323
//liuchen 2009-7-6 end
14325
+rtl::OUString SAL_CALL
14326
+ScVbaFrame::getAccelerator() throw (css::uno::RuntimeException)
14328
+ //FIXME: seems not support?
14329
+ return rtl::OUString();
14333
+ScVbaFrame::setAccelerator( const rtl::OUString& /*_accelerator*/ ) throw (::com::sun::star::uno::RuntimeException)
14335
+ //FIXME: seems not support?
14339
ScVbaFrame::getServiceImplName()
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);
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;
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 )
14366
@@ -68,20 +67,18 @@ ScVbaLabel::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::Run
14367
setCaption( sCaption );
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)
14376
- sal_Int32 nForeColor;
14377
- m_xProps->getPropertyValue( FORECOLOR ) >>= nForeColor;
14378
- return OORGBToXLRGB( nForeColor );
14379
+ //FIXME: seems not support?
14380
+ return rtl::OUString();
14383
-void SAL_CALL ScVbaLabel::setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException)
14385
- m_xProps->setPropertyValue( FORECOLOR, uno::makeAny( XLRGBToOORGB( _forecolor ) ) );
14387
+ScVbaLabel::setAccelerator( const rtl::OUString& /*_accelerator*/ ) throw (::com::sun::star::uno::RuntimeException)
14389
+ //FIXME: seems not support?
14391
-//liuchenn 2009-7-6
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);
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
14417
#include <vbalistcontrolhelper.hxx>
14419
+#include <vbahelper/vbapropvalue.hxx>
14421
using namespace com::sun::star;
14422
using namespace ooo::vba;
14424
const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
14426
+class ListPropListener : public PropListener
14429
+ uno::Reference< beans::XPropertySet > m_xProps;
14430
+ uno::Any m_pvargIndex;
14431
+ uno::Any m_pvarColumn;
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();
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 )
14443
+void ListPropListener::setValueEvent( const uno::Any& value )
14445
+ if( m_pvargIndex.hasValue() || m_pvarColumn.hasValue() )
14446
+ throw uno::RuntimeException( rtl::OUString::createFromAscii(
14447
+ "Bad argument" ), uno::Reference< uno::XInterface >() );
14449
+ m_xProps->setPropertyValue( ITEMS, value );
14452
+uno::Any ListPropListener::getValueEvent()
14454
+ uno::Sequence< rtl::OUString > sList;
14455
+ m_xProps->getPropertyValue( ITEMS ) >>= sList;
14456
+ sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
14458
+ if ( m_pvargIndex.hasValue() )
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 ];
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 )
14472
+ uno::Sequence< uno::Sequence< rtl::OUString > > sReturnArray( nLength );
14473
+ for ( sal_Int32 i = 0; i < nLength; ++i )
14475
+ sReturnArray[ i ].realloc( 10 );
14476
+ sReturnArray[ i ][ 0 ] = sList[ i ];
14478
+ aRet = uno::makeAny( sReturnArray );
14484
ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
14486
@@ -116,31 +174,5 @@ ListControlHelper::getListCount() throw (uno::RuntimeException)
14488
ListControlHelper::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
14490
- uno::Sequence< rtl::OUString > sList;
14491
- m_xProps->getPropertyValue( ITEMS ) >>= sList;
14492
- sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
14494
- if ( pvargIndex.hasValue() )
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 ];
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 )
14508
- uno::Sequence< uno::Sequence< rtl::OUString > > sReturnArray( nLength );
14509
- for ( sal_Int32 i = 0; i < nLength; ++i )
14511
- sReturnArray[ i ].realloc( 10 );
14512
- sReturnArray[ i ][ 0 ] = sList[ i ];
14514
- aRet = uno::makeAny( sReturnArray );
14517
+ return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( new ListPropListener( m_xProps, pvargIndex, pvarColumn ) ) ) );
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 \
14529
# --- Targets -------------------------------------------------------
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)
14538
uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
14539
+ if( bUpdate != xModel->hasControllersLocked() )
14542
xModel->unlockControllers();
14544
@@ -141,7 +143,8 @@ VbaApplicationBase::getVersion() throw (uno::RuntimeException)
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)
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() )
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
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>
14565
#include <tools/urlobj.hxx>
14566
@@ -69,13 +70,8 @@ VbaDocumentBase::getName() throw (uno::RuntimeException)
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();
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);
14589
+ xCloseable->close(sal_True);
14591
+ catch( uno::Exception& )
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,
14599
uno::Reference< lang::XComponent > xDisposable ( getModel(), uno::UNO_QUERY );
14600
if ( xDisposable.is() )
14601
- xDisposable->dispose();
14603
+ // To be on the safe side, catch possible veto exception anyway.
14606
+ xDisposable->dispose();
14608
+ catch( uno::Exception& )
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
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:
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() )
14636
+ INetURLObject aURL( xModel->getURL() );
14637
+ namesToIndices[ aURL.GetLastName() ] = nIndex++;
14641
+ uno::Reference< frame::XTitle > xTitle( xModel, uno::UNO_QUERY_THROW );
14642
+ sName = xTitle->getTitle();
14643
+ namesToIndices[ sName ] = nIndex++;
14648
diff --git vbahelper/source/vbahelper/vbaeventshelperbase.cxx vbahelper/source/vbahelper/vbaeventshelperbase.cxx
14649
new file mode 100644
14650
index 0000000..52aba1f
14652
+++ vbahelper/source/vbahelper/vbaeventshelperbase.cxx
14654
+/*************************************************************************
14656
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
14658
+ * Copyright 2008 by Sun Microsystems, Inc.
14660
+ * OpenOffice.org - a multi-platform office productivity suite
14665
+ * This file is part of OpenOffice.org.
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.
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).
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.
14682
+ ************************************************************************/
14683
+#include <vbahelper/vbaeventshelperbase.hxx>
14685
+using namespace ::com::sun::star;
14687
+VbaEventsHelperBase::VbaEventsHelperBase( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : m_xContext( xContext ), mbIgnoreEvents( sal_False )
14691
+void VbaEventsHelperBase::insert( const sal_Int32 nId, const rtl::OUString& sEventName )
14693
+ m_aEventNameMap.insert( std::make_pair( nId, sEventName ) );
14696
+rtl::OUString VbaEventsHelperBase::getEventName( const sal_Int32 nId )
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();
14704
+void SAL_CALL VbaEventsHelperBase::setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (css::uno::RuntimeException)
14706
+ mbIgnoreEvents = _ignoreevents;
14709
+::sal_Bool SAL_CALL VbaEventsHelperBase::getIgnoreEvents() throw (css::uno::RuntimeException)
14711
+ return mbIgnoreEvents;
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
14722
+void setOrAppendPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, const rtl::OUString& aName, const uno::Any& aValue )
14724
+ if( setPropertyValue( aProp, aName, aValue ) )
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;
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
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>
14749
@@ -222,25 +223,66 @@ ScVbaShape::setWidth( double _width ) throw (uno::RuntimeException)
14751
ScVbaShape::getLeft() throw (uno::RuntimeException)
14753
- return m_pShapeHelper->getLeft();
14757
+ left = m_pShapeHelper->getLeft();
14759
+ catch( uno::Exception& )
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 );
14770
ScVbaShape::setLeft( double _left ) throw (uno::RuntimeException)
14772
- m_pShapeHelper->setLeft( _left );
14775
+ m_pShapeHelper->setLeft( _left );
14777
+ catch( uno::Exception& )
14779
+ sal_Int32 nLeft = 0;
14780
+ nLeft = Millimeter::getInHundredthsOfOneMillimeter( _left );
14781
+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrientPosition" ), uno::makeAny( nLeft ) );
14786
ScVbaShape::getTop() throw (uno::RuntimeException)
14788
- return m_pShapeHelper->getTop();
14792
+ top = m_pShapeHelper->getTop();
14794
+ catch( uno::Exception& )
14796
+ sal_Int32 nTop = 0;
14797
+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition") ) ) >>= nTop;
14798
+ top = Millimeter::getInPoints( nTop );
14804
ScVbaShape::setTop( double _top ) throw (uno::RuntimeException)
14806
- return m_pShapeHelper->setTop( _top );
14809
+ m_pShapeHelper->setTop( _top );
14811
+ catch( uno::Exception& )
14813
+ sal_Int32 nTop = 0;
14814
+ nTop = Millimeter::getInHundredthsOfOneMillimeter( _top );
14815
+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "VertOrientPosition" ), uno::makeAny( nTop ) );
14820
@@ -507,35 +549,34 @@ sal_Int32 SAL_CALL
14821
ScVbaShape::getRelativeHorizontalPosition() throw (uno::RuntimeException)
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;
14832
- case text::TextContentAnchorType_AT_PARAGRAPH:
14833
+ case text::RelOrientation::FRAME:
14835
nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn;
14838
- case text::TextContentAnchorType_AT_PAGE:
14839
+ case text::RelOrientation::PAGE_FRAME:
14841
nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage;
14844
- case text::TextContentAnchorType_AT_CHARACTER:
14845
+ case text::RelOrientation::CHAR:
14847
nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter;
14850
- case text::TextContentAnchorType_AT_FRAME:
14851
- case text::TextContentAnchorType_AS_CHARACTER:
14852
+ case text::RelOrientation::PAGE_PRINT_AREA:
14854
nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
14859
- nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
14860
+ throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Shape::RelativeHorizontalPosition: not implemented" ) ), uno::Reference< uno::XInterface >() );
14863
return nRelativeHorizontalPosition;
14864
@@ -544,23 +585,27 @@ ScVbaShape::getRelativeHorizontalPosition() throw (uno::RuntimeException)
14866
ScVbaShape::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (uno::RuntimeException)
14868
- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
14869
+ sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
14870
switch( _relativehorizontalposition )
14872
case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter:
14874
- eType = text::TextContentAnchorType_AT_CHARACTER;
14875
+ nType = text::RelOrientation::CHAR;
14878
case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn:
14880
+ nType = text::RelOrientation::PAGE_FRAME;
14883
case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin:
14885
- eType = text::TextContentAnchorType_AT_PARAGRAPH;
14886
+ nType = text::RelOrientation::PAGE_PRINT_AREA;
14889
case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage:
14891
- eType = text::TextContentAnchorType_AT_PAGE;
14892
+ nType = text::RelOrientation::PAGE_FRAME;
14896
@@ -568,42 +613,41 @@ ScVbaShape::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalpositi
14897
DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
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 ) );
14905
ScVbaShape::getRelativeVerticalPosition() throw (uno::RuntimeException)
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;
14916
- case text::TextContentAnchorType_AT_PARAGRAPH:
14917
+ case text::RelOrientation::FRAME:
14919
nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph;
14922
- case text::TextContentAnchorType_AT_PAGE:
14923
+ case text::RelOrientation::PAGE_FRAME:
14925
nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage;
14928
- case text::TextContentAnchorType_AT_CHARACTER:
14929
+ case text::RelOrientation::TEXT_LINE:
14931
nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine;
14934
- case text::TextContentAnchorType_AT_FRAME:
14935
- case text::TextContentAnchorType_AS_CHARACTER:
14936
+ case text::RelOrientation::PAGE_PRINT_AREA:
14938
nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
14943
- nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
14944
+ throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Shape::RelativeVerticalPosition: not implemented" ) ), uno::Reference< uno::XInterface >() );
14947
return nRelativeVerticalPosition;
14948
@@ -612,23 +656,27 @@ ScVbaShape::getRelativeVerticalPosition() throw (uno::RuntimeException)
14950
ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (uno::RuntimeException)
14952
- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
14953
+ sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
14954
switch( _relativeverticalposition )
14956
case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine:
14958
- eType = text::TextContentAnchorType_AT_CHARACTER;
14959
+ nType = text::RelOrientation::TEXT_LINE;
14962
case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph:
14964
+ nType = text::RelOrientation::FRAME;
14967
case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin:
14969
- eType = text::TextContentAnchorType_AT_PARAGRAPH;
14970
+ nType = text::RelOrientation::PAGE_PRINT_AREA;
14973
case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage:
14975
- eType = text::TextContentAnchorType_AT_PAGE;
14976
+ nType = text::RelOrientation::PAGE_FRAME;
14980
@@ -636,7 +684,7 @@ ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition )
14981
DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
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 ) );
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)
14997
+rtl::OUString SAL_CALL ScVbaShapeRange::getName() throw (uno::RuntimeException)
14999
+ sal_Int32 nLen = getCount();
15000
+ for ( sal_Int32 index = 1; index <= nLen; ++index )
15002
+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW );
15003
+ return xShape->getName( );
15005
+ throw uno::RuntimeException();
15008
+void SAL_CALL ScVbaShapeRange::setName( const rtl::OUString& _name ) throw (uno::RuntimeException)
15010
+ sal_Int32 nLen = getCount();
15011
+ for ( sal_Int32 index = 1; index <= nLen; ++index )
15013
+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW );
15014
+ xShape->setName( _name );
15018
double SAL_CALL ScVbaShapeRange::getHeight() throw (uno::RuntimeException)
15020
sal_Int32 nLen = getCount();
15021
@@ -340,6 +361,16 @@ uno::Any SAL_CALL ScVbaShapeRange::WrapFormat( ) throw (css::uno::RuntimeExcept
15022
throw uno::RuntimeException();
15025
+void SAL_CALL ScVbaShapeRange::ZOrder( sal_Int32 ZOrderCmd ) throw (uno::RuntimeException)
15027
+ sal_Int32 nLen = getCount();
15028
+ for ( sal_Int32 index = 1; index <= nLen; ++index )
15030
+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW );
15031
+ xShape->ZOrder( ZOrderCmd );
15036
ScVbaShapeRange::getElementType() throw (uno::RuntimeException)
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 );
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 )
15049
m_xShapes.set( xShapes, uno::UNO_QUERY_THROW );
15050
m_xDrawPage.set( xShapes, uno::UNO_QUERY_THROW );