LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/source/core/unocore - unoftn.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 194 226 85.8 %
Date: 2013-07-09 Functions: 36 44 81.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include <osl/mutex.hxx>
      22             : #include <cppuhelper/interfacecontainer.h>
      23             : #include <vcl/svapp.hxx>
      24             : #include <comphelper/sequence.hxx>
      25             : #include <comphelper/servicehelper.hxx>
      26             : 
      27             : #include <unomid.h>
      28             : #include <unofootnote.hxx>
      29             : #include <unotextrange.hxx>
      30             : #include <unotextcursor.hxx>
      31             : #include <unoparagraph.hxx>
      32             : #include <unomap.hxx>
      33             : #include <unoprnms.hxx>
      34             : #include <doc.hxx>
      35             : #include <ftnidx.hxx>
      36             : #include <fmtftn.hxx>
      37             : #include <txtftn.hxx>
      38             : #include <ndtxt.hxx>
      39             : #include <unocrsr.hxx>
      40             : #include <hints.hxx>
      41             : 
      42             : 
      43             : using namespace ::com::sun::star;
      44             : 
      45             : /******************************************************************
      46             :  * SwXFootnote
      47             :  ******************************************************************/
      48         120 : class SwXFootnote::Impl
      49             :     : public SwClient
      50             : {
      51             : private:
      52             :     ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper
      53             : 
      54             : public:
      55             : 
      56             :     SwXFootnote &               m_rThis;
      57             :     const bool                  m_bIsEndnote;
      58             :     ::cppu::OInterfaceContainerHelper m_EventListeners;
      59             :     bool                        m_bIsDescriptor;
      60             :     const SwFmtFtn *            m_pFmtFtn;
      61             :     OUString             m_sLabel;
      62             : 
      63          60 :     Impl(   SwXFootnote & rThis,
      64             :             SwDoc *const pDoc, SwFmtFtn const*const pFootnote,
      65             :             const bool bIsEndnote)
      66             :         : SwClient((pDoc) ? pDoc->GetUnoCallBack() : 0)
      67             :         , m_rThis(rThis)
      68             :         , m_bIsEndnote(bIsEndnote)
      69             :         , m_EventListeners(m_Mutex)
      70             : // #i111177#: unxsols4 (Sun C++ 5.9 SunOS_sparc) generates wrong code for this
      71             : //        , m_bIsDescriptor(0 == pFootnote)
      72             :         , m_bIsDescriptor((0 == pFootnote) ? true : false)
      73          60 :         , m_pFmtFtn(pFootnote)
      74             :     {
      75          60 :     }
      76             : 
      77         162 :     const SwFmtFtn* GetFootnoteFormat() const {
      78         162 :         return m_rThis.GetDoc() ? m_pFmtFtn : 0;
      79             :     }
      80             : 
      81          91 :     SwFmtFtn const& GetFootnoteFormatOrThrow() {
      82          91 :         SwFmtFtn const*const pFootnote( GetFootnoteFormat() );
      83          91 :         if (!pFootnote) {
      84             :             throw uno::RuntimeException(OUString(
      85           0 :                         "SwXFootnote: disposed or invalid"), 0);
      86             :         }
      87          91 :         return *pFootnote;
      88             :     }
      89             : 
      90             :     void    Invalidate();
      91             : protected:
      92             :     // SwClient
      93             :     virtual void Modify( const SfxPoolItem *pOld, const SfxPoolItem *pNew);
      94             : 
      95             : };
      96             : 
      97          46 : void SwXFootnote::Impl::Invalidate()
      98             : {
      99          46 :     if (GetRegisteredIn())
     100             :     {
     101          25 :         const_cast<SwModify*>(GetRegisteredIn())->Remove(this);
     102             :     }
     103          46 :     m_pFmtFtn = 0;
     104          46 :     m_rThis.SetDoc(0);
     105          46 :     lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(m_rThis));
     106          46 :     m_EventListeners.disposeAndClear(ev);
     107          46 : }
     108             : 
     109          61 : void SwXFootnote::Impl::Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew)
     110             : {
     111          61 :     ClientModify(this, pOld, pNew);
     112             : 
     113          61 :     if (!GetRegisteredIn()) // removed => dispose
     114             :     {
     115          21 :         Invalidate();
     116             :     }
     117          40 :     else if (pOld)
     118             :     {
     119          40 :         switch (pOld->Which())
     120             :         {
     121             :             case RES_FOOTNOTE_DELETED:
     122          40 :                 if (static_cast<const void*>(m_pFmtFtn) ==
     123             :                         static_cast<const SwPtrMsgPoolItem *>(pOld)->pObject)
     124             :                 {
     125          25 :                     Invalidate();
     126             :                 }
     127          40 :                 break;
     128             :         }
     129             :     }
     130          61 : }
     131             : 
     132          35 : SwXFootnote::SwXFootnote(const bool bEndnote)
     133             :     : SwXText(0, CURSOR_FOOTNOTE)
     134          35 :     , m_pImpl( new SwXFootnote::Impl(*this, 0, 0, bEndnote) )
     135             : {
     136          35 : }
     137             : 
     138          25 : SwXFootnote::SwXFootnote(SwDoc & rDoc, const SwFmtFtn& rFmt)
     139             :     : SwXText(& rDoc, CURSOR_FOOTNOTE)
     140          25 :     , m_pImpl( new SwXFootnote::Impl(*this, &rDoc, &rFmt, rFmt.IsEndNote()) )
     141             : {
     142          25 : }
     143             : 
     144         120 : SwXFootnote::~SwXFootnote()
     145             : {
     146         120 : }
     147             : 
     148             : SwXFootnote *
     149          25 : SwXFootnote::GetXFootnote(
     150             :         SwModify const& /*rUnoCB*/, SwFmtFtn const& /*rFootnoteFmt*/)
     151             : {
     152             :     // re-use existing SwXFootnote
     153             :     // #i105557#: do not iterate over the registered clients: race condition
     154             :     // to do this properly requires the SwXFootnote to register at the
     155             :     // SwFmtFtn directly, not at the unocallback
     156             :     // also this function must return a uno Reference!
     157          25 :     return 0;
     158             : }
     159             : 
     160             : SwXFootnote *
     161          25 : SwXFootnote::CreateXFootnote(SwDoc & rDoc, SwFmtFtn const& rFootnoteFmt)
     162             : {
     163             :     SwXFootnote *const pXFootnote(
     164          25 :         GetXFootnote(*rDoc.GetUnoCallBack(), rFootnoteFmt));
     165             :     return (pXFootnote)
     166             :         ?   pXFootnote
     167          25 :         :   new SwXFootnote(rDoc, rFootnoteFmt);
     168             : }
     169             : 
     170             : namespace
     171             : {
     172             :     class theSwXFootnoteUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXFootnoteUnoTunnelId > {};
     173             : }
     174             : 
     175         165 : const uno::Sequence< sal_Int8 > & SwXFootnote::getUnoTunnelId()
     176             : {
     177         165 :     return theSwXFootnoteUnoTunnelId::get().getSeq();
     178             : }
     179             : 
     180             : sal_Int64 SAL_CALL
     181         165 : SwXFootnote::getSomething(const uno::Sequence< sal_Int8 >& rId)
     182             : throw (uno::RuntimeException)
     183             : {
     184         165 :     const sal_Int64 nRet( ::sw::UnoTunnelImpl<SwXFootnote>(rId, this) );
     185         165 :     return (nRet) ? nRet : SwXText::getSomething(rId);
     186             : }
     187             : 
     188             : OUString SAL_CALL
     189           0 : SwXFootnote::getImplementationName() throw (uno::RuntimeException)
     190             : {
     191           0 :     return OUString("SwXFootnote");
     192             : }
     193             : 
     194             : static char const*const g_ServicesFootnote[] =
     195             : {
     196             :     "com.sun.star.text.TextContent",
     197             :     "com.sun.star.text.Footnote",
     198             :     "com.sun.star.text.Text",
     199             :     "com.sun.star.text.Endnote", // NB: only supported for endnotes!
     200             : };
     201             : 
     202             : static const size_t g_nServicesEndnote( sizeof (g_ServicesFootnote) / sizeof (g_ServicesFootnote[0]) );
     203             : 
     204             : static const size_t g_nServicesFootnote( g_nServicesEndnote - 1 ); // NB: omit!
     205             : 
     206           2 : sal_Bool SAL_CALL SwXFootnote::supportsService(const OUString& rServiceName)
     207             : throw (uno::RuntimeException)
     208             : {
     209           2 :     SolarMutexGuard g;
     210             :     return ::sw::SupportsServiceImpl(
     211           2 :             (m_pImpl->m_bIsEndnote) ? g_nServicesEndnote : g_nServicesFootnote,
     212           2 :             g_ServicesFootnote, rServiceName);
     213             : }
     214             : 
     215             : uno::Sequence< OUString > SAL_CALL
     216           0 : SwXFootnote::getSupportedServiceNames() throw (uno::RuntimeException)
     217             : {
     218           0 :     SolarMutexGuard g;
     219             :     return ::sw::GetSupportedServiceNamesImpl(
     220           0 :             (m_pImpl->m_bIsEndnote) ? g_nServicesEndnote : g_nServicesFootnote,
     221           0 :             g_ServicesFootnote);
     222             : }
     223             : 
     224             : uno::Sequence< uno::Type > SAL_CALL
     225           0 : SwXFootnote::getTypes() throw (uno::RuntimeException)
     226             : {
     227           0 :     const uno::Sequence< uno::Type > aTypes = SwXFootnote_Base::getTypes();
     228           0 :     const uno::Sequence< uno::Type > aTextTypes = SwXText::getTypes();
     229           0 :     return ::comphelper::concatSequences(aTypes, aTextTypes);
     230             : }
     231             : 
     232             : namespace
     233             : {
     234             :     class theSwXFootnoteImplementationId : public rtl::Static< UnoTunnelIdInit, theSwXFootnoteImplementationId > {};
     235             : }
     236             : 
     237             : uno::Sequence< sal_Int8 > SAL_CALL
     238           0 : SwXFootnote::getImplementationId() throw (uno::RuntimeException)
     239             : {
     240           0 :     return theSwXFootnoteImplementationId::get().getSeq();
     241             : }
     242             : 
     243             : uno::Any SAL_CALL
     244         208 : SwXFootnote::queryInterface(const uno::Type& rType)
     245             : throw (uno::RuntimeException)
     246             : {
     247         208 :     const uno::Any ret = SwXFootnote_Base::queryInterface(rType);
     248         208 :     return (ret.getValueType() == ::getCppuVoidType())
     249             :         ?   SwXText::queryInterface(rType)
     250         208 :         :   ret;
     251             : }
     252             : 
     253          20 : OUString SAL_CALL SwXFootnote::getLabel() throw (uno::RuntimeException)
     254             : {
     255          20 :     SolarMutexGuard aGuard;
     256             : 
     257          20 :     OUString sRet;
     258          20 :     SwFmtFtn const*const pFmt = m_pImpl->GetFootnoteFormat();
     259          20 :     if(pFmt)
     260             :     {
     261          20 :         sRet = pFmt->GetNumStr();
     262             :     }
     263           0 :     else if (m_pImpl->m_bIsDescriptor)
     264             :     {
     265           0 :         sRet = m_pImpl->m_sLabel;
     266             :     }
     267             :     else
     268             :     {
     269           0 :         throw uno::RuntimeException();
     270             :     }
     271          20 :     return sRet;
     272             : }
     273             : 
     274             : void SAL_CALL
     275          20 : SwXFootnote::setLabel(const OUString& aLabel) throw (uno::RuntimeException)
     276             : {
     277          20 :     SolarMutexGuard aGuard;
     278             : 
     279          20 :     SwFmtFtn const*const pFmt = m_pImpl->GetFootnoteFormat();
     280          20 :     if(pFmt)
     281             :     {
     282           2 :         const SwTxtFtn* pTxtFtn = pFmt->GetTxtFtn();
     283             :         OSL_ENSURE(pTxtFtn, "kein TextNode?");
     284           2 :         SwTxtNode& rTxtNode = (SwTxtNode&)pTxtFtn->GetTxtNode();
     285             : 
     286           2 :         SwPaM aPam(rTxtNode, *pTxtFtn->GetStart());
     287           2 :         GetDoc()->SetCurFtn(aPam, aLabel, pFmt->GetNumber(), pFmt->IsEndNote());
     288             :     }
     289          18 :     else if (m_pImpl->m_bIsDescriptor)
     290             :     {
     291          18 :         m_pImpl->m_sLabel = String(aLabel);
     292             :     }
     293             :     else
     294             :     {
     295           0 :         throw uno::RuntimeException();
     296          20 :     }
     297          20 : }
     298             : 
     299             : void SAL_CALL
     300          35 : SwXFootnote::attach(const uno::Reference< text::XTextRange > & xTextRange)
     301             : throw (lang::IllegalArgumentException, uno::RuntimeException)
     302             : {
     303          35 :     SolarMutexGuard aGuard;
     304             : 
     305          35 :     if (!m_pImpl->m_bIsDescriptor)
     306             :     {
     307           0 :         throw uno::RuntimeException();
     308             :     }
     309             :     const uno::Reference<lang::XUnoTunnel> xRangeTunnel(
     310          70 :             xTextRange, uno::UNO_QUERY);
     311             :     SwXTextRange *const pRange =
     312          35 :         ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel);
     313             :     OTextCursorHelper *const pCursor =
     314          35 :         ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel);
     315             :     SwDoc *const pNewDoc =
     316          35 :         (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0);
     317          35 :     if (!pNewDoc)
     318             :     {
     319           0 :         throw lang::IllegalArgumentException();
     320             :     }
     321             : 
     322          70 :     SwUnoInternalPaM aPam(*pNewDoc);
     323             :     //das muss jetzt sal_True liefern
     324          35 :     ::sw::XTextRangeToSwPaM(aPam, xTextRange);
     325             : 
     326          70 :     UnoActionContext aCont(pNewDoc);
     327          35 :     pNewDoc->DeleteAndJoin(aPam);
     328          35 :     aPam.DeleteMark();
     329          70 :     SwFmtFtn aFootNote(m_pImpl->m_bIsEndnote);
     330          35 :     if (!m_pImpl->m_sLabel.isEmpty())
     331             :     {
     332          18 :         aFootNote.SetNumStr(m_pImpl->m_sLabel);
     333             :     }
     334             : 
     335             :     SwXTextCursor const*const pTextCursor(
     336          35 :             dynamic_cast<SwXTextCursor*>(pCursor));
     337             :     const bool bForceExpandHints( (pTextCursor)
     338          35 :             ? pTextCursor->IsAtEndOfMeta() : false );
     339             :     const SetAttrMode nInsertFlags = (bForceExpandHints)
     340             :         ? nsSetAttrMode::SETATTR_FORCEHINTEXPAND
     341          35 :         : nsSetAttrMode::SETATTR_DEFAULT;
     342             : 
     343          35 :     pNewDoc->InsertPoolItem(aPam, aFootNote, nInsertFlags);
     344             : 
     345             :     SwTxtFtn *const pTxtAttr = static_cast<SwTxtFtn*>(
     346             :         aPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
     347          35 :                 aPam.GetPoint()->nContent.GetIndex()-1, RES_TXTATR_FTN ));
     348             : 
     349          35 :     if (pTxtAttr)
     350             :     {
     351          35 :         const SwFmtFtn& rFtn = pTxtAttr->GetFtn();
     352          35 :         m_pImpl->m_pFmtFtn = &rFtn;
     353          35 :         pNewDoc->GetUnoCallBack()->Add(m_pImpl.get());
     354             :         // force creation of sequence id - is used for references
     355          35 :         if (pNewDoc->IsInReading())
     356             :         {
     357           7 :             pTxtAttr->SetSeqNo(pNewDoc->GetFtnIdxs().size());
     358             :         }
     359             :         else
     360             :         {
     361          28 :             pTxtAttr->SetSeqRefNo();
     362             :         }
     363             :     }
     364          35 :     m_pImpl->m_bIsDescriptor = sal_False;
     365          70 :     SetDoc(pNewDoc);
     366          35 : }
     367             : 
     368             : uno::Reference< text::XTextRange > SAL_CALL
     369           6 : SwXFootnote::getAnchor() throw (uno::RuntimeException)
     370             : {
     371           6 :     SolarMutexGuard aGuard;
     372             : 
     373           6 :     SwFmtFtn const& rFmt( m_pImpl->GetFootnoteFormatOrThrow() );
     374             : 
     375           6 :     SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
     376          12 :     SwPaM aPam( pTxtFtn->GetTxtNode(), *pTxtFtn->GetStart() );
     377          12 :     SwPosition aMark( *aPam.Start() );
     378           6 :     aPam.SetMark();
     379           6 :     aPam.GetMark()->nContent++;
     380             :     const uno::Reference< text::XTextRange > xRet =
     381           6 :         SwXTextRange::CreateXTextRange(*GetDoc(), *aPam.Start(), aPam.End());
     382          12 :     return xRet;
     383             : }
     384             : 
     385           1 : void SAL_CALL SwXFootnote::dispose() throw (uno::RuntimeException)
     386             : {
     387           1 :     SolarMutexGuard aGuard;
     388             : 
     389           1 :     SwFmtFtn const& rFmt( m_pImpl->GetFootnoteFormatOrThrow() );
     390             : 
     391           1 :     SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
     392             :     OSL_ENSURE(pTxtFtn, "no TextNode?");
     393           1 :     SwTxtNode& rTxtNode = const_cast<SwTxtNode&>(pTxtFtn->GetTxtNode());
     394           1 :     const xub_StrLen nPos = *pTxtFtn->GetStart();
     395           2 :     SwPaM aPam(rTxtNode, nPos, rTxtNode, nPos+1);
     396           2 :     GetDoc()->DeleteAndJoin( aPam );
     397           1 : }
     398             : 
     399             : void SAL_CALL
     400           2 : SwXFootnote::addEventListener(
     401             :     const uno::Reference< lang::XEventListener > & xListener)
     402             : throw (uno::RuntimeException)
     403             : {
     404             :     // no need to lock here as m_pImpl is const and container threadsafe
     405           2 :     m_pImpl->m_EventListeners.addInterface(xListener);
     406           2 : }
     407             : 
     408             : void SAL_CALL
     409           1 : SwXFootnote::removeEventListener(
     410             :     const uno::Reference< lang::XEventListener > & xListener)
     411             : throw (uno::RuntimeException)
     412             : {
     413             :     // no need to lock here as m_pImpl is const and container threadsafe
     414           1 :     m_pImpl->m_EventListeners.removeInterface(xListener);
     415           1 : }
     416             : 
     417          26 : const SwStartNode *SwXFootnote::GetStartNode() const
     418             : {
     419          26 :     SwFmtFtn const*const   pFmt = m_pImpl->GetFootnoteFormat();
     420          26 :     if(pFmt)
     421             :     {
     422          26 :         const SwTxtFtn* pTxtFtn = pFmt->GetTxtFtn();
     423          26 :         if( pTxtFtn )
     424             :         {
     425          26 :             return pTxtFtn->GetStartNode()->GetNode().GetStartNode();
     426             :         }
     427             :     }
     428           0 :     return 0;
     429             : }
     430             : 
     431             : uno::Reference< text::XTextCursor >
     432          51 : SwXFootnote::CreateCursor() throw (uno::RuntimeException)
     433             : {
     434          51 :     return createTextCursor();
     435             : }
     436             : 
     437             : uno::Reference< text::XTextCursor > SAL_CALL
     438          75 : SwXFootnote::createTextCursor() throw (uno::RuntimeException)
     439             : {
     440          75 :     SolarMutexGuard aGuard;
     441             : 
     442          75 :     SwFmtFtn const& rFmt( m_pImpl->GetFootnoteFormatOrThrow() );
     443             : 
     444          75 :     SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
     445         150 :     SwPosition aPos( *pTxtFtn->GetStartNode() );
     446             :     SwXTextCursor *const pXCursor =
     447          75 :         new SwXTextCursor(*GetDoc(), this, CURSOR_FOOTNOTE, aPos);
     448          75 :     SwUnoCrsr *const pUnoCrsr = pXCursor->GetCursor();
     449          75 :     pUnoCrsr->Move(fnMoveForward, fnGoNode);
     450             :     const uno::Reference< text::XTextCursor > xRet =
     451          75 :         static_cast<text::XWordCursor*>(pXCursor);
     452         150 :     return xRet;
     453             : }
     454             : 
     455             : uno::Reference< text::XTextCursor > SAL_CALL
     456           7 : SwXFootnote::createTextCursorByRange(
     457             :     const uno::Reference< text::XTextRange > & xTextPosition)
     458             : throw (uno::RuntimeException)
     459             : {
     460           7 :     SolarMutexGuard aGuard;
     461             : 
     462           7 :     SwFmtFtn const& rFmt( m_pImpl->GetFootnoteFormatOrThrow() );
     463             : 
     464          14 :     SwUnoInternalPaM aPam(*GetDoc());
     465           7 :     if (!::sw::XTextRangeToSwPaM(aPam, xTextPosition))
     466             :     {
     467           0 :         throw uno::RuntimeException();
     468             :     }
     469             : 
     470           7 :     SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
     471           7 :     SwNode const*const pFtnStartNode = &pTxtFtn->GetStartNode()->GetNode();
     472             : 
     473           7 :     const SwNode* pStart = aPam.GetNode()->FindFootnoteStartNode();
     474           7 :     if (pStart != pFtnStartNode)
     475             :     {
     476           0 :         throw uno::RuntimeException();
     477             :     }
     478             : 
     479             :     const uno::Reference< text::XTextCursor > xRet =
     480             :         static_cast<text::XWordCursor*>(
     481           7 :                 new SwXTextCursor(*GetDoc(), this, CURSOR_FOOTNOTE,
     482           7 :                     *aPam.GetPoint(), aPam.GetMark()));
     483          14 :     return xRet;
     484             : }
     485             : 
     486             : uno::Reference< container::XEnumeration > SAL_CALL
     487           2 : SwXFootnote::createEnumeration() throw (uno::RuntimeException)
     488             : {
     489           2 :     SolarMutexGuard aGuard;
     490             : 
     491           2 :     SwFmtFtn const& rFmt( m_pImpl->GetFootnoteFormatOrThrow() );
     492             : 
     493           2 :     SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
     494           4 :     SwPosition aPos( *pTxtFtn->GetStartNode() );
     495             :     ::std::auto_ptr<SwUnoCrsr> pUnoCursor(
     496           4 :         GetDoc()->CreateUnoCrsr(aPos, false));
     497           2 :     pUnoCursor->Move(fnMoveForward, fnGoNode);
     498             :     const uno::Reference< container::XEnumeration >  xRet =
     499           2 :         new SwXParagraphEnumeration(this, pUnoCursor, CURSOR_FOOTNOTE);
     500           4 :     return xRet;
     501             : }
     502             : 
     503           1 : uno::Type SAL_CALL SwXFootnote::getElementType() throw (uno::RuntimeException)
     504             : {
     505           1 :     return text::XTextRange::static_type();
     506             : }
     507             : 
     508           1 : sal_Bool SAL_CALL SwXFootnote::hasElements() throw (uno::RuntimeException)
     509             : {
     510           1 :     return sal_True;
     511             : }
     512             : 
     513             : uno::Reference< beans::XPropertySetInfo > SAL_CALL
     514           4 : SwXFootnote::getPropertySetInfo()
     515             : throw (uno::RuntimeException)
     516             : {
     517           4 :     SolarMutexGuard g;
     518             :     static uno::Reference< beans::XPropertySetInfo > xRet =
     519             :         aSwMapProvider.GetPropertySet(PROPERTY_MAP_FOOTNOTE)
     520           4 :             ->getPropertySetInfo();
     521           4 :     return xRet;
     522             : }
     523             : 
     524             : void SAL_CALL
     525           1 : SwXFootnote::setPropertyValue(const OUString&, const uno::Any&)
     526             : throw (beans::UnknownPropertyException, beans::PropertyVetoException,
     527             :         lang::IllegalArgumentException, lang::WrappedTargetException,
     528             :         uno::RuntimeException)
     529             : {
     530             :     //no values to be set
     531           1 :     throw lang::IllegalArgumentException();
     532             : }
     533             : 
     534             : uno::Any SAL_CALL
     535           7 : SwXFootnote::getPropertyValue(const OUString& rPropertyName)
     536             : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     537             :         uno::RuntimeException)
     538             : {
     539           7 :     SolarMutexGuard aGuard;
     540             : 
     541           7 :     uno::Any aRet;
     542           7 :     if (! ::sw::GetDefaultTextContentValue(aRet, rPropertyName))
     543             :     {
     544          13 :         if (rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_START_REDLINE)) ||
     545           6 :             rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_END_REDLINE)))
     546             :         {
     547             :             //redline can only be returned if it's a living object
     548           2 :             if (!m_pImpl->m_bIsDescriptor)
     549             :             {
     550           2 :                 aRet = SwXText::getPropertyValue(rPropertyName);
     551             :             }
     552             :         }
     553           5 :         else if (rPropertyName.equalsAsciiL(
     554           5 :                     SW_PROP_NAME(UNO_NAME_REFERENCE_ID)))
     555             :         {
     556           5 :             SwFmtFtn const*const pFmt = m_pImpl->GetFootnoteFormat();
     557           5 :             if (pFmt)
     558             :             {
     559           5 :                 SwTxtFtn const*const pTxtFtn = pFmt->GetTxtFtn();
     560             :                 OSL_ENSURE(pTxtFtn, "no TextNode?");
     561           5 :                 aRet <<= static_cast<sal_Int16>(pTxtFtn->GetSeqRefNo());
     562             :             }
     563             :         }
     564             :         else
     565             :         {
     566           0 :             beans::UnknownPropertyException aExcept;
     567           0 :             aExcept.Message = rPropertyName;
     568           0 :             throw aExcept;
     569             :         }
     570             :     }
     571           7 :     return aRet;
     572             : }
     573             : 
     574             : void SAL_CALL
     575           0 : SwXFootnote::addPropertyChangeListener(
     576             :         const OUString& /*rPropertyName*/,
     577             :         const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
     578             : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     579             :     uno::RuntimeException)
     580             : {
     581             :     OSL_FAIL("SwXFootnote::addPropertyChangeListener(): not implemented");
     582           0 : }
     583             : 
     584             : void SAL_CALL
     585           0 : SwXFootnote::removePropertyChangeListener(
     586             :         const OUString& /*rPropertyName*/,
     587             :         const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
     588             : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     589             :     uno::RuntimeException)
     590             : {
     591             :     OSL_FAIL("SwXFootnote::removePropertyChangeListener(): not implemented");
     592           0 : }
     593             : 
     594             : void SAL_CALL
     595           0 : SwXFootnote::addVetoableChangeListener(
     596             :         const OUString& /*rPropertyName*/,
     597             :         const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
     598             : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     599             :     uno::RuntimeException)
     600             : {
     601             :     OSL_FAIL("SwXFootnote::addVetoableChangeListener(): not implemented");
     602           0 : }
     603             : 
     604             : void SAL_CALL
     605           0 : SwXFootnote::removeVetoableChangeListener(
     606             :         const OUString& /*rPropertyName*/,
     607             :         const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
     608             : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     609             :         uno::RuntimeException)
     610             : {
     611             :     OSL_FAIL("SwXFootnote::removeVetoableChangeListener(): not implemented");
     612          99 : }
     613             : 
     614             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10