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

Generated by: LCOV version 1.10