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