LCOV - code coverage report
Current view: top level - sw/source/core/unocore - unoftn.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 199 228 87.3 %
Date: 2015-06-13 12:38:46 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         276 : 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 SwFormatFootnote *            m_pFormatFootnote;
      62             :     OUString             m_sLabel;
      63             : 
      64         138 :     Impl(   SwXFootnote & rThis,
      65             :             SwFormatFootnote *const pFootnote,
      66             :             const bool bIsEndnote)
      67             :         : SwClient(pFootnote)
      68             :         , m_rThis(rThis)
      69             :         , m_bIsEndnote(bIsEndnote)
      70             :         , m_EventListeners(m_Mutex)
      71         138 :         , m_bIsDescriptor(0 == pFootnote)
      72         276 :         , m_pFormatFootnote(pFootnote)
      73             :     {
      74         138 :     }
      75             : 
      76         928 :     const SwFormatFootnote* GetFootnoteFormat() const {
      77         928 :         return m_rThis.GetDoc() ? m_pFormatFootnote : 0;
      78             :     }
      79             : 
      80         671 :     SwFormatFootnote const& GetFootnoteFormatOrThrow() {
      81         671 :         SwFormatFootnote const*const pFootnote( GetFootnoteFormat() );
      82         671 :         if (!pFootnote) {
      83             :             throw uno::RuntimeException(OUString(
      84           0 :                         "SwXFootnote: disposed or invalid"), 0);
      85             :         }
      86         671 :         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          42 : void SwXFootnote::Impl::Invalidate()
      97             : {
      98          42 :     if (GetRegisteredIn())
      99             :     {
     100           0 :         GetRegisteredIn()->Remove(this);
     101             :     }
     102          42 :     m_pFormatFootnote = 0;
     103          42 :     m_rThis.SetDoc(0);
     104          42 :     uno::Reference<uno::XInterface> const xThis(m_wThis);
     105          42 :     if (!xThis.is())
     106             :     {   // fdo#72695: if UNO object is already dead, don't revive it with event
     107          42 :         return;
     108             :     }
     109          84 :     lang::EventObject const ev(xThis);
     110          84 :     m_EventListeners.disposeAndClear(ev);
     111             : }
     112             : 
     113          42 : void SwXFootnote::Impl::Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew)
     114             : {
     115          42 :     ClientModify(this, pOld, pNew);
     116             : 
     117          42 :     if (!GetRegisteredIn()) // removed => dispose
     118             :     {
     119          42 :         Invalidate();
     120             :     }
     121          42 : }
     122             : 
     123         104 : SwXFootnote::SwXFootnote(const bool bEndnote)
     124             :     : SwXText(0, CURSOR_FOOTNOTE)
     125         104 :     , m_pImpl( new SwXFootnote::Impl(*this, 0, bEndnote) )
     126             : {
     127         104 : }
     128             : 
     129          34 : SwXFootnote::SwXFootnote(SwDoc & rDoc, SwFormatFootnote & rFormat)
     130             :     : SwXText(& rDoc, CURSOR_FOOTNOTE)
     131          34 :     , m_pImpl( new SwXFootnote::Impl(*this, &rFormat, rFormat.IsEndNote()) )
     132             : {
     133          34 : }
     134             : 
     135         276 : SwXFootnote::~SwXFootnote()
     136             : {
     137         276 : }
     138             : 
     139             : uno::Reference<text::XFootnote>
     140         140 : SwXFootnote::CreateXFootnote(SwDoc & rDoc, SwFormatFootnote *const pFootnoteFormat,
     141             :         bool const isEndnote)
     142             : {
     143             :     // i#105557: do not iterate over the registered clients: race condition
     144         140 :     uno::Reference<text::XFootnote> xNote;
     145         140 :     if (pFootnoteFormat)
     146             :     {
     147          36 :         xNote = pFootnoteFormat->GetXFootnote();
     148             :     }
     149         140 :     if (!xNote.is())
     150             :     {
     151             :         SwXFootnote *const pNote((pFootnoteFormat)
     152          34 :                 ? new SwXFootnote(rDoc, *pFootnoteFormat)
     153         172 :                 : new SwXFootnote(isEndnote));
     154         138 :         xNote.set(pNote);
     155         138 :         if (pFootnoteFormat)
     156             :         {
     157          34 :             pFootnoteFormat->SetXFootnote(xNote);
     158             :         }
     159             :         // need a permanent Reference to initialize m_wThis
     160         138 :         pNote->m_pImpl->m_wThis = xNote;
     161             :     }
     162         140 :     return xNote;
     163             : }
     164             : 
     165             : namespace
     166             : {
     167             :     class theSwXFootnoteUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXFootnoteUnoTunnelId > {};
     168             : }
     169             : 
     170         598 : const uno::Sequence< sal_Int8 > & SwXFootnote::getUnoTunnelId()
     171             : {
     172         598 :     return theSwXFootnoteUnoTunnelId::get().getSeq();
     173             : }
     174             : 
     175             : sal_Int64 SAL_CALL
     176         598 : SwXFootnote::getSomething(const uno::Sequence< sal_Int8 >& rId)
     177             : throw (uno::RuntimeException, std::exception)
     178             : {
     179         598 :     const sal_Int64 nRet( ::sw::UnoTunnelImpl<SwXFootnote>(rId, this) );
     180         598 :     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           2 : sal_Bool SAL_CALL SwXFootnote::supportsService(const OUString& rServiceName)
     202             : throw (uno::RuntimeException, std::exception)
     203             : {
     204           2 :     return cppu::supportsService(this, rServiceName);
     205             : }
     206             : 
     207             : uno::Sequence< OUString > SAL_CALL
     208           2 : SwXFootnote::getSupportedServiceNames() throw (uno::RuntimeException, std::exception)
     209             : {
     210           2 :     SolarMutexGuard g;
     211             :     return ::sw::GetSupportedServiceNamesImpl(
     212           2 :             (m_pImpl->m_bIsEndnote) ? g_nServicesEndnote : g_nServicesFootnote,
     213           2 :             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         787 : SwXFootnote::queryInterface(const uno::Type& rType)
     232             : throw (uno::RuntimeException, std::exception)
     233             : {
     234         787 :     const uno::Any ret = SwXFootnote_Base::queryInterface(rType);
     235         787 :     return (ret.getValueType() == cppu::UnoType<void>::get())
     236             :         ?   SwXText::queryInterface(rType)
     237         787 :         :   ret;
     238             : }
     239             : 
     240          20 : OUString SAL_CALL SwXFootnote::getLabel() throw (uno::RuntimeException, std::exception)
     241             : {
     242          20 :     SolarMutexGuard aGuard;
     243             : 
     244          20 :     OUString sRet;
     245          20 :     SwFormatFootnote const*const pFormat = m_pImpl->GetFootnoteFormat();
     246          20 :     if(pFormat)
     247             :     {
     248          20 :         sRet = pFormat->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          20 :     return sRet;
     259             : }
     260             : 
     261             : void SAL_CALL
     262          20 : SwXFootnote::setLabel(const OUString& aLabel) throw (uno::RuntimeException, std::exception)
     263             : {
     264          20 :     SolarMutexGuard aGuard;
     265             : 
     266          20 :     SwFormatFootnote const*const pFormat = m_pImpl->GetFootnoteFormat();
     267          20 :     if(pFormat)
     268             :     {
     269           2 :         const SwTextFootnote* pTextFootnote = pFormat->GetTextFootnote();
     270             :         OSL_ENSURE(pTextFootnote, "kein TextNode?");
     271           2 :         SwTextNode& rTextNode = (SwTextNode&)pTextFootnote->GetTextNode();
     272             : 
     273           2 :         SwPaM aPam(rTextNode, pTextFootnote->GetStart());
     274           2 :         GetDoc()->SetCurFootnote(aPam, aLabel, pFormat->GetNumber(), pFormat->IsEndNote());
     275             :     }
     276          18 :     else if (m_pImpl->m_bIsDescriptor)
     277             :     {
     278          18 :         m_pImpl->m_sLabel = aLabel;
     279             :     }
     280             :     else
     281             :     {
     282           0 :         throw uno::RuntimeException();
     283          20 :     }
     284          20 : }
     285             : 
     286             : void SAL_CALL
     287         104 : SwXFootnote::attach(const uno::Reference< text::XTextRange > & xTextRange)
     288             : throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
     289             : {
     290         104 :     SolarMutexGuard aGuard;
     291             : 
     292         104 :     if (!m_pImpl->m_bIsDescriptor)
     293             :     {
     294           0 :         throw uno::RuntimeException();
     295             :     }
     296             :     const uno::Reference<lang::XUnoTunnel> xRangeTunnel(
     297         208 :             xTextRange, uno::UNO_QUERY);
     298             :     SwXTextRange *const pRange =
     299         104 :         ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel);
     300             :     OTextCursorHelper *const pCursor =
     301         104 :         ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel);
     302             :     SwDoc *const pNewDoc =
     303         104 :         (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0);
     304         104 :     if (!pNewDoc)
     305             :     {
     306           0 :         throw lang::IllegalArgumentException();
     307             :     }
     308             : 
     309         208 :     SwUnoInternalPaM aPam(*pNewDoc);
     310             :     // this now needs to return TRUE
     311         104 :     ::sw::XTextRangeToSwPaM(aPam, xTextRange);
     312             : 
     313         208 :     UnoActionContext aCont(pNewDoc);
     314         104 :     pNewDoc->getIDocumentContentOperations().DeleteAndJoin(aPam);
     315         104 :     aPam.DeleteMark();
     316         208 :     SwFormatFootnote aFootNote(m_pImpl->m_bIsEndnote);
     317         104 :     if (!m_pImpl->m_sLabel.isEmpty())
     318             :     {
     319          18 :         aFootNote.SetNumStr(m_pImpl->m_sLabel);
     320             :     }
     321             : 
     322             :     SwXTextCursor const*const pTextCursor(
     323         104 :             dynamic_cast<SwXTextCursor*>(pCursor));
     324         104 :     const bool bForceExpandHints( pTextCursor && pTextCursor->IsAtEndOfMeta() );
     325             :     const SetAttrMode nInsertFlags = (bForceExpandHints)
     326             :         ? SetAttrMode::FORCEHINTEXPAND
     327         104 :         : SetAttrMode::DEFAULT;
     328             : 
     329         104 :     pNewDoc->getIDocumentContentOperations().InsertPoolItem(aPam, aFootNote, nInsertFlags);
     330             : 
     331             :     SwTextFootnote *const pTextAttr = static_cast<SwTextFootnote*>(
     332         104 :         aPam.GetNode().GetTextNode()->GetTextAttrForCharAt(
     333         208 :                 aPam.GetPoint()->nContent.GetIndex()-1, RES_TXTATR_FTN ));
     334             : 
     335         104 :     if (pTextAttr)
     336             :     {
     337         104 :         const SwFormatFootnote& rFootnote = pTextAttr->GetFootnote();
     338         104 :         m_pImpl->m_pFormatFootnote = &rFootnote;
     339         104 :         const_cast<SwFormatFootnote*>(m_pImpl->m_pFormatFootnote)->Add(m_pImpl.get());
     340             :         // force creation of sequence id - is used for references
     341         104 :         if (pNewDoc->IsInReading())
     342             :         {
     343          64 :             pTextAttr->SetSeqNo(pNewDoc->GetFootnoteIdxs().size());
     344             :         }
     345             :         else
     346             :         {
     347          40 :             pTextAttr->SetSeqRefNo();
     348             :         }
     349             :     }
     350         104 :     m_pImpl->m_bIsDescriptor = false;
     351         208 :     SetDoc(pNewDoc);
     352         104 : }
     353             : 
     354             : uno::Reference< text::XTextRange > SAL_CALL
     355          57 : SwXFootnote::getAnchor() throw (uno::RuntimeException, std::exception)
     356             : {
     357          57 :     SolarMutexGuard aGuard;
     358             : 
     359          57 :     SwFormatFootnote const& rFormat( m_pImpl->GetFootnoteFormatOrThrow() );
     360             : 
     361          57 :     SwTextFootnote const*const pTextFootnote = rFormat.GetTextFootnote();
     362         114 :     SwPaM aPam( pTextFootnote->GetTextNode(), pTextFootnote->GetStart() );
     363         114 :     SwPosition aMark( *aPam.Start() );
     364          57 :     aPam.SetMark();
     365          57 :     ++aPam.GetMark()->nContent;
     366             :     const uno::Reference< text::XTextRange > xRet =
     367          57 :         SwXTextRange::CreateXTextRange(*GetDoc(), *aPam.Start(), aPam.End());
     368         114 :     return xRet;
     369             : }
     370             : 
     371           1 : void SAL_CALL SwXFootnote::dispose() throw (uno::RuntimeException, std::exception)
     372             : {
     373           1 :     SolarMutexGuard aGuard;
     374             : 
     375           1 :     SwFormatFootnote const& rFormat( m_pImpl->GetFootnoteFormatOrThrow() );
     376             : 
     377           1 :     SwTextFootnote const*const pTextFootnote = rFormat.GetTextFootnote();
     378             :     OSL_ENSURE(pTextFootnote, "no TextNode?");
     379           1 :     SwTextNode& rTextNode = const_cast<SwTextNode&>(pTextFootnote->GetTextNode());
     380           1 :     const sal_Int32 nPos = pTextFootnote->GetStart();
     381           2 :     SwPaM aPam(rTextNode, nPos, rTextNode, nPos+1);
     382           2 :     GetDoc()->getIDocumentContentOperations().DeleteAndJoin( aPam );
     383           1 : }
     384             : 
     385             : void SAL_CALL
     386           2 : 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           2 :     m_pImpl->m_EventListeners.addInterface(xListener);
     392           2 : }
     393             : 
     394             : void SAL_CALL
     395           1 : 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           1 :     m_pImpl->m_EventListeners.removeInterface(xListener);
     401           1 : }
     402             : 
     403         192 : const SwStartNode *SwXFootnote::GetStartNode() const
     404             : {
     405         192 :     SwFormatFootnote const*const   pFormat = m_pImpl->GetFootnoteFormat();
     406         192 :     if(pFormat)
     407             :     {
     408         192 :         const SwTextFootnote* pTextFootnote = pFormat->GetTextFootnote();
     409         192 :         if( pTextFootnote )
     410             :         {
     411         192 :             return pTextFootnote->GetStartNode()->GetNode().GetStartNode();
     412             :         }
     413             :     }
     414           0 :     return 0;
     415             : }
     416             : 
     417             : uno::Reference< text::XTextCursor >
     418         407 : SwXFootnote::CreateCursor() throw (uno::RuntimeException)
     419             : {
     420         407 :     return createTextCursor();
     421             : }
     422             : 
     423             : uno::Reference< text::XTextCursor > SAL_CALL
     424         449 : SwXFootnote::createTextCursor() throw (uno::RuntimeException, std::exception)
     425             : {
     426         449 :     SolarMutexGuard aGuard;
     427             : 
     428         449 :     SwFormatFootnote const& rFormat( m_pImpl->GetFootnoteFormatOrThrow() );
     429             : 
     430         449 :     SwTextFootnote const*const pTextFootnote = rFormat.GetTextFootnote();
     431         898 :     SwPosition aPos( *pTextFootnote->GetStartNode() );
     432             :     SwXTextCursor *const pXCursor =
     433         449 :         new SwXTextCursor(*GetDoc(), this, CURSOR_FOOTNOTE, aPos);
     434         449 :     auto pUnoCrsr(pXCursor->GetCursor());
     435         449 :     pUnoCrsr->Move(fnMoveForward, fnGoNode);
     436             :     const uno::Reference< text::XTextCursor > xRet =
     437         449 :         static_cast<text::XWordCursor*>(pXCursor);
     438         898 :     return xRet;
     439             : }
     440             : 
     441             : uno::Reference< text::XTextCursor > SAL_CALL
     442         161 : SwXFootnote::createTextCursorByRange(
     443             :     const uno::Reference< text::XTextRange > & xTextPosition)
     444             : throw (uno::RuntimeException, std::exception)
     445             : {
     446         161 :     SolarMutexGuard aGuard;
     447             : 
     448         161 :     SwFormatFootnote const& rFormat( m_pImpl->GetFootnoteFormatOrThrow() );
     449             : 
     450         322 :     SwUnoInternalPaM aPam(*GetDoc());
     451         161 :     if (!::sw::XTextRangeToSwPaM(aPam, xTextPosition))
     452             :     {
     453           0 :         throw uno::RuntimeException();
     454             :     }
     455             : 
     456         161 :     SwTextFootnote const*const pTextFootnote = rFormat.GetTextFootnote();
     457         161 :     SwNode const*const pFootnoteStartNode = &pTextFootnote->GetStartNode()->GetNode();
     458             : 
     459         161 :     const SwNode* pStart = aPam.GetNode().FindFootnoteStartNode();
     460         161 :     if (pStart != pFootnoteStartNode)
     461             :     {
     462           0 :         throw uno::RuntimeException();
     463             :     }
     464             : 
     465             :     const uno::Reference< text::XTextCursor > xRet =
     466             :         static_cast<text::XWordCursor*>(
     467         161 :                 new SwXTextCursor(*GetDoc(), this, CURSOR_FOOTNOTE,
     468         161 :                     *aPam.GetPoint(), aPam.GetMark()));
     469         322 :     return xRet;
     470             : }
     471             : 
     472             : uno::Reference< container::XEnumeration > SAL_CALL
     473           3 : SwXFootnote::createEnumeration() throw (uno::RuntimeException, std::exception)
     474             : {
     475           3 :     SolarMutexGuard aGuard;
     476             : 
     477           3 :     SwFormatFootnote const& rFormat( m_pImpl->GetFootnoteFormatOrThrow() );
     478             : 
     479           3 :     SwTextFootnote const*const pTextFootnote = rFormat.GetTextFootnote();
     480           6 :     SwPosition aPos( *pTextFootnote->GetStartNode() );
     481           6 :     auto pUnoCursor(GetDoc()->CreateUnoCrsr(aPos, false));
     482           3 :     pUnoCursor->Move(fnMoveForward, fnGoNode);
     483           6 :     return SwXParagraphEnumeration::Create(this, pUnoCursor, CURSOR_FOOTNOTE);
     484             : }
     485             : 
     486           1 : uno::Type SAL_CALL SwXFootnote::getElementType() throw (uno::RuntimeException, std::exception)
     487             : {
     488           1 :     return cppu::UnoType<text::XTextRange>::get();
     489             : }
     490             : 
     491           1 : sal_Bool SAL_CALL SwXFootnote::hasElements() throw (uno::RuntimeException, std::exception)
     492             : {
     493           1 :     return sal_True;
     494             : }
     495             : 
     496             : uno::Reference< beans::XPropertySetInfo > SAL_CALL
     497           4 : SwXFootnote::getPropertySetInfo()
     498             : throw (uno::RuntimeException, std::exception)
     499             : {
     500           4 :     SolarMutexGuard g;
     501             :     static uno::Reference< beans::XPropertySetInfo > xRet =
     502             :         aSwMapProvider.GetPropertySet(PROPERTY_MAP_FOOTNOTE)
     503           4 :             ->getPropertySetInfo();
     504           4 :     return xRet;
     505             : }
     506             : 
     507             : void SAL_CALL
     508           1 : SwXFootnote::setPropertyValue(const OUString&, const uno::Any&)
     509             : throw (beans::UnknownPropertyException, beans::PropertyVetoException,
     510             :         lang::IllegalArgumentException, lang::WrappedTargetException,
     511             :         uno::RuntimeException, std::exception)
     512             : {
     513             :     //no values to be set
     514           1 :     throw lang::IllegalArgumentException();
     515             : }
     516             : 
     517             : uno::Any SAL_CALL
     518          27 : SwXFootnote::getPropertyValue(const OUString& rPropertyName)
     519             : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     520             :         uno::RuntimeException, std::exception)
     521             : {
     522          27 :     SolarMutexGuard aGuard;
     523             : 
     524          27 :     uno::Any aRet;
     525          27 :     if (! ::sw::GetDefaultTextContentValue(aRet, rPropertyName))
     526             :     {
     527          53 :         if (rPropertyName == UNO_NAME_START_REDLINE ||
     528          26 :             rPropertyName == UNO_NAME_END_REDLINE)
     529             :         {
     530             :             //redline can only be returned if it's a living object
     531           2 :             if (!m_pImpl->m_bIsDescriptor)
     532             :             {
     533           2 :                 aRet = SwXText::getPropertyValue(rPropertyName);
     534             :             }
     535             :         }
     536          25 :         else if (rPropertyName == UNO_NAME_REFERENCE_ID)
     537             :         {
     538          25 :             SwFormatFootnote const*const pFormat = m_pImpl->GetFootnoteFormat();
     539          25 :             if (pFormat)
     540             :             {
     541          25 :                 SwTextFootnote const*const pTextFootnote = pFormat->GetTextFootnote();
     542             :                 OSL_ENSURE(pTextFootnote, "no TextNode?");
     543          25 :                 aRet <<= static_cast<sal_Int16>(pTextFootnote->GetSeqRefNo());
     544             :             }
     545             :         }
     546             :         else
     547             :         {
     548           0 :             beans::UnknownPropertyException aExcept;
     549           0 :             aExcept.Message = rPropertyName;
     550           0 :             throw aExcept;
     551             :         }
     552             :     }
     553          27 :     return aRet;
     554             : }
     555             : 
     556             : void SAL_CALL
     557           0 : SwXFootnote::addPropertyChangeListener(
     558             :         const OUString& /*rPropertyName*/,
     559             :         const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
     560             : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     561             :     uno::RuntimeException, std::exception)
     562             : {
     563             :     OSL_FAIL("SwXFootnote::addPropertyChangeListener(): not implemented");
     564           0 : }
     565             : 
     566             : void SAL_CALL
     567           0 : SwXFootnote::removePropertyChangeListener(
     568             :         const OUString& /*rPropertyName*/,
     569             :         const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
     570             : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     571             :     uno::RuntimeException, std::exception)
     572             : {
     573             :     OSL_FAIL("SwXFootnote::removePropertyChangeListener(): not implemented");
     574           0 : }
     575             : 
     576             : void SAL_CALL
     577           0 : SwXFootnote::addVetoableChangeListener(
     578             :         const OUString& /*rPropertyName*/,
     579             :         const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
     580             : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     581             :     uno::RuntimeException, std::exception)
     582             : {
     583             :     OSL_FAIL("SwXFootnote::addVetoableChangeListener(): not implemented");
     584           0 : }
     585             : 
     586             : void SAL_CALL
     587           0 : SwXFootnote::removeVetoableChangeListener(
     588             :         const OUString& /*rPropertyName*/,
     589             :         const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
     590             : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     591             :         uno::RuntimeException, std::exception)
     592             : {
     593             :     OSL_FAIL("SwXFootnote::removeVetoableChangeListener(): not implemented");
     594         177 : }
     595             : 
     596             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11