xref: /trunk/main/sw/source/ui/index/cntex.cxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sw.hxx"
30 
31 #ifdef SW_DLLIMPLEMENTATION
32 #undef SW_DLLIMPLEMENTATION
33 #endif
34 
35 
36 
37 #include <rsc/rscsfx.hxx>
38 #include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
39 #include <com/sun/star/text/XDocumentIndex.hpp>
40 #include <com/sun/star/text/XTextSectionsSupplier.hpp>
41 #include <com/sun/star/style/BreakType.hpp>
42 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
43 #include <com/sun/star/text/XDependentTextField.hpp>
44 #include <com/sun/star/text/XParagraphCursor.hpp>
45 #include <com/sun/star/text/XDocumentIndex.hpp>
46 #include <com/sun/star/text/ChapterFormat.hpp>
47 #include <com/sun/star/text/XTextSection.hpp>
48 #include <com/sun/star/text/ControlCharacter.hpp>
49 #include <com/sun/star/beans/PropertyValues.hpp>
50 #include <com/sun/star/text/TextContentAnchorType.hpp>
51 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
52 #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
53 #include <com/sun/star/ui/dialogs/XFilterManager.hpp>
54 #include <wrtsh.hxx>
55 #ifndef _VIEW_HXX
56 #include <view.hxx>
57 #endif
58 #include <cnttab.hxx>
59 #include <poolfmt.hxx>
60 #include <unoprnms.hxx>
61 #include <unotools.hxx>
62 #include <unotxdoc.hxx>
63 #include <docsh.hxx>
64 #include <swmodule.hxx>
65 
66 #ifndef _CMDID_H
67 #include <cmdid.h>
68 #endif
69 #ifndef _UTLUI_HRC
70 #include <utlui.hrc>
71 #endif
72 #ifndef _INDEX_HRC
73 #include <index.hrc>
74 #endif
75 #ifndef _CNTTAB_HRC
76 #include <cnttab.hrc>
77 #endif
78 #ifndef _GLOBALS_HRC
79 #include <globals.hrc>
80 #endif
81 #include <SwStyleNameMapper.hxx>
82 #include <swuicnttab.hxx>
83 #include <unomid.h>
84 
85 
86 using namespace ::com::sun::star;
87 using namespace ::com::sun::star::text;
88 using namespace ::com::sun::star::beans;
89 using namespace ::com::sun::star::container;
90 using namespace ::com::sun::star::lang;
91 using namespace ::com::sun::star::ucb;
92 using namespace ::com::sun::star::uno;
93 using namespace com::sun::star::ui::dialogs;
94 using ::rtl::OUString;
95 
96 
97 #define INDEX_SECTION_NAME String::CreateFromAscii( \
98                             RTL_CONSTASCII_STRINGPARAM( "IndexSection_" ))
99 
100 #ifdef SW_PROP_NAME_STR
101 #undef SW_PROP_NAME_STR
102 #endif
103 #define SW_PROP_NAME_STR(nId) SwGetPropName((nId)).pName
104 
105 /* -----------------04.11.99 11:28-------------------
106 
107  --------------------------------------------------*/
108 void lcl_SetProp( uno::Reference< XPropertySetInfo > & xInfo,
109                          uno::Reference< XPropertySet > & xProps,
110                          const char* pPropName, const String& rValue)
111 {
112     OUString uPropName(C2U(pPropName));
113     if(xInfo->hasPropertyByName(uPropName))
114     {
115         uno::Any aValue;
116         aValue <<= OUString(rValue);
117         xProps->setPropertyValue(uPropName, aValue);
118     }
119 }
120 void lcl_SetProp( uno::Reference< XPropertySetInfo > & xInfo,
121                          uno::Reference< XPropertySet > & xProps,
122                          sal_uInt16 nId, const String& rValue)
123 {
124     lcl_SetProp( xInfo, xProps, SW_PROP_NAME_STR(nId), rValue);
125 }
126 void lcl_SetProp( uno::Reference< XPropertySetInfo > & xInfo,
127                          uno::Reference< XPropertySet > & xProps,
128                          sal_uInt16 nId, sal_Int16 nValue )
129 {
130     OUString uPropName(C2U(SW_PROP_NAME_STR(nId)));
131     if(xInfo->hasPropertyByName(uPropName))
132     {
133         uno::Any aValue;
134         aValue <<= nValue;
135         xProps->setPropertyValue(uPropName, aValue);
136     }
137 }
138 
139 void lcl_SetBOOLProp(
140                 uno::Reference< beans::XPropertySetInfo > & xInfo,
141                 uno::Reference< beans::XPropertySet > & xProps,
142                 sal_uInt16 nId, sal_Bool bValue )
143 {
144     OUString uPropName(C2U(SW_PROP_NAME_STR(nId)));
145     if(xInfo->hasPropertyByName(uPropName))
146     {
147         uno::Any aValue;
148         aValue.setValue(&bValue, ::getCppuBooleanType());
149         xProps->setPropertyValue(uPropName, aValue);
150     }
151 }
152 //-----------------------------------------------------------------------------
153 IMPL_LINK( SwMultiTOXTabDialog, CreateExample_Hdl, void*, EMPTYARG )
154 {
155     try
156     {
157         uno::Reference< frame::XModel > & xModel = pExampleFrame->GetModel();
158         uno::Reference< lang::XUnoTunnel > xDocTunnel(xModel, uno::UNO_QUERY);
159         SwXTextDocument* pDoc = reinterpret_cast<SwXTextDocument*>(xDocTunnel->getSomething(SwXTextDocument::getUnoTunnelId()));
160 
161         if( pDoc )
162             pDoc->GetDocShell()->_LoadStyles( *rSh.GetView().GetDocShell(), sal_True );
163 
164          uno::Reference< lang::XMultiServiceFactory >  xFact(
165                                             xModel, uno::UNO_QUERY);
166 
167         uno::Reference< text::XTextSectionsSupplier >  xSectionSupplier(
168                                                 xModel, uno::UNO_QUERY);
169         uno::Reference< container::XNameAccess >  xSections =
170                                         xSectionSupplier->getTextSections();
171 
172         String sSectionName( INDEX_SECTION_NAME );
173         for(int i = 0; i < 7; ++i )
174         {
175             String sTmp( sSectionName ); sTmp += String::CreateFromInt32(i);
176             uno::Any aSection = xSections->getByName( sTmp );
177             aSection >>= pxIndexSectionsArr[i]->xContainerSection;
178         }
179         uno::Reference< text::XDocumentIndexesSupplier >  xIdxSupp(xModel, uno::UNO_QUERY);
180         uno::Reference< container::XIndexAccess >  xIdxs = xIdxSupp->getDocumentIndexes();
181         int n = xIdxs->getCount();
182         while(n)
183         {
184             n--;
185             uno::Any aIdx = xIdxs->getByIndex(n);
186             uno::Reference< text::XDocumentIndex >  xIdx;
187             aIdx >>= xIdx;
188             xIdx->dispose();
189         }
190         CreateOrUpdateExample(eCurrentTOXType.eType);
191     }
192     catch(Exception&)
193     {
194         DBG_ERROR("::CreateExample() - exception caught");
195     }
196     return 0;
197 }
198 
199 /* --------------------------------------------------
200 
201  --------------------------------------------------*/
202 void SwMultiTOXTabDialog::CreateOrUpdateExample(
203     TOXTypes nTOXIndex, sal_uInt16 nPage, sal_uInt16 nCurrentLevel)
204 {
205     if(!pExampleFrame || !pExampleFrame->IsInitialized())
206         return;
207 
208     const char* __FAR_DATA IndexServiceNames[] =
209     {
210         "com.sun.star.text.DocumentIndex",
211         "com.sun.star.text.UserIndex",
212         "com.sun.star.text.ContentIndex",
213         "com.sun.star.text.IllustrationsIndex",
214         "com.sun.star.text.ObjectIndex",
215         "com.sun.star.text.TableIndex",
216         "com.sun.star.text.Bibliography"
217     };
218 
219     try
220     {
221         DBG_ASSERT(pxIndexSectionsArr[nTOXIndex] &&
222                         pxIndexSectionsArr[nTOXIndex]->xContainerSection.is(),
223                             "Section not created");
224         uno::Reference< frame::XModel > & xModel = pExampleFrame->GetModel();
225         sal_Bool bInitialCreate = sal_True;
226         if(!pxIndexSectionsArr[nTOXIndex]->xDocumentIndex.is())
227         {
228             bInitialCreate = sal_True;
229             if(!pxIndexSectionsArr[nTOXIndex]->xContainerSection.is())
230                 throw uno::RuntimeException();
231             uno::Reference< text::XTextRange >  xAnchor = pxIndexSectionsArr[nTOXIndex]->xContainerSection->getAnchor();
232             xAnchor = xAnchor->getStart();
233          uno::Reference< text::XTextCursor >  xCrsr = xAnchor->getText()->createTextCursorByRange(xAnchor);
234 
235          uno::Reference< lang::XMultiServiceFactory >  xFact(xModel, uno::UNO_QUERY);
236 
237             String sIndexTypeName;
238             sIndexTypeName.AssignAscii( IndexServiceNames[
239                     nTOXIndex <= TOX_AUTHORITIES ? nTOXIndex : TOX_USER] );
240             pxIndexSectionsArr[nTOXIndex]->xDocumentIndex = uno::Reference< text::XDocumentIndex > (xFact->createInstance(
241                                                     sIndexTypeName), uno::UNO_QUERY);
242          uno::Reference< text::XTextContent >  xContent(pxIndexSectionsArr[nTOXIndex]->xDocumentIndex, uno::UNO_QUERY);
243          uno::Reference< text::XTextRange >  xRg(xCrsr, uno::UNO_QUERY);
244             xCrsr->getText()->insertTextContent(xRg, xContent, sal_False);
245         }
246         OUString uIsVisible(C2U(SW_PROP_NAME_STR(UNO_NAME_IS_VISIBLE)));
247         for(sal_uInt16 i = 0 ; i <= TOX_AUTHORITIES; i++)
248         {
249          uno::Reference< beans::XPropertySet >  xSectPr(pxIndexSectionsArr[i]->xContainerSection, uno::UNO_QUERY);
250             uno::Any aVal;
251 
252             if(xSectPr.is())
253             {
254                 sal_Bool bTemp = i == nTOXIndex;
255                 aVal.setValue(&bTemp, ::getBooleanCppuType());
256                 xSectPr->setPropertyValue(uIsVisible, aVal);
257             }
258         }
259         // set properties
260      uno::Reference< beans::XPropertySet >  xIdxProps(pxIndexSectionsArr[nTOXIndex]->xDocumentIndex, uno::UNO_QUERY);
261      uno::Reference< beans::XPropertySetInfo >  xInfo = xIdxProps->getPropertySetInfo();
262         SwTOXDescription& rDesc = GetTOXDescription(eCurrentTOXType);
263         sal_uInt16 nIdxOptions = rDesc.GetIndexOptions();
264         if(bInitialCreate || !nPage || nPage == TOX_PAGE_SELECT)
265         {
266             //title
267             if(rDesc.GetTitle())
268                 lcl_SetProp(xInfo, xIdxProps, UNO_NAME_TITLE, *rDesc.GetTitle());
269 
270             //stylenames
271             sal_uInt16  nContentOptions = rDesc.GetContentOptions();
272             if(xInfo->hasPropertyByName(C2U(SW_PROP_NAME_STR(UNO_NAME_LEVEL_PARAGRAPH_STYLES))))
273             {
274                 sal_Bool bOn = 0!=(nContentOptions&nsSwTOXElement::TOX_TEMPLATE    );
275                 uno::Any aStyleNames(xIdxProps->getPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_LEVEL_PARAGRAPH_STYLES))));
276                 uno::Reference< container::XIndexReplace >  xAcc;
277                 aStyleNames >>= xAcc;
278 
279                 for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
280                 {
281                     String sLevel;
282                     if(bOn)
283                         sLevel = rDesc.GetStyleNames(i);
284                     sal_uInt16 nStyles = sLevel.GetTokenCount(TOX_STYLE_DELIMITER);
285                     uno::Sequence<OUString> aStyles(nStyles);
286                     OUString* pArr = aStyles.getArray();
287                     for(sal_uInt16 nStyle = 0; nStyle < nStyles; nStyle++)
288                         pArr[nStyle] = sLevel.GetToken(nStyle, TOX_STYLE_DELIMITER);
289                     uno::Any aAny(&aStyles, ::getCppuType((uno::Sequence<OUString>*)0));
290                     xAcc->replaceByIndex(i, aAny);
291                 }
292             }
293             lcl_SetProp(xInfo, xIdxProps, UNO_NAME_LEVEL, (sal_Int16)rDesc.GetLevel());
294             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_MARKS,           0!=(nContentOptions&nsSwTOXElement::TOX_MARK        ));
295             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_OUTLINE,         0!=(nContentOptions&nsSwTOXElement::TOX_OUTLINELEVEL));
296             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_EMBEDDED_OBJECTS,0!=(nContentOptions&nsSwTOXElement::TOX_OLE            ));
297             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_TABLES ,         0!=(nContentOptions&nsSwTOXElement::TOX_TABLE          ));
298             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_GRAPHIC_OBJECTS, 0!=(nContentOptions&nsSwTOXElement::TOX_GRAPHIC        ));
299             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_TEXT_FRAMES,     0!=(nContentOptions&nsSwTOXElement::TOX_FRAME          ));
300             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_LABELS,          0!=(nContentOptions&nsSwTOXElement::TOX_SEQUENCE       ));
301 
302             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_CHAPTER, rDesc.IsFromChapter());
303             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_PROTECTED, rDesc.IsReadonly());
304 
305             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_COMBINED_ENTRIES,        0 != (nIdxOptions&nsSwTOIOptions::TOI_SAME_ENTRY        ));
306             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_P_P,                     0 != (nIdxOptions&nsSwTOIOptions::TOI_FF                   ));
307             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_CASE_SENSITIVE,           0 != (nIdxOptions&nsSwTOIOptions::TOI_CASE_SENSITIVE     ));
308             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_KEY_AS_ENTRY,            0 != (nIdxOptions&nsSwTOIOptions::TOI_KEY_AS_ENTRY     ));
309             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_ALPHABETICAL_SEPARATORS, 0 != (nIdxOptions&nsSwTOIOptions::TOI_ALPHA_DELIMITTER));
310             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_DASH,                    0 != (nIdxOptions&nsSwTOIOptions::TOI_DASH             ));
311             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_UPPER_CASE,              0 != (nIdxOptions&nsSwTOIOptions::TOI_INITIAL_CAPS     ));
312 
313             String aTmpName( SwStyleNameMapper::GetSpecialExtraProgName( rDesc.GetSequenceName() ) );
314             lcl_SetProp(xInfo, xIdxProps, UNO_NAME_LABEL_CATEGORY, aTmpName );
315             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_LABELS,  !rDesc.IsCreateFromObjectNames());
316 
317             sal_Int16 nSet = text::ChapterFormat::NAME_NUMBER;
318             switch (rDesc.GetCaptionDisplay())
319             {
320                 case CAPTION_COMPLETE:  nSet = text::ChapterFormat::NAME_NUMBER;break;
321                 case CAPTION_NUMBER  :  nSet = text::ChapterFormat::NUMBER; break;
322                 case CAPTION_TEXT    :  nSet = text::ChapterFormat::NAME;      break;
323             }
324             lcl_SetProp(xInfo, xIdxProps, UNO_NAME_LABEL_DISPLAY_TYPE, nSet);
325 
326             sal_uInt16  nOLEOptions = rDesc.GetOLEOptions();
327             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_MATH,   0 != (nsSwTOOElements::TOO_MATH &nOLEOptions           ));
328             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_CHART,  0 != (nsSwTOOElements::TOO_CHART    &nOLEOptions       ));
329             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_CALC,   0 != (nsSwTOOElements::TOO_CALC &nOLEOptions           ));
330             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_DRAW,   0 != (nsSwTOOElements::TOO_DRAW_IMPRESS&nOLEOptions));
331             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_OTHER_EMBEDDED_OBJECTS, 0 != (nsSwTOOElements::TOO_OTHER|nOLEOptions       ));
332 
333             //lcl_SetBOOLProp(xInfo, xIdxProps, , rDesc.IsLevelFromChapter());
334         }
335         const SwForm* pForm = GetForm(eCurrentTOXType);
336         if(bInitialCreate || !nPage || nPage == TOX_PAGE_ENTRY)
337         {
338             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_COMMA_SEPARATED, pForm->IsCommaSeparated());
339             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_ALPHABETICAL_SEPARATORS, 0 != (nIdxOptions&nsSwTOIOptions::TOI_ALPHA_DELIMITTER));
340             sal_uInt16 nStartLevel = USHRT_MAX;
341             sal_uInt16 nEndLevel = USHRT_MAX;
342             if(nCurrentLevel < pForm->GetFormMax())
343                 nStartLevel = nEndLevel = nCurrentLevel;
344             else
345             {
346                 nStartLevel = 0;
347                 nEndLevel = pForm->GetFormMax() - 1;
348             }
349 
350             if(xInfo->hasPropertyByName(C2U(SW_PROP_NAME_STR(UNO_NAME_LEVEL_FORMAT))))
351             {
352                 for(sal_uInt16 nCurrLevel = nStartLevel; nCurrLevel <= nEndLevel; nCurrLevel++)
353                 {
354                     String sTokenType;
355                     uno::Sequence< beans::PropertyValues> aSequPropVals(10);
356                     long nTokenIndex = 0;
357                     long nParamCount = 2;
358 
359                     // #i24377#
360                     SwFormTokens aPattern = pForm->GetPattern(nCurrLevel);
361                     SwFormTokens::iterator aIt = aPattern.begin();
362 
363                     while(aIt != aPattern.end())
364                     {
365                         if( aSequPropVals.getLength() <= nTokenIndex)
366                             aSequPropVals.realloc(nTokenIndex + 10);
367 
368                         SwFormToken aToken = *aIt; // #i24377#
369                         switch(aToken.eTokenType)
370                         {
371                             case TOKEN_ENTRY_NO     :
372                                 sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
373                                                         "TokenEntryNumber"));
374                                 // fuer Inhaltsverzeichnis Numerierung
375                             break;
376                             case TOKEN_ENTRY_TEXT   :
377                             case TOKEN_ENTRY        :
378                                 sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
379                                                         "TokenEntryText"));
380                             break;
381                             case TOKEN_TAB_STOP     :
382                                 nParamCount += 3;
383                                 sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
384                                                         "TokenTabStop"));
385                             break;
386                             case TOKEN_TEXT         :
387                                 sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
388                                                         "TokenText"));
389                                 nParamCount += 1;
390                             break;
391                             case TOKEN_PAGE_NUMS    :
392                                 sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
393                                                         "TokenPageNumber"));
394                             break;
395                             case TOKEN_CHAPTER_INFO :
396                                 sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
397                                                         "TokenChapterInfo"));
398                             break;
399                             case TOKEN_LINK_START   :
400                                 sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
401                                                         "TokenHyperlinkStart"));
402                             break;
403                             case TOKEN_LINK_END     :
404                                 sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
405                                                         "TokenHyperlinkEnd"));
406                             break;
407                             case TOKEN_AUTHORITY :
408                             {
409                                 sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
410                                                     "TokenBibliographyDataField"));
411                             }
412                             break;
413                             default:; //prevent warning
414                         }
415                         beans::PropertyValues aPropVals(nParamCount);
416                         beans::PropertyValue* pPropValArr = aPropVals.getArray();
417                         pPropValArr[0].Name = C2U("TokenType");
418                         pPropValArr[0].Value <<= OUString(sTokenType);
419                         pPropValArr[1].Name = C2U("CharacterStyleName");
420                         pPropValArr[1].Value <<= OUString(aToken.sCharStyleName);
421                         if(TOKEN_TAB_STOP == aToken.eTokenType)
422                         {
423                             pPropValArr[2].Name = C2U("TabStopRightAligned");
424                             sal_Bool bTemp = SVX_TAB_ADJUST_END == aToken.eTabAlign;
425                             pPropValArr[2].Value.setValue(&bTemp, ::getBooleanCppuType());
426                             pPropValArr[3].Name = C2U("TabStopFillCharacter");
427                             pPropValArr[3].Value <<= OUString(aToken.cTabFillChar);
428                             pPropValArr[4].Name = C2U("TabStopPosition");
429                             SwTwips nTempPos = aToken.nTabStopPosition >= 0 ?
430                                                             aToken.nTabStopPosition : 0;
431                             nTempPos = TWIP_TO_MM100(nTempPos);
432                             pPropValArr[4].Value <<= (sal_Int32)nTempPos;
433                         }
434                         else if(TOKEN_TEXT == aToken.eTokenType)
435                         {
436                             pPropValArr[2].Name = C2U("Text");
437                             pPropValArr[2].Value <<= OUString(aToken.sText);
438                         }
439                     beans::PropertyValues* pValues = aSequPropVals.getArray();
440                         pValues[nTokenIndex] = aPropVals;
441                         nTokenIndex++;
442 
443                         aIt++; // #i24377#
444                     }
445                     aSequPropVals.realloc(nTokenIndex);
446 
447                     uno::Any aFormatAccess = xIdxProps->getPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_LEVEL_FORMAT)));
448                     DBG_ASSERT(aFormatAccess.getValueType() == ::getCppuType((uno::Reference<container::XIndexReplace>*)0),
449                         "wrong property type");
450 
451 
452                     uno::Reference< container::XIndexReplace >  xFormatAccess;
453                     aFormatAccess >>= xFormatAccess;
454                     uno::Any aLevelProp(&aSequPropVals, ::getCppuType((uno::Sequence<beans::PropertyValues>*)0));
455                     xFormatAccess->replaceByIndex(nCurrLevel, aLevelProp);
456                 }
457             }
458         }
459         if(bInitialCreate || !nPage || nPage == TOX_PAGE_STYLES)
460         {
461             lcl_SetProp(xInfo, xIdxProps, "ParaStyleHeading", pForm->GetTemplate(0));
462             sal_uInt16 nOffset = 0;
463             sal_uInt16 nEndLevel = 2;
464             switch(eCurrentTOXType.eType)
465             {
466                 case  TOX_INDEX:
467                 {
468                     nOffset = 1;
469                     nEndLevel = 4;
470                     lcl_SetProp(xInfo, xIdxProps, "ParaStyleSeparator", pForm->GetTemplate(1));
471                 }
472                 break;
473                 case TOX_CONTENT :
474                     nEndLevel = 11;
475                 break;
476                 default:; //prevent warning
477             }
478             for(sal_uInt16 i = 1; i < nEndLevel; i++)
479             {
480                 String sPropName(C2S("ParaStyleLevel"));
481                 sPropName += String::CreateFromInt32( i );
482                 lcl_SetProp(xInfo,
483                     xIdxProps,
484                     ByteString(sPropName, RTL_TEXTENCODING_ASCII_US).GetBuffer(),
485                     pForm->GetTemplate(i + nOffset));
486             }
487         }
488 /*
489     const String&   GetAutoMarkURL() const { return sAutoMarkURL;}
490     const String&   GetMainEntryCharStyle() const {return sMainEntryCharStyle;}
491 
492     String          GetAuthBrackets() const {return sAuthBrackets;}
493     sal_Bool            IsAuthSequence() const {return bIsAuthSequence;}
494     sal_Bool            IsSortByDocument()const {return bSortByDocument ;}
495 
496     SwTOXSortKey GetSortKey1() const {return eSortKey1;}
497     SwTOXSortKey GetSortKey2() const {return eSortKey2;}
498     SwTOXSortKey GetSortKey3() const {return eSortKey3;}
499 */
500         //
501         pxIndexSectionsArr[nTOXIndex]->xDocumentIndex->update();
502 
503 //#if OSL_DEBUG_LEVEL > 1
504 //      uno::Reference< frame::XStorable >  xStor(xModel, uno::UNO_QUERY);
505 //      String sURL("file:///e|/temp/sw/idxexample.sdw");
506 //   uno::Sequence< beans::PropertyValue > aArgs(0);
507 //      xStor->storeToURL(S2U(sURL), aArgs);
508 //#endif
509 
510     }
511     catch(Exception&)
512     {
513         DBG_ERROR("::CreateExample() - exception caught");
514     }
515 }
516 
517