Better, Faster, Freer

The LXR Cross Referencer

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Architecture: i386 ]
Version: HEAD ]

001 /*************************************************************************
002  *
003  *  OpenOffice.org - a multi-platform office productivity suite
004  *
005  *  $RCSfile: unotxvw.cxx,v $
006  *
007  *  $Revision: 1.65 $
008  *
009  *  last change: $Author: hr $ $Date: 2007/09/27 12:43:56 $
010  *
011  *  The Contents of this file are made available subject to
012  *  the terms of GNU Lesser General Public License Version 2.1.
013  *
014  *
015  *    GNU Lesser General Public License Version 2.1
016  *    =============================================
017  *    Copyright 2005 by Sun Microsystems, Inc.
018  *    901 San Antonio Road, Palo Alto, CA 94303, USA
019  *
020  *    This library is free software; you can redistribute it and/or
021  *    modify it under the terms of the GNU Lesser General Public
022  *    License version 2.1, as published by the Free Software Foundation.
023  *
024  *    This library is distributed in the hope that it will be useful,
025  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
026  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
027  *    Lesser General Public License for more details.
028  *
029  *    You should have received a copy of the GNU Lesser General Public
030  *    License along with this library; if not, write to the Free Software
031  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
032  *    MA  02111-1307  USA
033  *
034  ************************************************************************/
035 
036 // MARKER(update_precomp.py): autogen include statement, do not remove
037 #include "precompiled_sw.hxx"
038 
039 #include "viscrs.hxx"
040 #include <sfx2/frame.hxx>
041 #ifndef _SFX_PRINTER_HXX
042 #include <sfx2/printer.hxx>
043 #endif
044 #include <cmdid.h>
045 #include <hintids.hxx>
046 #ifndef _SWDOCSH_HXX //autogen
047 #include <docsh.hxx>
048 #endif
049 #ifndef _RUBYLIST_HXX
050 #include <rubylist.hxx>
051 #endif
052 #ifndef _SWDOC_HXX //autogen
053 #include <doc.hxx>
054 #endif
055 #ifndef _UNOTXVW_HXX
056 #include <unotxvw.hxx>
057 #endif
058 #ifndef _UNODISPATCH_HXX
059 #include <unodispatch.hxx>
060 #endif
061 #ifndef _UNOMAP_HXX
062 #include <unomap.hxx>
063 #endif
064 #ifndef _UNOSTYLE_HXX
065 #include <unostyle.hxx>
066 #endif
067 #ifndef _UNOPRNMS_HXX
068 #include <unoprnms.hxx>
069 #endif
070 #ifndef _SWVIEW_HXX
071 #include <view.hxx>
072 #endif
073 #ifndef _VIEWOPT_HXX
074 #include <viewopt.hxx>
075 #endif
076 #ifndef _UNOMOD_HXX
077 #include <unomod.hxx>
078 #endif
079 #ifndef _UNOFRAME_HXX
080 #include <unoframe.hxx>
081 #endif
082 #ifndef _UNOCRSR_HXX
083 #include <unocrsr.hxx>
084 #endif
085 #ifndef _WRTSH_HXX //autogen
086 #include <wrtsh.hxx>
087 #endif
088 #ifndef _UNOTBL_HXX
089 #include <unotbl.hxx>
090 #endif
091 #ifndef _SVX_FMSHELL_HXX
092 #include <svx/fmshell.hxx>
093 #endif
094 #ifndef _SVDVIEW_HXX //autogen
095 #include <svx/svdview.hxx>
096 #endif
097 #ifndef _SVDPAGE_HXX //autogen
098 #include <svx/svdpage.hxx>
099 #endif
100 #ifndef _SVDOUNO_HXX //autogen
101 #include <svx/svdouno.hxx>
102 #endif
103 #ifndef _SVDOGRP_HXX //autogen
104 #include <svx/svdogrp.hxx>
105 #endif
106 #ifndef _SVX_PBINITEM_HXX
107 #include <svx/pbinitem.hxx>
108 #endif
109 #ifndef _PAGEDESC_HXX //autogen
110 #include <pagedesc.hxx>
111 #endif
112 #ifndef _SVX_LRSPITEM_HXX //autogen
113 #include <svx/lrspitem.hxx>
114 #endif
115 #ifndef _SVX_ULSPITEM_HXX //autogen
116 #include <svx/ulspitem.hxx>
117 #endif
118 #ifndef _SFX_BINDINGS_HXX //autogen
119 #include <sfx2/bindings.hxx>
120 #endif
121 #ifndef _SFXREQUEST_HXX //autogen
122 #include <sfx2/request.hxx>
123 #endif
124 #ifndef _FRMATR_HXX
125 #include <frmatr.hxx>
126 #endif
127 #ifndef _VOS_MUTEX_HXX_ //autogen
128 #include <vos/mutex.hxx>
129 #endif
130 #ifndef _BOOKMRK_HXX //autogen
131 #include <bookmrk.hxx>
132 #endif
133 #ifndef _UNOTXDOC_HXX //autogen
134 #include <unotxdoc.hxx>
135 #endif
136 #ifndef _UNODRAW_HXX //autogen
137 #include <unodraw.hxx>
138 #endif
139 #ifndef _SVX_UNOSHGRP_HXX //autogen
140 #include <svx/unoshcol.hxx>
141 #endif
142 #ifndef _SVX_UNOSHAPE_HXX //autogen wg. SvxShape
143 #include <svx/unoshape.hxx>
144 #endif
145 #ifndef _SVDPAGV_HXX //autogen wg. SdrPageView
146 #include <svx/svdpagv.hxx>
147 #endif
148 #include <swerror.h>
149 #ifndef _CACHESTR_HXX
150 #include <tools/cachestr.hxx>
151 #endif
152 #ifndef _SHELLIO_HXX
153 #include <shellio.hxx>
154 #endif
155 #ifndef _NDTXT_HXX
156 #include <ndtxt.hxx>
157 #endif
158 #ifndef _SWSTYLENAMEMAPPER_HXX
159 #include <SwStyleNameMapper.hxx>
160 #endif
161 #ifndef _CRSSKIP_HXX
162 #include <crsskip.hxx>
163 #endif
164 #ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
165 #include <com/sun/star/beans/PropertyAttribute.hpp>
166 #endif
167 
168 #include <svx/editview.hxx>
169 #include <sfx2/docfile.hxx>
170 
171 #include "swdtflvr.hxx"
172 
173 #ifndef _SV_SVAPP_HXX //autogen
174 #include <vcl/svapp.hxx>
175 #endif
176 
177 
178 using namespace ::com::sun::star;
179 using namespace ::com::sun::star::uno;
180 using namespace ::com::sun::star::lang;
181 using namespace ::com::sun::star::beans;
182 using namespace ::com::sun::star::text;
183 using namespace ::com::sun::star::view;
184 using namespace ::com::sun::star::frame;
185 using namespace rtl;
186 
187 using ::com::sun::star::util::URL;
188 using comphelper::HelperBaseNoState;
189 
190 SV_IMPL_PTRARR( SelectionChangeListenerArr, XSelectionChangeListenerPtr );
191 
192 /* -----------------22.05.98 12:20-------------------
193  *
194  * --------------------------------------------------*/
195 SwPaM* lcl_createPamCopy(const SwPaM& rPam)
196 {
197         SwPaM* pRet = new SwPaM(*rPam.GetPoint());
198         if(rPam.HasMark())
199         {
200                 pRet->SetMark();
201                 *pRet->GetMark() = *rPam.GetMark();
202         }
203         if(rPam.GetNext() != (const Ring*)&rPam)
204         {
205                 SwPaM *_pStartCrsr = (SwPaM *)rPam.GetNext();
206                 do
207                 {
208                         //neuen PaM erzeugen
209                         SwPaM* pPaM = new SwPaM(*_pStartCrsr);
210                         //und in den Ring einfuegen
211                         pPaM->MoveTo(pRet);
212 
213                 } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != rPam.GetNext() );
214         }
215         return pRet;
216 }
217 /******************************************************************
218  * SwXTextView
219  ******************************************************************/
220 /*-- 17.12.98 09:34:25---------------------------------------------------
221 
222   -----------------------------------------------------------------------*/
223 SwXTextView::SwXTextView(SwView* pSwView) :
224         SfxBaseController(pSwView),
225         pView(pSwView),
226     pMap( aSwMapProvider.GetPropertyMap( PROPERTY_MAP_TEXT_VIEW ) ),
227         pxViewSettings(0),
228     pxTextViewCursor(0)
229 {
230 
231 }
232 /*-- 17.12.98 09:34:25---------------------------------------------------
233 
234   -----------------------------------------------------------------------*/
235 SwXTextView::~SwXTextView()
236 {
237     Invalidate();
238 }
239 /* -----------------------------09.03.01 15:47--------------------------------
240 
241  ---------------------------------------------------------------------------*/
242 void SwXTextView::Invalidate()
243 {
244     if(pxViewSettings)
245         {
246                 HelperBaseNoState *pSettings = static_cast < HelperBaseNoState * > ( pxViewSettings->get() );
247                 static_cast < SwXViewSettings* > ( pSettings )->Invalidate();
248         DELETEZ(pxViewSettings);
249         }
250         if(pxTextViewCursor)
251         {
252         text::XTextViewCursor* pCrsr = pxTextViewCursor->get();
253                 ((SwXTextViewCursor*)pCrsr)->Invalidate();
254         DELETEZ(pxTextViewCursor);
255         }
256     sal_uInt16 nCount = aSelChangedListeners.Count();
257     m_refCount++; //prevent second d'tor call
258     if(nCount)
259     {
260         uno::Reference< uno::XInterface >  xInt = (cppu::OWeakObject*)(SfxBaseController*)this;
261         lang::EventObject aEvent(xInt);
262         for ( sal_uInt16 i = nCount; i--; )
263         {
264             uno::Reference< view::XSelectionChangeListener >  *pObj = aSelChangedListeners[i];
265             (*pObj)->disposing(aEvent);
266         }
267     }
268     m_refCount--;
269     pView = 0;
270 }
271 
272 /* -----------------------------18.05.00 10:18--------------------------------
273 
274  ---------------------------------------------------------------------------*/
275 Sequence< uno::Type > SAL_CALL SwXTextView::getTypes(  ) throw(uno::RuntimeException)
276 {
277 //      uno::Sequence< uno::Type > aViewTypes = SwXTextViewBaseClass::getTypes();
278         uno::Sequence< uno::Type > aBaseTypes = SfxBaseController::getTypes();
279 
280         long nIndex = aBaseTypes.getLength();
281         aBaseTypes.realloc(
282         aBaseTypes.getLength() + 8 );
283 
284         uno::Type* pBaseTypes = aBaseTypes.getArray();
285         pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XSelectionSupplier >*)0);
286         pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XServiceInfo                       >*)0);
287         pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XFormLayerAccess   >*)0);
288         pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XTextViewCursorSupplier>*)0);
289         pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XViewSettingsSupplier      >*)0);
290         pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XRubySelection     >*)0);
291     pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XPropertySet  >*)0);
292     pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<datatransfer::XTransferableSupplier >*)0);
293         return aBaseTypes;
294 }
295 /* -----------------------------18.05.00 10:18--------------------------------
296 
297  ---------------------------------------------------------------------------*/
298 Sequence< sal_Int8 > SAL_CALL SwXTextView::getImplementationId(  ) throw(uno::RuntimeException)
299 {
300     vos::OGuard aGuard(Application::GetSolarMutex());
301     static Sequence< sal_Int8 > aId( 16 );
302     static sal_Bool bInit = sal_False;
303     if(!bInit)
304     {
305         rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
306         bInit = sal_True;
307     }
308     return aId;
309 }
310 /* -----------------------------18.05.00 10:18--------------------------------
311 
312  ---------------------------------------------------------------------------*/
313 void SAL_CALL SwXTextView::acquire(  )throw()
314 {
315         SfxBaseController::acquire();
316 }
317 /* -----------------------------18.05.00 10:18--------------------------------
318 
319  ---------------------------------------------------------------------------*/
320 void SAL_CALL SwXTextView::release(  )throw()
321 {
322         SfxBaseController::release();
323 }
324 /* -----------------------------18.05.00 10:23--------------------------------
325 
326  ---------------------------------------------------------------------------*/
327 uno::Any SAL_CALL SwXTextView::queryInterface( const uno::Type& aType )
328         throw (RuntimeException)
329 {
330         uno::Any aRet;
331         if(aType == ::getCppuType((uno::Reference<view::XSelectionSupplier      >*)0))
332         {
333                 uno::Reference<view::XSelectionSupplier> xRet = this;
334                 aRet.setValue(&xRet, aType);
335         }
336         else if(aType == ::getCppuType((uno::Reference<lang::XServiceInfo                       >*)0))
337         {
338                 uno::Reference<lang::XServiceInfo> xRet = this;
339                 aRet.setValue(&xRet, aType);
340         }
341         else if(aType == ::getCppuType((uno::Reference<view::XControlAccess             >*)0))
342         {
343                 uno::Reference<view::XControlAccess> xRet = this;
344                 aRet.setValue(&xRet, aType);
345         }
346     else if(aType == ::getCppuType((uno::Reference<view::XFormLayerAccess   >*)0))
347         {
348                 uno::Reference<view::XFormLayerAccess> xRet = this;
349                 aRet.setValue(&xRet, aType);
350         }
351         else if(aType == ::getCppuType((uno::Reference<text::XTextViewCursorSupplier>*)0))
352         {
353                 uno::Reference<text::XTextViewCursorSupplier> xRet = this;
354                 aRet.setValue(&xRet, aType);
355         }
356         else if(aType == ::getCppuType((uno::Reference<view::XViewSettingsSupplier      >*)0))
357         {
358                 uno::Reference<view::XViewSettingsSupplier> xRet = this;
359                 aRet.setValue(&xRet, aType);
360         }
361         else if(aType == ::getCppuType((uno::Reference<XRubySelection>*)0))
362         {
363                 uno::Reference<XRubySelection> xRet = this;
364                 aRet.setValue(&xRet, aType);
365         }
366     else if(aType == ::getCppuType((uno::Reference<XPropertySet>*)0))
367     {
368         uno::Reference<XPropertySet> xRet = this;
369         aRet.setValue(&xRet, aType);
370     }
371     else if(aType == ::getCppuType((uno::Reference<datatransfer::XTransferableSupplier   >*)0))
372         {
373         uno::Reference<datatransfer::XTransferableSupplier> xRet = this;
374                 aRet.setValue(&xRet, aType);
375         }
376         else
377                 aRet = SfxBaseController::queryInterface(aType);
378         return aRet;
379 }
380 /*-- 17.12.98 09:34:26---------------------------------------------------
381 
382   -----------------------------------------------------------------------*/
383 sal_Bool SwXTextView::select(const uno::Any& aInterface) throw( lang::IllegalArgumentException, uno::RuntimeException )
384 {
385         ::vos::OGuard aGuard(Application::GetSolarMutex());
386     uno::Reference< uno::XInterface >  xInterface;
387     if(GetView() && (aInterface >>= xInterface))
388         {
389                 SwWrtShell& rSh = GetView()->GetWrtShell();
390                 SwDoc* pDoc = GetView()->GetDocShell()->GetDoc();
391                 uno::Reference< lang::XUnoTunnel >  xIfcTunnel(xInterface, uno::UNO_QUERY);
392                 uno::Reference< text::XTextCursor >  xCrsr(xInterface, uno::UNO_QUERY);
393                 uno::Reference< container::XIndexAccess >       xPosN(xInterface, uno::UNO_QUERY);
394                 uno::Reference< text::XTextRange >      xPos(xInterface, uno::UNO_QUERY);
395         SwXFrame* pFrame = xIfcTunnel.is() ? reinterpret_cast<SwXFrame*>(
396             xIfcTunnel->getSomething(SwXFrame::getUnoTunnelId())) : 0;
397 
398         SwXCell* pCell = xIfcTunnel.is() ? reinterpret_cast<SwXCell*>(
399             xIfcTunnel->getSomething(SwXCell::getUnoTunnelId())) : 0;
400 
401                 SwPaM * pPam = 0;
402                 SwXTextRanges* pPosN = 0;
403                 if(xCrsr.is())
404                 {
405                         //
406                         OTextCursorHelper* pCursor =
407                                 xIfcTunnel.is() ?
408                     reinterpret_cast<OTextCursorHelper*>(xIfcTunnel->getSomething(OTextCursorHelper::getUnoTunnelId()))
409                                         : 0;
410 
411                         if(pCursor && pCursor->GetDoc() == GetView()->GetDocShell()->GetDoc())
412                                 pPam = lcl_createPamCopy(*((SwXTextCursor*)pCursor)->GetPaM());
413 
414                 }
415                 else if(xPosN.is() &&
416                         xIfcTunnel.is() &&
417                 0 != (pPosN = reinterpret_cast<SwXTextRanges*>(xIfcTunnel->getSomething(SwXTextRanges::getUnoTunnelId()))))
418                 {
419                         const SwUnoCrsr* pUnoCrsr = pPosN->GetCursor();
420                         if(pUnoCrsr)
421                         {
422                                 pPam = lcl_createPamCopy(*pUnoCrsr);
423                         }
424                 }
425                 // prevent misinterpretation of text frames that provide a XTextRange interface, too
426                 else if(!pFrame && !pCell && xPos.is())
427                 {
428                         SwUnoInternalPaM aPam(*pDoc);
429                         if(SwXTextRange::XTextRangeToSwPaM(aPam, xPos))
430                         {
431                                 pPam = lcl_createPamCopy(aPam);
432                         }
433                 }
434                 if(pPam)
435                 {
436                         rSh.EnterStdMode();
437                         rSh.SetSelection(*pPam);
438             while( pPam->GetNext() != pPam )
439                 delete pPam->GetNext();
440             delete pPam;
441                         return sal_True;
442                 }
443                 if(pFrame)
444                 {
445 
446                         SwFrmFmt* pFrmFmt = pFrame->GetFrmFmt();
447                         if(pFrmFmt && pFrmFmt->GetDoc() == pDoc)
448                         {
449                                 sal_Bool bSuccess = rSh.GotoFly( pFrmFmt->GetName(), pFrame->GetFlyCntType());
450                                 if (bSuccess)
451                                 {
452                                         rSh.HideCrsr();
453                                         rSh.EnterSelFrmMode();
454                                 }
455                                 return sal_True;
456                         }
457                 }
458 
459                 uno::Reference< text::XTextTable >  xTbl(xInterface, uno::UNO_QUERY);;
460 
461                 if(xTbl.is() && xIfcTunnel.is())
462                 {
463             SwXTextTable* pTable = reinterpret_cast<SwXTextTable*>(
464                 xIfcTunnel->getSomething(SwXTextTable::getUnoTunnelId()));
465 
466                         SwFrmFmt* pTblFrmFmt = pTable ? ((SwXTextTable*)pTable)->GetFrmFmt() : 0;
467                         if(pTblFrmFmt &&pTblFrmFmt->GetDoc() == pDoc)
468                         {
469                                 rSh.EnterStdMode();
470                                 rSh.GotoTable(pTblFrmFmt->GetName());
471                         }
472                         return sal_True;
473                 }
474 
475         if(pCell)
476         {
477             SwFrmFmt* pTblFrmFmt = pCell->GetFrmFmt();
478             if(pTblFrmFmt && pTblFrmFmt->GetDoc() == pDoc)
479             {
480                 SwTableBox* pBox = pCell->GetTblBox();
481                 SwTable* pTable = SwTable::FindTable( pTblFrmFmt );
482                 pBox = pCell->FindBox(pTable, pBox);
483                 if(pBox)
484                 {
485                     const SwStartNode* pSttNd = pBox->GetSttNd();
486                     SwPosition aPos(*pSttNd);
487                     SwPaM aPam(aPos);
488                     aPam.Move(fnMoveForward, fnGoNode);
489                     rSh.EnterStdMode();
490                     rSh.SetSelection(aPam);
491                     return sal_True;
492                 }
493             }
494         }
495         SwXCellRange* pRange = xIfcTunnel.is() ? reinterpret_cast<SwXCellRange*>(
496             xIfcTunnel->getSomething(SwXCellRange::getUnoTunnelId())) : 0;
497         if(pRange)
498         {
499            const SwUnoCrsr* pUnoCrsr = pRange->GetTblCrsr();
500            if(pUnoCrsr)
501            {
502                 UnoActionRemoveContext aContext(pDoc);
503                 rSh.EnterStdMode();
504                 rSh.SetSelection(*pUnoCrsr);
505                                 return sal_True;
506            }
507         }
508                 uno::Reference< text::XTextContent >  xBkm(xInterface, uno::UNO_QUERY);;
509 
510                 if(xBkm.is() && xIfcTunnel.is())
511                 {
512             SwXBookmark* pBkm = reinterpret_cast<SwXBookmark*>(
513                     xIfcTunnel->getSomething(SwXBookmark::getUnoTunnelId()));
514                         if(pBkm && pBkm->GetDoc() == pDoc)
515                         {
516 
517                                 sal_uInt16 nFndPos = rSh.FindBookmark(pBkm->getName());
518 
519                                 if( USHRT_MAX != nFndPos )
520                                 {
521                                         rSh.EnterStdMode();
522                                         rSh.GotoBookmark( nFndPos );
523                                 }
524                                 return sal_True;
525                         }
526                 }
527         // IndexMark, Index, TextField, Draw, Section, Footnote, Paragraph
528                 //
529 
530         // detect controls
531 
532         uno::Reference< awt::XControlModel > xCtrlModel(xInterface, UNO_QUERY);
533         if(xCtrlModel.is())
534         {
535             uno::Reference<awt::XControl> XControl;
536             SdrObject* pObj = GetControl(xCtrlModel, XControl);
537             if(pObj)
538             {
539                 SdrView* pDrawView = rSh.GetDrawView();
540                 SdrPageView* pPV = pDrawView->GetSdrPageView();
541                 if ( pPV && pObj->GetPage() == pPV->GetPage() )
542                                 {
543                                         pDrawView->SdrEndTextEdit();
544                                         pDrawView->UnmarkAll();
545                     pDrawView->MarkObj( pObj, pPV );
546                                 }
547                 return sal_True;
548             }
549         }
550 
551                 uno::Reference< drawing::XShapes >  xShapeColl( xInterface, uno::UNO_QUERY );
552                 uno::Reference< beans::XPropertySet >  xTmpProp(xInterface, uno::UNO_QUERY);
553                 SwXShape* pSwXShape = 0;
554                 if(xIfcTunnel.is())
555             pSwXShape = reinterpret_cast<SwXShape*>(xIfcTunnel->getSomething(SwXShape::getUnoTunnelId()));
556                 SvxShape* pSvxShape = 0;
557                 if(pSwXShape)
558                 {
559                         uno::Reference< uno::XAggregation >     xAgg = pSwXShape->GetAggregationInterface();
560                         if(xAgg.is())
561                         {
562                 pSvxShape = reinterpret_cast<SvxShape*>(xIfcTunnel->getSomething(SvxShape::getUnoTunnelId()));
563                         }
564                 }
565 
566                 if ( pSvxShape || xShapeColl.is() )                     // Drawing drawing::Layer
567                 {
568                         SdrView* pDrawView = rSh.GetDrawView();
569                         if (pDrawView)
570                         {
571                                 pDrawView->SdrEndTextEdit();
572                                 pDrawView->UnmarkAll();
573 
574                                 if (pSvxShape)          // einzelnes Shape
575                                 {
576                                         SdrObject *pObj = pSvxShape->GetSdrObject();
577                                         if (pObj)
578                                         {
579 //                                              lcl_ShowObject( *pViewSh, *pDrawView, pObj );
580                                                 SdrPageView* pPV = pDrawView->GetSdrPageView();
581                                                 if ( pPV && pObj->GetPage() == pPV->GetPage() )
582                                                 {
583                                                         pDrawView->MarkObj( pObj, pPV );
584                             return sal_True;
585                                                 }
586                                         }
587                                 }
588                                 else    // Shape Collection
589                                 {
590                     sal_Bool bSelected = sal_False;
591                                         SdrPageView* pPV = NULL;
592                                         long nCount = xShapeColl->getCount();
593                                         for ( long i = 0; i < nCount; i++ )
594                                         {
595                                                 uno::Reference< drawing::XShape >  xShapeInt;
596                                                 uno::Any aAny = xShapeColl->getByIndex(i);
597                         aAny >>= xShapeInt;
598                                                 if (xShapeInt.is())
599                                                 {
600                                                         uno::Reference< lang::XUnoTunnel> xShapeTunnel(xShapeInt, uno::UNO_QUERY);
601 
602                                                         SvxShape* pShape = xShapeTunnel.is() ?
603                                 reinterpret_cast<SvxShape*>(xShapeTunnel->getSomething(SvxShape::getUnoTunnelId())) : 0;
604 
605                                                         if (pShape)
606                                                         {
607                                                                 SdrObject *pObj = pShape->GetSdrObject();
608                                                                 if (pObj)
609                                                                 {
610                                                                         if (!pPV)                               // erstes Objekt
611                                                                         {
612 //                                                                              lcl_ShowObject( *pViewSh, *pDrawView, pObj );
613                                                                                 pPV = pDrawView->GetSdrPageView();
614                                                                         }
615                                                                         if ( pPV && pObj->GetPage() == pPV->GetPage() )
616                                                                         {
617                                                                                 pDrawView->MarkObj( pObj, pPV );
618                                         bSelected = sal_True;
619                                                                         }
620                                                                 }
621                                                         }
622                                                 }
623                                         }
624                     return bSelected;
625                                 }
626                         }
627                 }
628         }
629         return sal_False;
630 
631 }
632 /*-- 17.12.98 09:34:26---------------------------------------------------
633 
634   -----------------------------------------------------------------------*/
635 uno::Any SwXTextView::getSelection(void) throw( uno::RuntimeException )
636 {
637         ::vos::OGuard aGuard(Application::GetSolarMutex());
638         uno::Reference< uno::XInterface >  aRef;
639     if(GetView())
640         {
641                 //force immediat shell update
642                 pView->StopShellTimer();
643                 // ein interface aus der aktuellen Selektion erzeugen
644                 SwWrtShell& rSh = pView->GetWrtShell();
645                 ShellModes      eSelMode = pView->GetShellMode();
646                 switch(eSelMode)
647                 {
648                         case SHELL_MODE_TABLE_TEXT      :
649                         {
650                                 if(rSh.GetTableCrsr())
651                                 {
652                                         DBG_ASSERT(rSh.GetTableFmt(), "kein Tabellenformat?");
653                                         uno::Reference< text::XTextTableCursor >  xCrsr = new SwXTextTableCursor(*rSh.GetTableFmt(),
654                                                                                                         rSh.GetTableCrsr());
655                                         aRef = uno::Reference<