update dev300-m58
[ooovba.git] / sw / source / ui / index / cntex.cxx
blob5397e971021f52473b4d1f62a9f12944f7c7e168
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: cntex.cxx,v $
10 * $Revision: 1.14 $
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"
34 #ifdef SW_DLLIMPLEMENTATION
35 #undef SW_DLLIMPLEMENTATION
36 #endif
40 #include <rsc/rscsfx.hxx>
41 #include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
42 #include <com/sun/star/text/XDocumentIndex.hpp>
43 #include <com/sun/star/text/XTextSectionsSupplier.hpp>
44 #include <com/sun/star/style/BreakType.hpp>
45 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
46 #include <com/sun/star/text/XDependentTextField.hpp>
47 #include <com/sun/star/text/XParagraphCursor.hpp>
48 #include <com/sun/star/text/XDocumentIndex.hpp>
49 #include <com/sun/star/text/ChapterFormat.hpp>
50 #include <com/sun/star/text/XTextSection.hpp>
51 #include <com/sun/star/text/ControlCharacter.hpp>
52 #include <com/sun/star/beans/PropertyValues.hpp>
53 #include <com/sun/star/text/TextContentAnchorType.hpp>
54 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
55 #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
56 #include <com/sun/star/ui/dialogs/XFilterManager.hpp>
57 #include <wrtsh.hxx>
58 #ifndef _VIEW_HXX
59 #include <view.hxx>
60 #endif
61 #include <cnttab.hxx>
62 #include <poolfmt.hxx>
63 #include <unoprnms.hxx>
64 #include <unotools.hxx>
65 #include <unotxdoc.hxx>
66 #include <docsh.hxx>
67 #include <swmodule.hxx>
69 #ifndef _CMDID_H
70 #include <cmdid.h>
71 #endif
72 #ifndef _UTLUI_HRC
73 #include <utlui.hrc>
74 #endif
75 #ifndef _INDEX_HRC
76 #include <index.hrc>
77 #endif
78 #ifndef _CNTTAB_HRC
79 #include <cnttab.hrc>
80 #endif
81 #ifndef _GLOBALS_HRC
82 #include <globals.hrc>
83 #endif
84 #include <SwStyleNameMapper.hxx>
85 #include <swuicnttab.hxx>
86 #include <unomid.h>
89 using namespace ::com::sun::star;
90 using namespace ::com::sun::star::text;
91 using namespace ::com::sun::star::beans;
92 using namespace ::com::sun::star::container;
93 using namespace ::com::sun::star::lang;
94 using namespace ::com::sun::star::ucb;
95 using namespace ::com::sun::star::uno;
96 using namespace com::sun::star::ui::dialogs;
97 using ::rtl::OUString;
100 #define INDEX_SECTION_NAME String::CreateFromAscii( \
101 RTL_CONSTASCII_STRINGPARAM( "IndexSection_" ))
103 #ifdef SW_PROP_NAME_STR
104 #undef SW_PROP_NAME_STR
105 #endif
106 #define SW_PROP_NAME_STR(nId) SwGetPropName((nId)).pName
108 /* -----------------04.11.99 11:28-------------------
110 --------------------------------------------------*/
111 void lcl_SetProp( uno::Reference< XPropertySetInfo > & xInfo,
112 uno::Reference< XPropertySet > & xProps,
113 const char* pPropName, const String& rValue)
115 OUString uPropName(C2U(pPropName));
116 if(xInfo->hasPropertyByName(uPropName))
118 uno::Any aValue;
119 aValue <<= OUString(rValue);
120 xProps->setPropertyValue(uPropName, aValue);
123 void lcl_SetProp( uno::Reference< XPropertySetInfo > & xInfo,
124 uno::Reference< XPropertySet > & xProps,
125 USHORT nId, const String& rValue)
127 lcl_SetProp( xInfo, xProps, SW_PROP_NAME_STR(nId), rValue);
129 void lcl_SetProp( uno::Reference< XPropertySetInfo > & xInfo,
130 uno::Reference< XPropertySet > & xProps,
131 USHORT nId, sal_Int16 nValue )
133 OUString uPropName(C2U(SW_PROP_NAME_STR(nId)));
134 if(xInfo->hasPropertyByName(uPropName))
136 uno::Any aValue;
137 aValue <<= nValue;
138 xProps->setPropertyValue(uPropName, aValue);
142 void lcl_SetBOOLProp(
143 uno::Reference< beans::XPropertySetInfo > & xInfo,
144 uno::Reference< beans::XPropertySet > & xProps,
145 USHORT nId, sal_Bool bValue )
147 OUString uPropName(C2U(SW_PROP_NAME_STR(nId)));
148 if(xInfo->hasPropertyByName(uPropName))
150 uno::Any aValue;
151 aValue.setValue(&bValue, ::getCppuBooleanType());
152 xProps->setPropertyValue(uPropName, aValue);
155 //-----------------------------------------------------------------------------
156 IMPL_LINK( SwMultiTOXTabDialog, CreateExample_Hdl, void*, EMPTYARG )
160 uno::Reference< frame::XModel > & xModel = pExampleFrame->GetModel();
161 uno::Reference< lang::XUnoTunnel > xDocTunnel(xModel, uno::UNO_QUERY);
162 SwXTextDocument* pDoc = reinterpret_cast<SwXTextDocument*>(xDocTunnel->getSomething(SwXTextDocument::getUnoTunnelId()));
164 if( pDoc )
165 pDoc->GetDocShell()->_LoadStyles( *rSh.GetView().GetDocShell(), TRUE );
167 uno::Reference< lang::XMultiServiceFactory > xFact(
168 xModel, uno::UNO_QUERY);
170 uno::Reference< text::XTextSectionsSupplier > xSectionSupplier(
171 xModel, uno::UNO_QUERY);
172 uno::Reference< container::XNameAccess > xSections =
173 xSectionSupplier->getTextSections();
175 String sSectionName( INDEX_SECTION_NAME );
176 for(int i = 0; i < 7; ++i )
178 String sTmp( sSectionName ); sTmp += String::CreateFromInt32(i);
179 uno::Any aSection = xSections->getByName( sTmp );
180 aSection >>= pxIndexSectionsArr[i]->xContainerSection;
182 uno::Reference< text::XDocumentIndexesSupplier > xIdxSupp(xModel, uno::UNO_QUERY);
183 uno::Reference< container::XIndexAccess > xIdxs = xIdxSupp->getDocumentIndexes();
184 int n = xIdxs->getCount();
185 while(n)
187 n--;
188 uno::Any aIdx = xIdxs->getByIndex(n);
189 uno::Reference< text::XDocumentIndex > xIdx;
190 aIdx >>= xIdx;
191 xIdx->dispose();
193 CreateOrUpdateExample(eCurrentTOXType.eType);
195 catch(Exception&)
197 DBG_ERROR("::CreateExample() - exception caught");
199 return 0;
202 /* --------------------------------------------------
204 --------------------------------------------------*/
205 void SwMultiTOXTabDialog::CreateOrUpdateExample(
206 TOXTypes nTOXIndex, sal_uInt16 nPage, sal_uInt16 nCurrentLevel)
208 if(!pExampleFrame || !pExampleFrame->IsInitialized())
209 return;
211 const char* __FAR_DATA IndexServiceNames[] =
213 "com.sun.star.text.DocumentIndex",
214 "com.sun.star.text.UserIndex",
215 "com.sun.star.text.ContentIndex",
216 "com.sun.star.text.IllustrationsIndex",
217 "com.sun.star.text.ObjectIndex",
218 "com.sun.star.text.TableIndex",
219 "com.sun.star.text.Bibliography"
224 DBG_ASSERT(pxIndexSectionsArr[nTOXIndex] &&
225 pxIndexSectionsArr[nTOXIndex]->xContainerSection.is(),
226 "Section not created");
227 uno::Reference< frame::XModel > & xModel = pExampleFrame->GetModel();
228 sal_Bool bInitialCreate = sal_True;
229 if(!pxIndexSectionsArr[nTOXIndex]->xDocumentIndex.is())
231 bInitialCreate = sal_True;
232 if(!pxIndexSectionsArr[nTOXIndex]->xContainerSection.is())
233 throw uno::RuntimeException();
234 uno::Reference< text::XTextRange > xAnchor = pxIndexSectionsArr[nTOXIndex]->xContainerSection->getAnchor();
235 xAnchor = xAnchor->getStart();
236 uno::Reference< text::XTextCursor > xCrsr = xAnchor->getText()->createTextCursorByRange(xAnchor);
238 uno::Reference< lang::XMultiServiceFactory > xFact(xModel, uno::UNO_QUERY);
240 String sIndexTypeName;
241 sIndexTypeName.AssignAscii( IndexServiceNames[
242 nTOXIndex <= TOX_AUTHORITIES ? nTOXIndex : TOX_USER] );
243 pxIndexSectionsArr[nTOXIndex]->xDocumentIndex = uno::Reference< text::XDocumentIndex > (xFact->createInstance(
244 sIndexTypeName), uno::UNO_QUERY);
245 uno::Reference< text::XTextContent > xContent(pxIndexSectionsArr[nTOXIndex]->xDocumentIndex, uno::UNO_QUERY);
246 uno::Reference< text::XTextRange > xRg(xCrsr, uno::UNO_QUERY);
247 xCrsr->getText()->insertTextContent(xRg, xContent, sal_False);
249 OUString uIsVisible(C2U(SW_PROP_NAME_STR(UNO_NAME_IS_VISIBLE)));
250 for(sal_uInt16 i = 0 ; i <= TOX_AUTHORITIES; i++)
252 uno::Reference< beans::XPropertySet > xSectPr(pxIndexSectionsArr[i]->xContainerSection, uno::UNO_QUERY);
253 uno::Any aVal;
255 if(xSectPr.is())
257 BOOL bTemp = i == nTOXIndex;
258 aVal.setValue(&bTemp, ::getBooleanCppuType());
259 xSectPr->setPropertyValue(uIsVisible, aVal);
262 // set properties
263 uno::Reference< beans::XPropertySet > xIdxProps(pxIndexSectionsArr[nTOXIndex]->xDocumentIndex, uno::UNO_QUERY);
264 uno::Reference< beans::XPropertySetInfo > xInfo = xIdxProps->getPropertySetInfo();
265 SwTOXDescription& rDesc = GetTOXDescription(eCurrentTOXType);
266 sal_uInt16 nIdxOptions = rDesc.GetIndexOptions();
267 if(bInitialCreate || !nPage || nPage == TOX_PAGE_SELECT)
269 //title
270 if(rDesc.GetTitle())
271 lcl_SetProp(xInfo, xIdxProps, UNO_NAME_TITLE, *rDesc.GetTitle());
273 //stylenames
274 sal_uInt16 nContentOptions = rDesc.GetContentOptions();
275 if(xInfo->hasPropertyByName(C2U(SW_PROP_NAME_STR(UNO_NAME_LEVEL_PARAGRAPH_STYLES))))
277 sal_Bool bOn = 0!=(nContentOptions&nsSwTOXElement::TOX_TEMPLATE );
278 uno::Any aStyleNames(xIdxProps->getPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_LEVEL_PARAGRAPH_STYLES))));
279 uno::Reference< container::XIndexReplace > xAcc;
280 aStyleNames >>= xAcc;
282 for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
284 String sLevel;
285 if(bOn)
286 sLevel = rDesc.GetStyleNames(i);
287 sal_uInt16 nStyles = sLevel.GetTokenCount(TOX_STYLE_DELIMITER);
288 uno::Sequence<OUString> aStyles(nStyles);
289 OUString* pArr = aStyles.getArray();
290 for(sal_uInt16 nStyle = 0; nStyle < nStyles; nStyle++)
291 pArr[nStyle] = sLevel.GetToken(nStyle, TOX_STYLE_DELIMITER);
292 uno::Any aAny(&aStyles, ::getCppuType((uno::Sequence<OUString>*)0));
293 xAcc->replaceByIndex(i, aAny);
296 lcl_SetProp(xInfo, xIdxProps, UNO_NAME_LEVEL, (sal_Int16)rDesc.GetLevel());
297 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_MARKS, 0!=(nContentOptions&nsSwTOXElement::TOX_MARK ));
298 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_OUTLINE, 0!=(nContentOptions&nsSwTOXElement::TOX_OUTLINELEVEL));
299 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_EMBEDDED_OBJECTS,0!=(nContentOptions&nsSwTOXElement::TOX_OLE ));
300 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_TABLES , 0!=(nContentOptions&nsSwTOXElement::TOX_TABLE ));
301 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_GRAPHIC_OBJECTS, 0!=(nContentOptions&nsSwTOXElement::TOX_GRAPHIC ));
302 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_TEXT_FRAMES, 0!=(nContentOptions&nsSwTOXElement::TOX_FRAME ));
303 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_LABELS, 0!=(nContentOptions&nsSwTOXElement::TOX_SEQUENCE ));
305 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_CHAPTER, rDesc.IsFromChapter());
306 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_PROTECTED, rDesc.IsReadonly());
308 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_COMBINED_ENTRIES, 0 != (nIdxOptions&nsSwTOIOptions::TOI_SAME_ENTRY ));
309 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_P_P, 0 != (nIdxOptions&nsSwTOIOptions::TOI_FF ));
310 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_CASE_SENSITIVE, 0 != (nIdxOptions&nsSwTOIOptions::TOI_CASE_SENSITIVE ));
311 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_KEY_AS_ENTRY, 0 != (nIdxOptions&nsSwTOIOptions::TOI_KEY_AS_ENTRY ));
312 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_ALPHABETICAL_SEPARATORS, 0 != (nIdxOptions&nsSwTOIOptions::TOI_ALPHA_DELIMITTER));
313 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_DASH, 0 != (nIdxOptions&nsSwTOIOptions::TOI_DASH ));
314 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_UPPER_CASE, 0 != (nIdxOptions&nsSwTOIOptions::TOI_INITIAL_CAPS ));
316 String aTmpName( SwStyleNameMapper::GetSpecialExtraProgName( rDesc.GetSequenceName() ) );
317 lcl_SetProp(xInfo, xIdxProps, UNO_NAME_LABEL_CATEGORY, aTmpName );
318 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_LABELS, !rDesc.IsCreateFromObjectNames());
320 sal_Int16 nSet = text::ChapterFormat::NAME_NUMBER;
321 switch (rDesc.GetCaptionDisplay())
323 case CAPTION_COMPLETE: nSet = text::ChapterFormat::NAME_NUMBER;break;
324 case CAPTION_NUMBER : nSet = text::ChapterFormat::NUMBER; break;
325 case CAPTION_TEXT : nSet = text::ChapterFormat::NAME; break;
327 lcl_SetProp(xInfo, xIdxProps, UNO_NAME_LABEL_DISPLAY_TYPE, nSet);
329 sal_uInt16 nOLEOptions = rDesc.GetOLEOptions();
330 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_MATH, 0 != (nsSwTOOElements::TOO_MATH &nOLEOptions ));
331 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_CHART, 0 != (nsSwTOOElements::TOO_CHART &nOLEOptions ));
332 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_CALC, 0 != (nsSwTOOElements::TOO_CALC &nOLEOptions ));
333 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_DRAW, 0 != (nsSwTOOElements::TOO_DRAW_IMPRESS&nOLEOptions));
334 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_OTHER_EMBEDDED_OBJECTS, 0 != (nsSwTOOElements::TOO_OTHER|nOLEOptions ));
336 //lcl_SetBOOLProp(xInfo, xIdxProps, , rDesc.IsLevelFromChapter());
338 const SwForm* pForm = GetForm(eCurrentTOXType);
339 if(bInitialCreate || !nPage || nPage == TOX_PAGE_ENTRY)
341 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_COMMA_SEPARATED, pForm->IsCommaSeparated());
342 lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_ALPHABETICAL_SEPARATORS, 0 != (nIdxOptions&nsSwTOIOptions::TOI_ALPHA_DELIMITTER));
343 sal_uInt16 nStartLevel = USHRT_MAX;
344 sal_uInt16 nEndLevel = USHRT_MAX;
345 if(nCurrentLevel < pForm->GetFormMax())
346 nStartLevel = nEndLevel = nCurrentLevel;
347 else
349 nStartLevel = 0;
350 nEndLevel = pForm->GetFormMax() - 1;
353 if(xInfo->hasPropertyByName(C2U(SW_PROP_NAME_STR(UNO_NAME_LEVEL_FORMAT))))
355 for(sal_uInt16 nCurrLevel = nStartLevel; nCurrLevel <= nEndLevel; nCurrLevel++)
357 String sTokenType;
358 uno::Sequence< beans::PropertyValues> aSequPropVals(10);
359 long nTokenIndex = 0;
360 long nParamCount = 2;
362 // #i24377#
363 SwFormTokens aPattern = pForm->GetPattern(nCurrLevel);
364 SwFormTokens::iterator aIt = aPattern.begin();
366 while(aIt != aPattern.end())
368 if( aSequPropVals.getLength() <= nTokenIndex)
369 aSequPropVals.realloc(nTokenIndex + 10);
371 SwFormToken aToken = *aIt; // #i24377#
372 switch(aToken.eTokenType)
374 case TOKEN_ENTRY_NO :
375 sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
376 "TokenEntryNumber"));
377 // fuer Inhaltsverzeichnis Numerierung
378 break;
379 case TOKEN_ENTRY_TEXT :
380 case TOKEN_ENTRY :
381 sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
382 "TokenEntryText"));
383 break;
384 case TOKEN_TAB_STOP :
385 nParamCount += 3;
386 sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
387 "TokenTabStop"));
388 break;
389 case TOKEN_TEXT :
390 sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
391 "TokenText"));
392 nParamCount += 1;
393 break;
394 case TOKEN_PAGE_NUMS :
395 sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
396 "TokenPageNumber"));
397 break;
398 case TOKEN_CHAPTER_INFO :
399 sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
400 "TokenChapterInfo"));
401 break;
402 case TOKEN_LINK_START :
403 sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
404 "TokenHyperlinkStart"));
405 break;
406 case TOKEN_LINK_END :
407 sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
408 "TokenHyperlinkEnd"));
409 break;
410 case TOKEN_AUTHORITY :
412 sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
413 "TokenBibliographyDataField"));
415 break;
416 default:; //prevent warning
418 beans::PropertyValues aPropVals(nParamCount);
419 beans::PropertyValue* pPropValArr = aPropVals.getArray();
420 pPropValArr[0].Name = C2U("TokenType");
421 pPropValArr[0].Value <<= OUString(sTokenType);
422 pPropValArr[1].Name = C2U("CharacterStyleName");
423 pPropValArr[1].Value <<= OUString(aToken.sCharStyleName);
424 if(TOKEN_TAB_STOP == aToken.eTokenType)
426 pPropValArr[2].Name = C2U("TabStopRightAligned");
427 BOOL bTemp = SVX_TAB_ADJUST_END == aToken.eTabAlign;
428 pPropValArr[2].Value.setValue(&bTemp, ::getBooleanCppuType());
429 pPropValArr[3].Name = C2U("TabStopFillCharacter");
430 pPropValArr[3].Value <<= OUString(aToken.cTabFillChar);
431 pPropValArr[4].Name = C2U("TabStopPosition");
432 SwTwips nTempPos = aToken.nTabStopPosition >= 0 ?
433 aToken.nTabStopPosition : 0;
434 nTempPos = TWIP_TO_MM100(nTempPos);
435 pPropValArr[4].Value <<= (sal_Int32)nTempPos;
437 else if(TOKEN_TEXT == aToken.eTokenType)
439 pPropValArr[2].Name = C2U("Text");
440 pPropValArr[2].Value <<= OUString(aToken.sText);
442 beans::PropertyValues* pValues = aSequPropVals.getArray();
443 pValues[nTokenIndex] = aPropVals;
444 nTokenIndex++;
446 aIt++; // #i24377#
448 aSequPropVals.realloc(nTokenIndex);
450 uno::Any aFormatAccess = xIdxProps->getPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_LEVEL_FORMAT)));
451 DBG_ASSERT(aFormatAccess.getValueType() == ::getCppuType((uno::Reference<container::XIndexReplace>*)0),
452 "wrong property type");
455 uno::Reference< container::XIndexReplace > xFormatAccess;
456 aFormatAccess >>= xFormatAccess;
457 uno::Any aLevelProp(&aSequPropVals, ::getCppuType((uno::Sequence<beans::PropertyValues>*)0));
458 xFormatAccess->replaceByIndex(nCurrLevel, aLevelProp);
462 if(bInitialCreate || !nPage || nPage == TOX_PAGE_STYLES)
464 lcl_SetProp(xInfo, xIdxProps, "ParaStyleHeading", pForm->GetTemplate(0));
465 sal_uInt16 nOffset = 0;
466 sal_uInt16 nEndLevel = 2;
467 switch(eCurrentTOXType.eType)
469 case TOX_INDEX:
471 nOffset = 1;
472 nEndLevel = 4;
473 lcl_SetProp(xInfo, xIdxProps, "ParaStyleSeparator", pForm->GetTemplate(1));
475 break;
476 case TOX_CONTENT :
477 nEndLevel = 11;
478 break;
479 default:; //prevent warning
481 for(sal_uInt16 i = 1; i < nEndLevel; i++)
483 String sPropName(C2S("ParaStyleLevel"));
484 sPropName += String::CreateFromInt32( i );
485 lcl_SetProp(xInfo,
486 xIdxProps,
487 ByteString(sPropName, RTL_TEXTENCODING_ASCII_US).GetBuffer(),
488 pForm->GetTemplate(i + nOffset));
492 const String& GetAutoMarkURL() const { return sAutoMarkURL;}
493 const String& GetMainEntryCharStyle() const {return sMainEntryCharStyle;}
495 String GetAuthBrackets() const {return sAuthBrackets;}
496 sal_Bool IsAuthSequence() const {return bIsAuthSequence;}
497 sal_Bool IsSortByDocument()const {return bSortByDocument ;}
499 SwTOXSortKey GetSortKey1() const {return eSortKey1;}
500 SwTOXSortKey GetSortKey2() const {return eSortKey2;}
501 SwTOXSortKey GetSortKey3() const {return eSortKey3;}
504 pxIndexSectionsArr[nTOXIndex]->xDocumentIndex->update();
506 //#if OSL_DEBUG_LEVEL > 1
507 // uno::Reference< frame::XStorable > xStor(xModel, uno::UNO_QUERY);
508 // String sURL("file:///e|/temp/sw/idxexample.sdw");
509 // uno::Sequence< beans::PropertyValue > aArgs(0);
510 // xStor->storeToURL(S2U(sURL), aArgs);
511 //#endif
514 catch(Exception&)
516 DBG_ERROR("::CreateExample() - exception caught");