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 <cnttab.hrc>
51 : #include <globals.hrc>
52 : #include <SwStyleNameMapper.hxx>
53 : #include <swuicnttab.hxx>
54 : #include <unomid.h>
55 :
56 :
57 : using namespace ::com::sun::star;
58 : using namespace ::com::sun::star::text;
59 : using namespace ::com::sun::star::beans;
60 : using namespace ::com::sun::star::container;
61 : using namespace ::com::sun::star::lang;
62 : using namespace ::com::sun::star::ucb;
63 : using namespace ::com::sun::star::uno;
64 : using namespace com::sun::star::ui::dialogs;
65 :
66 :
67 : #ifdef SW_PROP_NAME_STR
68 : #undef SW_PROP_NAME_STR
69 : #endif
70 : #define SW_PROP_NAME_STR(nId) SwGetPropName((nId)).pName
71 :
72 0 : static void lcl_SetProp( uno::Reference< XPropertySetInfo > & xInfo,
73 : uno::Reference< XPropertySet > & xProps,
74 : const char* pPropName, const String& rValue)
75 : {
76 0 : OUString uPropName(OUString::createFromAscii(pPropName));
77 0 : if(xInfo->hasPropertyByName(uPropName))
78 : {
79 0 : uno::Any aValue;
80 0 : aValue <<= OUString(rValue);
81 0 : xProps->setPropertyValue(uPropName, aValue);
82 0 : }
83 0 : }
84 :
85 0 : static void lcl_SetProp( uno::Reference< XPropertySetInfo > & xInfo,
86 : uno::Reference< XPropertySet > & xProps,
87 : sal_uInt16 nId, const String& rValue)
88 : {
89 0 : lcl_SetProp( xInfo, xProps, SW_PROP_NAME_STR(nId), rValue);
90 0 : }
91 :
92 0 : static void lcl_SetProp( uno::Reference< XPropertySetInfo > & xInfo,
93 : uno::Reference< XPropertySet > & xProps,
94 : sal_uInt16 nId, sal_Int16 nValue )
95 : {
96 0 : OUString uPropName(OUString::createFromAscii(SW_PROP_NAME_STR(nId)));
97 0 : if(xInfo->hasPropertyByName(uPropName))
98 : {
99 0 : uno::Any aValue;
100 0 : aValue <<= nValue;
101 0 : xProps->setPropertyValue(uPropName, aValue);
102 0 : }
103 0 : }
104 :
105 0 : static void lcl_SetBOOLProp(
106 : uno::Reference< beans::XPropertySetInfo > & xInfo,
107 : uno::Reference< beans::XPropertySet > & xProps,
108 : sal_uInt16 nId, sal_Bool bValue )
109 : {
110 0 : OUString uPropName(OUString::createFromAscii(SW_PROP_NAME_STR(nId)));
111 0 : if(xInfo->hasPropertyByName(uPropName))
112 : {
113 0 : uno::Any aValue;
114 0 : aValue.setValue(&bValue, ::getCppuBooleanType());
115 0 : xProps->setPropertyValue(uPropName, aValue);
116 0 : }
117 0 : }
118 :
119 0 : IMPL_LINK_NOARG(SwMultiTOXTabDialog, CreateExample_Hdl)
120 : {
121 : try
122 : {
123 0 : uno::Reference< frame::XModel > & xModel = pExampleFrame->GetModel();
124 0 : uno::Reference< lang::XUnoTunnel > xDocTunnel(xModel, uno::UNO_QUERY);
125 0 : SwXTextDocument* pDoc = reinterpret_cast<SwXTextDocument*>(xDocTunnel->getSomething(SwXTextDocument::getUnoTunnelId()));
126 :
127 0 : if( pDoc )
128 0 : pDoc->GetDocShell()->_LoadStyles( *rSh.GetView().GetDocShell(), sal_True );
129 :
130 : uno::Reference< lang::XMultiServiceFactory > xFact(
131 0 : xModel, uno::UNO_QUERY);
132 :
133 : uno::Reference< text::XTextSectionsSupplier > xSectionSupplier(
134 0 : xModel, uno::UNO_QUERY);
135 : uno::Reference< container::XNameAccess > xSections =
136 0 : xSectionSupplier->getTextSections();
137 :
138 0 : OUString sSectionName("IndexSection_");
139 0 : for(int i = 0; i < 7; ++i )
140 : {
141 0 : String sTmp( sSectionName ); sTmp += OUString::number(i);
142 0 : uno::Any aSection = xSections->getByName( sTmp );
143 0 : aSection >>= pxIndexSectionsArr[i]->xContainerSection;
144 0 : }
145 0 : uno::Reference< text::XDocumentIndexesSupplier > xIdxSupp(xModel, uno::UNO_QUERY);
146 0 : uno::Reference< container::XIndexAccess > xIdxs = xIdxSupp->getDocumentIndexes();
147 0 : int n = xIdxs->getCount();
148 0 : while(n)
149 : {
150 0 : n--;
151 0 : uno::Any aIdx = xIdxs->getByIndex(n);
152 0 : uno::Reference< text::XDocumentIndex > xIdx;
153 0 : aIdx >>= xIdx;
154 0 : xIdx->dispose();
155 0 : }
156 0 : CreateOrUpdateExample(eCurrentTOXType.eType);
157 : }
158 0 : catch (const Exception&)
159 : {
160 : OSL_FAIL("::CreateExample() - exception caught");
161 : }
162 0 : return 0;
163 : }
164 :
165 0 : void SwMultiTOXTabDialog::CreateOrUpdateExample(
166 : TOXTypes nTOXIndex, sal_uInt16 nPage, sal_uInt16 nCurrentLevel)
167 : {
168 0 : if(!pExampleFrame || !pExampleFrame->IsInitialized())
169 0 : return;
170 :
171 : const char* IndexServiceNames[] =
172 : {
173 : "com.sun.star.text.DocumentIndex",
174 : "com.sun.star.text.UserIndex",
175 : "com.sun.star.text.ContentIndex",
176 : "com.sun.star.text.IllustrationsIndex",
177 : "com.sun.star.text.ObjectIndex",
178 : "com.sun.star.text.TableIndex",
179 : "com.sun.star.text.Bibliography"
180 0 : };
181 :
182 : try
183 : {
184 : OSL_ENSURE(pxIndexSectionsArr[nTOXIndex] &&
185 : pxIndexSectionsArr[nTOXIndex]->xContainerSection.is(),
186 : "Section not created");
187 0 : uno::Reference< frame::XModel > & xModel = pExampleFrame->GetModel();
188 0 : sal_Bool bInitialCreate = sal_True;
189 0 : if(!pxIndexSectionsArr[nTOXIndex]->xDocumentIndex.is())
190 : {
191 0 : bInitialCreate = sal_True;
192 0 : if(!pxIndexSectionsArr[nTOXIndex]->xContainerSection.is())
193 0 : throw uno::RuntimeException();
194 0 : uno::Reference< text::XTextRange > xAnchor = pxIndexSectionsArr[nTOXIndex]->xContainerSection->getAnchor();
195 0 : xAnchor = xAnchor->getStart();
196 0 : uno::Reference< text::XTextCursor > xCrsr = xAnchor->getText()->createTextCursorByRange(xAnchor);
197 :
198 0 : uno::Reference< lang::XMultiServiceFactory > xFact(xModel, uno::UNO_QUERY);
199 :
200 0 : String sIndexTypeName;
201 : sIndexTypeName.AssignAscii( IndexServiceNames[
202 0 : nTOXIndex <= TOX_AUTHORITIES ? nTOXIndex : TOX_USER] );
203 0 : pxIndexSectionsArr[nTOXIndex]->xDocumentIndex = uno::Reference< text::XDocumentIndex > (xFact->createInstance(
204 0 : sIndexTypeName), uno::UNO_QUERY);
205 0 : uno::Reference< text::XTextContent > xContent(pxIndexSectionsArr[nTOXIndex]->xDocumentIndex, uno::UNO_QUERY);
206 0 : uno::Reference< text::XTextRange > xRg(xCrsr, uno::UNO_QUERY);
207 0 : xCrsr->getText()->insertTextContent(xRg, xContent, sal_False);
208 : }
209 0 : OUString uIsVisible(OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_IS_VISIBLE)));
210 0 : for(sal_uInt16 i = 0 ; i <= TOX_AUTHORITIES; i++)
211 : {
212 0 : uno::Reference< beans::XPropertySet > xSectPr(pxIndexSectionsArr[i]->xContainerSection, uno::UNO_QUERY);
213 0 : uno::Any aVal;
214 :
215 0 : if(xSectPr.is())
216 : {
217 0 : sal_Bool bTemp = i == nTOXIndex;
218 0 : aVal.setValue(&bTemp, ::getBooleanCppuType());
219 0 : xSectPr->setPropertyValue(uIsVisible, aVal);
220 : }
221 0 : }
222 : // set properties
223 0 : uno::Reference< beans::XPropertySet > xIdxProps(pxIndexSectionsArr[nTOXIndex]->xDocumentIndex, uno::UNO_QUERY);
224 0 : uno::Reference< beans::XPropertySetInfo > xInfo = xIdxProps->getPropertySetInfo();
225 0 : SwTOXDescription& rDesc = GetTOXDescription(eCurrentTOXType);
226 0 : sal_uInt16 nIdxOptions = rDesc.GetIndexOptions();
227 0 : if(bInitialCreate || !nPage || nPage == TOX_PAGE_SELECT)
228 : {
229 : //title
230 0 : if(rDesc.GetTitle())
231 0 : lcl_SetProp(xInfo, xIdxProps, UNO_NAME_TITLE, *rDesc.GetTitle());
232 :
233 : //stylenames
234 0 : sal_uInt16 nContentOptions = rDesc.GetContentOptions();
235 0 : if(xInfo->hasPropertyByName(OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_LEVEL_PARAGRAPH_STYLES))))
236 : {
237 0 : sal_Bool bOn = 0!=(nContentOptions&nsSwTOXElement::TOX_TEMPLATE );
238 0 : uno::Any aStyleNames(xIdxProps->getPropertyValue(OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_LEVEL_PARAGRAPH_STYLES))));
239 0 : uno::Reference< container::XIndexReplace > xAcc;
240 0 : aStyleNames >>= xAcc;
241 :
242 0 : for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
243 : {
244 0 : String sLevel;
245 0 : if(bOn)
246 0 : sLevel = rDesc.GetStyleNames(i);
247 0 : sal_uInt16 nStyles = comphelper::string::getTokenCount(sLevel, TOX_STYLE_DELIMITER);
248 0 : uno::Sequence<OUString> aStyles(nStyles);
249 0 : OUString* pArr = aStyles.getArray();
250 0 : for(sal_uInt16 nStyle = 0; nStyle < nStyles; nStyle++)
251 0 : pArr[nStyle] = sLevel.GetToken(nStyle, TOX_STYLE_DELIMITER);
252 0 : uno::Any aAny(&aStyles, ::getCppuType((uno::Sequence<OUString>*)0));
253 0 : xAcc->replaceByIndex(i, aAny);
254 0 : }
255 : }
256 0 : lcl_SetProp(xInfo, xIdxProps, UNO_NAME_LEVEL, (sal_Int16)rDesc.GetLevel());
257 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_MARKS, 0!=(nContentOptions&nsSwTOXElement::TOX_MARK ));
258 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_OUTLINE, 0!=(nContentOptions&nsSwTOXElement::TOX_OUTLINELEVEL));
259 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_EMBEDDED_OBJECTS,0!=(nContentOptions&nsSwTOXElement::TOX_OLE ));
260 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_TABLES , 0!=(nContentOptions&nsSwTOXElement::TOX_TABLE ));
261 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_GRAPHIC_OBJECTS, 0!=(nContentOptions&nsSwTOXElement::TOX_GRAPHIC ));
262 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_TEXT_FRAMES, 0!=(nContentOptions&nsSwTOXElement::TOX_FRAME ));
263 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_LABELS, 0!=(nContentOptions&nsSwTOXElement::TOX_SEQUENCE ));
264 :
265 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_CHAPTER, rDesc.IsFromChapter());
266 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_PROTECTED, rDesc.IsReadonly());
267 :
268 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_COMBINED_ENTRIES, 0 != (nIdxOptions&nsSwTOIOptions::TOI_SAME_ENTRY ));
269 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_P_P, 0 != (nIdxOptions&nsSwTOIOptions::TOI_FF ));
270 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_CASE_SENSITIVE, 0 != (nIdxOptions&nsSwTOIOptions::TOI_CASE_SENSITIVE ));
271 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_KEY_AS_ENTRY, 0 != (nIdxOptions&nsSwTOIOptions::TOI_KEY_AS_ENTRY ));
272 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_ALPHABETICAL_SEPARATORS, 0 != (nIdxOptions&nsSwTOIOptions::TOI_ALPHA_DELIMITTER));
273 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_DASH, 0 != (nIdxOptions&nsSwTOIOptions::TOI_DASH ));
274 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_UPPER_CASE, 0 != (nIdxOptions&nsSwTOIOptions::TOI_INITIAL_CAPS ));
275 :
276 0 : String aTmpName( SwStyleNameMapper::GetSpecialExtraProgName( rDesc.GetSequenceName() ) );
277 0 : lcl_SetProp(xInfo, xIdxProps, UNO_NAME_LABEL_CATEGORY, aTmpName );
278 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_LABELS, !rDesc.IsCreateFromObjectNames());
279 :
280 0 : sal_Int16 nSet = text::ChapterFormat::NAME_NUMBER;
281 0 : switch (rDesc.GetCaptionDisplay())
282 : {
283 0 : case CAPTION_COMPLETE: nSet = text::ChapterFormat::NAME_NUMBER;break;
284 0 : case CAPTION_NUMBER : nSet = text::ChapterFormat::NUMBER; break;
285 0 : case CAPTION_TEXT : nSet = text::ChapterFormat::NAME; break;
286 : }
287 0 : lcl_SetProp(xInfo, xIdxProps, UNO_NAME_LABEL_DISPLAY_TYPE, nSet);
288 :
289 0 : sal_uInt16 nOLEOptions = rDesc.GetOLEOptions();
290 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_MATH, 0 != (nsSwTOOElements::TOO_MATH &nOLEOptions ));
291 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_CHART, 0 != (nsSwTOOElements::TOO_CHART &nOLEOptions ));
292 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_CALC, 0 != (nsSwTOOElements::TOO_CALC &nOLEOptions ));
293 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_DRAW, 0 != (nsSwTOOElements::TOO_DRAW_IMPRESS&nOLEOptions));
294 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_OTHER_EMBEDDED_OBJECTS, 0 != (nsSwTOOElements::TOO_OTHER & nOLEOptions));
295 : }
296 0 : const SwForm* pForm = GetForm(eCurrentTOXType);
297 0 : if(bInitialCreate || !nPage || nPage == TOX_PAGE_ENTRY)
298 : {
299 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_COMMA_SEPARATED, pForm->IsCommaSeparated());
300 0 : lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_ALPHABETICAL_SEPARATORS, 0 != (nIdxOptions&nsSwTOIOptions::TOI_ALPHA_DELIMITTER));
301 0 : sal_uInt16 nStartLevel = USHRT_MAX;
302 0 : sal_uInt16 nEndLevel = USHRT_MAX;
303 0 : if(nCurrentLevel < pForm->GetFormMax())
304 0 : nStartLevel = nEndLevel = nCurrentLevel;
305 : else
306 : {
307 0 : nStartLevel = 0;
308 0 : nEndLevel = pForm->GetFormMax() - 1;
309 : }
310 :
311 0 : if(xInfo->hasPropertyByName(OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_LEVEL_FORMAT))))
312 : {
313 0 : for(sal_uInt16 nCurrLevel = nStartLevel; nCurrLevel <= nEndLevel; nCurrLevel++)
314 : {
315 0 : String sTokenType;
316 0 : uno::Sequence< beans::PropertyValues> aSequPropVals(10);
317 0 : long nTokenIndex = 0;
318 0 : long nParamCount = 2;
319 :
320 : // #i24377#
321 0 : SwFormTokens aPattern = pForm->GetPattern(nCurrLevel);
322 0 : SwFormTokens::iterator aIt = aPattern.begin();
323 :
324 0 : while(aIt != aPattern.end())
325 : {
326 0 : if( aSequPropVals.getLength() <= nTokenIndex)
327 0 : aSequPropVals.realloc(nTokenIndex + 10);
328 :
329 0 : SwFormToken aToken = *aIt; // #i24377#
330 0 : switch(aToken.eTokenType)
331 : {
332 : case TOKEN_ENTRY_NO :
333 : sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
334 0 : "TokenEntryNumber"));
335 : // numbering for content index
336 0 : break;
337 : case TOKEN_ENTRY_TEXT :
338 : case TOKEN_ENTRY :
339 : sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
340 0 : "TokenEntryText"));
341 0 : break;
342 : case TOKEN_TAB_STOP :
343 0 : nParamCount += 3;
344 : sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
345 0 : "TokenTabStop"));
346 0 : break;
347 : case TOKEN_TEXT :
348 : sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
349 0 : "TokenText"));
350 0 : nParamCount += 1;
351 0 : break;
352 : case TOKEN_PAGE_NUMS :
353 : sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
354 0 : "TokenPageNumber"));
355 0 : break;
356 : case TOKEN_CHAPTER_INFO :
357 : sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
358 0 : "TokenChapterInfo"));
359 0 : break;
360 : case TOKEN_LINK_START :
361 : sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
362 0 : "TokenHyperlinkStart"));
363 0 : break;
364 : case TOKEN_LINK_END :
365 : sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
366 0 : "TokenHyperlinkEnd"));
367 0 : break;
368 : case TOKEN_AUTHORITY :
369 : {
370 : sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
371 0 : "TokenBibliographyDataField"));
372 : }
373 0 : break;
374 : default:; //prevent warning
375 : }
376 0 : beans::PropertyValues aPropVals(nParamCount);
377 0 : beans::PropertyValue* pPropValArr = aPropVals.getArray();
378 0 : pPropValArr[0].Name = "TokenType";
379 0 : pPropValArr[0].Value <<= OUString(sTokenType);
380 0 : pPropValArr[1].Name = "CharacterStyleName";
381 0 : pPropValArr[1].Value <<= OUString(aToken.sCharStyleName);
382 0 : if(TOKEN_TAB_STOP == aToken.eTokenType)
383 : {
384 0 : pPropValArr[2].Name = "TabStopRightAligned";
385 0 : sal_Bool bTemp = SVX_TAB_ADJUST_END == aToken.eTabAlign;
386 0 : pPropValArr[2].Value.setValue(&bTemp, ::getBooleanCppuType());
387 0 : pPropValArr[3].Name = "TabStopFillCharacter";
388 0 : pPropValArr[3].Value <<= OUString(aToken.cTabFillChar);
389 0 : pPropValArr[4].Name = "TabStopPosition";
390 : SwTwips nTempPos = aToken.nTabStopPosition >= 0 ?
391 0 : aToken.nTabStopPosition : 0;
392 0 : nTempPos = TWIP_TO_MM100(nTempPos);
393 0 : pPropValArr[4].Value <<= (sal_Int32)nTempPos;
394 : }
395 0 : else if(TOKEN_TEXT == aToken.eTokenType)
396 : {
397 0 : pPropValArr[2].Name = "Text";
398 0 : pPropValArr[2].Value <<= OUString(aToken.sText);
399 : }
400 0 : beans::PropertyValues* pValues = aSequPropVals.getArray();
401 0 : pValues[nTokenIndex] = aPropVals;
402 0 : nTokenIndex++;
403 :
404 0 : ++aIt; // #i24377#
405 0 : }
406 0 : aSequPropVals.realloc(nTokenIndex);
407 :
408 0 : uno::Any aFormatAccess = xIdxProps->getPropertyValue(OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_LEVEL_FORMAT)));
409 : OSL_ENSURE(aFormatAccess.getValueType() == ::getCppuType((uno::Reference<container::XIndexReplace>*)0),
410 : "wrong property type");
411 :
412 :
413 0 : uno::Reference< container::XIndexReplace > xFormatAccess;
414 0 : aFormatAccess >>= xFormatAccess;
415 0 : uno::Any aLevelProp(&aSequPropVals, ::getCppuType((uno::Sequence<beans::PropertyValues>*)0));
416 0 : xFormatAccess->replaceByIndex(nCurrLevel, aLevelProp);
417 0 : }
418 : }
419 : }
420 0 : if(bInitialCreate || !nPage || nPage == TOX_PAGE_STYLES)
421 : {
422 0 : lcl_SetProp(xInfo, xIdxProps, "ParaStyleHeading", pForm->GetTemplate(0));
423 0 : sal_uInt16 nOffset = 0;
424 0 : sal_uInt16 nEndLevel = 2;
425 0 : switch(eCurrentTOXType.eType)
426 : {
427 : case TOX_INDEX:
428 : {
429 0 : nOffset = 1;
430 0 : nEndLevel = 4;
431 0 : lcl_SetProp(xInfo, xIdxProps, "ParaStyleSeparator", pForm->GetTemplate(1));
432 : }
433 0 : break;
434 : case TOX_CONTENT :
435 0 : nEndLevel = 11;
436 0 : break;
437 : default:; //prevent warning
438 : }
439 0 : for(sal_uInt16 i = 1; i < nEndLevel; i++)
440 : {
441 0 : String sPropName(OUString("ParaStyleLevel"));
442 0 : sPropName += OUString::number( i );
443 : lcl_SetProp(xInfo,
444 : xIdxProps,
445 : OUStringToOString(sPropName, RTL_TEXTENCODING_ASCII_US).getStr(),
446 0 : pForm->GetTemplate(i + nOffset));
447 0 : }
448 : }
449 0 : pxIndexSectionsArr[nTOXIndex]->xDocumentIndex->update();
450 :
451 : }
452 0 : catch (const Exception&)
453 : {
454 : OSL_FAIL("::CreateExample() - exception caught");
455 : }
456 0 : }
457 :
458 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|