LCOV - code coverage report
Current view: top level - sw/source/core/unocore - unocoll.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 635 890 71.3 %
Date: 2012-08-25 Functions: 107 167 64.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 706 1639 43.1 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <swtypes.hxx>
      31                 :            : #include <cmdid.h>
      32                 :            : #include <hintids.hxx>
      33                 :            : #include <svx/svxids.hrc>
      34                 :            : #include <doc.hxx>
      35                 :            : #include <docary.hxx>
      36                 :            : #include <fmtcol.hxx>
      37                 :            : #include <poolfmt.hxx>
      38                 :            : #include <unocoll.hxx>
      39                 :            : #include <unosett.hxx>
      40                 :            : #include <fmtanchr.hxx>
      41                 :            : #include <ndtxt.hxx>
      42                 :            : #include <section.hxx>
      43                 :            : #include <IMark.hxx>
      44                 :            : #include <ftnidx.hxx>
      45                 :            : #include <fmtftn.hxx>
      46                 :            : #include <txtftn.hxx>
      47                 :            : #include <fmtpdsc.hxx>
      48                 :            : #include <pagedesc.hxx>
      49                 :            : #include <osl/mutex.hxx>
      50                 :            : #include <com/sun/star/text/XTextTableCursor.hpp>
      51                 :            : #include <com/sun/star/text/XTextTablesSupplier.hpp>
      52                 :            : #include <com/sun/star/text/TableColumnSeparator.hpp>
      53                 :            : #include <com/sun/star/text/XTextTable.hpp>
      54                 :            : #include <svl/PasswordHelper.hxx>
      55                 :            : #include <svtools/unoimap.hxx>
      56                 :            : #include <svtools/unoevent.hxx>
      57                 :            : #include <unotbl.hxx>
      58                 :            : #include <unostyle.hxx>
      59                 :            : #include <unofield.hxx>
      60                 :            : #include <unoidx.hxx>
      61                 :            : #include <unoframe.hxx>
      62                 :            : #include <unofootnote.hxx>
      63                 :            : #include <vcl/svapp.hxx>
      64                 :            : #include <fmtcntnt.hxx>
      65                 :            : #include <authfld.hxx>
      66                 :            : #include <SwXTextDefaults.hxx>
      67                 :            : #include <unochart.hxx>
      68                 :            : #include <comphelper/makesequence.hxx>
      69                 :            : #include <comphelper/sequence.hxx>
      70                 :            : #include <list>
      71                 :            : #include <iterator>
      72                 :            : #include <unosection.hxx>
      73                 :            : #include <unoparagraph.hxx>
      74                 :            : #include <unobookmark.hxx>
      75                 :            : #include <unorefmark.hxx>
      76                 :            : #include <unometa.hxx>
      77                 :            : #include "docsh.hxx"
      78                 :            : #include <switerator.hxx>
      79                 :            : #include <com/sun/star/document/XCodeNameQuery.hpp>
      80                 :            : #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
      81                 :            : #include <com/sun/star/form/XFormsSupplier.hpp>
      82                 :            : #include <com/sun/star/script/ModuleInfo.hpp>
      83                 :            : #include <com/sun/star/script/ModuleType.hpp>
      84                 :            : #include <com/sun/star/script/ScriptEventDescriptor.hpp>
      85                 :            : #include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
      86                 :            : #include <vbahelper/vbaaccesshelper.hxx>
      87                 :            : #include <basic/basmgr.hxx>
      88                 :            : #include <comphelper/processfactory.hxx>
      89                 :            : #include <comphelper/sequenceasvector.hxx>
      90                 :            : 
      91                 :            : using ::rtl::OUString;
      92                 :            : using namespace ::com::sun::star;
      93                 :            : using namespace ::com::sun::star::document;
      94                 :            : using namespace ::com::sun::star::uno;
      95                 :            : using namespace ::com::sun::star::text;
      96                 :            : using namespace ::com::sun::star::container;
      97                 :            : using namespace ::com::sun::star::lang;
      98                 :            : 
      99                 :            : using rtl::OUString;
     100                 :            : 
     101                 :            : #ifndef DISABLE_SCRIPTING
     102                 :            : 
     103         [ #  # ]:          0 : class SwVbaCodeNameProvider : public ::cppu::WeakImplHelper1< document::XCodeNameQuery >
     104                 :            : {
     105                 :            :     SwDocShell* mpDocShell;
     106                 :            :     rtl::OUString msThisDocumentCodeName;
     107                 :            : public:
     108                 :          0 :     SwVbaCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell ) {}
     109                 :            :         // XCodeNameQuery
     110                 :            : 
     111                 :          0 :     rtl::OUString SAL_CALL getCodeNameForContainer( const uno::Reference< uno::XInterface >& /*xIf*/ ) throw( uno::RuntimeException )
     112                 :            :     {
     113                 :            :         // not implemented...
     114                 :          0 :         return rtl::OUString();
     115                 :            :     }
     116                 :            : 
     117                 :          0 :     rtl::OUString SAL_CALL getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
     118                 :            :     {
     119                 :            :         // Initialise the code name
     120         [ #  # ]:          0 :         if ( msThisDocumentCodeName.isEmpty() )
     121                 :            :         {
     122                 :            :             try
     123                 :            :             {
     124 [ #  # ][ #  # ]:          0 :                 uno::Reference< beans::XPropertySet > xProps( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
     125 [ #  # ][ #  # ]:          0 :                 uno::Reference< container::XNameAccess > xLibContainer( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
         [ #  # ][ #  # ]
     126         [ #  # ]:          0 :         rtl::OUString sProjectName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ) );
     127 [ #  # ][ #  # ]:          0 :                 if ( mpDocShell->GetBasicManager()->GetName().Len() )
         [ #  # ][ #  # ]
     128 [ #  # ][ #  # ]:          0 :                     sProjectName =  mpDocShell->GetBasicManager()->GetName();
         [ #  # ][ #  # ]
     129                 :            : 
     130 [ #  # ][ #  # ]:          0 :                 uno::Reference< container::XNameAccess > xLib( xLibContainer->getByName( sProjectName ), uno::UNO_QUERY_THROW );
                 [ #  # ]
     131 [ #  # ][ #  # ]:          0 :                 uno::Sequence< rtl::OUString > sModuleNames = xLib->getElementNames();
     132         [ #  # ]:          0 :                 uno::Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( xLib, uno::UNO_QUERY );
     133                 :            : 
     134         [ #  # ]:          0 :                 for ( sal_Int32 i=0; i < sModuleNames.getLength(); ++i )
     135                 :            :                 {
     136         [ #  # ]:          0 :                     script::ModuleInfo mInfo;
     137                 :            : 
     138 [ #  # ][ #  # ]:          0 :                     if ( xVBAModuleInfo->hasModuleInfo( sModuleNames[ i ] ) &&  xVBAModuleInfo->getModuleInfo( sModuleNames[ i ] ).ModuleType == script::ModuleType::DOCUMENT )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     139                 :            :                     {
     140         [ #  # ]:          0 :                         msThisDocumentCodeName = sModuleNames[ i ];
     141                 :            :                         break;
     142                 :            :                     }
     143 [ #  # ][ #  # ]:          0 :                 }
         [ #  # ][ #  # ]
     144                 :            :             }
     145                 :          0 :             catch( uno::Exception& )
     146                 :            :             {
     147                 :            :             }
     148                 :            :         }
     149                 :          0 :         rtl::OUString sCodeName;
     150         [ #  # ]:          0 :         if ( mpDocShell )
     151                 :            :         {
     152                 :            :             OSL_TRACE( "*** In ScVbaCodeNameProvider::getCodeNameForObject");
     153                 :            :             // need to find the page ( and index )  for this control
     154 [ #  # ][ #  # ]:          0 :             uno::Reference< drawing::XDrawPageSupplier > xSupplier( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
     155 [ #  # ][ #  # ]:          0 :             uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
                 [ #  # ]
     156                 :            : 
     157                 :          0 :             bool bMatched = false;
     158         [ #  # ]:          0 :             uno::Sequence< script::ScriptEventDescriptor > aFakeEvents;
     159                 :            :                 try
     160                 :            :                 {
     161         [ #  # ]:          0 :                     uno::Reference< form::XFormsSupplier >  xFormSupplier( xIndex, uno::UNO_QUERY_THROW );
     162 [ #  # ][ #  # ]:          0 :                     uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
                 [ #  # ]
     163                 :            :                     // get the www-standard container
     164 [ #  # ][ #  # ]:          0 :                     uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
                 [ #  # ]
     165 [ #  # ][ #  # ]:          0 :                     sal_Int32 nCntrls = xFormControls->getCount();
     166         [ #  # ]:          0 :                     for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
     167                 :            :                     {
     168 [ #  # ][ #  # ]:          0 :                         uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );
                 [ #  # ]
     169         [ #  # ]:          0 :                         bMatched = ( xControl == xIf );
     170         [ #  # ]:          0 :                         if ( bMatched )
     171                 :            :                         {
     172                 :          0 :                             sCodeName = msThisDocumentCodeName;
     173                 :            :                             break;
     174                 :            :                         }
     175 [ #  # ][ #  # ]:          0 :                     }
     176                 :            :                 }
     177 [ #  # ][ #  # ]:          0 :                 catch( uno::Exception& ) {}
     178                 :            :         }
     179                 :            :         // Probably should throw here ( if !bMatched )
     180                 :          0 :         return sCodeName;
     181                 :            :     }
     182                 :            : };
     183                 :            : 
     184                 :            : typedef boost::unordered_map< rtl::OUString, rtl::OUString, rtl::OUStringHash > StringHashMap;
     185 [ +  - ][ -  + ]:         66 : class SwVbaProjectNameProvider : public ::cppu::WeakImplHelper1< container::XNameContainer >
     186                 :            : {
     187                 :            :     SwDocShell* mpDocShell;
     188                 :            :     StringHashMap mTemplateToProject;
     189                 :            : public:
     190         [ +  - ]:         36 :     SwVbaProjectNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell )
     191                 :            :     {
     192                 :         36 :     }
     193                 :          0 :     virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException )
     194                 :            :     {
     195         [ #  # ]:          0 :         return ( mTemplateToProject.find( aName ) != mTemplateToProject.end() );
     196                 :            :     }
     197                 :          0 :     virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
     198                 :            :     {
     199         [ #  # ]:          0 :         if ( !hasByName( aName ) )
     200         [ #  # ]:          0 :             throw container::NoSuchElementException();
     201 [ #  # ][ #  # ]:          0 :         return uno::makeAny( mTemplateToProject.find( aName )->second );
     202                 :            :     }
     203                 :          0 :     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw (::com::sun::star::uno::RuntimeException)
     204                 :            :     {
     205         [ #  # ]:          0 :         uno::Sequence< rtl::OUString > aElements( mTemplateToProject.size() );
     206         [ #  # ]:          0 :         StringHashMap::iterator it_end = mTemplateToProject.end();
     207                 :          0 :         sal_Int32 index = 0;
     208 [ #  # ][ #  # ]:          0 :         for ( StringHashMap::iterator it = mTemplateToProject.begin(); it != it_end; ++it, ++index )
     209 [ #  # ][ #  # ]:          0 :             aElements[ index ] = it->first;
     210                 :          0 :         return aElements;
     211                 :            :     }
     212                 :            : 
     213                 :          0 :     virtual void SAL_CALL insertByName( const rtl::OUString& aName, const uno::Any& aElement ) throw ( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::ElementExistException, com::sun::star::lang::WrappedTargetException )
     214                 :            :     {
     215                 :            : 
     216                 :          0 :         rtl::OUString sProjectName;
     217                 :          0 :         aElement >>= sProjectName;
     218                 :            :         OSL_TRACE("** Template cache inserting template name %s with project %s"
     219                 :            :             , rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr()
     220                 :            :             , rtl::OUStringToOString( sProjectName, RTL_TEXTENCODING_UTF8 ).getStr() );
     221         [ #  # ]:          0 :         mTemplateToProject[ aName ] = sProjectName;
     222                 :          0 :     }
     223                 :            : 
     224                 :          0 :     virtual void SAL_CALL removeByName( const rtl::OUString& Name ) throw ( com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException )
     225                 :            :     {
     226         [ #  # ]:          0 :         if ( !hasByName( Name ) )
     227         [ #  # ]:          0 :             throw container::NoSuchElementException();
     228                 :          0 :         mTemplateToProject.erase( Name );
     229                 :          0 :     }
     230                 :          0 :     virtual void SAL_CALL replaceByName( const rtl::OUString& aName, const uno::Any& aElement ) throw ( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException )
     231                 :            :     {
     232         [ #  # ]:          0 :         if ( !hasByName( aName ) )
     233         [ #  # ]:          0 :             throw container::NoSuchElementException();
     234                 :          0 :         insertByName( aName, aElement ); // insert will overwrite
     235                 :          0 :     }
     236                 :            :     // XElemenAccess
     237                 :          0 :     virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw (::com::sun::star::uno::RuntimeException)
     238                 :            :     {
     239                 :          0 :         return ::getCppuType((const rtl::OUString*)0);
     240                 :            :     }
     241                 :          0 :     virtual ::sal_Bool SAL_CALL hasElements(  ) throw (::com::sun::star::uno::RuntimeException )
     242                 :            :     {
     243                 :            : 
     244                 :          0 :         return ( mTemplateToProject.size() > 0 );
     245                 :            :     }
     246                 :            : 
     247                 :            : };
     248                 :            : 
     249         [ #  # ]:          0 : class SwVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper1< container::XNameAccess >
     250                 :            : {
     251                 :            :     SwDocShell* mpDocShell;
     252                 :            : public:
     253                 :          0 :     SwVbaObjectForCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell )
     254                 :            :     {
     255                 :            :         // #FIXME #TODO is the code name for ThisDocument read anywhere?
     256                 :          0 :     }
     257                 :            : 
     258                 :          0 :     virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException )
     259                 :            :     {
     260                 :            :         // #FIXME #TODO we really need to be checking against the codename for
     261                 :            :         // ThisDocument
     262         [ #  # ]:          0 :         if ( aName == "ThisDocument" )
     263                 :          0 :             return sal_True;
     264                 :          0 :         return sal_False;
     265                 :            :     }
     266                 :            : 
     267                 :          0 :     ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
     268                 :            :     {
     269 [ #  # ][ #  # ]:          0 :         if ( !hasByName( aName ) )
     270         [ #  # ]:          0 :              throw container::NoSuchElementException();
     271         [ #  # ]:          0 :     uno::Sequence< uno::Any > aArgs( 2 );
     272 [ #  # ][ #  # ]:          0 :         aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
     273 [ #  # ][ #  # ]:          0 :         aArgs[1] = uno::Any( mpDocShell->GetModel() );
                 [ #  # ]
     274         [ #  # ]:          0 :         uno::Reference< uno::XInterface > xDocObj = ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.word.Document" , aArgs );
     275                 :            :         OSL_TRACE("Creating Object ( ooo.vba.word.Document ) 0x%x", xDocObj.get() );
     276 [ #  # ][ #  # ]:          0 :         return  uno::makeAny( xDocObj );
     277                 :            :     }
     278                 :          0 :     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw (::com::sun::star::uno::RuntimeException)
     279                 :            :     {
     280                 :          0 :         uno::Sequence< rtl::OUString > aNames;
     281                 :          0 :         return aNames;
     282                 :            :     }
     283                 :            :     // XElemenAccess
     284                 :          0 :     virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw (::com::sun::star::uno::RuntimeException){ return uno::Type(); }
     285                 :          0 :     virtual ::sal_Bool SAL_CALL hasElements(  ) throw (::com::sun::star::uno::RuntimeException ) { return sal_True; }
     286                 :            : 
     287                 :            : };
     288                 :            : 
     289                 :            : #endif
     290                 :            : 
     291                 :            : struct  ProvNamesId_Type
     292                 :            : {
     293                 :            :     const char *    pName;
     294                 :            :     sal_uInt16      nType;
     295                 :            : };
     296                 :            : 
     297                 :            : // note: this thing is indexed as an array, so do not insert/remove entries!
     298                 :            : const ProvNamesId_Type aProvNamesId[] =
     299                 :            : {
     300                 :            :     { "com.sun.star.text.TextTable",                          SW_SERVICE_TYPE_TEXTTABLE },
     301                 :            :     { "com.sun.star.text.TextFrame",                          SW_SERVICE_TYPE_TEXTFRAME },
     302                 :            :     { "com.sun.star.text.GraphicObject",                      SW_SERVICE_TYPE_GRAPHIC },
     303                 :            :     { "com.sun.star.text.TextEmbeddedObject",                 SW_SERVICE_TYPE_OLE },
     304                 :            :     { "com.sun.star.text.Bookmark",                           SW_SERVICE_TYPE_BOOKMARK },
     305                 :            :     { "com.sun.star.text.Footnote",                           SW_SERVICE_TYPE_FOOTNOTE },
     306                 :            :     { "com.sun.star.text.Endnote",                            SW_SERVICE_TYPE_ENDNOTE },
     307                 :            :     { "com.sun.star.text.DocumentIndexMark",                  SW_SERVICE_TYPE_INDEXMARK },
     308                 :            :     { "com.sun.star.text.DocumentIndex",                      SW_SERVICE_TYPE_INDEX },
     309                 :            :     { "com.sun.star.text.ReferenceMark",                      SW_SERVICE_REFERENCE_MARK },
     310                 :            :     { "com.sun.star.style.CharacterStyle",                    SW_SERVICE_STYLE_CHARACTER_STYLE },
     311                 :            :     { "com.sun.star.style.ParagraphStyle",                    SW_SERVICE_STYLE_PARAGRAPH_STYLE },
     312                 :            :     { "com.sun.star.style.FrameStyle",                        SW_SERVICE_STYLE_FRAME_STYLE },
     313                 :            :     { "com.sun.star.style.PageStyle",                         SW_SERVICE_STYLE_PAGE_STYLE },
     314                 :            :     { "com.sun.star.style.NumberingStyle",                    SW_SERVICE_STYLE_NUMBERING_STYLE },
     315                 :            :     { "com.sun.star.text.ContentIndexMark",                   SW_SERVICE_CONTENT_INDEX_MARK },
     316                 :            :     { "com.sun.star.text.ContentIndex",                       SW_SERVICE_CONTENT_INDEX },
     317                 :            :     { "com.sun.star.text.UserIndexMark",                      SW_SERVICE_USER_INDEX_MARK },
     318                 :            :     { "com.sun.star.text.UserIndex",                          SW_SERVICE_USER_INDEX },
     319                 :            :     { "com.sun.star.text.TextSection",                        SW_SERVICE_TEXT_SECTION },
     320                 :            :     { "com.sun.star.text.TextField.DateTime",                 SW_SERVICE_FIELDTYPE_DATETIME },
     321                 :            :     { "com.sun.star.text.TextField.User",                     SW_SERVICE_FIELDTYPE_USER },
     322                 :            :     { "com.sun.star.text.TextField.SetExpression",            SW_SERVICE_FIELDTYPE_SET_EXP },
     323                 :            :     { "com.sun.star.text.TextField.GetExpression",            SW_SERVICE_FIELDTYPE_GET_EXP },
     324                 :            :     { "com.sun.star.text.TextField.FileName",                 SW_SERVICE_FIELDTYPE_FILE_NAME },
     325                 :            :     { "com.sun.star.text.TextField.PageNumber",               SW_SERVICE_FIELDTYPE_PAGE_NUM },
     326                 :            :     { "com.sun.star.text.TextField.Author",                   SW_SERVICE_FIELDTYPE_AUTHOR },
     327                 :            :     { "com.sun.star.text.TextField.Chapter",                  SW_SERVICE_FIELDTYPE_CHAPTER },
     328                 :            :     { "",                                                     SW_SERVICE_FIELDTYPE_DUMMY_0 },
     329                 :            :     { "com.sun.star.text.TextField.GetReference",             SW_SERVICE_FIELDTYPE_GET_REFERENCE },
     330                 :            :     { "com.sun.star.text.TextField.ConditionalText",          SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT },
     331                 :            :     { "com.sun.star.text.TextField.Annotation",               SW_SERVICE_FIELDTYPE_ANNOTATION },
     332                 :            :     { "com.sun.star.text.TextField.Input",                    SW_SERVICE_FIELDTYPE_INPUT },
     333                 :            :     { "com.sun.star.text.TextField.Macro",                    SW_SERVICE_FIELDTYPE_MACRO },
     334                 :            :     { "com.sun.star.text.TextField.DDE",                      SW_SERVICE_FIELDTYPE_DDE },
     335                 :            :     { "com.sun.star.text.TextField.HiddenParagraph",          SW_SERVICE_FIELDTYPE_HIDDEN_PARA },
     336                 :            :     { "" /*com.sun.star.text.TextField.DocumentInfo"*/,       SW_SERVICE_FIELDTYPE_DOC_INFO },
     337                 :            :     { "com.sun.star.text.TextField.TemplateName",             SW_SERVICE_FIELDTYPE_TEMPLATE_NAME },
     338                 :            :     { "com.sun.star.text.TextField.ExtendedUser",             SW_SERVICE_FIELDTYPE_USER_EXT },
     339                 :            :     { "com.sun.star.text.TextField.ReferencePageSet",         SW_SERVICE_FIELDTYPE_REF_PAGE_SET },
     340                 :            :     { "com.sun.star.text.TextField.ReferencePageGet",         SW_SERVICE_FIELDTYPE_REF_PAGE_GET },
     341                 :            :     { "com.sun.star.text.TextField.JumpEdit",                 SW_SERVICE_FIELDTYPE_JUMP_EDIT },
     342                 :            :     { "com.sun.star.text.TextField.Script",                   SW_SERVICE_FIELDTYPE_SCRIPT },
     343                 :            :     { "com.sun.star.text.TextField.DatabaseNextSet",          SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET },
     344                 :            :     { "com.sun.star.text.TextField.DatabaseNumberOfSet",      SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET },
     345                 :            :     { "com.sun.star.text.TextField.DatabaseSetNumber",        SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM },
     346                 :            :     { "com.sun.star.text.TextField.Database",                 SW_SERVICE_FIELDTYPE_DATABASE },
     347                 :            :     { "com.sun.star.text.TextField.DatabaseName",             SW_SERVICE_FIELDTYPE_DATABASE_NAME },
     348                 :            :     { "com.sun.star.text.TextField.TableFormula",             SW_SERVICE_FIELDTYPE_TABLE_FORMULA },
     349                 :            :     { "com.sun.star.text.TextField.PageCount",                SW_SERVICE_FIELDTYPE_PAGE_COUNT },
     350                 :            :     { "com.sun.star.text.TextField.ParagraphCount",           SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT },
     351                 :            :     { "com.sun.star.text.TextField.WordCount",                SW_SERVICE_FIELDTYPE_WORD_COUNT },
     352                 :            :     { "com.sun.star.text.TextField.CharacterCount",           SW_SERVICE_FIELDTYPE_CHARACTER_COUNT },
     353                 :            :     { "com.sun.star.text.TextField.TableCount",               SW_SERVICE_FIELDTYPE_TABLE_COUNT },
     354                 :            :     { "com.sun.star.text.TextField.GraphicObjectCount",       SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT },
     355                 :            :     { "com.sun.star.text.TextField.EmbeddedObjectCount",      SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT },
     356                 :            :     { "com.sun.star.text.TextField.DocInfo.ChangeAuthor",     SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR },
     357                 :            :     { "com.sun.star.text.TextField.DocInfo.ChangeDateTime",   SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME },
     358                 :            :     { "com.sun.star.text.TextField.DocInfo.EditTime",         SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME },
     359                 :            :     { "com.sun.star.text.TextField.DocInfo.Description",      SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION },
     360                 :            :     { "com.sun.star.text.TextField.DocInfo.CreateAuthor",     SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR },
     361                 :            :     { "com.sun.star.text.TextField.DocInfo.CreateDateTime",   SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME },
     362                 :            :     { "",                                                     SW_SERVICE_FIELDTYPE_DUMMY_0 },
     363                 :            :     { "",                                                     SW_SERVICE_FIELDTYPE_DUMMY_1 },
     364                 :            :     { "",                                                     SW_SERVICE_FIELDTYPE_DUMMY_2 },
     365                 :            :     { "",                                                     SW_SERVICE_FIELDTYPE_DUMMY_3 },
     366                 :            :     { "com.sun.star.text.TextField.DocInfo.Custom",           SW_SERVICE_FIELDTYPE_DOCINFO_CUSTOM },
     367                 :            :     { "com.sun.star.text.TextField.DocInfo.PrintAuthor",      SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR },
     368                 :            :     { "com.sun.star.text.TextField.DocInfo.PrintDateTime",    SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME },
     369                 :            :     { "com.sun.star.text.TextField.DocInfo.KeyWords",         SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS },
     370                 :            :     { "com.sun.star.text.TextField.DocInfo.Subject",          SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT },
     371                 :            :     { "com.sun.star.text.TextField.DocInfo.Title",            SW_SERVICE_FIELDTYPE_DOCINFO_TITLE },
     372                 :            :     { "com.sun.star.text.TextField.DocInfo.Revision",         SW_SERVICE_FIELDTYPE_DOCINFO_REVISION },
     373                 :            :     { "com.sun.star.text.TextField.Bibliography",             SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY },
     374                 :            :     { "com.sun.star.text.TextField.CombinedCharacters",       SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS },
     375                 :            :     { "com.sun.star.text.TextField.DropDown",                 SW_SERVICE_FIELDTYPE_DROPDOWN },
     376                 :            :     { "com.sun.star.text.textfield.MetadataField",            SW_SERVICE_FIELDTYPE_METAFIELD },
     377                 :            :     { "",                                                     SW_SERVICE_FIELDTYPE_DUMMY_4 },
     378                 :            :     { "",                                                     SW_SERVICE_FIELDTYPE_DUMMY_5 },
     379                 :            :     { "",                                                     SW_SERVICE_FIELDTYPE_DUMMY_6 },
     380                 :            :     { "",                                                     SW_SERVICE_FIELDTYPE_DUMMY_7 },
     381                 :            :     { "com.sun.star.text.FieldMaster.User",                   SW_SERVICE_FIELDMASTER_USER },
     382                 :            :     { "com.sun.star.text.FieldMaster.DDE",                    SW_SERVICE_FIELDMASTER_DDE },
     383                 :            :     { "com.sun.star.text.FieldMaster.SetExpression",          SW_SERVICE_FIELDMASTER_SET_EXP },
     384                 :            :     { "com.sun.star.text.FieldMaster.Database",               SW_SERVICE_FIELDMASTER_DATABASE },
     385                 :            :     { "com.sun.star.text.FieldMaster.Bibliography",           SW_SERVICE_FIELDMASTER_BIBLIOGRAPHY },
     386                 :            :     { "",                                                     SW_SERVICE_FIELDMASTER_DUMMY2 },
     387                 :            :     { "",                                                     SW_SERVICE_FIELDMASTER_DUMMY3 },
     388                 :            :     { "",                                                     SW_SERVICE_FIELDMASTER_DUMMY4 },
     389                 :            :     { "",                                                     SW_SERVICE_FIELDMASTER_DUMMY5 },
     390                 :            :     { "com.sun.star.text.IllustrationsIndex",                 SW_SERVICE_INDEX_ILLUSTRATIONS },
     391                 :            :     { "com.sun.star.text.ObjectIndex",                        SW_SERVICE_INDEX_OBJECTS },
     392                 :            :     { "com.sun.star.text.TableIndex",                         SW_SERVICE_INDEX_TABLES },
     393                 :            :     { "com.sun.star.text.Bibliography",                       SW_SERVICE_INDEX_BIBLIOGRAPHY },
     394                 :            :     { "com.sun.star.text.Paragraph",                          SW_SERVICE_PARAGRAPH },
     395                 :            :     { "com.sun.star.text.TextField.InputUser",                SW_SERVICE_FIELDTYPE_INPUT_USER },
     396                 :            :     { "com.sun.star.text.TextField.HiddenText",               SW_SERVICE_FIELDTYPE_HIDDEN_TEXT },
     397                 :            :     { "com.sun.star.style.ConditionalParagraphStyle",         SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE },
     398                 :            :     { "com.sun.star.text.NumberingRules",                     SW_SERVICE_NUMBERING_RULES },
     399                 :            :     { "com.sun.star.text.TextColumns",                        SW_SERVICE_TEXT_COLUMNS },
     400                 :            :     { "com.sun.star.text.IndexHeaderSection",                 SW_SERVICE_INDEX_HEADER_SECTION },
     401                 :            :     { "com.sun.star.text.Defaults",                           SW_SERVICE_DEFAULTS },
     402                 :            :     { "com.sun.star.image.ImageMapRectangleObject",           SW_SERVICE_IMAP_RECTANGLE },
     403                 :            :     { "com.sun.star.image.ImageMapCircleObject",              SW_SERVICE_IMAP_CIRCLE },
     404                 :            :     { "com.sun.star.image.ImageMapPolygonObject",             SW_SERVICE_IMAP_POLYGON },
     405                 :            :     { "com.sun.star.text.TextGraphicObject",                  SW_SERVICE_TYPE_TEXT_GRAPHIC },
     406                 :            :     { "com.sun.star.chart2.data.DataProvider",                SW_SERVICE_CHART2_DATA_PROVIDER },
     407                 :            :     { "com.sun.star.text.Fieldmark",                          SW_SERVICE_TYPE_FIELDMARK },
     408                 :            :     { "com.sun.star.text.FormFieldmark",                      SW_SERVICE_TYPE_FORMFIELDMARK },
     409                 :            :     { "com.sun.star.text.InContentMetadata",                  SW_SERVICE_TYPE_META },
     410                 :            :     { "ooo.vba.VBAObjectModuleObjectProvider",                SW_SERVICE_VBAOBJECTPROVIDER },
     411                 :            :     { "ooo.vba.VBACodeNameProvider",                          SW_SERVICE_VBACODENAMEPROVIDER },
     412                 :            :     { "ooo.vba.VBAProjectNameProvider",                       SW_SERVICE_VBAPROJECTNAMEPROVIDER },
     413                 :            :     { "ooo.vba.VBAGlobals",                       SW_SERVICE_VBAGLOBALS },
     414                 :            : 
     415                 :            :     // case-correct versions of the service names (see #i67811)
     416                 :            :     { CSS_TEXT_TEXTFIELD_DATE_TIME,                   SW_SERVICE_FIELDTYPE_DATETIME },
     417                 :            :     { CSS_TEXT_TEXTFIELD_USER,                        SW_SERVICE_FIELDTYPE_USER },
     418                 :            :     { CSS_TEXT_TEXTFIELD_SET_EXPRESSION,              SW_SERVICE_FIELDTYPE_SET_EXP },
     419                 :            :     { CSS_TEXT_TEXTFIELD_GET_EXPRESSION,              SW_SERVICE_FIELDTYPE_GET_EXP },
     420                 :            :     { CSS_TEXT_TEXTFIELD_FILE_NAME,                   SW_SERVICE_FIELDTYPE_FILE_NAME },
     421                 :            :     { CSS_TEXT_TEXTFIELD_PAGE_NUMBER,                 SW_SERVICE_FIELDTYPE_PAGE_NUM },
     422                 :            :     { CSS_TEXT_TEXTFIELD_AUTHOR,                      SW_SERVICE_FIELDTYPE_AUTHOR },
     423                 :            :     { CSS_TEXT_TEXTFIELD_CHAPTER,                     SW_SERVICE_FIELDTYPE_CHAPTER },
     424                 :            :     { CSS_TEXT_TEXTFIELD_GET_REFERENCE,               SW_SERVICE_FIELDTYPE_GET_REFERENCE },
     425                 :            :     { CSS_TEXT_TEXTFIELD_CONDITIONAL_TEXT,            SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT },
     426                 :            :     { CSS_TEXT_TEXTFIELD_ANNOTATION,                  SW_SERVICE_FIELDTYPE_ANNOTATION },
     427                 :            :     { CSS_TEXT_TEXTFIELD_INPUT,                       SW_SERVICE_FIELDTYPE_INPUT },
     428                 :            :     { CSS_TEXT_TEXTFIELD_MACRO,                       SW_SERVICE_FIELDTYPE_MACRO },
     429                 :            :     { CSS_TEXT_TEXTFIELD_DDE,                         SW_SERVICE_FIELDTYPE_DDE },
     430                 :            :     { CSS_TEXT_TEXTFIELD_HIDDEN_PARAGRAPH,            SW_SERVICE_FIELDTYPE_HIDDEN_PARA },
     431                 :            :     { CSS_TEXT_TEXTFIELD_TEMPLATE_NAME,               SW_SERVICE_FIELDTYPE_TEMPLATE_NAME },
     432                 :            :     { CSS_TEXT_TEXTFIELD_EXTENDED_USER,               SW_SERVICE_FIELDTYPE_USER_EXT },
     433                 :            :     { CSS_TEXT_TEXTFIELD_REFERENCE_PAGE_SET,          SW_SERVICE_FIELDTYPE_REF_PAGE_SET },
     434                 :            :     { CSS_TEXT_TEXTFIELD_REFERENCE_PAGE_GET,          SW_SERVICE_FIELDTYPE_REF_PAGE_GET },
     435                 :            :     { CSS_TEXT_TEXTFIELD_JUMP_EDIT,                   SW_SERVICE_FIELDTYPE_JUMP_EDIT },
     436                 :            :     { CSS_TEXT_TEXTFIELD_SCRIPT,                      SW_SERVICE_FIELDTYPE_SCRIPT },
     437                 :            :     { CSS_TEXT_TEXTFIELD_DATABASE_NEXT_SET,           SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET },
     438                 :            :     { CSS_TEXT_TEXTFIELD_DATABASE_NUMBER_OF_SET,      SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET },
     439                 :            :     { CSS_TEXT_TEXTFIELD_DATABASE_SET_NUMBER,         SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM },
     440                 :            :     { CSS_TEXT_TEXTFIELD_DATABASE,                    SW_SERVICE_FIELDTYPE_DATABASE },
     441                 :            :     { CSS_TEXT_TEXTFIELD_DATABASE_NAME,               SW_SERVICE_FIELDTYPE_DATABASE_NAME },
     442                 :            :     { CSS_TEXT_TEXTFIELD_TABLE_FORMULA,               SW_SERVICE_FIELDTYPE_TABLE_FORMULA },
     443                 :            :     { CSS_TEXT_TEXTFIELD_PAGE_COUNT,                  SW_SERVICE_FIELDTYPE_PAGE_COUNT },
     444                 :            :     { CSS_TEXT_TEXTFIELD_PARAGRAPH_COUNT,             SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT },
     445                 :            :     { CSS_TEXT_TEXTFIELD_WORD_COUNT,                  SW_SERVICE_FIELDTYPE_WORD_COUNT },
     446                 :            :     { CSS_TEXT_TEXTFIELD_CHARACTER_COUNT,             SW_SERVICE_FIELDTYPE_CHARACTER_COUNT },
     447                 :            :     { CSS_TEXT_TEXTFIELD_TABLE_COUNT,                 SW_SERVICE_FIELDTYPE_TABLE_COUNT },
     448                 :            :     { CSS_TEXT_TEXTFIELD_GRAPHIC_OBJECT_COUNT,        SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT },
     449                 :            :     { CSS_TEXT_TEXTFIELD_EMBEDDED_OBJECT_COUNT,       SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT },
     450                 :            :     { CSS_TEXT_TEXTFIELD_DOCINFO_CHANGE_AUTHOR,       SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR },
     451                 :            :     { CSS_TEXT_TEXTFIELD_DOCINFO_CHANGE_DATE_TIME,    SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME },
     452                 :            :     { CSS_TEXT_TEXTFIELD_DOCINFO_EDIT_TIME,           SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME },
     453                 :            :     { CSS_TEXT_TEXTFIELD_DOCINFO_DESCRIPTION,         SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION },
     454                 :            :     { CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_AUTHOR,       SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR },
     455                 :            :     { CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_DATE_TIME,    SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME },
     456                 :            :     { CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_AUTHOR,        SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR },
     457                 :            :     { CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_DATE_TIME,     SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME },
     458                 :            :     { CSS_TEXT_TEXTFIELD_DOCINFO_KEY_WORDS,           SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS },
     459                 :            :     { CSS_TEXT_TEXTFIELD_DOCINFO_SUBJECT,             SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT },
     460                 :            :     { CSS_TEXT_TEXTFIELD_DOCINFO_TITLE,               SW_SERVICE_FIELDTYPE_DOCINFO_TITLE },
     461                 :            :     { CSS_TEXT_TEXTFIELD_DOCINFO_REVISION,            SW_SERVICE_FIELDTYPE_DOCINFO_REVISION },
     462                 :            :     { CSS_TEXT_TEXTFIELD_DOCINFO_CUSTOM,              SW_SERVICE_FIELDTYPE_DOCINFO_CUSTOM },
     463                 :            :     { CSS_TEXT_TEXTFIELD_BIBLIOGRAPHY,                SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY },
     464                 :            :     { CSS_TEXT_TEXTFIELD_COMBINED_CHARACTERS,         SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS },
     465                 :            :     { CSS_TEXT_TEXTFIELD_DROP_DOWN,                   SW_SERVICE_FIELDTYPE_DROPDOWN },
     466                 :            :     { CSS_TEXT_TEXTFIELD_INPUT_USER,                  SW_SERVICE_FIELDTYPE_INPUT_USER },
     467                 :            :     { CSS_TEXT_TEXTFIELD_HIDDEN_TEXT,                 SW_SERVICE_FIELDTYPE_HIDDEN_TEXT },
     468                 :            :     { CSS_TEXT_FIELDMASTER_USER,                      SW_SERVICE_FIELDMASTER_USER },
     469                 :            :     { CSS_TEXT_FIELDMASTER_DDE,                       SW_SERVICE_FIELDMASTER_DDE },
     470                 :            :     { CSS_TEXT_FIELDMASTER_SET_EXPRESSION,            SW_SERVICE_FIELDMASTER_SET_EXP },
     471                 :            :     { CSS_TEXT_FIELDMASTER_DATABASE,                  SW_SERVICE_FIELDMASTER_DATABASE },
     472                 :            :     { CSS_TEXT_FIELDMASTER_BIBLIOGRAPHY,              SW_SERVICE_FIELDMASTER_BIBLIOGRAPHY }
     473                 :            : };
     474                 :            : 
     475                 :          6 : const SvEventDescription* lcl_GetSupportedMacroItems()
     476                 :            : {
     477                 :            :     static const SvEventDescription aMacroDescriptionsImpl[] =
     478                 :            :     {
     479                 :            :         { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" },
     480                 :            :         { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" },
     481                 :            :         { 0, NULL }
     482                 :            :     };
     483                 :            : 
     484                 :          6 :     return aMacroDescriptionsImpl;
     485                 :            : }
     486                 :            : 
     487                 :            : /******************************************************************
     488                 :            :  * SwXServiceProvider
     489                 :            :  ******************************************************************/
     490                 :        117 : OUString    SwXServiceProvider::GetProviderName(sal_uInt16 nObjectType)
     491                 :            : {
     492         [ +  - ]:        117 :     SolarMutexGuard aGuard;
     493                 :        117 :     OUString sRet;
     494                 :        117 :     sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
     495         [ +  - ]:        117 :     if(nObjectType < nEntries)
     496                 :        117 :         sRet = rtl::OUString::createFromAscii(aProvNamesId[nObjectType].pName);
     497         [ +  - ]:        117 :     return sRet;
     498                 :            : }
     499                 :            : 
     500                 :         15 : uno::Sequence<OUString>     SwXServiceProvider::GetAllServiceNames()
     501                 :            : {
     502                 :         15 :     sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
     503                 :         15 :     uno::Sequence<OUString> aRet(nEntries);
     504         [ +  - ]:         15 :     OUString* pArray = aRet.getArray();
     505                 :         15 :     sal_uInt16 n = 0;
     506         [ +  + ]:       2580 :     for(sal_uInt16 i = 0; i < nEntries; i++)
     507                 :            :     {
     508         [ +  - ]:       2565 :         String sProv(rtl::OUString::createFromAscii(aProvNamesId[i].pName));
     509         [ +  + ]:       2565 :         if(sProv.Len())
     510                 :            :         {
     511         [ +  - ]:       2355 :             pArray[n] = sProv;
     512                 :       2355 :             n++;
     513                 :            :         }
     514         [ +  - ]:       2565 :     }
     515         [ +  - ]:         15 :     aRet.realloc(n);
     516                 :         15 :     return aRet;
     517                 :            : 
     518                 :            : }
     519                 :            : 
     520                 :       9740 : sal_uInt16  SwXServiceProvider::GetProviderType(const OUString& rServiceName)
     521                 :            : {
     522                 :       9740 :     sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
     523         [ +  + ]:     600702 :     for(sal_uInt16 i = 0; i < nEntries; i++ )
     524                 :            :     {
     525         [ +  + ]:     598512 :         if( COMPARE_EQUAL == rServiceName.compareToAscii(aProvNamesId[i].pName))
     526                 :       7550 :             return aProvNamesId[i].nType;
     527                 :            :     }
     528                 :       9740 :     return SW_SERVICE_INVALID;
     529                 :            : }
     530                 :            : 
     531                 :       7550 : uno::Reference< uno::XInterface >   SwXServiceProvider::MakeInstance(sal_uInt16 nObjectType, SwDoc* pDoc)
     532                 :            : {
     533         [ +  - ]:       7550 :     SolarMutexGuard aGuard;
     534                 :       7550 :     uno::Reference< uno::XInterface >  xRet;
     535   [ +  +  +  +  :       7550 :     switch(nObjectType)
          +  -  +  -  +  
          +  -  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  -  -  
             -  +  +  - ]
     536                 :            :     {
     537                 :            :         case  SW_SERVICE_TYPE_TEXTTABLE:
     538                 :            :         {
     539         [ +  - ]:         91 :             SwXTextTable* pTextTable = new SwXTextTable();
     540         [ +  - ]:         91 :             xRet =  (cppu::OWeakObject*)pTextTable;
     541                 :            :         }
     542                 :         91 :         break;
     543                 :            :         case  SW_SERVICE_TYPE_TEXTFRAME:
     544                 :            :         {
     545 [ +  - ][ +  - ]:        116 :             SwXTextFrame* pTextFrame = new SwXTextFrame( pDoc );
     546 [ +  - ][ +  - ]:        116 :             xRet =  (cppu::OWeakObject*)(SwXFrame*)pTextFrame;
     547                 :            :         }
     548                 :        116 :         break;
     549                 :            :         case  SW_SERVICE_TYPE_GRAPHIC  :
     550                 :            :         case  SW_SERVICE_TYPE_TEXT_GRAPHIC /* #i47503# */ :
     551                 :            :         {
     552 [ +  - ][ +  - ]:         41 :             SwXTextGraphicObject* pGraphic = new SwXTextGraphicObject( pDoc );
     553 [ +  - ][ +  - ]:         41 :             xRet =  (cppu::OWeakObject*)(SwXFrame*)pGraphic;
     554                 :            : 
     555                 :            :         }
     556                 :         41 :         break;
     557                 :            :         case  SW_SERVICE_TYPE_OLE      :
     558                 :            :         {
     559 [ +  - ][ +  - ]:        432 :             SwXTextEmbeddedObject* pOle = new SwXTextEmbeddedObject( pDoc );
     560 [ +  - ][ +  - ]:        432 :             xRet =  (cppu::OWeakObject*)(SwXFrame*)pOle;
     561                 :            :         }
     562                 :        432 :         break;
     563                 :            :         case  SW_SERVICE_TYPE_BOOKMARK :
     564                 :            :         {
     565         [ +  - ]:       4012 :             SwXBookmark* pBookmark = new SwXBookmark;
     566         [ +  - ]:       4012 :             xRet =  (cppu::OWeakObject*)pBookmark;
     567                 :            :         }
     568                 :       4012 :         break;
     569                 :            :         case  SW_SERVICE_TYPE_FIELDMARK :
     570                 :            :         {
     571         [ #  # ]:          0 :             SwXFieldmark* pFieldmark = new SwXFieldmark(false);
     572         [ #  # ]:          0 :             xRet =  (cppu::OWeakObject*)pFieldmark;
     573                 :            :         }
     574                 :          0 :         break;
     575                 :            :         case  SW_SERVICE_TYPE_FORMFIELDMARK :
     576                 :            :         {
     577         [ +  - ]:          3 :             SwXFieldmark* pFieldmark = new SwXFieldmark(true);
     578         [ +  - ]:          3 :             xRet =  (cppu::OWeakObject*)pFieldmark;
     579                 :            :         }
     580                 :          3 :         break;
     581                 :            :         case  SW_SERVICE_VBAOBJECTPROVIDER :
     582                 :            : #ifndef DISABLE_SCRIPTING
     583                 :            :         {
     584         [ #  # ]:          0 :             SwVbaObjectForCodeNameProvider* pObjProv = new SwVbaObjectForCodeNameProvider( pDoc->GetDocShell() );
     585         [ #  # ]:          0 :             xRet =  (cppu::OWeakObject*)pObjProv;
     586                 :            :         }
     587                 :            : #endif
     588                 :          0 :         break;
     589                 :            :         case  SW_SERVICE_VBACODENAMEPROVIDER :
     590                 :            : #ifndef DISABLE_SCRIPTING
     591                 :            :         {
     592 [ +  - ][ +  - ]:        468 :             if ( pDoc->GetDocShell()  && ooo::vba::isAlienWordDoc( *pDoc->GetDocShell() ) )
         [ -  + ][ -  + ]
     593                 :            :             {
     594         [ #  # ]:          0 :                 SwVbaCodeNameProvider* pObjProv = new SwVbaCodeNameProvider( pDoc->GetDocShell() );
     595         [ #  # ]:          0 :                 xRet =  (cppu::OWeakObject*)pObjProv;
     596                 :            :             }
     597                 :            :         }
     598                 :            : #endif
     599                 :        468 :         break;
     600                 :            :         case  SW_SERVICE_VBAPROJECTNAMEPROVIDER :
     601                 :            : #ifndef DISABLE_SCRIPTING
     602                 :            :         {
     603         [ +  - ]:        102 :                         uno::Reference< container::XNameContainer > xProjProv = pDoc->GetVBATemplateToProjectCache();
     604 [ +  - ][ +  - ]:        102 :                         if ( !xProjProv.is() && pDoc->GetDocShell()  && ooo::vba::isAlienWordDoc( *pDoc->GetDocShell() ) )
         [ +  - ][ +  + ]
                 [ +  + ]
     605                 :            :                         {
     606 [ +  - ][ +  - ]:         36 :                 xProjProv = new SwVbaProjectNameProvider( pDoc->GetDocShell() );
                 [ +  - ]
     607         [ +  - ]:         36 :                             pDoc->SetVBATemplateToProjectCache( xProjProv );
     608                 :            :                         }
     609                 :            :             //xRet =  (cppu::OWeakObject*)xProjProv;
     610         [ +  - ]:        102 :             xRet = xProjProv;
     611                 :            :         }
     612                 :            : #endif
     613                 :        102 :         break;
     614                 :            :         case  SW_SERVICE_VBAGLOBALS :
     615                 :            : #ifndef DISABLE_SCRIPTING
     616                 :            :         {
     617         [ #  # ]:          0 :             if ( pDoc )
     618                 :            :             {
     619                 :          0 :                 uno::Any aGlobs;
     620 [ #  # ][ #  # ]:          0 :                 if ( !pDoc->GetDocShell()->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aGlobs ) )
                 [ #  # ]
     621                 :            :                 {
     622         [ #  # ]:          0 :                     uno::Sequence< uno::Any > aArgs(1);
     623 [ #  # ][ #  # ]:          0 :                     aArgs[ 0 ] <<= pDoc->GetDocShell()->GetModel();
                 [ #  # ]
     624 [ #  # ][ #  # ]:          0 :                     aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Globals")), aArgs );
         [ #  # ][ #  # ]
                 [ #  # ]
     625 [ #  # ][ #  # ]:          0 :                     pDoc->GetDocShell()->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
                 [ #  # ]
     626                 :            :                 }
     627         [ #  # ]:          0 :                 aGlobs >>= xRet;
     628                 :            :             }
     629                 :            :         }
     630                 :            : #endif
     631                 :          0 :         break;
     632                 :            : 
     633                 :            :         case  SW_SERVICE_TYPE_FOOTNOTE :
     634 [ +  - ][ +  - ]:         52 :             xRet =  (cppu::OWeakObject*)new SwXFootnote(sal_False);
     635                 :         52 :         break;
     636                 :            :         case  SW_SERVICE_TYPE_ENDNOTE  :
     637 [ +  - ][ +  - ]:          8 :             xRet =  (cppu::OWeakObject*)new SwXFootnote(sal_True);
     638                 :          8 :         break;
     639                 :            :         case  SW_SERVICE_CONTENT_INDEX_MARK :
     640                 :            :         case  SW_SERVICE_USER_INDEX_MARK    :
     641                 :            :         case  SW_SERVICE_TYPE_INDEXMARK:
     642                 :            :         {
     643                 :         70 :             TOXTypes eType = TOX_INDEX;
     644         [ -  + ]:         70 :             if(SW_SERVICE_CONTENT_INDEX_MARK== nObjectType)
     645                 :          0 :                 eType = TOX_CONTENT;
     646         [ -  + ]:         70 :             else if(SW_SERVICE_USER_INDEX_MARK == nObjectType)
     647                 :          0 :                 eType = TOX_USER;
     648 [ +  - ][ +  - ]:         70 :             xRet =  (cppu::OWeakObject*)new SwXDocumentIndexMark(eType);
     649                 :            :         }
     650                 :         70 :         break;
     651                 :            :         case  SW_SERVICE_CONTENT_INDEX      :
     652                 :            :         case  SW_SERVICE_USER_INDEX         :
     653                 :            :         case  SW_SERVICE_TYPE_INDEX    :
     654                 :            :         case SW_SERVICE_INDEX_ILLUSTRATIONS:
     655                 :            :         case SW_SERVICE_INDEX_OBJECTS      :
     656                 :            :         case SW_SERVICE_INDEX_TABLES:
     657                 :            :         case SW_SERVICE_INDEX_BIBLIOGRAPHY :
     658                 :            :         {
     659                 :         38 :             TOXTypes eType = TOX_INDEX;
     660         [ +  + ]:         38 :             if(SW_SERVICE_CONTENT_INDEX == nObjectType)
     661                 :          6 :                 eType = TOX_CONTENT;
     662         [ +  + ]:         32 :             else if(SW_SERVICE_USER_INDEX == nObjectType)
     663                 :          4 :                 eType = TOX_USER;
     664         [ +  + ]:         28 :             else if(SW_SERVICE_INDEX_ILLUSTRATIONS == nObjectType)
     665                 :            :             {
     666                 :          4 :                 eType = TOX_ILLUSTRATIONS;
     667                 :            :             }
     668         [ +  + ]:         24 :             else if(SW_SERVICE_INDEX_OBJECTS       == nObjectType)
     669                 :            :             {
     670                 :          4 :                 eType = TOX_OBJECTS;
     671                 :            :             }
     672         [ +  + ]:         20 :             else if(SW_SERVICE_INDEX_BIBLIOGRAPHY  == nObjectType)
     673                 :            :             {
     674                 :          4 :                 eType = TOX_AUTHORITIES;
     675                 :            :             }
     676         [ +  + ]:         16 :             else if(SW_SERVICE_INDEX_TABLES == nObjectType)
     677                 :            :             {
     678                 :          4 :                 eType = TOX_TABLES;
     679                 :            :             }
     680 [ +  - ][ +  - ]:         38 :             xRet =  (cppu::OWeakObject*)new SwXDocumentIndex(eType, *pDoc);
     681                 :            :         }
     682                 :         38 :         break;
     683                 :            :         case SW_SERVICE_INDEX_HEADER_SECTION :
     684                 :            :         case SW_SERVICE_TEXT_SECTION :
     685                 :            :             xRet = SwXTextSection::CreateXTextSection(0,
     686 [ +  - ][ +  - ]:         92 :                     (SW_SERVICE_INDEX_HEADER_SECTION == nObjectType));
     687                 :            : 
     688                 :         92 :         break;
     689                 :            :         case SW_SERVICE_REFERENCE_MARK :
     690 [ +  - ][ +  - ]:         76 :             xRet =  (cppu::OWeakObject*)new SwXReferenceMark(0, 0);
     691                 :         76 :         break;
     692                 :            :         case SW_SERVICE_STYLE_CHARACTER_STYLE:
     693                 :            :         case SW_SERVICE_STYLE_PARAGRAPH_STYLE:
     694                 :            :         case SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE:
     695                 :            :         case SW_SERVICE_STYLE_FRAME_STYLE:
     696                 :            :         case SW_SERVICE_STYLE_PAGE_STYLE:
     697                 :            :         case SW_SERVICE_STYLE_NUMBERING_STYLE:
     698                 :            :         {
     699                 :        713 :             SfxStyleFamily  eFamily = SFX_STYLE_FAMILY_CHAR;
     700   [ +  -  +  +  :        713 :             switch(nObjectType)
                      + ]
     701                 :            :             {
     702                 :            :                 case SW_SERVICE_STYLE_PARAGRAPH_STYLE:
     703                 :            :                 case SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE:
     704                 :        179 :                     eFamily = SFX_STYLE_FAMILY_PARA;
     705                 :        179 :                 break;
     706                 :            :                 case SW_SERVICE_STYLE_FRAME_STYLE:
     707                 :          0 :                     eFamily = SFX_STYLE_FAMILY_FRAME;
     708                 :          0 :                 break;
     709                 :            :                 case SW_SERVICE_STYLE_PAGE_STYLE:
     710                 :         58 :                     eFamily = SFX_STYLE_FAMILY_PAGE;
     711                 :         58 :                 break;
     712                 :            :                 case SW_SERVICE_STYLE_NUMBERING_STYLE:
     713                 :        108 :                     eFamily = SFX_STYLE_FAMILY_PSEUDO;
     714                 :        108 :                 break;
     715                 :            :             }
     716                 :            :             SwXStyle* pNewStyle = SFX_STYLE_FAMILY_PAGE == eFamily ?
     717         [ +  - ]:         58 :                 new SwXPageStyle(pDoc->GetDocShell()) :
     718                 :            :                     eFamily == SFX_STYLE_FAMILY_FRAME ?
     719         [ #  # ]:          0 :                         new SwXFrameStyle ( pDoc ):
     720 [ +  + ][ -  + ]:        771 :                             new SwXStyle( pDoc, eFamily, nObjectType == SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE);
                 [ +  - ]
     721         [ +  - ]:        713 :             xRet = (cppu::OWeakObject*)pNewStyle;
     722                 :            :         }
     723                 :        713 :         break;
     724                 :            : //      SW_SERVICE_DUMMY_5
     725                 :            : //      SW_SERVICE_DUMMY_6
     726                 :            : //      SW_SERVICE_DUMMY_7
     727                 :            : //      SW_SERVICE_DUMMY_8
     728                 :            : //      SW_SERVICE_DUMMY_9
     729                 :            :         case SW_SERVICE_FIELDTYPE_DATETIME:
     730                 :            :         case SW_SERVICE_FIELDTYPE_USER:
     731                 :            :         case SW_SERVICE_FIELDTYPE_SET_EXP:
     732                 :            :         case SW_SERVICE_FIELDTYPE_GET_EXP:
     733                 :            :         case SW_SERVICE_FIELDTYPE_FILE_NAME:
     734                 :            :         case SW_SERVICE_FIELDTYPE_PAGE_NUM:
     735                 :            :         case SW_SERVICE_FIELDTYPE_AUTHOR:
     736                 :            :         case SW_SERVICE_FIELDTYPE_CHAPTER:
     737                 :            :         case SW_SERVICE_FIELDTYPE_GET_REFERENCE:
     738                 :            :         case SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT:
     739                 :            :         case SW_SERVICE_FIELDTYPE_INPUT:
     740                 :            :         case SW_SERVICE_FIELDTYPE_MACRO:
     741                 :            :         case SW_SERVICE_FIELDTYPE_DDE:
     742                 :            :         case SW_SERVICE_FIELDTYPE_HIDDEN_PARA:
     743                 :            :         case SW_SERVICE_FIELDTYPE_DOC_INFO:
     744                 :            :         case SW_SERVICE_FIELDTYPE_TEMPLATE_NAME:
     745                 :            :         case SW_SERVICE_FIELDTYPE_USER_EXT:
     746                 :            :         case SW_SERVICE_FIELDTYPE_REF_PAGE_SET:
     747                 :            :         case SW_SERVICE_FIELDTYPE_REF_PAGE_GET:
     748                 :            :         case SW_SERVICE_FIELDTYPE_JUMP_EDIT:
     749                 :            :         case SW_SERVICE_FIELDTYPE_SCRIPT:
     750                 :            :         case SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET:
     751                 :            :         case SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET:
     752                 :            :         case SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM:
     753                 :            :         case SW_SERVICE_FIELDTYPE_DATABASE:
     754                 :            :         case SW_SERVICE_FIELDTYPE_DATABASE_NAME:
     755                 :            :         case SW_SERVICE_FIELDTYPE_PAGE_COUNT      :
     756                 :            :         case SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT :
     757                 :            :         case SW_SERVICE_FIELDTYPE_WORD_COUNT      :
     758                 :            :         case SW_SERVICE_FIELDTYPE_CHARACTER_COUNT :
     759                 :            :         case SW_SERVICE_FIELDTYPE_TABLE_COUNT     :
     760                 :            :         case SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT    :
     761                 :            :         case SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT   :
     762                 :            :         case SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR     :
     763                 :            :         case SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME  :
     764                 :            :         case SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME         :
     765                 :            :         case SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION       :
     766                 :            :         case SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR     :
     767                 :            :         case SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME  :
     768                 :            :         case SW_SERVICE_FIELDTYPE_DOCINFO_CUSTOM            :
     769                 :            :         case SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR      :
     770                 :            :         case SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME   :
     771                 :            :         case SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS         :
     772                 :            :         case SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT           :
     773                 :            :         case SW_SERVICE_FIELDTYPE_DOCINFO_TITLE             :
     774                 :            :         case SW_SERVICE_FIELDTYPE_DOCINFO_REVISION          :
     775                 :            :         case SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY:
     776                 :            :         case SW_SERVICE_FIELDTYPE_INPUT_USER                :
     777                 :            :         case SW_SERVICE_FIELDTYPE_HIDDEN_TEXT               :
     778                 :            :         case SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS       :
     779                 :            :         case SW_SERVICE_FIELDTYPE_DROPDOWN                  :
     780                 :            :         case SW_SERVICE_FIELDTYPE_TABLE_FORMULA:
     781 [ +  - ][ +  - ]:        110 :             xRet = (cppu::OWeakObject*)new SwXTextField(nObjectType);
     782                 :        110 :             break;
     783                 :            :         case SW_SERVICE_FIELDTYPE_ANNOTATION:
     784 [ +  - ][ +  - ]:         24 :             xRet = (cppu::OWeakObject*)new SwXTextField(nObjectType, pDoc);
     785                 :         24 :             break;
     786                 :            :         case SW_SERVICE_FIELDMASTER_USER:
     787                 :            :         case SW_SERVICE_FIELDMASTER_DDE:
     788                 :            :         case SW_SERVICE_FIELDMASTER_SET_EXP :
     789                 :            :         case SW_SERVICE_FIELDMASTER_DATABASE:
     790                 :            :         {
     791                 :         65 :             sal_uInt16 nResId = USHRT_MAX;
     792   [ +  -  +  +  :         65 :             switch(nObjectType)
                      - ]
     793                 :            :             {
     794                 :         54 :                 case SW_SERVICE_FIELDMASTER_USER: nResId = RES_USERFLD; break;
     795                 :          0 :                 case SW_SERVICE_FIELDMASTER_DDE:  nResId = RES_DDEFLD; break;
     796                 :          3 :                 case SW_SERVICE_FIELDMASTER_SET_EXP : nResId = RES_SETEXPFLD; break;
     797                 :          8 :                 case SW_SERVICE_FIELDMASTER_DATABASE: nResId = RES_DBFLD; break;
     798                 :            :             }
     799 [ +  - ][ +  - ]:         65 :             xRet =  (cppu::OWeakObject*)new SwXFieldMaster(pDoc, nResId);
     800                 :            :         }
     801                 :         65 :         break;
     802                 :            :         case SW_SERVICE_FIELDMASTER_BIBLIOGRAPHY:
     803                 :            :         {
     804         [ +  - ]:          4 :             SwFieldType* pType = pDoc->GetFldType(RES_AUTHORITY, aEmptyStr, sal_True);
     805         [ +  - ]:          4 :             if(!pType)
     806                 :            :             {
     807         [ +  - ]:          4 :                 SwAuthorityFieldType aType(pDoc);
     808 [ +  - ][ +  - ]:          4 :                 pType = pDoc->InsertFldType(aType);
     809                 :            :             }
     810                 :            :             else
     811                 :            :             {
     812         [ #  # ]:          0 :                 SwXFieldMaster* pMaster = SwIterator<SwXFieldMaster,SwFieldType>::FirstElement( *pType );
     813         [ #  # ]:          0 :                 if(pMaster)
     814         [ #  # ]:          0 :                     xRet = (cppu::OWeakObject*)pMaster;
     815                 :            :             }
     816         [ +  - ]:          4 :             if(!xRet.is())
     817 [ +  - ][ +  - ]:          4 :                 xRet =  (cppu::OWeakObject*)new SwXFieldMaster(*pType, pDoc);
     818                 :            :         }
     819                 :          4 :         break;
     820                 :            :         case SW_SERVICE_PARAGRAPH :
     821 [ +  - ][ +  - ]:         30 :             xRet = (cppu::OWeakObject*)new SwXParagraph();
     822                 :         30 :         break;
     823                 :            :         case SW_SERVICE_NUMBERING_RULES :
     824 [ +  - ][ +  - ]:          4 :             xRet = (cppu::OWeakObject*)new SwXNumberingRules(*pDoc);
     825                 :          4 :         break;
     826                 :            :         case SW_SERVICE_TEXT_COLUMNS :
     827 [ +  - ][ +  - ]:         31 :             xRet = (cppu::OWeakObject*)new SwXTextColumns(0);
     828                 :         31 :         break;
     829                 :            :         case SW_SERVICE_DEFAULTS:
     830 [ +  - ][ +  - ]:        772 :             xRet = (cppu::OWeakObject*)new SwXTextDefaults( pDoc );
     831                 :        772 :         break;
     832                 :            :         case SW_SERVICE_IMAP_RECTANGLE :
     833 [ +  - ][ +  - ]:          2 :             xRet = SvUnoImageMapRectangleObject_createInstance( lcl_GetSupportedMacroItems() );
     834                 :          2 :         break;
     835                 :            :         case SW_SERVICE_IMAP_CIRCLE    :
     836 [ #  # ][ #  # ]:          0 :             xRet = SvUnoImageMapCircleObject_createInstance( lcl_GetSupportedMacroItems() );
     837                 :          0 :         break;
     838                 :            :         case SW_SERVICE_IMAP_POLYGON   :
     839 [ #  # ][ #  # ]:          0 :             xRet = SvUnoImageMapPolygonObject_createInstance( lcl_GetSupportedMacroItems() );
     840                 :          0 :         break;
     841                 :            :         case SW_SERVICE_CHART2_DATA_PROVIDER :
     842                 :            :             // #i64497# If a chart is in a temporary document during clipoard
     843                 :            :             // paste, there should be no data provider, so that own data is used
     844                 :            :             // This should not happen during copy/paste, as this will unlink
     845                 :            :             // charts using table data.
     846                 :            :             OSL_ASSERT( pDoc->GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED );
     847         [ #  # ]:          0 :             if( pDoc->GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
     848 [ #  # ][ #  # ]:          0 :                 xRet = (cppu::OWeakObject*) pDoc->GetChartDataProvider( true /* create - if not yet available */ );
     849                 :          0 :         break;
     850                 :            :         case SW_SERVICE_TYPE_META:
     851 [ +  - ][ +  - ]:        142 :             xRet = static_cast< ::cppu::OWeakObject* >( new SwXMeta(pDoc) );
     852                 :        142 :         break;
     853                 :            :         case SW_SERVICE_FIELDTYPE_METAFIELD:
     854 [ +  - ][ +  - ]:         52 :             xRet = static_cast< ::cppu::OWeakObject* >(new SwXMetaField(pDoc));
     855                 :         52 :         break;
     856                 :            :         default:
     857         [ #  # ]:          0 :             throw uno::RuntimeException();
     858                 :            :     }
     859         [ +  - ]:       7550 :     return xRet;
     860                 :            : }
     861                 :            : 
     862                 :            : /******************************************************************
     863                 :            :  * SwXTextTables
     864                 :            :  ******************************************************************/
     865                 :            : //SMART_UNO_IMPLEMENTATION( SwXTextTables, UsrObject );
     866                 :         87 : SwXTextTables::SwXTextTables(SwDoc* pDc) :
     867                 :         87 :         SwUnoCollection(pDc)
     868                 :            : {
     869                 :            : 
     870                 :         87 : }
     871                 :            : 
     872                 :         87 : SwXTextTables::~SwXTextTables()
     873                 :            : {
     874                 :            : 
     875         [ -  + ]:        174 : }
     876                 :            : 
     877                 :         53 : sal_Int32 SwXTextTables::getCount(void) throw( uno::RuntimeException )
     878                 :            : {
     879         [ +  - ]:         53 :     SolarMutexGuard aGuard;
     880                 :         53 :     sal_Int32 nRet = 0;
     881         [ +  - ]:         53 :     if(IsValid())
     882         [ +  - ]:         53 :         nRet = GetDoc()->GetTblFrmFmtCount(sal_True);
     883         [ +  - ]:         53 :     return nRet;
     884                 :            : }
     885                 :            : 
     886                 :         14 : uno::Any SAL_CALL SwXTextTables::getByIndex(sal_Int32 nIndex)
     887                 :            :         throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
     888                 :            : {
     889         [ +  - ]:         14 :     SolarMutexGuard aGuard;
     890                 :         14 :     uno::Any aRet;
     891         [ +  - ]:         14 :     if(IsValid())
     892                 :            :     {
     893 [ +  - ][ +  - ]:         14 :         if(0 <= nIndex && GetDoc()->GetTblFrmFmtCount(sal_True) > nIndex)
         [ +  + ][ +  + ]
     894                 :            :         {
     895         [ +  - ]:         12 :             SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt( static_cast< xub_StrLen >(nIndex), sal_True);
     896 [ +  - ][ +  - ]:         12 :             uno::Reference< XTextTable >  xTbl = SwXTextTables::GetObject(rFmt);
     897                 :            :             aRet.setValue( &xTbl,
     898         [ +  - ]:         12 :                 ::getCppuType((uno::Reference< XTextTable>*)0));
     899                 :            :         }
     900                 :            :         else
     901         [ +  - ]:          2 :             throw IndexOutOfBoundsException();
     902                 :            :     }
     903                 :            :     else
     904         [ #  # ]:         12 :         throw uno::RuntimeException();
     905         [ +  - ]:         26 :     return aRet;
     906                 :            : }
     907                 :            : 
     908                 :          4 : uno::Any SwXTextTables::getByName(const OUString& rItemName)
     909                 :            :     throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException )
     910                 :            : {
     911         [ +  - ]:          4 :     SolarMutexGuard aGuard;
     912                 :          4 :     uno::Any aRet;
     913         [ +  - ]:          4 :     if(IsValid())
     914                 :            :     {
     915         [ +  - ]:          4 :         sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(sal_True);
     916                 :          4 :         uno::Reference< XTextTable >  xTbl;
     917         [ +  + ]:         10 :         for( sal_uInt16 i = 0; i < nCount; i++)
     918                 :            :         {
     919         [ +  - ]:          6 :             String aName(rItemName);
     920         [ +  - ]:          6 :             SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt(i, sal_True);
     921 [ +  - ][ +  + ]:          6 :             if(aName == rFmt.GetName())
     922                 :            :             {
     923 [ +  - ][ +  - ]:          2 :                 xTbl = SwXTextTables::GetObject(rFmt);
     924                 :            :                 aRet.setValue(&xTbl,
     925         [ +  - ]:          6 :                     ::getCppuType(( uno::Reference< XTextTable >*)0));
     926                 :            :                 break;
     927                 :            :             }
     928 [ +  - ][ +  + ]:          6 :         }
     929         [ +  + ]:          4 :         if(!xTbl.is())
     930         [ +  - ]:          4 :             throw NoSuchElementException();
     931                 :            :     }
     932                 :            :     else
     933         [ #  # ]:          2 :         throw uno::RuntimeException();
     934         [ +  - ]:          6 :     return aRet;
     935                 :            : }
     936                 :            : 
     937                 :          2 : uno::Sequence< OUString > SwXTextTables::getElementNames(void)
     938                 :            :         throw( uno::RuntimeException )
     939                 :            : {
     940         [ +  - ]:          2 :     SolarMutexGuard aGuard;
     941         [ -  + ]:          2 :     if(!IsValid())
     942         [ #  # ]:          0 :         throw uno::RuntimeException();
     943         [ +  - ]:          2 :     sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(sal_True);
     944         [ +  - ]:          2 :     uno::Sequence<OUString> aSeq(nCount);
     945         [ +  - ]:          2 :     if(nCount)
     946                 :            :     {
     947         [ +  - ]:          2 :         OUString* pArray = aSeq.getArray();
     948         [ +  + ]:          6 :         for( sal_uInt16 i = 0; i < nCount; i++)
     949                 :            :         {
     950         [ +  - ]:          4 :             SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt(i, sal_True);
     951                 :            : 
     952         [ +  - ]:          4 :             pArray[i] = OUString(rFmt.GetName());
     953                 :            :         }
     954                 :            :     }
     955         [ +  - ]:          2 :     return aSeq;
     956                 :            : }
     957                 :            : 
     958                 :          6 : sal_Bool SwXTextTables::hasByName(const OUString& rName)
     959                 :            :     throw( uno::RuntimeException )
     960                 :            : {
     961         [ +  - ]:          6 :     SolarMutexGuard aGuard;
     962                 :          6 :     sal_Bool bRet= sal_False;
     963         [ +  - ]:          6 :     if(IsValid())
     964                 :            :     {
     965         [ +  - ]:          6 :         sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(sal_True);
     966         [ +  + ]:         14 :         for( sal_uInt16 i = 0; i < nCount; i++)
     967                 :            :         {
     968         [ +  - ]:          8 :             String aName(rName);
     969         [ +  - ]:          8 :             SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt(i, sal_True);
     970 [ +  - ][ +  + ]:          8 :             if(aName == rFmt.GetName())
     971                 :            :             {
     972                 :          8 :                 bRet = sal_True;
     973                 :            :                 break;
     974                 :            :             }
     975 [ +  - ][ +  + ]:          8 :         }
     976                 :            :     }
     977                 :            :     else
     978         [ #  # ]:          0 :         throw uno::RuntimeException();
     979         [ +  - ]:          6 :     return bRet;
     980                 :            : }
     981                 :            : 
     982                 :            : uno::Type SAL_CALL
     983                 :          2 :     SwXTextTables::getElementType(  )
     984                 :            :         throw(uno::RuntimeException)
     985                 :            : {
     986                 :          2 :     return ::getCppuType((uno::Reference<XTextTable>*)0);
     987                 :            : }
     988                 :            : 
     989                 :          2 : sal_Bool SwXTextTables::hasElements(void) throw( uno::RuntimeException )
     990                 :            : {
     991         [ +  - ]:          2 :     SolarMutexGuard aGuard;
     992         [ -  + ]:          2 :     if(!IsValid())
     993         [ #  # ]:          0 :         throw uno::RuntimeException();
     994 [ +  - ][ +  - ]:          2 :     return 0 != GetDoc()->GetTblFrmFmtCount(sal_True);
     995                 :            : }
     996                 :            : 
     997                 :          0 : OUString SwXTextTables::getImplementationName(void) throw( uno::RuntimeException )
     998                 :            : {
     999                 :          0 :     return C2U("SwXTextTables");
    1000                 :            : }
    1001                 :            : 
    1002                 :          0 : sal_Bool SwXTextTables::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
    1003                 :            : {
    1004                 :          0 :     return rServiceName == C2U("com.sun.star.text.TextTables");
    1005                 :            : }
    1006                 :            : 
    1007                 :          0 : uno::Sequence< OUString > SwXTextTables::getSupportedServiceNames(void) throw( uno::RuntimeException )
    1008                 :            : {
    1009                 :          0 :     uno::Sequence< OUString > aRet(1);
    1010         [ #  # ]:          0 :     OUString* pArr = aRet.getArray();
    1011         [ #  # ]:          0 :     pArr[0] = C2U("com.sun.star.text.TextTables");
    1012                 :          0 :     return aRet;
    1013                 :            : }
    1014                 :            : 
    1015                 :        112 : XTextTable* SwXTextTables::GetObject( SwFrmFmt& rFmt )
    1016                 :            : {
    1017         [ +  - ]:        112 :     SolarMutexGuard aGuard;
    1018         [ +  - ]:        112 :     SwXTextTable* pTbl = SwIterator<SwXTextTable,SwFmt>::FirstElement( rFmt );
    1019         [ +  + ]:        112 :     if( !pTbl )
    1020         [ +  - ]:        104 :         pTbl = new SwXTextTable(rFmt);
    1021 [ +  - ][ +  - ]:        112 :     return pTbl ;
    1022                 :            : }
    1023                 :            : 
    1024                 :            : /******************************************************************
    1025                 :            :  *  SwXFrameEnumeration
    1026                 :            :  ******************************************************************/
    1027                 :            : namespace
    1028                 :            : {
    1029                 :            :     template<FlyCntType T> struct UnoFrameWrap_traits {};
    1030                 :            : 
    1031                 :            :     template<>
    1032                 :            :     struct UnoFrameWrap_traits<FLYCNTTYPE_FRM>
    1033                 :            :     {
    1034                 :            :         typedef SwXTextFrame core_frame_t;
    1035                 :            :         typedef XTextFrame uno_frame_t;
    1036                 :         18 :         static inline bool filter(const SwNode* const pNode) { return !pNode->IsNoTxtNode(); };
    1037                 :            :     };
    1038                 :            : 
    1039                 :            :     template<>
    1040                 :            :     struct UnoFrameWrap_traits<FLYCNTTYPE_GRF>
    1041                 :            :     {
    1042                 :            :         typedef SwXTextGraphicObject core_frame_t;
    1043                 :            :         typedef XTextContent uno_frame_t;
    1044                 :         10 :         static inline bool filter(const SwNode* const pNode) { return pNode->IsGrfNode(); };
    1045                 :            :     };
    1046                 :            : 
    1047                 :            :     template<>
    1048                 :            :     struct UnoFrameWrap_traits<FLYCNTTYPE_OLE>
    1049                 :            :     {
    1050                 :            :         typedef SwXTextEmbeddedObject core_frame_t;
    1051                 :            :         typedef XEmbeddedObjectSupplier uno_frame_t;
    1052                 :         10 :         static inline bool filter(const SwNode* const pNode) { return pNode->IsOLENode(); };
    1053                 :            :     };
    1054                 :            : 
    1055                 :            :     template<FlyCntType T>
    1056                 :         72 :     static uno::Any lcl_UnoWrapFrame(SwFrmFmt* pFmt)
    1057                 :            :     {
    1058 [ +  - ][ +  - ]:         72 :         SwXFrame* pFrm = SwIterator<SwXFrame,SwFmt>::FirstElement( *pFmt );
                 [ +  - ]
    1059 [ +  + ][ +  + ]:         72 :         if(!pFrm)
                 [ +  + ]
    1060 [ +  - ][ +  - ]:         28 :             pFrm = new typename UnoFrameWrap_traits<T>::core_frame_t(*pFmt);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
    1061                 :            :         Reference< typename UnoFrameWrap_traits<T>::uno_frame_t > xFrm =
    1062 [ +  - ][ +  - ]:         72 :             static_cast< typename UnoFrameWrap_traits<T>::core_frame_t* >(pFrm);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    1063 [ +  - ][ +  - ]:         72 :         return uno::makeAny(xFrm);
                 [ +  - ]
    1064                 :            :     }
    1065                 :            : 
    1066                 :            :     // runtime adapter for lcl_UnoWrapFrame
    1067                 :         54 :     static uno::Any lcl_UnoWrapFrame(SwFrmFmt* pFmt, FlyCntType eType) throw(uno::RuntimeException())
    1068                 :            :     {
    1069   [ +  +  +  - ]:         54 :         switch(eType)
    1070                 :            :         {
    1071                 :            :             case FLYCNTTYPE_FRM:
    1072                 :         25 :                 return lcl_UnoWrapFrame<FLYCNTTYPE_FRM>(pFmt);
    1073                 :            :             case FLYCNTTYPE_GRF:
    1074                 :         15 :                 return lcl_UnoWrapFrame<FLYCNTTYPE_GRF>(pFmt);
    1075                 :            :             case FLYCNTTYPE_OLE:
    1076                 :         14 :                 return lcl_UnoWrapFrame<FLYCNTTYPE_OLE>(pFmt);
    1077                 :            :             default:
    1078         [ #  # ]:         54 :                 throw uno::RuntimeException();
    1079                 :            :         }
    1080                 :            :     }
    1081                 :            : 
    1082                 :            :     template<FlyCntType T>
    1083                 :            :     class SwXFrameEnumeration
    1084                 :            :         : public SwSimpleEnumeration_Base
    1085                 :            :     {
    1086                 :            :         private:
    1087                 :            :             typedef ::std::list< Any > frmcontainer_t;
    1088                 :            :             frmcontainer_t m_aFrames;
    1089                 :            :         protected:
    1090 [ -  + ][ -  + ]:        410 :             virtual ~SwXFrameEnumeration() {};
                 [ -  + ]
    1091                 :            :         public:
    1092                 :            :             SwXFrameEnumeration(const SwDoc* const pDoc);
    1093                 :            : 
    1094                 :            :             //XEnumeration
    1095                 :            :             virtual sal_Bool SAL_CALL hasMoreElements(void) throw( RuntimeException );
    1096                 :            :             virtual Any SAL_CALL nextElement(void) throw( NoSuchElementException, WrappedTargetException, RuntimeException );
    1097                 :            : 
    1098                 :            :             //XServiceInfo
    1099                 :            :             virtual OUString SAL_CALL getImplementationName(void) throw( RuntimeException );
    1100                 :            :             virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw( RuntimeException );
    1101                 :            :             virtual Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw( RuntimeException );
    1102                 :            :     };
    1103                 :            : }
    1104                 :            : 
    1105                 :            : template<FlyCntType T>
    1106                 :        205 : SwXFrameEnumeration<T>::SwXFrameEnumeration(const SwDoc* const pDoc)
    1107 [ +  - ][ +  - ]:        205 :     : m_aFrames()
                 [ +  - ]
    1108                 :            : {
    1109 [ +  - ][ +  - ]:        205 :     SolarMutexGuard aGuard;
                 [ +  - ]
    1110                 :        205 :     const SwFrmFmts* const pFmts = pDoc->GetSpzFrmFmts();
    1111 [ +  + ][ +  + ]:        205 :     if(pFmts->empty())
                 [ +  + ]
    1112                 :        205 :         return;
    1113                 :            :     // #i104937#
    1114                 :            : //    const SwFrmFmt* const pFmtsEnd = (*pFmts)[pFmts->Count()];
    1115                 :         16 :     const sal_uInt16 nSize = pFmts->size();
    1116                 :         16 :     ::std::insert_iterator<frmcontainer_t> pInserter = ::std::insert_iterator<frmcontainer_t>(m_aFrames, m_aFrames.begin());
    1117                 :            :     // #i104937#
    1118                 :         16 :     SwFrmFmt* pFmt( 0 );
    1119 [ +  + ][ +  + ]:         54 :     for( sal_uInt16 i = 0; i < nSize; ++i )
                 [ +  + ]
    1120                 :            : //    for(SwFrmFmt* pFmt = (*pFmts)[0]; pFmt < pFmtsEnd; ++pFmt)
    1121                 :            :     {
    1122                 :            :         // #i104937#
    1123                 :         38 :         pFmt = (*pFmts)[i];
    1124   [ -  +  -  +  :         38 :         if(pFmt->Which() != RES_FLYFRMFMT)
                   -  + ]
    1125                 :          0 :             continue;
    1126 [ +  - ][ +  - ]:         38 :         const SwNodeIndex* pIdx =  pFmt->GetCntnt().GetCntntIdx();
                 [ +  - ]
    1127 [ +  - ][ -  + ]:         38 :         if(!pIdx || !pIdx->GetNodes().IsDocNodes())
           [ -  +  +  - ]
         [ +  - ][ -  + ]
           [ -  +  +  - ]
         [ +  - ][ -  + ]
         [ -  + ][ +  - ]
    1128                 :          0 :             continue;
    1129 [ +  - ][ +  - ]:         38 :         const SwNode* pNd = pDoc->GetNodes()[ pIdx->GetIndex() + 1 ];
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    1130 [ +  + ][ +  + ]:         38 :         if(UnoFrameWrap_traits<T>::filter(pNd))
                 [ +  + ]
    1131 [ +  - ][ +  - ]:        223 :             *pInserter++ = lcl_UnoWrapFrame<T>(pFmt);
         [ +  - ][ +  + ]
         [ +  - ][ +  - ]
         [ +  - ][ +  + ]
         [ +  - ][ +  - ]
         [ +  - ][ +  + ]
    1132                 :            :     }
    1133                 :            : }
    1134                 :            : 
    1135                 :            : template<FlyCntType T>
    1136                 :        223 : sal_Bool SwXFrameEnumeration<T>::hasMoreElements(void) throw( RuntimeException )
    1137                 :            : {
    1138 [ +  - ][ +  - ]:        223 :     SolarMutexGuard aGuard;
                 [ +  - ]
    1139 [ +  - ][ +  - ]:        223 :     return !m_aFrames.empty();
                 [ +  - ]
    1140                 :            : }
    1141                 :            : 
    1142                 :            : template<FlyCntType T>
    1143                 :         18 : Any SwXFrameEnumeration<T>::nextElement(void) throw( NoSuchElementException, WrappedTargetException, RuntimeException )
    1144                 :            : {
    1145 [ +  - ][ +  - ]:         18 :     SolarMutexGuard aGuard;
                 [ +  - ]
    1146 [ -  + ][ -  + ]:         18 :     if(m_aFrames.empty())
                 [ -  + ]
    1147 [ #  # ][ #  # ]:          0 :         throw NoSuchElementException();
                 [ #  # ]
    1148                 :         18 :     Any aResult = *m_aFrames.begin();
    1149   [ +  -  +  -  :         18 :     m_aFrames.pop_front();
                   +  - ]
    1150 [ +  - ][ +  - ]:         18 :     return aResult;
                 [ +  - ]
    1151                 :            : }
    1152                 :            : 
    1153                 :            : template<FlyCntType T>
    1154                 :          0 : OUString SwXFrameEnumeration<T>::getImplementationName(void) throw( RuntimeException )
    1155                 :            : {
    1156                 :          0 :     return C2U("SwXFrameEnumeration");
    1157                 :            : }
    1158                 :            : 
    1159                 :            : template<FlyCntType T>
    1160                 :          0 : sal_Bool SwXFrameEnumeration<T>::supportsService(const OUString& ServiceName) throw( RuntimeException )
    1161                 :            : {
    1162                 :          0 :     return C2U("com.sun.star.container.XEnumeration") == ServiceName;
    1163                 :            : }
    1164                 :            : 
    1165                 :            : template<FlyCntType T>
    1166                 :          0 : Sequence< OUString > SwXFrameEnumeration<T>::getSupportedServiceNames(void) throw( RuntimeException )
    1167                 :            : {
    1168 [ #  # ][ #  # ]:          0 :     return ::comphelper::makeSequence(C2U("com.sun.star.container.XEnumeration"));
                 [ #  # ]
    1169                 :            : }
    1170                 :            : 
    1171                 :            : /******************************************************************
    1172                 :            :  *  SwXFrames
    1173                 :            :  ******************************************************************/
    1174                 :          0 : OUString SwXFrames::getImplementationName(void) throw( RuntimeException )
    1175                 :            : {
    1176                 :          0 :     return C2U("SwXFrames");
    1177                 :            : }
    1178                 :            : 
    1179                 :          0 : sal_Bool SwXFrames::supportsService(const OUString& rServiceName) throw( RuntimeException )
    1180                 :            : {
    1181                 :          0 :     return C2U("com.sun.star.text.TextFrames") == rServiceName;
    1182                 :            : }
    1183                 :            : 
    1184                 :          0 : Sequence<OUString> SwXFrames::getSupportedServiceNames(void) throw( RuntimeException )
    1185                 :            : {
    1186         [ #  # ]:          0 :     return ::comphelper::makeSequence(C2U("com.sun.star.text.TextFrames"));
    1187                 :            : }
    1188                 :            : 
    1189                 :        266 : SwXFrames::SwXFrames(SwDoc* _pDoc, FlyCntType eSet) :
    1190                 :            :     SwUnoCollection(_pDoc),
    1191                 :        266 :     eType(eSet)
    1192                 :        266 : {}
    1193                 :            : 
    1194                 :        230 : SwXFrames::~SwXFrames()
    1195         [ -  + ]:        230 : {}
    1196                 :            : 
    1197                 :        205 : uno::Reference<container::XEnumeration> SwXFrames::createEnumeration(void) throw(uno::RuntimeException)
    1198                 :            : {
    1199         [ +  - ]:        205 :     SolarMutexGuard aGuard;
    1200         [ -  + ]:        205 :     if(!IsValid())
    1201         [ #  # ]:          0 :         throw uno::RuntimeException();
    1202   [ +  +  +  - ]:        205 :     switch(eType)
    1203                 :            :     {
    1204                 :            :         case FLYCNTTYPE_FRM:
    1205                 :            :             return uno::Reference< container::XEnumeration >(
    1206 [ +  - ][ +  - ]:         71 :                 new SwXFrameEnumeration<FLYCNTTYPE_FRM>(GetDoc()));
                 [ +  - ]
    1207                 :            :         case FLYCNTTYPE_GRF:
    1208                 :            :             return uno::Reference< container::XEnumeration >(
    1209 [ +  - ][ +  - ]:         67 :                 new SwXFrameEnumeration<FLYCNTTYPE_GRF>(GetDoc()));
                 [ +  - ]
    1210                 :            :         case FLYCNTTYPE_OLE:
    1211                 :            :             return uno::Reference< container::XEnumeration >(
    1212 [ +  - ][ +  - ]:         67 :                 new SwXFrameEnumeration<FLYCNTTYPE_OLE>(GetDoc()));
                 [ +  - ]
    1213                 :            :         default:
    1214         [ #  # ]:          0 :             throw uno::RuntimeException();
    1215         [ +  - ]:        205 :     }
    1216                 :            : }
    1217                 :            : 
    1218                 :         31 : sal_Int32 SwXFrames::getCount(void) throw(uno::RuntimeException)
    1219                 :            : {
    1220         [ +  - ]:         31 :     SolarMutexGuard aGuard;
    1221         [ -  + ]:         31 :     if(!IsValid())
    1222         [ #  # ]:          0 :         throw uno::RuntimeException();
    1223 [ +  - ][ +  - ]:         31 :     return GetDoc()->GetFlyCount(eType);
    1224                 :            : }
    1225                 :            : 
    1226                 :         46 : uno::Any SwXFrames::getByIndex(sal_Int32 nIndex)
    1227                 :            :     throw(IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
    1228                 :            : {
    1229         [ +  - ]:         46 :     SolarMutexGuard aGuard;
    1230         [ -  + ]:         46 :     if(!IsValid())
    1231         [ #  # ]:          0 :         throw uno::RuntimeException();
    1232 [ +  - ][ -  + ]:         46 :     if(nIndex < 0 || nIndex >= USHRT_MAX)
    1233         [ #  # ]:          0 :         throw IndexOutOfBoundsException();
    1234         [ +  - ]:         46 :     SwFrmFmt* pFmt = GetDoc()->GetFlyNum(static_cast<sal_uInt16>(nIndex), eType);
    1235         [ +  + ]:         46 :     if(!pFmt)
    1236         [ +  - ]:          6 :         throw IndexOutOfBoundsException();
    1237 [ +  - ][ +  - ]:         46 :     return lcl_UnoWrapFrame(pFmt, eType);
    1238                 :            : }
    1239                 :            : 
    1240                 :         26 : uno::Any SwXFrames::getByName(const OUString& rName)
    1241                 :            :     throw(NoSuchElementException, WrappedTargetException, uno::RuntimeException )
    1242                 :            : {
    1243         [ +  - ]:         26 :     SolarMutexGuard aGuard;
    1244         [ -  + ]:         26 :     if(!IsValid())
    1245         [ #  # ]:          0 :         throw uno::RuntimeException();
    1246                 :            :     const SwFrmFmt* pFmt;
    1247      [ +  +  + ]:         26 :     switch(eType)
    1248                 :            :     {
    1249                 :            :         case FLYCNTTYPE_GRF:
    1250 [ +  - ][ +  - ]:          8 :             pFmt = GetDoc()->FindFlyByName(rName, ND_GRFNODE);
                 [ +  - ]
    1251                 :          8 :             break;
    1252                 :            :         case FLYCNTTYPE_OLE:
    1253 [ +  - ][ +  - ]:          8 :             pFmt = GetDoc()->FindFlyByName(rName, ND_OLENODE);
                 [ +  - ]
    1254                 :          8 :             break;
    1255                 :            :         default:
    1256 [ +  - ][ +  - ]:         10 :             pFmt = GetDoc()->FindFlyByName(rName, ND_TEXTNODE);
                 [ +  - ]
    1257                 :         10 :             break;
    1258                 :            :     }
    1259         [ +  + ]:         26 :     if(!pFmt)
    1260         [ +  - ]:         12 :         throw NoSuchElementException();
    1261 [ +  - ][ +  - ]:         26 :     return lcl_UnoWrapFrame(const_cast<SwFrmFmt*>(pFmt), eType);
    1262                 :            : }
    1263                 :            : 
    1264                 :         16 : uno::Sequence<OUString> SwXFrames::getElementNames(void) throw( uno::RuntimeException )
    1265                 :            : {
    1266         [ +  - ]:         16 :     SolarMutexGuard aGuard;
    1267         [ -  + ]:         16 :     if(!IsValid())
    1268         [ #  # ]:          0 :         throw uno::RuntimeException();
    1269         [ +  - ]:         16 :     const Reference<XEnumeration> xEnum = createEnumeration();
    1270         [ +  - ]:         16 :     ::std::vector<OUString> vNames;
    1271 [ +  - ][ +  - ]:         34 :     while(xEnum->hasMoreElements())
                 [ +  + ]
    1272                 :            :     {
    1273                 :         18 :         Reference<container::XNamed> xNamed;
    1274 [ +  - ][ +  - ]:         18 :         xEnum->nextElement() >>= xNamed;
                 [ +  - ]
    1275         [ +  - ]:         18 :         if(xNamed.is())
    1276 [ +  - ][ +  - ]:         18 :             vNames.push_back(xNamed->getName());
                 [ +  - ]
    1277                 :         18 :     }
    1278 [ +  - ][ +  - ]:         16 :     return ::comphelper::containerToSequence(vNames);
    1279                 :            : }
    1280                 :            : 
    1281                 :         52 : sal_Bool SwXFrames::hasByName(const OUString& rName) throw( uno::RuntimeException )
    1282                 :            : {
    1283         [ +  - ]:         52 :     SolarMutexGuard aGuard;
    1284         [ -  + ]:         52 :     if(!IsValid())
    1285         [ #  # ]:          0 :         throw uno::RuntimeException();
    1286      [ +  +  + ]:         52 :     switch(eType)
    1287                 :            :     {
    1288                 :            :         case FLYCNTTYPE_GRF:
    1289 [ +  - ][ +  - ]:         18 :             return GetDoc()->FindFlyByName(rName, ND_GRFNODE) != NULL;
                 [ +  - ]
    1290                 :            :         case FLYCNTTYPE_OLE:
    1291 [ +  - ][ +  - ]:         16 :             return GetDoc()->FindFlyByName(rName, ND_OLENODE) != NULL;
                 [ +  - ]
    1292                 :            :         default:
    1293 [ +  - ][ +  - ]:         18 :             return GetDoc()->FindFlyByName(rName, ND_TEXTNODE) != NULL;
                 [ +  - ]
    1294         [ +  - ]:         52 :     }
    1295                 :            : }
    1296                 :            : 
    1297                 :          6 : uno::Type SAL_CALL SwXFrames::getElementType() throw(uno::RuntimeException)
    1298                 :            : {
    1299         [ +  - ]:          6 :     SolarMutexGuard aGuard;
    1300   [ +  +  +  - ]:          6 :     switch(eType)
    1301                 :            :     {
    1302                 :            :         case FLYCNTTYPE_FRM:
    1303         [ +  - ]:          2 :             return ::getCppuType((uno::Reference<XTextFrame>*)0);
    1304                 :            :         case FLYCNTTYPE_GRF:
    1305         [ +  - ]:          2 :             return ::getCppuType((uno::Reference<XTextContent>*)0);
    1306                 :            :         case FLYCNTTYPE_OLE:
    1307         [ +  - ]:          2 :             return ::getCppuType((uno::Reference<XEmbeddedObjectSupplier>*)0);
    1308                 :            :         default:
    1309                 :          0 :             return uno::Type();
    1310         [ +  - ]:          6 :     }
    1311                 :            : }
    1312                 :            : 
    1313                 :          6 : sal_Bool SwXFrames::hasElements(void) throw(uno::RuntimeException)
    1314                 :            : {
    1315         [ +  - ]:          6 :     SolarMutexGuard aGuard;
    1316         [ -  + ]:          6 :     if(!IsValid())
    1317         [ #  # ]:          0 :         throw uno::RuntimeException();
    1318 [ +  - ][ +  - ]:          6 :     return GetDoc()->GetFlyCount(eType) > 0;
    1319                 :            : }
    1320                 :            : 
    1321                 :        443 : SwXFrame* SwXFrames::GetObject(SwFrmFmt& rFmt, FlyCntType eType)
    1322                 :            : {
    1323                 :        443 :     SwXFrame* pFrm = SwIterator<SwXFrame,SwFmt>::FirstElement( rFmt );
    1324         [ +  + ]:        443 :     if(pFrm) return pFrm;
    1325   [ +  +  +  - ]:        374 :     switch(eType)
    1326                 :            :     {
    1327                 :            :         case FLYCNTTYPE_FRM:
    1328 [ +  - ][ +  - ]:         21 :             return new SwXTextFrame(rFmt);
                 [ +  - ]
    1329                 :            :         case FLYCNTTYPE_GRF:
    1330 [ +  - ][ +  - ]:         18 :             return new SwXTextGraphicObject(rFmt);
                 [ +  - ]
    1331                 :            :         case FLYCNTTYPE_OLE:
    1332 [ +  - ][ +  - ]:        335 :             return new SwXTextEmbeddedObject(rFmt);
                 [ +  - ]
    1333                 :            :         default:
    1334                 :        443 :             return NULL;
    1335                 :            :     }
    1336                 :            : }
    1337                 :            : 
    1338                 :            : /******************************************************************
    1339                 :            :  * SwXTextFrames
    1340                 :            :  ******************************************************************/
    1341                 :          0 : OUString SwXTextFrames::getImplementationName(void) throw( RuntimeException )
    1342                 :            : {
    1343                 :          0 :     return C2U("SwXTextFrames");
    1344                 :            : }
    1345                 :            : 
    1346                 :          0 : sal_Bool SwXTextFrames::supportsService(const OUString& rServiceName) throw( RuntimeException )
    1347                 :            : {
    1348                 :          0 :     return C2U("com.sun.star.text.TextFrames") == rServiceName;
    1349                 :            : }
    1350                 :            : 
    1351                 :          0 : Sequence< OUString > SwXTextFrames::getSupportedServiceNames(void) throw( RuntimeException )
    1352                 :            : {
    1353                 :          0 :     Sequence< OUString > aRet(1);
    1354         [ #  # ]:          0 :     OUString* pArray = aRet.getArray();
    1355         [ #  # ]:          0 :     pArray[0] = C2U("com.sun.star.text.TextFrames");
    1356                 :          0 :     return aRet;
    1357                 :            : }
    1358                 :            : 
    1359                 :        103 : SwXTextFrames::SwXTextFrames(SwDoc* _pDoc) :
    1360                 :        103 :     SwXFrames(_pDoc, FLYCNTTYPE_FRM)
    1361                 :            : {
    1362                 :        103 : }
    1363                 :            : 
    1364                 :         91 : SwXTextFrames::~SwXTextFrames()
    1365                 :            : {
    1366         [ -  + ]:        182 : }
    1367                 :            : 
    1368                 :            : /******************************************************************
    1369                 :            :  *  SwXTextGraphicObjects
    1370                 :            :  ******************************************************************/
    1371                 :          0 : OUString SwXTextGraphicObjects::getImplementationName(void) throw( RuntimeException )
    1372                 :            : {
    1373                 :          0 :     return C2U("SwXTextGraphicObjects");
    1374                 :            : }
    1375                 :            : 
    1376                 :          0 : sal_Bool SwXTextGraphicObjects::supportsService(const OUString& rServiceName) throw( RuntimeException )
    1377                 :            : {
    1378                 :          0 :     return C2U("com.sun.star.text.TextGraphicObjects") == rServiceName;
    1379                 :            : }
    1380                 :            : 
    1381                 :          0 : Sequence< OUString > SwXTextGraphicObjects::getSupportedServiceNames(void) throw( RuntimeException )
    1382                 :            : {
    1383                 :          0 :     Sequence< OUString > aRet(1);
    1384         [ #  # ]:          0 :     OUString* pArray = aRet.getArray();
    1385         [ #  # ]:          0 :     pArray[0] = C2U("com.sun.star.text.TextGraphicObjects");
    1386                 :          0 :     return aRet;
    1387                 :            : }
    1388                 :            : 
    1389                 :         82 : SwXTextGraphicObjects::SwXTextGraphicObjects(SwDoc* _pDoc) :
    1390                 :         82 :     SwXFrames(_pDoc, FLYCNTTYPE_GRF)
    1391                 :            : {
    1392                 :         82 : }
    1393                 :            : 
    1394                 :         70 : SwXTextGraphicObjects::~SwXTextGraphicObjects()
    1395                 :            : {
    1396         [ -  + ]:        140 : }
    1397                 :            : 
    1398                 :            : /******************************************************************
    1399                 :            :  *  SwXTextEmbeddedObjects
    1400                 :            :  ******************************************************************/
    1401                 :          0 : OUString SwXTextEmbeddedObjects::getImplementationName(void) throw( RuntimeException )
    1402                 :            : {
    1403                 :          0 :     return C2U("SwXTextEmbeddedObjects");
    1404                 :            : }
    1405                 :            : 
    1406                 :          0 : sal_Bool SwXTextEmbeddedObjects::supportsService(const OUString& rServiceName) throw( RuntimeException )
    1407                 :            : {
    1408                 :          0 :     return C2U("com.sun.star.text.TextEmbeddedObjects") == rServiceName;
    1409                 :            : }
    1410                 :            : 
    1411                 :          0 : Sequence< OUString > SwXTextEmbeddedObjects::getSupportedServiceNames(void) throw( RuntimeException )
    1412                 :            : {
    1413                 :          0 :     Sequence< OUString > aRet(1);
    1414         [ #  # ]:          0 :     OUString* pArray = aRet.getArray();
    1415         [ #  # ]:          0 :     pArray[0] = C2U("com.sun.star.text.TextEmbeddedObjects");
    1416                 :          0 :     return aRet;
    1417                 :            : }
    1418                 :            : 
    1419                 :         81 : SwXTextEmbeddedObjects::SwXTextEmbeddedObjects(SwDoc* _pDoc) :
    1420                 :         81 :         SwXFrames(_pDoc, FLYCNTTYPE_OLE)
    1421                 :            : {
    1422                 :         81 : }
    1423                 :            : 
    1424                 :         69 : SwXTextEmbeddedObjects::~SwXTextEmbeddedObjects()
    1425                 :            : {
    1426         [ -  + ]:        138 : }
    1427                 :            : 
    1428                 :          0 : OUString SwXTextSections::getImplementationName(void) throw( RuntimeException )
    1429                 :            : {
    1430                 :          0 :     return C2U("SwXTextSections");
    1431                 :            : }
    1432                 :            : 
    1433                 :          0 : sal_Bool SwXTextSections::supportsService(const OUString& rServiceName) throw( RuntimeException )
    1434                 :            : {
    1435                 :          0 :     return C2U("com.sun.star.text.TextSections") == rServiceName;
    1436                 :            : }
    1437                 :            : 
    1438                 :          0 : Sequence< OUString > SwXTextSections::getSupportedServiceNames(void) throw( RuntimeException )
    1439                 :            : {
    1440                 :          0 :     Sequence< OUString > aRet(1);
    1441         [ #  # ]:          0 :     OUString* pArray = aRet.getArray();
    1442         [ #  # ]:          0 :     pArray[0] = C2U("com.sun.star.text.TextSections");
    1443                 :          0 :     return aRet;
    1444                 :            : }
    1445                 :            : 
    1446                 :         37 : SwXTextSections::SwXTextSections(SwDoc* _pDoc) :
    1447                 :         37 :     SwUnoCollection(_pDoc)
    1448                 :            : {
    1449                 :         37 : }
    1450                 :            : 
    1451                 :         37 : SwXTextSections::~SwXTextSections()
    1452                 :            : {
    1453         [ -  + ]:         74 : }
    1454                 :            : 
    1455                 :         27 : sal_Int32 SwXTextSections::getCount(void) throw( uno::RuntimeException )
    1456                 :            : {
    1457         [ +  - ]:         27 :     SolarMutexGuard aGuard;
    1458         [ -  + ]:         27 :     if(!IsValid())
    1459         [ #  # ]:          0 :         throw uno::RuntimeException();
    1460                 :         27 :     const SwSectionFmts& rSectFmts = GetDoc()->GetSections();
    1461                 :         27 :     sal_uInt16 nCount = rSectFmts.size();
    1462         [ +  + ]:         67 :     for(sal_uInt16 i = nCount; i; i--)
    1463                 :            :     {
    1464 [ +  - ][ -  + ]:         40 :         if( !rSectFmts[i - 1]->IsInNodesArr())
    1465                 :          0 :             nCount--;
    1466                 :            :     }
    1467         [ +  - ]:         27 :     return nCount;
    1468                 :            : }
    1469                 :            : 
    1470                 :         50 : uno::Any SwXTextSections::getByIndex(sal_Int32 nIndex)
    1471                 :            :     throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
    1472                 :            : {
    1473         [ +  - ]:         50 :     SolarMutexGuard aGuard;
    1474                 :         50 :     uno::Reference< XTextSection >  xRet;
    1475         [ +  - ]:         50 :     if(IsValid())
    1476                 :            :     {
    1477                 :         50 :         SwSectionFmts& rFmts = GetDoc()->GetSections();
    1478                 :            : 
    1479                 :         50 :         const SwSectionFmts& rSectFmts = GetDoc()->GetSections();
    1480                 :         50 :         sal_uInt16 nCount = rSectFmts.size();
    1481         [ +  + ]:        298 :         for(sal_uInt16 i = 0; i < nCount; i++)
    1482                 :            :         {
    1483 [ +  - ][ -  + ]:        296 :             if( !rSectFmts[i]->IsInNodesArr())
    1484                 :          0 :                 nIndex ++;
    1485         [ +  + ]:        296 :             else if(nIndex == i)
    1486                 :         48 :                 break;
    1487         [ -  + ]:        248 :             if(nIndex == i)
    1488                 :          0 :                 break;
    1489                 :            :         }
    1490 [ +  - ][ +  + ]:         50 :         if(nIndex >= 0 && nIndex < (sal_Int32)rFmts.size())
                 [ +  + ]
    1491                 :            :         {
    1492                 :         48 :             SwSectionFmt* pFmt = rFmts[(sal_uInt16)nIndex];
    1493 [ +  - ][ +  - ]:         48 :             xRet = GetObject(*pFmt);
    1494                 :            :         }
    1495                 :            :         else
    1496         [ +  - ]:          2 :             throw IndexOutOfBoundsException();
    1497                 :            :     }
    1498                 :            :     else
    1499         [ #  # ]:          0 :         throw uno::RuntimeException();
    1500 [ +  - ][ +  - ]:         50 :     return makeAny(xRet);
    1501                 :            : }
    1502                 :            : 
    1503                 :         76 : uno::Any SwXTextSections::getByName(const OUString& Name)
    1504                 :            :     throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException )
    1505                 :            : {
    1506         [ +  - ]:         76 :     SolarMutexGuard aGuard;
    1507                 :         76 :     uno::Any aRet;
    1508         [ +  - ]:         76 :     if(IsValid())
    1509                 :            :     {
    1510         [ +  - ]:         76 :         String aName(Name);
    1511                 :         76 :         SwSectionFmts& rFmts = GetDoc()->GetSections();
    1512                 :         76 :         uno::Reference< XTextSection >  xSect;
    1513         [ +  + ]:        572 :         for(sal_uInt16 i = 0; i < rFmts.size(); i++)
    1514                 :            :         {
    1515                 :        568 :             SwSectionFmt* pFmt = rFmts[i];
    1516 [ +  - ][ +  + ]:       1136 :             if (pFmt->IsInNodesArr()
         [ +  + ][ +  - ]
    1517 [ +  - ][ +  - ]:        568 :                 && (aName == pFmt->GetSection()->GetSectionName()))
    1518                 :            :             {
    1519 [ +  - ][ +  - ]:         72 :                 xSect = GetObject(*pFmt);
    1520         [ +  - ]:         72 :                 aRet.setValue(&xSect, ::getCppuType((uno::Reference<XTextSection>*)0));
    1521                 :         72 :                 break;
    1522                 :            :             }
    1523                 :            :         }
    1524         [ +  + ]:         76 :         if(!xSect.is())
    1525 [ +  - ][ +  - ]:         76 :             throw NoSuchElementException();
    1526                 :            :     }
    1527                 :            :     else
    1528         [ #  # ]:         72 :         throw uno::RuntimeException();
    1529         [ +  - ]:        148 :     return aRet;
    1530                 :            : }
    1531                 :            : 
    1532                 :          4 : uno::Sequence< OUString > SwXTextSections::getElementNames(void)
    1533                 :            :     throw( uno::RuntimeException )
    1534                 :            : {
    1535         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    1536         [ -  + ]:          4 :     if(!IsValid())
    1537         [ #  # ]:          0 :         throw uno::RuntimeException();
    1538                 :          4 :     sal_uInt16 nCount = GetDoc()->GetSections().size();
    1539                 :          4 :     SwSectionFmts& rSectFmts = GetDoc()->GetSections();
    1540         [ +  + ]:         14 :     for(sal_uInt16 i = nCount; i; i--)
    1541                 :            :     {
    1542 [ +  - ][ -  + ]:         10 :         if( !rSectFmts[i - 1]->IsInNodesArr())
    1543                 :          0 :             nCount--;
    1544                 :            :     }
    1545                 :            : 
    1546         [ +  - ]:          4 :     uno::Sequence<OUString> aSeq(nCount);
    1547         [ +  - ]:          4 :     if(nCount)
    1548                 :            :     {
    1549                 :          4 :         SwSectionFmts& rFmts = GetDoc()->GetSections();
    1550         [ +  - ]:          4 :         OUString* pArray = aSeq.getArray();
    1551                 :          4 :         sal_uInt16 nIndex = 0;
    1552         [ +  + ]:         14 :         for( sal_uInt16 i = 0; i < nCount; i++, nIndex++)
    1553                 :            :         {
    1554                 :         10 :             const SwSectionFmt* pFmt = rFmts[nIndex];
    1555 [ +  - ][ -  + ]:         10 :             while(!pFmt->IsInNodesArr())
    1556                 :            :             {
    1557                 :          0 :                 pFmt = rFmts[++nIndex];
    1558                 :            :             }
    1559 [ +  - ][ +  - ]:         10 :             pArray[i] = pFmt->GetSection()->GetSectionName();
    1560                 :            :         }
    1561                 :            :     }
    1562         [ +  - ]:          4 :     return aSeq;
    1563                 :            : }
    1564                 :            : 
    1565                 :         16 : sal_Bool SwXTextSections::hasByName(const OUString& Name)
    1566                 :            :     throw( uno::RuntimeException )
    1567                 :            : {
    1568         [ +  - ]:         16 :     SolarMutexGuard aGuard;
    1569                 :         16 :     sal_Bool bRet = sal_False;
    1570         [ +  - ]:         16 :     String aName(Name);
    1571         [ +  - ]:         16 :     if(IsValid())
    1572                 :            :     {
    1573                 :         16 :         SwSectionFmts& rFmts = GetDoc()->GetSections();
    1574         [ +  + ]:         34 :         for(sal_uInt16 i = 0; i < rFmts.size(); i++)
    1575                 :            :         {
    1576                 :         18 :             const SwSectionFmt* pFmt = rFmts[i];
    1577 [ +  - ][ +  + ]:         18 :             if (aName == pFmt->GetSection()->GetSectionName())
                 [ +  - ]
    1578                 :            :             {
    1579                 :          8 :                 bRet = sal_True;
    1580                 :          8 :                 break;
    1581                 :            :             }
    1582                 :            :         }
    1583                 :            :     }
    1584                 :            :     else
    1585                 :            :     {
    1586                 :            :         //Sonderbehandlung der dbg_ - Methoden
    1587 [ #  # ][ #  # ]:          0 :         if( COMPARE_EQUAL != aName.CompareToAscii("dbg_", 4))
    1588         [ #  # ]:          0 :             throw uno::RuntimeException();
    1589                 :            :     }
    1590 [ +  - ][ +  - ]:         16 :     return bRet;
    1591                 :            : }
    1592                 :            : 
    1593                 :          2 : uno::Type SAL_CALL SwXTextSections::getElementType() throw(uno::RuntimeException)
    1594                 :            : {
    1595                 :          2 :     return ::getCppuType((uno::Reference<XTextSection>*)0);
    1596                 :            : }
    1597                 :            : 
    1598                 :          2 : sal_Bool SwXTextSections::hasElements(void) throw( uno::RuntimeException )
    1599                 :            : {
    1600         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    1601                 :          2 :     sal_uInt16 nCount = 0;
    1602         [ +  - ]:          2 :     if(IsValid())
    1603                 :            :     {
    1604                 :          2 :         SwSectionFmts& rFmts = GetDoc()->GetSections();
    1605                 :          2 :         nCount = rFmts.size();
    1606                 :            :     }
    1607                 :            :     else
    1608         [ #  # ]:          2 :         throw uno::RuntimeException();
    1609         [ +  - ]:          4 :     return nCount > 0;
    1610                 :            : }
    1611                 :            : 
    1612                 :        138 : uno::Reference< XTextSection >  SwXTextSections::GetObject( SwSectionFmt& rFmt )
    1613                 :            : {
    1614                 :        138 :     return SwXTextSection::CreateXTextSection(&rFmt);
    1615                 :            : }
    1616                 :            : 
    1617                 :          0 : OUString SwXBookmarks::getImplementationName(void) throw( RuntimeException )
    1618                 :            : {
    1619                 :          0 :     return OUString(RTL_CONSTASCII_USTRINGPARAM("SwXBookmarks"));
    1620                 :            : }
    1621                 :            : 
    1622                 :          0 : sal_Bool SwXBookmarks::supportsService(const OUString& rServiceName) throw( RuntimeException )
    1623                 :            : {
    1624                 :          0 :     return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Bookmarks")) == rServiceName;
    1625                 :            : }
    1626                 :            : 
    1627                 :          0 : Sequence< OUString > SwXBookmarks::getSupportedServiceNames(void) throw( RuntimeException )
    1628                 :            : {
    1629                 :          0 :     Sequence< OUString > aRet(1);
    1630 [ #  # ][ #  # ]:          0 :     aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Bookmarks"));
    1631                 :          0 :     return aRet;
    1632                 :            : }
    1633                 :            : 
    1634                 :         16 : SwXBookmarks::SwXBookmarks(SwDoc* _pDoc) :
    1635                 :         16 :     SwUnoCollection(_pDoc)
    1636                 :         16 : { }
    1637                 :            : 
    1638                 :         16 : SwXBookmarks::~SwXBookmarks()
    1639         [ -  + ]:         32 : { }
    1640                 :            : 
    1641                 :          2 : sal_Int32 SwXBookmarks::getCount(void)
    1642                 :            :     throw( uno::RuntimeException )
    1643                 :            : {
    1644         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    1645         [ -  + ]:          2 :     if(!IsValid())
    1646         [ #  # ]:          0 :         throw uno::RuntimeException();
    1647                 :            : 
    1648                 :          2 :     sal_Int32 count(0);
    1649         [ +  - ]:          2 :     IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
    1650 [ +  - ][ +  + ]:         12 :     for (IDocumentMarkAccess::const_iterator_t ppMark =
    1651         [ +  - ]:          2 :             pMarkAccess->getBookmarksBegin();
    1652         [ +  - ]:          6 :          ppMark != pMarkAccess->getBookmarksEnd(); ++ppMark)
    1653                 :            :     {
    1654         [ +  - ]:          4 :         if (IDocumentMarkAccess::BOOKMARK ==
    1655         [ +  - ]:          4 :                 IDocumentMarkAccess::GetType(**ppMark))
    1656                 :            :         {
    1657                 :          4 :             ++count; // only count real bookmarks
    1658                 :            :         }
    1659                 :            :     }
    1660         [ +  - ]:          2 :     return count;
    1661                 :            : }
    1662                 :            : 
    1663                 :          8 : uno::Any SwXBookmarks::getByIndex(sal_Int32 nIndex)
    1664                 :            :     throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
    1665                 :            : {
    1666         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    1667         [ -  + ]:          8 :     if(!IsValid())
    1668         [ #  # ]:          0 :         throw uno::RuntimeException();
    1669         [ +  - ]:          8 :     IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
    1670 [ +  - ][ +  - ]:          8 :     if(nIndex < 0 || nIndex >= pMarkAccess->getBookmarksCount())
         [ +  + ][ +  + ]
    1671         [ +  - ]:          2 :         throw IndexOutOfBoundsException();
    1672                 :            : 
    1673                 :          6 :     sal_Int32 count(0);
    1674 [ +  - ][ +  - ]:         20 :     for (IDocumentMarkAccess::const_iterator_t ppMark =
    1675         [ +  - ]:          6 :             pMarkAccess->getBookmarksBegin();
    1676         [ +  - ]:         10 :          ppMark != pMarkAccess->getBookmarksEnd(); ++ppMark)
    1677                 :            :     {
    1678         [ +  - ]:         10 :         if (IDocumentMarkAccess::BOOKMARK ==
    1679         [ +  - ]:         10 :                 IDocumentMarkAccess::GetType(**ppMark))
    1680                 :            :         {
    1681         [ +  + ]:         10 :             if (count == nIndex)
    1682                 :            :             {
    1683                 :          6 :                 uno::Any aRet;
    1684                 :            :                 const uno::Reference< text::XTextContent > xRef =
    1685         [ +  - ]:          6 :                     SwXBookmark::CreateXBookmark(*GetDoc(), **ppMark);
    1686         [ +  - ]:          6 :                 aRet <<= xRef;
    1687                 :         12 :                 return aRet;
    1688                 :            :             }
    1689                 :          4 :             ++count; // only count real bookmarks
    1690                 :            :         }
    1691                 :            :     }
    1692 [ #  # ][ +  - ]:          8 :     throw IndexOutOfBoundsException();
    1693                 :            : }
    1694                 :            : 
    1695                 :       9674 : uno::Any SwXBookmarks::getByName(const rtl::OUString& rName)
    1696                 :            :     throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException )
    1697                 :            : {
    1698         [ +  - ]:       9674 :     SolarMutexGuard aGuard;
    1699         [ -  + ]:       9674 :     if(!IsValid())
    1700         [ #  # ]:          0 :         throw uno::RuntimeException();
    1701                 :            : 
    1702         [ +  - ]:       9674 :     IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
    1703         [ +  - ]:       9674 :     IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->findBookmark(rName);
    1704 [ +  - ][ +  - ]:       9674 :     if(ppBkmk == pMarkAccess->getBookmarksEnd())
                 [ +  + ]
    1705         [ +  - ]:          2 :         throw NoSuchElementException();
    1706                 :            : 
    1707                 :       9672 :     uno::Any aRet;
    1708                 :            :     const uno::Reference< text::XTextContent > xRef =
    1709         [ +  - ]:       9672 :         SwXBookmark::CreateXBookmark(*GetDoc(), *(ppBkmk->get()));
    1710         [ +  - ]:       9672 :     aRet <<= xRef;
    1711         [ +  - ]:       9674 :     return aRet;
    1712                 :            : }
    1713                 :            : 
    1714                 :         16 : uno::Sequence< OUString > SwXBookmarks::getElementNames(void)
    1715                 :            :     throw( uno::RuntimeException )
    1716                 :            : {
    1717         [ +  - ]:         16 :     SolarMutexGuard aGuard;
    1718         [ -  + ]:         16 :     if(!IsValid())
    1719         [ #  # ]:          0 :         throw uno::RuntimeException();
    1720                 :            : 
    1721         [ +  - ]:         16 :     ::comphelper::SequenceAsVector< ::rtl::OUString > ret;
    1722         [ +  - ]:         16 :     IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
    1723 [ +  - ][ +  + ]:      19364 :     for (IDocumentMarkAccess::const_iterator_t ppMark =
    1724         [ +  - ]:         16 :             pMarkAccess->getBookmarksBegin();
    1725         [ +  - ]:       9682 :          ppMark != pMarkAccess->getBookmarksEnd(); ++ppMark)
    1726                 :            :     {
    1727         [ +  - ]:       9666 :         if (IDocumentMarkAccess::BOOKMARK ==
    1728         [ +  - ]:       9666 :                 IDocumentMarkAccess::GetType(**ppMark))
    1729                 :            :         {
    1730 [ +  - ][ +  - ]:       9666 :             ret.push_back((*ppMark)->GetName()); // only add real bookmarks
    1731                 :            :         }
    1732                 :            :     }
    1733 [ +  - ][ +  - ]:         16 :     return ret.getAsConstList();
    1734                 :            : }
    1735                 :            : 
    1736                 :          4 : sal_Bool SwXBookmarks::hasByName(const OUString& rName)
    1737                 :            :     throw( uno::RuntimeException )
    1738                 :            : {
    1739         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    1740         [ -  + ]:          4 :     if(!IsValid())
    1741         [ #  # ]:          0 :         throw uno::RuntimeException();
    1742                 :            : 
    1743         [ +  - ]:          4 :     IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
    1744 [ +  - ][ +  - ]:          4 :     return pMarkAccess->findBookmark(rName) != pMarkAccess->getBookmarksEnd();
         [ +  - ][ +  - ]
    1745                 :            : }
    1746                 :            : 
    1747                 :          2 : uno::Type SAL_CALL SwXBookmarks::getElementType()
    1748                 :            :     throw(uno::RuntimeException)
    1749                 :            : {
    1750                 :          2 :     return ::getCppuType((uno::Reference<XTextContent>*)0);
    1751                 :            : }
    1752                 :            : 
    1753                 :          2 : sal_Bool SwXBookmarks::hasElements(void)
    1754                 :            :     throw( uno::RuntimeException )
    1755                 :            : {
    1756         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    1757         [ -  + ]:          2 :     if(!IsValid())
    1758         [ #  # ]:          0 :         throw uno::RuntimeException();
    1759                 :            : 
    1760         [ +  - ]:          2 :     IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
    1761 [ +  - ][ +  - ]:          4 :     for (IDocumentMarkAccess::const_iterator_t ppMark =
    1762         [ +  - ]:          2 :             pMarkAccess->getBookmarksBegin();
    1763         [ +  - ]:          2 :          ppMark != pMarkAccess->getBookmarksEnd(); ++ppMark)
    1764                 :            :     {
    1765         [ +  - ]:          2 :         if (IDocumentMarkAccess::BOOKMARK ==
    1766         [ +  - ]:          2 :                 IDocumentMarkAccess::GetType(**ppMark))
    1767                 :            :         {
    1768                 :          2 :             return true;
    1769                 :            :         }
    1770                 :            :     }
    1771         [ +  - ]:          2 :     return false;
    1772                 :            : }
    1773                 :            : 
    1774                 :         22 : SwXNumberingRulesCollection::SwXNumberingRulesCollection( SwDoc* _pDoc ) :
    1775                 :         22 :     SwUnoCollection(_pDoc)
    1776                 :            : {
    1777                 :         22 : }
    1778                 :            : 
    1779                 :         22 : SwXNumberingRulesCollection::~SwXNumberingRulesCollection()
    1780                 :            : {
    1781         [ -  + ]:         44 : }
    1782                 :            : 
    1783                 :         42 : sal_Int32 SwXNumberingRulesCollection::getCount(void) throw( uno::RuntimeException )
    1784                 :            : {
    1785         [ +  - ]:         42 :     SolarMutexGuard aGuard;
    1786         [ -  + ]:         42 :     if(!IsValid())
    1787         [ #  # ]:          0 :         throw uno::RuntimeException();
    1788         [ +  - ]:         42 :     return GetDoc()->GetNumRuleTbl().size();
    1789                 :            : }
    1790                 :            : 
    1791                 :         45 : uno::Any SwXNumberingRulesCollection::getByIndex(sal_Int32 nIndex)
    1792                 :            :     throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
    1793                 :            : {
    1794         [ +  - ]:         45 :     SolarMutexGuard aGuard;
    1795                 :         45 :     uno::Any aRet;
    1796         [ +  - ]:         45 :     if(IsValid())
    1797                 :            :     {
    1798                 :         45 :         uno::Reference< XIndexReplace >  xRef;
    1799         [ +  - ]:         45 :         if ( nIndex < (sal_Int32)GetDoc()->GetNumRuleTbl().size() )
    1800                 :            :         {
    1801 [ +  - ][ +  - ]:         45 :             xRef = new SwXNumberingRules( *GetDoc()->GetNumRuleTbl()[ static_cast< sal_uInt16 >(nIndex) ], GetDoc());
                 [ +  - ]
    1802         [ +  - ]:         45 :             aRet.setValue(&xRef, ::getCppuType((uno::Reference<XIndexReplace>*)0));
    1803                 :            :         }
    1804                 :            : 
    1805         [ -  + ]:         45 :         if(!xRef.is())
    1806         [ #  # ]:         45 :             throw IndexOutOfBoundsException();
    1807                 :            :     }
    1808                 :            :     else
    1809         [ #  # ]:         45 :         throw uno::RuntimeException();
    1810         [ +  - ]:         90 :     return aRet;
    1811                 :            : }
    1812                 :            : 
    1813                 :          0 : uno::Type SAL_CALL SwXNumberingRulesCollection::getElementType() throw(uno::RuntimeException)
    1814                 :            : {
    1815                 :          0 :     return ::getCppuType((uno::Reference<XIndexReplace>*)0);
    1816                 :            : }
    1817                 :            : 
    1818                 :          0 : sal_Bool SwXNumberingRulesCollection::hasElements(void) throw( uno::RuntimeException )
    1819                 :            : {
    1820         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1821         [ #  # ]:          0 :     if(!IsValid())
    1822         [ #  # ]:          0 :         throw uno::RuntimeException();
    1823         [ #  # ]:          0 :     return !GetDoc()->GetNumRuleTbl().empty();
    1824                 :            : }
    1825                 :            : 
    1826                 :          0 : OUString SwXFootnotes::getImplementationName(void) throw( RuntimeException )
    1827                 :            : {
    1828                 :          0 :     return C2U("SwXFootnotes");
    1829                 :            : }
    1830                 :            : 
    1831                 :          0 : sal_Bool SwXFootnotes::supportsService(const OUString& rServiceName) throw( RuntimeException )
    1832                 :            : {
    1833                 :          0 :     return C2U("com.sun.star.text.Footnotes") == rServiceName;
    1834                 :            : }
    1835                 :            : 
    1836                 :          0 : Sequence< OUString > SwXFootnotes::getSupportedServiceNames(void) throw( RuntimeException )
    1837                 :            : {
    1838                 :          0 :     Sequence< OUString > aRet(1);
    1839         [ #  # ]:          0 :     OUString* pArray = aRet.getArray();
    1840         [ #  # ]:          0 :     pArray[0] = C2U("com.sun.star.text.Footnotes");
    1841                 :          0 :     return aRet;
    1842                 :            : }
    1843                 :            : 
    1844                 :         12 : SwXFootnotes::SwXFootnotes(sal_Bool bEnd, SwDoc* _pDoc)
    1845                 :            :     : SwUnoCollection(_pDoc)
    1846                 :         12 :     , m_bEndnote(bEnd)
    1847                 :            : {
    1848                 :         12 : }
    1849                 :            : 
    1850                 :         12 : SwXFootnotes::~SwXFootnotes()
    1851                 :            : {
    1852         [ -  + ]:         24 : }
    1853                 :            : 
    1854                 :          5 : sal_Int32 SwXFootnotes::getCount(void) throw( uno::RuntimeException )
    1855                 :            : {
    1856         [ +  - ]:          5 :     SolarMutexGuard aGuard;
    1857         [ -  + ]:          5 :     if(!IsValid())
    1858         [ #  # ]:          0 :         throw uno::RuntimeException();
    1859                 :          5 :     sal_Int32 nCount = 0;
    1860                 :          5 :     sal_uInt16 n, nFtnCnt = GetDoc()->GetFtnIdxs().size();
    1861                 :            :     SwTxtFtn* pTxtFtn;
    1862         [ +  + ]:         10 :     for( n = 0; n < nFtnCnt; ++n )
    1863                 :            :     {
    1864         [ +  - ]:          5 :         pTxtFtn = GetDoc()->GetFtnIdxs()[ n ];
    1865                 :          5 :         const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
    1866         [ -  + ]:          5 :         if ( rFtn.IsEndNote() != m_bEndnote )
    1867                 :          0 :             continue;
    1868                 :          5 :         nCount++;
    1869                 :            :     }
    1870         [ +  - ]:          5 :     return nCount;
    1871                 :            : }
    1872                 :            : 
    1873                 :         11 : uno::Any SwXFootnotes::getByIndex(sal_Int32 nIndex)
    1874                 :            :     throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
    1875                 :            : {
    1876         [ +  - ]:         11 :     SolarMutexGuard aGuard;
    1877                 :         11 :     uno::Any aRet;
    1878                 :         11 :     sal_Int32 nCount = 0;
    1879         [ +  - ]:         11 :     if(IsValid())
    1880                 :            :     {
    1881                 :         11 :         sal_uInt16 n, nFtnCnt = GetDoc()->GetFtnIdxs().size();
    1882                 :            :         SwTxtFtn* pTxtFtn;
    1883                 :         11 :         uno::Reference< XFootnote >  xRef;
    1884         [ +  + ]:         13 :         for( n = 0; n < nFtnCnt; ++n )
    1885                 :            :         {
    1886         [ +  - ]:         11 :             pTxtFtn = GetDoc()->GetFtnIdxs()[ n ];
    1887                 :         11 :             const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
    1888         [ -  + ]:         11 :             if ( rFtn.IsEndNote() != m_bEndnote )
    1889                 :          0 :                 continue;
    1890                 :            : 
    1891         [ +  + ]:         11 :             if(nCount == nIndex)
    1892                 :            :             {
    1893 [ +  - ][ +  - ]:          9 :                 xRef = SwXFootnote::CreateXFootnote(*GetDoc(), rFtn);
                 [ +  - ]
    1894         [ +  - ]:          9 :                 aRet <<= xRef;
    1895                 :          9 :                 break;
    1896                 :            :             }
    1897                 :          2 :             nCount++;
    1898                 :            :         }
    1899         [ +  + ]:         11 :         if(!xRef.is())
    1900         [ +  - ]:         11 :             throw IndexOutOfBoundsException();
    1901                 :            :     }
    1902                 :            :     else
    1903         [ #  # ]:          9 :         throw uno::RuntimeException();
    1904         [ +  - ]:         20 :     return aRet;
    1905                 :            : }
    1906                 :            : 
    1907                 :          2 : uno::Type SAL_CALL SwXFootnotes::getElementType() throw(uno::RuntimeException)
    1908                 :            : {
    1909                 :          2 :     return ::getCppuType((uno::Reference<XFootnote>*)0);
    1910                 :            : }
    1911                 :            : 
    1912                 :          4 : sal_Bool SwXFootnotes::hasElements(void) throw( uno::RuntimeException )
    1913                 :            : {
    1914         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    1915         [ -  + ]:          4 :     if(!IsValid())
    1916         [ #  # ]:          0 :         throw uno::RuntimeException();
    1917         [ +  - ]:          4 :     return !GetDoc()->GetFtnIdxs().empty();
    1918                 :            : }
    1919                 :            : 
    1920                 :         34 : Reference<XFootnote>    SwXFootnotes::GetObject( SwDoc& rDoc, const SwFmtFtn& rFmt )
    1921                 :            : {
    1922         [ +  - ]:         34 :     return SwXFootnote::CreateXFootnote(rDoc, rFmt);
    1923                 :            : }
    1924                 :            : 
    1925                 :          0 : OUString SwXReferenceMarks::getImplementationName(void) throw( RuntimeException )
    1926                 :            : {
    1927                 :          0 :     return C2U("SwXReferenceMarks");
    1928                 :            : }
    1929                 :            : 
    1930                 :          0 : sal_Bool SwXReferenceMarks::supportsService(const OUString& rServiceName) throw( RuntimeException )
    1931                 :            : {
    1932                 :          0 :     return C2U("com.sun.star.text.ReferenceMarks") == rServiceName;
    1933                 :            : }
    1934                 :            : 
    1935                 :          0 : Sequence< OUString > SwXReferenceMarks::getSupportedServiceNames(void) throw( RuntimeException )
    1936                 :            : {
    1937                 :          0 :     Sequence< OUString > aRet(1);
    1938         [ #  # ]:          0 :     OUString* pArray = aRet.getArray();
    1939         [ #  # ]:          0 :     pArray[0] = C2U("com.sun.star.text.ReferenceMarks");
    1940                 :          0 :     return aRet;
    1941                 :            : }
    1942                 :            : 
    1943                 :          4 : SwXReferenceMarks::SwXReferenceMarks(SwDoc* _pDoc) :
    1944                 :          4 :     SwUnoCollection(_pDoc)
    1945                 :            : {
    1946                 :          4 : }
    1947                 :            : 
    1948                 :          4 : SwXReferenceMarks::~SwXReferenceMarks()
    1949                 :            : {
    1950         [ -  + ]:          8 : }
    1951                 :            : 
    1952                 :          2 : sal_Int32 SwXReferenceMarks::getCount(void) throw( uno::RuntimeException )
    1953                 :            : {
    1954         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    1955         [ -  + ]:          2 :     if(!IsValid())
    1956         [ #  # ]:          0 :         throw uno::RuntimeException();
    1957 [ +  - ][ +  - ]:          2 :     return GetDoc()->GetRefMarks();
    1958                 :            : }
    1959                 :            : 
    1960                 :          8 : uno::Any SwXReferenceMarks::getByIndex(sal_Int32 nIndex)
    1961                 :            :     throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
    1962                 :            : {
    1963         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    1964                 :          8 :     uno::Any aRet;
    1965         [ -  + ]:          8 :     if(!IsValid())
    1966         [ #  # ]:          0 :         throw uno::RuntimeException();
    1967                 :          8 :     uno::Reference< XTextContent >  xRef;
    1968 [ +  - ][ +  - ]:          8 :     if(0 <= nIndex && nIndex < USHRT_MAX)
    1969                 :            :     {
    1970         [ +  - ]:          8 :         const SwFmtRefMark* pMark = GetDoc()->GetRefMark( (sal_uInt16) nIndex );
    1971         [ +  + ]:          8 :         if(pMark)
    1972                 :            :         {
    1973 [ +  - ][ +  - ]:          6 :             xRef = SwXReferenceMarks::GetObject( GetDoc(), pMark );
                 [ +  - ]
    1974         [ +  - ]:          6 :             aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0));
    1975                 :            :         }
    1976                 :            :     }
    1977         [ +  + ]:          8 :     if(!xRef.is())
    1978         [ +  - ]:          2 :         throw IndexOutOfBoundsException();
    1979         [ +  - ]:          8 :     return aRet;
    1980                 :            : }
    1981                 :            : 
    1982                 :          4 : uno::Any SwXReferenceMarks::getByName(const OUString& rName)
    1983                 :            :     throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException )
    1984                 :            : {
    1985         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    1986                 :          4 :     uno::Any aRet;
    1987         [ +  - ]:          4 :     if(IsValid())
    1988                 :            :     {
    1989 [ +  - ][ +  - ]:          4 :         const SwFmtRefMark* pMark = GetDoc()->GetRefMark(rName);
                 [ +  - ]
    1990         [ +  + ]:          4 :         if(pMark)
    1991                 :            :         {
    1992 [ +  - ][ +  - ]:          2 :             uno::Reference< XTextContent >  xRef = SwXReferenceMarks::GetObject( GetDoc(), pMark );
                 [ +  - ]
    1993         [ +  - ]:          2 :             aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0));
    1994                 :            :         }
    1995                 :            :         else
    1996         [ +  - ]:          2 :             throw NoSuchElementException();
    1997                 :            :     }
    1998                 :            :     else
    1999         [ #  # ]:          2 :         throw uno::RuntimeException();
    2000         [ +  - ]:          6 :     return aRet;
    2001                 :            : }
    2002                 :            : 
    2003                 :          2 : uno::Sequence< OUString > SwXReferenceMarks::getElementNames(void) throw( uno::RuntimeException )
    2004                 :            : {
    2005         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    2006         [ +  - ]:          2 :     uno::Sequence<OUString> aRet;
    2007         [ +  - ]:          2 :     if(IsValid())
    2008                 :            :     {
    2009         [ +  - ]:          2 :         std::vector<rtl::OUString> aStrings;
    2010         [ +  - ]:          2 :         sal_uInt16 nCount = GetDoc()->GetRefMarks( &aStrings );
    2011         [ +  - ]:          2 :         aRet.realloc(nCount);
    2012         [ +  - ]:          2 :         OUString* pNames = aRet.getArray();
    2013         [ +  + ]:          6 :         for(sal_uInt16 i = 0; i < nCount; i++)
    2014                 :          6 :             pNames[i] = aStrings[i];
    2015                 :            :     }
    2016                 :            :     else
    2017         [ #  # ]:          2 :         throw uno::RuntimeException();
    2018         [ +  - ]:          4 :     return aRet;
    2019                 :            : }
    2020                 :            : 
    2021                 :          6 : sal_Bool SwXReferenceMarks::hasByName(const OUString& rName) throw( uno::RuntimeException )
    2022                 :            : {
    2023         [ +  - ]:          6 :     SolarMutexGuard aGuard;
    2024         [ -  + ]:          6 :     if(!IsValid())
    2025         [ #  # ]:          0 :         throw uno::RuntimeException();
    2026 [ +  - ][ +  - ]:          6 :     return 0 != GetDoc()->GetRefMark( rName);
         [ +  - ][ +  - ]
    2027                 :            : }
    2028                 :            : 
    2029                 :          2 : uno::Type SAL_CALL SwXReferenceMarks::getElementType() throw(uno::RuntimeException)
    2030                 :            : {
    2031                 :          2 :     return ::getCppuType((uno::Reference<XTextContent>*)0);
    2032                 :            : }
    2033                 :            : 
    2034                 :          2 : sal_Bool SwXReferenceMarks::hasElements(void) throw( uno::RuntimeException )
    2035                 :            : {
    2036         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    2037         [ -  + ]:          2 :     if(!IsValid())
    2038         [ #  # ]:          0 :         throw uno::RuntimeException();
    2039 [ +  - ][ +  - ]:          2 :     return 0 != GetDoc()->GetRefMarks();
    2040                 :            : }
    2041                 :            : 
    2042                 :          8 : SwXReferenceMark* SwXReferenceMarks::GetObject( SwDoc* pDoc, const SwFmtRefMark* pMark )
    2043                 :            : {
    2044         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    2045                 :            : 
    2046 [ +  - ][ +  - ]:          8 :     return SwXReferenceMark::CreateXReferenceMark(*pDoc, *pMark);
    2047                 :            : }
    2048                 :            : 
    2049                 :            : 
    2050                 :       2570 : void SwUnoCollection::Invalidate()
    2051                 :            : {
    2052                 :       2570 :     bObjectValid = sal_False;
    2053                 :       2570 :     pDoc = 0;
    2054                 :       2570 : }
    2055                 :            : 
    2056                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10