LibreOffice Module sw (master)  1
vbaselection.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 #include "vbaselection.hxx"
20 #include <vbahelper/vbahelper.hxx>
21 #include <tools/diagnose_ex.h>
22 #include "vbarange.hxx"
23 #include "vbafind.hxx"
24 #include <com/sun/star/text/XTextRange.hpp>
25 #include <com/sun/star/text/XTextTable.hpp>
26 #include <com/sun/star/text/XTextTableCursor.hpp>
27 #include <com/sun/star/text/ControlCharacter.hpp>
28 #include <com/sun/star/table/XCell.hpp>
29 #include <basic/sberrors.hxx>
30 #include <ooo/vba/word/WdUnits.hpp>
31 #include <ooo/vba/word/WdMovementType.hpp>
32 #include <ooo/vba/word/WdGoToItem.hpp>
33 #include <ooo/vba/word/WdGoToDirection.hpp>
34 #include <ooo/vba/word/XBookmark.hpp>
35 #include <ooo/vba/word/XApplication.hpp>
36 #include <ooo/vba/word/WdCollapseDirection.hpp>
37 #include <com/sun/star/text/XPageCursor.hpp>
38 #include <unotbl.hxx>
39 #include <unocoll.hxx>
40 #include "vbatable.hxx"
41 #include <com/sun/star/view/XSelectionSupplier.hpp>
42 #include <com/sun/star/view/XViewCursor.hpp>
43 #include <com/sun/star/view/XLineCursor.hpp>
44 #include <com/sun/star/text/XWordCursor.hpp>
45 #include <com/sun/star/text/XParagraphCursor.hpp>
46 #include <ooo/vba/word/WdInformation.hpp>
47 #include <ooo/vba/word/WdHeaderFooterIndex.hpp>
48 #include <ooo/vba/word/WdSeekView.hpp>
49 #include "vbainformationhelper.hxx"
50 #include "vbafield.hxx"
51 #include "vbaheaderfooter.hxx"
54 #include <com/sun/star/drawing/ShapeCollection.hpp>
55 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
56 #include <com/sun/star/drawing/XDrawPage.hpp>
57 #include "vbarows.hxx"
58 #include "vbacolumns.hxx"
59 #include "vbatablehelper.hxx"
60 #include "vbacells.hxx"
61 #include "vbaview.hxx"
62 #include "vbaparagraph.hxx"
63 #include "vbastyle.hxx"
64 #include <docsh.hxx>
65 #include <tblenum.hxx>
66 #include <fesh.hxx>
67 
68 using namespace ::ooo::vba;
69 using namespace ::com::sun::star;
70 
71 SwVbaSelection::SwVbaSelection( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& rModel ) : SwVbaSelection_BASE( rParent, rContext ), mxModel( rModel )
72 {
74 }
75 
77 {
78 }
79 
80 uno::Reference< text::XTextRange > SwVbaSelection::GetSelectedRange()
81 {
82  uno::Reference< text::XTextRange > xTextRange;
83  uno::Reference< lang::XServiceInfo > xServiceInfo( mxModel->getCurrentSelection(), uno::UNO_QUERY_THROW );
84  if( !xServiceInfo->supportsService("com.sun.star.text.TextRanges") )
85  {
86  throw uno::RuntimeException("Not implemented" );
87  }
88 
89  uno::Reference< container::XIndexAccess > xTextRanges( xServiceInfo, uno::UNO_QUERY_THROW );
90  if( xTextRanges->getCount() > 0 )
91  {
92  // if there are multiple selection, just return the last selected Range.
93  xTextRange.set( xTextRanges->getByIndex( xTextRanges->getCount()-1 ), uno::UNO_QUERY_THROW );
94  }
95 
96  return xTextRange;
97 }
98 
99 uno::Reference< word::XRange > SAL_CALL
101 {
102  uno::Reference< text::XTextRange > xTextRange = GetSelectedRange();
103  uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW );
104  return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, xDocument, xTextRange->getStart(), xTextRange->getEnd(), mxTextViewCursor->getText() ) );
105 }
106 
107 OUString SAL_CALL
109 {
110  return getRange()->getText();
111 }
112 
113 void SAL_CALL
114 SwVbaSelection::setText( const OUString& rText )
115 {
116  getRange()->setText( rText );
117 }
118 
119 void SAL_CALL
120 SwVbaSelection::TypeText( const OUString& rText )
121 {
122  // FIXME: handle the property Options.ReplaceSelection, the default value is true
123  setText( rText );
124 }
125 
126 void SAL_CALL
127 SwVbaSelection::HomeKey( const uno::Any& _unit, const uno::Any& _extend )
128 {
129  sal_Int32 nUnit = word::WdUnits::wdLine;
130  sal_Int32 nExtend = word::WdMovementType::wdMove;
131  _unit >>= nUnit;
132  _extend >>= nExtend;
133  bool bExtend = nExtend == word::WdMovementType::wdExtend;
134 
135  switch( nUnit )
136  {
137  case word::WdUnits::wdStory:
138  {
139  // go to the valid text first so that the current view cursor is valid to call gotoRange.
141  // go to the begin of the document
142  uno::Reference< text::XText > xCurrentText = word::getCurrentXText( mxModel );
143  uno::Reference< text::XTextRange > xFirstRange = word::getFirstObjectPosition( xCurrentText );
144  mxTextViewCursor->gotoRange( xFirstRange, bExtend );
145  break;
146  }
147  case word::WdUnits::wdLine:
148  {
149  // go to the begin of the Line
150  uno::Reference< view::XLineCursor > xLineCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
151  xLineCursor->gotoStartOfLine( bExtend );
152  break;
153  }
154  default:
155  {
156  throw uno::RuntimeException("Not implemented" );
157  }
158  }
159 }
160 
161 void SAL_CALL
162 SwVbaSelection::EndKey( const uno::Any& _unit, const uno::Any& _extend )
163 {
164  sal_Int32 nUnit = word::WdUnits::wdLine;
165  sal_Int32 nExtend = word::WdMovementType::wdMove;
166  _unit >>= nUnit;
167  _extend >>= nExtend;
168  bool bExtend = nExtend == word::WdMovementType::wdExtend;
169 
170  switch( nUnit )
171  {
172  case word::WdUnits::wdStory:
173  {
174  // go to the valid text first so that the current view cursor is valid to call gotoRange.
176  // go to the end of the document
177  uno::Reference< text::XText > xCurrentText = word::getCurrentXText( mxModel );
178  uno::Reference< text::XTextRange > xEnd = xCurrentText->getEnd();
179  mxTextViewCursor->gotoRange( xEnd, bExtend );
180  break;
181  }
182  case word::WdUnits::wdLine:
183  {
184  // go to the end of the Line
185  uno::Reference< view::XLineCursor > xLineCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
186  xLineCursor->gotoEndOfLine( bExtend );
187  break;
188  }
189  default:
190  {
191  throw uno::RuntimeException("Not implemented" );
192  }
193  }
194 }
195 
196 void SAL_CALL
197 SwVbaSelection::Delete( const uno::Any& _unit, const uno::Any& _count )
198 {
199  sal_Int32 nUnit = word::WdUnits::wdLine;
200  sal_Int32 nCount = 0;
201  if( _count.hasValue() )
202  _count >>= nCount;
203  if( _unit.hasValue() && ( nCount > 0 ) )
204  {
205  _unit >>= nUnit;
206  switch( nUnit )
207  {
208  case word::WdUnits::wdCharacter:
209  {
210  if( HasSelection() )
211  nCount--;
212  mxTextViewCursor->goRight( nCount, true );
213  break;
214  }
215  default:
216  {
217  throw uno::RuntimeException("Not implemented" );
218  }
219  }
220  }
221  OUString url = ".uno:Delete";
222  dispatchRequests( mxModel,url );
223 }
224 
225 void
226 SwVbaSelection::Move( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend, word::E_DIRECTION eDirection )
227 {
228  sal_Int32 nUnit = word::WdUnits::wdCharacter;
229  sal_Int32 nCount = 1;
230  sal_Int32 nExtend = word::WdMovementType::wdMove;
231 
232  if( _unit.hasValue() )
233  _unit >>= nUnit;
234  if( _count.hasValue() )
235  _count >>= nCount;
236  if( _extend.hasValue() )
237  _extend >>= nExtend;
238 
239  if( nCount == 0 )
240  return;
241 
242  bool bExpand = nExtend != word::WdMovementType::wdMove;
243 
244  switch( nUnit )
245  {
246  case word::WdUnits::wdCell:
247  {
248  if( nExtend == word::WdMovementType::wdExtend )
249  {
250  DebugHelper::basicexception(ERRCODE_BASIC_BAD_ARGUMENT, OUString());
251  return;
252  }
253  NextCell( nCount, eDirection );
254  break;
255  }
256  case word::WdUnits::wdLine:
257  {
258  if( eDirection == word::MOVE_LEFT || eDirection == word::MOVE_RIGHT )
259  {
260  throw uno::RuntimeException("Not implemented" );
261  }
262  uno::Reference< view::XViewCursor > xViewCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
263  if( eDirection == word::MOVE_UP )
264  xViewCursor->goUp( nCount, bExpand );
265  else if( eDirection == word::MOVE_DOWN )
266  xViewCursor->goDown( nCount, bExpand );
267  break;
268  }
269  case word::WdUnits::wdCharacter:
270  {
271  if( eDirection == word::MOVE_UP || eDirection == word::MOVE_DOWN )
272  {
273  throw uno::RuntimeException("Not implemented" );
274  }
276  {
277  nCount--;
278  }
279  uno::Reference< view::XViewCursor > xViewCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
280  if( eDirection == word::MOVE_LEFT )
281  {
282  // if current select is a cellrange or table,
283  // the first count of move should move to the first selected cell.
284  uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
285  if ( xTextTableCursor.is() )
286  {
287  uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
288  uno::Reference< text::XTextTable > xTextTable;
289  xCursorProps->getPropertyValue("TextTable") >>= xTextTable;
290  if( xTextTable.is() )
291  {
292  uno::Reference< text::XTextRange > xRange( xTextTable->getCellByName( xTextTableCursor->getRangeName()), uno::UNO_QUERY_THROW );
293  mxTextViewCursor->gotoRange( xRange->getStart(), bExpand );
294  nCount--;
295  }
296  }
297  xViewCursor->goLeft( nCount, bExpand );
298  }
299  else if( eDirection == word::MOVE_RIGHT )
300  xViewCursor->goRight( nCount, bExpand );
301  break;
302  }
303  case word::WdUnits::wdWord:
304  case word::WdUnits::wdParagraph:
305  {
306  uno::Reference< text::XTextRange > xRange = GetSelectedRange();
307  uno::Reference< text::XText > xText = xRange->getText();
308  uno::Reference< text::XTextCursor > xTextCursor = xText->createTextCursorByRange( xRange );
309  if( nUnit == word::WdUnits::wdParagraph )
310  {
311  if( eDirection == word::MOVE_LEFT || eDirection == word::MOVE_RIGHT )
312  {
313  throw uno::RuntimeException("Not implemented" );
314  }
315  uno::Reference< text::XParagraphCursor > xParagraphCursor( xTextCursor, uno::UNO_QUERY_THROW );
316  for( sal_Int32 i=0; i<nCount; i++ )
317  {
318  if( ( eDirection == word::MOVE_UP ) && !xParagraphCursor->gotoPreviousParagraph( bExpand ) )
319  break;
320  else if( ( eDirection == word::MOVE_DOWN ) && !xParagraphCursor->gotoNextParagraph( bExpand ) )
321  break;
322  }
323  }
324  else if( nUnit == word::WdUnits::wdWord )
325  {
326  if( eDirection == word::MOVE_UP || eDirection == word::MOVE_DOWN )
327  {
328  throw uno::RuntimeException("Not implemented" );
329  }
330  uno::Reference< text::XWordCursor > xWordCursor( xTextCursor, uno::UNO_QUERY_THROW );
331  for( sal_Int32 i=0; i<nCount; i++ )
332  {
333  if( (eDirection == word::MOVE_LEFT ) && !xWordCursor->gotoPreviousWord( bExpand ) )
334  break;
335  else if( ( eDirection == word::MOVE_RIGHT ) && !xWordCursor->gotoNextWord( bExpand ) )
336  break;
337  }
338  }
339  mxTextViewCursor->gotoRange( xTextCursor->getStart(), false );
340  mxTextViewCursor->gotoRange( xTextCursor->getEnd(), true );
341  break;
342  }
343  default:
344  {
345  throw uno::RuntimeException("Not implemented" );
346  }
347  }
348 }
349 
350 void SwVbaSelection::NextCell(sal_Int32 nCount, word::E_DIRECTION eDirection)
351 {
352  uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
353  uno::Reference< text::XTextTable > xTextTable;
354  uno::Reference< table::XCell > xCell;
355  xCursorProps->getPropertyValue("TextTable") >>= xTextTable;
356  xCursorProps->getPropertyValue("Cell") >>= xCell;
357  if( !xTextTable.is() || !xCell.is() )
358  {
359  DebugHelper::basicexception(ERRCODE_BASIC_BAD_ARGUMENT, OUString());
360  return;
361  }
362  uno::Reference< beans::XPropertySet > xCellProps( xCell, uno::UNO_QUERY_THROW );
363  OUString aCellName;
364  xCellProps->getPropertyValue("CellName") >>= aCellName;
365  uno::Reference< text::XTextTableCursor > xTextTableCursor = xTextTable->createCursorByCellName( aCellName );
366  // move the table cursor
367  switch( eDirection )
368  {
369  case word::MOVE_LEFT:
370  {
371  xTextTableCursor->goLeft( nCount, false );
372  break;
373  }
374  case word::MOVE_RIGHT:
375  {
376  xTextTableCursor->goRight( nCount, false );
377  break;
378  }
379  case word::MOVE_UP:
380  {
381  xTextTableCursor->goUp( nCount, false );
382  break;
383  }
384  case word::MOVE_DOWN:
385  {
386  xTextTableCursor->goDown( nCount, false );
387  break;
388  }
389  default:
390  {
391  DebugHelper::basicexception(ERRCODE_BASIC_BAD_ARGUMENT, OUString());
392  return;
393  }
394  }
395  // move the view cursor
396  xCell = xTextTable->getCellByName( xTextTableCursor->getRangeName() );
397  mxTextViewCursor->gotoRange( uno::Reference< text::XTextRange >( xCell, uno::UNO_QUERY_THROW ), false );
398 }
399 
400 void SAL_CALL
401 SwVbaSelection::MoveRight(const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend)
402 {
403  sal_Int32 nCount = 1;
404 
405  if( _count.hasValue() )
406  _count >>= nCount;
407 
408  if( nCount == 0 )
409  return;
410 
411  if( nCount < 0 )
412  {
413  MoveLeft( _unit, uno::makeAny( -nCount ), _extend );
414  return;
415  }
416 
417  Move( _unit, _count, _extend, word::MOVE_RIGHT );
418 }
419 
420 void SAL_CALL
421 SwVbaSelection::MoveLeft(const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend)
422 {
423  sal_Int32 nCount = 1;
424  if( _count.hasValue() )
425  _count >>= nCount;
426 
427  if( nCount == 0 )
428  return;
429 
430  if( nCount < 0 )
431  {
432  MoveRight( _unit, uno::makeAny( -nCount ), _extend );
433  return;
434  }
435 
436  Move( _unit, _count, _extend, word::MOVE_LEFT );
437 }
438 
439 void SAL_CALL
440 SwVbaSelection::MoveDown(const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend)
441 {
442  sal_Int32 nCount = 1;
443 
444  if( _count.hasValue() )
445  _count >>= nCount;
446 
447  if( nCount == 0 )
448  return;
449 
450  if( nCount < 0 )
451  {
452  MoveUp( _unit, uno::makeAny( -nCount ), _extend );
453  return;
454  }
455 
456  Move( _unit, _count, _extend, word::MOVE_DOWN );
457 }
458 
459 void SAL_CALL
460 SwVbaSelection::MoveUp(const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend)
461 {
462  sal_Int32 nCount = 1;
463 
464  if( _count.hasValue() )
465  _count >>= nCount;
466 
467  if( nCount == 0 )
468  return;
469 
470  if( nCount < 0 )
471  {
472  MoveDown( _unit, uno::makeAny( -nCount ), _extend );
473  return;
474  }
475 
476  Move( _unit, _count, _extend, word::MOVE_UP );
477 }
478 
479 void SAL_CALL
481 {
482  // #FIXME: if the selection is an entire paragraph, it's replaced
483  // by the new paragraph
484  bool isCollapsed = mxTextViewCursor->isCollapsed();
485  InsertParagraph();
486  if( isCollapsed )
487  mxTextViewCursor->collapseToStart();
488 }
489 
490 void SAL_CALL
492 {
493  // #FIXME: the selection should include the new paragraph.
494  getRange()->InsertParagraph();
495 }
496 
497 void SAL_CALL
499 {
500  getRange()->InsertParagraphBefore();
501 }
502 
503 void SAL_CALL
505 {
506  getRange()->InsertParagraphAfter();
507 }
508 
509 uno::Reference< word::XParagraphFormat > SAL_CALL
511 {
512  return getRange()->getParagraphFormat();
513 }
514 
515 void SAL_CALL
516 SwVbaSelection::setParagraphFormat( const uno::Reference< word::XParagraphFormat >& rParagraphFormat )
517 {
518  return getRange()->setParagraphFormat( rParagraphFormat );
519 }
520 
521 uno::Reference< word::XFind > SAL_CALL
523 {
524  uno::Reference< text::XTextRange > xTextRange = GetSelectedRange();
525  return uno::Reference< word::XFind >( new SwVbaFind( this, mxContext, mxModel, xTextRange ) );
526 }
527 
528 uno::Any SAL_CALL
530 {
531  return getRange()->getStyle();
532 }
533 
534 void SAL_CALL
536 {
537  uno::Reference< beans::XPropertySet > xParaProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
538  return SwVbaStyle::setStyle( xParaProps, rStyle );
539 }
540 
541 uno::Reference< word::XFont > SAL_CALL
543 {
544  return getRange()->getFont();
545 }
546 
547 void SAL_CALL
549 {
550  OUString url = ".uno:SwBackspace";
551  dispatchRequests( mxModel,url );
552 }
553 
554 uno::Reference< word::XRange > SAL_CALL SwVbaSelection::GoTo( const uno::Any& _what, const uno::Any& _which, const uno::Any& _count, const uno::Any& _name )
555 {
556  sal_Int32 nWhat = 0;
557  if( !( _what >>= nWhat ) )
558  DebugHelper::basicexception(ERRCODE_BASIC_BAD_ARGUMENT, OUString());
559  switch( nWhat )
560  {
561  case word::WdGoToItem::wdGoToBookmark:
562  {
563  uno::Reference< word::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
564  uno::Reference< word::XBookmark > xBookmark( xApplication->getActiveDocument()->Bookmarks(_name), uno::UNO_QUERY_THROW );
565  xBookmark->Select();
566  break;
567  }
568  case word::WdGoToItem::wdGoToPage:
569  {
570  uno::Reference< text::XPageCursor > xPageCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
571  sal_Int32 nCurrPage = xPageCursor->getPage();
572  sal_Int32 nLastPage = word::getPageCount( mxModel );
573  sal_Int32 nCount = 0;
574  if( _count.hasValue() )
575  _count >>= nCount;
576  sal_Int32 nWhich = 0;
577  if( _which.hasValue() )
578  _which >>= nWhich;
579  sal_Int32 nPage = 0;
580  switch( nWhich )
581  {
582  case word::WdGoToDirection::wdGoToLast:
583  {
584  nPage = nLastPage;
585  break;
586  }
587  case word::WdGoToDirection::wdGoToNext:
588  {
589  if( nCount !=0 )
590  nPage = nCurrPage + nCount;
591  else
592  nPage = nCurrPage + 1;
593  break;
594  }
595  case word::WdGoToDirection::wdGoToPrevious:
596  {
597  if( nCount !=0 )
598  nPage = nCurrPage - nCount;
599  else
600  nPage = nCurrPage - 1;
601  break;
602  }
603  default:
604  {
605  nPage = nCount;
606  }
607  }
608  if( _name.hasValue() )
609  {
610  OUString sName;
611  _name >>= sName;
612  sal_Int32 nName = sName.toInt32();
613  if( nName !=0 )
614  nPage = nName;
615  }
616  if( nPage <= 0 )
617  nPage = 1;
618  if( nPage > nLastPage )
619  nPage = nLastPage;
620  xPageCursor->jumpToPage( static_cast<sal_Int16>(nPage) );
621  break;
622  }
623  case word::WdGoToItem::wdGoToSection:
624  {
625  uno::Reference< text::XPageCursor > xPageCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
626  sal_Int32 nCount = 0;
627  if( _count.hasValue() )
628  _count >>= nCount;
629  sal_Int32 nWhich = 0;
630  if( _which.hasValue() )
631  _which >>= nWhich;
632  sal_Int32 nPage = 0;
633  switch( nWhich )
634  {
635  case word::WdGoToDirection::wdGoToAbsolute:
636  {
637  // currently only support this type
638  if( nCount == 1 )
639  nPage = 1;
640  break;
641  }
642  default:
643  {
644  nPage = 0;
645  }
646  }
647  if( nPage == 0 )
648  throw uno::RuntimeException("Not implemented" );
649  xPageCursor->jumpToPage( static_cast<sal_Int16>(nPage) );
650  break;
651  }
652  default:
653  throw uno::RuntimeException("Not implemented" );
654  }
655  return getRange();
656 }
657 
658 ::sal_Int32 SAL_CALL SwVbaSelection::getLanguageID()
659 {
660  return getRange()->getLanguageID();
661 }
662 
663 void SAL_CALL SwVbaSelection::setLanguageID( ::sal_Int32 _languageid )
664 {
665  getRange()->setLanguageID( _languageid );
666 }
667 
668 uno::Any SAL_CALL SwVbaSelection::Information( sal_Int32 _type )
669 {
671  switch( _type )
672  {
673  case word::WdInformation::wdActiveEndPageNumber:
674  {
676  break;
677  }
678  case word::WdInformation::wdNumberOfPagesInDocument:
679  {
681  break;
682  }
683  case word::WdInformation::wdVerticalPositionRelativeToPage:
684  {
686  break;
687  }
688  case word::WdInformation::wdWithInTable:
689  {
690  uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
691  uno::Reference< text::XTextTable > xTextTable;
692  xCursorProps->getPropertyValue("TextTable") >>= xTextTable;
693  result <<= xTextTable.is();
694  break;
695  }
696  case word::WdInformation::wdHeaderFooterType:
697  {
698  uno::Reference< word::XView > xView( new SwVbaView( this, mxContext, mxModel ) );
699  sal_Int32 nView = xView->getSeekView();
700  sal_Int32 nHeaderFooterType = 0;
701  switch( nView )
702  {
703  case word::WdSeekView::wdSeekMainDocument:
704  {
705  nHeaderFooterType = -1; // not in a header or footer
706  break;
707  }
708  case word::WdSeekView::wdSeekEvenPagesHeader:
709  {
710  nHeaderFooterType = 0; // even page header
711  break;
712  }
713  case word::WdSeekView::wdSeekPrimaryHeader:
714  {
715  nHeaderFooterType = 1; // odd page header
716  break;
717  }
718  case word::WdSeekView::wdSeekEvenPagesFooter:
719  {
720  nHeaderFooterType = 2; // even page footer
721  break;
722  }
723  case word::WdSeekView::wdSeekPrimaryFooter:
724  {
725  nHeaderFooterType = 3; // odd page footer
726  break;
727  }
728  case word::WdSeekView::wdSeekFirstPageHeader:
729  case word::WdSeekView::wdSeekFirstPageFooter:
730  {
731  uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
732  OUString aPageStyleName;
733  xCursorProps->getPropertyValue("PageStyleName") >>= aPageStyleName;
734  bool bFirstPage = false;
735  if ( aPageStyleName == "First Page" )
736  bFirstPage = true;
737  if( nView == word::WdSeekView::wdSeekFirstPageHeader )
738  {
739  if( bFirstPage )
740  nHeaderFooterType = 4;
741  else
742  nHeaderFooterType = 1;
743  }
744  else
745  {
746  if( bFirstPage )
747  nHeaderFooterType = 5;
748  else
749  nHeaderFooterType = 3;
750  }
751  break;
752  }
753  default:
754  {
755  nHeaderFooterType = -1;
756  }
757  }
758  result <<= nHeaderFooterType;
759  break;
760  }
761  default:
762  throw uno::RuntimeException("Not implemented" );
763  }
764  return result;
765 }
766 
767 void SAL_CALL SwVbaSelection::InsertBreak( const uno::Any& _breakType )
768 {
769  getRange()->InsertBreak( _breakType );
770 }
771 
772 uno::Any SAL_CALL
774 {
775  // Hacky implementation due to missing api ( and lack of knowledge )
776  // we can only support a selection that is a single table
777  if ( !aIndex.hasValue() ) // currently we can't support multiple tables in a selection
778  throw uno::RuntimeException();
779 
780  sal_Int32 nIndex = 0;
781  aIndex >>= nIndex;
782 
783  uno::Any aRet;
784 
785  if ( nIndex != 1 )
786  throw uno::RuntimeException();
787 
788  uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
789  uno::Reference< text::XTextTable > xTextTable;
790  xCursorProps->getPropertyValue("TextTable") >>= xTextTable;
791  if( xTextTable.is() )
792  {
793  uno::Reference< css::text::XTextDocument > xTextDoc( mxModel, uno::UNO_QUERY_THROW );
794  uno::Reference< word::XTable > xVBATable = new SwVbaTable( mxParent, mxContext, xTextDoc, xTextTable );
795  aRet <<= xVBATable;
796  return aRet;
797  }
798 
799  // if the current selection is a XTextTableCursor and the index is 1 then we can service this request, otherwise we just have to throw
800  uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY_THROW );
801  SwXTextTableCursor* pTTCursor = dynamic_cast< SwXTextTableCursor* >( xTextTableCursor.get() );
802  if ( pTTCursor )
803  {
804  SwFrameFormat* pFormat = pTTCursor->GetFrameFormat();
805  if ( pFormat )
806  {
807  uno::Reference< text::XTextTable > xTable = SwXTextTables::GetObject(*pFormat);
808  uno::Reference< css::text::XTextDocument > xTextDoc( mxModel, uno::UNO_QUERY_THROW );
809  uno::Reference< word::XTable > xVBATable = new SwVbaTable( mxParent, mxContext, xTextDoc, xTable );
810  aRet <<= xVBATable;
811  }
812  }
813  return aRet;
814 
815 }
816 
817 uno::Any SAL_CALL
819 {
820  uno::Reference< XCollection > xCol( new SwVbaFields( mxParent, mxContext, mxModel ) );
821  if ( index.hasValue() )
822  return xCol->Item( index, uno::Any() );
823  return uno::makeAny( xCol );
824 }
825 
826 uno::Reference< word::XHeaderFooter > SAL_CALL
828 {
830  {
831  uno::Reference< beans::XPropertySet > xPageStyleProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
832  sal_Int32 nIndex = word::WdHeaderFooterIndex::wdHeaderFooterPrimary;
833  bool isHeader = HeaderFooterHelper::isHeader( mxModel );
835  nIndex = word::WdHeaderFooterIndex::wdHeaderFooterEvenPages;
837  nIndex = word::WdHeaderFooterIndex::wdHeaderFooterFirstPage;
838 
839  return uno::Reference< word::XHeaderFooter >( new SwVbaHeaderFooter( this, mxContext, mxModel, xPageStyleProps, isHeader, nIndex ) );
840 
841  }
842  return uno::Reference< word::XHeaderFooter >();
843 }
844 
845 uno::Any SAL_CALL
847 {
848  uno::Reference< drawing::XShapes > xShapes( mxModel->getCurrentSelection(), uno::UNO_QUERY );
849  if ( !xShapes.is() )
850  {
851  uno::Reference< drawing::XShape > xShape( mxModel->getCurrentSelection(), uno::UNO_QUERY_THROW );
852  xShapes.set( drawing::ShapeCollection::create(mxContext) );
853  xShapes->add( xShape );
854  }
855 
856  uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW );
857  uno::Reference< drawing::XDrawPage > xDrawPage = xDrawPageSupplier->getDrawPage();
858  uno::Reference< container::XIndexAccess > xShapesAccess( xShapes, uno::UNO_QUERY_THROW );
859  return uno::makeAny( uno::Reference< msforms::XShapeRange >( new ScVbaShapeRange( this, mxContext, xShapesAccess, xDrawPage, mxModel ) ) );
860 }
861 
862 ::sal_Int32 SAL_CALL SwVbaSelection::getStart()
863 {
864  return getRange()->getStart();
865 }
866 
867 void SAL_CALL SwVbaSelection::setStart( ::sal_Int32 _start )
868 {
869  getRange()->setStart( _start );
870 }
871 ::sal_Int32 SAL_CALL SwVbaSelection::getEnd()
872 {
873  return getRange()->getEnd();
874 }
875 
876 void SAL_CALL SwVbaSelection::setEnd( ::sal_Int32 _end )
877 {
878  getRange()->setEnd( _end );
879 }
880 
882 {
883  uno::Reference< word::XRows > xRows( Rows( uno::Any() ), uno::UNO_QUERY_THROW );
884  xRows->Select();
885 }
886 
888 {
889  uno::Reference< word::XColumns > xColumns( Columns( uno::Any() ), uno::UNO_QUERY_THROW );
890  xColumns->Select();
891 }
892 
893 uno::Any SAL_CALL SwVbaSelection::Rows( const uno::Any& index )
894 {
895  OUString sTLName;
896  OUString sBRName;
897  GetSelectedCellRange( sTLName, sBRName );
898 
899  sal_Int32 nStartRow = 0;
900  sal_Int32 nEndRow = 0;
901  uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
902  SwVbaTableHelper aTableHelper( xTextTable );
903  nStartRow = aTableHelper.getTabRowIndex( sTLName );
904  if( !sBRName.isEmpty() )
905  {
906  nEndRow = aTableHelper.getTabRowIndex( sBRName );
907  }
908  else
909  {
910  nEndRow = nStartRow;
911  }
912 
913  uno::Reference< XCollection > xCol( new SwVbaRows( this, mxContext, xTextTable, xTextTable->getRows(), nStartRow, nEndRow ) );
914  if ( index.hasValue() )
915  return xCol->Item( index, uno::Any() );
916  return uno::makeAny( xCol );
917 }
918 
919 uno::Any SAL_CALL SwVbaSelection::Columns( const uno::Any& index )
920 {
921  OUString sTLName;
922  OUString sBRName;
923  GetSelectedCellRange( sTLName, sBRName );
924  sal_Int32 nStartColumn = 0;
925  sal_Int32 nEndColumn = 0;
926 
927  uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
928  SwVbaTableHelper aTableHelper( xTextTable );
929  nStartColumn = aTableHelper.getTabColIndex( sTLName );
930  if( !sBRName.isEmpty() )
931  {
932  nEndColumn = aTableHelper.getTabColIndex( sBRName );
933  }
934  else
935  {
936  nEndColumn = nStartColumn;
937  }
938 
939  uno::Reference< XCollection > xCol( new SwVbaColumns( this, mxContext, xTextTable, xTextTable->getColumns(), nStartColumn, nEndColumn ) );
940  if ( index.hasValue() )
941  return xCol->Item( index, uno::Any() );
942  return uno::makeAny( xCol );
943 }
944 
945 uno::Reference< text::XTextTable > SwVbaSelection::GetXTextTable()
946 {
947  uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
948  uno::Reference< text::XTextTable > xTextTable;
949  xCursorProps->getPropertyValue("TextTable") >>= xTextTable;
950  return xTextTable;
951 }
952 
954 {
955  uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
956  return xTextTable.is();
957 }
958 
960 {
961  uno::Reference< text::XTextRange > xStart = mxTextViewCursor->getStart();
962  uno::Reference< text::XTextRange > xEnd = mxTextViewCursor->getEnd();
963  uno::Reference< text::XTextRangeCompare > xTRC( mxTextViewCursor->getText(), uno::UNO_QUERY_THROW );
964  return xTRC->compareRegionStarts( xStart, xEnd ) != 0 || xTRC->compareRegionEnds( xStart, xEnd ) != 0;
965 }
966 
967 void SwVbaSelection::GetSelectedCellRange( OUString& sTLName, OUString& sBRName )
968 {
969  uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
970  uno::Reference< text::XTextTable > xTextTable;
971  xCursorProps->getPropertyValue("TextTable") >>= xTextTable;
972  if( !xTextTable.is() )
973  throw uno::RuntimeException( );
974 
975  uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
976  if( xTextTableCursor.is() )
977  {
978  const OUString sRange( xTextTableCursor->getRangeName() );
979  if (!sRange.isEmpty())
980  {
981  sal_Int32 nIdx{0};
982  sTLName = sRange.getToken(0, ':', nIdx);
983  sBRName = sRange.getToken(0, ':', nIdx);
984  }
985  }
986  if( sTLName.isEmpty() )
987  {
988  uno::Reference< table::XCell > xCell;
989  xCursorProps->getPropertyValue("Cell") >>= xCell;
990  if( !xCell.is() )
991  {
992  throw uno::RuntimeException( );
993  }
994  uno::Reference< beans::XPropertySet > xCellProps( xCell, uno::UNO_QUERY_THROW );
995  xCellProps->getPropertyValue("CellName") >>= sTLName;
996  }
997 }
998 
999 uno::Any SAL_CALL SwVbaSelection::Cells( const uno::Any& index )
1000 {
1001  OUString sTLName;
1002  OUString sBRName;
1003  GetSelectedCellRange( sTLName, sBRName );
1004  sal_Int32 nLeft = 0;
1005  sal_Int32 nTop = 0;
1006  sal_Int32 nRight = 0;
1007  sal_Int32 nBottom = 0;
1008 
1009  uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
1010  SwVbaTableHelper aTableHelper( xTextTable );
1011  nLeft = aTableHelper.getTabColIndex( sTLName );
1012  nTop = aTableHelper.getTabRowIndex( sTLName );
1013  if( !sBRName.isEmpty() )
1014  {
1015  nRight = aTableHelper.getTabColIndex( sBRName );
1016  nBottom = aTableHelper.getTabRowIndex( sBRName );
1017  }
1018  else
1019  {
1020  nRight = nLeft;
1021  nBottom = nTop;
1022  }
1023 
1024  uno::Reference< XCollection > xCol( new SwVbaCells( this, mxContext, xTextTable, nLeft, nTop, nRight, nBottom ) );
1025  if ( index.hasValue() )
1026  return xCol->Item( index, uno::Any() );
1027  return uno::makeAny( xCol );
1028 }
1029 
1030 void SAL_CALL SwVbaSelection::Copy( )
1031 {
1032  OUString url = ".uno:Copy";
1033  dispatchRequests( mxModel,url );
1034 }
1035 
1037 {
1038  // seems not support in Writer
1039  Copy();
1040 }
1041 
1042 void SAL_CALL SwVbaSelection::Paste( )
1043 {
1044  OUString url = ".uno:Paste";
1045  dispatchRequests( mxModel,url );
1046 }
1047 
1049 {
1051  return;
1052 
1053  sal_Int32 nDirection = word::WdCollapseDirection::wdCollapseStart;
1054  if( Direction.hasValue() )
1055  Direction >>= nDirection;
1056 
1057  uno::Reference< text::XTextViewCursor > xTextViewCursor = word::getXTextViewCursor( mxModel );
1058  if( nDirection == word::WdCollapseDirection::wdCollapseStart )
1059  {
1060  // it is inaccurate if current selection is multiple cells, so it needs to go to start
1061  uno::Reference< text::XTextRange > xTextRange = mxTextViewCursor->getStart();
1062  xTextViewCursor->gotoRange( xTextRange, false );
1063  xTextViewCursor->collapseToStart();
1064  }
1065  else if( nDirection == word::WdCollapseDirection::wdCollapseEnd )
1066  {
1067  uno::Reference< text::XTextRange > xTextRange = mxTextViewCursor->getEnd();
1068  xTextViewCursor->gotoRange( xTextRange, false );
1069  xTextViewCursor->collapseToEnd();
1070  }
1071  else
1072  {
1073  throw uno::RuntimeException();
1074  }
1075 }
1076 
1078 {
1079  uno::Reference< text::XText > xText = word::getCurrentXText( mxModel );
1080  // FIXME: for i#7747,if the first line is a table, it fails to select all the contents in the story.
1081  // Temporary solution, insert an empty line before the table so that it could select all the contents.
1082  uno::Reference< container::XEnumerationAccess > xParaAccess( xText, uno::UNO_QUERY_THROW );
1083  uno::Reference< container::XEnumeration> xParaEnum = xParaAccess->createEnumeration();
1084  if( xParaEnum->hasMoreElements() )
1085  {
1086  uno::Reference< text::XTextTable > xTextTable( xParaEnum->nextElement(), uno::UNO_QUERY );
1087  if( xTextTable.is() )
1088  {
1089  // insert an empty line
1090  uno::Reference< text::XTextRange > xFirstCellRange = word::getFirstObjectPosition( xText );
1091  mxTextViewCursor->gotoRange( xFirstCellRange, false );
1092  OUString url = ".uno:InsertPara";
1093  dispatchRequests( mxModel,url );
1094  }
1095  }
1096  uno::Reference< text::XTextRange > xStart = xText->getStart();
1097  uno::Reference< text::XTextRange > xEnd = xText->getEnd();
1098  mxTextViewCursor->gotoRange( xStart, false );
1099  mxTextViewCursor->gotoRange( xEnd, true );
1100 }
1101 
1102 sal_Bool SAL_CALL SwVbaSelection::InRange( const uno::Reference< ::ooo::vba::word::XRange >& Range )
1103 {
1104  return getRange()->InRange( Range );
1105 }
1106 
1108 {
1109  if( !IsInTable() )
1110  throw uno::RuntimeException();
1111 
1112  SwDocShell* pDocShell = word::getDocShell( mxModel );
1113  if( pDocShell )
1114  {
1115  SwFEShell* pFEShell = pDocShell->GetFEShell();
1116  if( pFEShell )
1117  {
1119  }
1120  }
1121 }
1122 
1123 uno::Any SAL_CALL
1125 {
1126  // Hacky implementation due to missing api ( and lack of knowledge )
1127  // we can only support a selection that is a single paragraph
1128  if ( !aIndex.hasValue() ) // currently we can't support multiple paragraphs in a selection
1129  throw uno::RuntimeException();
1130 
1131  sal_Int32 nIndex = 0;
1132  aIndex >>= nIndex;
1133 
1134  uno::Any aRet;
1135 
1136  if ( nIndex != 1 )
1137  throw uno::RuntimeException();
1138 
1139  uno::Reference< text::XTextRange > xTextRange = mxTextViewCursor->getStart();
1140  uno::Reference< text::XText > xText = xTextRange->getText();
1141  uno::Reference< text::XParagraphCursor > xParaCursor( xText->createTextCursor(), uno::UNO_QUERY_THROW );
1142  xParaCursor->gotoStartOfParagraph( false );
1143  xParaCursor->gotoStartOfParagraph( true );
1144 
1145  uno::Reference< text::XTextDocument > xTextDoc( mxModel, uno::UNO_QUERY_THROW );
1146  uno::Reference< text::XTextRange > xParaRange( xParaCursor, uno::UNO_QUERY_THROW );
1147  uno::Reference< word::XParagraph > xParagraph = new SwVbaParagraph( mxParent, mxContext, xTextDoc, xParaRange );
1148 
1149  aRet <<= xParagraph;
1150  return aRet;
1151 }
1152 
1153 OUString
1155 {
1156  return OUString("SwVbaSelection");
1157 }
1158 
1159 uno::Sequence< OUString >
1161 {
1162  static uno::Sequence< OUString > const aServiceNames
1163  {
1164  "ooo.vba.word.Selection"
1165  };
1166  return aServiceNames;
1167 }
1168 
1169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Any SAL_CALL Application() override
void GetSelectedCellRange(OUString &sTLName, OUString &sBRName)
virtual css::uno::Any SAL_CALL Rows(const css::uno::Any &aIndex) override
virtual void SAL_CALL InsertParagraphAfter() override
bool hasValue()
virtual css::uno::Reference< ooo::vba::word::XHeaderFooter > SAL_CALL getHeaderFooter() override
css::uno::Reference< css::text::XTextRange > GetSelectedRange()
virtual css::uno::Any SAL_CALL ShapeRange() override
css::uno::Reference< css::frame::XModel > mxModel
void Move(const css::uno::Any &_unit, const css::uno::Any &_count, const css::uno::Any &_extend, ooo::vba::word::E_DIRECTION eDirection)
#define ERRCODE_BASIC_BAD_ARGUMENT
virtual void SAL_CALL WholeStory() override
virtual void SAL_CALL TypeBackspace() override
static bool isFirstPageHeader(const css::uno::Reference< css::frame::XModel > &xModel)
virtual void SAL_CALL setParagraphFormat(const css::uno::Reference< ooo::vba::word::XParagraphFormat > &rParagraphFormat) override
css::uno::Reference< css::frame::XModel2 > mxModel
virtual void SAL_CALL InsertParagraphBefore() override
static bool isEvenPagesFooter(const css::uno::Reference< css::frame::XModel > &xModel)
virtual css::uno::Any SAL_CALL Fields(const css::uno::Any &aIndex) override
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) override
virtual css::uno::Reference< ooo::vba::word::XFind > SAL_CALL getFind() override
virtual void SAL_CALL CopyAsPicture() override
sal_Int32 getTabColIndex(const OUString &sCellName)
virtual css::uno::Reference< ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() override
virtual css::uno::Any SAL_CALL Columns(const css::uno::Any &aIndex) override
virtual void SAL_CALL setEnd(::sal_Int32 _end) override
virtual void SAL_CALL InsertParagraph() override
uno::Reference< style::XStyle > getCurrentPageStyle(const uno::Reference< frame::XModel > &xModel)
virtual ::sal_Int32 SAL_CALL getStart() override
virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL getRange() override
virtual void SAL_CALL HomeKey(const css::uno::Any &_unit, const css::uno::Any &_extend) override
virtual css::uno::Any SAL_CALL Paragraphs(const css::uno::Any &aIndex) override
uno::Reference< text::XTextViewCursor > getXTextViewCursor(const uno::Reference< frame::XModel > &xModel)
virtual css::uno::Any SAL_CALL Tables(const css::uno::Any &aIndex) override
virtual css::uno::Any SAL_CALL getStyle() override
virtual ~SwVbaSelection() override
virtual void SAL_CALL InsertBreak(const css::uno::Any &_breakType) override
virtual css::uno::Any SAL_CALL Information(sal_Int32 _type) override
virtual void SAL_CALL setStart(::sal_Int32 _start) override
static double handleWdVerticalPositionRelativeToPage(const css::uno::Reference< css::frame::XModel > &xModel, const css::uno::Reference< css::text::XTextViewCursor > &xTVCursor)
virtual void SAL_CALL setLanguageID(::sal_Int32 _languageid) override
virtual void SAL_CALL TypeParagraph() override
Style of a layout element.
Definition: frmfmt.hxx:57
bool gotoSelectedObjectAnchor(const uno::Reference< frame::XModel > &xModel)
css::uno::Reference< css::text::XTextTable > GetXTextTable()
virtual void SAL_CALL MoveRight(const css::uno::Any &_unit, const css::uno::Any &_count, const css::uno::Any &_extend) override
virtual void SAL_CALL MoveDown(const css::uno::Any &_unit, const css::uno::Any &_count, const css::uno::Any &_extend) override
OUString sName
MetadataImporterPluginType * result
int i
virtual void SAL_CALL TypeText(const OUString &rText) override
unsigned char sal_Bool
virtual OUString SAL_CALL getText() override
css::uno::WeakReference< ov::XHelperInterface > mxParent
virtual void SAL_CALL Copy() override
static void setStyle(const css::uno::Reference< css::beans::XPropertySet > &xParaProps, const css::uno::Any &xStyle)
Definition: vbastyle.cxx:94
virtual void SAL_CALL SelectRow() override
static css::uno::Reference< css::text::XTextTable > GetObject(SwFrameFormat &rFormat)
Definition: unocoll.cxx:983
virtual void SAL_CALL MoveLeft(const css::uno::Any &_unit, const css::uno::Any &_count, const css::uno::Any &_extend) override
virtual sal_Bool SAL_CALL InRange(const css::uno::Reference< ::ooo::vba::word::XRange > &Range) override
virtual void SAL_CALL Paste() override
sal_Int32 getPageCount(const uno::Reference< frame::XModel > &xModel)
virtual void SAL_CALL setText(const OUString &rText) override
SwDocShell * getDocShell(const uno::Reference< frame::XModel > &xModel)
virtual void SAL_CALL MoveUp(const css::uno::Any &_unit, const css::uno::Any &_count, const css::uno::Any &_extend) override
static sal_Int32 handleWdNumberOfPagesInDocument(const css::uno::Reference< css::frame::XModel > &xModel)
virtual void SAL_CALL Collapse(const css::uno::Any &Direction) override
css::uno::Reference< css::uno::XComponentContext > mxContext
Direction
virtual OUString getServiceImplName() override
static bool isEvenPagesHeader(const css::uno::Reference< css::frame::XModel > &xModel)
static bool isHeaderFooter(const css::uno::Reference< css::frame::XModel > &xModel)
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)
virtual void SAL_CALL SelectColumn() override
static sal_Int32 handleWdActiveEndPageNumber(const css::uno::Reference< css::text::XTextViewCursor > &xTVCursor)
uno::Reference< text::XText > getCurrentXText(const uno::Reference< frame::XModel > &xModel)
virtual css::uno::Any SAL_CALL Cells(const css::uno::Any &aIndex) override
static bool isFirstPageFooter(const css::uno::Reference< css::frame::XModel > &xModel)
virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() override
SwFEShell * GetFEShell()
For Core - it knows the DocShell but not the WrtShell!
Definition: docsh.cxx:1244
uno::Reference< text::XTextRange > getFirstObjectPosition(const uno::Reference< text::XText > &xText)
virtual css::uno::Sequence< OUString > getServiceNames() override
virtual void SAL_CALL SplitTable() override
virtual void SAL_CALL setStyle(const css::uno::Any &_xStyle) override
css::uno::Reference< css::text::XTextViewCursor > mxTextViewCursor
virtual ::sal_Int32 SAL_CALL getLanguageID() override
virtual void SAL_CALL Delete(const css::uno::Any &_unit, const css::uno::Any &_count) override
sal_Int32 getTabRowIndex(const OUString &sCellName)
virtual ::sal_Int32 SAL_CALL getEnd() override
void dispatchRequests(const uno::Reference< frame::XModel > &xModel, const OUString &aUrl, const uno::Sequence< beans::PropertyValue > &sProps)
static bool isHeader(const css::uno::Reference< css::frame::XModel > &xModel)
void NextCell(sal_Int32 nCount, ooo::vba::word::E_DIRECTION eDirection)
virtual void SAL_CALL EndKey(const css::uno::Any &_unit, const css::uno::Any &_extend) override
void SplitTable(SplitTable_HeadlineOption eMode)
Split table at cursor position.
Definition: edtab.cxx:427