Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <rsc/rscsfx.hxx>
21 : #include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
22 : #include <com/sun/star/text/XTextSectionsSupplier.hpp>
23 : #include <com/sun/star/style/BreakType.hpp>
24 : #include <com/sun/star/text/XTextFieldsSupplier.hpp>
25 : #include <com/sun/star/text/XDependentTextField.hpp>
26 : #include <com/sun/star/text/XParagraphCursor.hpp>
27 : #include <com/sun/star/text/XDocumentIndex.hpp>
28 : #include <com/sun/star/text/ChapterFormat.hpp>
29 : #include <com/sun/star/text/XTextSection.hpp>
30 : #include <com/sun/star/text/ControlCharacter.hpp>
31 : #include <com/sun/star/beans/PropertyValues.hpp>
32 : #include <com/sun/star/text/TextContentAnchorType.hpp>
33 : #include <com/sun/star/ucb/XCommandEnvironment.hpp>
34 : #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
35 : #include <com/sun/star/ui/dialogs/XFilterManager.hpp>
36 : #include <comphelper/string.hxx>
37 : #include <wrtsh.hxx>
38 : #include <view.hxx>
39 : #include <cnttab.hxx>
40 : #include <poolfmt.hxx>
41 : #include <unoprnms.hxx>
42 : #include <unotools.hxx>
43 : #include <unotxdoc.hxx>
44 : #include <docsh.hxx>
45 : #include <swmodule.hxx>
46 :
47 : #include <cmdid.h>
48 : #include <utlui.hrc>
49 : #include <index.hrc>
50 : #include <globals.hrc>
51 : #include <SwStyleNameMapper.hxx>
52 : #include <swuicnttab.hxx>
53 : #include <unomid.h>
54 :
55 : using namespace ::com::sun::star;
56 : using namespace ::com::sun::star::text;
57 : using namespace ::com::sun::star::beans;
58 : using namespace ::com::sun::star::container;
59 : using namespace ::com::sun::star::lang;
60 : using namespace ::com::sun::star::ucb;
61 : using namespace ::com::sun::star::uno;
62 : using namespace com::sun::star::ui::dialogs;
63 :
64 0 : static void lcl_SetProp( uno::Reference< XPropertySetInfo > & xInfo,
65 : uno::Reference< XPropertySet > & xProps,
66 : OUString const & aPropName, const OUString& rValue)
67 : {
68 0 : if(xInfo->hasPropertyByName(aPropName))
69 : {
70 0 : uno::Any aValue;
71 0 : aValue <<= OUString(rValue);
72 0 : xProps->setPropertyValue(aPropName, aValue);
73 : }
74 0 : }
75 :
76 0 : static void lcl_SetProp( uno::Reference< XPropertySetInfo > & xInfo,
77 : uno::Reference< XPropertySet > & xProps,
78 : OUString const & aPropName, sal_Int16 nValue )
79 : {
80 0 : if(xInfo->hasPropertyByName(aPropName))
81 : {
82 0 : uno::Any aValue;
83 0 : aValue <<= nValue;
84 0 : xProps->setPropertyValue(aPropName, aValue);
85 : }
86 0 : }
87 :
88 0 : static void lcl_SetBOOLProp(
89 : uno::Reference< beans::XPropertySetInfo > & xInfo,
90 : uno::Reference< beans::XPropertySet > & xProps,
91 : OUString const & aPropName, bool bValue )
92 : {
93 0 : if(xInfo->hasPropertyByName(aPropName))
94 : {
95 0 : xProps->setPropertyValue(aPropName, makeAny(bValue));
96 : }
97 0 : }
98 :
99 0 : IMPL_LINK_NOARG(SwMultiTOXTabDialog, CreateExample_Hdl)
100 : {
101 : try
102 : {
103 0 : uno::Reference< frame::XModel > & xModel = pExampleFrame->GetModel();
104 0 : uno::Reference< lang::XUnoTunnel > xDocTunnel(xModel, uno::UNO_QUERY);
105 0 : SwXTextDocument* pDoc = reinterpret_cast<SwXTextDocument*>(xDocTunnel->getSomething(SwXTextDocument::getUnoTunnelId()));
106 :
107 0 : if( pDoc )
108 0 : pDoc->GetDocShell()->_LoadStyles( *rSh.GetView().GetDocShell(), true );
109 :
110 : uno::Reference< lang::XMultiServiceFactory > xFact(
111 0 : xModel, uno::UNO_QUERY);
112 :
113 : uno::Reference< text::XTextSectionsSupplier > xSectionSupplier(
114 0 : xModel, uno::UNO_QUERY);
115 : uno::Reference< container::XNameAccess > xSections =
116 0 : xSectionSupplier->getTextSections();
117 :
118 0 : OUString sSectionName("IndexSection_");
119 0 : for(int i = 0; i < 7; ++i )
120 : {
121 0 : OUString sTmp( sSectionName ); sTmp += OUString::number(i);
122 0 : uno::Any aSection = xSections->getByName( sTmp );
123 0 : aSection >>= pxIndexSectionsArr[i]->xContainerSection;
124 0 : }
125 0 : uno::Reference< text::XDocumentIndexesSupplier > xIdxSupp(xModel, uno::UNO_QUERY);
126 0 : uno::Reference< container::XIndexAccess > xIdxs = xIdxSupp->getDocumentIndexes();
127 0 : int n = xIdxs->getCount();
128 0 : while(n)
129 : {
130 0 : n--;
131 0 : uno::Any aIdx = xIdxs->getByIndex(n);
132 0 : uno::Reference< text::XDocumentIndex > xIdx;
133 0 : aIdx >>= xIdx;
134 0 : xIdx->dispose();
135 0 : }
136 0 : CreateOrUpdateExample(eCurrentTOXType.eType);
137 : }
138 0 : catch (const Exception&)
139 : {
140 : OSL_FAIL("::CreateExample() - exception caught");
141 : }
142 0 : return 0;
143 : }
144 :
145 0 : void SwMultiTOXTabDialog::CreateOrUpdateExample(
146 : TOXTypes nTOXIndex, sal_uInt16 nPage, sal_uInt16 nCurrentLevel)
147 : {
148 0 : if(!pExampleFrame || !pExampleFrame->IsInitialized())
149 0 : return;
150 :
151 : const char* IndexServiceNames[] =
152 : {
153 : "com.sun.star.text.DocumentIndex",
154 : "com.sun.star.text.UserIndex",
155 : "com.sun.star.text.ContentIndex",
156 : "com.sun.star.text.IllustrationsIndex",
157 : "com.sun.star.text.ObjectIndex",
158 : "com.sun.star.text.TableIndex",
159 : "com.sun.star.text.Bibliography"
160 0 : };
161 :
162 : try
163 : {
164 : OSL_ENSURE(pxIndexSectionsArr[nTOXIndex] &&
165 : pxIndexSectionsArr[nTOXIndex]->xContainerSection.is(),
166 : "Section not created");
167 0 : uno::Reference< frame::XModel > & xModel = pExampleFrame->GetModel();
168 0 : bool bInitialCreate = true;
169 0 : if(!pxIndexSectionsArr[nTOXIndex]->xDocumentIndex.is())
170 : {
171 0 : bInitialCreate = true;
172 0 : if(!pxIndexSectionsArr[nTOXIndex]->xContainerSection.is())
173 0 : throw uno::RuntimeException();
174 0 : uno::Reference< text::XTextRange > xAnchor = pxIndexSectionsArr[nTOXIndex]->xContainerSection->getAnchor();
175 0 : xAnchor = xAnchor->getStart();
176 0 : uno::Reference< text::XTextCursor > xCrsr = xAnchor->getText()->createTextCursorByRange(xAnchor);
177 :
178 0 : uno::Reference< lang::XMultiServiceFactory > xFact(xModel, uno::UNO_QUERY);
179 :
180 : OUString sIndexTypeName(OUString::createFromAscii( IndexServiceNames[
181 0 : nTOXIndex <= TOX_AUTHORITIES ? nTOXIndex : TOX_USER] ));
182 0 : pxIndexSectionsArr[nTOXIndex]->xDocumentIndex = uno::Reference< text::XDocumentIndex > (xFact->createInstance(
183 0 : sIndexTypeName), uno::UNO_QUERY);
184 0 : uno::Reference< text::XTextContent > xContent(pxIndexSectionsArr[nTOXIndex]->xDocumentIndex, uno::UNO_QUERY);
185 0 : uno::Reference< text::XTextRange > xRg(xCrsr, uno::UNO_QUERY);
186 0 : xCrsr->getText()->insertTextContent(xRg, xContent, sal_False);
187 : }
188 0 : for(sal_uInt16 i = 0 ; i <= TOX_AUTHORITIES; i++)
189 : {
190 0 : uno::Reference< beans::XPropertySet > xSectPr(pxIndexSectionsArr[i]->xContainerSection, uno::UNO_QUERY);
191 0 : if(xSectPr.is())
192 : {
193 0 : xSectPr->setPropertyValue(UNO_NAME_IS_VISIBLE, makeAny(i == nTOXIndex));
194 : }
195 0 : }
196 : // set properties
197 0 : uno::Reference< beans::XPropertySet > xIdxProps(pxIndexSectionsArr[nTOXIndex]->xDocumentIndex, uno::UNO_QUERY);
198 0 : uno::Reference< beans::XPropertySetInfo > xInfo = xIdxProps->getPropertySetInfo();
199 0 : SwTOXDescription& rDesc = GetTOXDescription(eCurrentTOXType);
200 0 : sal_uInt16 nIdxOptions = rDesc.GetIndexOptions();
201 0 : if(bInitialCreate || !nPage || nPage == TOX_PAGE_SELECT)
202 : {
203 : //title
204 0 : if(rDesc.GetTitle())
205 0 : lcl_SetProp(xInfo, xIdxProps, UNO_NAME_TITLE, *rDesc.GetTitle());
206 :
207 : //stylenames
208 0 : sal_uInt16 nContentOptions = rDesc.GetContentOptions();
209 0 : if(xInfo->hasPropertyByName(UNO_NAME_LEVEL_PARAGRAPH_STYLES))
210 : {
211 0 : bool bOn = 0!=(nContentOptions&nsSwTOXElement::TOX_TEMPLATE );
212 0 : uno::Any aStyleNames(xIdxProps->getPropertyValue(UNO_NAME_LEVEL_PARAGRAPH_STYLES));
213 0 : uno::Reference< container::XIndexReplace > xAcc;
214 0 : aStyleNames >>= xAcc;
215 :
216 0 : for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
217 : {
218 0 : OUString sLevel;
219 0 : if(bOn)
220 0 : sLevel = rDesc.GetStyleNames(i);
221 : const sal_Int32 nStyles =
222 0 : comphelper::string::getTokenCount(sLevel, TOX_STYLE_DELIMITER);
223 0 : uno::Sequence<OUString> aStyles(nStyles);
224 0 : OUString* pArr = aStyles.getArray();
225 0 : for(sal_Int32 nStyle = 0; nStyle < nStyles; nStyle++)
226 0 : pArr[nStyle] = sLevel.getToken(nStyle, TOX_STYLE_DELIMITER);
227 0 : uno::Any aAny(&aStyles, cppu::UnoType<uno::Sequence<OUString>>::get());
228 0 : xAcc->replaceByIndex(i, aAny);
229 0 : }
230 : }
231 0 : lcl_SetProp(xInfo, xIdxProps, UNO_NAME_LEVEL, (sal_Int16)rDesc.GetLevel());
232 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_MARKS, 0!=(nContentOptions&nsSwTOXElement::TOX_MARK ));
233 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_OUTLINE, 0!=(nContentOptions&nsSwTOXElement::TOX_OUTLINELEVEL));
234 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_EMBEDDED_OBJECTS,0!=(nContentOptions&nsSwTOXElement::TOX_OLE ));
235 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_TABLES , 0!=(nContentOptions&nsSwTOXElement::TOX_TABLE ));
236 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_GRAPHIC_OBJECTS, 0!=(nContentOptions&nsSwTOXElement::TOX_GRAPHIC ));
237 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_TEXT_FRAMES, 0!=(nContentOptions&nsSwTOXElement::TOX_FRAME ));
238 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_LABELS, 0!=(nContentOptions&nsSwTOXElement::TOX_SEQUENCE ));
239 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_HIDE_TAB_LEADER_AND_PAGE_NUMBERS, 0!=(nContentOptions&nsSwTOXElement::TOX_TABLEADER ));
240 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_TAB_IN_TOC, 0!=(nContentOptions&nsSwTOXElement::TOX_TAB_IN_TOC ));
241 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_TOC_NEWLINE, 0!=(nContentOptions&nsSwTOXElement::TOX_NEWLINE));
242 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_TOC_PARAGRAPH_OUTLINE_LEVEL, 0!=(nContentOptions&nsSwTOXElement::TOX_PARAGRAPH_OUTLINE_LEVEL));
243 :
244 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_CHAPTER, rDesc.IsFromChapter());
245 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_PROTECTED, rDesc.IsReadonly());
246 :
247 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_COMBINED_ENTRIES, 0 != (nIdxOptions&nsSwTOIOptions::TOI_SAME_ENTRY ));
248 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_P_P, 0 != (nIdxOptions&nsSwTOIOptions::TOI_FF ));
249 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_CASE_SENSITIVE, 0 != (nIdxOptions&nsSwTOIOptions::TOI_CASE_SENSITIVE ));
250 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_KEY_AS_ENTRY, 0 != (nIdxOptions&nsSwTOIOptions::TOI_KEY_AS_ENTRY ));
251 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_ALPHABETICAL_SEPARATORS, 0 != (nIdxOptions&nsSwTOIOptions::TOI_ALPHA_DELIMITTER));
252 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_DASH, 0 != (nIdxOptions&nsSwTOIOptions::TOI_DASH ));
253 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_UPPER_CASE, 0 != (nIdxOptions&nsSwTOIOptions::TOI_INITIAL_CAPS ));
254 :
255 0 : OUString aTmpName( SwStyleNameMapper::GetSpecialExtraProgName( rDesc.GetSequenceName() ) );
256 0 : lcl_SetProp(xInfo, xIdxProps, UNO_NAME_LABEL_CATEGORY, aTmpName );
257 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_LABELS, !rDesc.IsCreateFromObjectNames());
258 :
259 0 : sal_Int16 nSet = text::ChapterFormat::NAME_NUMBER;
260 0 : switch (rDesc.GetCaptionDisplay())
261 : {
262 0 : case CAPTION_COMPLETE: nSet = text::ChapterFormat::NAME_NUMBER;break;
263 0 : case CAPTION_NUMBER : nSet = text::ChapterFormat::NUMBER; break;
264 0 : case CAPTION_TEXT : nSet = text::ChapterFormat::NAME; break;
265 : }
266 0 : lcl_SetProp(xInfo, xIdxProps, UNO_NAME_LABEL_DISPLAY_TYPE, nSet);
267 :
268 0 : sal_uInt16 nOLEOptions = rDesc.GetOLEOptions();
269 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_MATH, 0 != (nsSwTOOElements::TOO_MATH &nOLEOptions ));
270 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_CHART, 0 != (nsSwTOOElements::TOO_CHART &nOLEOptions ));
271 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_CALC, 0 != (nsSwTOOElements::TOO_CALC &nOLEOptions ));
272 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_DRAW, 0 != (nsSwTOOElements::TOO_DRAW_IMPRESS&nOLEOptions));
273 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_OTHER_EMBEDDED_OBJECTS, 0 != (nsSwTOOElements::TOO_OTHER & nOLEOptions));
274 : }
275 0 : const SwForm* pForm = GetForm(eCurrentTOXType);
276 0 : if(bInitialCreate || !nPage || nPage == TOX_PAGE_ENTRY)
277 : {
278 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_COMMA_SEPARATED, pForm->IsCommaSeparated());
279 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_ALPHABETICAL_SEPARATORS, 0 != (nIdxOptions&nsSwTOIOptions::TOI_ALPHA_DELIMITTER));
280 0 : const bool bUseCurrent = nCurrentLevel < pForm->GetFormMax();
281 0 : const sal_uInt16 nStartLevel = bUseCurrent ? nCurrentLevel : 0;
282 0 : const sal_uInt16 nEndLevel = bUseCurrent ? nCurrentLevel : pForm->GetFormMax() - 1;
283 0 : if(xInfo->hasPropertyByName(UNO_NAME_LEVEL_FORMAT))
284 : {
285 0 : for(sal_uInt16 nCurrLevel = nStartLevel; nCurrLevel <= nEndLevel; nCurrLevel++)
286 : {
287 0 : OUString sTokenType;
288 0 : uno::Sequence< beans::PropertyValues> aSequPropVals(10);
289 0 : long nTokenIndex = 0;
290 0 : long nParamCount = 2;
291 :
292 : // #i24377#
293 0 : SwFormTokens aPattern = pForm->GetPattern(nCurrLevel);
294 0 : SwFormTokens::iterator aIt = aPattern.begin();
295 :
296 0 : while(aIt != aPattern.end())
297 : {
298 0 : if( aSequPropVals.getLength() <= nTokenIndex)
299 0 : aSequPropVals.realloc(nTokenIndex + 10);
300 :
301 0 : SwFormToken aToken = *aIt; // #i24377#
302 0 : switch(aToken.eTokenType)
303 : {
304 : case TOKEN_ENTRY_NO :
305 0 : sTokenType = "TokenEntryNumber";
306 : // numbering for content index
307 0 : break;
308 : case TOKEN_ENTRY_TEXT :
309 : case TOKEN_ENTRY :
310 0 : sTokenType = "TokenEntryText";
311 0 : break;
312 : case TOKEN_TAB_STOP :
313 0 : nParamCount += 3;
314 0 : sTokenType = "TokenTabStop";
315 0 : break;
316 : case TOKEN_TEXT :
317 0 : sTokenType = "TokenText";
318 0 : nParamCount += 1;
319 0 : break;
320 : case TOKEN_PAGE_NUMS :
321 0 : sTokenType = "TokenPageNumber";
322 0 : break;
323 : case TOKEN_CHAPTER_INFO :
324 0 : sTokenType = "TokenChapterInfo";
325 0 : break;
326 : case TOKEN_LINK_START :
327 0 : sTokenType = "TokenHyperlinkStart";
328 0 : break;
329 : case TOKEN_LINK_END :
330 0 : sTokenType = "TokenHyperlinkEnd";
331 0 : break;
332 : case TOKEN_AUTHORITY :
333 : {
334 0 : sTokenType = "TokenBibliographyDataField";
335 : }
336 0 : break;
337 : default:; //prevent warning
338 : }
339 0 : beans::PropertyValues aPropVals(nParamCount);
340 0 : beans::PropertyValue* pPropValArr = aPropVals.getArray();
341 0 : pPropValArr[0].Name = "TokenType";
342 0 : pPropValArr[0].Value <<= sTokenType;
343 0 : pPropValArr[1].Name = "CharacterStyleName";
344 0 : pPropValArr[1].Value <<= OUString(aToken.sCharStyleName);
345 0 : if(TOKEN_TAB_STOP == aToken.eTokenType)
346 : {
347 0 : pPropValArr[2].Name = "TabStopRightAligned";
348 0 : pPropValArr[2].Value <<= SVX_TAB_ADJUST_END == aToken.eTabAlign;
349 0 : pPropValArr[3].Name = "TabStopFillCharacter";
350 0 : pPropValArr[3].Value <<= OUString(aToken.cTabFillChar);
351 0 : pPropValArr[4].Name = "TabStopPosition";
352 : SwTwips nTempPos = aToken.nTabStopPosition >= 0 ?
353 0 : aToken.nTabStopPosition : 0;
354 0 : nTempPos = convertTwipToMm100(nTempPos);
355 0 : pPropValArr[4].Value <<= (sal_Int32)nTempPos;
356 : }
357 0 : else if(TOKEN_TEXT == aToken.eTokenType)
358 : {
359 0 : pPropValArr[2].Name = "Text";
360 0 : pPropValArr[2].Value <<= OUString(aToken.sText);
361 : }
362 0 : beans::PropertyValues* pValues = aSequPropVals.getArray();
363 0 : pValues[nTokenIndex] = aPropVals;
364 0 : nTokenIndex++;
365 :
366 0 : ++aIt; // #i24377#
367 0 : }
368 0 : aSequPropVals.realloc(nTokenIndex);
369 :
370 0 : uno::Any aFormatAccess = xIdxProps->getPropertyValue(UNO_NAME_LEVEL_FORMAT);
371 : OSL_ENSURE(aFormatAccess.getValueType() == cppu::UnoType<container::XIndexReplace>::get(),
372 : "wrong property type");
373 :
374 0 : uno::Reference< container::XIndexReplace > xFormatAccess;
375 0 : aFormatAccess >>= xFormatAccess;
376 0 : uno::Any aLevelProp(&aSequPropVals, cppu::UnoType<uno::Sequence<beans::PropertyValues>>::get());
377 0 : xFormatAccess->replaceByIndex(nCurrLevel, aLevelProp);
378 0 : }
379 : }
380 : }
381 0 : if(bInitialCreate || !nPage || nPage == TOX_PAGE_STYLES)
382 : {
383 0 : lcl_SetProp(xInfo, xIdxProps, "ParaStyleHeading", pForm->GetTemplate(0));
384 0 : sal_uInt16 nOffset = 0;
385 0 : sal_uInt16 nEndLevel = 2;
386 0 : switch(eCurrentTOXType.eType)
387 : {
388 : case TOX_INDEX:
389 : {
390 0 : nOffset = 1;
391 0 : nEndLevel = 4;
392 0 : lcl_SetProp(xInfo, xIdxProps, "ParaStyleSeparator", pForm->GetTemplate(1));
393 : }
394 0 : break;
395 : case TOX_CONTENT :
396 0 : nEndLevel = 11;
397 0 : break;
398 : default:; //prevent warning
399 : }
400 0 : for(sal_uInt16 i = 1; i < nEndLevel; i++)
401 : {
402 : lcl_SetProp(xInfo,
403 : xIdxProps,
404 0 : "ParaStyleLevel" + OUString::number( i ),
405 0 : pForm->GetTemplate(i + nOffset));
406 : }
407 : }
408 0 : pxIndexSectionsArr[nTOXIndex]->xDocumentIndex->update();
409 :
410 : }
411 0 : catch (const Exception&)
412 : {
413 : OSL_FAIL("::CreateExample() - exception caught");
414 : }
415 0 : }
416 :
417 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|