LCOV - code coverage report
Current view: top level - sw/source/core/unocore - unoftn.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 223 0.0 %
Date: 2014-04-14 Functions: 0 42 0.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             : #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           0 : 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           0 :     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           0 :         , m_pFmtFtn(pFootnote)
      73             :     {
      74           0 :     }
      75             : 
      76           0 :     const SwFmtFtn* GetFootnoteFormat() const {
      77           0 :         return m_rThis.GetDoc() ? m_pFmtFtn : 0;
      78             :     }
      79             : 
      80           0 :     SwFmtFtn const& GetFootnoteFormatOrThrow() {
      81           0 :         SwFmtFtn const*const pFootnote( GetFootnoteFormat() );
      82           0 :         if (!pFootnote) {
      83             :             throw uno::RuntimeException(OUString(
      84           0 :                         "SwXFootnote: disposed or invalid"), 0);
      85             :         }
      86           0 :         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           0 : void SwXFootnote::Impl::Invalidate()
      97             : {
      98           0 :     if (GetRegisteredIn())
      99             :     {
     100           0 :         const_cast<SwModify*>(GetRegisteredIn())->Remove(this);
     101             :     }
     102           0 :     m_pFmtFtn = 0;
     103           0 :     m_rThis.SetDoc(0);
     104           0 :     lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(m_rThis));
     105           0 :     m_EventListeners.disposeAndClear(ev);
     106           0 : }
     107             : 
     108           0 : void SwXFootnote::Impl::Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew)
     109             : {
     110           0 :     ClientModify(this, pOld, pNew);
     111             : 
     112           0 :     if (!GetRegisteredIn()) // removed => dispose
     113             :     {
     114           0 :         Invalidate();
     115             :     }
     116           0 :     else if (pOld)
     117             :     {
     118           0 :         switch (pOld->Which())
     119             :         {
     120             :             case RES_FOOTNOTE_DELETED:
     121           0 :                 if (static_cast<const void*>(m_pFmtFtn) ==
     122             :                         static_cast<const SwPtrMsgPoolItem *>(pOld)->pObject)
     123             :                 {
     124           0 :                     Invalidate();
     125             :                 }
     126           0 :                 break;
     127             :         }
     128             :     }
     129           0 : }
     130             : 
     131           0 : SwXFootnote::SwXFootnote(const bool bEndnote)
     132             :     : SwXText(0, CURSOR_FOOTNOTE)
     133           0 :     , m_pImpl( new SwXFootnote::Impl(*this, 0, 0, bEndnote) )
     134             : {
     135           0 : }
     136             : 
     137           0 : SwXFootnote::SwXFootnote(SwDoc & rDoc, const SwFmtFtn& rFmt)
     138             :     : SwXText(& rDoc, CURSOR_FOOTNOTE)
     139           0 :     , m_pImpl( new SwXFootnote::Impl(*this, &rDoc, &rFmt, rFmt.IsEndNote()) )
     140             : {
     141           0 : }
     142             : 
     143           0 : SwXFootnote::~SwXFootnote()
     144             : {
     145           0 : }
     146             : 
     147             : SwXFootnote *
     148           0 : 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           0 :     return 0;
     157             : }
     158             : 
     159             : SwXFootnote *
     160           0 : SwXFootnote::CreateXFootnote(SwDoc & rDoc, SwFmtFtn const& rFootnoteFmt)
     161             : {
     162             :     SwXFootnote *const pXFootnote(
     163           0 :         GetXFootnote(*rDoc.GetUnoCallBack(), rFootnoteFmt));
     164             :     return (pXFootnote)
     165             :         ?   pXFootnote
     166           0 :         :   new SwXFootnote(rDoc, rFootnoteFmt);
     167             : }
     168             : 
     169             : namespace
     170             : {
     171             :     class theSwXFootnoteUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXFootnoteUnoTunnelId > {};
     172             : }
     173             : 
     174           0 : const uno::Sequence< sal_Int8 > & SwXFootnote::getUnoTunnelId()
     175             : {
     176           0 :     return theSwXFootnoteUnoTunnelId::get().getSeq();
     177             : }
     178             : 
     179             : sal_Int64 SAL_CALL
     180           0 : SwXFootnote::getSomething(const uno::Sequence< sal_Int8 >& rId)
     181             : throw (uno::RuntimeException, std::exception)
     182             : {
     183           0 :     const sal_Int64 nRet( ::sw::UnoTunnelImpl<SwXFootnote>(rId, this) );
     184           0 :     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           0 : sal_Bool SAL_CALL SwXFootnote::supportsService(const OUString& rServiceName)
     206             : throw (uno::RuntimeException, std::exception)
     207             : {
     208           0 :     return cppu::supportsService(this, rServiceName);
     209             : }
     210             : 
     211             : uno::Sequence< OUString > SAL_CALL
     212           0 : SwXFootnote::getSupportedServiceNames() throw (uno::RuntimeException, std::exception)
     213             : {
     214           0 :     SolarMutexGuard g;
     215             :     return ::sw::GetSupportedServiceNamesImpl(
     216           0 :             (m_pImpl->m_bIsEndnote) ? g_nServicesEndnote : g_nServicesFootnote,
     217           0 :             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           0 : SwXFootnote::queryInterface(const uno::Type& rType)
     236             : throw (uno::RuntimeException, std::exception)
     237             : {
     238           0 :     const uno::Any ret = SwXFootnote_Base::queryInterface(rType);
     239           0 :     return (ret.getValueType() == ::getCppuVoidType())
     240             :         ?   SwXText::queryInterface(rType)
     241           0 :         :   ret;
     242             : }
     243             : 
     244           0 : OUString SAL_CALL SwXFootnote::getLabel() throw (uno::RuntimeException, std::exception)
     245             : {
     246           0 :     SolarMutexGuard aGuard;
     247             : 
     248           0 :     OUString sRet;
     249           0 :     SwFmtFtn const*const pFmt = m_pImpl->GetFootnoteFormat();
     250           0 :     if(pFmt)
     251             :     {
     252           0 :         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           0 :     return sRet;
     263             : }
     264             : 
     265             : void SAL_CALL
     266           0 : SwXFootnote::setLabel(const OUString& aLabel) throw (uno::RuntimeException, std::exception)
     267             : {
     268           0 :     SolarMutexGuard aGuard;
     269             : 
     270           0 :     SwFmtFtn const*const pFmt = m_pImpl->GetFootnoteFormat();
     271           0 :     if(pFmt)
     272             :     {
     273           0 :         const SwTxtFtn* pTxtFtn = pFmt->GetTxtFtn();
     274             :         OSL_ENSURE(pTxtFtn, "kein TextNode?");
     275           0 :         SwTxtNode& rTxtNode = (SwTxtNode&)pTxtFtn->GetTxtNode();
     276             : 
     277           0 :         SwPaM aPam(rTxtNode, *pTxtFtn->GetStart());
     278           0 :         GetDoc()->SetCurFtn(aPam, aLabel, pFmt->GetNumber(), pFmt->IsEndNote());
     279             :     }
     280           0 :     else if (m_pImpl->m_bIsDescriptor)
     281             :     {
     282           0 :         m_pImpl->m_sLabel = aLabel;
     283             :     }
     284             :     else
     285             :     {
     286           0 :         throw uno::RuntimeException();
     287           0 :     }
     288           0 : }
     289             : 
     290             : void SAL_CALL
     291           0 : SwXFootnote::attach(const uno::Reference< text::XTextRange > & xTextRange)
     292             : throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
     293             : {
     294           0 :     SolarMutexGuard aGuard;
     295             : 
     296           0 :     if (!m_pImpl->m_bIsDescriptor)
     297             :     {
     298           0 :         throw uno::RuntimeException();
     299             :     }
     300             :     const uno::Reference<lang::XUnoTunnel> xRangeTunnel(
     301           0 :             xTextRange, uno::UNO_QUERY);
     302             :     SwXTextRange *const pRange =
     303           0 :         ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel);
     304             :     OTextCursorHelper *const pCursor =
     305           0 :         ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel);
     306             :     SwDoc *const pNewDoc =
     307           0 :         (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0);
     308           0 :     if (!pNewDoc)
     309             :     {
     310           0 :         throw lang::IllegalArgumentException();
     311             :     }
     312             : 
     313           0 :     SwUnoInternalPaM aPam(*pNewDoc);
     314             :     //das muss jetzt sal_True liefern
     315           0 :     ::sw::XTextRangeToSwPaM(aPam, xTextRange);
     316             : 
     317           0 :     UnoActionContext aCont(pNewDoc);
     318           0 :     pNewDoc->DeleteAndJoin(aPam);
     319           0 :     aPam.DeleteMark();
     320           0 :     SwFmtFtn aFootNote(m_pImpl->m_bIsEndnote);
     321           0 :     if (!m_pImpl->m_sLabel.isEmpty())
     322             :     {
     323           0 :         aFootNote.SetNumStr(m_pImpl->m_sLabel);
     324             :     }
     325             : 
     326             :     SwXTextCursor const*const pTextCursor(
     327           0 :             dynamic_cast<SwXTextCursor*>(pCursor));
     328             :     const bool bForceExpandHints( (pTextCursor)
     329           0 :             ? pTextCursor->IsAtEndOfMeta() : false );
     330             :     const SetAttrMode nInsertFlags = (bForceExpandHints)
     331             :         ? nsSetAttrMode::SETATTR_FORCEHINTEXPAND
     332           0 :         : nsSetAttrMode::SETATTR_DEFAULT;
     333             : 
     334           0 :     pNewDoc->InsertPoolItem(aPam, aFootNote, nInsertFlags);
     335             : 
     336             :     SwTxtFtn *const pTxtAttr = static_cast<SwTxtFtn*>(
     337             :         aPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
     338           0 :                 aPam.GetPoint()->nContent.GetIndex()-1, RES_TXTATR_FTN ));
     339             : 
     340           0 :     if (pTxtAttr)
     341             :     {
     342           0 :         const SwFmtFtn& rFtn = pTxtAttr->GetFtn();
     343           0 :         m_pImpl->m_pFmtFtn = &rFtn;
     344           0 :         pNewDoc->GetUnoCallBack()->Add(m_pImpl.get());
     345             :         // force creation of sequence id - is used for references
     346           0 :         if (pNewDoc->IsInReading())
     347             :         {
     348           0 :             pTxtAttr->SetSeqNo(pNewDoc->GetFtnIdxs().size());
     349             :         }
     350             :         else
     351             :         {
     352           0 :             pTxtAttr->SetSeqRefNo();
     353             :         }
     354             :     }
     355           0 :     m_pImpl->m_bIsDescriptor = false;
     356           0 :     SetDoc(pNewDoc);
     357           0 : }
     358             : 
     359             : uno::Reference< text::XTextRange > SAL_CALL
     360           0 : SwXFootnote::getAnchor() throw (uno::RuntimeException, std::exception)
     361             : {
     362           0 :     SolarMutexGuard aGuard;
     363             : 
     364           0 :     SwFmtFtn const& rFmt( m_pImpl->GetFootnoteFormatOrThrow() );
     365             : 
     366           0 :     SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
     367           0 :     SwPaM aPam( pTxtFtn->GetTxtNode(), *pTxtFtn->GetStart() );
     368           0 :     SwPosition aMark( *aPam.Start() );
     369           0 :     aPam.SetMark();
     370           0 :     aPam.GetMark()->nContent++;
     371             :     const uno::Reference< text::XTextRange > xRet =
     372           0 :         SwXTextRange::CreateXTextRange(*GetDoc(), *aPam.Start(), aPam.End());
     373           0 :     return xRet;
     374             : }
     375             : 
     376           0 : void SAL_CALL SwXFootnote::dispose() throw (uno::RuntimeException, std::exception)
     377             : {
     378           0 :     SolarMutexGuard aGuard;
     379             : 
     380           0 :     SwFmtFtn const& rFmt( m_pImpl->GetFootnoteFormatOrThrow() );
     381             : 
     382           0 :     SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
     383             :     OSL_ENSURE(pTxtFtn, "no TextNode?");
     384           0 :     SwTxtNode& rTxtNode = const_cast<SwTxtNode&>(pTxtFtn->GetTxtNode());
     385           0 :     const sal_Int32 nPos = *pTxtFtn->GetStart();
     386           0 :     SwPaM aPam(rTxtNode, nPos, rTxtNode, nPos+1);
     387           0 :     GetDoc()->DeleteAndJoin( aPam );
     388           0 : }
     389             : 
     390             : void SAL_CALL
     391           0 : 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           0 :     m_pImpl->m_EventListeners.addInterface(xListener);
     397           0 : }
     398             : 
     399             : void SAL_CALL
     400           0 : 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           0 :     m_pImpl->m_EventListeners.removeInterface(xListener);
     406           0 : }
     407             : 
     408           0 : const SwStartNode *SwXFootnote::GetStartNode() const
     409             : {
     410           0 :     SwFmtFtn const*const   pFmt = m_pImpl->GetFootnoteFormat();
     411           0 :     if(pFmt)
     412             :     {
     413           0 :         const SwTxtFtn* pTxtFtn = pFmt->GetTxtFtn();
     414           0 :         if( pTxtFtn )
     415             :         {
     416           0 :             return pTxtFtn->GetStartNode()->GetNode().GetStartNode();
     417             :         }
     418             :     }
     419           0 :     return 0;
     420             : }
     421             : 
     422             : uno::Reference< text::XTextCursor >
     423           0 : SwXFootnote::CreateCursor() throw (uno::RuntimeException)
     424             : {
     425           0 :     return createTextCursor();
     426             : }
     427             : 
     428             : uno::Reference< text::XTextCursor > SAL_CALL
     429           0 : SwXFootnote::createTextCursor() throw (uno::RuntimeException, std::exception)
     430             : {
     431           0 :     SolarMutexGuard aGuard;
     432             : 
     433           0 :     SwFmtFtn const& rFmt( m_pImpl->GetFootnoteFormatOrThrow() );
     434             : 
     435           0 :     SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
     436           0 :     SwPosition aPos( *pTxtFtn->GetStartNode() );
     437             :     SwXTextCursor *const pXCursor =
     438           0 :         new SwXTextCursor(*GetDoc(), this, CURSOR_FOOTNOTE, aPos);
     439           0 :     SwUnoCrsr *const pUnoCrsr = pXCursor->GetCursor();
     440           0 :     pUnoCrsr->Move(fnMoveForward, fnGoNode);
     441             :     const uno::Reference< text::XTextCursor > xRet =
     442           0 :         static_cast<text::XWordCursor*>(pXCursor);
     443           0 :     return xRet;
     444             : }
     445             : 
     446             : uno::Reference< text::XTextCursor > SAL_CALL
     447           0 : SwXFootnote::createTextCursorByRange(
     448             :     const uno::Reference< text::XTextRange > & xTextPosition)
     449             : throw (uno::RuntimeException, std::exception)
     450             : {
     451           0 :     SolarMutexGuard aGuard;
     452             : 
     453           0 :     SwFmtFtn const& rFmt( m_pImpl->GetFootnoteFormatOrThrow() );
     454             : 
     455           0 :     SwUnoInternalPaM aPam(*GetDoc());
     456           0 :     if (!::sw::XTextRangeToSwPaM(aPam, xTextPosition))
     457             :     {
     458           0 :         throw uno::RuntimeException();
     459             :     }
     460             : 
     461           0 :     SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
     462           0 :     SwNode const*const pFtnStartNode = &pTxtFtn->GetStartNode()->GetNode();
     463             : 
     464           0 :     const SwNode* pStart = aPam.GetNode()->FindFootnoteStartNode();
     465           0 :     if (pStart != pFtnStartNode)
     466             :     {
     467           0 :         throw uno::RuntimeException();
     468             :     }
     469             : 
     470             :     const uno::Reference< text::XTextCursor > xRet =
     471             :         static_cast<text::XWordCursor*>(
     472           0 :                 new SwXTextCursor(*GetDoc(), this, CURSOR_FOOTNOTE,
     473           0 :                     *aPam.GetPoint(), aPam.GetMark()));
     474           0 :     return xRet;
     475             : }
     476             : 
     477             : uno::Reference< container::XEnumeration > SAL_CALL
     478           0 : SwXFootnote::createEnumeration() throw (uno::RuntimeException, std::exception)
     479             : {
     480           0 :     SolarMutexGuard aGuard;
     481             : 
     482           0 :     SwFmtFtn const& rFmt( m_pImpl->GetFootnoteFormatOrThrow() );
     483             : 
     484           0 :     SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
     485           0 :     SwPosition aPos( *pTxtFtn->GetStartNode() );
     486             :     ::std::auto_ptr<SwUnoCrsr> pUnoCursor(
     487           0 :         GetDoc()->CreateUnoCrsr(aPos, false));
     488           0 :     pUnoCursor->Move(fnMoveForward, fnGoNode);
     489             :     const uno::Reference< container::XEnumeration >  xRet =
     490           0 :         new SwXParagraphEnumeration(this, pUnoCursor, CURSOR_FOOTNOTE);
     491           0 :     return xRet;
     492             : }
     493             : 
     494           0 : uno::Type SAL_CALL SwXFootnote::getElementType() throw (uno::RuntimeException, std::exception)
     495             : {
     496           0 :     return cppu::UnoType<text::XTextRange>::get();
     497             : }
     498             : 
     499           0 : sal_Bool SAL_CALL SwXFootnote::hasElements() throw (uno::RuntimeException, std::exception)
     500             : {
     501           0 :     return sal_True;
     502             : }
     503             : 
     504             : uno::Reference< beans::XPropertySetInfo > SAL_CALL
     505           0 : SwXFootnote::getPropertySetInfo()
     506             : throw (uno::RuntimeException, std::exception)
     507             : {
     508           0 :     SolarMutexGuard g;
     509             :     static uno::Reference< beans::XPropertySetInfo > xRet =
     510             :         aSwMapProvider.GetPropertySet(PROPERTY_MAP_FOOTNOTE)
     511           0 :             ->getPropertySetInfo();
     512           0 :     return xRet;
     513             : }
     514             : 
     515             : void SAL_CALL
     516           0 : 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           0 :     throw lang::IllegalArgumentException();
     523             : }
     524             : 
     525             : uno::Any SAL_CALL
     526           0 : SwXFootnote::getPropertyValue(const OUString& rPropertyName)
     527             : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     528             :         uno::RuntimeException, std::exception)
     529             : {
     530           0 :     SolarMutexGuard aGuard;
     531             : 
     532           0 :     uno::Any aRet;
     533           0 :     if (! ::sw::GetDefaultTextContentValue(aRet, rPropertyName))
     534             :     {
     535           0 :         if (rPropertyName == UNO_NAME_START_REDLINE ||
     536           0 :             rPropertyName == UNO_NAME_END_REDLINE)
     537             :         {
     538             :             //redline can only be returned if it's a living object
     539           0 :             if (!m_pImpl->m_bIsDescriptor)
     540             :             {
     541           0 :                 aRet = SwXText::getPropertyValue(rPropertyName);
     542             :             }
     543             :         }
     544           0 :         else if (rPropertyName == UNO_NAME_REFERENCE_ID)
     545             :         {
     546           0 :             SwFmtFtn const*const pFmt = m_pImpl->GetFootnoteFormat();
     547           0 :             if (pFmt)
     548             :             {
     549           0 :                 SwTxtFtn const*const pTxtFtn = pFmt->GetTxtFtn();
     550             :                 OSL_ENSURE(pTxtFtn, "no TextNode?");
     551           0 :                 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           0 :     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