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