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 <com/sun/star/beans/PropertyAttribute.hpp> 28 #include <com/sun/star/text/SectionFileLink.hpp> 29 30 #include <cmdid.h> 31 #include <hintids.hxx> 32 #include <svl/urihelper.hxx> 33 #include <editeng/brshitem.hxx> 34 #include <editeng/xmlcnitm.hxx> 35 #include <sfx2/linkmgr.hxx> 36 #include <sfx2/lnkbase.hxx> 37 #include <vos/mutex.hxx> 38 #include <vcl/svapp.hxx> 39 #include <fmtclds.hxx> 40 #include <unotextrange.hxx> 41 #include <unosection.hxx> 42 #include <TextCursorHelper.hxx> 43 #include <unoredline.hxx> 44 #include <redline.hxx> 45 #include <unomap.hxx> 46 #include <unocrsr.hxx> 47 #include <section.hxx> 48 #include <doc.hxx> 49 #include <IDocumentUndoRedo.hxx> 50 #include <docsh.hxx> 51 #include <sfx2/docfile.hxx> 52 #include <docary.hxx> 53 #include <swundo.hxx> 54 #include <hints.hxx> 55 #include <tox.hxx> 56 #include <unoidx.hxx> 57 #include <doctxm.hxx> 58 #include <fmtftntx.hxx> 59 #include <fmtclbl.hxx> 60 #include <com/sun/star/beans/PropertyAttribute.hpp> 61 #include <editeng/frmdiritem.hxx> 62 #include <fmtcntnt.hxx> 63 /* #109700# */ 64 #include <editeng/lrspitem.hxx> 65 66 67 using namespace ::com::sun::star; 68 using ::rtl::OUString; 69 70 71 /****************************************************************** 72 * 73 ******************************************************************/ 74 struct SwTextSectionProperties_Impl 75 { 76 uno::Sequence<sal_Int8> m_Password; 77 ::rtl::OUString m_sCondition; 78 ::rtl::OUString m_sLinkFileName; 79 ::rtl::OUString m_sSectionFilter; 80 ::rtl::OUString m_sSectionRegion; 81 82 ::std::auto_ptr<SwFmtCol> m_pColItem; 83 ::std::auto_ptr<SvxBrushItem> m_pBrushItem; 84 ::std::auto_ptr<SwFmtFtnAtTxtEnd> m_pFtnItem; 85 ::std::auto_ptr<SwFmtEndAtTxtEnd> m_pEndItem; 86 ::std::auto_ptr<SvXMLAttrContainerItem> m_pXMLAttr; 87 ::std::auto_ptr<SwFmtNoBalancedColumns> m_pNoBalanceItem; 88 ::std::auto_ptr<SvxFrameDirectionItem> m_pFrameDirItem; 89 ::std::auto_ptr<SvxLRSpaceItem> m_pLRSpaceItem; // #109700# 90 91 bool m_bDDE; 92 bool m_bHidden; 93 bool m_bCondHidden; 94 bool m_bProtect; 95 // --> FME 2004-06-22 #114856# edit in readonly sections 96 bool m_bEditInReadonly; 97 // <-- 98 bool m_bUpdateType; 99 100 SwTextSectionProperties_Impl() 101 : m_bDDE(false) 102 , m_bHidden(false) 103 , m_bCondHidden(false) 104 , m_bProtect(false) 105 // --> FME 2004-06-22 #114856# edit in readonly sections 106 , m_bEditInReadonly(false) 107 // <-- 108 , m_bUpdateType(true) 109 { 110 } 111 112 }; 113 114 115 class SwXTextSection::Impl 116 : public SwClient 117 { 118 119 public: 120 121 SwXTextSection & m_rThis; 122 const SfxItemPropertySet & m_rPropSet; 123 SwEventListenerContainer m_ListenerContainer; 124 const bool m_bIndexHeader; 125 bool m_bIsDescriptor; 126 ::rtl::OUString m_sName; 127 ::std::auto_ptr<SwTextSectionProperties_Impl> m_pProps; 128 129 Impl( SwXTextSection & rThis, 130 SwSectionFmt *const pFmt, const bool bIndexHeader) 131 : SwClient(pFmt) 132 , m_rThis(rThis) 133 , m_rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_SECTION)) 134 , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis)) 135 , m_bIndexHeader(bIndexHeader) 136 // #i111177# unxsols4 (Sun C++ 5.9 SunOS_sparc) may generate wrong code 137 , m_bIsDescriptor((0 == pFmt) ? true : false) 138 , m_pProps((pFmt) ? 0 : new SwTextSectionProperties_Impl()) 139 { 140 } 141 142 SwSectionFmt * GetSectionFmt() const 143 { 144 return static_cast<SwSectionFmt*>(const_cast<SwModify*>( 145 GetRegisteredIn())); 146 } 147 148 SwSectionFmt & GetSectionFmtOrThrow() const { 149 SwSectionFmt *const pFmt( GetSectionFmt() ); 150 if (!pFmt) { 151 throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM( 152 "SwXTextSection: disposed or invalid")), 0); 153 } 154 return *pFmt; 155 } 156 157 void SAL_CALL SetPropertyValues_Impl( 158 const uno::Sequence< ::rtl::OUString >& rPropertyNames, 159 const uno::Sequence< uno::Any >& aValues) 160 throw (beans::UnknownPropertyException, beans::PropertyVetoException, 161 lang::IllegalArgumentException, lang::WrappedTargetException, 162 uno::RuntimeException); 163 uno::Sequence< uno::Any > SAL_CALL 164 GetPropertyValues_Impl( 165 const uno::Sequence< ::rtl::OUString >& rPropertyNames) 166 throw (beans::UnknownPropertyException, lang::WrappedTargetException, 167 uno::RuntimeException); 168 protected: 169 // SwClient 170 virtual void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew); 171 172 }; 173 174 /*-- 10.12.98 14:42:52--------------------------------------------------- 175 176 -----------------------------------------------------------------------*/ 177 void SwXTextSection::Impl::Modify( const SfxPoolItem *pOld, const SfxPoolItem *pNew) 178 { 179 ClientModify(this, pOld, pNew); 180 if (!GetRegisteredIn()) 181 { 182 m_ListenerContainer.Disposing(); 183 } 184 } 185 186 /*-- 20.12.2005 10:27:33--------------------------------------------------- 187 188 -----------------------------------------------------------------------*/ 189 SwSectionFmt * SwXTextSection::GetFmt() const 190 { 191 return m_pImpl->GetSectionFmt(); 192 } 193 194 /*-- 20.12.2005 09:56:36--------------------------------------------------- 195 196 -----------------------------------------------------------------------*/ 197 uno::Reference< text::XTextSection > 198 SwXTextSection::CreateXTextSection( 199 SwSectionFmt *const pFmt, const bool bIndexHeader) 200 { 201 // re-use existing SwXTextSection 202 // #i105557#: do not iterate over the registered clients: race condition 203 uno::Reference< text::XTextSection > xSection; 204 if (pFmt) 205 { 206 xSection.set(pFmt->GetXTextSection()); 207 } 208 if ( !xSection.is() ) 209 { 210 SwXTextSection *const pNew = new SwXTextSection(pFmt, bIndexHeader); 211 xSection.set(pNew); 212 if (pFmt) 213 { 214 pFmt->SetXTextSection(xSection); 215 } 216 } 217 return xSection; 218 } 219 220 /*-- 10.12.98 14:47:05--------------------------------------------------- 221 222 -----------------------------------------------------------------------*/ 223 SwXTextSection::SwXTextSection( 224 SwSectionFmt *const pFmt, const bool bIndexHeader) 225 : m_pImpl( new SwXTextSection::Impl(*this, pFmt, bIndexHeader) ) 226 { 227 } 228 229 /*-- 10.12.98 14:47:07--------------------------------------------------- 230 231 -----------------------------------------------------------------------*/ 232 SwXTextSection::~SwXTextSection() 233 { 234 } 235 236 /* -----------------------------13.03.00 12:15-------------------------------- 237 238 ---------------------------------------------------------------------------*/ 239 const uno::Sequence< sal_Int8 > & SwXTextSection::getUnoTunnelId() 240 { 241 static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId(); 242 return aSeq; 243 } 244 /* -----------------------------10.03.00 18:04-------------------------------- 245 246 ---------------------------------------------------------------------------*/ 247 sal_Int64 SAL_CALL 248 SwXTextSection::getSomething(const uno::Sequence< sal_Int8 >& rId) 249 throw (uno::RuntimeException) 250 { 251 return ::sw::UnoTunnelImpl<SwXTextSection>(rId, this); 252 } 253 254 /*-- 10.12.98 14:47:08--------------------------------------------------- 255 256 -----------------------------------------------------------------------*/ 257 uno::Reference< text::XTextSection > SAL_CALL 258 SwXTextSection::getParentSection() throw (uno::RuntimeException) 259 { 260 vos::OGuard aGuard(Application::GetSolarMutex()); 261 262 SwSectionFmt & rSectionFmt( m_pImpl->GetSectionFmtOrThrow() ); 263 264 SwSectionFmt *const pParentFmt = rSectionFmt.GetParent(); 265 const uno::Reference< text::XTextSection > xRet = 266 (pParentFmt) ? CreateXTextSection(pParentFmt) : 0; 267 return xRet; 268 } 269 270 /*-- 10.12.98 14:47:08--------------------------------------------------- 271 272 -----------------------------------------------------------------------*/ 273 uno::Sequence< uno::Reference< text::XTextSection > > SAL_CALL 274 SwXTextSection::getChildSections() throw (uno::RuntimeException) 275 { 276 vos::OGuard aGuard(Application::GetSolarMutex()); 277 278 SwSectionFmt & rSectionFmt( m_pImpl->GetSectionFmtOrThrow() ); 279 280 SwSections aChildren; 281 rSectionFmt.GetChildSections(aChildren, SORTSECT_NOT, sal_False); 282 uno::Sequence<uno::Reference<text::XTextSection> > aSeq(aChildren.Count()); 283 uno::Reference< text::XTextSection > * pArray = aSeq.getArray(); 284 for (sal_uInt16 i = 0; i < aChildren.Count(); i++) 285 { 286 SwSectionFmt *const pChild = aChildren.GetObject(i)->GetFmt(); 287 pArray[i] = CreateXTextSection(pChild); 288 } 289 return aSeq; 290 } 291 292 /* -----------------18.02.99 13:31------------------- 293 * 294 * --------------------------------------------------*/ 295 void SAL_CALL 296 SwXTextSection::attach(const uno::Reference< text::XTextRange > & xTextRange) 297 throw (lang::IllegalArgumentException, uno::RuntimeException) 298 { 299 vos::OGuard g(Application::GetSolarMutex()); 300 301 if (!m_pImpl->m_bIsDescriptor) 302 { 303 throw uno::RuntimeException(); 304 } 305 306 uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY); 307 SwXTextRange* pRange = 0; 308 OTextCursorHelper* pCursor = 0; 309 if(xRangeTunnel.is()) 310 { 311 pRange = ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel); 312 pCursor = 313 ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel); 314 } 315 316 SwDoc *const pDoc = 317 (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0); 318 if (!pDoc) 319 { 320 throw lang::IllegalArgumentException(); 321 } 322 323 SwUnoInternalPaM aPam(*pDoc); 324 //das muss jetzt sal_True liefern 325 ::sw::XTextRangeToSwPaM(aPam, xTextRange); 326 UnoActionContext aCont(pDoc); 327 pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_INSSECTION, NULL ); 328 329 if (!m_pImpl->m_sName.getLength()) 330 { 331 m_pImpl->m_sName = C2U("TextSection"); 332 } 333 SectionType eType = (m_pImpl->m_pProps->m_bDDE) 334 ? DDE_LINK_SECTION 335 : ((m_pImpl->m_pProps->m_sLinkFileName.getLength() || 336 m_pImpl->m_pProps->m_sSectionRegion.getLength()) 337 ? FILE_LINK_SECTION : CONTENT_SECTION); 338 // index header section? 339 if (m_pImpl->m_bIndexHeader) 340 { 341 // caller wants an index header section, but will only 342 // give him one if a) we are inside an index, and b) said 343 // index doesn't yet have a header section. 344 const SwTOXBase* pBase = aPam.GetDoc()->GetCurTOX(*aPam.Start()); 345 346 // are we inside an index? 347 if (pBase) 348 { 349 // get all child sections 350 SwSections aSectionsArr; 351 static_cast<const SwTOXBaseSection*>(pBase)->GetFmt()-> 352 GetChildSections(aSectionsArr); 353 354 // and search for current header section 355 const sal_uInt16 nCount = aSectionsArr.Count(); 356 sal_Bool bHeaderPresent = sal_False; 357 for(sal_uInt16 i = 0; i < nCount; i++) 358 { 359 bHeaderPresent |= 360 (aSectionsArr[i]->GetType() == TOX_HEADER_SECTION); 361 } 362 if (! bHeaderPresent) 363 { 364 eType = TOX_HEADER_SECTION; 365 } 366 } 367 } 368 369 String tmp(m_pImpl->m_sName); 370 SwSectionData aSect(eType, pDoc->GetUniqueSectionName(&tmp)); 371 aSect.SetCondition(m_pImpl->m_pProps->m_sCondition); 372 ::rtl::OUStringBuffer sLinkNameBuf(m_pImpl->m_pProps->m_sLinkFileName); 373 sLinkNameBuf.append(sfx2::cTokenSeperator); 374 sLinkNameBuf.append(m_pImpl->m_pProps->m_sSectionFilter); 375 sLinkNameBuf.append(sfx2::cTokenSeperator); 376 sLinkNameBuf.append(m_pImpl->m_pProps->m_sSectionRegion); 377 aSect.SetLinkFileName(sLinkNameBuf.makeStringAndClear()); 378 379 aSect.SetHidden(m_pImpl->m_pProps->m_bHidden); 380 aSect.SetProtectFlag(m_pImpl->m_pProps->m_bProtect); 381 // --> FME 2004-06-22 #114856# edit in readonly sections 382 aSect.SetEditInReadonlyFlag(m_pImpl->m_pProps->m_bEditInReadonly); 383 // <-- 384 385 SfxItemSet aSet(pDoc->GetAttrPool(), 386 RES_COL, RES_COL, 387 RES_BACKGROUND, RES_BACKGROUND, 388 RES_FTN_AT_TXTEND, RES_FRAMEDIR, 389 RES_LR_SPACE, RES_LR_SPACE, // #109700# 390 RES_UNKNOWNATR_CONTAINER,RES_UNKNOWNATR_CONTAINER, 391 0); 392 if (m_pImpl->m_pProps->m_pBrushItem.get()) 393 { 394 aSet.Put(*m_pImpl->m_pProps->m_pBrushItem); 395 } 396 if (m_pImpl->m_pProps->m_pColItem.get()) 397 { 398 aSet.Put(*m_pImpl->m_pProps->m_pColItem); 399 } 400 if (m_pImpl->m_pProps->m_pFtnItem.get()) 401 { 402 aSet.Put(*m_pImpl->m_pProps->m_pFtnItem); 403 } 404 if (m_pImpl->m_pProps->m_pEndItem.get()) 405 { 406 aSet.Put(*m_pImpl->m_pProps->m_pEndItem); 407 } 408 if (m_pImpl->m_pProps->m_pXMLAttr.get()) 409 { 410 aSet.Put(*m_pImpl->m_pProps->m_pXMLAttr); 411 } 412 if (m_pImpl->m_pProps->m_pNoBalanceItem.get()) 413 { 414 aSet.Put(*m_pImpl->m_pProps->m_pNoBalanceItem); 415 } 416 if (m_pImpl->m_pProps->m_pFrameDirItem.get()) 417 { 418 aSet.Put(*m_pImpl->m_pProps->m_pFrameDirItem); 419 } 420 /* #109700# */ 421 if (m_pImpl->m_pProps->m_pLRSpaceItem.get()) 422 { 423 aSet.Put(*m_pImpl->m_pProps->m_pLRSpaceItem); 424 } 425 // section password 426 if (m_pImpl->m_pProps->m_Password.getLength() > 0) 427 { 428 aSect.SetPassword(m_pImpl->m_pProps->m_Password); 429 } 430 431 SwSection *const pRet = 432 pDoc->InsertSwSection( aPam, aSect, 0, aSet.Count() ? &aSet : 0 ); 433 pRet->GetFmt()->Add(m_pImpl.get()); 434 pRet->GetFmt()->SetXObject(static_cast< ::cppu::OWeakObject*>(this)); 435 436 // #97450# XML import must hide sections depending on their old 437 // condition status 438 if (m_pImpl->m_pProps->m_sCondition.getLength() != 0) 439 { 440 pRet->SetCondHidden(m_pImpl->m_pProps->m_bCondHidden); 441 } 442 443 // set update type if DDE link (and connect, if necessary) 444 if (m_pImpl->m_pProps->m_bDDE) 445 { 446 if (! pRet->IsConnected()) 447 { 448 pRet->CreateLink(CREATE_CONNECT); 449 } 450 pRet->SetUpdateType( static_cast< sal_uInt16 >( 451 (m_pImpl->m_pProps->m_bUpdateType) ? 452 sfx2::LINKUPDATE_ALWAYS : sfx2::LINKUPDATE_ONCALL) ); 453 } 454 455 // Undo-Klammerung hier beenden 456 pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_INSSECTION, NULL ); 457 m_pImpl->m_pProps.reset(); 458 m_pImpl->m_bIsDescriptor = false; 459 } 460 461 /*-- 10.12.98 14:47:09--------------------------------------------------- 462 463 -----------------------------------------------------------------------*/ 464 uno::Reference< text::XTextRange > SAL_CALL 465 SwXTextSection::getAnchor() throw (uno::RuntimeException) 466 { 467 vos::OGuard aGuard(Application::GetSolarMutex()); 468 469 uno::Reference< text::XTextRange > xRet; 470 SwSectionFmt *const pSectFmt = m_pImpl->GetSectionFmt(); 471 if(pSectFmt) 472 { 473 const SwSection* pSect; 474 const SwNodeIndex* pIdx; 475 if( 0 != ( pSect = pSectFmt->GetSection() ) && 476 0 != ( pIdx = pSectFmt->GetCntnt().GetCntntIdx() ) && 477 pIdx->GetNode().GetNodes().IsDocNodes() ) 478 { 479 SwPaM aPaM(*pIdx); 480 aPaM.Move( fnMoveForward, fnGoCntnt ); 481 482 const SwEndNode* pEndNode = pIdx->GetNode().EndOfSectionNode(); 483 SwPaM aEnd(*pEndNode); 484 aEnd.Move( fnMoveBackward, fnGoCntnt ); 485 xRet = SwXTextRange::CreateXTextRange(*pSectFmt->GetDoc(), 486 *aPaM.Start(), aEnd.Start()); 487 } 488 } 489 return xRet; 490 } 491 /*-- 10.12.98 14:47:09--------------------------------------------------- 492 493 -----------------------------------------------------------------------*/ 494 void SAL_CALL SwXTextSection::dispose() throw (uno::RuntimeException) 495 { 496 vos::OGuard aGuard(Application::GetSolarMutex()); 497 498 SwSectionFmt *const pSectFmt = m_pImpl->GetSectionFmt(); 499 if (pSectFmt) 500 { 501 pSectFmt->GetDoc()->DelSectionFmt( pSectFmt ); 502 } 503 } 504 /*-- 10.12.98 14:47:10--------------------------------------------------- 505 506 -----------------------------------------------------------------------*/ 507 void SAL_CALL SwXTextSection::addEventListener( 508 const uno::Reference< lang::XEventListener > & xListener) 509 throw (uno::RuntimeException) 510 { 511 vos::OGuard g(Application::GetSolarMutex()); 512 513 if (!m_pImpl->GetSectionFmt()) 514 { 515 throw uno::RuntimeException(); 516 } 517 m_pImpl->m_ListenerContainer.AddListener(xListener); 518 } 519 /*-- 10.12.98 14:47:10--------------------------------------------------- 520 521 -----------------------------------------------------------------------*/ 522 void SAL_CALL SwXTextSection::removeEventListener( 523 const uno::Reference< lang::XEventListener > & xListener) 524 throw (uno::RuntimeException) 525 { 526 vos::OGuard g(Application::GetSolarMutex()); 527 528 if (!m_pImpl->GetSectionFmt() || 529 !m_pImpl->m_ListenerContainer.RemoveListener(xListener)) 530 { 531 throw uno::RuntimeException(); 532 } 533 } 534 /*-- 10.12.98 14:47:11--------------------------------------------------- 535 536 -----------------------------------------------------------------------*/ 537 uno::Reference< beans::XPropertySetInfo > SAL_CALL 538 SwXTextSection::getPropertySetInfo() throw (uno::RuntimeException) 539 { 540 vos::OGuard g(Application::GetSolarMutex()); 541 542 static const uno::Reference< beans::XPropertySetInfo > aRef = 543 m_pImpl->m_rPropSet.getPropertySetInfo(); 544 return aRef; 545 } 546 547 /* -----------------------------12.02.01 10:45-------------------------------- 548 549 ---------------------------------------------------------------------------*/ 550 static void 551 lcl_UpdateLinkType(SwSection & rSection, bool const bLinkUpdateAlways = true) 552 { 553 if (rSection.GetType() == DDE_LINK_SECTION) 554 { 555 // set update type; needs an established link 556 if (!rSection.IsConnected()) 557 { 558 rSection.CreateLink(CREATE_CONNECT); 559 } 560 rSection.SetUpdateType( static_cast< sal_uInt16 >((bLinkUpdateAlways) 561 ? sfx2::LINKUPDATE_ALWAYS : sfx2::LINKUPDATE_ONCALL) ); 562 } 563 } 564 565 static void 566 lcl_UpdateSection(SwSectionFmt *const pFmt, 567 ::std::auto_ptr<SwSectionData> const& pSectionData, 568 ::std::auto_ptr<SfxItemSet> const& pItemSet, 569 bool const bLinkModeChanged, bool const bLinkUpdateAlways = true) 570 { 571 if (pFmt) 572 { 573 SwSection & rSection = *pFmt->GetSection(); 574 SwDoc *const pDoc = pFmt->GetDoc(); 575 SwSectionFmts const& rFmts = pDoc->GetSections(); 576 UnoActionContext aContext(pDoc); 577 for (sal_uInt16 i = 0; i < rFmts.Count(); i++) 578 { 579 if (rFmts[i]->GetSection()->GetSectionName() 580 == rSection.GetSectionName()) 581 { 582 pDoc->UpdateSection(i, *pSectionData, pItemSet.get(), 583 pDoc->IsInReading()); 584 { 585 // temporarily remove actions to allow cursor update 586 UnoActionRemoveContext aRemoveContext( pDoc ); 587 } 588 589 if (bLinkModeChanged) 590 { 591 lcl_UpdateLinkType(rSection, bLinkUpdateAlways); 592 } 593 // section found and processed: break from loop 594 break; 595 } 596 } 597 } 598 } 599 600 void SwXTextSection::Impl::SetPropertyValues_Impl( 601 const uno::Sequence< OUString >& rPropertyNames, 602 const uno::Sequence< uno::Any >& rValues) 603 throw (beans::UnknownPropertyException, beans::PropertyVetoException, 604 lang::IllegalArgumentException, lang::WrappedTargetException, 605 uno::RuntimeException) 606 { 607 if(rPropertyNames.getLength() != rValues.getLength()) 608 { 609 throw lang::IllegalArgumentException(); 610 } 611 SwSectionFmt *const pFmt = GetSectionFmt(); 612 if (!pFmt && !m_bIsDescriptor) 613 { 614 throw uno::RuntimeException(); 615 } 616 617 ::std::auto_ptr<SwSectionData> const pSectionData( 618 (pFmt) ? new SwSectionData(*pFmt->GetSection()) : 0); 619 620 OUString const*const pPropertyNames = rPropertyNames.getConstArray(); 621 uno::Any const*const pValues = rValues.getConstArray(); 622 ::std::auto_ptr<SfxItemSet> pItemSet; 623 sal_Bool bLinkModeChanged = sal_False; 624 sal_Bool bLinkMode = sal_False; 625 626 for (sal_Int32 nProperty = 0; nProperty < rPropertyNames.getLength(); 627 nProperty++) 628 { 629 SfxItemPropertySimpleEntry const*const pEntry = 630 m_rPropSet.getPropertyMap()->getByName(pPropertyNames[nProperty]); 631 if (!pEntry) 632 { 633 throw beans::UnknownPropertyException( 634 OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: ")) 635 + pPropertyNames[nProperty], 636 static_cast<cppu::OWeakObject *>(& m_rThis)); 637 } 638 if (pEntry->nFlags & beans::PropertyAttribute::READONLY) 639 { 640 throw beans::PropertyVetoException( 641 OUString(RTL_CONSTASCII_USTRINGPARAM("Property is read-only: ")) 642 + pPropertyNames[nProperty], 643 static_cast<cppu::OWeakObject *>(& m_rThis)); 644 } 645 switch (pEntry->nWID) 646 { 647 case WID_SECT_CONDITION: 648 { 649 OUString uTmp; 650 pValues[nProperty] >>= uTmp; 651 if (m_bIsDescriptor) 652 { 653 m_pProps->m_sCondition = uTmp; 654 } 655 else 656 { 657 pSectionData->SetCondition(uTmp); 658 } 659 } 660 break; 661 case WID_SECT_DDE_TYPE: 662 case WID_SECT_DDE_FILE: 663 case WID_SECT_DDE_ELEMENT: 664 { 665 OUString uTmp; 666 pValues[nProperty] >>= uTmp; 667 String sTmp(uTmp); 668 if (m_bIsDescriptor) 669 { 670 if (!m_pProps->m_bDDE) 671 { 672 ::rtl::OUStringBuffer buf; 673 buf.append(sfx2::cTokenSeperator); 674 buf.append(sfx2::cTokenSeperator); 675 m_pProps->m_sLinkFileName = buf.makeStringAndClear(); 676 m_pProps->m_bDDE = true; 677 } 678 String sLinkFileName(m_pProps->m_sLinkFileName); 679 sLinkFileName.SetToken(pEntry->nWID - WID_SECT_DDE_TYPE, 680 sfx2::cTokenSeperator, sTmp); 681 m_pProps->m_sLinkFileName = sLinkFileName; 682 } 683 else 684 { 685 String sLinkFileName(pSectionData->GetLinkFileName()); 686 if (pSectionData->GetType() != DDE_LINK_SECTION) 687 { 688 sLinkFileName = sfx2::cTokenSeperator; 689 sLinkFileName += sfx2::cTokenSeperator; 690 pSectionData->SetType(DDE_LINK_SECTION); 691 } 692 sLinkFileName.SetToken(pEntry->nWID - WID_SECT_DDE_TYPE, 693 sfx2::cTokenSeperator, sTmp); 694 pSectionData->SetLinkFileName(sLinkFileName); 695 } 696 } 697 break; 698 case WID_SECT_DDE_AUTOUPDATE: 699 { 700 sal_Bool bVal(sal_False); 701 if (!(pValues[nProperty] >>= bVal)) 702 { 703 throw lang::IllegalArgumentException(); 704 } 705 if (m_bIsDescriptor) 706 { 707 m_pProps->m_bUpdateType = bVal; 708 } 709 else 710 { 711 bLinkModeChanged = sal_True; 712 bLinkMode = bVal; 713 } 714 } 715 break; 716 case WID_SECT_LINK: 717 { 718 text::SectionFileLink aLink; 719 if (!(pValues[nProperty] >>= aLink)) 720 { 721 throw lang::IllegalArgumentException(); 722 } 723 if (m_bIsDescriptor) 724 { 725 m_pProps->m_bDDE = sal_False; 726 m_pProps->m_sLinkFileName = aLink.FileURL; 727 m_pProps->m_sSectionFilter = aLink.FilterName; 728 } 729 else 730 { 731 if (pSectionData->GetType() != FILE_LINK_SECTION && 732 aLink.FileURL.getLength()) 733 { 734 pSectionData->SetType(FILE_LINK_SECTION); 735 } 736 ::rtl::OUStringBuffer sFileNameBuf; 737 if (aLink.FileURL.getLength()) 738 { 739 sFileNameBuf.append( URIHelper::SmartRel2Abs( 740 pFmt->GetDoc()->GetDocShell()->GetMedium() 741 ->GetURLObject(), 742 aLink.FileURL, URIHelper::GetMaybeFileHdl())); 743 } 744 sFileNameBuf.append(sfx2::cTokenSeperator); 745 sFileNameBuf.append(aLink.FilterName); 746 sFileNameBuf.append(sfx2::cTokenSeperator); 747 sFileNameBuf.append( 748 pSectionData->GetLinkFileName().GetToken(2, 749 sfx2::cTokenSeperator)); 750 const ::rtl::OUString sFileName( 751 sFileNameBuf.makeStringAndClear()); 752 pSectionData->SetLinkFileName(sFileName); 753 if (sFileName.getLength() < 3) 754 { 755 pSectionData->SetType(CONTENT_SECTION); 756 } 757 } 758 } 759 break; 760 case WID_SECT_REGION: 761 { 762 OUString sLink; 763 pValues[nProperty] >>= sLink; 764 if (m_bIsDescriptor) 765 { 766 m_pProps->m_bDDE = sal_False; 767 m_pProps->m_sSectionRegion = sLink; 768 } 769 else 770 { 771 if (pSectionData->GetType() != FILE_LINK_SECTION && 772 sLink.getLength()) 773 { 774 pSectionData->SetType(FILE_LINK_SECTION); 775 } 776 String sSectLink(pSectionData->GetLinkFileName()); 777 while (3 < sSectLink.GetTokenCount(sfx2::cTokenSeperator)) 778 { 779 sSectLink += sfx2::cTokenSeperator; 780 } 781 sSectLink.SetToken(2, sfx2::cTokenSeperator, sLink); 782 pSectionData->SetLinkFileName(sSectLink); 783 if (sSectLink.Len() < 3) 784 { 785 pSectionData->SetType(CONTENT_SECTION); 786 } 787 } 788 } 789 break; 790 case WID_SECT_VISIBLE: 791 { 792 sal_Bool bVal(sal_False); 793 if (!(pValues[nProperty] >>= bVal)) 794 { 795 throw lang::IllegalArgumentException(); 796 } 797 if (m_bIsDescriptor) 798 { 799 m_pProps->m_bHidden = !bVal; 800 } 801 else 802 { 803 pSectionData->SetHidden(!bVal); 804 } 805 } 806 break; 807 case WID_SECT_CURRENTLY_VISIBLE: 808 { 809 sal_Bool bVal(sal_False); 810 if (!(pValues[nProperty] >>= bVal)) 811 { 812 throw lang::IllegalArgumentException(); 813 } 814 if (m_bIsDescriptor) 815 { 816 m_pProps->m_bCondHidden = !bVal; 817 } 818 else 819 { 820 if (pSectionData->GetCondition().Len() != 0) 821 { 822 pSectionData->SetCondHidden(!bVal); 823 } 824 } 825 } 826 break; 827 case WID_SECT_PROTECTED: 828 { 829 sal_Bool bVal(sal_False); 830 if (!(pValues[nProperty] >>= bVal)) 831 { 832 throw lang::IllegalArgumentException(); 833 } 834 if (m_bIsDescriptor) 835 { 836 m_pProps->m_bProtect = bVal; 837 } 838 else 839 { 840 pSectionData->SetProtectFlag(bVal); 841 } 842 } 843 break; 844 // --> FME 2004-06-22 #114856# edit in readonly sections 845 case WID_SECT_EDIT_IN_READONLY: 846 { 847 sal_Bool bVal(sal_False); 848 if (!(pValues[nProperty] >>= bVal)) 849 { 850 throw lang::IllegalArgumentException(); 851 } 852 if (m_bIsDescriptor) 853 { 854 m_pProps->m_bEditInReadonly = bVal; 855 } 856 else 857 { 858 pSectionData->SetEditInReadonlyFlag(bVal); 859 } 860 } 861 // <-- 862 break; 863 case WID_SECT_PASSWORD: 864 { 865 uno::Sequence<sal_Int8> aSeq; 866 pValues[nProperty] >>= aSeq; 867 if (m_bIsDescriptor) 868 { 869 m_pProps->m_Password = aSeq; 870 } 871 else 872 { 873 pSectionData->SetPassword(aSeq); 874 } 875 } 876 break; 877 default: 878 { 879 if (pFmt) 880 { 881 const SfxItemSet& rOldAttrSet = pFmt->GetAttrSet(); 882 pItemSet.reset( new SfxItemSet(*rOldAttrSet.GetPool(), 883 pEntry->nWID, pEntry->nWID, 0)); 884 pItemSet->Put(rOldAttrSet); 885 m_rPropSet.setPropertyValue(*pEntry, 886 pValues[nProperty], *pItemSet); 887 } 888 else 889 { 890 SfxPoolItem* pPutItem = 0; 891 if (RES_COL == pEntry->nWID) 892 { 893 if (!m_pProps->m_pColItem.get()) 894 { 895 m_pProps->m_pColItem.reset(new SwFmtCol); 896 } 897 pPutItem = m_pProps->m_pColItem.get(); 898 } 899 else if (RES_BACKGROUND == pEntry->nWID) 900 { 901 if (!m_pProps->m_pBrushItem.get()) 902 { 903 m_pProps->m_pBrushItem.reset( 904 new SvxBrushItem(RES_BACKGROUND)); 905 } 906 pPutItem = m_pProps->m_pBrushItem.get(); 907 } 908 else if (RES_FTN_AT_TXTEND == pEntry->nWID) 909 { 910 if (!m_pProps->m_pFtnItem.get()) 911 { 912 m_pProps->m_pFtnItem.reset(new SwFmtFtnAtTxtEnd); 913 } 914 pPutItem = m_pProps->m_pFtnItem.get(); 915 } 916 else if (RES_END_AT_TXTEND == pEntry->nWID) 917 { 918 if (!m_pProps->m_pEndItem.get()) 919 { 920 m_pProps->m_pEndItem.reset(new SwFmtEndAtTxtEnd); 921 } 922 pPutItem = m_pProps->m_pEndItem.get(); 923 } 924 else if (RES_UNKNOWNATR_CONTAINER== pEntry->nWID) 925 { 926 if (!m_pProps->m_pXMLAttr.get()) 927 { 928 m_pProps->m_pXMLAttr.reset( 929 new SvXMLAttrContainerItem( 930 RES_UNKNOWNATR_CONTAINER)); 931 } 932 pPutItem = m_pProps->m_pXMLAttr.get(); 933 } 934 else if (RES_COLUMNBALANCE== pEntry->nWID) 935 { 936 if (!m_pProps->m_pNoBalanceItem.get()) 937 { 938 m_pProps->m_pNoBalanceItem.reset( 939 new SwFmtNoBalancedColumns(RES_COLUMNBALANCE)); 940 } 941 pPutItem = m_pProps->m_pNoBalanceItem.get(); 942 } 943 else if (RES_FRAMEDIR == pEntry->nWID) 944 { 945 if (!m_pProps->m_pFrameDirItem.get()) 946 { 947 m_pProps->m_pFrameDirItem.reset( 948 new SvxFrameDirectionItem( 949 FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR)); 950 } 951 pPutItem = m_pProps->m_pFrameDirItem.get(); 952 } 953 else if (RES_LR_SPACE == pEntry->nWID) 954 { 955 // #109700# 956 if (!m_pProps->m_pLRSpaceItem.get()) 957 { 958 m_pProps->m_pLRSpaceItem.reset( 959 new SvxLRSpaceItem( RES_LR_SPACE )); 960 } 961 pPutItem = m_pProps->m_pLRSpaceItem.get(); 962 } 963 if (pPutItem) 964 { 965 pPutItem->PutValue(pValues[nProperty], 966 pEntry->nMemberId); 967 } 968 } 969 } 970 } 971 } 972 973 lcl_UpdateSection(pFmt, pSectionData, pItemSet, bLinkModeChanged, 974 bLinkMode); 975 } 976 977 void SAL_CALL 978 SwXTextSection::setPropertyValues( 979 const uno::Sequence< ::rtl::OUString >& rPropertyNames, 980 const uno::Sequence< uno::Any >& rValues) 981 throw (beans::PropertyVetoException, lang::IllegalArgumentException, 982 lang::WrappedTargetException, uno::RuntimeException) 983 { 984 vos::OGuard aGuard(Application::GetSolarMutex()); 985 986 // workaround for bad designed API 987 try 988 { 989 m_pImpl->SetPropertyValues_Impl( rPropertyNames, rValues ); 990 } 991 catch (beans::UnknownPropertyException &rException) 992 { 993 // wrap the original (here not allowed) exception in 994 // a WrappedTargetException that gets thrown instead. 995 lang::WrappedTargetException aWExc; 996 aWExc.TargetException <<= rException; 997 throw aWExc; 998 } 999 } 1000 /*-- 10.12.98 14:47:11--------------------------------------------------- 1001 1002 -----------------------------------------------------------------------*/ 1003 void SwXTextSection::setPropertyValue( 1004 const OUString& rPropertyName, const uno::Any& rValue) 1005 throw (beans::UnknownPropertyException, beans::PropertyVetoException, 1006 lang::IllegalArgumentException, lang::WrappedTargetException, 1007 uno::RuntimeException ) 1008 { 1009 vos::OGuard aGuard(Application::GetSolarMutex()); 1010 1011 uno::Sequence< ::rtl::OUString > aPropertyNames(1); 1012 aPropertyNames.getArray()[0] = rPropertyName; 1013 uno::Sequence< uno::Any > aValues(1); 1014 aValues.getArray()[0] = rValue; 1015 m_pImpl->SetPropertyValues_Impl( aPropertyNames, aValues ); 1016 } 1017 1018 /* -----------------------------12.02.01 10:43-------------------------------- 1019 1020 ---------------------------------------------------------------------------*/ 1021 uno::Sequence< uno::Any > 1022 SwXTextSection::Impl::GetPropertyValues_Impl( 1023 const uno::Sequence< OUString > & rPropertyNames ) 1024 throw (beans::UnknownPropertyException, lang::WrappedTargetException, 1025 uno::RuntimeException) 1026 { 1027 SwSectionFmt *const pFmt = GetSectionFmt(); 1028 if (!pFmt && !m_bIsDescriptor) 1029 { 1030 throw uno::RuntimeException(); 1031 } 1032 1033 uno::Sequence< uno::Any > aRet(rPropertyNames.getLength()); 1034 uno::Any* pRet = aRet.getArray(); 1035 SwSection *const pSect = (pFmt) ? pFmt->GetSection() : 0; 1036 const OUString* pPropertyNames = rPropertyNames.getConstArray(); 1037 1038 for (sal_Int32 nProperty = 0; nProperty < rPropertyNames.getLength(); 1039 nProperty++) 1040 { 1041 SfxItemPropertySimpleEntry const*const pEntry = 1042 m_rPropSet.getPropertyMap()->getByName(pPropertyNames[nProperty]); 1043 if (!pEntry) 1044 { 1045 throw beans::UnknownPropertyException( 1046 OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: ")) 1047 + pPropertyNames[nProperty], 1048 static_cast<cppu::OWeakObject *>(& m_rThis)); 1049 } 1050 switch(pEntry->nWID) 1051 { 1052 case WID_SECT_CONDITION: 1053 { 1054 OUString uTmp( (m_bIsDescriptor) 1055 ? m_pProps->m_sCondition 1056 : ::rtl::OUString(pSect->GetCondition())); 1057 pRet[nProperty] <<= uTmp; 1058 } 1059 break; 1060 case WID_SECT_DDE_TYPE: 1061 case WID_SECT_DDE_FILE: 1062 case WID_SECT_DDE_ELEMENT: 1063 { 1064 ::rtl::OUString sRet; 1065 if (m_bIsDescriptor) 1066 { 1067 if (m_pProps->m_bDDE) 1068 { 1069 sRet = m_pProps->m_sLinkFileName; 1070 } 1071 } 1072 else if (DDE_LINK_SECTION == pSect->GetType()) 1073 { 1074 sRet = pSect->GetLinkFileName(); 1075 } 1076 sal_Int32 nDummy(0); 1077 sRet = sRet.getToken(pEntry->nWID - WID_SECT_DDE_TYPE, 1078 sfx2::cTokenSeperator, nDummy); 1079 pRet[nProperty] <<= sRet; 1080 } 1081 break; 1082 case WID_SECT_DDE_AUTOUPDATE: 1083 { 1084 // GetUpdateType() returns .._ALWAYS or .._ONCALL 1085 if (pSect && pSect->IsLinkType() && pSect->IsConnected()) // lijian i73247 1086 { 1087 const sal_Bool bTemp = 1088 (pSect->GetUpdateType() == sfx2::LINKUPDATE_ALWAYS); 1089 pRet[nProperty] <<= bTemp; 1090 } 1091 } 1092 break; 1093 case WID_SECT_LINK : 1094 { 1095 text::SectionFileLink aLink; 1096 if (m_bIsDescriptor) 1097 { 1098 if (!m_pProps->m_bDDE) 1099 { 1100 aLink.FileURL = m_pProps->m_sLinkFileName; 1101 aLink.FilterName = m_pProps->m_sSectionFilter; 1102 } 1103 } 1104 else if (FILE_LINK_SECTION == pSect->GetType()) 1105 { 1106 ::rtl::OUString sRet( pSect->GetLinkFileName() ); 1107 sal_Int32 nIndex(0); 1108 aLink.FileURL = 1109 sRet.getToken(0, sfx2::cTokenSeperator, nIndex); 1110 aLink.FilterName = 1111 sRet.getToken(0, sfx2::cTokenSeperator, nIndex); 1112 } 1113 pRet[nProperty] <<= aLink; 1114 } 1115 break; 1116 case WID_SECT_REGION : 1117 { 1118 ::rtl::OUString sRet; 1119 if (m_bIsDescriptor) 1120 { 1121 sRet = m_pProps->m_sSectionRegion; 1122 } 1123 else if (FILE_LINK_SECTION == pSect->GetType()) 1124 { 1125 sRet = pSect->GetLinkFileName().GetToken(2, 1126 sfx2::cTokenSeperator); 1127 } 1128 pRet[nProperty] <<= sRet; 1129 } 1130 break; 1131 case WID_SECT_VISIBLE : 1132 { 1133 const sal_Bool bTemp = (m_bIsDescriptor) 1134 ? !m_pProps->m_bHidden : !pSect->IsHidden(); 1135 pRet[nProperty] <<= bTemp; 1136 } 1137 break; 1138 case WID_SECT_CURRENTLY_VISIBLE: 1139 { 1140 const sal_Bool bTemp = (m_bIsDescriptor) 1141 ? !m_pProps->m_bCondHidden : !pSect->IsCondHidden(); 1142 pRet[nProperty] <<= bTemp; 1143 } 1144 break; 1145 case WID_SECT_PROTECTED: 1146 { 1147 const sal_Bool bTemp = (m_bIsDescriptor) 1148 ? m_pProps->m_bProtect : pSect->IsProtect(); 1149 pRet[nProperty] <<= bTemp; 1150 } 1151 break; 1152 // --> FME 2004-06-22 #114856# edit in readonly sections 1153 case WID_SECT_EDIT_IN_READONLY: 1154 { 1155 const sal_Bool bTemp = (m_bIsDescriptor) 1156 ? m_pProps->m_bEditInReadonly : pSect->IsEditInReadonly(); 1157 pRet[nProperty] <<= bTemp; 1158 } 1159 break; 1160 // <-- 1161 case FN_PARAM_LINK_DISPLAY_NAME: 1162 { 1163 if (pFmt) 1164 { 1165 pRet[nProperty] <<= 1166 OUString(pFmt->GetSection()->GetSectionName()); 1167 } 1168 } 1169 break; 1170 case WID_SECT_DOCUMENT_INDEX: 1171 { 1172 // search enclosing index 1173 SwSection* pEnclosingSection = pSect; 1174 while ((pEnclosingSection != NULL) && 1175 (TOX_CONTENT_SECTION != pEnclosingSection->GetType())) 1176 { 1177 pEnclosingSection = pEnclosingSection->GetParent(); 1178 } 1179 if (pEnclosingSection) 1180 { 1181 // convert section to TOXBase and get SwXDocumentIndex 1182 SwTOXBaseSection *const pTOXBaseSect = 1183 PTR_CAST(SwTOXBaseSection, pEnclosingSection); 1184 const uno::Reference<text::XDocumentIndex> xIndex = 1185 SwXDocumentIndex::CreateXDocumentIndex( 1186 *pTOXBaseSect->GetFmt()->GetDoc(), *pTOXBaseSect); 1187 pRet[nProperty] <<= xIndex; 1188 } 1189 // else: no enclosing index found -> empty return value 1190 } 1191 break; 1192 case WID_SECT_IS_GLOBAL_DOC_SECTION: 1193 { 1194 const sal_Bool bRet = (NULL == pFmt) ? sal_False : 1195 static_cast<sal_Bool>(NULL != pFmt->GetGlobalDocSection()); 1196 pRet[nProperty] <<= bRet; 1197 } 1198 break; 1199 case FN_UNO_ANCHOR_TYPES: 1200 case FN_UNO_TEXT_WRAP: 1201 case FN_UNO_ANCHOR_TYPE: 1202 ::sw::GetDefaultTextContentValue( 1203 pRet[nProperty], OUString(), pEntry->nWID); 1204 break; 1205 case FN_UNO_REDLINE_NODE_START: 1206 case FN_UNO_REDLINE_NODE_END: 1207 { 1208 if (!pFmt) 1209 break; // lijian i73247 1210 SwNode* pSectNode = pFmt->GetSectionNode(); 1211 if (FN_UNO_REDLINE_NODE_END == pEntry->nWID) 1212 { 1213 pSectNode = pSectNode->EndOfSectionNode(); 1214 } 1215 const SwRedlineTbl& rRedTbl = 1216 pFmt->GetDoc()->GetRedlineTbl(); 1217 for (sal_uInt16 nRed = 0; nRed < rRedTbl.Count(); nRed++) 1218 { 1219 const SwRedline* pRedline = rRedTbl[nRed]; 1220 SwNode const*const pRedPointNode = pRedline->GetNode(sal_True); 1221 SwNode const*const pRedMarkNode = pRedline->GetNode(sal_False); 1222 if ((pRedPointNode == pSectNode) || 1223 (pRedMarkNode == pSectNode)) 1224 { 1225 SwNode const*const pStartOfRedline = 1226 (SwNodeIndex(*pRedPointNode) <= 1227 SwNodeIndex(*pRedMarkNode)) 1228 ? pRedPointNode : pRedMarkNode; 1229 const bool bIsStart = (pStartOfRedline == pSectNode); 1230 pRet[nProperty] <<= 1231 SwXRedlinePortion::CreateRedlineProperties( 1232 *pRedline, bIsStart); 1233 break; 1234 } 1235 } 1236 } 1237 break; 1238 case WID_SECT_PASSWORD: 1239 { 1240 pRet[nProperty] <<= (m_bIsDescriptor) 1241 ? m_pProps->m_Password : pSect->GetPassword(); 1242 } 1243 break; 1244 default: 1245 { 1246 if (pFmt) 1247 { 1248 m_rPropSet.getPropertyValue(*pEntry, 1249 pFmt->GetAttrSet(), pRet[nProperty]); 1250 } 1251 else 1252 { 1253 const SfxPoolItem* pQueryItem = 0; 1254 if (RES_COL == pEntry->nWID) 1255 { 1256 if (!m_pProps->m_pColItem.get()) 1257 { 1258 m_pProps->m_pColItem.reset(new SwFmtCol); 1259 } 1260 pQueryItem = m_pProps->m_pColItem.get(); 1261 } 1262 else if (RES_BACKGROUND == pEntry->nWID) 1263 { 1264 if (!m_pProps->m_pBrushItem.get()) 1265 { 1266 m_pProps->m_pBrushItem.reset( 1267 new SvxBrushItem(RES_BACKGROUND)); 1268 } 1269 pQueryItem = m_pProps->m_pBrushItem.get(); 1270 } 1271 else if (RES_FTN_AT_TXTEND == pEntry->nWID) 1272 { 1273 if (!m_pProps->m_pFtnItem.get()) 1274 { 1275 m_pProps->m_pFtnItem.reset(new SwFmtFtnAtTxtEnd); 1276 } 1277 pQueryItem = m_pProps->m_pFtnItem.get(); 1278 } 1279 else if (RES_END_AT_TXTEND == pEntry->nWID) 1280 { 1281 if (!m_pProps->m_pEndItem.get()) 1282 { 1283 m_pProps->m_pEndItem.reset(new SwFmtEndAtTxtEnd); 1284 } 1285 pQueryItem = m_pProps->m_pEndItem.get(); 1286 } 1287 else if (RES_UNKNOWNATR_CONTAINER== pEntry->nWID) 1288 { 1289 if (!m_pProps->m_pXMLAttr.get()) 1290 { 1291 m_pProps->m_pXMLAttr.reset( 1292 new SvXMLAttrContainerItem); 1293 } 1294 pQueryItem = m_pProps->m_pXMLAttr.get(); 1295 } 1296 else if (RES_COLUMNBALANCE== pEntry->nWID) 1297 { 1298 if (!m_pProps->m_pNoBalanceItem.get()) 1299 { 1300 m_pProps->m_pNoBalanceItem.reset( 1301 new SwFmtNoBalancedColumns); 1302 } 1303 pQueryItem = m_pProps->m_pNoBalanceItem.get(); 1304 } 1305 else if (RES_FRAMEDIR == pEntry->nWID) 1306 { 1307 if (!m_pProps->m_pFrameDirItem.get()) 1308 { 1309 m_pProps->m_pFrameDirItem.reset( 1310 new SvxFrameDirectionItem( 1311 FRMDIR_ENVIRONMENT, RES_FRAMEDIR)); 1312 } 1313 pQueryItem = m_pProps->m_pFrameDirItem.get(); 1314 } 1315 /* -> #109700# */ 1316 else if (RES_LR_SPACE == pEntry->nWID) 1317 { 1318 if (!m_pProps->m_pLRSpaceItem.get()) 1319 { 1320 m_pProps->m_pLRSpaceItem.reset( 1321 new SvxLRSpaceItem( RES_LR_SPACE )); 1322 } 1323 pQueryItem = m_pProps->m_pLRSpaceItem.get(); 1324 } 1325 /* <- #109700# */ 1326 if (pQueryItem) 1327 { 1328 pQueryItem->QueryValue(pRet[nProperty], 1329 pEntry->nMemberId); 1330 } 1331 } 1332 } 1333 } 1334 } 1335 return aRet; 1336 } 1337 1338 /* -----------------------------04.11.03 10:43-------------------------------- 1339 1340 ---------------------------------------------------------------------------*/ 1341 uno::Sequence< uno::Any > SAL_CALL 1342 SwXTextSection::getPropertyValues( 1343 const uno::Sequence< ::rtl::OUString >& rPropertyNames) 1344 throw (uno::RuntimeException) 1345 { 1346 vos::OGuard aGuard(Application::GetSolarMutex()); 1347 uno::Sequence< uno::Any > aValues; 1348 1349 // workaround for bad designed API 1350 try 1351 { 1352 aValues = m_pImpl->GetPropertyValues_Impl( rPropertyNames ); 1353 } 1354 catch (beans::UnknownPropertyException &) 1355 { 1356 throw uno::RuntimeException(OUString( 1357 RTL_CONSTASCII_USTRINGPARAM("Unknown property exception caught")), 1358 static_cast<cppu::OWeakObject *>(this)); 1359 } 1360 catch (lang::WrappedTargetException &) 1361 { 1362 throw uno::RuntimeException(OUString( 1363 RTL_CONSTASCII_USTRINGPARAM("WrappedTargetException caught")), 1364 static_cast<cppu::OWeakObject *>(this)); 1365 } 1366 1367 return aValues; 1368 } 1369 /*-- 10.12.98 14:47:12--------------------------------------------------- 1370 1371 -----------------------------------------------------------------------*/ 1372 uno::Any SAL_CALL 1373 SwXTextSection::getPropertyValue(const OUString& rPropertyName) 1374 throw (beans::UnknownPropertyException, lang::WrappedTargetException, 1375 uno::RuntimeException) 1376 { 1377 vos::OGuard aGuard(Application::GetSolarMutex()); 1378 1379 uno::Sequence< ::rtl::OUString > aPropertyNames(1); 1380 aPropertyNames.getArray()[0] = rPropertyName; 1381 return m_pImpl->GetPropertyValues_Impl(aPropertyNames).getConstArray()[0]; 1382 } 1383 /* -----------------------------12.02.01 10:30-------------------------------- 1384 1385 ---------------------------------------------------------------------------*/ 1386 void SAL_CALL SwXTextSection::addPropertiesChangeListener( 1387 const uno::Sequence< OUString >& /*aPropertyNames*/, 1388 const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ ) 1389 throw (uno::RuntimeException) 1390 { 1391 OSL_ENSURE(false, 1392 "SwXTextSection::addPropertiesChangeListener(): not implemented"); 1393 } 1394 1395 /* -----------------------------12.02.01 10:30-------------------------------- 1396 1397 ---------------------------------------------------------------------------*/ 1398 void SAL_CALL SwXTextSection::removePropertiesChangeListener( 1399 const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ ) 1400 throw (uno::RuntimeException) 1401 { 1402 OSL_ENSURE(false, 1403 "SwXTextSection::removePropertiesChangeListener(): not implemented"); 1404 } 1405 1406 /* -----------------------------12.02.01 10:30-------------------------------- 1407 1408 ---------------------------------------------------------------------------*/ 1409 void SAL_CALL SwXTextSection::firePropertiesChangeEvent( 1410 const uno::Sequence< OUString >& /*aPropertyNames*/, 1411 const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ ) 1412 throw(uno::RuntimeException) 1413 { 1414 OSL_ENSURE(false, 1415 "SwXTextSection::firePropertiesChangeEvent(): not implemented"); 1416 } 1417 1418 /*-- 10.12.98 14:47:13--------------------------------------------------- 1419 1420 -----------------------------------------------------------------------*/ 1421 void SAL_CALL 1422 SwXTextSection::addPropertyChangeListener( 1423 const ::rtl::OUString& /*rPropertyName*/, 1424 const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/) 1425 throw (beans::UnknownPropertyException, lang::WrappedTargetException, 1426 uno::RuntimeException) 1427 { 1428 OSL_ENSURE(false, 1429 "SwXTextSection::addPropertyChangeListener(): not implemented"); 1430 } 1431 1432 void SAL_CALL 1433 SwXTextSection::removePropertyChangeListener( 1434 const ::rtl::OUString& /*rPropertyName*/, 1435 const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/) 1436 throw (beans::UnknownPropertyException, lang::WrappedTargetException, 1437 uno::RuntimeException) 1438 { 1439 OSL_ENSURE(false, 1440 "SwXTextSection::removePropertyChangeListener(): not implemented"); 1441 } 1442 1443 void SAL_CALL 1444 SwXTextSection::addVetoableChangeListener( 1445 const ::rtl::OUString& /*rPropertyName*/, 1446 const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/) 1447 throw (beans::UnknownPropertyException, lang::WrappedTargetException, 1448 uno::RuntimeException) 1449 { 1450 OSL_ENSURE(false, 1451 "SwXTextSection::addVetoableChangeListener(): not implemented"); 1452 } 1453 1454 void SAL_CALL 1455 SwXTextSection::removeVetoableChangeListener( 1456 const ::rtl::OUString& /*rPropertyName*/, 1457 const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/) 1458 throw (beans::UnknownPropertyException, lang::WrappedTargetException, 1459 uno::RuntimeException) 1460 { 1461 OSL_ENSURE(false, 1462 "SwXTextSection::removeVetoableChangeListener(): not implemented"); 1463 } 1464 1465 /*-- 08.11.00 10:47:55--------------------------------------------------- 1466 1467 -----------------------------------------------------------------------*/ 1468 beans::PropertyState SAL_CALL 1469 SwXTextSection::getPropertyState(const OUString& rPropertyName) 1470 throw (beans::UnknownPropertyException, uno::RuntimeException) 1471 { 1472 vos::OGuard aGuard(Application::GetSolarMutex()); 1473 1474 uno::Sequence< OUString > aNames(1); 1475 aNames.getArray()[0] = rPropertyName; 1476 return getPropertyStates(aNames).getConstArray()[0]; 1477 } 1478 /*-- 08.11.00 10:47:55--------------------------------------------------- 1479 1480 -----------------------------------------------------------------------*/ 1481 uno::Sequence< beans::PropertyState > SAL_CALL 1482 SwXTextSection::getPropertyStates( 1483 const uno::Sequence< OUString >& rPropertyNames) 1484 throw (beans::UnknownPropertyException, uno::RuntimeException) 1485 { 1486 vos::OGuard aGuard(Application::GetSolarMutex()); 1487 1488 SwSectionFmt *const pFmt = m_pImpl->GetSectionFmt(); 1489 if (!pFmt && !m_pImpl->m_bIsDescriptor) 1490 { 1491 throw uno::RuntimeException(); 1492 } 1493 1494 uno::Sequence< beans::PropertyState > aStates(rPropertyNames.getLength()); 1495 beans::PropertyState *const pStates = aStates.getArray(); 1496 const OUString* pNames = rPropertyNames.getConstArray(); 1497 for (sal_Int32 i = 0; i < rPropertyNames.getLength(); i++) 1498 { 1499 pStates[i] = beans::PropertyState_DEFAULT_VALUE; 1500 SfxItemPropertySimpleEntry const*const pEntry = 1501 m_pImpl->m_rPropSet.getPropertyMap()->getByName( pNames[i]); 1502 if (!pEntry) 1503 { 1504 throw beans::UnknownPropertyException( 1505 OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: ")) 1506 + pNames[i], static_cast< cppu::OWeakObject* >(this)); 1507 } 1508 switch (pEntry->nWID) 1509 { 1510 case WID_SECT_CONDITION: 1511 case WID_SECT_DDE_TYPE: 1512 case WID_SECT_DDE_FILE: 1513 case WID_SECT_DDE_ELEMENT: 1514 case WID_SECT_DDE_AUTOUPDATE: 1515 case WID_SECT_LINK: 1516 case WID_SECT_REGION : 1517 case WID_SECT_VISIBLE: 1518 case WID_SECT_PROTECTED: 1519 // --> FME 2004-06-22 #114856# edit in readonly sections 1520 case WID_SECT_EDIT_IN_READONLY: 1521 // <-- 1522 case FN_PARAM_LINK_DISPLAY_NAME: 1523 case FN_UNO_ANCHOR_TYPES: 1524 case FN_UNO_TEXT_WRAP: 1525 case FN_UNO_ANCHOR_TYPE: 1526 pStates[i] = beans::PropertyState_DIRECT_VALUE; 1527 break; 1528 default: 1529 { 1530 if (pFmt) 1531 { 1532 pStates[i] = m_pImpl->m_rPropSet.getPropertyState( 1533 pNames[i], pFmt->GetAttrSet()); 1534 } 1535 else 1536 { 1537 if (RES_COL == pEntry->nWID) 1538 { 1539 if (!m_pImpl->m_pProps->m_pColItem.get()) 1540 { 1541 pStates[i] = beans::PropertyState_DEFAULT_VALUE; 1542 } 1543 else 1544 { 1545 pStates[i] = beans::PropertyState_DIRECT_VALUE; 1546 } 1547 } 1548 else //if(RES_BACKGROUND == pEntry->nWID) 1549 { 1550 if (!m_pImpl->m_pProps->m_pBrushItem.get()) 1551 { 1552 pStates[i] = beans::PropertyState_DEFAULT_VALUE; 1553 } 1554 else 1555 { 1556 pStates[i] = beans::PropertyState_DIRECT_VALUE; 1557 } 1558 } 1559 } 1560 } 1561 } 1562 } 1563 return aStates; 1564 } 1565 1566 /*-- 08.11.00 10:47:55--------------------------------------------------- 1567 1568 -----------------------------------------------------------------------*/ 1569 void SAL_CALL 1570 SwXTextSection::setPropertyToDefault(const OUString& rPropertyName) 1571 throw (beans::UnknownPropertyException, uno::RuntimeException) 1572 { 1573 vos::OGuard aGuard(Application::GetSolarMutex()); 1574 1575 SwSectionFmt *const pFmt = m_pImpl->GetSectionFmt(); 1576 if (!pFmt && !m_pImpl->m_bIsDescriptor) 1577 { 1578 throw uno::RuntimeException(); 1579 } 1580 1581 SfxItemPropertySimpleEntry const*const pEntry = 1582 m_pImpl->m_rPropSet.getPropertyMap()->getByName(rPropertyName); 1583 if (!pEntry) 1584 { 1585 throw beans::UnknownPropertyException( 1586 OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: ")) 1587 + rPropertyName, static_cast< cppu::OWeakObject* >(this)); 1588 } 1589 if (pEntry->nFlags & beans::PropertyAttribute::READONLY) 1590 { 1591 throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM( 1592 "setPropertyToDefault: property is read-only: ")) 1593 + rPropertyName, 1594 static_cast<cppu::OWeakObject *>(this)); 1595 } 1596 1597 ::std::auto_ptr<SwSectionData> const pSectionData( 1598 (pFmt) ? new SwSectionData(*pFmt->GetSection()) : 0); 1599 1600 ::std::auto_ptr<SfxItemSet> pNewAttrSet; 1601 bool bLinkModeChanged = false; 1602 1603 switch (pEntry->nWID) 1604 { 1605 case WID_SECT_CONDITION: 1606 { 1607 if (m_pImpl->m_bIsDescriptor) 1608 { 1609 m_pImpl->m_pProps->m_sCondition = aEmptyStr; 1610 } 1611 else 1612 { 1613 pSectionData->SetCondition(aEmptyStr); 1614 } 1615 } 1616 break; 1617 case WID_SECT_DDE_TYPE : 1618 case WID_SECT_DDE_FILE : 1619 case WID_SECT_DDE_ELEMENT : 1620 case WID_SECT_LINK : 1621 case WID_SECT_REGION : 1622 if (m_pImpl->m_bIsDescriptor) 1623 { 1624 m_pImpl->m_pProps->m_bDDE = false; 1625 m_pImpl->m_pProps->m_sLinkFileName = ::rtl::OUString(); 1626 m_pImpl->m_pProps->m_sSectionRegion = ::rtl::OUString(); 1627 m_pImpl->m_pProps->m_sSectionFilter = ::rtl::OUString(); 1628 } 1629 else 1630 { 1631 pSectionData->SetType(CONTENT_SECTION); 1632 } 1633 break; 1634 case WID_SECT_DDE_AUTOUPDATE: 1635 if (m_pImpl->m_bIsDescriptor) 1636 { 1637 m_pImpl->m_pProps->m_bUpdateType = true; 1638 } 1639 else 1640 { 1641 bLinkModeChanged = true; 1642 } 1643 break; 1644 case WID_SECT_VISIBLE : 1645 { 1646 if (m_pImpl->m_bIsDescriptor) 1647 { 1648 m_pImpl->m_pProps->m_bHidden = false; 1649 } 1650 else 1651 { 1652 pSectionData->SetHidden(false); 1653 } 1654 } 1655 break; 1656 case WID_SECT_PROTECTED: 1657 { 1658 if (m_pImpl->m_bIsDescriptor) 1659 { 1660 m_pImpl->m_pProps->m_bProtect = false; 1661 } 1662 else 1663 { 1664 pSectionData->SetProtectFlag(false); 1665 } 1666 } 1667 break; 1668 // --> FME 2004-06-22 #114856# edit in readonly sections 1669 case WID_SECT_EDIT_IN_READONLY: 1670 { 1671 if (m_pImpl->m_bIsDescriptor) 1672 { 1673 m_pImpl->m_pProps->m_bEditInReadonly = false; 1674 } 1675 else 1676 { 1677 pSectionData->SetEditInReadonlyFlag(false); 1678 } 1679 } 1680 break; 1681 // <-- 1682 1683 case FN_UNO_ANCHOR_TYPES: 1684 case FN_UNO_TEXT_WRAP: 1685 case FN_UNO_ANCHOR_TYPE: 1686 break; 1687 default: 1688 { 1689 if (pEntry->nWID <= SFX_WHICH_MAX) 1690 { 1691 if (pFmt) 1692 { 1693 const SfxItemSet& rOldAttrSet = pFmt->GetAttrSet(); 1694 pNewAttrSet.reset( new SfxItemSet(*rOldAttrSet.GetPool(), 1695 pEntry->nWID, pEntry->nWID, 0)); 1696 pNewAttrSet->ClearItem(pEntry->nWID); 1697 } 1698 else 1699 { 1700 if (RES_COL == pEntry->nWID) 1701 { 1702 m_pImpl->m_pProps->m_pColItem.reset(); 1703 } 1704 else if (RES_BACKGROUND == pEntry->nWID) 1705 { 1706 m_pImpl->m_pProps->m_pBrushItem.reset(); 1707 } 1708 } 1709 } 1710 } 1711 } 1712 1713 lcl_UpdateSection(pFmt, pSectionData, pNewAttrSet, bLinkModeChanged); 1714 } 1715 1716 /*-- 08.11.00 10:47:56--------------------------------------------------- 1717 1718 -----------------------------------------------------------------------*/ 1719 uno::Any SAL_CALL 1720 SwXTextSection::getPropertyDefault(const OUString& rPropertyName) 1721 throw (beans::UnknownPropertyException, lang::WrappedTargetException, 1722 uno::RuntimeException) 1723 { 1724 vos::OGuard aGuard(Application::GetSolarMutex()); 1725 1726 uno::Any aRet; 1727 SwSectionFmt *const pFmt = m_pImpl->GetSectionFmt(); 1728 SfxItemPropertySimpleEntry const*const pEntry = 1729 m_pImpl->m_rPropSet.getPropertyMap()->getByName(rPropertyName); 1730 if (!pEntry) 1731 { 1732 throw beans::UnknownPropertyException( 1733 OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: ")) 1734 + rPropertyName, 1735 static_cast<cppu::OWeakObject *>(this)); 1736 } 1737 1738 switch(pEntry->nWID) 1739 { 1740 case WID_SECT_CONDITION: 1741 case WID_SECT_DDE_TYPE : 1742 case WID_SECT_DDE_FILE : 1743 case WID_SECT_DDE_ELEMENT : 1744 case WID_SECT_REGION : 1745 case FN_PARAM_LINK_DISPLAY_NAME: 1746 aRet <<= OUString(); 1747 break; 1748 case WID_SECT_LINK : 1749 aRet <<= text::SectionFileLink(); 1750 break; 1751 case WID_SECT_DDE_AUTOUPDATE: 1752 case WID_SECT_VISIBLE : 1753 { 1754 sal_Bool bTemp = sal_True; 1755 aRet.setValue( &bTemp, ::getCppuBooleanType()); 1756 } 1757 break; 1758 case WID_SECT_PROTECTED: 1759 // --> FME 2004-06-22 #114856# edit in readonly sections 1760 case WID_SECT_EDIT_IN_READONLY: 1761 // <-- 1762 { 1763 sal_Bool bTemp = sal_False; 1764 aRet.setValue( &bTemp, ::getCppuBooleanType()); 1765 } 1766 break; 1767 case FN_UNO_ANCHOR_TYPES: 1768 case FN_UNO_TEXT_WRAP: 1769 case FN_UNO_ANCHOR_TYPE: 1770 ::sw::GetDefaultTextContentValue(aRet, OUString(), pEntry->nWID); 1771 break; 1772 default: 1773 if(pFmt && pEntry->nWID <= SFX_WHICH_MAX) 1774 { 1775 SwDoc *const pDoc = pFmt->GetDoc(); 1776 const SfxPoolItem& rDefItem = 1777 pDoc->GetAttrPool().GetDefaultItem(pEntry->nWID); 1778 rDefItem.QueryValue(aRet, pEntry->nMemberId); 1779 } 1780 } 1781 return aRet; 1782 } 1783 1784 /*-- 10.12.98 14:47:15--------------------------------------------------- 1785 1786 -----------------------------------------------------------------------*/ 1787 OUString SAL_CALL SwXTextSection::getName() throw (uno::RuntimeException) 1788 { 1789 vos::OGuard aGuard(Application::GetSolarMutex()); 1790 1791 ::rtl::OUString sRet; 1792 SwSectionFmt const*const pFmt = m_pImpl->GetSectionFmt(); 1793 if(pFmt) 1794 { 1795 sRet = pFmt->GetSection()->GetSectionName(); 1796 } 1797 else if (m_pImpl->m_bIsDescriptor) 1798 { 1799 sRet = m_pImpl->m_sName; 1800 } 1801 else 1802 { 1803 throw uno::RuntimeException(); 1804 } 1805 return sRet; 1806 } 1807 /*-- 10.12.98 14:47:16--------------------------------------------------- 1808 1809 -----------------------------------------------------------------------*/ 1810 void SAL_CALL SwXTextSection::setName(const OUString& rName) 1811 throw (uno::RuntimeException) 1812 { 1813 vos::OGuard aGuard(Application::GetSolarMutex()); 1814 1815 SwSectionFmt *const pFmt = m_pImpl->GetSectionFmt(); 1816 if(pFmt) 1817 { 1818 SwSection *const pSect = pFmt->GetSection(); 1819 SwSectionData aSection(*pSect); 1820 String sNewName(rName); 1821 aSection.SetSectionName(sNewName); 1822 1823 const SwSectionFmts& rFmts = pFmt->GetDoc()->GetSections(); 1824 sal_uInt16 nApplyPos = USHRT_MAX; 1825 for( sal_uInt16 i = 0; i < rFmts.Count(); i++ ) 1826 { 1827 if(rFmts[i]->GetSection() == pSect) 1828 { 1829 nApplyPos = i; 1830 } 1831 else if (sNewName == rFmts[i]->GetSection()->GetSectionName()) 1832 { 1833 throw uno::RuntimeException(); 1834 } 1835 } 1836 if(nApplyPos != USHRT_MAX) 1837 { 1838 { 1839 UnoActionContext aContext(pFmt->GetDoc()); 1840 pFmt->GetDoc()->UpdateSection(nApplyPos, aSection); 1841 } 1842 { 1843 // temporarily remove actions to allow cursor update 1844 UnoActionRemoveContext aRemoveContext( pFmt->GetDoc() ); 1845 } 1846 } 1847 } 1848 else if (m_pImpl->m_bIsDescriptor) 1849 { 1850 m_pImpl->m_sName = rName; 1851 } 1852 else 1853 { 1854 throw uno::RuntimeException(); 1855 } 1856 } 1857 /* -----------------02.11.99 11:30------------------- 1858 1859 --------------------------------------------------*/ 1860 OUString SAL_CALL 1861 SwXTextSection::getImplementationName() throw (uno::RuntimeException) 1862 { 1863 return C2U("SwXTextSection"); 1864 } 1865 1866 /* -----------------02.11.99 11:30------------------- 1867 1868 --------------------------------------------------*/ 1869 static char const*const g_ServicesTextSection[] = 1870 { 1871 "com.sun.star.text.TextContent", 1872 "com.sun.star.text.TextSection", 1873 "com.sun.star.document.LinkTarget", 1874 }; 1875 static const size_t g_nServicesTextSection( 1876 sizeof(g_ServicesTextSection)/sizeof(g_ServicesTextSection[0])); 1877 1878 sal_Bool SAL_CALL SwXTextSection::supportsService(const OUString& rServiceName) 1879 throw (uno::RuntimeException) 1880 { 1881 return ::sw::SupportsServiceImpl( 1882 g_nServicesTextSection, g_ServicesTextSection, rServiceName); 1883 } 1884 1885 /* -----------------02.11.99 11:30------------------- 1886 1887 --------------------------------------------------*/ 1888 uno::Sequence< OUString > SAL_CALL 1889 SwXTextSection::getSupportedServiceNames() throw (uno::RuntimeException) 1890 { 1891 return ::sw::GetSupportedServiceNamesImpl( 1892 g_nServicesTextSection, g_ServicesTextSection); 1893 } 1894 1895 1896 // MetadatableMixin 1897 ::sfx2::Metadatable* SwXTextSection::GetCoreObject() 1898 { 1899 SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() ); 1900 return pSectionFmt; 1901 } 1902 1903 uno::Reference<frame::XModel> SwXTextSection::GetModel() 1904 { 1905 SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() ); 1906 if (pSectionFmt) 1907 { 1908 SwDocShell const*const pShell( pSectionFmt->GetDoc()->GetDocShell() ); 1909 return (pShell) ? pShell->GetModel() : 0; 1910 } 1911 return 0; 1912 } 1913 1914