xref: /aoo42x/main/sw/source/core/unocore/unoftn.cxx (revision efeef26f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26 
27 #include <rtl/uuid.h>
28 
29 #include <vos/mutex.hxx>
30 #include <vcl/svapp.hxx>
31 #include <comphelper/sequence.hxx>
32 
33 #include <unomid.h>
34 #include <unofootnote.hxx>
35 #include <unotextrange.hxx>
36 #include <unotextcursor.hxx>
37 #include <unoparagraph.hxx>
38 #include <unomap.hxx>
39 #include <unoprnms.hxx>
40 #include <unoevtlstnr.hxx>
41 #include <doc.hxx>
42 #include <ftnidx.hxx>
43 #include <fmtftn.hxx>
44 #include <txtftn.hxx>
45 #include <ndtxt.hxx>
46 #include <unocrsr.hxx>
47 #include <hints.hxx>
48 
49 
50 using namespace ::com::sun::star;
51 using ::rtl::OUString;
52 
53 /******************************************************************
54  * SwXFootnote
55  ******************************************************************/
56 
57 class SwXFootnote::Impl
58     : public SwClient
59 {
60 
61 public:
62 
63     SwXFootnote &               m_rThis;
64     const bool                  m_bIsEndnote;
65     SwEventListenerContainer    m_ListenerContainer;
66     bool                        m_bIsDescriptor;
67     const SwFmtFtn *            m_pFmtFtn;
68     ::rtl::OUString             m_sLabel;
69 
Impl(SwXFootnote & rThis,SwDoc * const pDoc,SwFmtFtn const * const pFootnote,const bool bIsEndnote)70     Impl(   SwXFootnote & rThis,
71             SwDoc *const pDoc, SwFmtFtn const*const pFootnote,
72             const bool bIsEndnote)
73         : SwClient((pDoc) ? pDoc->GetUnoCallBack() : 0)
74         , m_rThis(rThis)
75         , m_bIsEndnote(bIsEndnote)
76         , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
77 // #i111177#: unxsols4 (Sun C++ 5.9 SunOS_sparc) generates wrong code for this
78 //        , m_bIsDescriptor(0 == pFootnote)
79         , m_bIsDescriptor((0 == pFootnote) ? true : false)
80         , m_pFmtFtn(pFootnote)
81     {
82     }
83 
GetFootnoteFormat() const84     const SwFmtFtn* GetFootnoteFormat() const {
85         return m_rThis.GetDoc() ? m_pFmtFtn : 0;
86     }
87 
GetFootnoteFormatOrThrow()88     SwFmtFtn const& GetFootnoteFormatOrThrow() {
89         SwFmtFtn const*const pFootnote( GetFootnoteFormat() );
90         if (!pFootnote) {
91             throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM(
92                         "SwXFootnote: disposed or invalid")), 0);
93         }
94         return *pFootnote;
95     }
96 
97     void    Invalidate();
98 protected:
99     // SwClient
100     virtual void Modify( const SfxPoolItem *pOld, const SfxPoolItem *pNew);
101 
102 };
103 
104 /* -----------------------------07.01.00 12:39--------------------------------
105 
106  ---------------------------------------------------------------------------*/
Invalidate()107 void SwXFootnote::Impl::Invalidate()
108 {
109     if (GetRegisteredIn())
110     {
111         const_cast<SwModify*>(GetRegisteredIn())->Remove(this);
112     }
113     m_ListenerContainer.Disposing();
114     m_pFmtFtn = 0;
115     m_rThis.SetDoc(0);
116 }
117 
118 /* -----------------18.01.99 09:12-------------------
119  *
120  * --------------------------------------------------*/
Modify(const SfxPoolItem * pOld,const SfxPoolItem * pNew)121 void SwXFootnote::Impl::Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew)
122 {
123     ClientModify(this, pOld, pNew);
124 
125     if (!GetRegisteredIn()) // removed => dispose
126     {
127         Invalidate();
128     }
129     else if (pOld)
130     {
131         switch (pOld->Which())
132         {
133             case RES_FOOTNOTE_DELETED:
134                 if (static_cast<const void*>(m_pFmtFtn) ==
135                         static_cast<const SwPtrMsgPoolItem *>(pOld)->pObject)
136                 {
137                     Invalidate();
138                 }
139                 break;
140         }
141     }
142 }
143 
144 /*-- 10.12.98 15:31:44---------------------------------------------------
145 
146   -----------------------------------------------------------------------*/
SwXFootnote(const bool bEndnote)147 SwXFootnote::SwXFootnote(const bool bEndnote)
148     : SwXText(0, CURSOR_FOOTNOTE)
149     , m_pImpl( new SwXFootnote::Impl(*this, 0, 0, bEndnote) )
150 {
151 }
152 /*-- 10.12.98 15:31:45---------------------------------------------------
153 
154   -----------------------------------------------------------------------*/
SwXFootnote(SwDoc & rDoc,const SwFmtFtn & rFmt)155 SwXFootnote::SwXFootnote(SwDoc & rDoc, const SwFmtFtn& rFmt)
156     : SwXText(& rDoc, CURSOR_FOOTNOTE)
157     , m_pImpl( new SwXFootnote::Impl(*this, &rDoc, &rFmt, rFmt.IsEndNote()) )
158 {
159 }
160 /*-- 10.12.98 15:31:45---------------------------------------------------
161 
162   -----------------------------------------------------------------------*/
~SwXFootnote()163 SwXFootnote::~SwXFootnote()
164 {
165 }
166 
167 SwXFootnote *
GetXFootnote(SwModify const &,SwFmtFtn const &)168 SwXFootnote::GetXFootnote(
169         SwModify const& /*rUnoCB*/, SwFmtFtn const& /*rFootnoteFmt*/)
170 {
171     // re-use existing SwXFootnote
172     // #i105557#: do not iterate over the registered clients: race condition
173     // to do this properly requires the SwXFootnote to register at the
174     // SwFmtFtn directly, not at the unocallback
175     // also this function must return a uno Reference!
176     return 0;
177 }
178 
179 SwXFootnote *
CreateXFootnote(SwDoc & rDoc,SwFmtFtn const & rFootnoteFmt)180 SwXFootnote::CreateXFootnote(SwDoc & rDoc, SwFmtFtn const& rFootnoteFmt)
181 {
182     SwXFootnote *const pXFootnote(
183         GetXFootnote(*rDoc.GetUnoCallBack(), rFootnoteFmt));
184     return (pXFootnote)
185         ?   pXFootnote
186         :   new SwXFootnote(rDoc, rFootnoteFmt);
187 }
188 
189 /* -----------------------------13.03.00 12:15--------------------------------
190 
191  ---------------------------------------------------------------------------*/
getUnoTunnelId()192 const uno::Sequence< sal_Int8 > & SwXFootnote::getUnoTunnelId()
193 {
194     static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
195 	return aSeq;
196 }
197 /* -----------------------------10.03.00 18:04--------------------------------
198 
199  ---------------------------------------------------------------------------*/
200 sal_Int64 SAL_CALL
getSomething(const uno::Sequence<sal_Int8> & rId)201 SwXFootnote::getSomething(const uno::Sequence< sal_Int8 >& rId)
202 throw (uno::RuntimeException)
203 {
204     const sal_Int64 nRet( ::sw::UnoTunnelImpl<SwXFootnote>(rId, this) );
205     return (nRet) ? nRet : SwXText::getSomething(rId);
206 }
207 
208 /* -----------------------------06.04.00 16:36--------------------------------
209 
210  ---------------------------------------------------------------------------*/
211 OUString SAL_CALL
getImplementationName()212 SwXFootnote::getImplementationName() throw (uno::RuntimeException)
213 {
214 	return C2U("SwXFootnote");
215 }
216 
217 /* -----------------------------06.04.00 16:36--------------------------------
218 
219  ---------------------------------------------------------------------------*/
220 static char const*const g_ServicesFootnote[] =
221 {
222     "com.sun.star.text.TextContent",
223     "com.sun.star.text.Footnote",
224     "com.sun.star.text.Text",
225     "com.sun.star.text.Endnote", // NB: only supported for endnotes!
226 };
227 static const size_t g_nServicesEndnote(
228     sizeof(g_ServicesFootnote)/sizeof(g_ServicesFootnote[0]));
229 static const size_t g_nServicesFootnote( g_nServicesEndnote - 1 ); // NB: omit!
230 
supportsService(const OUString & rServiceName)231 sal_Bool SAL_CALL SwXFootnote::supportsService(const OUString& rServiceName)
232 throw (uno::RuntimeException)
233 {
234     vos::OGuard g(Application::GetSolarMutex());
235     return ::sw::SupportsServiceImpl(
236             (m_pImpl->m_bIsEndnote) ? g_nServicesEndnote : g_nServicesFootnote,
237             g_ServicesFootnote, rServiceName);
238 }
239 
240 uno::Sequence< OUString > SAL_CALL
getSupportedServiceNames()241 SwXFootnote::getSupportedServiceNames() throw (uno::RuntimeException)
242 {
243     vos::OGuard g(Application::GetSolarMutex());
244     return ::sw::GetSupportedServiceNamesImpl(
245             (m_pImpl->m_bIsEndnote) ? g_nServicesEndnote : g_nServicesFootnote,
246             g_ServicesFootnote);
247 }
248 
249 /* -----------------------------21.03.00 15:39--------------------------------
250 
251  ---------------------------------------------------------------------------*/
252 uno::Sequence< uno::Type > SAL_CALL
getTypes()253 SwXFootnote::getTypes() throw (uno::RuntimeException)
254 {
255     const uno::Sequence< uno::Type > aTypes = SwXFootnote_Base::getTypes();
256     const uno::Sequence< uno::Type > aTextTypes = SwXText::getTypes();
257     return ::comphelper::concatSequences(aTypes, aTextTypes);
258 }
259 
260 /* -----------------------------21.03.00 15:39--------------------------------
261 
262  ---------------------------------------------------------------------------*/
263 uno::Sequence< sal_Int8 > SAL_CALL
getImplementationId()264 SwXFootnote::getImplementationId() throw (uno::RuntimeException)
265 {
266     vos::OGuard aGuard(Application::GetSolarMutex());
267     static uno::Sequence< sal_Int8 > aId( 16 );
268     static sal_Bool bInit = sal_False;
269     if(!bInit)
270     {
271         rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
272         bInit = sal_True;
273     }
274     return aId;
275 }
276 /* -----------------------------21.03.00 15:46--------------------------------
277 
278  ---------------------------------------------------------------------------*/
279 uno::Any SAL_CALL
queryInterface(const uno::Type & rType)280 SwXFootnote::queryInterface(const uno::Type& rType)
281 throw (uno::RuntimeException)
282 {
283     const uno::Any ret = SwXFootnote_Base::queryInterface(rType);
284     return (ret.getValueType() == ::getCppuVoidType())
285         ?   SwXText::queryInterface(rType)
286         :   ret;
287 }
288 
289 /*-- 10.12.98 15:31:47---------------------------------------------------
290 
291   -----------------------------------------------------------------------*/
getLabel()292 OUString SAL_CALL SwXFootnote::getLabel() throw (uno::RuntimeException)
293 {
294 	vos::OGuard aGuard(Application::GetSolarMutex());
295 
296     ::rtl::OUString sRet;
297     SwFmtFtn const*const pFmt = m_pImpl->GetFootnoteFormat();
298 	if(pFmt)
299     {
300 		sRet = pFmt->GetNumStr();
301     }
302     else if (m_pImpl->m_bIsDescriptor)
303     {
304         sRet = m_pImpl->m_sLabel;
305     }
306 	else
307     {
308 		throw uno::RuntimeException();
309     }
310 	return sRet;
311 }
312 
313 /*-- 10.12.98 15:31:48---------------------------------------------------
314 
315   -----------------------------------------------------------------------*/
316 void SAL_CALL
setLabel(const OUString & aLabel)317 SwXFootnote::setLabel(const OUString& aLabel) throw (uno::RuntimeException)
318 {
319 	vos::OGuard aGuard(Application::GetSolarMutex());
320 
321     SwFmtFtn const*const pFmt = m_pImpl->GetFootnoteFormat();
322 	if(pFmt)
323 	{
324 		const SwTxtFtn* pTxtFtn = pFmt->GetTxtFtn();
325 		DBG_ASSERT(pTxtFtn, "kein TextNode?");
326 		SwTxtNode& rTxtNode = (SwTxtNode&)pTxtFtn->GetTxtNode();
327 
328 		SwPaM aPam(rTxtNode, *pTxtFtn->GetStart());
329 		GetDoc()->SetCurFtn(aPam, aLabel, pFmt->GetNumber(), pFmt->IsEndNote());
330 	}
331     else if (m_pImpl->m_bIsDescriptor)
332     {
333         m_pImpl->m_sLabel = String(aLabel);
334     }
335 	else
336     {
337 		throw uno::RuntimeException();
338     }
339 }
340 
341 /* -----------------18.02.99 13:32-------------------
342  *
343  * --------------------------------------------------*/
344 void SAL_CALL
attach(const uno::Reference<text::XTextRange> & xTextRange)345 SwXFootnote::attach(const uno::Reference< text::XTextRange > & xTextRange)
346 throw (lang::IllegalArgumentException, uno::RuntimeException)
347 {
348     vos::OGuard aGuard(Application::GetSolarMutex());
349 
350     if (!m_pImpl->m_bIsDescriptor)
351     {
352 		throw uno::RuntimeException();
353     }
354     const uno::Reference<lang::XUnoTunnel> xRangeTunnel(
355             xTextRange, uno::UNO_QUERY);
356     SwXTextRange *const pRange =
357         ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel);
358     OTextCursorHelper *const pCursor =
359         ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel);
360     SwDoc *const pNewDoc =
361         (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0);
362     if (!pNewDoc)
363     {
364         throw lang::IllegalArgumentException();
365     }
366 
367     SwUnoInternalPaM aPam(*pNewDoc);
368     //das muss jetzt sal_True liefern
369     ::sw::XTextRangeToSwPaM(aPam, xTextRange);
370 
371     UnoActionContext aCont(pNewDoc);
372     pNewDoc->DeleteAndJoin(aPam);
373     aPam.DeleteMark();
374     SwFmtFtn aFootNote(m_pImpl->m_bIsEndnote);
375     if (m_pImpl->m_sLabel.getLength())
376     {
377         aFootNote.SetNumStr(m_pImpl->m_sLabel);
378     }
379 
380     SwXTextCursor const*const pTextCursor(
381             dynamic_cast<SwXTextCursor*>(pCursor));
382     const bool bForceExpandHints( (pTextCursor)
383             ? pTextCursor->IsAtEndOfMeta() : false );
384     const SetAttrMode nInsertFlags = (bForceExpandHints)
385         ? nsSetAttrMode::SETATTR_FORCEHINTEXPAND
386         : nsSetAttrMode::SETATTR_DEFAULT;
387 
388     pNewDoc->InsertPoolItem(aPam, aFootNote, nInsertFlags);
389 
390     SwTxtFtn *const pTxtAttr = static_cast<SwTxtFtn*>(
391         aPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
392                 aPam.GetPoint()->nContent.GetIndex()-1, RES_TXTATR_FTN ));
393 
394     if (pTxtAttr)
395     {
396         const SwFmtFtn& rFtn = pTxtAttr->GetFtn();
397         m_pImpl->m_pFmtFtn = &rFtn;
398         pNewDoc->GetUnoCallBack()->Add(m_pImpl.get());
399         // force creation of sequence id - is used for references
400         if (pNewDoc->IsInReading())
401         {
402             pTxtAttr->SetSeqNo(pNewDoc->GetFtnIdxs().Count());
403         }
404         else
405         {
406             pTxtAttr->SetSeqRefNo();
407         }
408     }
409     m_pImpl->m_bIsDescriptor = sal_False;
410     SetDoc(pNewDoc);
411 }
412 
413 /*-- 10.12.98 15:31:48---------------------------------------------------
414 
415   -----------------------------------------------------------------------*/
416 uno::Reference< text::XTextRange > SAL_CALL
getAnchor()417 SwXFootnote::getAnchor() throw (uno::RuntimeException)
418 {
419 	vos::OGuard aGuard(Application::GetSolarMutex());
420 
421     SwFmtFtn const& rFmt( m_pImpl->GetFootnoteFormatOrThrow() );
422 
423     SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
424     SwPaM aPam( pTxtFtn->GetTxtNode(), *pTxtFtn->GetStart() );
425     SwPosition aMark( *aPam.Start() );
426     aPam.SetMark();
427     aPam.GetMark()->nContent++;
428     const uno::Reference< text::XTextRange > xRet =
429         SwXTextRange::CreateXTextRange(*GetDoc(), *aPam.Start(), aPam.End());
430     return xRet;
431 }
432 /*-- 10.12.98 15:31:49---------------------------------------------------
433 
434   -----------------------------------------------------------------------*/
dispose()435 void SAL_CALL SwXFootnote::dispose() throw (uno::RuntimeException)
436 {
437 	vos::OGuard aGuard(Application::GetSolarMutex());
438 
439     SwFmtFtn const& rFmt( m_pImpl->GetFootnoteFormatOrThrow() );
440 
441     SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
442     DBG_ASSERT(pTxtFtn, "no TextNode?");
443     SwTxtNode& rTxtNode = const_cast<SwTxtNode&>(pTxtFtn->GetTxtNode());
444     const xub_StrLen nPos = *pTxtFtn->GetStart();
445     SwPaM aPam(rTxtNode, nPos, rTxtNode, nPos+1);
446     GetDoc()->DeleteAndJoin( aPam );
447 }
448 
449 /*-- 10.12.98 15:31:49---------------------------------------------------
450 
451   -----------------------------------------------------------------------*/
452 void SAL_CALL
addEventListener(const uno::Reference<lang::XEventListener> & xListener)453 SwXFootnote::addEventListener(
454     const uno::Reference< lang::XEventListener > & xListener)
455 throw (uno::RuntimeException)
456 {
457     vos::OGuard g(Application::GetSolarMutex());
458 
459     if (!m_pImpl->GetFootnoteFormat())
460     {
461 		throw uno::RuntimeException();
462     }
463     m_pImpl->m_ListenerContainer.AddListener(xListener);
464 }
465 /*-- 10.12.98 15:31:50---------------------------------------------------
466 
467   -----------------------------------------------------------------------*/
468 void SAL_CALL
removeEventListener(const uno::Reference<lang::XEventListener> & xListener)469 SwXFootnote::removeEventListener(
470     const uno::Reference< lang::XEventListener > & xListener)
471 throw (uno::RuntimeException)
472 {
473     vos::OGuard g(Application::GetSolarMutex());
474 
475     if (!m_pImpl->GetFootnoteFormat() ||
476         !m_pImpl->m_ListenerContainer.RemoveListener(xListener))
477     {
478 		throw uno::RuntimeException();
479     }
480 }
481 
482 /* -----------------06.05.99 15:31-------------------
483  *
484  * --------------------------------------------------*/
GetStartNode() const485 const SwStartNode *SwXFootnote::GetStartNode() const
486 {
487     SwFmtFtn const*const   pFmt = m_pImpl->GetFootnoteFormat();
488 	if(pFmt)
489 	{
490 		const SwTxtFtn* pTxtFtn = pFmt->GetTxtFtn();
491 		if( pTxtFtn )
492         {
493             return pTxtFtn->GetStartNode()->GetNode().GetStartNode();
494         }
495 	}
496     return 0;
497 }
498 
499 uno::Reference< text::XTextCursor >
CreateCursor()500 SwXFootnote::CreateCursor() throw (uno::RuntimeException)
501 {
502 	return createTextCursor();
503 }
504 
505 /*-- 10.12.98 15:31:50---------------------------------------------------
506 
507   -----------------------------------------------------------------------*/
508 uno::Reference< text::XTextCursor > SAL_CALL
createTextCursor()509 SwXFootnote::createTextCursor() throw (uno::RuntimeException)
510 {
511 	vos::OGuard aGuard(Application::GetSolarMutex());
512 
513     SwFmtFtn const& rFmt( m_pImpl->GetFootnoteFormatOrThrow() );
514 
515     SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
516     SwPosition aPos( *pTxtFtn->GetStartNode() );
517     SwXTextCursor *const pXCursor =
518         new SwXTextCursor(*GetDoc(), this, CURSOR_FOOTNOTE, aPos);
519     SwUnoCrsr *const pUnoCrsr = pXCursor->GetCursor();
520     pUnoCrsr->Move(fnMoveForward, fnGoNode);
521     const uno::Reference< text::XTextCursor > xRet =
522         static_cast<text::XWordCursor*>(pXCursor);
523     return xRet;
524 }
525 
526 /*-- 10.12.98 15:31:51---------------------------------------------------
527 
528   -----------------------------------------------------------------------*/
529 uno::Reference< text::XTextCursor > SAL_CALL
createTextCursorByRange(const uno::Reference<text::XTextRange> & xTextPosition)530 SwXFootnote::createTextCursorByRange(
531     const uno::Reference< text::XTextRange > & xTextPosition)
532 throw (uno::RuntimeException)
533 {
534 	vos::OGuard aGuard(Application::GetSolarMutex());
535 
536     SwFmtFtn const& rFmt( m_pImpl->GetFootnoteFormatOrThrow() );
537 
538     SwUnoInternalPaM aPam(*GetDoc());
539     if (!::sw::XTextRangeToSwPaM(aPam, xTextPosition))
540     {
541         throw uno::RuntimeException();
542     }
543 
544     SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
545     SwNode const*const pFtnStartNode = &pTxtFtn->GetStartNode()->GetNode();
546 
547     const SwNode* pStart = aPam.GetNode()->FindFootnoteStartNode();
548     if (pStart != pFtnStartNode)
549     {
550         throw uno::RuntimeException();
551     }
552 
553     const uno::Reference< text::XTextCursor > xRet =
554         static_cast<text::XWordCursor*>(
555                 new SwXTextCursor(*GetDoc(), this, CURSOR_FOOTNOTE,
556                     *aPam.GetPoint(), aPam.GetMark()));
557     return xRet;
558 }
559 
560 /*-- 13.06.00 14:28:23---------------------------------------------------
561 
562   -----------------------------------------------------------------------*/
563 uno::Reference< container::XEnumeration > SAL_CALL
createEnumeration()564 SwXFootnote::createEnumeration() throw (uno::RuntimeException)
565 {
566 	vos::OGuard aGuard(Application::GetSolarMutex());
567 
568     SwFmtFtn const& rFmt( m_pImpl->GetFootnoteFormatOrThrow() );
569 
570     SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
571     SwPosition aPos( *pTxtFtn->GetStartNode() );
572     ::std::auto_ptr<SwUnoCrsr> pUnoCursor(
573         GetDoc()->CreateUnoCrsr(aPos, sal_False));
574     pUnoCursor->Move(fnMoveForward, fnGoNode);
575     const uno::Reference< container::XEnumeration >  xRet =
576         new SwXParagraphEnumeration(this, pUnoCursor, CURSOR_FOOTNOTE);
577     return xRet;
578 }
579 
580 /*-- 13.06.00 14:28:24---------------------------------------------------
581 
582   -----------------------------------------------------------------------*/
getElementType()583 uno::Type SAL_CALL SwXFootnote::getElementType() throw (uno::RuntimeException)
584 {
585     return text::XTextRange::static_type();
586 }
587 /*-- 13.06.00 14:28:24---------------------------------------------------
588 
589   -----------------------------------------------------------------------*/
hasElements()590 sal_Bool SAL_CALL SwXFootnote::hasElements() throw (uno::RuntimeException)
591 {
592 	return sal_True;
593 }
594 
595 /*-- 11.09.00 13:12:03---------------------------------------------------
596 
597   -----------------------------------------------------------------------*/
598 uno::Reference< beans::XPropertySetInfo > SAL_CALL
getPropertySetInfo()599 SwXFootnote::getPropertySetInfo()
600 throw (uno::RuntimeException)
601 {
602     vos::OGuard g(Application::GetSolarMutex());
603     static uno::Reference< beans::XPropertySetInfo > xRet =
604         aSwMapProvider.GetPropertySet(PROPERTY_MAP_FOOTNOTE)
605             ->getPropertySetInfo();
606     return xRet;
607 }
608 
609 /*-- 11.09.00 13:12:04---------------------------------------------------
610 
611   -----------------------------------------------------------------------*/
612 void SAL_CALL
setPropertyValue(const::rtl::OUString &,const uno::Any &)613 SwXFootnote::setPropertyValue(const ::rtl::OUString&, const uno::Any&)
614 throw (beans::UnknownPropertyException, beans::PropertyVetoException,
615         lang::IllegalArgumentException, lang::WrappedTargetException,
616         uno::RuntimeException)
617 {
618 	//no values to be set
619 	throw lang::IllegalArgumentException();
620 }
621 /*-- 11.09.00 13:12:04---------------------------------------------------
622 
623   -----------------------------------------------------------------------*/
624 uno::Any SAL_CALL
getPropertyValue(const OUString & rPropertyName)625 SwXFootnote::getPropertyValue(const OUString& rPropertyName)
626 throw (beans::UnknownPropertyException, lang::WrappedTargetException,
627         uno::RuntimeException)
628 {
629 	vos::OGuard aGuard(Application::GetSolarMutex());
630 
631 	uno::Any aRet;
632     if (! ::sw::GetDefaultTextContentValue(aRet, rPropertyName))
633 	{
634         if (rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_START_REDLINE)) ||
635             rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_END_REDLINE)))
636         {
637             //redline can only be returned if it's a living object
638             if (!m_pImpl->m_bIsDescriptor)
639             {
640                 aRet = SwXText::getPropertyValue(rPropertyName);
641             }
642         }
643         else if (rPropertyName.equalsAsciiL(
644                     SW_PROP_NAME(UNO_NAME_REFERENCE_ID)))
645         {
646             SwFmtFtn const*const pFmt = m_pImpl->GetFootnoteFormat();
647             if (pFmt)
648             {
649                 SwTxtFtn const*const pTxtFtn = pFmt->GetTxtFtn();
650                 DBG_ASSERT(pTxtFtn, "no TextNode?");
651                 aRet <<= static_cast<sal_Int16>(pTxtFtn->GetSeqRefNo());
652             }
653         }
654         else
655         {
656             beans::UnknownPropertyException aExcept;
657             aExcept.Message = rPropertyName;
658             throw aExcept;
659         }
660 	}
661 	return aRet;
662 }
663 
664 /*-- 11.09.00 13:12:04---------------------------------------------------
665 
666   -----------------------------------------------------------------------*/
667 void SAL_CALL
addPropertyChangeListener(const::rtl::OUString &,const uno::Reference<beans::XPropertyChangeListener> &)668 SwXFootnote::addPropertyChangeListener(
669         const ::rtl::OUString& /*rPropertyName*/,
670         const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
671 throw (beans::UnknownPropertyException, lang::WrappedTargetException,
672     uno::RuntimeException)
673 {
674     OSL_ENSURE(false,
675         "SwXFootnote::addPropertyChangeListener(): not implemented");
676 }
677 
678 void SAL_CALL
removePropertyChangeListener(const::rtl::OUString &,const uno::Reference<beans::XPropertyChangeListener> &)679 SwXFootnote::removePropertyChangeListener(
680         const ::rtl::OUString& /*rPropertyName*/,
681         const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
682 throw (beans::UnknownPropertyException, lang::WrappedTargetException,
683     uno::RuntimeException)
684 {
685     OSL_ENSURE(false,
686         "SwXFootnote::removePropertyChangeListener(): not implemented");
687 }
688 
689 void SAL_CALL
addVetoableChangeListener(const::rtl::OUString &,const uno::Reference<beans::XVetoableChangeListener> &)690 SwXFootnote::addVetoableChangeListener(
691         const ::rtl::OUString& /*rPropertyName*/,
692         const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
693 throw (beans::UnknownPropertyException, lang::WrappedTargetException,
694     uno::RuntimeException)
695 {
696     OSL_ENSURE(false,
697         "SwXFootnote::addVetoableChangeListener(): not implemented");
698 }
699 
700 void SAL_CALL
removeVetoableChangeListener(const::rtl::OUString &,const uno::Reference<beans::XVetoableChangeListener> &)701 SwXFootnote::removeVetoableChangeListener(
702         const ::rtl::OUString& /*rPropertyName*/,
703         const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
704 throw (beans::UnknownPropertyException, lang::WrappedTargetException,
705         uno::RuntimeException)
706 {
707     OSL_ENSURE(false,
708         "SwXFootnote::removeVetoableChangeListener(): not implemented");
709 }
710 
711