LCOV - code coverage report
Current view: top level - sw/source/ui/index - cntex.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 223 0.0 %
Date: 2014-04-11 Functions: 0 8 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10