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

Generated by: LCOV version 1.10