merge the formfield patch from ooo-build
[ooovba.git] / sw / source / core / unocore / unoidx.cxx
blob41643101c18a23cc3fec695e1d5395c14e6482ff
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unoidx.cxx,v $
10 * $Revision: 1.68 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <hints.hxx>
36 #include <tools/debug.hxx>
37 #include <vos/mutex.hxx>
38 #include <vcl/svapp.hxx>
39 #include <svx/unolingu.hxx>
40 #include <com/sun/star/text/ChapterFormat.hpp>
41 #include <com/sun/star/text/ReferenceFieldPart.hpp>
42 #include <com/sun/star/text/BibliographyDataField.hpp>
43 #include <com/sun/star/frame/XModel.hpp>
44 #include <com/sun/star/text/XTextDocument.hpp>
45 #include <com/sun/star/beans/PropertyAttribute.hpp>
46 #ifndef _CMDID_H
47 #include <cmdid.h>
48 #endif
49 #include <swtypes.hxx>
50 #include <shellres.hxx>
51 #include <viewsh.hxx>
52 #include <doc.hxx>
53 #include <docary.hxx>
54 #include <poolfmt.hxx>
55 #ifndef _POOLFMT_HRC
56 #include <poolfmt.hrc>
57 #endif
58 #include <pagedesc.hxx>
59 #include <unomap.hxx>
60 #include <unoobj.hxx>
61 #include <doctxm.hxx>
62 #include <txttxmrk.hxx>
63 #include <unocrsr.hxx>
64 #include <unostyle.hxx>
65 #include <ndtxt.hxx>
66 #include <unoidx.hxx>
67 #ifndef _DOCSH_HXX //autogen
68 #include <docsh.hxx>
69 #endif
70 #include <chpfld.hxx>
71 #include <SwStyleNameMapper.hxx>
73 using namespace ::com::sun::star;
74 using ::rtl::OUString;
76 //-----------------------------------------------------------------------------
77 String lcl_AnyToString(uno::Any rVal) throw(lang::IllegalArgumentException)
79 OUString sRet;
80 if(!(rVal >>= sRet))
81 throw lang::IllegalArgumentException();
82 return sRet;
84 //-----------------------------------------------------------------------------
85 sal_Int16 lcl_AnyToInt16(uno::Any rVal) throw(lang::IllegalArgumentException)
87 sal_Int16 nRet = 0;
88 if(!(rVal >>= nRet))
89 throw lang::IllegalArgumentException();
90 return nRet;
92 //-----------------------------------------------------------------------------
93 sal_Bool lcl_AnyToBool(uno::Any rVal) throw(lang::IllegalArgumentException)
95 sal_Bool bRet = sal_False;
96 if(!(rVal >>= bRet))
97 throw lang::IllegalArgumentException();
98 return bRet;
100 /******************************************************************************
102 ******************************************************************************/
103 //-----------------------------------------------------------------------------
104 void lcl_ReAssignTOXType(SwDoc* pDoc, SwTOXBase& rTOXBase, const OUString& rNewName)
106 sal_uInt16 nUserCount = pDoc->GetTOXTypeCount( TOX_USER );
107 const SwTOXType* pNewType = 0;
108 for(sal_uInt16 nUser = 0; nUser < nUserCount; nUser++)
110 const SwTOXType* pType = pDoc->GetTOXType( TOX_USER, nUser );
111 if(pType->GetTypeName().Equals((String)rNewName))
113 pNewType = pType;
114 break;
117 if(!pNewType)
119 SwTOXType aNewType(TOX_USER, rNewName);
120 pNewType = pDoc->InsertTOXType( aNewType );
122 //has to be non-const-casted
123 ((SwTOXType*)pNewType)->Add(&rTOXBase);
125 //-----------------------------------------------------------------------------
126 static const char cUserDefined[] = "User-Defined";
127 static const char cUserSuffix[] = " (user)";
128 #define USER_LEN 12
129 #define USER_AND_SUFFIXLEN 19
131 void lcl_ConvertTOUNameToProgrammaticName(OUString& rTmp)
133 ShellResource* pShellRes = ViewShell::GetShellRes();
135 if(rTmp.equals(pShellRes->aTOXUserName))
136 rTmp = OUString(C2U(cUserDefined));
137 //if the version is not English but the alternative index's name is "User-Defined"
138 //a " (user)" is appended
139 else if(rTmp.equalsAscii(cUserDefined))
140 rTmp += C2U(cUserSuffix);
142 //-----------------------------------------------------------------------------
143 void lcl_ConvertTOUNameToUserName(OUString& rTmp)
145 ShellResource* pShellRes = ViewShell::GetShellRes();
146 if(rTmp.equalsAscii(cUserDefined))
148 rTmp = pShellRes->aTOXUserName;
150 else if(!pShellRes->aTOXUserName.EqualsAscii(cUserDefined) &&
151 USER_AND_SUFFIXLEN == rTmp.getLength())
153 String sToChange(rTmp);
154 //make sure that in non-English versions the " (user)" suffix is removed
155 if(!sToChange.SearchAscii(cUserDefined) && USER_LEN == sToChange.SearchAscii(cUserSuffix))
156 rTmp = C2U(cUserDefined);
160 /******************************************************************
161 * SwXDocumentIndex
162 ******************************************************************/
163 /* -----------------20.06.98 11:06-------------------
165 * --------------------------------------------------*/
166 class SwDocIdxProperties_Impl
168 SwTOXBase* pTOXBase;
169 OUString sUserTOXTypeName;
170 public:
171 SwTOXBase& GetTOXBase() {return *pTOXBase;}
172 SwDocIdxProperties_Impl(const SwTOXType* pType);
173 ~SwDocIdxProperties_Impl(){delete pTOXBase;}
175 const OUString& GetTypeName()const {return sUserTOXTypeName;}
176 void SetTypeName(const OUString& rSet) {sUserTOXTypeName = rSet;}
178 /* -----------------20.06.98 11:41-------------------
180 * --------------------------------------------------*/
181 SwDocIdxProperties_Impl::SwDocIdxProperties_Impl(const SwTOXType* pType)
183 SwForm aForm(pType->GetType());
184 pTOXBase = new SwTOXBase(pType, aForm,
185 nsSwTOXElement::TOX_MARK, pType->GetTypeName());
186 if(pType->GetType() == TOX_CONTENT || pType->GetType() == TOX_USER)
187 pTOXBase->SetLevel(MAXLEVEL);
188 sUserTOXTypeName = pType->GetTypeName();
190 /* -----------------------------10.03.00 18:02--------------------------------
192 ---------------------------------------------------------------------------*/
193 const uno::Sequence< sal_Int8 > & SwXDocumentIndex::getUnoTunnelId()
195 static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
196 return aSeq;
198 /* -----------------------------10.03.00 18:04--------------------------------
200 ---------------------------------------------------------------------------*/
201 sal_Int64 SAL_CALL SwXDocumentIndex::getSomething( const uno::Sequence< sal_Int8 >& rId )
202 throw(uno::RuntimeException)
204 if( rId.getLength() == 16
205 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
206 rId.getConstArray(), 16 ) )
208 return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
210 return 0;
212 /* -----------------------------06.04.00 15:01--------------------------------
214 ---------------------------------------------------------------------------*/
215 OUString SwXDocumentIndex::getImplementationName(void) throw( uno::RuntimeException )
217 return C2U("SwXDocumentIndex");
219 /* -----------------------------06.04.00 15:01--------------------------------
221 ---------------------------------------------------------------------------*/
222 BOOL SwXDocumentIndex::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
224 return C2U("com.sun.star.text.BaseIndex") == rServiceName ||
225 ( TOX_INDEX == eTOXType && C2U("com.sun.star.text.DocumentIndex") == rServiceName) ||
226 ( TOX_CONTENT == eTOXType && C2U("com.sun.star.text.ContentIndex") == rServiceName) ||
227 ( TOX_USER == eTOXType && C2U("com.sun.star.text.UserDefinedIndex") == rServiceName) ||
228 ( TOX_ILLUSTRATIONS == eTOXType && C2U("com.sun.star.text.IllustrationsIndex") == rServiceName) ||
229 ( TOX_TABLES == eTOXType && C2U("com.sun.star.text.TableIndex") == rServiceName) ||
230 ( TOX_OBJECTS == eTOXType && C2U("com.sun.star.text.ObjectIndex") == rServiceName) ||
231 ( TOX_AUTHORITIES == eTOXType && C2U("com.sun.star.text.Bibliography") == rServiceName);
233 /* -----------------------------06.04.00 15:01--------------------------------
235 ---------------------------------------------------------------------------*/
236 uno::Sequence< OUString > SwXDocumentIndex::getSupportedServiceNames(void) throw( uno::RuntimeException )
238 uno::Sequence< OUString > aRet(2);
239 OUString* pArray = aRet.getArray();
240 pArray[0] = C2U("com.sun.star.text.BaseIndex");
241 switch( eTOXType )
243 case TOX_INDEX: pArray[1] = C2U("com.sun.star.text.DocumentIndex");break;
244 case TOX_CONTENT: pArray[1] = C2U("com.sun.star.text.ContentIndex");break;
245 case TOX_TABLES: pArray[1] = C2U("com.sun.star.text.TableIndex");break;
246 case TOX_ILLUSTRATIONS: pArray[1] = C2U("com.sun.star.text.IllustrationsIndex");break;
247 case TOX_OBJECTS: pArray[1] = C2U("com.sun.star.text.ObjectIndex");break;
248 case TOX_AUTHORITIES : pArray[1] = C2U("com.sun.star.text.Bibliography");break;
249 //case TOX_USER:
250 default:
251 pArray[1] = C2U("com.sun.star.text.UserDefinedIndex");
253 return aRet;
255 /*-- 14.12.98 09:35:03---------------------------------------------------
257 -----------------------------------------------------------------------*/
258 TYPEINIT1(SwXDocumentIndex, SwClient)
259 SwXDocumentIndex::SwXDocumentIndex(const SwTOXBaseSection* pB, SwDoc* pDc) :
260 aLstnrCntnr( (text::XTextContent*)this),
261 m_pPropSet(0),
262 m_pDoc(pDc),
263 pBase(pB),
264 eTOXType(TOX_USER),
265 bIsDescriptor(sal_False),
266 pProps(0),
267 pStyleAccess(0),
268 pTokenAccess(0)
270 if(pBase && m_pDoc)
272 pBase->GetFmt()->Add(this);
273 sal_uInt16 PropertyId;
274 eTOXType = pBase->SwTOXBase::GetType();
275 switch( eTOXType )
277 case TOX_INDEX: PropertyId = PROPERTY_MAP_INDEX_IDX; break;
278 case TOX_CONTENT: PropertyId = PROPERTY_MAP_INDEX_CNTNT; break;
279 case TOX_TABLES: PropertyId = PROPERTY_MAP_INDEX_TABLES; break;
280 case TOX_ILLUSTRATIONS: PropertyId = PROPERTY_MAP_INDEX_ILLUSTRATIONS; break;
281 case TOX_OBJECTS: PropertyId = PROPERTY_MAP_INDEX_OBJECTS; break;
282 case TOX_AUTHORITIES : PropertyId = PROPERTY_MAP_BIBLIOGRAPHY; break;
283 //case TOX_USER:
284 default:
285 PropertyId = PROPERTY_MAP_INDEX_USER;
287 m_pPropSet = aSwMapProvider.GetPropertySet(PropertyId);
290 /* -----------------15.01.99 14:59-------------------
292 * --------------------------------------------------*/
293 SwXDocumentIndex::SwXDocumentIndex(TOXTypes eType, SwDoc& rDoc) :
294 aLstnrCntnr( (text::XTextContent*)this),
295 m_pDoc(0),
296 pBase(0),
297 eTOXType(eType),
298 bIsDescriptor(sal_True),
299 pProps(new SwDocIdxProperties_Impl(rDoc.GetTOXType(eType, 0))),
300 pStyleAccess(0),
301 pTokenAccess(0)
303 sal_uInt16 PropertyId;
304 switch(eType)
306 case TOX_INDEX: PropertyId = PROPERTY_MAP_INDEX_IDX; break;
307 case TOX_CONTENT: PropertyId = PROPERTY_MAP_INDEX_CNTNT; break;
308 case TOX_TABLES: PropertyId = PROPERTY_MAP_INDEX_TABLES; break;
309 case TOX_ILLUSTRATIONS: PropertyId = PROPERTY_MAP_INDEX_ILLUSTRATIONS; break;
310 case TOX_OBJECTS: PropertyId = PROPERTY_MAP_INDEX_OBJECTS; break;
311 case TOX_AUTHORITIES : PropertyId = PROPERTY_MAP_BIBLIOGRAPHY; break;
312 //case TOX_USER:
313 default:
314 PropertyId = PROPERTY_MAP_INDEX_USER;
316 m_pPropSet = aSwMapProvider.GetPropertySet(PropertyId);
319 /*-- 14.12.98 09:35:04---------------------------------------------------
321 -----------------------------------------------------------------------*/
322 SwXDocumentIndex::~SwXDocumentIndex()
324 delete pProps;
326 /*-- 14.12.98 09:35:05---------------------------------------------------
328 -----------------------------------------------------------------------*/
329 OUString SwXDocumentIndex::getServiceName(void) throw( uno::RuntimeException )
331 USHORT nObjectType = SW_SERVICE_TYPE_INDEX;
332 switch(eTOXType)
334 // case TOX_INDEX: break;
335 case TOX_USER: nObjectType = SW_SERVICE_USER_INDEX;break;
336 case TOX_CONTENT: nObjectType = SW_SERVICE_CONTENT_INDEX;break;
337 case TOX_ILLUSTRATIONS: nObjectType = SW_SERVICE_INDEX_ILLUSTRATIONS;break;
338 case TOX_OBJECTS: nObjectType = SW_SERVICE_INDEX_OBJECTS;break;
339 case TOX_TABLES: nObjectType = SW_SERVICE_INDEX_TABLES;break;
340 case TOX_AUTHORITIES: nObjectType = SW_SERVICE_INDEX_BIBLIOGRAPHY;break;
341 default:
344 return SwXServiceProvider::GetProviderName(nObjectType);
346 /*-- 14.12.98 09:35:05---------------------------------------------------
348 -----------------------------------------------------------------------*/
349 void SwXDocumentIndex::update(void) throw( uno::RuntimeException )
351 vos::OGuard aGuard(Application::GetSolarMutex());
352 SwSectionFmt *pFmt = GetFmt();
353 SwTOXBase* pTOXBase = pFmt ? (SwTOXBaseSection*)pFmt->GetSection() : 0;
354 if(!pTOXBase)
355 throw uno::RuntimeException();
356 ((SwTOXBaseSection*)pTOXBase)->Update();
357 // Seitennummern eintragen
358 ((SwTOXBaseSection*)pTOXBase)->UpdatePageNum();
360 /*-- 14.12.98 09:35:05---------------------------------------------------
362 -----------------------------------------------------------------------*/
363 uno::Reference< beans::XPropertySetInfo > SwXDocumentIndex::getPropertySetInfo(void) throw( uno::RuntimeException )
365 uno::Reference< beans::XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo();
366 return aRef;
368 /*-- 14.12.98 09:35:05---------------------------------------------------
370 -----------------------------------------------------------------------*/
371 void SwXDocumentIndex::setPropertyValue(const OUString& rPropertyName,
372 const uno::Any& aValue)
373 throw( beans::UnknownPropertyException, beans::PropertyVetoException,
374 lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
376 vos::OGuard aGuard(Application::GetSolarMutex());
377 const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName);
378 if (!pEntry)
379 throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
380 if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
381 throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
383 SwTOXBase* pTOXBase = 0;
384 if(GetFmt())
385 pTOXBase = (SwTOXBaseSection*)GetFmt()->GetSection();
386 else if(bIsDescriptor)
387 pTOXBase = &pProps->GetTOXBase();
388 if(pTOXBase)
390 sal_uInt16 nCreate = pTOXBase->GetCreateType();
391 sal_uInt16 nTOIOptions = 0;
392 sal_uInt16 nOLEOptions = pTOXBase->GetOLEOptions();
393 TOXTypes eTxBaseType = pTOXBase->GetTOXType()->GetType();
394 if( eTxBaseType == TOX_INDEX )
395 nTOIOptions = pTOXBase->GetOptions();
396 SwForm aForm(pTOXBase->GetTOXForm());
397 sal_Bool bForm = sal_False;
398 SfxItemSet* pAttrSet = 0;
399 switch(pEntry->nWID)
401 case WID_IDX_TITLE :
403 OUString sNewName;
404 aValue >>= sNewName;
405 pTOXBase->SetTitle(sNewName);
407 break;
408 case WID_IDX_NAME:
410 OUString sNewName;
411 aValue >>= sNewName;
412 pTOXBase->SetTOXName(sNewName);
414 break;
415 case WID_USER_IDX_NAME:
417 OUString sNewName;
418 aValue >>= sNewName;
419 lcl_ConvertTOUNameToUserName(sNewName);
420 DBG_ASSERT(TOX_USER == eTxBaseType, "tox type name can only be changed for user indexes");
421 if(GetFmt())
423 OUString sTmp = pTOXBase->GetTOXType()->GetTypeName();
424 if(sTmp != sNewName)
426 lcl_ReAssignTOXType(GetFmt()->GetDoc(), *pTOXBase, sNewName);
429 else
430 pProps->SetTypeName(sNewName);
432 break;
433 case WID_IDX_LOCALE:
435 lang::Locale aLocale;
436 if(aValue>>= aLocale)
437 pTOXBase->SetLanguage(SvxLocaleToLanguage(aLocale));
438 else
439 throw lang::IllegalArgumentException();
441 break;
442 case WID_IDX_SORT_ALGORITHM:
444 OUString sTmp;
445 if(aValue >>= sTmp)
446 pTOXBase->SetSortAlgorithm(sTmp);
447 else
448 throw lang::IllegalArgumentException();
450 break;
451 case WID_LEVEL :
452 pTOXBase->SetLevel(lcl_AnyToInt16(aValue));
453 break;
454 case WID_CREATE_FROM_MARKS :
455 nCreate = lcl_AnyToBool(aValue) ? nCreate | nsSwTOXElement::TOX_MARK: nCreate & ~nsSwTOXElement::TOX_MARK;
456 break;
457 case WID_CREATE_FROM_OUTLINE :
458 nCreate = lcl_AnyToBool(aValue) ? nCreate | nsSwTOXElement::TOX_OUTLINELEVEL: nCreate & ~nsSwTOXElement::TOX_OUTLINELEVEL;
459 break;
460 // case WID_PARAGRAPH_STYLE_NAMES :DBG_ERROR("not implemented")
461 // break;
462 case WID_CREATE_FROM_CHAPTER :
463 pTOXBase->SetFromChapter(lcl_AnyToBool(aValue));
464 break;
465 case WID_CREATE_FROM_LABELS :
466 pTOXBase->SetFromObjectNames(! lcl_AnyToBool(aValue));
467 break;
468 case WID_PROTECTED :
470 sal_Bool bSet = lcl_AnyToBool(aValue);
471 pTOXBase->SetProtected(bSet);
472 if(GetFmt())
473 ((SwTOXBaseSection*)pTOXBase)->SetProtect(bSet);
475 break;
476 case WID_USE_ALPHABETICAL_SEPARATORS:
477 nTOIOptions = lcl_AnyToBool(aValue) ?
478 nTOIOptions | nsSwTOIOptions::TOI_ALPHA_DELIMITTER : nTOIOptions & ~nsSwTOIOptions::TOI_ALPHA_DELIMITTER;
479 break;
480 case WID_USE_KEY_AS_ENTRY :
481 nTOIOptions = lcl_AnyToBool(aValue) ?
482 nTOIOptions | nsSwTOIOptions::TOI_KEY_AS_ENTRY : nTOIOptions & ~nsSwTOIOptions::TOI_KEY_AS_ENTRY;
483 break;
484 case WID_USE_COMBINED_ENTRIES :
485 nTOIOptions = lcl_AnyToBool(aValue) ?
486 nTOIOptions | nsSwTOIOptions::TOI_SAME_ENTRY : nTOIOptions & ~nsSwTOIOptions::TOI_SAME_ENTRY;
487 break;
488 case WID_IS_CASE_SENSITIVE :
489 nTOIOptions = lcl_AnyToBool(aValue) ?
490 nTOIOptions | nsSwTOIOptions::TOI_CASE_SENSITIVE : nTOIOptions & ~nsSwTOIOptions::TOI_CASE_SENSITIVE;
491 break;
492 case WID_USE_P_P :
493 nTOIOptions = lcl_AnyToBool(aValue) ?
494 nTOIOptions | nsSwTOIOptions::TOI_FF : nTOIOptions & ~nsSwTOIOptions::TOI_FF;
495 break;
496 case WID_USE_DASH :
497 nTOIOptions = lcl_AnyToBool(aValue) ?
498 nTOIOptions | nsSwTOIOptions::TOI_DASH : nTOIOptions & ~nsSwTOIOptions::TOI_DASH;
499 break;
500 case WID_USE_UPPER_CASE :
501 nTOIOptions = lcl_AnyToBool(aValue) ?
502 nTOIOptions | nsSwTOIOptions::TOI_INITIAL_CAPS : nTOIOptions & ~nsSwTOIOptions::TOI_INITIAL_CAPS;
503 break;
504 case WID_IS_COMMA_SEPARATED :
505 bForm = sal_True;
506 aForm.SetCommaSeparated(lcl_AnyToBool(aValue));
507 break;
508 case WID_LABEL_CATEGORY :
510 // convert file-format/API/external programmatic english name
511 // to internal UI name before usage
512 String aName( SwStyleNameMapper::GetSpecialExtraUIName(
513 lcl_AnyToString(aValue) ) );
514 pTOXBase->SetSequenceName( aName );
516 break;
517 case WID_LABEL_DISPLAY_TYPE :
519 sal_Int16 nVal = lcl_AnyToInt16(aValue);
520 sal_uInt16 nSet = CAPTION_COMPLETE;
521 switch (nVal)
523 case text::ReferenceFieldPart::TEXT: nSet = CAPTION_COMPLETE;
524 break;
525 case text::ReferenceFieldPart::CATEGORY_AND_NUMBER : nSet = CAPTION_NUMBER;
526 break;
527 case text::ReferenceFieldPart::ONLY_CAPTION : nSet = CAPTION_TEXT;
528 break;
529 default:
530 throw lang::IllegalArgumentException();
532 pTOXBase->SetCaptionDisplay((SwCaptionDisplay)nSet);
534 break;
535 case WID_USE_LEVEL_FROM_SOURCE :
536 pTOXBase->SetLevelFromChapter(lcl_AnyToBool(aValue));
537 break;
538 case WID_MAIN_ENTRY_CHARACTER_STYLE_NAME :
540 String aString;
541 SwStyleNameMapper::FillUIName(lcl_AnyToString(aValue), aString, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True);
542 pTOXBase->SetMainEntryCharStyle( aString );
544 break;
545 case WID_CREATE_FROM_TABLES :
546 nCreate = lcl_AnyToBool(aValue) ? nCreate | nsSwTOXElement::TOX_TABLE : nCreate & ~nsSwTOXElement::TOX_TABLE;
547 break;
548 case WID_CREATE_FROM_TEXT_FRAMES :
549 nCreate = lcl_AnyToBool(aValue) ? nCreate | nsSwTOXElement::TOX_FRAME : nCreate & ~nsSwTOXElement::TOX_FRAME;
550 break;
551 case WID_CREATE_FROM_GRAPHIC_OBJECTS :
552 nCreate = lcl_AnyToBool(aValue) ? nCreate | nsSwTOXElement::TOX_GRAPHIC : nCreate & ~nsSwTOXElement::TOX_GRAPHIC;
553 break;
554 case WID_CREATE_FROM_EMBEDDED_OBJECTS :
555 if(lcl_AnyToBool(aValue))
556 nCreate |= nsSwTOXElement::TOX_OLE;
557 else
558 nCreate &= ~nsSwTOXElement::TOX_OLE;
559 break;
560 case WID_CREATE_FROM_STAR_MATH:
561 nOLEOptions = lcl_AnyToBool(aValue) ? nOLEOptions | nsSwTOOElements::TOO_MATH : nOLEOptions & ~nsSwTOOElements::TOO_MATH;
562 break;
563 case WID_CREATE_FROM_STAR_CHART :
564 nOLEOptions = lcl_AnyToBool(aValue) ? nOLEOptions | nsSwTOOElements::TOO_CHART : nOLEOptions & ~nsSwTOOElements::TOO_CHART;
565 break;
566 case WID_CREATE_FROM_STAR_CALC :
567 nOLEOptions = lcl_AnyToBool(aValue) ? nOLEOptions | nsSwTOOElements::TOO_CALC : nOLEOptions & ~nsSwTOOElements::TOO_CALC;
568 break;
569 case WID_CREATE_FROM_STAR_DRAW :
570 nOLEOptions = lcl_AnyToBool(aValue) ? nOLEOptions | nsSwTOOElements::TOO_DRAW_IMPRESS : nOLEOptions & ~nsSwTOOElements::TOO_DRAW_IMPRESS;
571 break;
572 case WID_CREATE_FROM_OTHER_EMBEDDED_OBJECTS:
573 nOLEOptions = lcl_AnyToBool(aValue) ? nOLEOptions | nsSwTOOElements::TOO_OTHER : nOLEOptions & ~nsSwTOOElements::TOO_OTHER;
574 break;
575 case WID_PARA_HEAD :
577 String aString;
578 SwStyleNameMapper::FillUIName( lcl_AnyToString(aValue), aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True);
579 bForm = sal_True;
580 //Header steht an Pos 0
581 aForm.SetTemplate( 0, aString );
583 break;
584 case WID_IS_RELATIVE_TABSTOPS:
585 bForm = sal_True;
586 aForm.SetRelTabPos(lcl_AnyToBool(aValue));
587 break;
588 case WID_PARA_SEP :
590 String aString;
591 bForm = sal_True;
592 SwStyleNameMapper::FillUIName( lcl_AnyToString(aValue), aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True);
593 aForm.SetTemplate( 1, aString );
595 break;
596 case WID_CREATE_FROM_PARAGRAPH_STYLES:
597 nCreate = lcl_AnyToBool(aValue) ?
598 (nCreate | nsSwTOXElement::TOX_TEMPLATE) : (nCreate & ~nsSwTOXElement::TOX_TEMPLATE);
599 break;
601 case WID_PARA_LEV1 :
602 case WID_PARA_LEV2 :
603 case WID_PARA_LEV3 :
604 case WID_PARA_LEV4 :
605 case WID_PARA_LEV5 :
606 case WID_PARA_LEV6 :
607 case WID_PARA_LEV7 :
608 case WID_PARA_LEV8 :
609 case WID_PARA_LEV9 :
610 case WID_PARA_LEV10 :
612 bForm = sal_True;
613 // im sdbcx::Index beginnt Lebel 1 bei Pos 2 sonst bei Pos 1
614 sal_uInt16 nLPos = pTOXBase->GetType() == TOX_INDEX ? 2 : 1;
615 String aString;
616 SwStyleNameMapper::FillUIName( lcl_AnyToString(aValue), aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True);
617 aForm.SetTemplate(nLPos + pEntry->nWID - WID_PARA_LEV1, aString );
619 break;
620 default:
621 //this is for items only
622 if(WID_PRIMARY_KEY > pEntry->nWID)
624 const SwAttrSet& rSet = m_pDoc->GetTOXBaseAttrSet(*pTOXBase);
625 pAttrSet = new SfxItemSet(rSet);
626 m_pPropSet->setPropertyValue(rPropertyName, aValue, *pAttrSet);
628 const SwSectionFmts& rSects = m_pDoc->GetSections();
629 const SwSectionFmt* pOwnFmt = GetFmt();
630 for(sal_uInt16 i = 0; i < rSects.Count(); i++)
632 const SwSectionFmt* pTmpFmt = rSects[ i ];
633 if(pTmpFmt == pOwnFmt)
635 m_pDoc->ChgSection( i, *(SwTOXBaseSection*)pTOXBase, pAttrSet );
636 break;
641 pTOXBase->SetCreate(nCreate);
642 pTOXBase->SetOLEOptions(nOLEOptions);
643 if(pTOXBase->GetTOXType()->GetType() == TOX_INDEX)
644 pTOXBase->SetOptions(nTOIOptions);
645 if(bForm)
646 pTOXBase->SetTOXForm(aForm);
647 delete pAttrSet;
649 else
650 throw uno::RuntimeException();
653 /*-- 14.12.98 09:35:05---------------------------------------------------
655 -----------------------------------------------------------------------*/
656 uno::Any SwXDocumentIndex::getPropertyValue(const OUString& rPropertyName)
657 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
659 vos::OGuard aGuard(Application::GetSolarMutex());
660 uno::Any aRet;
661 const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName);
662 if (!pEntry)
663 throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
664 SwTOXBase* pTOXBase = 0;
665 if(GetFmt())
666 pTOXBase = (SwTOXBaseSection*)GetFmt()->GetSection();
667 else if(bIsDescriptor)
668 pTOXBase = &pProps->GetTOXBase();
669 if(pTOXBase)
671 sal_uInt16 nCreate = pTOXBase->GetCreateType();
672 sal_uInt16 nTOIOptions = 0;
673 sal_uInt16 nOLEOptions = pTOXBase->GetOLEOptions();
674 if(pTOXBase->GetTOXType()->GetType() == TOX_INDEX)
675 nTOIOptions = pTOXBase->GetOptions();
676 const SwForm& rForm = pTOXBase->GetTOXForm();
677 sal_Bool bBOOL = sal_True;
678 sal_Bool bRet = sal_False;
679 switch(pEntry->nWID)
681 case WID_IDX_CONTENT_SECTION:
682 case WID_IDX_HEADER_SECTION :
683 bBOOL = sal_False;
684 if(WID_IDX_CONTENT_SECTION == pEntry->nWID)
686 uno::Reference <text::XTextSection> xContentSect = SwXTextSections::GetObject( *GetFmt() );
687 aRet <<= xContentSect;
689 else
691 SwSections aSectArr;
692 GetFmt()->GetChildSections( aSectArr, SORTSECT_NOT, FALSE);
693 for(USHORT i = 0; i < aSectArr.Count(); i++)
695 SwSection* pSect = aSectArr[i];
696 if(pSect->GetType() == TOX_HEADER_SECTION)
698 uno::Reference <text::XTextSection> xHeaderSect = SwXTextSections::GetObject( *pSect->GetFmt() );
699 aRet <<= xHeaderSect;
700 break;
704 break;
705 case WID_IDX_TITLE :
707 bBOOL = sal_False;
708 OUString uRet(pTOXBase->GetTitle());
709 aRet <<= uRet;
710 break;
712 case WID_IDX_NAME:
713 bBOOL = sal_False;
714 aRet <<= OUString(pTOXBase->GetTOXName());
715 break;
716 case WID_USER_IDX_NAME:
718 bBOOL = sal_False;
719 OUString sTmp;
720 if(!IsDescriptor())
721 sTmp = pTOXBase->GetTOXType()->GetTypeName();
722 else
723 sTmp = pProps->GetTypeName();
724 //I18N
725 lcl_ConvertTOUNameToProgrammaticName(sTmp);
726 aRet <<= sTmp;
728 break;
729 case WID_IDX_LOCALE:
730 bBOOL = sal_False;
731 aRet <<= SvxCreateLocale(pTOXBase->GetLanguage());
732 break;
733 case WID_IDX_SORT_ALGORITHM:
734 bBOOL = sal_False;
735 aRet <<= OUString(pTOXBase->GetSortAlgorithm());
736 break;
737 case WID_LEVEL :
738 bBOOL = sal_False;
739 aRet <<= (sal_Int16)pTOXBase->GetLevel();
740 break;
741 case WID_CREATE_FROM_MARKS :
742 bRet = 0 != (nCreate & nsSwTOXElement::TOX_MARK);
743 break;
744 case WID_CREATE_FROM_OUTLINE :
745 bRet = 0 != (nCreate & nsSwTOXElement::TOX_OUTLINELEVEL);
746 break;
747 case WID_CREATE_FROM_CHAPTER :
748 bRet = pTOXBase->IsFromChapter();
749 break;
750 case WID_CREATE_FROM_LABELS :
751 bRet = ! pTOXBase->IsFromObjectNames();
752 break;
753 case WID_PROTECTED :
754 bRet = pTOXBase->IsProtected();
755 break;
756 case WID_USE_ALPHABETICAL_SEPARATORS:
757 bRet = 0 != (nTOIOptions & nsSwTOIOptions::TOI_ALPHA_DELIMITTER);
758 break;
759 case WID_USE_KEY_AS_ENTRY :
760 bRet = 0 != (nTOIOptions & nsSwTOIOptions::TOI_KEY_AS_ENTRY);
761 break;
762 case WID_USE_COMBINED_ENTRIES :
763 bRet = 0 != (nTOIOptions & nsSwTOIOptions::TOI_SAME_ENTRY);
764 break;
765 case WID_IS_CASE_SENSITIVE :
766 bRet = 0 != (nTOIOptions & nsSwTOIOptions::TOI_CASE_SENSITIVE);
767 break;
768 case WID_USE_P_P:
769 bRet = 0 != (nTOIOptions & nsSwTOIOptions::TOI_FF);
770 break;
771 case WID_USE_DASH :
772 bRet = 0 != (nTOIOptions & nsSwTOIOptions::TOI_DASH);
773 break;
774 case WID_USE_UPPER_CASE :
775 bRet = 0 != (nTOIOptions & nsSwTOIOptions::TOI_INITIAL_CAPS);
776 break;
777 case WID_IS_COMMA_SEPARATED :
778 bRet = rForm.IsCommaSeparated();
779 break;
780 case WID_LABEL_CATEGORY :
782 // convert internal UI name to
783 // file-format/API/external programmatic english name
784 // before usage
785 String aName( SwStyleNameMapper::GetSpecialExtraProgName(
786 pTOXBase->GetSequenceName() ) );
787 aRet <<= OUString( aName );
788 bBOOL = sal_False;
790 break;
791 case WID_LABEL_DISPLAY_TYPE :
793 bBOOL = sal_False;
794 sal_Int16 nSet = text::ReferenceFieldPart::TEXT;
795 switch (pTOXBase->GetCaptionDisplay())
797 case CAPTION_COMPLETE: nSet = text::ReferenceFieldPart::TEXT;break;
798 case CAPTION_NUMBER : nSet = text::ReferenceFieldPart::CATEGORY_AND_NUMBER; break;
799 case CAPTION_TEXT : nSet = text::ReferenceFieldPart::ONLY_CAPTION; break;
801 aRet <<= nSet;
803 break;
804 case WID_USE_LEVEL_FROM_SOURCE :
805 bRet = pTOXBase->IsLevelFromChapter();
806 break;
807 case WID_LEVEL_FORMAT :
809 uno::Reference< container::XIndexReplace > xTokenAcc =
810 ((SwXDocumentIndex*)this)->GetTokenAccess();
811 if(!xTokenAcc.is())
812 xTokenAcc = new SwXIndexTokenAccess_Impl(*
813 (SwXDocumentIndex*)this);
814 aRet.setValue(&xTokenAcc, ::getCppuType((const uno::Reference<container::XIndexReplace>*)0));
815 bBOOL = sal_False;
817 break;
818 case WID_LEVEL_PARAGRAPH_STYLES :
820 uno::Reference< container::XIndexReplace > xStyleAcc =
821 ((SwXDocumentIndex*)this)->GetStyleAccess();
822 if(!xStyleAcc.is())
823 xStyleAcc = new SwXIndexStyleAccess_Impl(*
824 (SwXDocumentIndex*)this);
825 aRet.setValue(&xStyleAcc, ::getCppuType((const uno::Reference<container::XIndexReplace>*)0));
826 bBOOL = sal_False;
828 break;
829 case WID_MAIN_ENTRY_CHARACTER_STYLE_NAME :
831 bBOOL = sal_False;
832 String aString;
833 SwStyleNameMapper::FillProgName(
834 pTOXBase->GetMainEntryCharStyle(),
835 aString,
836 nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
837 sal_True);
838 aRet <<= OUString( aString );
840 break;
841 case WID_CREATE_FROM_TABLES :
842 bRet = 0 != (nCreate & nsSwTOXElement::TOX_TABLE);
843 break;
844 case WID_CREATE_FROM_TEXT_FRAMES :
845 bRet = 0 != (nCreate & nsSwTOXElement::TOX_FRAME);
846 break;
847 case WID_CREATE_FROM_GRAPHIC_OBJECTS :
848 bRet = 0 != (nCreate & nsSwTOXElement::TOX_GRAPHIC);
849 break;
850 case WID_CREATE_FROM_EMBEDDED_OBJECTS :
851 bRet = 0 != (nCreate & nsSwTOXElement::TOX_OLE);
852 break;
853 case WID_CREATE_FROM_STAR_MATH:
854 bRet = 0 != (nOLEOptions & nsSwTOOElements::TOO_MATH);
855 break;
856 case WID_CREATE_FROM_STAR_CHART :
857 bRet = 0 != (nOLEOptions & nsSwTOOElements::TOO_CHART);
858 break;
859 case WID_CREATE_FROM_STAR_CALC :
860 bRet = 0 != (nOLEOptions & nsSwTOOElements::TOO_CALC);
861 break;
862 case WID_CREATE_FROM_STAR_DRAW :
863 bRet = 0 != (nOLEOptions & nsSwTOOElements::TOO_DRAW_IMPRESS);
864 break;
865 case WID_CREATE_FROM_OTHER_EMBEDDED_OBJECTS:
866 bRet = 0 != (nOLEOptions & nsSwTOOElements::TOO_OTHER);
867 break;
868 case WID_CREATE_FROM_PARAGRAPH_STYLES:
869 bRet = 0 != (nCreate & nsSwTOXElement::TOX_TEMPLATE);
870 break;
871 case WID_PARA_HEAD :
873 //Header steht an Pos 0
874 String aString;
875 SwStyleNameMapper::FillProgName(rForm.GetTemplate( 0 ), aString,
876 nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True );
877 aRet <<= OUString( aString );
878 bBOOL = sal_False;
880 break;
881 case WID_PARA_SEP :
883 String aString;
884 SwStyleNameMapper::FillProgName(
885 rForm.GetTemplate( 1 ),
886 aString,
887 nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL,
888 sal_True);
889 aRet <<= OUString( aString );
890 bBOOL = sal_False;
892 break;
893 case WID_PARA_LEV1 :
894 case WID_PARA_LEV2 :
895 case WID_PARA_LEV3 :
896 case WID_PARA_LEV4 :
897 case WID_PARA_LEV5 :
898 case WID_PARA_LEV6 :
899 case WID_PARA_LEV7 :
900 case WID_PARA_LEV8 :
901 case WID_PARA_LEV9 :
902 case WID_PARA_LEV10 :
904 // im sdbcx::Index beginnt Lebel 1 bei Pos 2 sonst bei Pos 1
905 sal_uInt16 nLPos = pTOXBase->GetType() == TOX_INDEX ? 2 : 1;
906 String aString;
907 SwStyleNameMapper::FillProgName(
908 rForm.GetTemplate(nLPos + pEntry->nWID - WID_PARA_LEV1),
909 aString,
910 nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL,
911 sal_True);
912 aRet <<= OUString( aString );
913 bBOOL = sal_False;
915 break;
916 case WID_IS_RELATIVE_TABSTOPS:
917 bRet = rForm.IsRelTabPos();
918 break;
919 case WID_INDEX_MARKS:
921 SwTOXMarks aMarks;
922 const SwTOXType* pType = pTOXBase->GetTOXType();
923 SwClientIter aIter(*(SwTOXType*)pType);
924 SwTOXMark* pMark = (SwTOXMark*)aIter.First(TYPE(SwTOXMark));
925 while( pMark )
927 if(pMark->GetTxtTOXMark())
928 aMarks.C40_INSERT(SwTOXMark, pMark, aMarks.Count());
929 pMark = (SwTOXMark*)aIter.Next();
931 uno::Sequence< uno::Reference < text::XDocumentIndexMark > > aXMarks(aMarks.Count());
932 uno::Reference<text::XDocumentIndexMark>* pxMarks = aXMarks.getArray();
933 for(USHORT i = 0; i < aMarks.Count(); i++)
935 pMark = aMarks.GetObject(i);
936 pxMarks[i] = SwXDocumentIndexMark::GetObject((SwTOXType*)pType, pMark, m_pDoc);
938 aRet.setValue(&aXMarks, ::getCppuType((uno::Sequence< uno::Reference< text::XDocumentIndexMark > >*)0));
939 bBOOL = sal_False;
941 break;
942 default:
943 //this is for items only
944 bBOOL = sal_False;
945 if(WID_PRIMARY_KEY > pEntry->nWID)
947 const SwAttrSet& rSet = m_pDoc->GetTOXBaseAttrSet(*pTOXBase);
948 aRet = m_pPropSet->getPropertyValue(rPropertyName, rSet);
951 if(bBOOL)
952 aRet.setValue(&bRet, ::getCppuBooleanType());
954 return aRet;
956 /*-- 14.12.98 09:35:06---------------------------------------------------
958 -----------------------------------------------------------------------*/
959 void SwXDocumentIndex::addPropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
961 DBG_WARNING("not implemented");
963 /*-- 14.12.98 09:35:06---------------------------------------------------
965 -----------------------------------------------------------------------*/
966 void SwXDocumentIndex::removePropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
968 DBG_WARNING("not implemented");
970 /*-- 14.12.98 09:35:06---------------------------------------------------
972 -----------------------------------------------------------------------*/
973 void SwXDocumentIndex::addVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
975 DBG_WARNING("not implemented");
977 /*-- 14.12.98 09:35:07---------------------------------------------------
979 -----------------------------------------------------------------------*/
980 void SwXDocumentIndex::removeVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
982 DBG_WARNING("not implemented");
984 /*-- 14.12.98 09:35:07---------------------------------------------------
986 -----------------------------------------------------------------------*/
987 void SwXDocumentIndex::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
989 BOOL bRemove = FALSE;
990 switch( pOld ? pOld->Which() : 0 )
992 case RES_REMOVE_UNO_OBJECT:
993 case RES_OBJECTDYING:
994 bRemove = (void*)GetRegisteredIn() == ((SwPtrMsgPoolItem *)pOld)->pObject;
995 break;
996 case RES_FMT_CHG:
997 // wurden wir an das neue umgehaengt und wird das alte geloscht?
998 bRemove = ((SwFmtChg*)pNew)->pChangedFmt == GetRegisteredIn() &&
999 ((SwFmtChg*)pOld)->pChangedFmt->IsFmtInDTOR();
1000 break;
1002 if( bRemove )
1004 ((SwModify*)GetRegisteredIn())->Remove( this );
1005 aLstnrCntnr.Disposing();
1008 /* -----------------18.02.99 13:39-------------------
1010 * --------------------------------------------------*/
1011 void SwXDocumentIndex::attachToRange(const uno::Reference< text::XTextRange > & xTextRange)
1012 throw( lang::IllegalArgumentException, uno::RuntimeException )
1014 if(!bIsDescriptor)
1015 throw uno::RuntimeException();
1016 uno::Reference<XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
1017 SwXTextRange* pRange = 0;
1018 OTextCursorHelper* pCursor = 0;
1019 if(xRangeTunnel.is())
1021 pRange = reinterpret_cast< SwXTextRange * >(
1022 sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) ));
1023 pCursor = reinterpret_cast< OTextCursorHelper * >(
1024 sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
1027 SwDoc* pDoc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0;
1028 if(pDoc )
1030 SwUnoInternalPaM aPam(*pDoc);
1031 //das muss jetzt sal_True liefern
1032 SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange);
1034 const SwTOXBase* pOld = pDoc->GetCurTOX( *aPam.Start() );
1035 if(!pOld)
1037 UnoActionContext aAction(pDoc);
1038 if(aPam.HasMark())
1039 pDoc->DeleteAndJoin(aPam);
1041 SwTOXBase& rTOXBase = pProps->GetTOXBase();
1042 const SwTOXType* pTOXType = rTOXBase.GetTOXType();
1043 if(TOX_USER == pTOXType->GetType() && !pProps->GetTypeName().equals(pTOXType->GetTypeName()))
1045 lcl_ReAssignTOXType(pDoc, rTOXBase, pProps->GetTypeName());
1047 //TODO: apply Section attributes (columns and background)
1048 const SwTOXBaseSection* pTOX = pDoc->InsertTableOf(
1049 *aPam.GetPoint(), rTOXBase, 0, sal_False );
1051 pDoc->SetTOXBaseName( *pTOX, pProps->GetTOXBase().GetTOXName() );
1053 // Seitennummern eintragen
1054 pBase = (const SwTOXBaseSection*)pTOX;
1055 pBase->GetFmt()->Add(this);
1056 ((SwTOXBaseSection*)pTOX)->UpdatePageNum();
1058 else
1059 throw lang::IllegalArgumentException();
1061 DELETEZ(pProps);
1062 m_pDoc = pDoc;
1063 bIsDescriptor = sal_False;
1066 /*-- 15.01.99 14:23:51---------------------------------------------------
1068 -----------------------------------------------------------------------*/
1069 void SwXDocumentIndex::attach(const uno::Reference< text::XTextRange > & xTextRange)
1070 throw( lang::IllegalArgumentException, uno::RuntimeException )
1072 vos::OGuard aGuard(Application::GetSolarMutex());
1073 attachToRange( xTextRange );
1075 /*-- 15.01.99 14:23:56---------------------------------------------------
1077 -----------------------------------------------------------------------*/
1078 uno::Reference< text::XTextRange > SwXDocumentIndex::getAnchor(void) throw( uno::RuntimeException )
1080 vos::OGuard aGuard(Application::GetSolarMutex());
1081 uno::Reference< text::XTextRange > xRet;
1082 if(GetRegisteredIn())
1084 SwSectionFmt* pSectFmt = GetFmt();
1085 const SwNodeIndex* pIdx;
1086 if( 0 != ( pIdx = pSectFmt->GetCntnt().GetCntntIdx() ) &&
1087 pIdx->GetNode().GetNodes().IsDocNodes() )
1089 SwPaM aPaM(*pIdx);
1090 aPaM.Move( fnMoveForward, fnGoCntnt );
1091 aPaM.SetMark();
1092 aPaM.GetPoint()->nNode = *pIdx->GetNode().EndOfSectionNode();
1093 aPaM.Move( fnMoveBackward, fnGoCntnt );
1094 xRet = SwXTextRange::CreateTextRangeFromPosition(pSectFmt->GetDoc(),
1095 *aPaM.GetMark(), aPaM.GetPoint());
1098 else
1099 throw uno::RuntimeException();
1100 return xRet;
1102 /*-- 15.01.99 15:46:48---------------------------------------------------
1104 -----------------------------------------------------------------------*/
1105 void lcl_RemoveChildSections(SwSectionFmt& rParentFmt)
1107 SwSections aTmpArr;
1108 SwDoc* pDoc = rParentFmt.GetDoc();
1109 sal_uInt16 nCnt = rParentFmt.GetChildSections(aTmpArr,SORTSECT_POS);
1110 if( nCnt )
1112 for( sal_uInt16 n = 0; n < nCnt; ++n )
1113 if( aTmpArr[n]->GetFmt()->IsInNodesArr() )
1115 SwSectionFmt* pFmt = aTmpArr[n]->GetFmt();
1116 lcl_RemoveChildSections(*pFmt);
1117 pDoc->DelSectionFmt( pFmt );
1121 void SwXDocumentIndex::dispose(void) throw( uno::RuntimeException )
1123 vos::OGuard aGuard(Application::GetSolarMutex());
1124 if(GetRegisteredIn())
1126 SwSectionFmt* pSectFmt = GetFmt();
1127 pSectFmt->GetDoc()->DeleteTOX( *(SwTOXBaseSection*)pSectFmt->GetSection(), sal_True);
1129 else
1130 throw uno::RuntimeException();
1132 /*-- 15.01.99 15:46:49---------------------------------------------------
1134 -----------------------------------------------------------------------*/
1135 void SwXDocumentIndex::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
1137 if(!GetRegisteredIn())
1138 throw uno::RuntimeException();
1139 aLstnrCntnr.AddListener(aListener);
1141 /*-- 15.01.99 15:46:54---------------------------------------------------
1143 -----------------------------------------------------------------------*/
1144 void SwXDocumentIndex::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
1146 if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
1147 throw uno::RuntimeException();
1149 /* -----------------30.07.99 11:28-------------------
1151 --------------------------------------------------*/
1152 OUString SwXDocumentIndex::getName(void) throw( uno::RuntimeException )
1154 SwSectionFmt* pSectionFmt = GetFmt();
1155 OUString uRet;
1156 if(bIsDescriptor)
1158 uRet = OUString(pProps->GetTOXBase().GetTOXName());
1160 else if(pSectionFmt)
1162 uRet = OUString(pSectionFmt->GetSection()->GetName());
1164 else
1165 throw uno::RuntimeException();
1166 return uRet;
1168 /* -----------------30.07.99 11:28-------------------
1170 --------------------------------------------------*/
1171 void SwXDocumentIndex::setName(const OUString& rName) throw( uno::RuntimeException )
1173 SwSectionFmt* pSectionFmt = GetFmt();
1174 String sNewName(rName);
1175 sal_Bool bExcept = sal_False;
1176 if(!sNewName.Len())
1177 bExcept = sal_True;
1178 if(bIsDescriptor)
1180 pProps->GetTOXBase().SetTOXName(sNewName);
1182 else if(!pSectionFmt ||
1183 !pSectionFmt->GetDoc()->SetTOXBaseName(
1184 *(SwTOXBaseSection*)pSectionFmt->GetSection(), sNewName))
1185 bExcept = sal_True;
1187 if(bExcept)
1188 throw uno::RuntimeException();
1191 /******************************************************************
1192 * SwXDocumentIndexMark
1193 ******************************************************************/
1194 /* -----------------------------10.03.00 18:02--------------------------------
1196 ---------------------------------------------------------------------------*/
1197 const uno::Sequence< sal_Int8 > & SwXDocumentIndexMark::getUnoTunnelId()
1199 static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
1200 return aSeq;
1202 /* -----------------------------10.03.00 18:04--------------------------------
1204 ---------------------------------------------------------------------------*/
1205 sal_Int64 SAL_CALL SwXDocumentIndexMark::getSomething( const uno::Sequence< sal_Int8 >& rId )
1206 throw(uno::RuntimeException)
1208 if( rId.getLength() == 16
1209 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
1210 rId.getConstArray(), 16 ) )
1212 return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
1214 return 0;
1217 TYPEINIT1(SwXDocumentIndexMark, SwClient)
1218 const sal_Char cBaseMark[] = "com.sun.star.text.BaseIndexMark";
1219 const sal_Char cContentMark[] = "com.sun.star.text.ContentIndexMark";
1220 const sal_Char cIdxMark[] = "com.sun.star.text.DocumentIndexMark";
1221 const sal_Char cIdxMarkAsian[] = "com.sun.star.text.DocumentIndexMarkAsian";
1222 const sal_Char cUserMark[] = "com.sun.star.text.UserIndexMark";
1223 const sal_Char cTextContent[] = "com.sun.star.text.TextContent";
1224 /* -----------------------------06.04.00 15:07--------------------------------
1226 ---------------------------------------------------------------------------*/
1227 OUString SwXDocumentIndexMark::getImplementationName(void) throw( uno::RuntimeException )
1229 return C2U("SwXDocumentIndexMark");
1231 /* -----------------------------06.04.00 15:07--------------------------------
1233 ---------------------------------------------------------------------------*/
1234 BOOL SwXDocumentIndexMark::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
1236 return !rServiceName.compareToAscii(cBaseMark)||
1237 !rServiceName.compareToAscii(cTextContent) ||
1238 (eType == TOX_USER && !rServiceName.compareToAscii(cUserMark)) ||
1239 (eType == TOX_CONTENT && !rServiceName.compareToAscii(cContentMark)) ||
1240 (eType == TOX_INDEX && !rServiceName.compareToAscii(cIdxMark)) ||
1241 (eType == TOX_INDEX && !rServiceName.compareToAscii(cIdxMarkAsian));
1243 /* -----------------------------06.04.00 15:07--------------------------------
1245 ---------------------------------------------------------------------------*/
1246 uno::Sequence< OUString > SwXDocumentIndexMark::getSupportedServiceNames(void) throw( uno::RuntimeException )
1248 INT32 nCnt = (eType == TOX_INDEX) ? 4 : 3;
1249 uno::Sequence< OUString > aRet(nCnt);
1250 OUString* pArray = aRet.getArray();
1251 pArray[0] = C2U(cBaseMark);
1252 pArray[1] = C2U(cTextContent);
1253 switch(eType)
1255 case TOX_USER:
1256 pArray[2] = C2U(cUserMark);
1257 break;
1258 case TOX_CONTENT:
1259 pArray[2] = C2U(cContentMark);
1260 break;
1261 case TOX_INDEX:
1262 pArray[2] = C2U(cIdxMark);
1263 pArray[3] = C2U(cIdxMarkAsian);
1264 break;
1266 default:
1269 return aRet;
1271 /*-- 14.12.98 10:25:43---------------------------------------------------
1273 -----------------------------------------------------------------------*/
1274 SwXDocumentIndexMark::SwXDocumentIndexMark(TOXTypes eToxType) :
1275 aLstnrCntnr( (text::XTextContent*)this),
1276 aTypeDepend(this, 0),
1277 m_pDoc(0),
1278 m_pTOXMark(0),
1279 bIsDescriptor(sal_True),
1280 bMainEntry(sal_False),
1281 eType(eToxType),
1282 nLevel(0)
1284 InitMap(eToxType);
1286 /*-- 14.12.98 10:25:44---------------------------------------------------
1288 -----------------------------------------------------------------------*/
1289 SwXDocumentIndexMark::SwXDocumentIndexMark(const SwTOXType* pType,
1290 const SwTOXMark* pMark,
1291 SwDoc* pDc) :
1292 aLstnrCntnr( (text::XTextContent*)this),
1293 aTypeDepend(this, (SwTOXType*)pType),
1294 m_pDoc(pDc),
1295 m_pTOXMark(pMark),
1296 bIsDescriptor(sal_False),
1297 bMainEntry(sal_False),
1298 eType(pType->GetType()),
1299 nLevel(0)
1301 m_pDoc->GetUnoCallBack()->Add(this);
1302 InitMap(eType);
1304 /*-- 14.12.98 10:25:44---------------------------------------------------
1306 -----------------------------------------------------------------------*/
1307 SwXDocumentIndexMark::~SwXDocumentIndexMark()
1311 /* -----------------21.04.99 09:36-------------------
1313 * --------------------------------------------------*/
1314 void SwXDocumentIndexMark::InitMap(TOXTypes eToxType)
1316 sal_uInt16 nMapId = PROPERTY_MAP_USER_MARK; //case TOX_USER:
1317 switch( eToxType )
1319 case TOX_INDEX:
1320 nMapId = PROPERTY_MAP_INDEX_MARK ;
1321 break;
1322 case TOX_CONTENT:
1323 nMapId = PROPERTY_MAP_CNTIDX_MARK;
1324 break;
1325 //case TOX_USER:
1327 default:
1330 m_pPropSet = aSwMapProvider.GetPropertySet(nMapId);
1332 /*-- 14.12.98 10:25:45---------------------------------------------------
1334 -----------------------------------------------------------------------*/
1335 OUString SwXDocumentIndexMark::getMarkEntry(void) throw( uno::RuntimeException )
1337 vos::OGuard aGuard(Application::GetSolarMutex());
1338 SwTOXType* pType = ((SwXDocumentIndexMark*)this)->GetTOXType();
1339 OUString sRet;
1340 if(pType && m_pTOXMark)
1342 sRet = OUString(m_pTOXMark->GetAlternativeText());
1344 else if(bIsDescriptor)
1345 sRet = sAltText;
1346 else
1347 throw uno::RuntimeException();
1348 return sRet;
1350 /*-- 14.12.98 10:25:45---------------------------------------------------
1352 -----------------------------------------------------------------------*/
1353 void SwXDocumentIndexMark::setMarkEntry(const OUString& rIndexEntry) throw( uno::RuntimeException )
1355 vos::OGuard aGuard(Application::GetSolarMutex());
1356 SwTOXType* pType = ((SwXDocumentIndexMark*)this)->GetTOXType();
1357 if(pType && m_pTOXMark)
1359 SwTOXMark aMark(*m_pTOXMark);
1360 aMark.SetAlternativeText(rIndexEntry);
1361 const SwTxtTOXMark* pTxtMark = m_pTOXMark->GetTxtTOXMark();
1362 SwPaM aPam(pTxtMark->GetTxtNode(), *pTxtMark->GetStart());
1363 aPam.SetMark();
1364 if(pTxtMark->GetEnd())
1366 aPam.GetPoint()->nContent = *pTxtMark->GetEnd();
1368 else
1369 aPam.GetPoint()->nContent++;
1371 //die alte Marke loeschen
1372 m_pDoc->DeleteTOXMark(m_pTOXMark);
1373 m_pTOXMark = 0;
1375 SwTxtAttr* pTxtAttr = 0;
1376 sal_Bool bInsAtPos = aMark.IsAlternativeText();
1377 const SwPosition *pStt = aPam.Start(),
1378 *pEnd = aPam.End();
1379 if( bInsAtPos )
1381 SwPaM aTmp( *pStt );
1382 m_pDoc->InsertPoolItem( aTmp, aMark, 0 );
1383 pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttrForCharAt(
1384 pStt->nContent.GetIndex()-1, RES_TXTATR_TOXMARK);
1386 else if( *pEnd != *pStt )
1388 m_pDoc->InsertPoolItem( aPam, aMark,
1389 nsSetAttrMode::SETATTR_DONTEXPAND );
1390 pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttr(
1391 pStt->nContent, RES_TXTATR_TOXMARK);
1393 //und sonst - Marke geloescht?
1394 if(pTxtAttr)
1395 m_pTOXMark = &pTxtAttr->GetTOXMark();
1397 else if(bIsDescriptor)
1399 sAltText = rIndexEntry;
1401 else
1402 throw uno::RuntimeException();
1404 /* -----------------18.02.99 13:40-------------------
1406 * --------------------------------------------------*/
1407 void SwXDocumentIndexMark::attachToRange(const uno::Reference< text::XTextRange > & xTextRange)
1408 throw( lang::IllegalArgumentException, uno::RuntimeException )
1410 vos::OGuard aGuard(Application::GetSolarMutex());
1411 if(!bIsDescriptor)
1412 throw uno::RuntimeException();
1414 uno::Reference<XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
1415 SwXTextRange* pRange = 0;
1416 OTextCursorHelper* pCursor = 0;
1417 if(xRangeTunnel.is())
1419 pRange = reinterpret_cast< SwXTextRange * >(
1420 sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) ));
1421 pCursor = reinterpret_cast< OTextCursorHelper * >(
1422 sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
1425 SwDoc* pDoc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0;
1427 if(pDoc )
1429 const SwTOXType* pTOXType = 0;
1430 switch(eType)
1432 case TOX_INDEX:
1433 case TOX_CONTENT:
1434 pTOXType = pDoc->GetTOXType( eType, 0 );
1435 break;
1436 case TOX_USER:
1438 if(!sUserIndexName.Len())
1439 pTOXType = pDoc->GetTOXType( eType, 0 );
1440 else
1442 sal_uInt16 nCount = pDoc->GetTOXTypeCount( eType);
1443 for(sal_uInt16 i = 0; i < nCount; i++)
1445 const SwTOXType* pTemp = pDoc->GetTOXType( eType, i );
1446 if(sUserIndexName == pTemp->GetTypeName())
1448 pTOXType = pTemp;
1449 break;
1452 if(!pTOXType)
1454 SwTOXType aUserType(TOX_USER, sUserIndexName);
1455 pTOXType = pDoc->InsertTOXType(aUserType);
1459 break;
1461 default:
1464 if(!pTOXType)
1465 throw lang::IllegalArgumentException();
1466 pDoc->GetUnoCallBack()->Add(this);
1467 ((SwTOXType*)pTOXType)->Add(&aTypeDepend);
1469 SwUnoInternalPaM aPam(*pDoc);
1470 //das muss jetzt sal_True liefern
1471 SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange);
1472 SwTOXMark aMark (pTOXType);
1473 if(sAltText.Len())
1474 aMark.SetAlternativeText(sAltText);
1475 switch(eType)
1477 case TOX_INDEX:
1478 if(sPrimaryKey.Len())
1479 aMark.SetPrimaryKey(sPrimaryKey);
1480 if(sSecondaryKey.Len())
1481 aMark.SetSecondaryKey(sSecondaryKey);
1482 if(sTextReading.Len())
1483 aMark.SetTextReading(sTextReading);
1484 if(sPrimaryKeyReading.Len())
1485 aMark.SetPrimaryKeyReading(sPrimaryKeyReading);
1486 if(sSecondaryKeyReading.Len())
1487 aMark.SetSecondaryKeyReading(sSecondaryKeyReading);
1488 aMark.SetMainEntry(bMainEntry);
1489 break;
1490 case TOX_USER:
1491 case TOX_CONTENT:
1492 if(USHRT_MAX != nLevel)
1493 aMark.SetLevel(nLevel+1);
1494 break;
1496 default:
1499 UnoActionContext aAction(pDoc);
1500 sal_Bool bMark = *aPam.GetPoint() != *aPam.GetMark();
1501 // Marks ohne Alternativtext ohne selektierten Text koennen nicht eingefuegt werden,
1502 // deshalb hier ein Leerzeichen - ob das die ideale Loesung ist?
1503 if(!bMark && !aMark.GetAlternativeText().Len())
1504 aMark.SetAlternativeText( String(' ') );
1506 SwXTextCursor const*const pTextCursor(
1507 dynamic_cast<SwXTextCursor*>(pCursor));
1508 const bool bForceExpandHints( (!bMark && pTextCursor)
1509 ? pTextCursor->IsAtEndOfMeta() : false );
1510 const SetAttrMode nInsertFlags = (bForceExpandHints)
1511 ? ( nsSetAttrMode::SETATTR_FORCEHINTEXPAND
1512 | nsSetAttrMode::SETATTR_DONTEXPAND)
1513 : nsSetAttrMode::SETATTR_DONTEXPAND;
1515 pDoc->InsertPoolItem(aPam, aMark, nInsertFlags);
1516 if( bMark && *aPam.GetPoint() > *aPam.GetMark())
1517 aPam.Exchange();
1519 SwTxtAttr* pTxtAttr = 0;
1520 if( bMark )
1521 pTxtAttr = aPam.GetNode()->GetTxtNode()->GetTxtAttr(
1522 aPam.GetPoint()->nContent, RES_TXTATR_TOXMARK );
1523 else
1525 pTxtAttr = aPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
1526 aPam.GetPoint()->nContent.GetIndex()-1, RES_TXTATR_TOXMARK );
1529 if(pTxtAttr)
1531 m_pTOXMark = &pTxtAttr->GetTOXMark();
1532 m_pDoc = pDoc;
1533 bIsDescriptor = sal_False;
1535 else
1536 throw uno::RuntimeException();
1539 /*-- 14.12.98 10:25:45---------------------------------------------------
1541 -----------------------------------------------------------------------*/
1542 void SwXDocumentIndexMark::attach(const uno::Reference< text::XTextRange > & xTextRange)
1543 throw( lang::IllegalArgumentException, uno::RuntimeException )
1545 vos::OGuard aGuard(Application::GetSolarMutex());
1546 attachToRange( xTextRange );
1548 /*-- 14.12.98 10:25:45---------------------------------------------------
1550 -----------------------------------------------------------------------*/
1551 uno::Reference< text::XTextRange > SwXDocumentIndexMark::getAnchor(void) throw( uno::RuntimeException )
1553 vos::OGuard aGuard(Application::GetSolarMutex());
1554 uno::Reference< text::XTextRange > aRet;
1555 SwTOXType* pType = ((SwXDocumentIndexMark*)this)->GetTOXType();
1556 if(pType && m_pTOXMark)
1558 if( m_pTOXMark->GetTxtTOXMark() )
1560 const SwTxtTOXMark* pTxtMark = m_pTOXMark->GetTxtTOXMark();
1561 SwPaM aPam(pTxtMark->GetTxtNode(), *pTxtMark->GetStart());
1562 aPam.SetMark();
1563 if(pTxtMark->GetEnd())
1565 aPam.GetPoint()->nContent = *pTxtMark->GetEnd();
1567 else
1568 aPam.GetPoint()->nContent++;
1569 uno::Reference< frame::XModel > xModel = m_pDoc->GetDocShell()->GetBaseModel();
1570 uno::Reference< text::XTextDocument > xTDoc(xModel, uno::UNO_QUERY);
1571 aRet = new SwXTextRange(aPam, xTDoc->getText());
1574 if(!aRet.is())
1575 throw uno::RuntimeException();
1576 return aRet;
1578 /*-- 14.12.98 10:25:45---------------------------------------------------
1580 -----------------------------------------------------------------------*/
1581 void SwXDocumentIndexMark::dispose(void) throw( uno::RuntimeException )
1583 vos::OGuard aGuard(Application::GetSolarMutex());
1584 SwTOXType* pType = ((SwXDocumentIndexMark*)this)->GetTOXType();
1585 if(pType && m_pTOXMark)
1587 m_pDoc->DeleteTOXMark(m_pTOXMark);
1589 else
1590 throw uno::RuntimeException();
1592 /*-- 14.12.98 10:25:45---------------------------------------------------
1594 -----------------------------------------------------------------------*/
1595 void SwXDocumentIndexMark::addEventListener(const uno::Reference< lang::XEventListener > & aListener)
1596 throw( uno::RuntimeException )
1598 if(!GetRegisteredIn())
1599 throw uno::RuntimeException();
1600 aLstnrCntnr.AddListener(aListener);
1602 /*-- 14.12.98 10:25:46---------------------------------------------------
1604 -----------------------------------------------------------------------*/
1605 void SwXDocumentIndexMark::removeEventListener(const uno::Reference< lang::XEventListener > & aListener)
1606 throw( uno::RuntimeException )
1608 if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
1609 throw uno::RuntimeException();
1611 /*-- 14.12.98 10:25:46---------------------------------------------------
1613 -----------------------------------------------------------------------*/
1614 uno::Reference< beans::XPropertySetInfo > SwXDocumentIndexMark::getPropertySetInfo(void)
1615 throw( uno::RuntimeException )
1617 static uno::Reference< beans::XPropertySetInfo > xInfos[3];
1618 int nPos = 0;
1619 switch(eType)
1621 case TOX_INDEX: nPos = 0; break;
1622 case TOX_CONTENT: nPos = 1; break;
1623 case TOX_USER: nPos = 2; break;
1624 default:
1627 if(!xInfos[nPos].is())
1629 uno::Reference< beans::XPropertySetInfo > xInfo = m_pPropSet->getPropertySetInfo();
1630 // extend PropertySetInfo!
1631 const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties();
1632 xInfos[nPos] = new SfxExtItemPropertySetInfo(
1633 aSwMapProvider.GetPropertyMapEntries(PROPERTY_MAP_PARAGRAPH_EXTENSIONS),
1634 aPropSeq );
1636 return xInfos[nPos];
1638 /*-- 14.12.98 10:25:46---------------------------------------------------
1640 -----------------------------------------------------------------------*/
1641 void SwXDocumentIndexMark::setPropertyValue(const OUString& rPropertyName,
1642 const uno::Any& aValue)
1643 throw( beans::UnknownPropertyException, beans::PropertyVetoException,
1644 lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
1646 vos::OGuard aGuard(Application::GetSolarMutex());
1647 SwTOXType* pType = ((SwXDocumentIndexMark*)this)->GetTOXType();
1648 const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName);
1649 if (!pEntry)
1650 throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
1651 if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
1652 throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
1653 if(pType && m_pTOXMark)
1655 SwDoc* pLocalDoc = m_pDoc;
1657 SwTOXMark aMark(*m_pTOXMark);
1658 switch(pEntry->nWID)
1660 case WID_ALT_TEXT:
1661 aMark.SetAlternativeText(lcl_AnyToString(aValue));
1662 break;
1663 case WID_LEVEL:
1664 aMark.SetLevel(Min( (sal_Int8) ( MAXLEVEL ),
1665 (sal_Int8)(lcl_AnyToInt16(aValue)+1)));
1666 break;
1667 case WID_PRIMARY_KEY :
1668 aMark.SetPrimaryKey(lcl_AnyToString(aValue));
1669 break;
1670 case WID_SECONDARY_KEY:
1671 aMark.SetSecondaryKey(lcl_AnyToString(aValue));
1672 break;
1673 case WID_MAIN_ENTRY:
1674 aMark.SetMainEntry(lcl_AnyToBool(aValue));
1675 break;
1676 case WID_TEXT_READING:
1677 aMark.SetTextReading(lcl_AnyToString(aValue));
1678 break;
1679 case WID_PRIMARY_KEY_READING:
1680 aMark.SetPrimaryKeyReading(lcl_AnyToString(aValue));
1681 break;
1682 case WID_SECONDARY_KEY_READING:
1683 aMark.SetSecondaryKeyReading(lcl_AnyToString(aValue));
1684 break;
1686 const SwTxtTOXMark* pTxtMark = m_pTOXMark->GetTxtTOXMark();
1687 SwPaM aPam(pTxtMark->GetTxtNode(), *pTxtMark->GetStart());
1688 aPam.SetMark();
1689 if(pTxtMark->GetEnd())
1691 aPam.GetPoint()->nContent = *pTxtMark->GetEnd();
1693 else
1694 aPam.GetPoint()->nContent++;
1696 //delete the old mark
1697 pLocalDoc->DeleteTOXMark(m_pTOXMark);
1698 m_pTOXMark = 0;
1700 sal_Bool bInsAtPos = aMark.IsAlternativeText();
1701 const SwPosition *pStt = aPam.Start(),
1702 *pEnd = aPam.End();
1704 SwTxtAttr* pTxtAttr = 0;
1705 if( bInsAtPos )
1707 SwPaM aTmp( *pStt );
1708 pLocalDoc->InsertPoolItem( aTmp, aMark, 0 );
1709 pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttrForCharAt(
1710 pStt->nContent.GetIndex()-1, RES_TXTATR_TOXMARK );
1712 else if( *pEnd != *pStt )
1714 pLocalDoc->InsertPoolItem( aPam, aMark,
1715 nsSetAttrMode::SETATTR_DONTEXPAND );
1716 pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttr(
1717 pStt->nContent, RES_TXTATR_TOXMARK );
1719 m_pDoc = pLocalDoc;
1721 if(pTxtAttr)
1723 m_pTOXMark = &pTxtAttr->GetTOXMark();
1724 m_pDoc->GetUnoCallBack()->Add(this);
1725 pType->Add(&aTypeDepend);
1728 else if(bIsDescriptor)
1730 switch(pEntry->nWID)
1732 case WID_ALT_TEXT:
1733 sAltText = lcl_AnyToString(aValue);
1734 break;
1735 case WID_LEVEL:
1737 sal_Int16 nVal = lcl_AnyToInt16(aValue);
1738 if(nVal >= 0 && nVal < MAXLEVEL)
1739 nLevel = nVal;
1740 else
1741 throw lang::IllegalArgumentException();
1743 break;
1744 case WID_PRIMARY_KEY :
1745 sPrimaryKey = lcl_AnyToString(aValue);
1746 break;
1747 case WID_SECONDARY_KEY:
1748 sSecondaryKey = lcl_AnyToString(aValue);
1749 break;
1750 case WID_TEXT_READING:
1751 sTextReading = lcl_AnyToString(aValue);
1752 break;
1753 case WID_PRIMARY_KEY_READING:
1754 sPrimaryKeyReading = lcl_AnyToString(aValue);
1755 break;
1756 case WID_SECONDARY_KEY_READING:
1757 sSecondaryKeyReading = lcl_AnyToString(aValue);
1758 break;
1759 case WID_USER_IDX_NAME :
1761 OUString sTmp(lcl_AnyToString(aValue));
1762 lcl_ConvertTOUNameToUserName(sTmp);
1763 sUserIndexName = sTmp;
1765 break;
1766 case WID_MAIN_ENTRY:
1767 bMainEntry = lcl_AnyToBool(aValue);
1768 break;
1771 else
1772 throw uno::RuntimeException();
1774 /*-- 14.12.98 10:25:46---------------------------------------------------
1776 -----------------------------------------------------------------------*/
1777 uno::Any SwXDocumentIndexMark::getPropertyValue(const OUString& rPropertyName)
1778 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
1780 vos::OGuard aGuard(Application::GetSolarMutex());
1781 uno::Any aRet;
1782 SwTOXType* pType = ((SwXDocumentIndexMark*)this)->GetTOXType();
1783 const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName);
1784 if (!pEntry)
1785 throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
1786 if(SwXParagraph::getDefaultTextContentValue(aRet, rPropertyName, pEntry->nWID))
1787 return aRet;
1788 if(pType && m_pTOXMark)
1790 switch(pEntry->nWID)
1792 case WID_ALT_TEXT:
1793 aRet <<= OUString(m_pTOXMark->GetAlternativeText());
1794 break;
1795 case WID_LEVEL:
1796 aRet <<= (sal_Int16)(m_pTOXMark->GetLevel() - 1);
1797 break;
1798 case WID_PRIMARY_KEY :
1799 aRet <<= OUString(m_pTOXMark->GetPrimaryKey());
1800 break;
1801 case WID_SECONDARY_KEY:
1802 aRet <<= OUString(m_pTOXMark->GetSecondaryKey());
1803 break;
1804 case WID_TEXT_READING:
1805 aRet <<= OUString(m_pTOXMark->GetTextReading());
1806 break;
1807 case WID_PRIMARY_KEY_READING:
1808 aRet <<= OUString(m_pTOXMark->GetPrimaryKeyReading());
1809 break;
1810 case WID_SECONDARY_KEY_READING:
1811 aRet <<= OUString(m_pTOXMark->GetSecondaryKeyReading());
1812 break;
1813 case WID_USER_IDX_NAME :
1815 OUString sTmp(pType->GetTypeName());
1816 lcl_ConvertTOUNameToProgrammaticName(sTmp);
1817 aRet <<= sTmp;
1819 break;
1820 case WID_MAIN_ENTRY:
1822 sal_Bool bTemp = m_pTOXMark->IsMainEntry();
1823 aRet.setValue(&bTemp, ::getBooleanCppuType());
1825 break;
1828 else if(bIsDescriptor)
1830 switch(pEntry->nWID)
1832 case WID_ALT_TEXT:
1833 aRet <<= OUString(sAltText);
1834 break;
1835 case WID_LEVEL:
1836 aRet <<= (sal_Int16)nLevel;
1837 break;
1838 case WID_PRIMARY_KEY :
1839 aRet <<= OUString(sPrimaryKey);
1840 break;
1841 case WID_SECONDARY_KEY:
1842 aRet <<= OUString(sSecondaryKey);
1843 break;
1844 case WID_TEXT_READING:
1845 aRet <<= OUString(sTextReading);
1846 break;
1847 case WID_PRIMARY_KEY_READING:
1848 aRet <<= OUString(sPrimaryKeyReading);
1849 break;
1850 case WID_SECONDARY_KEY_READING:
1851 aRet <<= OUString(sSecondaryKeyReading);
1852 break;
1853 case WID_USER_IDX_NAME :
1854 aRet <<= OUString(sUserIndexName);
1855 break;
1856 case WID_MAIN_ENTRY:
1858 aRet.setValue(&bMainEntry, ::getBooleanCppuType());
1860 break;
1863 else
1864 throw uno::RuntimeException();
1865 return aRet;
1867 /*-- 14.12.98 10:25:46---------------------------------------------------
1869 -----------------------------------------------------------------------*/
1870 void SwXDocumentIndexMark::addPropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
1872 DBG_WARNING("not implemented");
1874 /*-- 14.12.98 10:25:46---------------------------------------------------
1876 -----------------------------------------------------------------------*/
1877 void SwXDocumentIndexMark::removePropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
1879 DBG_WARNING("not implemented");
1881 /*-- 14.12.98 10:25:47---------------------------------------------------
1883 -----------------------------------------------------------------------*/
1884 void SwXDocumentIndexMark::addVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
1886 DBG_WARNING("not implemented");
1888 /*-- 14.12.98 10:25:47---------------------------------------------------
1890 -----------------------------------------------------------------------*/
1891 void SwXDocumentIndexMark::removeVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
1893 DBG_WARNING("not implemented");
1895 /*-- 14.12.98 10:25:47---------------------------------------------------
1897 -----------------------------------------------------------------------*/
1898 SwXDocumentIndexMark* SwXDocumentIndexMark::GetObject(SwTOXType* pType,
1899 const SwTOXMark* pMark, SwDoc* pDoc)
1901 SwClientIter aIter(*pType);
1902 SwXDocumentIndexMark* pxMark = (SwXDocumentIndexMark*)
1903 aIter.First(TYPE(SwXDocumentIndexMark));
1904 while( pxMark )
1906 if(pxMark->m_pTOXMark == pMark)
1907 return pxMark;
1908 pxMark = (SwXDocumentIndexMark*)aIter.Next();
1910 return new SwXDocumentIndexMark(pType, pMark, pDoc);
1912 /*-- 14.12.98 10:25:47---------------------------------------------------
1914 -----------------------------------------------------------------------*/
1915 void SwXDocumentIndexMark::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
1917 switch( pOld ? pOld->Which() : 0 )
1919 case RES_REMOVE_UNO_OBJECT:
1920 case RES_OBJECTDYING:
1921 if( (void*)GetRegisteredIn() == ((SwPtrMsgPoolItem *)pOld)->pObject )
1922 Invalidate();
1923 break;
1925 case RES_FMT_CHG:
1926 // wurden wir an das neue umgehaengt und wird das alte geloscht?
1927 if( ((SwFmtChg*)pNew)->pChangedFmt == GetRegisteredIn() &&
1928 ((SwFmtChg*)pOld)->pChangedFmt->IsFmtInDTOR() )
1929 Invalidate();
1930 break;
1931 case RES_TOXMARK_DELETED:
1932 if( (void*)m_pTOXMark == ((SwPtrMsgPoolItem *)pOld)->pObject )
1933 Invalidate();
1934 break;
1937 /* -----------------------------16.10.00 11:24--------------------------------
1939 ---------------------------------------------------------------------------*/
1940 void SwXDocumentIndexMark::Invalidate()
1942 if(GetRegisteredIn())
1944 ((SwModify*)GetRegisteredIn())->Remove(this);
1945 if(aTypeDepend.GetRegisteredIn())
1946 ((SwModify*)aTypeDepend.GetRegisteredIn())->Remove(&aTypeDepend);
1947 aLstnrCntnr.Disposing();
1948 m_pTOXMark = 0;
1949 m_pDoc = 0;
1952 /* -----------------------------06.04.00 15:08--------------------------------
1954 ---------------------------------------------------------------------------*/
1955 OUString SwXDocumentIndexes::getImplementationName(void) throw( uno::RuntimeException )
1957 return C2U("SwXDocumentIndexes");
1959 /* -----------------------------06.04.00 15:08--------------------------------
1961 ---------------------------------------------------------------------------*/
1962 BOOL SwXDocumentIndexes::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
1964 return C2U("com.sun.star.text.DocumentIndexes") == rServiceName;
1966 /* -----------------------------06.04.00 15:08--------------------------------
1968 ---------------------------------------------------------------------------*/
1969 uno::Sequence< OUString > SwXDocumentIndexes::getSupportedServiceNames(void) throw( uno::RuntimeException )
1971 uno::Sequence< OUString > aRet(1);
1972 OUString* pArray = aRet.getArray();
1973 pArray[0] = C2U("com.sun.star.text.DocumentIndexes");
1974 return aRet;
1976 /*-- 05.05.99 13:14:59---------------------------------------------------
1978 -----------------------------------------------------------------------*/
1979 SwXDocumentIndexes::SwXDocumentIndexes(SwDoc* _pDoc) :
1980 SwUnoCollection(_pDoc)
1983 /*-- 05.05.99 13:15:00---------------------------------------------------
1985 -----------------------------------------------------------------------*/
1986 SwXDocumentIndexes::~SwXDocumentIndexes()
1989 /*-- 05.05.99 13:15:01---------------------------------------------------
1991 -----------------------------------------------------------------------*/
1992 sal_Int32 SwXDocumentIndexes::getCount(void) throw( uno::RuntimeException )
1994 vos::OGuard aGuard(Application::GetSolarMutex());
1995 if(!IsValid())
1996 throw uno::RuntimeException();
1998 sal_uInt32 nRet = 0;
1999 const SwSectionFmts& rFmts = GetDoc()->GetSections();
2000 for( sal_uInt16 n = 0; n < rFmts.Count(); ++n )
2002 const SwSection* pSect = rFmts[ n ]->GetSection();
2003 if( TOX_CONTENT_SECTION == pSect->GetType() &&
2004 pSect->GetFmt()->GetSectionNode() )
2005 ++nRet;
2007 return nRet;
2009 /*-- 05.05.99 13:15:01---------------------------------------------------
2011 -----------------------------------------------------------------------*/
2012 uno::Any SwXDocumentIndexes::getByIndex(sal_Int32 nIndex)
2013 throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
2015 vos::OGuard aGuard(Application::GetSolarMutex());
2016 if(!IsValid())
2017 throw uno::RuntimeException();
2019 uno::Any aRet;
2020 sal_Int32 nIdx = 0;
2022 const SwSectionFmts& rFmts = GetDoc()->GetSections();
2023 for( sal_uInt16 n = 0; n < rFmts.Count(); ++n )
2025 const SwSection* pSect = rFmts[ n ]->GetSection();
2026 if( TOX_CONTENT_SECTION == pSect->GetType() &&
2027 pSect->GetFmt()->GetSectionNode() &&
2028 nIdx++ == nIndex )
2030 uno::Reference< text::XDocumentIndex > xTmp = new SwXDocumentIndex(
2031 (SwTOXBaseSection*)pSect, GetDoc() );
2032 aRet.setValue(&xTmp, ::getCppuType((uno::Reference<text::XDocumentIndex>*)0));
2033 return aRet;
2037 throw lang::IndexOutOfBoundsException();
2040 /*-- 31.01.00 10:12:31---------------------------------------------------
2042 -----------------------------------------------------------------------*/
2043 uno::Any SwXDocumentIndexes::getByName(const OUString& rName)
2044 throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
2046 vos::OGuard aGuard(Application::GetSolarMutex());
2047 if(!IsValid())
2048 throw uno::RuntimeException();
2050 uno::Any aRet;
2052 String sToFind(rName);
2053 const SwSectionFmts& rFmts = GetDoc()->GetSections();
2054 for( sal_uInt16 n = 0; n < rFmts.Count(); ++n )
2056 const SwSection* pSect = rFmts[ n ]->GetSection();
2057 if( TOX_CONTENT_SECTION == pSect->GetType() &&
2058 pSect->GetFmt()->GetSectionNode() &&
2059 ((SwTOXBaseSection*)pSect)->GetTOXName() == sToFind)
2061 uno::Reference< text::XDocumentIndex > xTmp = new SwXDocumentIndex(
2062 (SwTOXBaseSection*)pSect, GetDoc() );
2063 aRet.setValue(&xTmp, ::getCppuType((uno::Reference<text::XDocumentIndex>*)0));
2064 return aRet;
2067 throw container::NoSuchElementException();
2069 /*-- 31.01.00 10:12:31---------------------------------------------------
2071 -----------------------------------------------------------------------*/
2072 uno::Sequence< OUString > SwXDocumentIndexes::getElementNames(void)
2073 throw( uno::RuntimeException )
2075 vos::OGuard aGuard(Application::GetSolarMutex());
2076 if(!IsValid())
2077 throw uno::RuntimeException();
2079 const SwSectionFmts& rFmts = GetDoc()->GetSections();
2080 sal_Int32 nCount = 0;
2081 sal_uInt16 n;
2082 for( n = 0; n < rFmts.Count(); ++n )
2084 const SwSection* pSect = rFmts[ n ]->GetSection();
2085 if( TOX_CONTENT_SECTION == pSect->GetType() &&
2086 pSect->GetFmt()->GetSectionNode() )
2087 ++nCount;
2090 uno::Sequence< OUString > aRet(nCount);
2091 OUString* pArray = aRet.getArray();
2092 sal_uInt16 nCnt;
2093 for( n = 0, nCnt = 0; n < rFmts.Count(); ++n )
2095 const SwSection* pSect = rFmts[ n ]->GetSection();
2096 if( TOX_CONTENT_SECTION == pSect->GetType() &&
2097 pSect->GetFmt()->GetSectionNode())
2099 pArray[nCnt++] = OUString(((SwTOXBaseSection*)pSect)->GetTOXName());
2102 return aRet;
2104 /*-- 31.01.00 10:12:31---------------------------------------------------
2106 -----------------------------------------------------------------------*/
2107 sal_Bool SwXDocumentIndexes::hasByName(const OUString& rName)
2108 throw( uno::RuntimeException )
2110 vos::OGuard aGuard(Application::GetSolarMutex());
2111 if(!IsValid())
2112 throw uno::RuntimeException();
2114 String sToFind(rName);
2115 const SwSectionFmts& rFmts = GetDoc()->GetSections();
2116 for( sal_uInt16 n = 0; n < rFmts.Count(); ++n )
2118 const SwSection* pSect = rFmts[ n ]->GetSection();
2119 if( TOX_CONTENT_SECTION == pSect->GetType() &&
2120 pSect->GetFmt()->GetSectionNode())
2122 if(((SwTOXBaseSection*)pSect)->GetTOXName() == sToFind)
2123 return sal_True;
2126 return sal_False;
2128 /*-- 05.05.99 13:15:01---------------------------------------------------
2130 -----------------------------------------------------------------------*/
2131 uno::Type SwXDocumentIndexes::getElementType(void) throw( uno::RuntimeException )
2133 return ::getCppuType((uno::Reference< text::XDocumentIndex> *)0);
2135 /*-- 05.05.99 13:15:02---------------------------------------------------
2137 -----------------------------------------------------------------------*/
2138 sal_Bool SwXDocumentIndexes::hasElements(void) throw( uno::RuntimeException )
2140 vos::OGuard aGuard(Application::GetSolarMutex());
2141 if(!IsValid())
2142 throw uno::RuntimeException();
2143 return 0 != getCount();
2146 SwXDocumentIndex* SwXDocumentIndexes::GetObject(const SwTOXBaseSection* pTOX)
2148 SwSectionFmt* pFmt = pTOX->GetFmt();
2149 SwClientIter aIter(*pFmt);
2150 SwXDocumentIndex* pxIdx = (SwXDocumentIndex*)aIter.First(TYPE(SwXDocumentIndex));
2151 if(pxIdx)
2152 return pxIdx;
2153 else
2154 return new SwXDocumentIndex(pTOX, pFmt->GetDoc());
2157 /* -----------------------------06.04.00 15:08--------------------------------
2159 ---------------------------------------------------------------------------*/
2160 OUString SwXIndexStyleAccess_Impl::getImplementationName(void) throw( uno::RuntimeException )
2162 return C2U("SwXIndexStyleAccess_Impl");
2164 /* -----------------------------06.04.00 15:08--------------------------------
2166 ---------------------------------------------------------------------------*/
2167 BOOL SwXIndexStyleAccess_Impl::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
2169 return C2U("com.sun.star.text.DocumentIndexParagraphStyles") == rServiceName;
2171 /* -----------------------------06.04.00 15:08--------------------------------
2173 ---------------------------------------------------------------------------*/
2174 uno::Sequence< OUString > SwXIndexStyleAccess_Impl::getSupportedServiceNames(void) throw( uno::RuntimeException )
2176 uno::Sequence< OUString > aRet(1);
2177 OUString* pArray = aRet.getArray();
2178 pArray[0] = C2U("com.sun.star.text.DocumentIndexParagraphStyles");
2179 return aRet;
2181 /*-- 13.09.99 16:52:28---------------------------------------------------
2183 -----------------------------------------------------------------------*/
2184 SwXIndexStyleAccess_Impl::SwXIndexStyleAccess_Impl(SwXDocumentIndex& rParentIdx) :
2185 rParent(rParentIdx),
2186 xParent(&rParentIdx)
2188 vos::OGuard aGuard(Application::GetSolarMutex());
2189 rParent.SetStyleAccess(this);
2191 /*-- 13.09.99 16:52:29---------------------------------------------------
2193 -----------------------------------------------------------------------*/
2194 SwXIndexStyleAccess_Impl::~SwXIndexStyleAccess_Impl()
2196 vos::OGuard aGuard(Application::GetSolarMutex());
2197 rParent.SetStyleAccess(0);
2199 /*-- 13.09.99 16:52:29---------------------------------------------------
2201 -----------------------------------------------------------------------*/
2202 void SwXIndexStyleAccess_Impl::replaceByIndex(sal_Int32 nIndex, const uno::Any& rElement)
2203 throw( lang::IllegalArgumentException, lang::IndexOutOfBoundsException,
2204 lang::WrappedTargetException, uno::RuntimeException)
2206 vos::OGuard aGuard(Application::GetSolarMutex());
2207 const sal_Bool bDescriptor = rParent.IsDescriptor();
2208 SwSectionFmt* pSectFmt = rParent.GetFmt();
2209 if(!pSectFmt && !bDescriptor)
2210 throw uno::RuntimeException();
2211 if(nIndex < 0 || nIndex > MAXLEVEL)
2212 throw lang::IndexOutOfBoundsException();
2213 SwTOXBase* pTOXBase = bDescriptor ? &rParent.GetProperties_Impl()->GetTOXBase() :
2214 (SwTOXBaseSection*)pSectFmt->GetSection();
2216 uno::Sequence<OUString> aSeq;
2217 if(!(rElement >>= aSeq))
2218 throw lang::IllegalArgumentException();
2220 sal_Int32 nStyles = aSeq.getLength();
2221 const OUString* pStyles = aSeq.getConstArray();
2222 String sSetStyles;
2223 String aString;
2224 for(sal_Int32 i = 0; i < nStyles; i++)
2226 if(i)
2227 sSetStyles += TOX_STYLE_DELIMITER;
2228 SwStyleNameMapper::FillUIName(pStyles[i], aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True);
2229 sSetStyles += aString;
2231 pTOXBase->SetStyleNames(sSetStyles, (sal_uInt16) nIndex);
2233 /*-- 13.09.99 16:52:29---------------------------------------------------
2235 -----------------------------------------------------------------------*/
2236 sal_Int32 SwXIndexStyleAccess_Impl::getCount(void) throw( uno::RuntimeException )
2238 return MAXLEVEL;
2240 /*-- 13.09.99 16:52:30---------------------------------------------------
2242 -----------------------------------------------------------------------*/
2243 uno::Any SwXIndexStyleAccess_Impl::getByIndex(sal_Int32 nIndex)
2244 throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException,
2245 uno::RuntimeException)
2247 vos::OGuard aGuard(Application::GetSolarMutex());
2248 const sal_Bool bDescriptor = rParent.IsDescriptor();
2249 SwSectionFmt* pSectFmt = rParent.GetFmt();
2250 if(!pSectFmt && !bDescriptor)
2251 throw uno::RuntimeException();
2252 if(nIndex < 0 || nIndex > MAXLEVEL)
2253 throw lang::IndexOutOfBoundsException();
2254 SwTOXBase* pTOXBase = bDescriptor ? &rParent.GetProperties_Impl()->GetTOXBase() :
2255 (SwTOXBaseSection*)pSectFmt->GetSection();
2257 const String& rStyles = pTOXBase->GetStyleNames((sal_uInt16) nIndex);
2258 sal_uInt16 nStyles = rStyles.GetTokenCount(TOX_STYLE_DELIMITER);
2259 uno::Sequence<OUString> aStyles(nStyles);
2260 OUString* pStyles = aStyles.getArray();
2261 String aString;
2262 for(sal_uInt16 i = 0; i < nStyles; i++)
2264 SwStyleNameMapper::FillProgName(
2265 rStyles.GetToken(i, TOX_STYLE_DELIMITER),
2266 aString,
2267 nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL,
2268 sal_True);
2269 pStyles[i] = OUString( aString );
2271 uno::Any aRet(&aStyles, ::getCppuType((uno::Sequence<OUString>*)0));
2272 return aRet;
2274 /*-- 13.09.99 16:52:30---------------------------------------------------
2276 -----------------------------------------------------------------------*/
2277 uno::Type SwXIndexStyleAccess_Impl::getElementType(void)
2278 throw( uno::RuntimeException )
2280 return ::getCppuType((uno::Sequence<OUString>*)0);
2282 /*-- 13.09.99 16:52:30---------------------------------------------------
2284 -----------------------------------------------------------------------*/
2285 sal_Bool SwXIndexStyleAccess_Impl::hasElements(void) throw( uno::RuntimeException )
2287 return sal_True;
2290 /* -----------------13.09.99 16:51-------------------
2292 --------------------------------------------------*/
2293 /* -----------------------------06.04.00 15:08--------------------------------
2295 ---------------------------------------------------------------------------*/
2296 OUString SwXIndexTokenAccess_Impl::getImplementationName(void) throw( uno::RuntimeException )
2298 return C2U("SwXIndexTokenAccess_Impl");
2300 /* -----------------------------06.04.00 15:08--------------------------------
2302 ---------------------------------------------------------------------------*/
2303 BOOL SwXIndexTokenAccess_Impl::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
2305 return C2U("com.sun.star.text.DocumentIndexLevelFormat") == rServiceName;
2307 /* -----------------------------06.04.00 15:08--------------------------------
2309 ---------------------------------------------------------------------------*/
2310 uno::Sequence< OUString > SwXIndexTokenAccess_Impl::getSupportedServiceNames(void) throw( uno::RuntimeException )
2312 uno::Sequence< OUString > aRet(1);
2313 OUString* pArray = aRet.getArray();
2314 pArray[0] = C2U("com.sun.star.text.DocumentIndexLevelFormat");
2315 return aRet;
2317 /*-- 13.09.99 16:52:28---------------------------------------------------
2319 -----------------------------------------------------------------------*/
2320 SwXIndexTokenAccess_Impl::SwXIndexTokenAccess_Impl(SwXDocumentIndex& rParentIdx) :
2321 rParent(rParentIdx),
2322 xParent(&rParentIdx),
2323 nCount(SwForm::GetFormMaxLevel(rParent.GetTOXType()))
2325 vos::OGuard aGuard(Application::GetSolarMutex());
2326 rParent.SetTokenAccess(this);
2328 /*-- 13.09.99 16:52:29---------------------------------------------------
2330 -----------------------------------------------------------------------*/
2331 SwXIndexTokenAccess_Impl::~SwXIndexTokenAccess_Impl()
2333 vos::OGuard aGuard(Application::GetSolarMutex());
2334 rParent.SetTokenAccess(0);
2336 /*-- 13.09.99 16:52:29---------------------------------------------------
2338 -----------------------------------------------------------------------*/
2339 void SwXIndexTokenAccess_Impl::replaceByIndex(sal_Int32 nIndex, const uno::Any& rElement)
2340 throw( lang::IllegalArgumentException, lang::IndexOutOfBoundsException,
2341 lang::WrappedTargetException, uno::RuntimeException)
2343 vos::OGuard aGuard(Application::GetSolarMutex());
2344 const sal_Bool bDescriptor = rParent.IsDescriptor();
2345 SwSectionFmt* pSectFmt = rParent.GetFmt();
2346 if(!pSectFmt && !bDescriptor)
2347 throw uno::RuntimeException();
2349 SwTOXBase* pTOXBase = bDescriptor ? &rParent.GetProperties_Impl()->GetTOXBase() :
2350 (SwTOXBaseSection*)pSectFmt->GetSection();
2351 if(nIndex < 0 ||
2352 (nIndex > pTOXBase->GetTOXForm().GetFormMax()))
2353 throw lang::IndexOutOfBoundsException();
2355 uno::Sequence<beans::PropertyValues> aSeq;
2356 if(!(rElement >>= aSeq))
2357 throw lang::IllegalArgumentException();
2359 String sPattern;
2360 sal_Int32 nTokens = aSeq.getLength();
2361 const beans::PropertyValues* pTokens = aSeq.getConstArray();
2362 for(sal_Int32 i = 0; i < nTokens; i++)
2364 const beans::PropertyValue* pProperties = pTokens[i].getConstArray();
2365 sal_Int32 nProperties = pTokens[i].getLength();
2366 //create an invalid token
2367 SwFormToken aToken(TOKEN_END);
2368 for(sal_Int32 j = 0; j < nProperties; j++)
2370 if( COMPARE_EQUAL == pProperties[j].Name.compareToAscii("TokenType"))
2372 const String sTokenType =
2373 lcl_AnyToString(pProperties[j].Value);
2374 if(sTokenType.EqualsAscii("TokenEntryNumber"))
2375 aToken.eTokenType = TOKEN_ENTRY_NO;
2376 else if(sTokenType.EqualsAscii("TokenEntryText" ))
2377 aToken.eTokenType = TOKEN_ENTRY_TEXT;
2378 else if(sTokenType.EqualsAscii("TokenTabStop" ))
2379 aToken.eTokenType = TOKEN_TAB_STOP;
2380 else if(sTokenType.EqualsAscii("TokenText" ))
2381 aToken.eTokenType = TOKEN_TEXT;
2382 else if(sTokenType.EqualsAscii("TokenPageNumber"))
2383 aToken.eTokenType = TOKEN_PAGE_NUMS;
2384 else if(sTokenType.EqualsAscii("TokenChapterInfo" ))
2385 aToken.eTokenType = TOKEN_CHAPTER_INFO;
2386 else if(sTokenType.EqualsAscii("TokenHyperlinkStart" ))
2387 aToken.eTokenType = TOKEN_LINK_START;
2388 else if(sTokenType.EqualsAscii("TokenHyperlinkEnd"))
2389 aToken.eTokenType = TOKEN_LINK_END;
2390 else if(sTokenType.EqualsAscii("TokenBibliographyDataField" ))
2391 aToken.eTokenType = TOKEN_AUTHORITY;
2393 else if( pProperties[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("CharacterStyleName" ) ))
2395 String sCharStyleName;
2396 SwStyleNameMapper::FillUIName(
2397 lcl_AnyToString(pProperties[j].Value),
2398 sCharStyleName,
2399 nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
2400 sal_True);
2401 aToken.sCharStyleName = sCharStyleName;
2402 aToken.nPoolId = SwStyleNameMapper::GetPoolIdFromUIName (
2403 sCharStyleName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
2405 else if( pProperties[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("TabStopRightAligned") ))
2407 sal_Bool bRight = lcl_AnyToBool(pProperties[j].Value);
2408 aToken.eTabAlign = bRight ?
2409 SVX_TAB_ADJUST_END : SVX_TAB_ADJUST_LEFT;
2411 else if( pProperties[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("TabStopPosition" )))
2413 sal_Int32 nPosition = 0;
2414 if(pProperties[j].Value.getValueType() != ::getCppuType((sal_Int32*)0))
2415 throw lang::IllegalArgumentException();
2416 pProperties[j].Value >>= nPosition;
2417 nPosition = MM100_TO_TWIP(nPosition);
2418 if(nPosition < 0)
2419 throw lang::IllegalArgumentException();
2420 aToken.nTabStopPosition = nPosition;
2422 else if( pProperties[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("TabStopFillCharacter" )))
2424 const String sFillChar =
2425 lcl_AnyToString(pProperties[j].Value);
2426 if(sFillChar.Len() > 1)
2427 throw lang::IllegalArgumentException();
2428 aToken.cTabFillChar = sFillChar.Len() ?
2429 sFillChar.GetChar(0) : ' ';
2431 else if( pProperties[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Text" )))
2433 const String sText =
2434 lcl_AnyToString(pProperties[j].Value);
2435 aToken.sText = sText;
2437 else if( pProperties[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ChapterFormat" )))
2439 sal_Int16 nFormat = lcl_AnyToInt16(pProperties[j].Value);
2440 switch(nFormat)
2442 case text::ChapterFormat::NUMBER: nFormat = CF_NUMBER;
2443 break;
2444 case text::ChapterFormat::NAME: nFormat = CF_TITLE;
2445 break;
2446 case text::ChapterFormat::NAME_NUMBER: nFormat = CF_NUM_TITLE;
2447 break;
2448 case text::ChapterFormat::NO_PREFIX_SUFFIX:nFormat = CF_NUMBER_NOPREPST;
2449 break;
2450 case text::ChapterFormat::DIGIT: nFormat = CF_NUM_NOPREPST_TITLE;
2451 break;
2452 default:
2453 throw lang::IllegalArgumentException();
2455 aToken.nChapterFormat = nFormat;
2457 //--->i53420
2458 else if( pProperties[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ChapterLevel")) )
2460 const sal_Int16 nLevel = lcl_AnyToInt16(pProperties[j].Value);
2461 if( nLevel < 1 || nLevel > MAXLEVEL )
2462 throw lang::IllegalArgumentException();
2463 aToken.nOutlineLevel = nLevel;
2465 //<---
2466 else if( pProperties[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("BibliographyDataField")))
2468 sal_Int16 nType = 0;
2469 pProperties[j].Value >>= nType;
2470 if(nType < 0 || nType > text::BibliographyDataField::ISBN)
2472 lang::IllegalArgumentException aExcept;
2473 aExcept.Message = C2U("BibliographyDataField - wrong value");
2474 aExcept.ArgumentPosition = static_cast< sal_Int16 >(j);
2475 throw aExcept;
2477 aToken.nAuthorityField = nType;
2479 // #i21237#
2480 else if ( pProperties[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("WithTab")))
2482 aToken.bWithTab = lcl_AnyToBool(pProperties[j].Value);
2486 //exception if wrong TokenType
2487 if(TOKEN_END <= aToken.eTokenType )
2488 throw lang::IllegalArgumentException();
2489 // set TokenType from TOKEN_ENTRY_TEXT to TOKEN_ENTRY if it is
2490 // not a content index
2491 if(TOKEN_ENTRY_TEXT == aToken.eTokenType &&
2492 TOX_CONTENT != pTOXBase->GetType())
2493 aToken.eTokenType = TOKEN_ENTRY;
2494 //---> i53420
2495 // check for chapter format allowed values if it was TOKEN_ENTRY_NO type
2496 // only allowed value are CF_NUMBER and CF_NUM_NOPREPST_TITLE
2497 // reading from file
2498 if( TOKEN_ENTRY_NO == aToken.eTokenType )
2499 switch(aToken.nChapterFormat)
2501 case CF_NUMBER:
2502 case CF_NUM_NOPREPST_TITLE:
2503 break;
2504 default:
2505 throw lang::IllegalArgumentException();
2507 //<---
2508 sPattern += aToken.GetString();
2510 SwForm aForm(pTOXBase->GetTOXForm());
2511 aForm.SetPattern((sal_uInt16) nIndex, sPattern);
2512 pTOXBase->SetTOXForm(aForm);
2514 /*-- 13.09.99 16:52:29---------------------------------------------------
2516 -----------------------------------------------------------------------*/
2517 sal_Int32 SwXIndexTokenAccess_Impl::getCount(void) throw( uno::RuntimeException )
2519 vos::OGuard aGuard(Application::GetSolarMutex());
2520 const sal_Bool bDescriptor = rParent.IsDescriptor();
2521 SwSectionFmt* pSectFmt = rParent.GetFmt();
2522 if(!pSectFmt && !bDescriptor)
2523 throw uno::RuntimeException();
2524 sal_Int32 nRet = bDescriptor ?
2525 nCount :
2526 ((SwTOXBaseSection*)pSectFmt->GetSection())->
2527 GetTOXForm().GetFormMax();
2528 return nRet;
2530 /*-- 13.09.99 16:52:30---------------------------------------------------
2532 -----------------------------------------------------------------------*/
2533 uno::Any SwXIndexTokenAccess_Impl::getByIndex(sal_Int32 nIndex)
2534 throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException,
2535 uno::RuntimeException)
2537 vos::OGuard aGuard(Application::GetSolarMutex());
2538 const sal_Bool bDescriptor = rParent.IsDescriptor();
2539 SwSectionFmt* pSectFmt = rParent.GetFmt();
2540 if(!pSectFmt && !bDescriptor)
2541 throw uno::RuntimeException();
2542 SwTOXBase* pTOXBase = bDescriptor ? &rParent.GetProperties_Impl()->GetTOXBase() :
2543 (SwTOXBaseSection*)pSectFmt->GetSection();
2544 if(nIndex < 0 ||
2545 (nIndex > pTOXBase->GetTOXForm().GetFormMax()))
2546 throw lang::IndexOutOfBoundsException();
2548 // #i21237#
2549 SwFormTokens aPattern = pTOXBase->GetTOXForm().
2550 GetPattern((sal_uInt16) nIndex);
2551 SwFormTokens::iterator aIt = aPattern.begin();
2553 sal_uInt16 nTokenCount = 0;
2554 uno::Sequence< beans::PropertyValues > aRetSeq;
2555 String aString;
2556 while(aIt != aPattern.end()) // #i21237#
2558 nTokenCount++;
2559 aRetSeq.realloc(nTokenCount);
2560 beans::PropertyValues* pTokenProps = aRetSeq.getArray();
2561 SwFormToken aToken = *aIt; // #i21237#
2563 uno::Sequence< beans::PropertyValue >& rCurTokenSeq = pTokenProps[nTokenCount-1];
2564 SwStyleNameMapper::FillProgName(
2565 aToken.sCharStyleName,
2566 aString,
2567 nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
2568 sal_True );
2569 const OUString aProgCharStyle( aString );
2570 switch(aToken.eTokenType)
2572 case TOKEN_ENTRY_NO :
2574 //--->i53420
2575 // writing to file (from doc to properties)
2576 sal_Int32 nElements = 2;
2577 sal_Int32 nCurrentElement = 0;
2579 if( aToken.nChapterFormat != CF_NUMBER )//check for default value
2580 nElements++;//we need the element
2581 if( aToken.nOutlineLevel != MAXLEVEL )
2582 nElements++;
2584 rCurTokenSeq.realloc( nElements );
2586 beans::PropertyValue* pArr = rCurTokenSeq.getArray();
2588 pArr[nCurrentElement].Name = C2U("TokenType");
2589 pArr[nCurrentElement++].Value <<= OUString::createFromAscii("TokenEntryNumber");
2590 // pArr[0].Value <<= C2U("TokenEntryNumber");
2592 pArr[nCurrentElement].Name = C2U("CharacterStyleName");
2593 pArr[nCurrentElement++].Value <<= aProgCharStyle;
2594 if( aToken.nChapterFormat != CF_NUMBER )
2596 pArr[nCurrentElement].Name = C2U("ChapterFormat");
2597 sal_Int16 nVal;
2598 //! the allowed values for chapter format, when used as entry number, are CF_NUMBER and CF_NUM_NOPREPST_TITLE only, all else forced to
2599 //CF_NUMBER
2600 switch(aToken.nChapterFormat)
2602 default:
2603 case CF_NUMBER: nVal = text::ChapterFormat::NUMBER; break;
2604 case CF_NUM_NOPREPST_TITLE: nVal = text::ChapterFormat::DIGIT; break;
2606 pArr[nCurrentElement++].Value <<= (sal_Int16)nVal;
2609 if( aToken.nOutlineLevel != MAXLEVEL ) //only a ChapterLevel != MAXLEVEL is registered
2611 pArr[nCurrentElement].Name = C2U("ChapterLevel");
2612 pArr[nCurrentElement].Value <<= aToken.nOutlineLevel;
2614 //<---
2616 break;
2617 case TOKEN_ENTRY : // no difference between Entry and Entry Text
2618 case TOKEN_ENTRY_TEXT :
2620 rCurTokenSeq.realloc( 2 );
2621 beans::PropertyValue* pArr = rCurTokenSeq.getArray();
2623 pArr[0].Name = C2U("TokenType");
2624 pArr[0].Value <<= OUString::createFromAscii("TokenEntryText");
2626 pArr[1].Name = C2U("CharacterStyleName");
2627 pArr[1].Value <<= aProgCharStyle;
2629 break;
2630 case TOKEN_TAB_STOP :
2632 rCurTokenSeq.realloc(5); // #i21237#
2633 beans::PropertyValue* pArr = rCurTokenSeq.getArray();
2635 pArr[0].Name = C2U("TokenType");
2636 pArr[0].Value <<= OUString::createFromAscii("TokenTabStop");
2639 if(SVX_TAB_ADJUST_END == aToken.eTabAlign)
2641 pArr[1].Name = C2U("TabStopRightAligned");
2642 BOOL bTemp = sal_True;
2643 pArr[1].Value.setValue(&bTemp, ::getCppuBooleanType());
2645 else
2647 pArr[1].Name = C2U("TabStopPosition");
2648 sal_Int32 nPos = (TWIP_TO_MM100(aToken.nTabStopPosition));
2649 if(nPos < 0)
2650 nPos = 0;
2651 pArr[1].Value <<= (sal_Int32)nPos;
2653 pArr[2].Name = C2U("TabStopFillCharacter");
2654 pArr[2].Value <<= OUString(aToken.cTabFillChar);
2655 pArr[3].Name = C2U("CharacterStyleName");
2656 pArr[3].Value <<= aProgCharStyle;
2657 // #i21237#
2658 pArr[4].Name = C2U("WithTab");
2659 pArr[4].Value.setValue(&aToken.bWithTab, ::getCppuBooleanType());
2661 break;
2662 case TOKEN_TEXT :
2664 rCurTokenSeq.realloc( 3 );
2665 beans::PropertyValue* pArr = rCurTokenSeq.getArray();
2667 pArr[0].Name = C2U("TokenType");
2668 pArr[0].Value <<= OUString::createFromAscii("TokenText");
2670 pArr[1].Name = C2U("CharacterStyleName");
2671 pArr[1].Value <<= aProgCharStyle;
2673 pArr[2].Name = C2U("Text");
2674 pArr[2].Value <<= OUString(aToken.sText);
2676 break;
2677 case TOKEN_PAGE_NUMS :
2679 rCurTokenSeq.realloc( 2 );
2680 beans::PropertyValue* pArr = rCurTokenSeq.getArray();
2682 pArr[0].Name = C2U("TokenType");
2683 pArr[0].Value <<= OUString::createFromAscii("TokenPageNumber");
2685 pArr[1].Name = C2U("CharacterStyleName");
2686 pArr[1].Value <<= aProgCharStyle;
2688 break;
2689 case TOKEN_CHAPTER_INFO :
2691 rCurTokenSeq.realloc( 4 );
2692 beans::PropertyValue* pArr = rCurTokenSeq.getArray();
2694 pArr[0].Name = C2U("TokenType");
2695 pArr[0].Value <<= OUString::createFromAscii("TokenChapterInfo");
2697 pArr[1].Name = C2U("CharacterStyleName");
2698 pArr[1].Value <<= aProgCharStyle;
2700 pArr[2].Name = C2U("ChapterFormat");
2701 sal_Int16 nVal = text::ChapterFormat::NUMBER;
2702 switch(aToken.nChapterFormat)
2704 case CF_NUMBER: nVal = text::ChapterFormat::NUMBER; break;
2705 case CF_TITLE: nVal = text::ChapterFormat::NAME; break;
2706 case CF_NUM_TITLE: nVal = text::ChapterFormat::NAME_NUMBER; break;
2707 case CF_NUMBER_NOPREPST: nVal = text::ChapterFormat::NO_PREFIX_SUFFIX; break;
2708 case CF_NUM_NOPREPST_TITLE: nVal = text::ChapterFormat::DIGIT; break;
2710 pArr[2].Value <<= (sal_Int16)nVal;
2711 //--->i53420
2712 pArr[3].Name = C2U("ChapterLevel");
2714 pArr[3].Value <<= aToken.nOutlineLevel;
2715 //<---
2717 break;
2718 case TOKEN_LINK_START :
2720 rCurTokenSeq.realloc( 2 );
2721 beans::PropertyValue* pArr = rCurTokenSeq.getArray();
2723 pArr[0].Name = C2U("TokenType");
2724 pArr[0].Value <<= OUString::createFromAscii("TokenHyperlinkStart");
2725 pArr[1].Name = C2U("CharacterStyleName");
2726 pArr[1].Value <<= aProgCharStyle;
2728 break;
2729 case TOKEN_LINK_END :
2731 rCurTokenSeq.realloc( 1 );
2732 beans::PropertyValue* pArr = rCurTokenSeq.getArray();
2734 pArr[0].Name = C2U("TokenType");
2735 pArr[0].Value <<= OUString::createFromAscii("TokenHyperlinkEnd");
2737 break;
2738 case TOKEN_AUTHORITY :
2740 rCurTokenSeq.realloc( 3 );
2741 beans::PropertyValue* pArr = rCurTokenSeq.getArray();
2743 pArr[0].Name = C2U("TokenType");
2744 pArr[0].Value <<= OUString::createFromAscii("TokenBibliographyDataField");
2746 pArr[1].Name = C2U("CharacterStyleName");
2747 pArr[1].Value <<= aProgCharStyle;
2749 pArr[2].Name = C2U("BibliographyDataField");
2750 pArr[2].Value <<= sal_Int16(aToken.nAuthorityField);
2752 break;
2754 default:
2758 aIt++; // #i21237#
2761 uno::Any aRet(&aRetSeq, ::getCppuType((uno::Sequence< beans::PropertyValues >*)0));
2763 return aRet;
2765 /*-- 13.09.99 16:52:30---------------------------------------------------
2767 -----------------------------------------------------------------------*/
2768 uno::Type SwXIndexTokenAccess_Impl::getElementType(void)
2769 throw( uno::RuntimeException )
2771 return ::getCppuType((uno::Sequence< beans::PropertyValues >*)0);
2773 /*-- 13.09.99 16:52:30---------------------------------------------------
2775 -----------------------------------------------------------------------*/
2776 sal_Bool SwXIndexTokenAccess_Impl::hasElements(void) throw( uno::RuntimeException )
2778 return sal_True;