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