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

Generated by: LCOV version 1.10