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: unotxdoc.cxx,v $
006  *
007  *  $Revision: 1.122 $
008  *
009  *  last change: $Author: hr $ $Date: 2007/09/27 12:43:41 $
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 <cmdid.h>
040 #include <swtypes.hxx>
041 
042 #ifndef _SV_IMAGE_HXX
043 #include <vcl/image.hxx>
044 #endif
045 #ifndef _SV_VIRDEV_HXX
046 #include <vcl/virdev.hxx>
047 #endif
048 #ifndef _SV_SVAPP_HXX
049 #include <vcl/svapp.hxx>
050 #endif
051 #ifndef _SFXVIEWFRM_HXX
052 #include <sfx2/viewfrm.hxx>
053 #endif
054 #ifndef _TOOLKIT_UNOHLP_HXX
055 #include <toolkit/helper/vclunohelper.hxx>
056 #endif
057 #ifndef _SWWDOCSH_HXX //autogen
058 #include <wdocsh.hxx>
059 #endif
060 #ifndef _WRTSH_HXX //autogen
061 #include <wrtsh.hxx>
062 #endif
063 #ifndef _SWVIEW_HXX //autogen
064 #include <view.hxx>
065 #endif
066 #ifndef _SWPVIEW_HXX
067 #include <pview.hxx>
068 #endif
069 #ifndef _SRCVIEW_HXX
070 #include <srcview.hxx>
071 #endif
072 #ifndef _VIEWSH_HXX //autogen
073 #include <viewsh.hxx>
074 #endif
075 #ifndef _PVPRTDAT_HXX
076 #include <pvprtdat.hxx>
077 #endif
078 #ifndef _SWPRTOPT_HXX
079 #include <swprtopt.hxx>
080 #endif
081 #ifndef _SFXSTRITEM_HXX //autogen
082 #include <svtools/stritem.hxx>
083 #endif
084 #ifndef _UNOTXDOC_HXX //autogen
085 #include <unotxdoc.hxx>
086 #endif
087 #ifndef _NUMUNO_HXX
088 #include <svtools/numuno.hxx>
089 #endif
090 #ifndef _UNOOBJ_HXX
091 #include <unoobj.hxx>
092 #endif
093 #ifndef _UNOSETT_HXX
094 #include <unosett.hxx>
095 #endif
096 #ifndef _UNOCOLL_HXX
097 #include <unocoll.hxx>
098 #endif
099 #ifndef _UNOREDLINES_HXX
100 #include <unoredlines.hxx>
101 #endif
102 #ifndef _UNOSRCH_HXX
103 #include <unosrch.hxx>
104 #endif
105 #ifndef _TOOLKIT_AWT_VCLXDEVICE_HXX_
106 #include <toolkit/awt/vclxdevice.hxx>
107 #endif
108 #ifndef _SFXDISPATCH_HXX //autogen
109 #include <sfx2/dispatch.hxx>
110 #endif
111 #ifndef _SFXREQUEST_HXX //autogen
112 #include <sfx2/request.hxx>
113 #endif
114 #ifndef _SFXDOCINF_HXX
115 #include <sfx2/docinf.hxx>
116 #endif
117 #ifndef _SFX_OBJSH_HXX
118 #include <sfx2/objsh.hxx>   // SfxObjectShellRef <-> SV_DECL_REF(SfxObjectShell)
119 #endif
120 #ifndef _UNOPRNMS_HXX
121 #include <unoprnms.hxx>
122 #endif
123 #ifndef _UNOSTYLE_HXX
124 #include <unostyle.hxx>
125 #endif
126 #ifndef _UNODRAW_HXX
127 #include <unodraw.hxx>
128 #endif
129 #ifndef _SFXENUMITEM_HXX //autogen
130 #include <svtools/eitem.hxx>
131 #endif
132 #ifndef _PAGEDESC_HXX //autogen
133 #include <pagedesc.hxx>
134 #endif
135 #ifndef _TXTCMP_HXX //autogen
136 #include <svtools/txtcmp.hxx>
137 #endif
138 #ifndef _UNOCRSR_HXX //autogen
139 #include <unocrsr.hxx>
140 #endif
141 #ifndef _UNOFIELD_HXX
142 #include <unofield.hxx>
143 #endif
144 #ifndef _UNOIDX_HXX
145 #include <unoidx.hxx>
146 #endif
147 #ifndef _POOLFMT_HXX
148 #include <poolfmt.hxx>
149 #endif
150 #ifndef _SWGLOBDOCSH_HXX
151 #include <globdoc.hxx>
152 #endif
153 #ifndef _VIEWOPT_HXX
154 #include <viewopt.hxx>
155 #endif
156 #ifndef _UNOCHART_HXX
157 #include <unochart.hxx>
158 #endif
159 #ifndef _DOC_HXX
160 #include <doc.hxx>
161 #endif
162 
163 #ifndef _COM_SUN_STAR_UTIL_SEARCHOPTIONS_HPP_
164 #include <com/sun/star/util/SearchOptions.hpp>
165 #endif
166 #ifndef _COM_SUN_STAR_LANG_SERVICENOTREGISTEREDEXCEPTION_HPP_
167 #include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
168 #endif
169 #ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
170 #include <com/sun/star/lang/DisposedException.hpp>
171 #endif
172 #ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATSSUPPLIER_HPP_
173 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
174 #endif
175 #ifndef _COM_SUN_STAR_BEANS_PropertyAttribute_HPP_
176 #include <com/sun/star/beans/PropertyAttribute.hpp>
177 #endif
178 #ifndef _COM_SUN_STAR_DOCUMENT_REDLINEDISPLAYTYPE_HPP_
179 #include <com/sun/star/document/RedlineDisplayType.hpp>
180 #endif
181 #ifndef _SVXLINKMGR_HXX
182 #include <svx/linkmgr.hxx>
183 #endif
184 #ifndef _SVX_UNOFILL_HXX_
185 #include <svx/unofill.hxx>
186 #endif
187 #ifndef _UNO_LINGU_HXX
188 #include <svx/unolingu.hxx>
189 #endif
190 #ifndef _SFX_PROGRESS_HXX
191 #include <sfx2/progress.hxx>
192 #endif
193 #ifndef _SWMODULE_HXX
194 #include <swmodule.hxx>
195 #endif
196 #ifndef _DOCSTAT_HXX //autogen wg. SwDocStat
197 #include <docstat.hxx>
198 #endif
199 #ifndef _MODOPT_HXX //
200 #include <modcfg.hxx>
201  #endif
202 #ifndef _NDTXT_HXX
203 #include <ndtxt.hxx>
204 #endif
205 #ifndef _UTLUI_HRC
206 #include <utlui.hrc>
207 #endif
208 #ifndef _SWCONT_HXX
209 #include <swcont.hxx>
210 #endif
211 #ifndef _UNODEFAULTS_HXX
212 #include <unodefaults.hxx>
213 #endif
214 #ifndef _SW_XDOCUMENT_SETTINGS_HXX
215 #include <SwXDocumentSettings.hxx>
216 #endif
217 #ifndef _SW_XPRINTPREVIEWSETTINGS_HXX_
218 #include <SwXPrintPreviewSettings.hxx>
219 #endif
220 #ifndef _DOC_HXX //autogen
221 #include <doc.hxx>
222 #endif
223 #ifndef _FORBIDDENCHARACTERSTABLE_HXX
224 #include <svx/forbiddencharacterstable.hxx>
225 #endif
226 #ifndef _ZFORLIST_HXX
227 #include <svtools/zforlist.hxx>
228 #endif
229 #ifndef _DRAWDOC_HXX
230 #include <drawdoc.hxx>
231 #endif
232 #ifndef _SWSTYLENAMEMAPPER_HXX
233 #include <SwStyleNameMapper.hxx>
234 #endif
235 #ifndef _OSL_FILE_HXX_
236 #include <osl/file.hxx>
237 #endif
238 
239 // --> FME 2004-06-08 #i12836# enhanced pdf export
240 #ifndef _ENHANCEDPDFEXPORTHELPER_HXX
241 #include <EnhancedPDFExportHelper.hxx>
242 #endif
243 // <--
244 
245 using namespace ::com::sun::star;
246 using namespace ::com::sun::star::text;
247 using namespace ::com::sun::star::i18n;
248 using namespace ::com::sun::star::uno;
249 using namespace ::com::sun::star::beans;
250 using namespace ::com::sun::star::lang;
251 using namespace ::com::sun::star::container;
252 using namespace ::com::sun::star::document;
253 using namespace ::com::sun::star::i18n;
254 using ::rtl::OUString;
255 using ::osl::FileBase;
256 
257 /* -----------------------------17.01.01 15:43--------------------------------
258 
259  ---------------------------------------------------------------------------*/
260 #define SW_CREATE_DASH_TABLE            0x01
261 #define SW_CREATE_GRADIENT_TABLE        0x02
262 #define SW_CREATE_HATCH_TABLE           0x03
263 #define SW_CREATE_BITMAP_TABLE          0x04
264 #define SW_CREATE_TRANSGRADIENT_TABLE   0x05
265 #define SW_CREATE_MARKER_TABLE          0x06
266 #define SW_CREATE_DRAW_DEFAULTS         0x07
267 
268 
269 /******************************************************************************
270  *
271  ******************************************************************************/
272 SwTxtFmtColl *lcl_GetParaStyle(const String& rCollName, SwDoc* pDoc)
273 {
274         SwTxtFmtColl* pColl = pDoc->FindTxtFmtCollByName( rCollName );
275         if( !pColl )
276         {
277                 sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( rCollName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
278                 if( USHRT_MAX != nId )
279                         pColl = pDoc->GetTxtCollFromPool( nId );
280         }
281         return pColl;
282 }
283 void lcl_DisposeView( SfxViewFrame* pToClose, SwDocShell* pDocShell )
284 {
285     // check if the view frame still exists
286     SfxViewFrame* pFound = SfxViewFrame::GetFirst( pDocShell,
287                                 0,
288                                 FALSE );
289     while(pFound)
290     {
291         if( pFound == pToClose)
292         {
293             pToClose->DoClose();
294             break;
295         }
296         pFound = SfxViewFrame::GetNext( *pFound,
297                                 pDocShell,
298                                 0,
299                                 FALSE );
300     }
301 }
302 /* -----------------------------10.03.00 18:02--------------------------------
303 
304  ---------------------------------------------------------------------------*/
305 const Sequence< sal_Int8 > & SwXTextDocument::getUnoTunnelId()
306 {
307     static Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
308         return aSeq;
309 }
310 /* -----------------------------10.03.00 18:04--------------------------------
311 
312  ---------------------------------------------------------------------------*/
313 sal_Int64 SAL_CALL SwXTextDocument::getSomething( const Sequence< sal_Int8 >& rId )
314         throw(RuntimeException)
315 {
316     if( rId.getLength() == 16
317         && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
318                                                                                 rId.getConstArray(), 16 ) )
319     {
320             return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ));
321     }
322 
323         sal_Int64 nRet = SfxBaseModel::getSomething( rId );
324         if ( nRet )
325                 return nRet;
326         else
327         {
328                 GetNumberFormatter();
329                 Any aNumTunnel = xNumFmtAgg->queryAggregation(::getCppuType((Reference<XUnoTunnel>*)0));
330                 Reference<XUnoTunnel> xNumTunnel;
331                 aNumTunnel >>= xNumTunnel;
332                 if(xNumTunnel.is())
333                         return xNumTunnel->getSomething(rId);
334         }
335 
336         return SfxBaseModel::getSomething( rId );
337 }
338 /* -----------------------------16.03.00 14:12--------------------------------
339 
340  ---------------------------------------------------------------------------*/
341 Any SAL_CALL SwXTextDocument::queryInterface( const uno::Type& rType ) throw(RuntimeException)
342 {
343         Any aRet = SwXTextDocumentBaseClass::queryInterface(rType);
344         if(aRet.getValueType() == getVoidCppuType())
345                 aRet = SfxBaseModel::queryInterface(rType);
346         if(aRet.getValueType() == getVoidCppuType() &&
347                 rType == ::getCppuType((Reference<lang::XMultiServiceFactory>*)0))
348         {
349                 Reference<lang::XMultiServiceFactory> xTmp = this;
350                 aRet <<= xTmp;
351         }
352         if(aRet.getValueType() == getVoidCppuType())
353         {
354                 GetNumberFormatter();
355                 if(xNumFmtAgg.is())
356                         aRet = xNumFmtAgg->queryAggregation(rType);
357         }
358         return aRet;
359 }
360 /* -----------------------------16.03.00 14:12--------------------------------
361 
362  ---------------------------------------------------------------------------*/
363 void SAL_CALL SwXTextDocument::acquire()throw()
364 {
365         SfxBaseModel::acquire();
366 }
367 /* -----------------------------16.03.00 14:12--------------------------------
368 
369  ---------------------------------------------------------------------------*/
370 void SAL_CALL SwXTextDocument::release()throw()
371 {
372         SfxBaseModel::release();
373 }
374 /* -----------------------------07.12.00 11:37--------------------------------
375 
376  ---------------------------------------------------------------------------*/
377 Reference< XAdapter > SwXTextDocument::queryAdapter(  ) throw(RuntimeException)
378 {
379         return SfxBaseModel::queryAdapter();
380 }
381 /* -----------------------------16.03.00 14:12--------------------------------
382 
383  ---------------------------------------------------------------------------*/
384 Sequence< uno::Type > SAL_CALL SwXTextDocument::getTypes() throw(RuntimeException)
385 {
386         Sequence< uno::Type > aBaseTypes = SfxBaseModel::getTypes();
387         Sequence< uno::Type > aTextTypes = SwXTextDocumentBaseClass::getTypes();
388 
389         Sequence< uno::Type > aNumTypes;
390         GetNumberFormatter();
391         if(xNumFmtAgg.is())
392         {
393         const uno::Type& rProvType = ::getCppuType((Reference <XTypeProvider>*)0);
394         Any aNumProv = xNumFmtAgg->queryAggregation(rProvType);
395         Reference<XTypeProvider> xNumProv;
396         if(aNumProv >>= xNumProv)
397                 {
398                         aNumTypes = xNumProv->getTypes();
399                 }
400         }
401         long nIndex = aBaseTypes.getLength();
402     // don't forget the lang::XMultiServiceFactory
403         aBaseTypes.realloc(aBaseTypes.getLength() + aTextTypes.getLength() + aNumTypes.getLength() + 1);
404         uno::Type* pBaseTypes = aBaseTypes.getArray();
405         const uno::Type* pTextTypes = aTextTypes.getConstArray();
406         long nPos;
407         for(nPos = 0; nPos < aTextTypes.getLength(); nPos++)
408         {
409                 pBaseTypes[nIndex++] = pTextTypes[nPos];
410         }
411         const uno::Type* pNumTypes = aNumTypes.getConstArray();
412         for(nPos = 0; nPos < aNumTypes.getLength(); nPos++)
413         {
414                 pBaseTypes[nIndex++] = pNumTypes[nPos];
415         }
416         pBaseTypes[nIndex++] = ::getCppuType((Reference<lang::XMultiServiceFactory>*)0);
417         return aBaseTypes;
418 }
419 /*-- 18.12.98 11:52:59---------------------------------------------------
420 
421   -----------------------------------------------------------------------*/
422 SwXTextDocument::SwXTextDocument(SwDocShell* pShell) :
423         SfxBaseModel(pShell),
424 
425     aRefreshCont ( static_cast < XTextDocument* > ( this ) ),
426 
427     aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_DOCUMENT)),
428 
429     pDocShell(pShell),
430 
431     bObjectValid(pShell != 0),
432 
433     pDrawPage(0),
434     pxXDrawPage(0),
435 
436     pxXNumberingRules(0),
437     pxXFootnotes(0),
438     pxXFootnoteSettings(0),
439     pxXEndnotes(0),
440     pxXEndnoteSettings(0),
441     pxXReferenceMarks(0),
442     pxXTextFieldTypes(0),
443     pxXTextFieldMasters(0),
444     pxXTextSections(0),
445     pxXBookmarks(0),
446     pxXTextTables(0),
447         pxXTextFrames(0),
448         pxXGraphicObjects(0),
449         pxXEmbeddedObjects(0),
450     pxXStyleFamilies(0),
451     pxXAutoStyles(0),
452     pxXChapterNumbering(0),
453     pxXDocumentIndexes(0),
454 
455         pxXLineNumberingProperties(0),
456         pxLinkTargetSupplier(0),
457     pxXRedlines(0),
458     m_pHiddenViewFrame(0)
459 {
460 }
461 /*-- 18.12.98 11:53:00---------------------------------------------------
462 
463   -----------------------------------------------------------------------*/
464 SwXTextDocument::~SwXTextDocument()
465 {
466         InitNewDoc();
467         if(xNumFmtAgg.is())
468         {
469                 Reference< XInterface >  x0;
470                 xNumFmtAgg->setDelegator(x0);
471                 xNumFmtAgg = 0;
472         }
473 }
474 
475 uno::Reference< document::XDocumentInfo > SAL_CALL SwXTextDocument::getDocumentInfo() throw (::uno::RuntimeException)
476 {
477         return pDocShell->GetDoc()->GetDocumentInfo()->GetInfo();
478 }
479 
480 /*-- 18.12.98 11:55:08---------------------------------------------------
481 
482   -----------------------------------------------------------------------*/
483 /* -----------------18.12.98 12:49-------------------
484  *
485  * --------------------------------------------------*/
486 SwXDocumentPropertyHelper * SwXTextDocument::GetPropertyHelper ()
487 {
488         if(!xPropertyHelper.is())
489         {
490                 pPropertyHelper = new SwXDocumentPropertyHelper(*pDocShell->GetDoc());
491                 xPropertyHelper = (cppu::OWeakObject*)pPropertyHelper;
492         }
493         return pPropertyHelper;
494 }
495 void SwXTextDocument::GetNumberFormatter()
496 {
497         if(IsValid())
498         {
499                 if(!xNumFmtAgg.is())
500                 {
501                         if ( pDocShell->GetDoc() )
502                         {
503                                 SvNumberFormatsSupplierObj* pNumFmt = new SvNumberFormatsSupplierObj(
504                                                                         pDocShell->GetDoc()->GetNumberFormatter( sal_True ));
505                                 Reference< util::XNumberFormatsSupplier >  xTmp = pNumFmt;
506                                 xNumFmtAgg = Reference< XAggregation >(xTmp, UNO_QUERY);
507                         }
508                         if(xNumFmtAgg.is())
509                                 xNumFmtAgg->setDelegator((cppu::OWeakObject*)(SwXTextDocumentBaseClass*)this);
510                 }
511                 else
512                 {
513             const uno::Type& rTunnelType = ::getCppuType((Reference <XUnoTunnel>*)0);
514             Any aNumTunnel = xNumFmtAgg->queryAggregation(rTunnelType);
515                         SvNumberFormatsSupplierObj* pNumFmt = 0;
516             Reference< XUnoTunnel > xNumTunnel;
517             if(aNumTunnel >>= xNumTunnel)
518                         {
519                 pNumFmt = reinterpret_cast<SvNumberFormatsSupplierObj*>(
520                         xNumTunnel->getSomething(SvNumberFormatsSupplierObj::getUnoTunnelId()));
521 
522                         }
523                         DBG_ASSERT(pNumFmt, "No number formatter available");
524                         if(!pNumFmt->GetNumberFormatter())
525                                 pNumFmt->SetNumberFormatter(pDocShell->GetDoc()->GetNumberFormatter( sal_True ));
526                 }
527         }
528 }
529 /*-- 18.12.98 11:55:11---------------------------------------------------
530 
531   -----------------------------------------------------------------------*/
532 Reference< XText >  SwXTextDocument::getText(void) throw( RuntimeException )
533 {
534         ::vos::OGuard aGuard(Application::GetSolarMutex());
535         if(!IsValid())
536                 throw RuntimeException();
537         if(!xBodyText.is())
538         {
539                 pBodyText = new SwXBodyText(pDocShell->GetDoc());
540                 xBodyText = pBodyText;
541         }
542         return xBodyText;
543 }
544 /*-- 18.12.98 11:55:11---------------------------------------------------
545 
546   -----------------------------------------------------------------------*/
547 void SwXTextDocument::reformat(void) throw( RuntimeException )
548 {
549         ::vos::OGuard aGuard(Application::GetSolarMutex());
550         if(!IsValid())
551                 throw RuntimeException();
552 }
553 /*-- 18.12.98 11:55:16---------------------------------------------------
554 
555   -----------------------------------------------------------------------*/
556 void SwXTextDocument::lockControllers(void) throw( RuntimeException )
557 {
558         ::vos::OGuard aGuard(Application::GetSolarMutex());
559         if(IsValid())
560         {
561                 UnoActionContext* pContext = new UnoActionContext(pDocShell->GetDoc());
562                 aActionArr.Insert(pContext, 0);
563         }
564         else
565                 throw RuntimeException();
566 }
567 /*-- 18.12.98 11:55:16---------------------------------------------------
568 
569   -----------------------------------------------------------------------*/
570 void SwXTextDocument::unlockControllers(void) throw( RuntimeException )
571 {
572         ::vos::OGuard aGuard(Application::GetSolarMutex());
573         if(aActionArr.Count())
574         {
575                 UnoActionContext* pContext = aActionArr.GetObject(0);
576                 aActionArr.Remove(0);
577                 delete pContext;
578         }
579         else
580                 throw RuntimeException();
581 }
582 /*-- 18.12.98 11:55:17---------------------------------------------------
583 
584   -----------------------------------------------------------------------*/
585 sal_Bool SwXTextDocument::hasControllersLocked(void) throw( RuntimeException )
586 {
587         ::vos::OGuard aGuard(Application::GetSolarMutex());
588         return aActionArr.Count() > 0;
589 }
590 /*-- 18.12.98 13:12:23---------------------------------------------------
591 
592   -----------------------------------------------------------------------*/
593 Reference< frame::XController >  SwXTextDocument::getCurrentController(void) throw( RuntimeException )
594 {
595         return SfxBaseModel::getCurrentController();
596 }
597 /*-- 18.12.98 13:12:24---------------------------------------------------
598 
599   -----------------------------------------------------------------------*/
600 void SwXTextDocument::setCurrentController(const Reference< frame::XController > & xController)
601         throw( NoSuchElementException, RuntimeException )
602 {
603         SfxBaseModel::setCurrentController(xController);
604 }
605 /* -----------------27.01.99 11:48-------------------
606  *
607  * --------------------------------------------------*/
608 Reference< XInterface >  SwXTextDocument::getCurrentSelection() throw( RuntimeException )
609 {
610         ::vos::OGuard aGuard(Application::GetSolarMutex());
611         Reference< XInterface >  xRef;
612         if(IsValid())
613         {
614 
615                 const TypeId aTypeId = TYPE(SwView);
616                 SwView* pView = (SwView*)SfxViewShell::GetFirst(&aTypeId);
617                 while(pView && pView->GetObjectShell() != pDocShell)
618                 {
619                         pView = (SwView*)SfxViewShell::GetNext(*pView, &aTypeId);
620                 }
621                 if(pView)
622                 {
623                         Any aRef = pView->GetUNOObject()->getSelection();
624             aRef >>= xRef;
625                 }
626         }
627         return xRef;
628 }
629 
630 /*-- 18.12.98 13:12:24---------------------------------------------------
631 
632   -----------------------------------------------------------------------*/
633 sal_Bool SwXTextDocument::attachResource(const OUString& aURL, const Sequence< beans::PropertyValue >& aArgs)
634                 throw( RuntimeException )
635 {
636         return SfxBaseModel::attachResource(aURL, aArgs);
637 }
638 /*-- 18.12.98 13:12:24---------------------------------------------------
639 
640   -----------------------------------------------------------------------*/
641 OUString SwXTextDocument::getURL(void) throw( RuntimeException )
642 {
643         return SfxBaseModel::getURL();
644 }
645 /*-- 18.12.98 13:12:24---------------------------------------------------
646 
647   -----------------------------------------------------------------------*/
648 Sequence< beans::PropertyValue > SwXTextDocument::getArgs(void) throw( RuntimeException )
649 {
650         return SfxBaseModel::getArgs();
651 }
652 /*-- 18.12.98 13:12:24---------------------------------------------------
653 
654   -----------------------------------------------------------------------*/
655 void SwXTextDocument::connectController(const Reference< frame::XController > & xController) throw( RuntimeException )
656 {
657         SfxBaseModel::connectController(xController);
658 }
659 /*-- 18.12.98 13:12:25---------------------------------------------------
660 
661   -----------------------------------------------------------------------*/
662 void SwXTextDocument::disconnectController(const Reference< frame::XController > & xController) throw( RuntimeException )
663 {
664         SfxBaseModel::disconnectController(xController);
665 }
666 /*-- 18.12.98 13:12:25---------------------------------------------------
667 
668   -----------------------------------------------------------------------*/
669 void SwXTextDocument::dispose(void) throw( RuntimeException )
670 {
671     SfxBaseModel::dispose();
672 }
673 /*-- 10.05.2005 14:14:39---------------------------------------------------
674 
675   -----------------------------------------------------------------------*/
676 void SwXTextDocument::close( sal_Bool bDeliverOwnership ) throw( util::CloseVetoException, RuntimeException )
677 {
678     if(IsValid() && m_pHiddenViewFrame)
679         lcl_DisposeView( m_pHiddenViewFrame, pDocShell);
680     SfxBaseModel::close(bDeliverOwnership);
681 }
682 /*-- 18.12.98 13:12:25---------------------------------------------------
683 
684   -----------------------------------------------------------------------*/
685 void SwXTextDocument::addEventListener(const Reference< lang::XEventListener > & aListener) throw( RuntimeException )
686 {
687         SfxBaseModel::addEventListener(aListener);
688 }
689 /*-- 18.12.98 13:12:26---------------------------------------------------
690 
691   -----------------------------------------------------------------------*/
692 void SwXTextDocument::removeEventListener(const Reference< lang::XEventListener > & aListener) throw( RuntimeException )
693 {
694         SfxBaseModel::removeEventListener(aListener);
695 }
696 
697 /*-- 18.12.98 11:55:19---------------------------------------------------
698 
699   -----------------------------------------------------------------------*/
700 Reference< XPropertySet > SwXTextDocument::getLineNumberingProperties(void)
701                         throw( RuntimeException )
702 {
703         ::vos::OGuard aGuard(Application::GetSolarMutex());
704         if(IsValid())
705         {
706                 if(!pxXLineNumberingProperties)
707                 {
708                         pxXLineNumberingProperties = new Reference<XPropertySet>;
709                         (*pxXLineNumberingProperties) = new SwXLineNumberingProperties(pDocShell->GetDoc());
710                 }
711         }
712         else
713                 throw RuntimeException();
714         return *pxXLineNumberingProperties;
715 }
716 /*-- 18.12.98 11:55:20---------------------------------------------------
717 
718   -----------------------------------------------------------------------*/
719 Reference< XIndexReplace >  SwXTextDocument::getChapterNumberingRules(void)