xref: /trunk/main/sw/source/ui/vba/vbaselection.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #include "vbaselection.hxx"
28*cdf0e10cSrcweir #include <vbahelper/vbahelper.hxx>
29*cdf0e10cSrcweir #include <tools/diagnose_ex.h>
30*cdf0e10cSrcweir #include "vbarange.hxx"
31*cdf0e10cSrcweir #include "vbafind.hxx"
32*cdf0e10cSrcweir #include "wordvbahelper.hxx"
33*cdf0e10cSrcweir #include <com/sun/star/text/XTextRange.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/text/XTextTable.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/text/XTextTableCursor.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/text/ControlCharacter.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/table/XCell.hpp>
38*cdf0e10cSrcweir #include <ooo/vba/word/WdUnits.hpp>
39*cdf0e10cSrcweir #include <ooo/vba/word/WdMovementType.hpp>
40*cdf0e10cSrcweir #include <ooo/vba/word/WdGoToItem.hpp>
41*cdf0e10cSrcweir #include <ooo/vba/word/WdGoToDirection.hpp>
42*cdf0e10cSrcweir #include <ooo/vba/word/XBookmark.hpp>
43*cdf0e10cSrcweir #include <ooo/vba/word/XApplication.hpp>
44*cdf0e10cSrcweir #include <com/sun/star/text/XPageCursor.hpp>
45*cdf0e10cSrcweir #include "unotbl.hxx"
46*cdf0e10cSrcweir #include "unocoll.hxx"
47*cdf0e10cSrcweir #include "vbatable.hxx"
48*cdf0e10cSrcweir #include <com/sun/star/view/XSelectionSupplier.hpp>
49*cdf0e10cSrcweir #include <com/sun/star/view/XViewCursor.hpp>
50*cdf0e10cSrcweir #include <ooo/vba/word/WdInformation.hpp>
51*cdf0e10cSrcweir #include <ooo/vba/word/WdHeaderFooterIndex.hpp>
52*cdf0e10cSrcweir #include "vbainformationhelper.hxx"
53*cdf0e10cSrcweir #include "vbafield.hxx"
54*cdf0e10cSrcweir #include "vbaheaderfooter.hxx"
55*cdf0e10cSrcweir #include "vbaheaderfooterhelper.hxx"
56*cdf0e10cSrcweir #include <vbahelper/vbashaperange.hxx>
57*cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
58*cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPage.hpp>
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir using namespace ::ooo::vba;
61*cdf0e10cSrcweir using namespace ::com::sun::star;
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir SwVbaSelection::SwVbaSelection( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& rModel ) throw ( uno::RuntimeException ) : SwVbaSelection_BASE( rParent, rContext ), mxModel( rModel )
64*cdf0e10cSrcweir {
65*cdf0e10cSrcweir     mxTextViewCursor = word::getXTextViewCursor( mxModel );
66*cdf0e10cSrcweir }
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir SwVbaSelection::~SwVbaSelection()
69*cdf0e10cSrcweir {
70*cdf0e10cSrcweir }
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir uno::Reference< text::XTextRange > SwVbaSelection::GetSelectedRange() throw ( uno::RuntimeException )
73*cdf0e10cSrcweir {
74*cdf0e10cSrcweir     uno::Reference< text::XTextRange > xTextRange;
75*cdf0e10cSrcweir     uno::Reference< lang::XServiceInfo > xServiceInfo( mxModel->getCurrentSelection(), uno::UNO_QUERY_THROW );
76*cdf0e10cSrcweir     if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextRanges") ) ) )
77*cdf0e10cSrcweir     {
78*cdf0e10cSrcweir         uno::Reference< container::XIndexAccess > xTextRanges( xServiceInfo, uno::UNO_QUERY_THROW );
79*cdf0e10cSrcweir         if( xTextRanges->getCount() > 0 )
80*cdf0e10cSrcweir         {
81*cdf0e10cSrcweir             // if there are multipul selection, just return the last selected Range.
82*cdf0e10cSrcweir             xTextRange.set( xTextRanges->getByIndex( xTextRanges->getCount()-1 ), uno::UNO_QUERY_THROW );
83*cdf0e10cSrcweir         }
84*cdf0e10cSrcweir     }
85*cdf0e10cSrcweir     else
86*cdf0e10cSrcweir     {
87*cdf0e10cSrcweir         throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
88*cdf0e10cSrcweir     }
89*cdf0e10cSrcweir     return xTextRange;
90*cdf0e10cSrcweir }
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir uno::Reference< word::XRange > SAL_CALL
93*cdf0e10cSrcweir SwVbaSelection::getRange() throw ( uno::RuntimeException )
94*cdf0e10cSrcweir {
95*cdf0e10cSrcweir     uno::Reference< text::XTextRange > xTextRange = GetSelectedRange();
96*cdf0e10cSrcweir     uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW );
97*cdf0e10cSrcweir     return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, xDocument, xTextRange->getStart(), xTextRange->getEnd(), mxTextViewCursor->getText() ) );
98*cdf0e10cSrcweir }
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir rtl::OUString SAL_CALL
101*cdf0e10cSrcweir SwVbaSelection::getText() throw ( uno::RuntimeException )
102*cdf0e10cSrcweir {
103*cdf0e10cSrcweir     return getRange()->getText();
104*cdf0e10cSrcweir }
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir void SAL_CALL
107*cdf0e10cSrcweir SwVbaSelection::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
108*cdf0e10cSrcweir {
109*cdf0e10cSrcweir     getRange()->setText( rText );
110*cdf0e10cSrcweir }
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir void SAL_CALL
113*cdf0e10cSrcweir SwVbaSelection::TypeText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
114*cdf0e10cSrcweir {
115*cdf0e10cSrcweir     // FIXME: handle the property Options.ReplaceSelection, the default value is sal_True
116*cdf0e10cSrcweir     setText( rText );
117*cdf0e10cSrcweir }
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir void SAL_CALL
120*cdf0e10cSrcweir SwVbaSelection::HomeKey( const uno::Any& _unit, const uno::Any& _extend ) throw ( uno::RuntimeException )
121*cdf0e10cSrcweir {
122*cdf0e10cSrcweir     sal_Int32 nUnit = word::WdUnits::wdLine;
123*cdf0e10cSrcweir     sal_Int32 nExtend = word::WdMovementType::wdMove;
124*cdf0e10cSrcweir     _unit >>= nUnit;
125*cdf0e10cSrcweir     _extend >>= nExtend;
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir     switch( nUnit )
128*cdf0e10cSrcweir     {
129*cdf0e10cSrcweir         case word::WdUnits::wdStory:
130*cdf0e10cSrcweir         {
131*cdf0e10cSrcweir             // go to the begin of the document
132*cdf0e10cSrcweir             rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfDoc"));
133*cdf0e10cSrcweir             dispatchRequests( mxModel,url );
134*cdf0e10cSrcweir             // If something is selected, it needs to go twice
135*cdf0e10cSrcweir             dispatchRequests( mxModel,url );
136*cdf0e10cSrcweir             break;
137*cdf0e10cSrcweir         }
138*cdf0e10cSrcweir         case word::WdUnits::wdLine:
139*cdf0e10cSrcweir         {
140*cdf0e10cSrcweir             // go to the begin of the Line
141*cdf0e10cSrcweir             rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfLine"));
142*cdf0e10cSrcweir             dispatchRequests( mxModel,url );
143*cdf0e10cSrcweir             break;
144*cdf0e10cSrcweir         }
145*cdf0e10cSrcweir         default:
146*cdf0e10cSrcweir         {
147*cdf0e10cSrcweir             throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
148*cdf0e10cSrcweir             break;
149*cdf0e10cSrcweir         }
150*cdf0e10cSrcweir     }
151*cdf0e10cSrcweir }
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir void SAL_CALL
154*cdf0e10cSrcweir SwVbaSelection::EndKey( const uno::Any& _unit, const uno::Any& _extend ) throw ( uno::RuntimeException )
155*cdf0e10cSrcweir {
156*cdf0e10cSrcweir     sal_Int32 nUnit = word::WdUnits::wdLine;
157*cdf0e10cSrcweir     sal_Int32 nExtend = word::WdMovementType::wdMove;
158*cdf0e10cSrcweir     _unit >>= nUnit;
159*cdf0e10cSrcweir     _extend >>= nExtend;
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir     switch( nUnit )
162*cdf0e10cSrcweir     {
163*cdf0e10cSrcweir         case word::WdUnits::wdStory:
164*cdf0e10cSrcweir         {
165*cdf0e10cSrcweir             // go to the end of the document
166*cdf0e10cSrcweir             rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfDoc"));
167*cdf0e10cSrcweir             dispatchRequests( mxModel,url );
168*cdf0e10cSrcweir             // If something is selected, it needs to go twice
169*cdf0e10cSrcweir             dispatchRequests( mxModel,url );
170*cdf0e10cSrcweir             break;
171*cdf0e10cSrcweir         }
172*cdf0e10cSrcweir         case word::WdUnits::wdLine:
173*cdf0e10cSrcweir         {
174*cdf0e10cSrcweir             // go to the end of the Line
175*cdf0e10cSrcweir             rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfLine"));
176*cdf0e10cSrcweir             dispatchRequests( mxModel,url );
177*cdf0e10cSrcweir             break;
178*cdf0e10cSrcweir         }
179*cdf0e10cSrcweir         default:
180*cdf0e10cSrcweir         {
181*cdf0e10cSrcweir             throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
182*cdf0e10cSrcweir             break;
183*cdf0e10cSrcweir         }
184*cdf0e10cSrcweir     }
185*cdf0e10cSrcweir }
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir void SAL_CALL
188*cdf0e10cSrcweir SwVbaSelection::Delete( const uno::Any& /*_unit*/, const uno::Any& /*_count*/ ) throw ( uno::RuntimeException )
189*cdf0e10cSrcweir {
190*cdf0e10cSrcweir     // FIXME: handle the arguments: _unit and _count
191*cdf0e10cSrcweir     rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Delete"));
192*cdf0e10cSrcweir     dispatchRequests( mxModel,url );
193*cdf0e10cSrcweir }
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir void SwVbaSelection::NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw ( uno::RuntimeException )
196*cdf0e10cSrcweir {
197*cdf0e10cSrcweir     uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
198*cdf0e10cSrcweir     uno::Reference< text::XTextTable > xTextTable;
199*cdf0e10cSrcweir     uno::Reference< table::XCell > xCell;
200*cdf0e10cSrcweir     xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
201*cdf0e10cSrcweir     xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cell") ) ) >>= xCell;
202*cdf0e10cSrcweir     if( !xTextTable.is() || !xCell.is() )
203*cdf0e10cSrcweir     {
204*cdf0e10cSrcweir         DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
205*cdf0e10cSrcweir         return;
206*cdf0e10cSrcweir     }
207*cdf0e10cSrcweir     uno::Reference< beans::XPropertySet > xCellProps( xCell, uno::UNO_QUERY_THROW );
208*cdf0e10cSrcweir     rtl::OUString aCellName;
209*cdf0e10cSrcweir     xCellProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellName") ) ) >>= aCellName;
210*cdf0e10cSrcweir     uno::Reference< text::XTextTableCursor > xTextTableCursor = xTextTable->createCursorByCellName( aCellName );
211*cdf0e10cSrcweir     // move the table cursor
212*cdf0e10cSrcweir     switch( eDirection )
213*cdf0e10cSrcweir     {
214*cdf0e10cSrcweir         case MOVE_LEFT:
215*cdf0e10cSrcweir         {
216*cdf0e10cSrcweir             xTextTableCursor->goLeft( nCount, sal_False );
217*cdf0e10cSrcweir             break;
218*cdf0e10cSrcweir         }
219*cdf0e10cSrcweir         case MOVE_RIGHT:
220*cdf0e10cSrcweir         {
221*cdf0e10cSrcweir             xTextTableCursor->goRight( nCount, sal_False );
222*cdf0e10cSrcweir             break;
223*cdf0e10cSrcweir         }
224*cdf0e10cSrcweir         case MOVE_UP:
225*cdf0e10cSrcweir         {
226*cdf0e10cSrcweir             xTextTableCursor->goUp( nCount, sal_False );
227*cdf0e10cSrcweir             break;
228*cdf0e10cSrcweir         }
229*cdf0e10cSrcweir         case MOVE_DOWN:
230*cdf0e10cSrcweir         {
231*cdf0e10cSrcweir             xTextTableCursor->goDown( nCount, sal_False );
232*cdf0e10cSrcweir             break;
233*cdf0e10cSrcweir         }
234*cdf0e10cSrcweir         default:
235*cdf0e10cSrcweir         {
236*cdf0e10cSrcweir             DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
237*cdf0e10cSrcweir             return;
238*cdf0e10cSrcweir         }
239*cdf0e10cSrcweir     }
240*cdf0e10cSrcweir     // move the view cursor
241*cdf0e10cSrcweir     xCell = xTextTable->getCellByName( xTextTableCursor->getRangeName() );
242*cdf0e10cSrcweir     mxTextViewCursor->gotoRange( uno::Reference< text::XTextRange >( xCell, uno::UNO_QUERY_THROW ), sal_False );
243*cdf0e10cSrcweir }
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir void SAL_CALL
246*cdf0e10cSrcweir SwVbaSelection::MoveRight( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
247*cdf0e10cSrcweir {
248*cdf0e10cSrcweir     sal_Int32 nUnit = word::WdUnits::wdCharacter;
249*cdf0e10cSrcweir     sal_Int32 nCount = 1;
250*cdf0e10cSrcweir     sal_Int32 nExtend = word::WdMovementType::wdMove;
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir     if( _unit.hasValue() )
253*cdf0e10cSrcweir         _unit >>= nUnit;
254*cdf0e10cSrcweir     if( _count.hasValue() )
255*cdf0e10cSrcweir         _count >>= nCount;
256*cdf0e10cSrcweir     if( _extend.hasValue() )
257*cdf0e10cSrcweir         _extend >>= nExtend;
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir     if( nCount == 0 )
260*cdf0e10cSrcweir         return;
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir     if( nCount < 0 )
263*cdf0e10cSrcweir     {
264*cdf0e10cSrcweir         // TODO: call MoveLeft;
265*cdf0e10cSrcweir         MoveLeft( _unit, uno::makeAny( -nCount ), _extend );
266*cdf0e10cSrcweir         return;
267*cdf0e10cSrcweir     }
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir     switch( nUnit )
270*cdf0e10cSrcweir     {
271*cdf0e10cSrcweir         case word::WdUnits::wdCell:
272*cdf0e10cSrcweir         {
273*cdf0e10cSrcweir             if(  nExtend == word::WdMovementType::wdExtend )
274*cdf0e10cSrcweir             {
275*cdf0e10cSrcweir                 DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
276*cdf0e10cSrcweir                 return;
277*cdf0e10cSrcweir             }
278*cdf0e10cSrcweir             NextCell( nCount, MOVE_RIGHT );
279*cdf0e10cSrcweir             break;
280*cdf0e10cSrcweir         }
281*cdf0e10cSrcweir         default:
282*cdf0e10cSrcweir         {
283*cdf0e10cSrcweir             throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
284*cdf0e10cSrcweir             break;
285*cdf0e10cSrcweir         }
286*cdf0e10cSrcweir     }
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir }
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir void SAL_CALL
291*cdf0e10cSrcweir SwVbaSelection::MoveLeft( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
292*cdf0e10cSrcweir {
293*cdf0e10cSrcweir     sal_Int32 nUnit = word::WdUnits::wdCharacter;
294*cdf0e10cSrcweir     sal_Int32 nCount = 1;
295*cdf0e10cSrcweir     sal_Int32 nExtend = word::WdMovementType::wdMove;
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir     if( _unit.hasValue() )
298*cdf0e10cSrcweir         _unit >>= nUnit;
299*cdf0e10cSrcweir     if( _count.hasValue() )
300*cdf0e10cSrcweir         _count >>= nCount;
301*cdf0e10cSrcweir     if( _extend.hasValue() )
302*cdf0e10cSrcweir         _extend >>= nExtend;
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir     if( nCount == 0 )
305*cdf0e10cSrcweir         return;
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir     if( nCount < 0 )
308*cdf0e10cSrcweir     {
309*cdf0e10cSrcweir         MoveRight( _unit, uno::makeAny( -nCount ), _extend );
310*cdf0e10cSrcweir         return;
311*cdf0e10cSrcweir     }
312*cdf0e10cSrcweir 
313*cdf0e10cSrcweir     switch( nUnit )
314*cdf0e10cSrcweir     {
315*cdf0e10cSrcweir         case word::WdUnits::wdCell:
316*cdf0e10cSrcweir         {
317*cdf0e10cSrcweir             if(  nExtend == word::WdMovementType::wdExtend )
318*cdf0e10cSrcweir             {
319*cdf0e10cSrcweir                 DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
320*cdf0e10cSrcweir                 return;
321*cdf0e10cSrcweir             }
322*cdf0e10cSrcweir             NextCell( nCount, MOVE_LEFT );
323*cdf0e10cSrcweir             break;
324*cdf0e10cSrcweir         }
325*cdf0e10cSrcweir         default:
326*cdf0e10cSrcweir         {
327*cdf0e10cSrcweir             throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
328*cdf0e10cSrcweir             break;
329*cdf0e10cSrcweir         }
330*cdf0e10cSrcweir     }
331*cdf0e10cSrcweir 
332*cdf0e10cSrcweir }
333*cdf0e10cSrcweir 
334*cdf0e10cSrcweir void SAL_CALL
335*cdf0e10cSrcweir SwVbaSelection::MoveDown( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
336*cdf0e10cSrcweir {
337*cdf0e10cSrcweir     sal_Int32 nUnit = word::WdUnits::wdCharacter;
338*cdf0e10cSrcweir     sal_Int32 nCount = 1;
339*cdf0e10cSrcweir     sal_Int32 nExtend = word::WdMovementType::wdMove;
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir     if( _unit.hasValue() )
342*cdf0e10cSrcweir         _unit >>= nUnit;
343*cdf0e10cSrcweir     if( _count.hasValue() )
344*cdf0e10cSrcweir         _count >>= nCount;
345*cdf0e10cSrcweir     if( _extend.hasValue() )
346*cdf0e10cSrcweir         _extend >>= nExtend;
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir     if( nCount == 0 )
349*cdf0e10cSrcweir         return;
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir     if( nCount < 0 )
352*cdf0e10cSrcweir     {
353*cdf0e10cSrcweir         // TODO: call MoveLeft;
354*cdf0e10cSrcweir         //MoveUp( _unit, uno::makeAny( -nCount ), _extend );
355*cdf0e10cSrcweir         return;
356*cdf0e10cSrcweir     }
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir     switch( nUnit )
359*cdf0e10cSrcweir     {
360*cdf0e10cSrcweir         case word::WdUnits::wdLine:
361*cdf0e10cSrcweir         {
362*cdf0e10cSrcweir             uno::Reference< view::XViewCursor > xViewCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
363*cdf0e10cSrcweir             sal_Bool bExpand = ( nExtend == word::WdMovementType::wdMove ) ? sal_False : sal_True;
364*cdf0e10cSrcweir             xViewCursor->goDown( nCount, bExpand );
365*cdf0e10cSrcweir             break;
366*cdf0e10cSrcweir         }
367*cdf0e10cSrcweir         default:
368*cdf0e10cSrcweir         {
369*cdf0e10cSrcweir             throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
370*cdf0e10cSrcweir             break;
371*cdf0e10cSrcweir         }
372*cdf0e10cSrcweir     }
373*cdf0e10cSrcweir 
374*cdf0e10cSrcweir }
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir void SAL_CALL
377*cdf0e10cSrcweir SwVbaSelection::TypeParagraph() throw ( uno::RuntimeException )
378*cdf0e10cSrcweir {
379*cdf0e10cSrcweir     // #FIXME: if the selection is an entire paragraph, it's replaced
380*cdf0e10cSrcweir     // by the new paragraph
381*cdf0e10cSrcweir     sal_Bool isCollapsed = mxTextViewCursor->isCollapsed();
382*cdf0e10cSrcweir     InsertParagraph();
383*cdf0e10cSrcweir     if( isCollapsed )
384*cdf0e10cSrcweir         mxTextViewCursor->collapseToStart();
385*cdf0e10cSrcweir }
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir void SAL_CALL
388*cdf0e10cSrcweir SwVbaSelection::InsertParagraph() throw ( uno::RuntimeException )
389*cdf0e10cSrcweir {
390*cdf0e10cSrcweir     // #FIME: the selection should include the new paragraph.
391*cdf0e10cSrcweir     getRange()->InsertParagraph();
392*cdf0e10cSrcweir }
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir void SAL_CALL
395*cdf0e10cSrcweir SwVbaSelection::InsertParagraphBefore() throw ( uno::RuntimeException )
396*cdf0e10cSrcweir {
397*cdf0e10cSrcweir     getRange()->InsertParagraphBefore();
398*cdf0e10cSrcweir }
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir void SAL_CALL
401*cdf0e10cSrcweir SwVbaSelection::InsertParagraphAfter() throw ( uno::RuntimeException )
402*cdf0e10cSrcweir {
403*cdf0e10cSrcweir     getRange()->InsertParagraphAfter();
404*cdf0e10cSrcweir }
405*cdf0e10cSrcweir 
406*cdf0e10cSrcweir uno::Reference< word::XParagraphFormat > SAL_CALL
407*cdf0e10cSrcweir SwVbaSelection::getParagraphFormat() throw ( uno::RuntimeException )
408*cdf0e10cSrcweir {
409*cdf0e10cSrcweir     return getRange()->getParagraphFormat();
410*cdf0e10cSrcweir }
411*cdf0e10cSrcweir 
412*cdf0e10cSrcweir void SAL_CALL
413*cdf0e10cSrcweir SwVbaSelection::setParagraphFormat( const uno::Reference< word::XParagraphFormat >& rParagraphFormat ) throw ( uno::RuntimeException )
414*cdf0e10cSrcweir {
415*cdf0e10cSrcweir     return getRange()->setParagraphFormat( rParagraphFormat );
416*cdf0e10cSrcweir }
417*cdf0e10cSrcweir 
418*cdf0e10cSrcweir uno::Reference< word::XFind > SAL_CALL
419*cdf0e10cSrcweir SwVbaSelection::getFind() throw ( uno::RuntimeException )
420*cdf0e10cSrcweir {
421*cdf0e10cSrcweir     uno::Reference< text::XTextRange > xTextRange = GetSelectedRange();
422*cdf0e10cSrcweir     return uno::Reference< word::XFind >( new SwVbaFind( this, mxContext, mxModel, xTextRange ) );
423*cdf0e10cSrcweir }
424*cdf0e10cSrcweir 
425*cdf0e10cSrcweir uno::Reference< word::XStyle > SAL_CALL
426*cdf0e10cSrcweir SwVbaSelection::getStyle() throw ( uno::RuntimeException )
427*cdf0e10cSrcweir {
428*cdf0e10cSrcweir     return getRange()->getStyle();
429*cdf0e10cSrcweir }
430*cdf0e10cSrcweir 
431*cdf0e10cSrcweir void SAL_CALL
432*cdf0e10cSrcweir SwVbaSelection::setStyle( const uno::Reference< word::XStyle >& rStyle ) throw ( uno::RuntimeException )
433*cdf0e10cSrcweir {
434*cdf0e10cSrcweir     return getRange()->setStyle( rStyle );
435*cdf0e10cSrcweir }
436*cdf0e10cSrcweir 
437*cdf0e10cSrcweir uno::Reference< word::XFont > SAL_CALL
438*cdf0e10cSrcweir SwVbaSelection::getFont() throw ( uno::RuntimeException )
439*cdf0e10cSrcweir {
440*cdf0e10cSrcweir     return getRange()->getFont();
441*cdf0e10cSrcweir }
442*cdf0e10cSrcweir 
443*cdf0e10cSrcweir void SAL_CALL
444*cdf0e10cSrcweir SwVbaSelection::TypeBackspace() throw ( uno::RuntimeException )
445*cdf0e10cSrcweir {
446*cdf0e10cSrcweir     rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SwBackspace"));
447*cdf0e10cSrcweir     dispatchRequests( mxModel,url );
448*cdf0e10cSrcweir }
449*cdf0e10cSrcweir 
450*cdf0e10cSrcweir uno::Reference< word::XRange > SAL_CALL SwVbaSelection::GoTo( const uno::Any& _what, const uno::Any& _which, const uno::Any& _count, const uno::Any& _name ) throw (uno::RuntimeException)
451*cdf0e10cSrcweir {
452*cdf0e10cSrcweir     sal_Int32 nWhat = 0;
453*cdf0e10cSrcweir     if( ( _what >>= nWhat ) != sal_True )
454*cdf0e10cSrcweir          DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
455*cdf0e10cSrcweir     switch( nWhat )
456*cdf0e10cSrcweir     {
457*cdf0e10cSrcweir         case word::WdGoToItem::wdGoToBookmark:
458*cdf0e10cSrcweir         {
459*cdf0e10cSrcweir             rtl::OUString sName;
460*cdf0e10cSrcweir             uno::Reference< word::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
461*cdf0e10cSrcweir             uno::Reference< word::XBookmark > xBookmark( xApplication->getActiveDocument()->Bookmarks(_name), uno::UNO_QUERY_THROW );
462*cdf0e10cSrcweir             xBookmark->Select();
463*cdf0e10cSrcweir             //return uno::Reference< word::XRange >( xBookmark->Range(), uno::UNO_QUERY_THROW );
464*cdf0e10cSrcweir             break;
465*cdf0e10cSrcweir         }
466*cdf0e10cSrcweir         case word::WdGoToItem::wdGoToPage:
467*cdf0e10cSrcweir         {
468*cdf0e10cSrcweir             uno::Reference< text::XPageCursor > xPageCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
469*cdf0e10cSrcweir             sal_Int32 nCurrPage = xPageCursor->getPage();
470*cdf0e10cSrcweir             sal_Int32 nLastPage = word::getPageCount( mxModel );
471*cdf0e10cSrcweir             sal_Int32 nCount = 0;
472*cdf0e10cSrcweir             if( _count.hasValue() )
473*cdf0e10cSrcweir                 _count >>= nCount;
474*cdf0e10cSrcweir             sal_Int32 nWhich = 0;
475*cdf0e10cSrcweir             if( _which.hasValue() )
476*cdf0e10cSrcweir                 _which >>= nWhich;
477*cdf0e10cSrcweir              sal_Int32 nPage = 0;
478*cdf0e10cSrcweir              switch( nWhich )
479*cdf0e10cSrcweir              {
480*cdf0e10cSrcweir                 case word::WdGoToDirection::wdGoToLast:
481*cdf0e10cSrcweir                 {
482*cdf0e10cSrcweir                     nPage = nLastPage;
483*cdf0e10cSrcweir                     break;
484*cdf0e10cSrcweir                 }
485*cdf0e10cSrcweir                 case word::WdGoToDirection::wdGoToNext:
486*cdf0e10cSrcweir                 {
487*cdf0e10cSrcweir                     nPage = nCurrPage + 1;
488*cdf0e10cSrcweir                     break;
489*cdf0e10cSrcweir                 }
490*cdf0e10cSrcweir                 case word::WdGoToDirection::wdGoToPrevious:
491*cdf0e10cSrcweir                 {
492*cdf0e10cSrcweir                     nPage = nCurrPage - 1;
493*cdf0e10cSrcweir                     break;
494*cdf0e10cSrcweir                 }
495*cdf0e10cSrcweir                 default:
496*cdf0e10cSrcweir                 {
497*cdf0e10cSrcweir                     nPage = nCount;
498*cdf0e10cSrcweir                 }
499*cdf0e10cSrcweir              }
500*cdf0e10cSrcweir              if( nPage <= 0 )
501*cdf0e10cSrcweir                 nPage = 1;
502*cdf0e10cSrcweir              if( nPage > nLastPage )
503*cdf0e10cSrcweir                 nPage = nLastPage;
504*cdf0e10cSrcweir              xPageCursor->jumpToPage( ( sal_Int16 )( nPage ) );
505*cdf0e10cSrcweir              break;
506*cdf0e10cSrcweir         }
507*cdf0e10cSrcweir         case word::WdGoToItem::wdGoToSection:
508*cdf0e10cSrcweir         {
509*cdf0e10cSrcweir             // TODO: implement Section object
510*cdf0e10cSrcweir         }
511*cdf0e10cSrcweir         default:
512*cdf0e10cSrcweir             throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
513*cdf0e10cSrcweir     }
514*cdf0e10cSrcweir     return getRange();
515*cdf0e10cSrcweir }
516*cdf0e10cSrcweir 
517*cdf0e10cSrcweir ::sal_Int32 SAL_CALL SwVbaSelection::getLanguageID() throw (uno::RuntimeException)
518*cdf0e10cSrcweir {
519*cdf0e10cSrcweir     return getRange()->getLanguageID();
520*cdf0e10cSrcweir }
521*cdf0e10cSrcweir 
522*cdf0e10cSrcweir void SAL_CALL SwVbaSelection::setLanguageID( ::sal_Int32 _languageid ) throw (uno::RuntimeException)
523*cdf0e10cSrcweir {
524*cdf0e10cSrcweir     getRange()->setLanguageID( _languageid );
525*cdf0e10cSrcweir }
526*cdf0e10cSrcweir 
527*cdf0e10cSrcweir uno::Any SAL_CALL SwVbaSelection::Information( sal_Int32 _type ) throw (uno::RuntimeException)
528*cdf0e10cSrcweir {
529*cdf0e10cSrcweir     uno::Any result;
530*cdf0e10cSrcweir     //uno::Reference< view::XSelectionSupplier > xSel( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
531*cdf0e10cSrcweir     //uno::Any aSelectedObject = xSel->getSelection();
532*cdf0e10cSrcweir     switch( _type )
533*cdf0e10cSrcweir     {
534*cdf0e10cSrcweir         case word::WdInformation::wdActiveEndPageNumber:
535*cdf0e10cSrcweir         {
536*cdf0e10cSrcweir             result = uno::makeAny( SwVbaInformationHelper::handleWdActiveEndPageNumber( mxTextViewCursor ) );
537*cdf0e10cSrcweir             break;
538*cdf0e10cSrcweir         }
539*cdf0e10cSrcweir         case word::WdInformation::wdNumberOfPagesInDocument:
540*cdf0e10cSrcweir         {
541*cdf0e10cSrcweir             result = uno::makeAny( SwVbaInformationHelper::handleWdNumberOfPagesInDocument( mxModel ) );
542*cdf0e10cSrcweir             break;
543*cdf0e10cSrcweir         }
544*cdf0e10cSrcweir         case word::WdInformation::wdVerticalPositionRelativeToPage:
545*cdf0e10cSrcweir         {
546*cdf0e10cSrcweir             result = uno::makeAny( SwVbaInformationHelper::handleWdVerticalPositionRelativeToPage( mxModel, mxTextViewCursor ) );
547*cdf0e10cSrcweir             break;
548*cdf0e10cSrcweir         }
549*cdf0e10cSrcweir         default:
550*cdf0e10cSrcweir             throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
551*cdf0e10cSrcweir     }
552*cdf0e10cSrcweir     // This method fails to restore the previouse selection
553*cdf0e10cSrcweir     //xSel->select( aSelectedObject );
554*cdf0e10cSrcweir     return result;
555*cdf0e10cSrcweir }
556*cdf0e10cSrcweir 
557*cdf0e10cSrcweir void SAL_CALL SwVbaSelection::InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException)
558*cdf0e10cSrcweir {
559*cdf0e10cSrcweir     getRange()->InsertBreak( _breakType );
560*cdf0e10cSrcweir }
561*cdf0e10cSrcweir 
562*cdf0e10cSrcweir uno::Any SAL_CALL
563*cdf0e10cSrcweir SwVbaSelection::Tables( const uno::Any& aIndex ) throw (uno::RuntimeException)
564*cdf0e10cSrcweir {
565*cdf0e10cSrcweir     // Hacky implementation due to missing api ( and lack of knowledge )
566*cdf0e10cSrcweir     // we can only support a selection that is a single table
567*cdf0e10cSrcweir     if ( !aIndex.hasValue() ) // currently we can't support multiple tables in a selection
568*cdf0e10cSrcweir        throw uno::RuntimeException();
569*cdf0e10cSrcweir     // if the current selection is a XTextTableCursor and the index is 1 then we can service this request, otherwise we just have to throw
570*cdf0e10cSrcweir     uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
571*cdf0e10cSrcweir 
572*cdf0e10cSrcweir     if ( !xTextTableCursor.is() )
573*cdf0e10cSrcweir        throw uno::RuntimeException();
574*cdf0e10cSrcweir 
575*cdf0e10cSrcweir     sal_Int32 nIndex = 0;
576*cdf0e10cSrcweir     aIndex >>= nIndex;
577*cdf0e10cSrcweir 
578*cdf0e10cSrcweir     uno::Any aRet;
579*cdf0e10cSrcweir 
580*cdf0e10cSrcweir     if ( nIndex != 1 )
581*cdf0e10cSrcweir        throw uno::RuntimeException();
582*cdf0e10cSrcweir     SwXTextTableCursor* pTTCursor = dynamic_cast< SwXTextTableCursor* >( xTextTableCursor.get() );
583*cdf0e10cSrcweir     if ( pTTCursor )
584*cdf0e10cSrcweir     {
585*cdf0e10cSrcweir         SwFrmFmt* pFmt = pTTCursor->GetFrmFmt();
586*cdf0e10cSrcweir         rtl::OUString sTableName;
587*cdf0e10cSrcweir         if ( pFmt )
588*cdf0e10cSrcweir         {
589*cdf0e10cSrcweir             uno::Reference< text::XTextTable > xTbl = SwXTextTables::GetObject(*pFmt);
590*cdf0e10cSrcweir             uno::Reference< css::text::XTextDocument > xTextDoc( mxModel, uno::UNO_QUERY_THROW );
591*cdf0e10cSrcweir             uno::Reference< word::XTable > xVBATbl = new SwVbaTable( mxParent, mxContext, xTextDoc, xTbl );
592*cdf0e10cSrcweir             aRet <<= xVBATbl;
593*cdf0e10cSrcweir         }
594*cdf0e10cSrcweir     }
595*cdf0e10cSrcweir     return aRet;
596*cdf0e10cSrcweir 
597*cdf0e10cSrcweir }
598*cdf0e10cSrcweir 
599*cdf0e10cSrcweir uno::Any SAL_CALL
600*cdf0e10cSrcweir SwVbaSelection::Fields( const uno::Any& index ) throw (uno::RuntimeException)
601*cdf0e10cSrcweir {
602*cdf0e10cSrcweir     uno::Reference< XCollection > xCol( new SwVbaFields( mxParent, mxContext, mxModel ) );
603*cdf0e10cSrcweir     if ( index.hasValue() )
604*cdf0e10cSrcweir         return xCol->Item( index, uno::Any() );
605*cdf0e10cSrcweir     return uno::makeAny( xCol );
606*cdf0e10cSrcweir }
607*cdf0e10cSrcweir 
608*cdf0e10cSrcweir uno::Reference< word::XHeaderFooter > SAL_CALL
609*cdf0e10cSrcweir SwVbaSelection::getHeaderFooter() throw ( uno::RuntimeException )
610*cdf0e10cSrcweir {
611*cdf0e10cSrcweir     uno::Reference< text::XText > xCurrentText = word::getXTextViewCursor( mxModel )->getText();
612*cdf0e10cSrcweir     if( HeaderFooterHelper::isHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isFooter( mxModel, xCurrentText ) )
613*cdf0e10cSrcweir     {
614*cdf0e10cSrcweir         uno::Reference< beans::XPropertySet > xPageStyleProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
615*cdf0e10cSrcweir         sal_Int32 nIndex = word::WdHeaderFooterIndex::wdHeaderFooterPrimary;
616*cdf0e10cSrcweir         sal_Bool isHeader = HeaderFooterHelper::isHeader( mxModel, xCurrentText );
617*cdf0e10cSrcweir         if( HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) )
618*cdf0e10cSrcweir             nIndex = word::WdHeaderFooterIndex::wdHeaderFooterEvenPages;
619*cdf0e10cSrcweir         else if( HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) )
620*cdf0e10cSrcweir             nIndex = word::WdHeaderFooterIndex::wdHeaderFooterFirstPage;
621*cdf0e10cSrcweir 
622*cdf0e10cSrcweir         return uno::Reference< word::XHeaderFooter >( new SwVbaHeaderFooter( this, mxContext, mxModel, xPageStyleProps, isHeader, nIndex ) );
623*cdf0e10cSrcweir 
624*cdf0e10cSrcweir     }
625*cdf0e10cSrcweir     return uno::Reference< word::XHeaderFooter >();
626*cdf0e10cSrcweir }
627*cdf0e10cSrcweir 
628*cdf0e10cSrcweir uno::Any SAL_CALL
629*cdf0e10cSrcweir SwVbaSelection::ShapeRange( ) throw (uno::RuntimeException)
630*cdf0e10cSrcweir {
631*cdf0e10cSrcweir     uno::Reference< drawing::XShapes > xShapes( mxModel->getCurrentSelection(), uno::UNO_QUERY );
632*cdf0e10cSrcweir 
633*cdf0e10cSrcweir     if ( !xShapes.is() )
634*cdf0e10cSrcweir        throw uno::RuntimeException();
635*cdf0e10cSrcweir 
636*cdf0e10cSrcweir     uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW );
637*cdf0e10cSrcweir     uno::Reference< drawing::XDrawPage > xDrawPage = xDrawPageSupplier->getDrawPage();
638*cdf0e10cSrcweir     uno::Reference< container::XIndexAccess > xShapesAccess( xShapes, uno::UNO_QUERY_THROW );
639*cdf0e10cSrcweir     return uno::makeAny( uno::Reference< msforms::XShapeRange >( new ScVbaShapeRange( this, mxContext, xShapesAccess, xDrawPage, mxModel ) ) );
640*cdf0e10cSrcweir }
641*cdf0e10cSrcweir 
642*cdf0e10cSrcweir ::sal_Int32 SAL_CALL SwVbaSelection::getStart() throw (uno::RuntimeException)
643*cdf0e10cSrcweir {
644*cdf0e10cSrcweir     return getRange()->getStart();
645*cdf0e10cSrcweir }
646*cdf0e10cSrcweir 
647*cdf0e10cSrcweir void SAL_CALL SwVbaSelection::setStart( ::sal_Int32 _start ) throw (uno::RuntimeException)
648*cdf0e10cSrcweir {
649*cdf0e10cSrcweir     getRange()->setStart( _start );
650*cdf0e10cSrcweir }
651*cdf0e10cSrcweir ::sal_Int32 SAL_CALL SwVbaSelection::getEnd() throw (uno::RuntimeException)
652*cdf0e10cSrcweir {
653*cdf0e10cSrcweir     return getRange()->getEnd();
654*cdf0e10cSrcweir }
655*cdf0e10cSrcweir 
656*cdf0e10cSrcweir void SAL_CALL SwVbaSelection::setEnd( ::sal_Int32 _end ) throw (uno::RuntimeException)
657*cdf0e10cSrcweir {
658*cdf0e10cSrcweir     getRange()->setEnd( _end );
659*cdf0e10cSrcweir }
660*cdf0e10cSrcweir 
661*cdf0e10cSrcweir rtl::OUString&
662*cdf0e10cSrcweir SwVbaSelection::getServiceImplName()
663*cdf0e10cSrcweir {
664*cdf0e10cSrcweir 	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaSelection") );
665*cdf0e10cSrcweir 	return sImplName;
666*cdf0e10cSrcweir }
667*cdf0e10cSrcweir 
668*cdf0e10cSrcweir uno::Sequence< rtl::OUString >
669*cdf0e10cSrcweir SwVbaSelection::getServiceNames()
670*cdf0e10cSrcweir {
671*cdf0e10cSrcweir 	static uno::Sequence< rtl::OUString > aServiceNames;
672*cdf0e10cSrcweir 	if ( aServiceNames.getLength() == 0 )
673*cdf0e10cSrcweir 	{
674*cdf0e10cSrcweir 		aServiceNames.realloc( 1 );
675*cdf0e10cSrcweir 		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Selection" ) );
676*cdf0e10cSrcweir 	}
677*cdf0e10cSrcweir 	return aServiceNames;
678*cdf0e10cSrcweir }
679*cdf0e10cSrcweir 
680