LCOV - code coverage report
Current view: top level - writerfilter/source/dmapper - DomainMapper.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1590 1796 88.5 %
Date: 2015-06-13 12:38:46 Functions: 56 59 94.9 %
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             : #include "PageBordersHandler.hxx"
      20             : 
      21             : #include "util.hxx"
      22             : #include <SdtHelper.hxx>
      23             : #include <TDefTableHandler.hxx>
      24             : #include <DomainMapper_Impl.hxx>
      25             : #include <ConversionHelper.hxx>
      26             : #include <ModelEventListener.hxx>
      27             : #include <MeasureHandler.hxx>
      28             : #include <i18nlangtag/languagetag.hxx>
      29             : #include <i18nutil/paper.hxx>
      30             : #include <oox/token/tokens.hxx>
      31             : #include <oox/drawingml/drawingmltypes.hxx>
      32             : #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
      33             : #include <com/sun/star/document/XOOXMLDocumentPropertiesImporter.hpp>
      34             : #include <com/sun/star/table/ShadowFormat.hpp>
      35             : #include <com/sun/star/text/HoriOrientation.hpp>
      36             : #include <com/sun/star/text/RelOrientation.hpp>
      37             : #include <com/sun/star/text/VertOrientation.hpp>
      38             : #include <com/sun/star/text/WrapTextMode.hpp>
      39             : #include <com/sun/star/text/SizeType.hpp>
      40             : #include <com/sun/star/text/XEndnotesSupplier.hpp>
      41             : #include <com/sun/star/text/XFootnotesSupplier.hpp>
      42             : #include <com/sun/star/text/XLineNumberingProperties.hpp>
      43             : #include <com/sun/star/awt/FontRelief.hpp>
      44             : #include <com/sun/star/awt/FontWeight.hpp>
      45             : #include <com/sun/star/awt/FontUnderline.hpp>
      46             : #include <com/sun/star/awt/FontStrikeout.hpp>
      47             : #include <com/sun/star/awt/FontSlant.hpp>
      48             : #include <com/sun/star/document/XEventBroadcaster.hpp>
      49             : #include <com/sun/star/style/ParagraphAdjust.hpp>
      50             : #include <com/sun/star/style/BreakType.hpp>
      51             : #include <com/sun/star/style/CaseMap.hpp>
      52             : #include <com/sun/star/style/LineSpacing.hpp>
      53             : #include <com/sun/star/style/LineSpacingMode.hpp>
      54             : #include <com/sun/star/text/FootnoteNumbering.hpp>
      55             : #include <com/sun/star/text/TextGridMode.hpp>
      56             : #include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
      57             : #include <com/sun/star/text/XTextFieldsSupplier.hpp>
      58             : #include <com/sun/star/text/WritingMode.hpp>
      59             : #include <com/sun/star/text/WritingMode2.hpp>
      60             : #include <com/sun/star/text/XFootnote.hpp>
      61             : #include <com/sun/star/text/XTextColumns.hpp>
      62             : #include <com/sun/star/uno/XComponentContext.hpp>
      63             : #include <com/sun/star/text/FontEmphasis.hpp>
      64             : #include <comphelper/types.hxx>
      65             : #include <comphelper/storagehelper.hxx>
      66             : #include <comphelper/sequence.hxx>
      67             : #include <filter/msfilter/util.hxx>
      68             : #include <unotools/mediadescriptor.hxx>
      69             : 
      70             : #include <TextEffectsHandler.hxx>
      71             : #include <CellColorHandler.hxx>
      72             : #include <SectionColumnHandler.hxx>
      73             : #include <GraphicHelpers.hxx>
      74             : #include <dmapper/GraphicZOrderHelper.hxx>
      75             : 
      76             : using namespace ::com::sun::star;
      77             : using namespace oox;
      78             : 
      79             : namespace writerfilter {
      80             : 
      81             : namespace dmapper{
      82             : 
      83             : struct _PageSz
      84             : {
      85             :     sal_Int32 code;
      86             :     sal_Int32 h;
      87             :     bool      orient;
      88             :     sal_Int32 w;
      89             : } CT_PageSz;
      90             : 
      91             : 
      92        1985 : DomainMapper::DomainMapper( const uno::Reference< uno::XComponentContext >& xContext,
      93             :                             uno::Reference<io::XInputStream> const& xInputStream,
      94             :                             uno::Reference<lang::XComponent> const& xModel,
      95             :                             bool bRepairStorage,
      96             :                             SourceDocumentType eDocumentType,
      97             :                             uno::Reference<text::XTextRange> const& xInsertTextRange,
      98             :                             utl::MediaDescriptor& rMediaDesc) :
      99             :     LoggedProperties("DomainMapper"),
     100             :     LoggedTable("DomainMapper"),
     101             :     LoggedStream("DomainMapper"),
     102        5955 :     m_pImpl( new DomainMapper_Impl( *this, xContext, xModel, eDocumentType, xInsertTextRange, !rMediaDesc.getUnpackedValueOrDefault("InsertMode", false))),
     103        7938 :     mbIsSplitPara(false)
     104             : {
     105             :     // #i24363# tab stops relative to indent
     106             :     m_pImpl->SetDocumentSettingsProperty(
     107        1984 :         PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_TABS_RELATIVE_TO_INDENT ),
     108        3968 :         uno::makeAny( false ) );
     109             :     m_pImpl->SetDocumentSettingsProperty(
     110        1984 :         PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_SURROUND_TEXT_WRAP_SMALL ),
     111        3968 :         uno::makeAny( true ) );
     112             :     m_pImpl->SetDocumentSettingsProperty(
     113        1984 :         PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING ),
     114        3968 :         uno::makeAny( true ) );
     115             : 
     116             :     // Don't load the default style definitions to avoid weird mix
     117        1984 :     m_pImpl->SetDocumentSettingsProperty("StylesNoDefault", uno::makeAny(true));
     118             : 
     119             :     //import document properties
     120             :     try
     121             :     {
     122             :         uno::Reference< embed::XStorage > xDocumentStorage =
     123        2444 :             (comphelper::OStorageHelper::GetStorageOfFormatFromInputStream(OFOPXML_STORAGE_FORMAT_STRING, xInputStream, xContext, bRepairStorage ));
     124             : 
     125        3048 :         uno::Reference< uno::XInterface > xTemp = xContext->getServiceManager()->createInstanceWithContext(
     126             :                                 "com.sun.star.document.OOXMLDocumentPropertiesImporter",
     127        3048 :                                 xContext);
     128             : 
     129        3048 :         uno::Reference< document::XOOXMLDocumentPropertiesImporter > xImporter( xTemp, uno::UNO_QUERY_THROW );
     130        3048 :         uno::Reference< document::XDocumentPropertiesSupplier > xPropSupplier( xModel, uno::UNO_QUERY_THROW);
     131        3048 :         xImporter->importProperties( xDocumentStorage, xPropSupplier->getDocumentProperties() );
     132             :     }
     133         460 :     catch( const uno::Exception& rEx )
     134             :     {
     135             :         (void)rEx;
     136             :     }
     137        1984 : }
     138             : 
     139        5952 : DomainMapper::~DomainMapper()
     140             : {
     141             :     try
     142             :     {
     143        1984 :         uno::Reference< text::XDocumentIndexesSupplier> xIndexesSupplier( m_pImpl->GetTextDocument(), uno::UNO_QUERY );
     144        1984 :         sal_Int32 nIndexes = 0;
     145        1984 :         if( xIndexesSupplier.is() )
     146             :         {
     147        1958 :             uno::Reference< container::XIndexAccess > xIndexes = xIndexesSupplier->getDocumentIndexes();
     148        1958 :             nIndexes = xIndexes->getCount();
     149             :         }
     150             :         // If we have page references, those need updating as well, similar to the indexes.
     151        3968 :         uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(m_pImpl->GetTextDocument(), uno::UNO_QUERY);
     152        1984 :         if(xTextFieldsSupplier.is())
     153             :         {
     154        1958 :             uno::Reference<container::XEnumeration> xEnumeration = xTextFieldsSupplier->getTextFields()->createEnumeration();
     155        4298 :             while(xEnumeration->hasMoreElements())
     156             :             {
     157         382 :                 ++nIndexes;
     158         382 :                 xEnumeration->nextElement();
     159        1958 :             }
     160             :         }
     161        1984 :         if( nIndexes || m_pImpl->m_pSdtHelper->hasElements())
     162             :         {
     163             :             //index update has to wait until first view is created
     164         320 :             uno::Reference< document::XEventBroadcaster > xBroadcaster(xIndexesSupplier, uno::UNO_QUERY);
     165         320 :             if (xBroadcaster.is())
     166         320 :                 xBroadcaster->addEventListener(uno::Reference< document::XEventListener >(new ModelEventListener(nIndexes, m_pImpl->m_pSdtHelper->hasElements())));
     167             :         }
     168             : 
     169             : 
     170             :         // Apply the document settings after everything else
     171        1984 :         m_pImpl->GetSettingsTable()->ApplyProperties( m_pImpl->GetTextDocument( ) );
     172             : 
     173             :         // Grab-bag handling
     174        3968 :         comphelper::SequenceAsHashMap aProperties;
     175             :         // Add the saved w:themeFontLang setting
     176        1984 :         aProperties["ThemeFontLangProps"] = uno::makeAny(GetThemeFontLangProperties());
     177             :         // Add the saved compat settings
     178        1984 :         aProperties["CompatSettings"] = uno::makeAny(GetCompatSettings());
     179        3968 :         uno::Reference<beans::XPropertySet> xDocProps(m_pImpl->GetTextDocument(), uno::UNO_QUERY);
     180        1984 :         if (xDocProps.is())
     181             :         {
     182        1958 :             comphelper::SequenceAsHashMap aGrabBag(xDocProps->getPropertyValue("InteropGrabBag"));
     183        1958 :             aGrabBag.update(aProperties);
     184        1958 :             xDocProps->setPropertyValue("InteropGrabBag", uno::Any(aGrabBag.getAsConstPropertyValueList()));
     185        1984 :         }
     186             :     }
     187           0 :     catch( const uno::Exception& rEx )
     188             :     {
     189             :         (void)rEx;
     190             :     }
     191             : 
     192        1984 :     delete m_pImpl;
     193             : 
     194             : #ifdef DEBUG_WRITERFILTER
     195             :         TagLogger::getInstance().endDocument();
     196             : #endif
     197        3968 : }
     198             : 
     199      394081 : void DomainMapper::lcl_attribute(Id nName, Value & val)
     200             : {
     201      394081 :     if (m_pImpl->getTableManager().attribute(nName, val))
     202      409504 :         return;
     203             : 
     204             :     static const int nSingleLineSpacing = 240;
     205      378658 :     sal_Int32 nIntValue = val.getInt();
     206      378658 :     OUString sStringValue = val.getString();
     207             : 
     208      378658 :     SectionPropertyMap * pSectionContext = m_pImpl->GetSectionContext();
     209      378658 :         switch( nName )
     210             :         {
     211             :         case NS_ooxml::LN_CT_Lvl_start:
     212           0 :             break;
     213             :         case NS_ooxml::LN_CT_Lvl_numFmt:
     214           0 :             break;
     215             :         case NS_ooxml::LN_CT_Lvl_isLgl:
     216           0 :             break;
     217             :         case NS_ooxml::LN_CT_Lvl_legacy:
     218           0 :             break;
     219             :         case NS_ooxml::LN_CT_AbstractNum_nsid:
     220           0 :             break;
     221             :         case NS_ooxml::LN_CT_AbstractNum_tmpl:
     222           0 :             break;
     223             :         case NS_ooxml::LN_CT_Border_sz:
     224           0 :             break;
     225             :         case NS_ooxml::LN_CT_Border_val:
     226           0 :             break;
     227             :         case NS_ooxml::LN_CT_Border_space:
     228           0 :             break;
     229             :         case NS_ooxml::LN_CT_Border_shadow:
     230           0 :             break;
     231             :         case NS_ooxml::LN_CT_Border_frame:
     232           0 :             break;
     233             :         case NS_ooxml::LN_headerr:
     234           0 :             break;
     235             :         case NS_ooxml::LN_footerr:
     236           0 :             break;
     237             :         case NS_ooxml::LN_endnote:
     238           0 :             break;
     239             :         case NS_ooxml::LN_CT_Bookmark_name:
     240        2925 :             m_pImpl->SetBookmarkName( sStringValue );
     241        2925 :         break;
     242             :         case NS_ooxml::LN_CT_MarkupRangeBookmark_id:
     243             :             // add a bookmark range -- this remembers a bookmark starting here
     244             :             // or, if the bookmark was already started or, if the bookmark was
     245             :             // already started before, writes out the bookmark
     246        5645 :             m_pImpl->StartOrEndBookmark( sStringValue );
     247        5645 :         break;
     248             :         case NS_ooxml::LN_CT_MarkupRange_displacedByCustomXml:
     249          68 :             break;
     250             :         case NS_ooxml::LN_NUMBERING:
     251           0 :             break;
     252             :         case NS_ooxml::LN_FONTTABLE:
     253           0 :             break;
     254             :         case NS_ooxml::LN_STYLESHEET:
     255           0 :             break;
     256             : 
     257             :         case NS_ooxml::LN_CT_Sym_char:
     258          10 :         if( m_pImpl->GetTopContext() && m_pImpl->GetTopContext()->GetFootnote().is())
     259             :         {
     260           0 :             m_pImpl->GetTopContext()->GetFootnote()->setLabel(OUString( sal_Unicode(nIntValue)));
     261           0 :             break;
     262             :         }
     263             :         else //it's a _real_ symbol
     264             :         {
     265          10 :             m_pImpl->SetSymbolData(nIntValue);
     266             :         }
     267          10 :         break;
     268             :         case NS_ooxml::LN_CT_Sym_font:
     269             :             //the footnote symbol and font are provided after the footnote is already inserted
     270          10 :         if( m_pImpl->GetTopContext() && m_pImpl->GetTopContext()->GetFootnote().is())
     271             :         {
     272           0 :             uno::Reference< beans::XPropertySet > xAnchorProps( m_pImpl->GetTopContext()->GetFootnote()->getAnchor(), uno::UNO_QUERY );
     273           0 :             xAnchorProps->setPropertyValue(
     274           0 :                 PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_CHAR_FONT_NAME),
     275           0 :                 uno::makeAny( sStringValue ));
     276             :         }
     277             :         else //a real symbol
     278          10 :             if (m_pImpl->GetTopContext())
     279             :             {
     280          10 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME, uno::makeAny( sStringValue ));
     281             :                 /*
     282             :                  * In case of symbol, symbol character get imported first and then font of symbols.
     283             :                  * So we are storing symbol character and when we parse symbol font then create UNO object for text.
     284             :                  */
     285          10 :                 sal_Int32 symboldata = m_pImpl->GetSymbolData();
     286          10 :                 utext( reinterpret_cast < const sal_uInt8 * >( &(symboldata) ), 1 );
     287             :             }
     288             : 
     289          10 :         break;
     290             :         case NS_ooxml::LN_CT_Underline_val:
     291        2409 :             handleUnderlineType(nIntValue, m_pImpl->GetTopContext());
     292        2409 :             break;
     293             :         case NS_ooxml::LN_CT_Color_val:
     294       17791 :             if (m_pImpl->GetTopContext())
     295       17791 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR, uno::makeAny( nIntValue ) );
     296       17791 :             m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "val", OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue, /*bAutoColor=*/true)));
     297       17791 :             break;
     298             :         case NS_ooxml::LN_CT_Underline_color:
     299          46 :             if (m_pImpl->GetTopContext())
     300             :             {
     301          46 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_UNDERLINE_HAS_COLOR, uno::makeAny( true ) );
     302          46 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_UNDERLINE_COLOR, uno::makeAny( nIntValue ) );
     303             :             }
     304          46 :             break;
     305             : 
     306             :         case NS_ooxml::LN_CT_TabStop_val:
     307        7580 :             if (sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_ST_TabJc_clear)
     308             :             {
     309         396 :                 m_pImpl->m_aCurrentTabStop.bDeleted = true;
     310             :             }
     311             :             else
     312             :             {
     313        7184 :                 m_pImpl->m_aCurrentTabStop.bDeleted = false;
     314        7184 :                 m_pImpl->m_aCurrentTabStop.Alignment = getTabAlignFromValue(nIntValue);
     315             :             }
     316        7580 :             break;
     317             :         case NS_ooxml::LN_CT_TabStop_leader:
     318        3128 :             m_pImpl->m_aCurrentTabStop.FillChar = getFillCharFromValue(nIntValue);
     319        3128 :             break;
     320             :         case NS_ooxml::LN_CT_TabStop_pos:
     321        7900 :             m_pImpl->m_aCurrentTabStop.Position = ConversionHelper::convertTwipToMM100(nIntValue);
     322        7900 :             break;
     323             : 
     324             :         case NS_ooxml::LN_CT_Fonts_ascii:
     325       48266 :             if (m_pImpl->GetTopContext())
     326             :             {
     327       48266 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME, uno::makeAny( sStringValue ));
     328       48266 :                 if (m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) && m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH)->isSet(PROP_NUMBERING_RULES))
     329             :                 {
     330             :                     // Font of the paragraph mark should be used for the numbering as well.
     331        1862 :                     uno::Reference<beans::XPropertySet> xCharStyle(m_pImpl->GetCurrentNumberingCharStyle());
     332        1862 :                     if (xCharStyle.is())
     333         838 :                         xCharStyle->setPropertyValue("CharFontName", uno::makeAny(sStringValue));
     334             :                 }
     335             :             }
     336       48266 :             break;
     337             :         case NS_ooxml::LN_CT_Fonts_asciiTheme:
     338        5124 :             m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "asciiTheme", ThemeTable::getStringForTheme(nIntValue));
     339        5124 :             if (m_pImpl->GetTopContext())
     340             :             {
     341        5124 :                 uno::Any aPropValue = uno::makeAny( m_pImpl->GetThemeTable()->getFontNameForTheme( nIntValue ) );
     342        5124 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME, aPropValue );
     343        5124 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_FONT_NAME_ASCII, aPropValue, true, CHAR_GRAB_BAG );
     344        5124 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_NAME_ASCII, uno::makeAny( ThemeTable::getStringForTheme(nIntValue) ), true, CHAR_GRAB_BAG);
     345             :             }
     346        5124 :             break;
     347             :         case NS_ooxml::LN_CT_Fonts_hAnsi:
     348       44737 :             break;//unsupported
     349             :         case NS_ooxml::LN_CT_Fonts_hAnsiTheme:
     350        5122 :             m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "hAnsiTheme", ThemeTable::getStringForTheme(nIntValue));
     351        5122 :             if (m_pImpl->GetTopContext())
     352        5122 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_NAME_H_ANSI, uno::makeAny( ThemeTable::getStringForTheme(nIntValue) ), true, CHAR_GRAB_BAG);
     353        5122 :             break;
     354             :         case NS_ooxml::LN_CT_Fonts_eastAsia:
     355       11690 :             if (m_pImpl->GetTopContext())
     356       11690 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME_ASIAN, uno::makeAny( sStringValue ));
     357       11690 :             break;
     358             :         case NS_ooxml::LN_CT_Fonts_eastAsiaTheme:
     359        4658 :             m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "eastAsiaTheme", ThemeTable::getStringForTheme(nIntValue));
     360        4658 :             if (m_pImpl->GetTopContext())
     361             :             {
     362        4658 :                 uno::Any aPropValue = uno::makeAny( m_pImpl->GetThemeTable()->getFontNameForTheme( nIntValue ) );
     363        4658 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME_ASIAN, aPropValue );
     364        4658 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_FONT_NAME_EAST_ASIA, aPropValue, true, CHAR_GRAB_BAG );
     365        4658 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_NAME_EAST_ASIA, uno::makeAny( ThemeTable::getStringForTheme(nIntValue) ), true, CHAR_GRAB_BAG);
     366             :             }
     367        4658 :             break;
     368             :         case NS_ooxml::LN_CT_Fonts_cs:
     369       30390 :             if (m_pImpl->GetTopContext())
     370       30390 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME_COMPLEX, uno::makeAny( sStringValue ));
     371       30390 :             break;
     372             :         case NS_ooxml::LN_CT_Fonts_cstheme:
     373        5261 :             m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "cstheme", ThemeTable::getStringForTheme(nIntValue));
     374        5261 :             if (m_pImpl->GetTopContext())
     375             :             {
     376        5261 :                 uno::Any aPropValue = uno::makeAny( m_pImpl->GetThemeTable()->getFontNameForTheme( nIntValue ) );
     377        5261 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME_COMPLEX, aPropValue );
     378        5261 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_FONT_NAME_CS, aPropValue, true, CHAR_GRAB_BAG );
     379        5261 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_NAME_CS, uno::makeAny( ThemeTable::getStringForTheme(nIntValue) ), true, CHAR_GRAB_BAG);
     380             :             }
     381        5261 :         break;
     382             :         case NS_ooxml::LN_CT_Spacing_before:
     383       11177 :             m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "before", OUString::number(nIntValue));
     384       11177 :             if (m_pImpl->GetTopContext())
     385             :                 // Don't overwrite NS_ooxml::LN_CT_Spacing_beforeAutospacing.
     386       11177 :                 m_pImpl->GetTopContext()->Insert(PROP_PARA_TOP_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue ) ), false);
     387       11177 :             break;
     388             :         case NS_ooxml::LN_CT_Spacing_beforeLines:
     389         150 :                 m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "beforeLines", OUString::number(nIntValue));
     390         150 :                 if (m_pImpl->GetTopContext())
     391         150 :                     m_pImpl->GetTopContext()->Insert(PROP_PARA_TOP_MARGIN, uno::makeAny(ConversionHelper::convertTwipToMM100(nIntValue * nSingleLineSpacing / 100)), false);
     392         150 :             break;
     393             :         case NS_ooxml::LN_CT_Spacing_after:
     394       16337 :             m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "after", OUString::number(nIntValue));
     395       16337 :             if (m_pImpl->GetTopContext())
     396             :                 // Don't overwrite NS_ooxml::LN_CT_Spacing_afterAutospacing.
     397       16337 :                 m_pImpl->GetTopContext()->Insert(PROP_PARA_BOTTOM_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue ) ), false);
     398       16337 :             break;
     399             :         case NS_ooxml::LN_CT_Spacing_afterLines:
     400         152 :             m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "afterLines", OUString::number(nIntValue));
     401         152 :             if (m_pImpl->GetTopContext())
     402         152 :                 m_pImpl->GetTopContext()->Insert(PROP_PARA_BOTTOM_MARGIN, uno::makeAny(ConversionHelper::convertTwipToMM100(nIntValue * nSingleLineSpacing / 100)), false);
     403         152 :             break;
     404             :         case NS_ooxml::LN_CT_Spacing_line: //91434
     405             :         case NS_ooxml::LN_CT_Spacing_lineRule: //91435
     406             :         {
     407       23228 :             style::LineSpacing aSpacing;
     408       23228 :             PropertyMapPtr pTopContext = m_pImpl->GetTopContext();
     409       46456 :             boost::optional<PropertyMap::Property> aLineSpacingVal;
     410       23228 :             if (pTopContext && (aLineSpacingVal = pTopContext->getProperty(PROP_PARA_LINE_SPACING)) )
     411             :             {
     412       11613 :                 aLineSpacingVal->second >>= aSpacing;
     413             :             }
     414             :             else
     415             :             {
     416             :                 //default to single line spacing
     417       11615 :                 aSpacing.Mode = style::LineSpacingMode::FIX;
     418       11615 :                 aSpacing.Height = sal_Int16(ConversionHelper::convertTwipToMM100( nSingleLineSpacing ));
     419             :             }
     420       23228 :             if( nName == NS_ooxml::LN_CT_Spacing_line )
     421             :             {
     422       11612 :                 m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "line", OUString::number(nIntValue));
     423             :                 //now set the value depending on the Mode
     424       11612 :                 if( aSpacing.Mode == style::LineSpacingMode::PROP )
     425         285 :                     aSpacing.Height = sal_Int16(sal_Int32(nIntValue) * 100 / nSingleLineSpacing );
     426             :                 else
     427       11327 :                     aSpacing.Height = sal_Int16(ConversionHelper::convertTwipToMM100( nIntValue ));
     428             : 
     429       11612 :                 if( m_pImpl->getTableManager().isInCell() )
     430             :                 {
     431             :                     // direct formatting is applied for table cell data
     432        2927 :                     TablePropertyMapPtr pTblCellWithDirectFormatting(new TablePropertyMap);
     433        2927 :                     pTblCellWithDirectFormatting->Insert(PROP_PARA_LINE_SPACING, uno::makeAny( aSpacing ), false);
     434        2927 :                     m_pImpl->getTableManager().cellProps(pTblCellWithDirectFormatting);
     435             :                 }
     436             :             }
     437             :             else //NS_ooxml::LN_CT_Spacing_lineRule:
     438             :             {
     439             :                     // exactly, atLeast, auto
     440       11616 :                     if( sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_doc_ST_LineSpacingRule_auto)
     441             :                     {
     442        9386 :                         m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "lineRule", "auto");
     443        9386 :                         aSpacing.Mode = style::LineSpacingMode::PROP;
     444             :                         //reinterpret the already set value
     445        9386 :                         aSpacing.Height = sal_Int16( aSpacing.Height * 100 /  ConversionHelper::convertTwipToMM100( nSingleLineSpacing ));
     446             :                     }
     447        2230 :                     else if( sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_doc_ST_LineSpacingRule_atLeast)
     448             :                     {
     449         953 :                         m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "lineRule", "atLeast");
     450         953 :                         aSpacing.Mode = style::LineSpacingMode::MINIMUM;
     451             :                     }
     452             :                     else // NS_ooxml::LN_Value_doc_ST_LineSpacingRule_exact
     453             :                     {
     454        1277 :                         m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "lineRule", "exact");
     455        1277 :                         aSpacing.Mode = style::LineSpacingMode::FIX;
     456             :                     }
     457             : 
     458       11616 :                 if( m_pImpl->getTableManager().isInCell() )
     459             :                 {
     460             :                     // If the table manager got the line rule after
     461             :                     // ooxml::CT_Spacing_line, then it should get the rule
     462             :                     // after lineRule as well.
     463        2927 :                     TablePropertyMapPtr pTblCellWithDirectFormatting(new TablePropertyMap);
     464        2927 :                     pTblCellWithDirectFormatting->Insert(PROP_PARA_LINE_SPACING, uno::makeAny(aSpacing), false);
     465        2927 :                     m_pImpl->getTableManager().cellProps(pTblCellWithDirectFormatting);
     466             :                 }
     467             :             }
     468       23228 :             if (pTopContext)
     469       46456 :                 pTopContext->Insert(PROP_PARA_LINE_SPACING, uno::makeAny( aSpacing ));
     470             :         }
     471       23228 :         break;
     472             :         case NS_ooxml::LN_CT_Ind_start:
     473             :         case NS_ooxml::LN_CT_Ind_left:
     474        8873 :             if (m_pImpl->GetTopContext())
     475             :             {
     476             :                 // Word inherits FirstLineIndent property of the numbering, even if ParaLeftMargin is set, Writer does not.
     477             :                 // So copy it explicitly, if necessary.
     478        8873 :                 sal_Int32 nFirstLineIndent = m_pImpl->getCurrentNumberingProperty("FirstLineIndent");
     479             : 
     480        8873 :                 if (nFirstLineIndent != 0)
     481         298 :                     m_pImpl->GetTopContext()->Insert(PROP_PARA_FIRST_LINE_INDENT, uno::makeAny(nFirstLineIndent));
     482             : 
     483             :                 m_pImpl->GetTopContext()->Insert(
     484        8873 :                     PROP_PARA_LEFT_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue ) ));
     485             :             }
     486        8873 :             break;
     487             :         case NS_ooxml::LN_CT_Ind_end:
     488             :         case NS_ooxml::LN_CT_Ind_right:
     489        5006 :             if (m_pImpl->GetTopContext())
     490             :             {
     491             :                 // Word inherits FirstLineIndent/ParaLeftMargin property of the numbering, even if ParaRightMargin is set, Writer does not.
     492             :                 // So copy it explicitly, if necessary.
     493        5006 :                 sal_Int32 nFirstLineIndent = m_pImpl->getCurrentNumberingProperty("FirstLineIndent");
     494        5006 :                 sal_Int32 nParaLeftMargin = m_pImpl->getCurrentNumberingProperty("IndentAt");
     495             : 
     496        5006 :                 if (nFirstLineIndent != 0)
     497         130 :                     m_pImpl->GetTopContext()->Insert(PROP_PARA_FIRST_LINE_INDENT, uno::makeAny(nFirstLineIndent));
     498        5006 :                 if (nParaLeftMargin != 0)
     499         131 :                     m_pImpl->GetTopContext()->Insert(PROP_PARA_LEFT_MARGIN, uno::makeAny(nParaLeftMargin));
     500             : 
     501             :                 m_pImpl->GetTopContext()->Insert(
     502        5006 :                     PROP_PARA_RIGHT_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue ) ));
     503             :             }
     504        5006 :             m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "right", OUString::number(nIntValue));
     505        5006 :             break;
     506             :         case NS_ooxml::LN_CT_Ind_hanging:
     507        3735 :             if (m_pImpl->GetTopContext())
     508             :             {
     509        3735 :                 sal_Int32 nValue = ConversionHelper::convertTwipToMM100( nIntValue );
     510             :                 m_pImpl->GetTopContext()->Insert(
     511        3735 :                     PROP_PARA_FIRST_LINE_INDENT, uno::makeAny( - nValue ));
     512             :             }
     513        3735 :             break;
     514             :         case NS_ooxml::LN_CT_Ind_firstLine:
     515        2104 :             if (m_pImpl->GetTopContext())
     516             :                 m_pImpl->GetTopContext()->Insert(
     517        2104 :                     PROP_PARA_FIRST_LINE_INDENT, uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue ) ));
     518        2104 :             break;
     519             :         case NS_ooxml::LN_CT_Ind_rightChars:
     520          66 :             m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "rightChars", OUString::number(nIntValue));
     521          66 :             break;
     522             : 
     523             :         case NS_ooxml::LN_CT_EastAsianLayout_id:
     524           2 :             break;
     525             :         case NS_ooxml::LN_CT_EastAsianLayout_combine:
     526           0 :             if (m_pImpl->GetTopContext())
     527           0 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_COMBINE_IS_ON, uno::makeAny ( nIntValue != 0 ));
     528           0 :             break;
     529             :         case NS_ooxml::LN_CT_EastAsianLayout_combineBrackets:
     530           0 :             if (m_pImpl->GetTopContext())
     531             :             {
     532           0 :                 OUString sCombinePrefix = getBracketStringFromEnum(nIntValue);
     533           0 :                 OUString sCombineSuffix = getBracketStringFromEnum(nIntValue, false);
     534           0 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_COMBINE_PREFIX, uno::makeAny ( sCombinePrefix ));
     535           0 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_COMBINE_SUFFIX, uno::makeAny ( sCombineSuffix ));
     536             :             }
     537           0 :             break;
     538             :         case NS_ooxml::LN_CT_EastAsianLayout_vert:
     539           1 :             if (m_pImpl->GetTopContext())
     540             :             {
     541           1 :                 sal_Int16 nRotationAngle = (nIntValue ? 900 : 0);
     542           1 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_ROTATION, uno::makeAny ( nRotationAngle ));
     543             :             }
     544           1 :             break;
     545             :         case NS_ooxml::LN_CT_EastAsianLayout_vertCompress:
     546           0 :             if (m_pImpl->GetTopContext())
     547           0 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_ROTATION_IS_FIT_TO_LINE, uno::makeAny ( nIntValue != 0 ));
     548           0 :             break;
     549             : 
     550             :         case NS_ooxml::LN_CT_PageSz_code:
     551         127 :             CT_PageSz.code = nIntValue;
     552         127 :             break;
     553             :         case NS_ooxml::LN_CT_PageSz_h:
     554             :             {
     555        1890 :                 sal_Int32 nHeight = ConversionHelper::convertTwipToMM100(nIntValue);
     556        1890 :                 CT_PageSz.h = PaperInfo::sloppyFitPageDimension(nHeight);
     557             :             }
     558        1890 :             break;
     559             :         case NS_ooxml::LN_CT_PageSz_orient:
     560          77 :             CT_PageSz.orient = (nIntValue != static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_PageOrientation_portrait));
     561          77 :             break;
     562             :         case NS_ooxml::LN_CT_PageSz_w:
     563             :             {
     564        1890 :                 sal_Int32 nWidth = ConversionHelper::convertTwipToMM100(nIntValue);
     565        1890 :                 CT_PageSz.w = PaperInfo::sloppyFitPageDimension(nWidth);
     566             :             }
     567        1890 :             break;
     568             : 
     569             :         case NS_ooxml::LN_CT_PageMar_top:
     570        1887 :             m_pImpl->SetPageMarginTwip( PAGE_MAR_TOP, nIntValue );
     571        1887 :         break;
     572             :         case NS_ooxml::LN_CT_PageMar_right:
     573        1890 :             m_pImpl->SetPageMarginTwip( PAGE_MAR_RIGHT, nIntValue );
     574        1890 :         break;
     575             :         case NS_ooxml::LN_CT_PageMar_bottom:
     576        1886 :             m_pImpl->SetPageMarginTwip( PAGE_MAR_BOTTOM, nIntValue );
     577        1886 :         break;
     578             :         case NS_ooxml::LN_CT_PageMar_left:
     579        1890 :             m_pImpl->SetPageMarginTwip( PAGE_MAR_LEFT, nIntValue );
     580        1890 :         break;
     581             :         case NS_ooxml::LN_CT_PageMar_header:
     582        1737 :             m_pImpl->SetPageMarginTwip( PAGE_MAR_HEADER, nIntValue );
     583        1737 :         break;
     584             :         case NS_ooxml::LN_CT_PageMar_footer:
     585        1738 :             m_pImpl->SetPageMarginTwip( PAGE_MAR_FOOTER, nIntValue );
     586        1738 :         break;
     587             :         case NS_ooxml::LN_CT_PageMar_gutter:
     588        1693 :             m_pImpl->SetPageMarginTwip( PAGE_MAR_GUTTER, nIntValue );
     589        1693 :         break;
     590             :         case NS_ooxml::LN_CT_Language_val: //90314
     591             :         case NS_ooxml::LN_CT_Language_eastAsia: //90315
     592             :         case NS_ooxml::LN_CT_Language_bidi: //90316
     593             :         {
     594       27816 :             if (nName == NS_ooxml::LN_CT_Language_eastAsia)
     595        9882 :                 m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "eastAsia", sStringValue);
     596       17934 :             else if (nName == NS_ooxml::LN_CT_Language_val)
     597       13282 :                 m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "val", sStringValue);
     598        4652 :             else if (nName == NS_ooxml::LN_CT_Language_bidi)
     599        4652 :                 m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "bidi", sStringValue);
     600       27816 :             lang::Locale aLocale( LanguageTag::convertToLocale( sStringValue));
     601       27816 :             if (m_pImpl->GetTopContext())
     602       27816 :                 m_pImpl->GetTopContext()->Insert(NS_ooxml::LN_CT_Language_val== nName ? PROP_CHAR_LOCALE :
     603       14534 :                              NS_ooxml::LN_CT_Language_eastAsia == nName ? PROP_CHAR_LOCALE_ASIAN : PROP_CHAR_LOCALE_COMPLEX,
     604       70166 :                              uno::makeAny( aLocale ) );
     605             :         }
     606       27816 :         break;
     607             :         // See SwWW8ImplReader::GetParagraphAutoSpace() on why these are 100 and 280
     608             :         case NS_ooxml::LN_CT_Spacing_beforeAutospacing:
     609             :         {
     610        1102 :             sal_Int32 default_spacing = 100;
     611        1102 :             if (!m_pImpl->GetSettingsTable()->GetDoNotUseHTMLParagraphAutoSpacing())
     612             :             {
     613             :                 // 49 is just the old value that should be removed, once the
     614             :                 // root cause in SwTabFrm::MakeAll() is fixed.
     615        1086 :                 if (m_pImpl->GetSettingsTable()->GetView() == NS_ooxml::LN_Value_doc_ST_View_web)
     616          16 :                     default_spacing = 49;
     617             :                 else
     618        1070 :                     default_spacing = 280;
     619             :             }
     620        1102 :             if  (nIntValue) // If auto spacing is set, then only store set value in InteropGrabBag
     621             :             {
     622         735 :                 m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) );
     623             :             }
     624             :             else
     625             :             {
     626         367 :                 default_spacing = -1;
     627             :             }
     628        1102 :             m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN_BEFORE_AUTO_SPACING, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ),true, PARA_GRAB_BAG );
     629             :         }
     630        1102 :         break;
     631             :         case NS_ooxml::LN_CT_Spacing_afterAutospacing:
     632             :         {
     633         901 :             sal_Int32 default_spacing = 100;
     634             : 
     635         901 :             if (!m_pImpl->GetSettingsTable()->GetDoNotUseHTMLParagraphAutoSpacing())
     636             :             {
     637         886 :                 if (m_pImpl->GetSettingsTable()->GetView() == NS_ooxml::LN_Value_doc_ST_View_web)
     638          18 :                     default_spacing = 49;
     639             :                 else
     640         868 :                     default_spacing = 280;
     641             :             }
     642         901 :             if  (nIntValue) // If auto spacing is set, then only store set value in InteropGrabBag
     643             :             {
     644         752 :                 m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) );
     645             :             }
     646             :             else
     647             :             {
     648         149 :                 default_spacing = -1;
     649             :             }
     650         901 :             m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN_AFTER_AUTO_SPACING, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ),true, PARA_GRAB_BAG );
     651             :         }
     652         901 :         break;
     653             :         case NS_ooxml::LN_CT_SmartTagRun_uri:
     654             :         case NS_ooxml::LN_CT_SmartTagRun_element:
     655             :             //TODO: add handling of SmartTags
     656          66 :         break;
     657             :         case NS_ooxml::LN_CT_Br_type :
     658             :             //TODO: attributes for break (0x12) are not supported
     659         457 :         break;
     660             :         case NS_ooxml::LN_CT_Fonts_hint :
     661             :             /*  assigns script type to ambigous characters, values can be:
     662             :                 NS_ooxml::LN_Value_ST_Hint_default
     663             :                 NS_ooxml::LN_Value_ST_Hint_eastAsia
     664             :                 NS_ooxml::LN_Value_ST_Hint_cs
     665             :              */
     666             :             //TODO: unsupported?
     667       20127 :         break;
     668             :         case NS_ooxml::LN_CT_TblCellMar_right: // 92375;
     669             :         case NS_ooxml::LN_CT_TblBorders_top: // 92377;
     670             :         case NS_ooxml::LN_CT_TblBorders_left: // 92378;
     671             :         case NS_ooxml::LN_CT_TblBorders_bottom: // 92379;
     672             :         //todo: handle cell mar
     673           0 :         break;
     674             :         case NS_ooxml::LN_blip: // contains the binary graphic
     675             :         case NS_ooxml::LN_shape:
     676             :         {
     677             :             //looks a bit like a hack - and it is. The graphic import is split into the inline_inline part and
     678             :             //afterwards the adding of the binary data.
     679           0 :             m_pImpl->GetGraphicImport( IMPORT_AS_DETECTED_INLINE )->attribute(nName, val);
     680           0 :             m_pImpl->ImportGraphic( val.getProperties(), IMPORT_AS_DETECTED_INLINE );
     681             :         }
     682           0 :         break;
     683             :         case NS_ooxml::LN_starmath:
     684         267 :             m_pImpl->appendStarMath( val );
     685         267 :             break;
     686             :         case NS_ooxml::LN_CT_FramePr_dropCap:
     687             :         case NS_ooxml::LN_CT_FramePr_lines:
     688             :         case NS_ooxml::LN_CT_FramePr_hAnchor:
     689             :         case NS_ooxml::LN_CT_FramePr_vAnchor:
     690             :         case NS_ooxml::LN_CT_FramePr_x:
     691             :         case NS_ooxml::LN_CT_FramePr_xAlign:
     692             :         case NS_ooxml::LN_CT_FramePr_y:
     693             :         case NS_ooxml::LN_CT_FramePr_yAlign:
     694             :         case NS_ooxml::LN_CT_FramePr_hRule:
     695             :         case NS_ooxml::LN_CT_FramePr_w:
     696             :         case NS_ooxml::LN_CT_FramePr_h:
     697             :         case NS_ooxml::LN_CT_FramePr_wrap:
     698             :         case NS_ooxml::LN_CT_FramePr_hSpace:
     699             :         case NS_ooxml::LN_CT_FramePr_vSpace:
     700             :         {
     701             :             ParagraphProperties* pParaProperties = dynamic_cast< ParagraphProperties*>(
     702        2762 :                     m_pImpl->GetTopContextOfType( CONTEXT_PARAGRAPH ).get() );
     703        2762 :             if( pParaProperties )
     704             :             {
     705        2442 :                 switch( nName )
     706             :                 {
     707             :                     case NS_ooxml::LN_CT_FramePr_dropCap:
     708           0 :                         pParaProperties->SetDropCap( nIntValue );
     709           0 :                     break;
     710             :                     case NS_ooxml::LN_CT_FramePr_lines:
     711           0 :                         pParaProperties->SetLines( nIntValue );
     712           0 :                     break;
     713             :                     case NS_ooxml::LN_CT_FramePr_hAnchor:
     714         395 :                         switch(nIntValue)
     715             :                         {
     716             :                             case  NS_ooxml::LN_Value_doc_ST_HAnchor_text:   //relative to column
     717           2 :                                 nIntValue = text::RelOrientation::FRAME; break;
     718         366 :                             case  NS_ooxml::LN_Value_doc_ST_HAnchor_margin: nIntValue = text::RelOrientation::PAGE_PRINT_AREA; break;
     719          27 :                             case  NS_ooxml::LN_Value_doc_ST_HAnchor_page:   nIntValue = text::RelOrientation::PAGE_FRAME; break;
     720             :                             default:;
     721             :                         }
     722         395 :                         pParaProperties->SethAnchor( nIntValue );
     723         395 :                     break;
     724             :                     case NS_ooxml::LN_CT_FramePr_vAnchor:
     725         388 :                         switch(nIntValue)
     726             :                         {
     727             :                             case  NS_ooxml::LN_Value_doc_ST_VAnchor_text:  //relative to paragraph
     728          51 :                                     nIntValue = text::RelOrientation::FRAME; break;
     729           6 :                             case  NS_ooxml::LN_Value_doc_ST_VAnchor_margin:nIntValue = text::RelOrientation::PAGE_PRINT_AREA ; break;
     730         331 :                             case  NS_ooxml::LN_Value_doc_ST_VAnchor_page: nIntValue = text::RelOrientation::PAGE_FRAME; break;
     731             :                             default:;
     732             :                         }
     733         388 :                         pParaProperties->SetvAnchor( nIntValue );
     734         388 :                     break;
     735             :                     case NS_ooxml::LN_CT_FramePr_x:
     736          40 :                         pParaProperties->Setx( ConversionHelper::convertTwipToMM100(nIntValue ));
     737          40 :                     break;
     738             :                     case NS_ooxml::LN_CT_FramePr_xAlign:
     739         372 :                         switch( nIntValue )
     740             :                         {
     741         321 :                             case  NS_ooxml::LN_Value_doc_ST_XAlign_center  : nIntValue = text::HoriOrientation::CENTER; break;
     742          21 :                             case  NS_ooxml::LN_Value_doc_ST_XAlign_right   : nIntValue = text::HoriOrientation::RIGHT; break;
     743           0 :                             case  NS_ooxml::LN_Value_doc_ST_XAlign_inside  : nIntValue = text::HoriOrientation::INSIDE; break;
     744           0 :                             case  NS_ooxml::LN_Value_doc_ST_XAlign_outside : nIntValue = text::HoriOrientation::OUTSIDE; break;
     745           0 :                             case  NS_ooxml::LN_Value_doc_ST_XAlign_left    : nIntValue = text::HoriOrientation::LEFT; break;
     746          30 :                             default:    nIntValue = text::HoriOrientation::NONE;
     747             :                         }
     748         372 :                         pParaProperties->SetxAlign( nIntValue );
     749         372 :                     break;
     750             :                     case NS_ooxml::LN_CT_FramePr_y:
     751         393 :                         pParaProperties->Sety( ConversionHelper::convertTwipToMM100(nIntValue ));
     752         393 :                     break;
     753             :                     case NS_ooxml::LN_CT_FramePr_yAlign:
     754          31 :                         switch( nIntValue )
     755             :                         {
     756             :                             case  NS_ooxml::LN_Value_doc_ST_YAlign_top     :
     757           0 :                             case  NS_ooxml::LN_Value_doc_ST_YAlign_inside  :nIntValue = text::VertOrientation::TOP; break;
     758           0 :                             case  NS_ooxml::LN_Value_doc_ST_YAlign_center  :nIntValue = text::VertOrientation::CENTER;break;
     759             :                             case  NS_ooxml::LN_Value_doc_ST_YAlign_bottom  :
     760           1 :                             case  NS_ooxml::LN_Value_doc_ST_YAlign_outside :nIntValue = text::VertOrientation::BOTTOM;break;
     761             :                             case  NS_ooxml::LN_Value_doc_ST_YAlign_inline  :
     762             :                             {
     763             :                             // HACK: This is for bnc#780851, where a table has one cell that has w:framePr,
     764             :                             // which causes that paragraph to be converted to a text frame, and the original
     765             :                             // paragraph object no longer exists, which makes table creation fail and furthermore
     766             :                             // it would be missing in the table layout anyway. So actually no letting that paragraph
     767             :                             // be a text frame "fixes" it. I'm not sure what "inline" is supposed to mean in practice
     768             :                             // anyway, so as long as this doesn't cause trouble elsewhere ...
     769           0 :                                 PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH);
     770           0 :                                 if( pContext.get() )
     771             :                                 {
     772           0 :                                     ParagraphPropertyMap* pParaContext = dynamic_cast< ParagraphPropertyMap* >( pContext.get() );
     773           0 :                                     if (pParaContext)
     774           0 :                                         pParaContext->SetFrameMode(false);
     775             :                                 }
     776           0 :                                 nIntValue = text::VertOrientation::NONE;
     777           0 :                                 break;
     778             :                             }
     779             :                             default:
     780          30 :                                 nIntValue = text::VertOrientation::NONE;
     781          30 :                                 break;
     782             :                         }
     783          31 :                         pParaProperties->SetyAlign( nIntValue );
     784          31 :                     break;
     785             :                     case NS_ooxml::LN_CT_FramePr_hRule:
     786          39 :                          switch( nIntValue )
     787             :                          {
     788             :                             case NS_ooxml::LN_Value_doc_ST_HeightRule_exact:
     789          33 :                                 nIntValue = text::SizeType::FIX;
     790          33 :                             break;
     791             :                             case NS_ooxml::LN_Value_doc_ST_HeightRule_atLeast:
     792           1 :                                 nIntValue = text::SizeType::MIN;
     793           1 :                             break;
     794             :                             case NS_ooxml::LN_Value_doc_ST_HeightRule_auto:
     795             :                             //no break;
     796             :                             default:;
     797           5 :                                 nIntValue = text::SizeType::VARIABLE;
     798             :                          }
     799          39 :                         pParaProperties->SethRule( nIntValue );
     800          39 :                     break;
     801             :                     case NS_ooxml::LN_CT_FramePr_wrap:
     802             :                     {
     803             :                         //should be either LN_Value_doc_ST_Wrap_notBeside or LN_Value_doc_ST_Wrap_around or LN_Value_doc_ST_Wrap_auto
     804             :                         OSL_ENSURE( sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_doc_ST_Wrap_around ||
     805             :                                     sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_doc_ST_Wrap_notBeside ||
     806             :                                     sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_doc_ST_Wrap_auto,
     807             :                             "wrap not around, not_Beside or auto?");
     808         443 :                         if( sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_doc_ST_Wrap_around ||
     809          42 :                             sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_doc_ST_Wrap_auto )
     810         362 :                             pParaProperties->SetWrap ( text::WrapTextMode_DYNAMIC ) ;
     811             :                         else
     812          39 :                             pParaProperties->SetWrap ( text::WrapTextMode_NONE ) ;
     813             :                     }
     814         401 :                     break;
     815             :                     case NS_ooxml::LN_CT_FramePr_w:
     816          39 :                         pParaProperties->Setw(ConversionHelper::convertTwipToMM100(nIntValue));
     817          39 :                     break;
     818             :                     case NS_ooxml::LN_CT_FramePr_h:
     819          34 :                         pParaProperties->Seth(ConversionHelper::convertTwipToMM100(nIntValue));
     820          34 :                     break;
     821             :                     case NS_ooxml::LN_CT_FramePr_hSpace:
     822         308 :                         pParaProperties->SethSpace( ConversionHelper::convertTwipToMM100(nIntValue ));
     823         308 :                     break;
     824             :                     case NS_ooxml::LN_CT_FramePr_vSpace:
     825           2 :                         pParaProperties->SetvSpace( ConversionHelper::convertTwipToMM100(nIntValue ));
     826           2 :                     break;
     827             :                     default:;
     828             :                 }
     829             :             }
     830             :             else
     831             :             {
     832             :                 //TODO: how to handle frame properties at styles
     833             :             }
     834             :         }
     835        2762 :         break;
     836             :         case NS_ooxml::LN_CT_TrackChange_author:
     837        1029 :             m_pImpl->SetCurrentRedlineAuthor( sStringValue );
     838        1029 :         break;
     839             :         case NS_ooxml::LN_CT_TrackChange_date:
     840        1012 :             m_pImpl->SetCurrentRedlineDate( sStringValue );
     841        1012 :         break;
     842             :         case NS_ooxml::LN_CT_Markup_id:
     843        1061 :             m_pImpl->SetCurrentRedlineId( nIntValue );
     844        1061 :         break;
     845             :         case NS_ooxml::LN_EG_RangeMarkupElements_commentRangeStart:
     846          20 :             m_pImpl->AddAnnotationPosition( true, nIntValue );
     847          20 :         break;
     848             :         case NS_ooxml::LN_EG_RangeMarkupElements_commentRangeEnd:
     849          20 :             m_pImpl->AddAnnotationPosition( false, nIntValue );
     850          20 :         break;
     851             :         case NS_ooxml::LN_CT_Comment_initials:
     852          35 :             m_pImpl->SetCurrentRedlineInitials(sStringValue);
     853          35 :         break;
     854             :         case NS_ooxml::LN_token:
     855         390 :             m_pImpl->SetCurrentRedlineToken( nIntValue );
     856         390 :         break;
     857             :         case NS_ooxml::LN_CT_LineNumber_start:
     858             :         case NS_ooxml::LN_CT_LineNumber_distance:
     859             :         case NS_ooxml::LN_CT_LineNumber_countBy:
     860             :         case NS_ooxml::LN_CT_LineNumber_restart:
     861             :         {
     862             :             //line numbering in Writer is a global document setting
     863             :             //in Word is a section setting
     864             :             //if line numbering is switched on anywhere in the document it's set at the global settings
     865          77 :             LineNumberSettings aSettings = m_pImpl->GetLineNumberSettings();
     866          77 :             switch( nName )
     867             :             {
     868             :                 case NS_ooxml::LN_CT_LineNumber_countBy:
     869          27 :                     aSettings.nInterval = nIntValue;
     870             :                     OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
     871          27 :                     if( pSectionContext )
     872          27 :                         pSectionContext->SetLnnMod( nIntValue );
     873          27 :                 break;
     874             :                 case NS_ooxml::LN_CT_LineNumber_start:
     875           3 :                     aSettings.nStartValue = nIntValue; // todo: has to be set at (each) first paragraph
     876             :                     OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
     877           3 :                     if( pSectionContext )
     878           3 :                         pSectionContext->SetLnnMin( nIntValue );
     879           3 :                 break;
     880             :                 case NS_ooxml::LN_CT_LineNumber_distance:
     881          22 :                     aSettings.nDistance = ConversionHelper::convertTwipToMM100( nIntValue );
     882             :                     OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
     883          22 :                     if( pSectionContext )
     884          22 :                         pSectionContext->SetdxaLnn( nIntValue );
     885          22 :                 break;
     886             :                 case NS_ooxml::LN_CT_LineNumber_restart:
     887          25 :                     aSettings.bRestartAtEachPage = nIntValue == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_LineNumberRestart_newPage);
     888             :                     OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
     889          25 :                     if( pSectionContext )
     890          25 :                         pSectionContext->SetLnc( nIntValue );
     891          25 :                 break;
     892             :                 default:;
     893             :             }
     894          77 :             m_pImpl->SetLineNumberSettings( aSettings );
     895             :         }
     896          77 :         break;
     897             :         case NS_ooxml::LN_CT_FtnEdnRef_customMarkFollows:
     898           0 :             m_pImpl->SetCustomFtnMark( true );
     899           0 :         break;
     900             :         case NS_ooxml::LN_CT_FtnEdnRef_id:
     901             :             // footnote or endnote reference id - not needed
     902          44 :         break;
     903             :         case NS_ooxml::LN_CT_Color_themeColor:
     904        2828 :             m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "themeColor", TDefTableHandler::getThemeColorTypeString(nIntValue));
     905        2828 :         break;
     906             :         case NS_ooxml::LN_CT_Color_themeTint:
     907         428 :             m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "themeTint", OUString::number(nIntValue, 16));
     908         428 :         break;
     909             :         case NS_ooxml::LN_CT_Color_themeShade:
     910         939 :             m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "themeShade", OUString::number(nIntValue, 16));
     911         939 :         break;
     912             :         case NS_ooxml::LN_CT_DocGrid_linePitch:
     913             :         {
     914             :             //see SwWW8ImplReader::SetDocumentGrid
     915             :             OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
     916        1446 :             if(pSectionContext)
     917             :             {
     918        1446 :                 pSectionContext->SetGridLinePitch( ConversionHelper::convertTwipToMM100( nIntValue ) );
     919             :             }
     920             :         }
     921        1446 :         break;
     922             :         case NS_ooxml::LN_CT_DocGrid_charSpace:
     923             :         {
     924             :             OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
     925         573 :             if(pSectionContext)
     926             :             {
     927         573 :                 pSectionContext->SetDxtCharSpace( nIntValue );
     928             :             }
     929             :         }
     930         573 :         break;
     931             :         case NS_ooxml::LN_CT_DocGrid_type:
     932             :         {
     933         560 :             if (pSectionContext != nullptr)
     934             :             {
     935         560 :                 switch( nIntValue )
     936             :                 {
     937             :                     case NS_ooxml::LN_Value_doc_ST_DocGrid_default:
     938         534 :                         pSectionContext->SetGridType(text::TextGridMode::NONE);
     939         534 :                         break;
     940             :                     case NS_ooxml::LN_Value_doc_ST_DocGrid_lines:
     941          23 :                         pSectionContext->SetGridType(text::TextGridMode::LINES);
     942          23 :                         break;
     943             :                     case NS_ooxml::LN_Value_doc_ST_DocGrid_linesAndChars:
     944           0 :                         pSectionContext->SetGridType(text::TextGridMode::LINES_AND_CHARS);
     945           0 :                         pSectionContext->SetGridSnapToChars( false );
     946           0 :                         break;
     947             :                     case NS_ooxml::LN_Value_doc_ST_DocGrid_snapToChars:
     948           3 :                         pSectionContext->SetGridType(text::TextGridMode::LINES_AND_CHARS);
     949           3 :                         pSectionContext->SetGridSnapToChars( true );
     950           3 :                         break;
     951             :                     default :
     952             :                         OSL_FAIL("unknown SwTextGrid value");
     953             :                 }
     954             :             }
     955             :         }
     956         560 :         break;
     957             :         case NS_ooxml::LN_CT_SdtBlock_sdtContent:
     958         446 :             m_pImpl->SetSdt(true);
     959         446 :         break;
     960             :         case NS_ooxml::LN_CT_SdtBlock_sdtEndContent:
     961         446 :             m_pImpl->SetSdt(false);
     962             : 
     963             :             // It's not possible to insert the relevant property to the character context here:
     964             :             // the previous, already sent character context may be still active, so the property would be lost.
     965         446 :             if (m_pImpl->m_pSdtHelper->isOutsideAParagraph())
     966         291 :                 m_pImpl->setParaSdtEndDeferred(true);
     967             :             else
     968         155 :                 m_pImpl->setSdtEndDeferred(true);
     969             : 
     970         446 :             if (!m_pImpl->m_pSdtHelper->getDropDownItems().empty())
     971           6 :                 m_pImpl->m_pSdtHelper->createDropDownControl();
     972         446 :         break;
     973             :         case NS_ooxml::LN_CT_SdtListItem_displayText:
     974             :             // TODO handle when this is != value
     975          58 :         break;
     976             :         case NS_ooxml::LN_CT_SdtListItem_value:
     977          62 :             m_pImpl->m_pSdtHelper->getDropDownItems().push_back(sStringValue);
     978          62 :         break;
     979             :         case NS_ooxml::LN_CT_SdtDate_fullDate:
     980          26 :             if (!IsInHeaderFooter())
     981           9 :                 m_pImpl->m_pSdtHelper->getDate().append(sStringValue);
     982             :             else
     983          17 :                 m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtDate_fullDate", sStringValue);
     984          26 :         break;
     985             :         case NS_ooxml::LN_CT_Background_color:
     986          24 :             m_pImpl->m_oBackgroundColor.reset(nIntValue);
     987          24 :         break;
     988             :         case NS_ooxml::LN_CT_PageNumber_start:
     989         112 :             if (pSectionContext != nullptr)
     990         112 :                 pSectionContext->SetPageNumber(nIntValue);
     991         112 :         break;
     992             :         case NS_ooxml::LN_CT_FtnEdn_type:
     993             :             // This is the "separator" footnote, ignore its linebreak.
     994         132 :             if (static_cast<sal_uInt32>(nIntValue) == NS_ooxml::LN_Value_doc_ST_FtnEdn_separator)
     995          88 :                 m_pImpl->m_bIgnoreNextPara = true;
     996         132 :         break;
     997             :         case NS_ooxml::LN_CT_DataBinding_prefixMappings:
     998          99 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_DataBinding_prefixMappings", sStringValue);
     999          99 :             break;
    1000             :         case NS_ooxml::LN_CT_DataBinding_xpath:
    1001          99 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_DataBinding_xpath", sStringValue);
    1002          99 :             break;
    1003             :         case NS_ooxml::LN_CT_DataBinding_storeItemID:
    1004          99 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_DataBinding_storeItemID", sStringValue);
    1005          99 :             break;
    1006             :         case NS_ooxml::LN_CT_PTab_leader:
    1007             :         case NS_ooxml::LN_CT_PTab_relativeTo:
    1008             :         case NS_ooxml::LN_CT_PTab_alignment:
    1009          78 :             break;
    1010             :         case NS_ooxml::LN_CT_Cnf_lastRowLastColumn:
    1011        1617 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "lastRowLastColumn", OUString::number(nIntValue));
    1012        1617 :             break;
    1013             :         case NS_ooxml::LN_CT_Cnf_lastRowFirstColumn:
    1014        1617 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "lastRowFirstColumn", OUString::number(nIntValue));
    1015        1617 :             break;
    1016             :         case NS_ooxml::LN_CT_Cnf_firstRowLastColumn:
    1017        1617 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "firstRowLastColumn", OUString::number(nIntValue));
    1018        1617 :             break;
    1019             :         case NS_ooxml::LN_CT_Cnf_oddHBand:
    1020        1617 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "oddHBand", OUString::number(nIntValue));
    1021        1617 :             break;
    1022             :         case NS_ooxml::LN_CT_Cnf_firstRowFirstColumn:
    1023        1617 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "firstRowFirstColumn", OUString::number(nIntValue));
    1024        1617 :             break;
    1025             :         case NS_ooxml::LN_CT_Cnf_evenVBand:
    1026        1617 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "evenVBand", OUString::number(nIntValue));
    1027        1617 :             break;
    1028             :         case NS_ooxml::LN_CT_Cnf_evenHBand:
    1029        1617 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "evenHBand", OUString::number(nIntValue));
    1030        1617 :             break;
    1031             :         case NS_ooxml::LN_CT_Cnf_lastColumn:
    1032        1617 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "lastColumn", OUString::number(nIntValue));
    1033        1617 :             break;
    1034             :         case NS_ooxml::LN_CT_Cnf_firstColumn:
    1035        1617 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "firstColumn", OUString::number(nIntValue));
    1036        1617 :             break;
    1037             :         case NS_ooxml::LN_CT_Cnf_oddVBand:
    1038        1617 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "oddVBand", OUString::number(nIntValue));
    1039        1617 :             break;
    1040             :         case NS_ooxml::LN_CT_Cnf_lastRow:
    1041        1617 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "lastRow", OUString::number(nIntValue));
    1042        1617 :             break;
    1043             :         case NS_ooxml::LN_CT_Cnf_firstRow:
    1044        1617 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "firstRow", OUString::number(nIntValue));
    1045        1617 :             break;
    1046             :         case NS_ooxml::LN_CT_Cnf_val:
    1047        1618 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "val", sStringValue);
    1048        1618 :             break;
    1049             :         default:
    1050             :             SAL_WARN("writerfilter", "DomainMapper::lcl_attribute: unhandled token: " << nName);
    1051      378658 :         }
    1052             : }
    1053             : 
    1054      487564 : void DomainMapper::lcl_sprm(Sprm & rSprm)
    1055             : {
    1056      487564 :     if( !m_pImpl->getTableManager().sprm(rSprm))
    1057      392575 :         sprmWithProps( rSprm, m_pImpl->GetTopContext() );
    1058      487564 : }
    1059             : 
    1060           2 : sal_Int32 lcl_getCurrentNumberingProperty(
    1061             :         uno::Reference<container::XIndexAccess> const& xNumberingRules,
    1062             :         sal_Int32 nNumberingLevel, const OUString& aProp)
    1063             : {
    1064           2 :     sal_Int32 nRet = 0;
    1065             : 
    1066             :     try
    1067             :     {
    1068           2 :         if (nNumberingLevel < 0) // It seems it's valid to omit numbering level, and in that case it means zero.
    1069           2 :             nNumberingLevel = 0;
    1070           2 :         if (xNumberingRules.is())
    1071             :         {
    1072           2 :             uno::Sequence<beans::PropertyValue> aProps;
    1073           2 :             xNumberingRules->getByIndex(nNumberingLevel) >>= aProps;
    1074          21 :             for (int i = 0; i < aProps.getLength(); ++i)
    1075             :             {
    1076          21 :                 const beans::PropertyValue& rProp = aProps[i];
    1077             : 
    1078          21 :                 if (rProp.Name == aProp)
    1079             :                 {
    1080           2 :                     rProp.Value >>= nRet;
    1081           2 :                     break;
    1082             :                 }
    1083           2 :             }
    1084             :         }
    1085             :     }
    1086           0 :     catch( const uno::Exception& )
    1087             :     {
    1088             :         // This can happen when the doc contains some hand-crafted invalid list level.
    1089             :     }
    1090             : 
    1091           2 :     return nRet;
    1092             : }
    1093             : 
    1094             : // In rtl-paragraphs the meaning of left/right are to be exchanged
    1095        8906 : static bool ExchangeLeftRight(const PropertyMapPtr& rContext, DomainMapper_Impl* m_pImpl)
    1096             : {
    1097        8906 :     bool bExchangeLeftRight = false;
    1098        8906 :     boost::optional<PropertyMap::Property> aPropPara = rContext->getProperty(PROP_WRITING_MODE);
    1099        8906 :     if( aPropPara )
    1100             :     {
    1101             :         sal_Int32 aAdjust ;
    1102        1621 :         if( (aPropPara->second >>= aAdjust) && aAdjust == text::WritingMode2::RL_TB )
    1103           9 :             bExchangeLeftRight = true;
    1104             :     }
    1105             :     else
    1106             :     {
    1107             :         // check if there RTL <bidi> in default style for the paragraph
    1108        7285 :         StyleSheetEntryPtr pTable = m_pImpl->GetStyleSheetTable()->FindDefaultParaStyle();
    1109        7285 :         if ( pTable )
    1110             :         {
    1111        5891 :             boost::optional<PropertyMap::Property> aPropStyle = pTable->pProperties->getProperty(PROP_WRITING_MODE);
    1112        5891 :             if( aPropStyle )
    1113             :             {
    1114             :                 sal_Int32 aDirect;
    1115        4871 :                 if( (aPropStyle->second >>= aDirect) && aDirect == text::WritingMode2::RL_TB )
    1116          13 :                     bExchangeLeftRight = true;
    1117        5891 :             }
    1118        7285 :         }
    1119             :     }
    1120        8906 :     return bExchangeLeftRight;
    1121             : }
    1122             : 
    1123             : /// Check if the style or its parent has a list id, recursively.
    1124       24815 : static sal_Int32 lcl_getListId(const StyleSheetEntryPtr& rEntry, const StyleSheetTablePtr& rStyleTable)
    1125             : {
    1126       24815 :     const StyleSheetPropertyMap* pEntryProperties = dynamic_cast<const StyleSheetPropertyMap*>(rEntry->pProperties.get());
    1127       24815 :     if (!pEntryProperties)
    1128           0 :         return -1;
    1129             : 
    1130       24815 :     sal_Int32 nListId = pEntryProperties->GetListId();
    1131             :     // The style itself has a list id.
    1132       24815 :     if (nListId >= 0)
    1133         258 :         return nListId;
    1134             : 
    1135             :     // The style has no parent.
    1136       24557 :     if (rEntry->sBaseStyleIdentifier.isEmpty())
    1137       15037 :         return -1;
    1138             : 
    1139        9520 :     const StyleSheetEntryPtr pParent = rStyleTable->FindStyleSheetByISTD(rEntry->sBaseStyleIdentifier);
    1140             :     // No such parent style or loop in the style hierarchy.
    1141        9520 :     if (!pParent || pParent == rEntry)
    1142           6 :         return -1;
    1143             : 
    1144        9514 :     return lcl_getListId(pParent, rStyleTable);
    1145             : }
    1146             : 
    1147      436052 : void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext )
    1148             : {
    1149             :     // These SPRM's are not specific to any section, so it's expected that there is no context yet.
    1150      436052 :     switch (rSprm.getId())
    1151             :     {
    1152             :     case NS_ooxml::LN_background_background:
    1153          77 :         return;
    1154             :         break;
    1155             :     default:
    1156      436048 :         break;
    1157             :     }
    1158             : 
    1159             :     OSL_ENSURE(rContext.get(), "PropertyMap has to be valid!");
    1160      436048 :     if(!rContext.get())
    1161          69 :         return ;
    1162             : 
    1163      435979 :     sal_uInt32 nSprmId = rSprm.getId();
    1164             :     //needed for page properties
    1165      435979 :     SectionPropertyMap * pSectionContext = m_pImpl->GetSectionContext();
    1166      435979 :     Value::Pointer_t pValue = rSprm.getValue();
    1167      435979 :     sal_Int32 nIntValue = pValue->getInt();
    1168      871958 :     const OUString sStringValue = pValue->getString();
    1169      435979 :     PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
    1170             : 
    1171      435979 :     switch(nSprmId)
    1172             :     {
    1173             :     case NS_ooxml::LN_CT_PPrBase_jc:
    1174        8906 :         handleParaJustification(nIntValue, rContext, ExchangeLeftRight( rContext, m_pImpl ));
    1175        8906 :         break;
    1176             :     case NS_ooxml::LN_CT_PPrBase_keepLines:
    1177         762 :         rContext->Insert(PROP_PARA_SPLIT, uno::makeAny(nIntValue == 0));
    1178         762 :         break;
    1179             :     case NS_ooxml::LN_CT_PPrBase_keepNext:
    1180        2518 :         rContext->Insert(PROP_PARA_KEEP_TOGETHER, uno::makeAny( nIntValue != 0 ) );
    1181        2518 :         break;
    1182             :     case NS_ooxml::LN_CT_PPrBase_pageBreakBefore:
    1183         112 :         rContext->Insert(PROP_BREAK_TYPE, uno::makeAny(nIntValue ? style::BreakType_PAGE_BEFORE : style::BreakType_NONE));
    1184         112 :     break;
    1185             :     case NS_ooxml::LN_CT_NumPr_ilvl:
    1186        2801 :             if (nIntValue < 0 || 10 <= nIntValue) // Writer can't do everything
    1187             :             {
    1188             :                 SAL_INFO("writerfilter",
    1189             :                         "unsupported numbering level " << nIntValue);
    1190           1 :                 break;
    1191             :             }
    1192        2800 :             if( IsStyleSheetImport() )
    1193             :             {
    1194             :                 //style sheets cannot have a numbering rule attached
    1195         548 :                 StyleSheetPropertyMap* pStyleSheetPropertyMap = dynamic_cast< StyleSheetPropertyMap* >( rContext.get() );
    1196         548 :                 if (pStyleSheetPropertyMap)
    1197         546 :                     pStyleSheetPropertyMap->SetListLevel( (sal_Int16)nIntValue );
    1198             :             }
    1199             :             else
    1200        2252 :                 rContext->Insert( PROP_NUMBERING_LEVEL, uno::makeAny( (sal_Int16)nIntValue ));
    1201        2800 :         break;
    1202             :     case NS_ooxml::LN_CT_NumPr_numId:
    1203             :         {
    1204             :             //convert the ListTable entry to a NumberingRules propery and apply it
    1205        3729 :             ListsManager::Pointer pListTable = m_pImpl->GetListTable();
    1206        7458 :             ListDef::Pointer pList = pListTable->GetList( nIntValue );
    1207        3729 :             if( IsStyleSheetImport() )
    1208             :             {
    1209             :                 //style sheets cannot have a numbering rule attached
    1210         993 :                 StyleSheetPropertyMap* pStyleSheetPropertyMap = dynamic_cast< StyleSheetPropertyMap* >( rContext.get() );
    1211         993 :                 if (pStyleSheetPropertyMap)
    1212         991 :                     pStyleSheetPropertyMap->SetListId( nIntValue );
    1213             :             }
    1214        3729 :             if( pList.get( ) )
    1215             :             {
    1216        2454 :                 if( !IsStyleSheetImport() )
    1217             :                 {
    1218        2454 :                     uno::Any aRules = uno::makeAny( pList->GetNumberingRules( ) );
    1219        2454 :                     rContext->Insert( PROP_NUMBERING_RULES, aRules );
    1220             :                     // erase numbering from pStyle if already set
    1221        2454 :                     rContext->Erase(PROP_NUMBERING_STYLE_NAME);
    1222             :                 }
    1223             :             }
    1224             :             else
    1225             :             {
    1226        1275 :                 if( IsStyleSheetImport() )
    1227             :                 {
    1228             :                     // set the number id for AbstractNum references
    1229         993 :                     StyleSheetPropertyMap* pStyleSheetPropertyMap = dynamic_cast< StyleSheetPropertyMap* >( rContext.get() );
    1230         993 :                     if (pStyleSheetPropertyMap)
    1231         991 :                         pStyleSheetPropertyMap->SetNumId( nIntValue );
    1232             :                 }
    1233             :                 else
    1234             :                 {
    1235         282 :                     rContext->Insert( PROP_NUMBERING_STYLE_NAME, uno::makeAny( OUString() ) );
    1236             :                 }
    1237        3729 :             }
    1238             :         }
    1239        3729 :         break;
    1240             :     case NS_ooxml::LN_CT_PPrBase_suppressLineNumbers:
    1241        1343 :         rContext->Insert(PROP_PARA_LINE_NUMBER_COUNT, uno::makeAny( nIntValue == 0 ) );
    1242        1343 :         break;
    1243             :     case NS_ooxml::LN_inTbl:
    1244           0 :         break;
    1245             :     case NS_ooxml::LN_tblDepth:
    1246             :         //not handled via sprm but via text( 0x07 )
    1247           0 :     break;
    1248             :     case NS_ooxml::LN_CT_FramePr_w:
    1249           0 :         break;
    1250             :     case NS_ooxml::LN_CT_FramePr_wrap:
    1251           0 :         break;
    1252             : 
    1253             :     case NS_ooxml::LN_CT_PrBase_pBdr: //paragraph border
    1254         670 :         resolveSprmProps(*this, rSprm);
    1255         670 :     break;
    1256             :     case NS_ooxml::LN_CT_PBdr_top:
    1257             :     case NS_ooxml::LN_CT_PBdr_left:
    1258             :     case NS_ooxml::LN_CT_PBdr_bottom:
    1259             :     case NS_ooxml::LN_CT_PBdr_right:
    1260             :     case NS_ooxml::LN_CT_PBdr_between:
    1261             :     {
    1262         872 :         writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
    1263         872 :         if( pProperties.get())
    1264             :         {
    1265         872 :             BorderHandlerPtr pBorderHandler( new BorderHandler( true ) );
    1266         872 :             pProperties->resolve(*pBorderHandler);
    1267         872 :             PropertyIds eBorderId = PropertyIds( 0 );
    1268         872 :             PropertyIds eBorderDistId = PropertyIds( 0 );
    1269         872 :             switch( nSprmId )
    1270             :             {
    1271             :             case NS_ooxml::LN_CT_PBdr_top:
    1272         187 :                 eBorderId = PROP_TOP_BORDER;
    1273         187 :                 eBorderDistId = PROP_TOP_BORDER_DISTANCE;
    1274         187 :                 break;
    1275             :             case NS_ooxml::LN_CT_PBdr_left:
    1276         167 :                 eBorderId = PROP_LEFT_BORDER;
    1277         167 :                 eBorderDistId = PROP_LEFT_BORDER_DISTANCE;
    1278         167 :                 break;
    1279             :             case NS_ooxml::LN_CT_PBdr_bottom:
    1280         370 :                 eBorderId = PROP_BOTTOM_BORDER         ;
    1281         370 :                 eBorderDistId = PROP_BOTTOM_BORDER_DISTANCE;
    1282         370 :                 break;
    1283             :             case NS_ooxml::LN_CT_PBdr_right:
    1284         137 :                 eBorderId = PROP_RIGHT_BORDER;
    1285         137 :                 eBorderDistId = PROP_RIGHT_BORDER_DISTANCE ;
    1286         137 :                 break;
    1287             :             case NS_ooxml::LN_CT_PBdr_between:
    1288             :                 //not supported
    1289          11 :                 break;
    1290             :             default:;
    1291             :             }
    1292         872 :             if( eBorderId )
    1293         861 :                 rContext->Insert( eBorderId, uno::makeAny( pBorderHandler->getBorderLine()) , true);
    1294         872 :             if(eBorderDistId)
    1295         861 :                 rContext->Insert(eBorderDistId, uno::makeAny( pBorderHandler->getLineDistance()), true);
    1296         872 :             if (nSprmId == NS_ooxml::LN_CT_PBdr_right && pBorderHandler->getShadow())
    1297             :             {
    1298          14 :                 table::ShadowFormat aFormat = writerfilter::dmapper::PropertyMap::getShadowFromBorder(pBorderHandler->getBorderLine());
    1299          14 :                 rContext->Insert(PROP_PARA_SHADOW_FORMAT, uno::makeAny(aFormat));
    1300         872 :             }
    1301         872 :         }
    1302             :     }
    1303         872 :     break;
    1304             :     case NS_ooxml::LN_CT_PBdr_bar:
    1305           2 :         break;
    1306             :     case NS_ooxml::LN_CT_PPrBase_suppressAutoHyphens:
    1307         741 :         rContext->Insert(PROP_PARA_IS_HYPHENATION, uno::makeAny( nIntValue == 0 ));
    1308         741 :         break;
    1309             :     case NS_ooxml::LN_CT_FramePr_h:
    1310           0 :         break;
    1311             :     case NS_ooxml::LN_CT_PrBase_shd:
    1312             :     {
    1313             :         //contains fore color, back color and shadow percentage, results in a brush
    1314         287 :         writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
    1315         287 :         if( pProperties.get())
    1316             :         {
    1317         287 :             CellColorHandlerPtr pCellColorHandler( new CellColorHandler );
    1318         287 :             pCellColorHandler->setOutputFormat( CellColorHandler::Paragraph );
    1319         287 :             bool bEnableTempGrabBag = !pCellColorHandler->isInteropGrabBagEnabled();
    1320         287 :             if( bEnableTempGrabBag )
    1321         287 :                 pCellColorHandler->enableInteropGrabBag( "TempShdPropsGrabBag" );
    1322             : 
    1323         287 :             pProperties->resolve(*pCellColorHandler);
    1324         287 :             rContext->InsertProps(pCellColorHandler->getProperties());
    1325             : 
    1326         287 :             rContext->Insert(PROP_CHAR_THEME_FILL,  pCellColorHandler->getInteropGrabBag().Value, true, PARA_GRAB_BAG);
    1327         287 :             if(bEnableTempGrabBag)
    1328         287 :                 pCellColorHandler->disableInteropGrabBag();
    1329         287 :         }
    1330             :     }
    1331         287 :     break;
    1332             :     case NS_ooxml::LN_CT_FramePr_vSpace:
    1333           0 :         break;  // sprmPDyaFromText
    1334             :     case NS_ooxml::LN_CT_FramePr_hSpace:
    1335           0 :         break;  // sprmPDxaFromText
    1336             :     case NS_ooxml::LN_CT_FramePr_anchorLock:
    1337           0 :         break;
    1338             :     case NS_ooxml::LN_CT_PPrBase_widowControl:
    1339             :     {
    1340        3254 :         uno::Any aVal( uno::makeAny( sal_Int8(nIntValue ? 2 : 0 )));
    1341        3254 :         rContext->Insert( PROP_PARA_WIDOWS, aVal );
    1342        3254 :         rContext->Insert( PROP_PARA_ORPHANS, aVal );
    1343             :     }
    1344        3254 :     break;  // sprmPFWidowControl
    1345             :     case NS_ooxml::LN_CT_PPrBase_overflowPunct:
    1346         426 :         rContext->Insert(PROP_PARA_IS_HANGING_PUNCTUATION, uno::makeAny( nIntValue == 0 ));
    1347         426 :         break;
    1348             :     case NS_ooxml::LN_CT_PPrBase_topLinePunct:
    1349           0 :         break;
    1350             :     case NS_ooxml::LN_CT_PPrBase_autoSpaceDE:
    1351        1657 :         break;
    1352             :     case NS_ooxml::LN_CT_PPrBase_autoSpaceDN:
    1353         560 :         break;
    1354             :     case NS_ooxml::LN_CT_PPrBase_textAlignment:
    1355             :         {
    1356        1668 :             sal_Int16 nAlignment = 0;
    1357        1668 :             switch (nIntValue)
    1358             :             {
    1359             :                 case NS_ooxml::LN_Value_doc_ST_TextAlignment_top:
    1360          22 :                     nAlignment = 2;
    1361          22 :                     break;
    1362             :                 case NS_ooxml::LN_Value_doc_ST_TextAlignment_center:
    1363          26 :                     nAlignment = 3;
    1364          26 :                     break;
    1365             :                 case NS_ooxml::LN_Value_doc_ST_TextAlignment_baseline:
    1366         198 :                     nAlignment = 1;
    1367         198 :                     break;
    1368             :                 case NS_ooxml::LN_Value_doc_ST_TextAlignment_bottom:
    1369           0 :                     nAlignment = 4;
    1370           0 :                     break;
    1371             :                 case NS_ooxml::LN_Value_doc_ST_TextAlignment_auto:
    1372             :                 default:
    1373        1422 :                     break;
    1374             :             }
    1375        1668 :             rContext->Insert( PROP_PARA_VERT_ALIGNMENT, uno::makeAny( nAlignment) );
    1376             :         }
    1377        1668 :         break;
    1378             :     case NS_ooxml::LN_CT_PPrBase_textDirection:
    1379           6 :         break;
    1380             :     case NS_ooxml::LN_CT_PPrBase_outlineLvl:
    1381             :         {
    1382        3027 :             sal_Int16 nLvl = static_cast< sal_Int16 >( nIntValue );
    1383        3027 :             if( IsStyleSheetImport() )
    1384             :             {
    1385             : 
    1386        2599 :                 StyleSheetPropertyMap* pStyleSheetPropertyMap = dynamic_cast< StyleSheetPropertyMap* >( rContext.get() );
    1387        2599 :                 if (pStyleSheetPropertyMap)
    1388        2597 :                     pStyleSheetPropertyMap->SetOutlineLevel( nLvl );
    1389             :             }
    1390             :             else
    1391             :             {
    1392         428 :                 nLvl = nLvl >= WW_OUTLINE_MIN && nLvl < WW_OUTLINE_MAX? nLvl+1 : 0; //0 means no outline level set on
    1393         428 :                 rContext->Insert(PROP_OUTLINE_LEVEL, uno::makeAny ( nLvl ));
    1394             :             }
    1395             :         }
    1396        3027 :         break;
    1397             :     case NS_ooxml::LN_CT_PPrBase_bidi:
    1398             :         {
    1399        2344 :             if (nIntValue != 0)
    1400             :             {
    1401          26 :                 rContext->Insert(PROP_WRITING_MODE, uno::makeAny( text::WritingMode2::RL_TB ));
    1402          26 :                 rContext->Insert(PROP_PARA_ADJUST, uno::makeAny( style::ParagraphAdjust_RIGHT ));
    1403             :             }
    1404             :             else
    1405             :             {
    1406        2318 :                 rContext->Insert(PROP_WRITING_MODE, uno::makeAny( text::WritingMode2::LR_TB ));
    1407        2318 :                 rContext->Insert(PROP_PARA_ADJUST, uno::makeAny( style::ParagraphAdjust_LEFT ));
    1408             :             }
    1409             :         }
    1410             : 
    1411        2344 :         break;
    1412             :     case NS_ooxml::LN_EG_SectPrContents_bidi:
    1413          15 :         if (pSectionContext != nullptr)
    1414          15 :             pSectionContext->Insert(PROP_WRITING_MODE, uno::makeAny( text::WritingMode2::RL_TB));
    1415          15 :         break;
    1416             :     case NS_ooxml::LN_EG_RPrBase_highlight:
    1417             :         {
    1418             :             // OOXML import uses an ID
    1419         322 :             if( IsOOXMLImport() )
    1420             :             {
    1421         263 :                 sal_Int32 nColor = 0;
    1422         263 :                 if( getColorFromId(nIntValue, nColor) )
    1423         261 :                     rContext->Insert(PROP_CHAR_HIGHLIGHT, uno::makeAny( nColor ));
    1424             :             }
    1425             :             // RTF import uses the actual color value
    1426          59 :             else if( IsRTFImport() )
    1427             :             {
    1428          59 :                 rContext->Insert(PROP_CHAR_HIGHLIGHT, uno::makeAny( nIntValue ));
    1429             :             }
    1430             :         }
    1431         322 :         break;
    1432             :     case NS_ooxml::LN_EG_RPrBase_em:
    1433          64 :         rContext->Insert(PROP_CHAR_EMPHASIS, uno::makeAny ( getEmphasisValue (nIntValue)));
    1434          64 :         break;
    1435             :     case NS_ooxml::LN_EG_RPrBase_emboss:
    1436             :     case NS_ooxml::LN_EG_RPrBase_b:
    1437             :     case NS_ooxml::LN_EG_RPrBase_bCs:
    1438             :     case NS_ooxml::LN_EG_RPrBase_i:
    1439             :     case NS_ooxml::LN_EG_RPrBase_iCs:
    1440             :     case NS_ooxml::LN_EG_RPrBase_strike:
    1441             :     case NS_ooxml::LN_EG_RPrBase_dstrike:
    1442             :     case NS_ooxml::LN_EG_RPrBase_outline:
    1443             :     case NS_ooxml::LN_EG_RPrBase_shadow:
    1444             :     case NS_ooxml::LN_EG_RPrBase_caps:
    1445             :     case NS_ooxml::LN_EG_RPrBase_smallCaps:
    1446             :     case NS_ooxml::LN_EG_RPrBase_vanish:
    1447             :     case NS_ooxml::LN_EG_RPrBase_webHidden:
    1448             :         {
    1449       41231 :             PropertyIds ePropertyId = PROP_CHAR_WEIGHT; //initialized to prevent warning!
    1450       41231 :             switch( nSprmId )
    1451             :             {
    1452             :             case NS_ooxml::LN_EG_RPrBase_b:
    1453             :             case NS_ooxml::LN_EG_RPrBase_bCs:
    1454       29443 :                 ePropertyId = nSprmId != NS_ooxml::LN_EG_RPrBase_bCs ? PROP_CHAR_WEIGHT : PROP_CHAR_WEIGHT_COMPLEX;
    1455       29443 :                 break;
    1456             :             case NS_ooxml::LN_EG_RPrBase_i:
    1457             :             case NS_ooxml::LN_EG_RPrBase_iCs:
    1458        8162 :                 ePropertyId = nSprmId == NS_ooxml::LN_EG_RPrBase_i ? PROP_CHAR_POSTURE : PROP_CHAR_POSTURE_COMPLEX;
    1459        8162 :                 break;
    1460             :             case NS_ooxml::LN_EG_RPrBase_strike:
    1461             :             case NS_ooxml::LN_EG_RPrBase_dstrike:
    1462         245 :                 ePropertyId = PROP_CHAR_STRIKEOUT;
    1463         245 :                 break;
    1464             :             case NS_ooxml::LN_EG_RPrBase_outline:
    1465          54 :                 ePropertyId = PROP_CHAR_CONTOURED;
    1466          54 :                 break;
    1467             :             case NS_ooxml::LN_EG_RPrBase_shadow:
    1468          37 :                 ePropertyId = PROP_CHAR_SHADOWED;
    1469          37 :                 break;
    1470             :             case NS_ooxml::LN_EG_RPrBase_caps:
    1471             :             case NS_ooxml::LN_EG_RPrBase_smallCaps:
    1472        1073 :                 ePropertyId = PROP_CHAR_CASE_MAP;
    1473        1073 :                 break;
    1474             :             case NS_ooxml::LN_EG_RPrBase_vanish:
    1475             :             case NS_ooxml::LN_EG_RPrBase_webHidden:
    1476        2202 :                 ePropertyId = PROP_CHAR_HIDDEN;
    1477        2202 :                 break;
    1478             :             case NS_ooxml::LN_EG_RPrBase_emboss:
    1479          15 :                 ePropertyId = PROP_CHAR_RELIEF;
    1480          15 :                 break;
    1481             :             }
    1482             :             //expected: 0,1,128,129
    1483       41231 :             if(nIntValue != 128) //inherited from paragraph - ignore
    1484             :             {
    1485       41231 :                 if( nIntValue == 129) //inverted style sheet value
    1486             :                 {
    1487             :                     //get value from style sheet and invert it
    1488           0 :                     sal_Int16 nStyleValue = 0;
    1489           0 :                     uno::Any aStyleVal = m_pImpl->GetPropertyFromStyleSheet(ePropertyId);
    1490           0 :                     if( !aStyleVal.hasValue() )
    1491             :                     {
    1492             :                         nIntValue = 0x83a == nSprmId ?
    1493           0 :                             4 : 1;
    1494             :                     }
    1495           0 :                     else if(aStyleVal.getValueTypeClass() == uno::TypeClass_FLOAT )
    1496             :                     {
    1497           0 :                         double fDoubleValue = 0;
    1498             :                         //only in case of awt::FontWeight
    1499           0 :                         aStyleVal >>= fDoubleValue;
    1500           0 :                         nIntValue = fDoubleValue  > 100. ?  0 : 1;
    1501             :                     }
    1502           0 :                     else if((aStyleVal >>= nStyleValue) ||
    1503           0 :                             (nStyleValue = (sal_Int16)comphelper::getEnumAsINT32(aStyleVal)) >= 0 )
    1504             :                     {
    1505             :                         nIntValue = 0x83a == nSprmId ?
    1506             :                             nStyleValue ? 0 : 4 :
    1507           0 :                             nStyleValue ? 0 : 1;
    1508             :                     }
    1509             :                     else
    1510             :                     {
    1511             :                         OSL_FAIL( "what type was it");
    1512           0 :                     }
    1513             :                 }
    1514             : 
    1515       41231 :                 switch( nSprmId )
    1516             :                 {
    1517             :                     case NS_ooxml::LN_EG_RPrBase_b:
    1518             :                     case NS_ooxml::LN_EG_RPrBase_bCs:
    1519             :                     {
    1520       29443 :                         uno::Any aBold( uno::makeAny( nIntValue ? awt::FontWeight::BOLD : awt::FontWeight::NORMAL ) );
    1521             : 
    1522       29443 :                         rContext->Insert(ePropertyId, aBold );
    1523       29443 :                         if( nSprmId != NS_ooxml::LN_EG_RPrBase_bCs )
    1524       21438 :                             rContext->Insert(PROP_CHAR_WEIGHT_ASIAN, aBold );
    1525             : 
    1526       58886 :                         uno::Reference<beans::XPropertySet> xCharStyle(m_pImpl->GetCurrentNumberingCharStyle());
    1527       29443 :                         if (xCharStyle.is())
    1528         552 :                             xCharStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_CHAR_WEIGHT), aBold);
    1529       29443 :                         if (nSprmId == NS_ooxml::LN_EG_RPrBase_b)
    1530       21438 :                             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "b", OUString::number(nIntValue));
    1531        8005 :                         else if (nSprmId == NS_ooxml::LN_EG_RPrBase_bCs)
    1532       37448 :                             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "bCs", OUString::number(nIntValue));
    1533             :                     }
    1534       29443 :                     break;
    1535             :                     case NS_ooxml::LN_EG_RPrBase_i:
    1536             :                     case NS_ooxml::LN_EG_RPrBase_iCs:
    1537             :                     {
    1538        8162 :                         uno::Any aPosture( uno::makeAny( nIntValue ? awt::FontSlant_ITALIC : awt::FontSlant_NONE ) );
    1539        8162 :                         rContext->Insert( ePropertyId, aPosture );
    1540        8162 :                         if (nSprmId != NS_ooxml::LN_EG_RPrBase_iCs)
    1541        5589 :                             rContext->Insert(PROP_CHAR_POSTURE_ASIAN, aPosture );
    1542        8162 :                         if (nSprmId == NS_ooxml::LN_EG_RPrBase_i)
    1543        5589 :                             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "i", OUString::number(nIntValue));
    1544             :                     }
    1545        8162 :                     break;
    1546             :                     case NS_ooxml::LN_EG_RPrBase_strike:
    1547             :                         rContext->Insert(ePropertyId,
    1548         150 :                                          uno::makeAny( nIntValue ? awt::FontStrikeout::SINGLE : awt::FontStrikeout::NONE ) );
    1549         150 :                     break;
    1550             :                     case NS_ooxml::LN_EG_RPrBase_dstrike:
    1551             :                         rContext->Insert(ePropertyId,
    1552          95 :                                          uno::makeAny( nIntValue ? awt::FontStrikeout::DOUBLE : awt::FontStrikeout::NONE ) );
    1553          95 :                     break;
    1554             :                     case NS_ooxml::LN_EG_RPrBase_outline:
    1555             :                     case NS_ooxml::LN_EG_RPrBase_shadow:
    1556             :                     case NS_ooxml::LN_EG_RPrBase_vanish:
    1557             :                     case NS_ooxml::LN_EG_RPrBase_webHidden:
    1558        2293 :                         rContext->Insert(ePropertyId, uno::makeAny( nIntValue != 0 ));
    1559        2293 :                     break;
    1560             :                     case NS_ooxml::LN_EG_RPrBase_smallCaps:
    1561             :                         // If smallcaps would be just disabled and an other casemap is already inserted, don't do anything.
    1562         679 :                         if (nIntValue || !rContext->isSet(ePropertyId) )
    1563         640 :                             rContext->Insert(ePropertyId, uno::makeAny( nIntValue ? style::CaseMap::SMALLCAPS : style::CaseMap::NONE));
    1564         679 :                         m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "smallCaps", OUString::number(nIntValue));
    1565         679 :                     break;
    1566             :                     case NS_ooxml::LN_EG_RPrBase_caps:
    1567             :                         rContext->Insert(ePropertyId,
    1568         394 :                                          uno::makeAny( nIntValue ? style::CaseMap::UPPERCASE : style::CaseMap::NONE));
    1569         394 :                         m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "caps", OUString::number(nIntValue));
    1570         394 :                     break;
    1571             :                     case NS_ooxml::LN_EG_RPrBase_emboss:
    1572             :                         rContext->Insert(ePropertyId,
    1573          15 :                                          uno::makeAny( nIntValue ? awt::FontRelief::EMBOSSED : awt::FontRelief::NONE ));
    1574          15 :                     break;
    1575             : 
    1576             :                 }
    1577             :             }
    1578             :         }
    1579       41231 :         break;
    1580             :     case NS_ooxml::LN_EG_RPrBase_sz:
    1581             :     case NS_ooxml::LN_EG_RPrBase_szCs:
    1582             :         {
    1583             :             //multiples of half points (12pt == 24)
    1584       75710 :             double fVal = double(nIntValue) / 2.;
    1585       75710 :             uno::Any aVal = uno::makeAny( fVal );
    1586       75710 :             if( NS_ooxml::LN_EG_RPrBase_szCs == nSprmId )
    1587             :             {
    1588       33611 :                 rContext->Insert( PROP_CHAR_HEIGHT_COMPLEX, aVal );
    1589             :             }
    1590             :             else
    1591             :             {
    1592       42099 :                 bool bIgnore = false;
    1593       42099 :                 if (m_pImpl->m_bInTableStyleRunProps)
    1594             :                 {
    1595             :                     // If the default para style contains PROP_CHAR_HEIGHT, that should have priority over the table style.
    1596         130 :                     StyleSheetEntryPtr pTable = m_pImpl->GetStyleSheetTable()->FindDefaultParaStyle();
    1597         130 :                     if (pTable && pTable->pProperties->isSet(PROP_CHAR_HEIGHT) )
    1598          51 :                         bIgnore = true;
    1599             :                 }
    1600       42099 :                 if (!bIgnore)
    1601             :                 {
    1602             :                     //Asian get the same value as Western
    1603       42048 :                     rContext->Insert( PROP_CHAR_HEIGHT, aVal );
    1604       42048 :                     rContext->Insert( PROP_CHAR_HEIGHT_ASIAN, aVal );
    1605             : 
    1606       42048 :                     uno::Reference<beans::XPropertySet> xCharStyle(m_pImpl->GetCurrentNumberingCharStyle());
    1607       42048 :                     if (xCharStyle.is())
    1608         877 :                         xCharStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_CHAR_HEIGHT), aVal);
    1609             :                 }
    1610             :             }
    1611             :             // Make sure char sizes defined in the stylesheets don't affect char props from direct formatting.
    1612       75710 :             if (!IsStyleSheetImport())
    1613       48083 :                 m_pImpl->deferCharacterProperty( nSprmId, uno::makeAny( nIntValue ));
    1614       75710 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, (nSprmId == NS_ooxml::LN_EG_RPrBase_sz ? OUString("sz") : OUString("szCs")), OUString::number(nIntValue));
    1615             :         }
    1616       75710 :         break;
    1617             :     case NS_ooxml::LN_EG_RPrBase_position:
    1618             :         // The spec says 0 is the same as the lack of the value, so don't parse that.
    1619         295 :         if (nIntValue)
    1620          29 :             m_pImpl->deferCharacterProperty( nSprmId, uno::makeAny( nIntValue ));
    1621         295 :         break;
    1622             :     case NS_ooxml::LN_EG_RPrBase_spacing:
    1623             :         {
    1624             :             //Kerning half point values
    1625             :             //TODO: there are two kerning values -
    1626             :             // in ww8par6.cxx NS_sprm::LN_CHpsKern is used as boolean AutoKerning
    1627        1075 :             sal_Int16 nResult = static_cast<sal_Int16>(ConversionHelper::convertTwipToMM100(nIntValue));
    1628        1075 :             if (m_pImpl->IsInComments())
    1629             :             {
    1630          14 :                 nResult = static_cast<sal_Int16>(nIntValue);
    1631             :             }
    1632        1075 :             rContext->Insert(PROP_CHAR_CHAR_KERNING, uno::makeAny(nResult));
    1633        1075 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "spacing", OUString::number(nIntValue));
    1634             :         }
    1635        1075 :         break;
    1636             :     case NS_ooxml::LN_EG_RPrBase_kern: // auto kerning is bound to a minimum font size in Word - but not in Writer :-(
    1637        2032 :         rContext->Insert(PROP_CHAR_AUTO_KERNING, uno::makeAny( nIntValue != 0 ) );
    1638        2032 :         break;
    1639             :     case NS_ooxml::LN_EG_RPrBase_w:
    1640             :         rContext->Insert(PROP_CHAR_SCALE_WIDTH,
    1641          50 :                          uno::makeAny( sal_Int16(nIntValue) ));
    1642          50 :         break;
    1643             :     case NS_ooxml::LN_EG_RPrBase_imprint:
    1644             :         // FontRelief: NONE, EMBOSSED, ENGRAVED
    1645             :         rContext->Insert(PROP_CHAR_RELIEF,
    1646          12 :                          uno::makeAny( nIntValue ? awt::FontRelief::ENGRAVED : awt::FontRelief::NONE ));
    1647          12 :         break;
    1648             :     case NS_ooxml::LN_EG_RPrBase_effect:
    1649             :         // The file-format has many character animations. We have only
    1650             :         // one, so we use it always. Suboptimal solution though.
    1651          42 :         if (nIntValue)
    1652          42 :             rContext->Insert(PROP_CHAR_FLASH, uno::makeAny( true ));
    1653             :         else
    1654           0 :             rContext->Insert(PROP_CHAR_FLASH, uno::makeAny( false ));
    1655          42 :         break;
    1656             :     case NS_ooxml::LN_EG_RPrBase_rtl:
    1657          68 :         break;
    1658             :     case NS_ooxml::LN_EG_RPrBase_shd:
    1659             :         {
    1660             :             //contains fore color, back color and shadow percentage, results in a brush
    1661         694 :             writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
    1662         694 :             if( pProperties.get())
    1663             :             {
    1664         694 :                 CellColorHandlerPtr pCellColorHandler( new CellColorHandler );
    1665         694 :                 pCellColorHandler->setOutputFormat( CellColorHandler::Character );
    1666         694 :                 pProperties->resolve(*pCellColorHandler);
    1667         694 :                 rContext->InsertProps(pCellColorHandler->getProperties());
    1668         694 :                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_SHADING_MARKER, uno::makeAny(true), true, CHAR_GRAB_BAG );
    1669             :             }
    1670         694 :             break;
    1671             :         }
    1672             :     case NS_ooxml::LN_EG_SectPrContents_type:
    1673             :         /* break type
    1674             :           0 - No break
    1675             :           1 - New Column
    1676             :           2 - New page
    1677             :           3 - Even page
    1678             :           4 - odd page
    1679             :         */
    1680             :         OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
    1681         738 :         if(pSectionContext)
    1682             :         {
    1683             :             // Ignore continuous section break at the end of the document, if the previous section had the same type as well
    1684             :             // It makes the importer lose margin settings with no benefit
    1685         738 :             SectionPropertyMap* pLastContext = m_pImpl->GetLastSectionContext();
    1686         738 :             int nPrevBreakType = NS_ooxml::LN_Value_ST_SectionMark_continuous;
    1687         738 :             bool bHasPrevSection = false;
    1688         738 :             if (pLastContext)
    1689             :             {
    1690         127 :                 bHasPrevSection = true;
    1691         127 :                 nPrevBreakType = pLastContext->GetBreakType();
    1692             :             }
    1693         738 :             if (m_pImpl->GetParaSectpr() || nIntValue != static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_continuous) || (bHasPrevSection && nPrevBreakType != nIntValue))
    1694         696 :                 pSectionContext->SetBreakType( nIntValue );
    1695             :         }
    1696         738 :         break;
    1697             :     case NS_ooxml::LN_EG_SectPrContents_titlePg:
    1698             :     {
    1699             :         OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
    1700         157 :         if(pSectionContext)
    1701         157 :             pSectionContext->SetTitlePage( nIntValue > 0 );//section has title page
    1702             :     }
    1703         157 :     break;
    1704             :     case 165:
    1705             :     {
    1706             :         //page height, rounded to default values, default: 0x3dc0 twip
    1707           0 :         sal_Int32 nHeight = ConversionHelper::convertTwipToMM100( nIntValue );
    1708           0 :         rContext->Insert( PROP_HEIGHT, uno::makeAny( PaperInfo::sloppyFitPageDimension( nHeight ) ) );
    1709             :     }
    1710           0 :     break;
    1711             :     case NS_ooxml::LN_EG_SectPrContents_textDirection:
    1712             :     {
    1713             :         /* 0 HoriLR 1 Vert TR 2 Vert TR 3 Vert TT 4 HoriLT
    1714             :             only 0 and 1 can be imported correctly
    1715             :           */
    1716         633 :         sal_Int16 nDirection = text::WritingMode_LR_TB;
    1717         633 :         switch( nIntValue )
    1718             :         {
    1719             :             case NS_ooxml::LN_Value_ST_TextDirection_lrTb:
    1720             :             case NS_ooxml::LN_Value_ST_TextDirection_lrTbV:
    1721         632 :                 nDirection = text::WritingMode_LR_TB;
    1722         632 :             break;
    1723             :             case NS_ooxml::LN_Value_ST_TextDirection_tbRl:
    1724             :             case NS_ooxml::LN_Value_ST_TextDirection_btLr:
    1725           0 :                 nDirection = text::WritingMode_TB_RL;
    1726           0 :             break;
    1727             :             default:;
    1728             :         }
    1729             : 
    1730         633 :         PropertyMap * pTargetContext = rContext.get();
    1731             : 
    1732         633 :         if (pSectionContext != nullptr &&
    1733             :             nSprmId == NS_ooxml::LN_EG_SectPrContents_textDirection)
    1734             :         {
    1735         633 :             pTargetContext = pSectionContext;
    1736             :         }
    1737             : 
    1738         633 :         pTargetContext->Insert(PROP_WRITING_MODE, uno::makeAny( nDirection ) );
    1739             :     }
    1740         633 :     break;  // sprmSTextFlow
    1741             :         // the following are not part of the official documentation
    1742             :     case NS_ooxml::LN_CT_Tabs_tab:
    1743        7900 :         resolveSprmProps(*this, rSprm);
    1744        7900 :         m_pImpl->IncorporateTabStop(m_pImpl->m_aCurrentTabStop);
    1745        7900 :         m_pImpl->m_aCurrentTabStop = DeletableTabStop();
    1746        7900 :     break;
    1747             :     case NS_ooxml::LN_CT_PPrBase_tabs:
    1748             :     {
    1749             :         // Initialize tab stop vector from style sheet
    1750             :         // fdo#81033: for RTF, a tab stop is inherited from the style if it
    1751             :         // is also applied to the paragraph directly, and cleared if it is
    1752             :         // not applied to the paragraph directly => don't InitTabStopFromStyle
    1753        5013 :         if (!IsStyleSheetImport() && !IsRTFImport())
    1754             :         {
    1755        1576 :             uno::Any aValue = m_pImpl->GetPropertyFromStyleSheet(PROP_PARA_TAB_STOPS);
    1756        3152 :             uno::Sequence< style::TabStop > aStyleTabStops;
    1757        1576 :             if(aValue >>= aStyleTabStops)
    1758             :             {
    1759         244 :                 m_pImpl->InitTabStopFromStyle( aStyleTabStops );
    1760        1576 :             }
    1761             :         }
    1762        5013 :         resolveSprmProps(*this, rSprm);
    1763        5013 :         rContext->Insert(PROP_PARA_TAB_STOPS, uno::makeAny( m_pImpl->GetCurrentTabStopAndClear()));
    1764             :     }
    1765        5013 :     break;
    1766             : 
    1767             :     case NS_ooxml::LN_CT_DocDefaults_pPrDefault:
    1768             :     case NS_ooxml::LN_CT_DocDefaults_rPrDefault:
    1769           0 :         GetStyleSheetTable()->sprm( rSprm );
    1770           0 :     break;
    1771             :     case NS_ooxml::LN_EG_RPrBase_bdr:
    1772             :         {
    1773         188 :             writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
    1774         188 :             if( pProperties.get())
    1775             :             {
    1776         188 :                 BorderHandlerPtr pBorderHandler( new BorderHandler( true ) );
    1777         188 :                 pProperties->resolve(*pBorderHandler);
    1778             : 
    1779         188 :                 rContext->Insert( PROP_CHAR_TOP_BORDER, uno::makeAny( pBorderHandler->getBorderLine()));
    1780         188 :                 rContext->Insert( PROP_CHAR_BOTTOM_BORDER, uno::makeAny( pBorderHandler->getBorderLine()));
    1781         188 :                 rContext->Insert( PROP_CHAR_LEFT_BORDER, uno::makeAny( pBorderHandler->getBorderLine()));
    1782         188 :                 rContext->Insert( PROP_CHAR_RIGHT_BORDER, uno::makeAny( pBorderHandler->getBorderLine()));
    1783             : 
    1784         188 :                 rContext->Insert( PROP_CHAR_TOP_BORDER_DISTANCE, uno::makeAny( pBorderHandler->getLineDistance()));
    1785         188 :                 rContext->Insert( PROP_CHAR_BOTTOM_BORDER_DISTANCE, uno::makeAny( pBorderHandler->getLineDistance()));
    1786         188 :                 rContext->Insert( PROP_CHAR_LEFT_BORDER_DISTANCE, uno::makeAny( pBorderHandler->getLineDistance()));
    1787         188 :                 rContext->Insert( PROP_CHAR_RIGHT_BORDER_DISTANCE, uno::makeAny( pBorderHandler->getLineDistance()));
    1788             : 
    1789         188 :                 if( pBorderHandler->getShadow() )
    1790             :                 {
    1791           4 :                     table::ShadowFormat aFormat = writerfilter::dmapper::PropertyMap::getShadowFromBorder(pBorderHandler->getBorderLine());
    1792           4 :                     rContext->Insert(PROP_CHAR_SHADOW_FORMAT, uno::makeAny(aFormat));
    1793         188 :                 }
    1794         188 :             }
    1795             :         }
    1796         188 :         break;
    1797             :     case NS_ooxml::LN_CT_PPr_sectPr:
    1798             :     case NS_ooxml::LN_EG_RPrBase_color:
    1799             :     case NS_ooxml::LN_EG_RPrBase_rFonts:
    1800             :     case NS_ooxml::LN_EG_RPrBase_eastAsianLayout:
    1801             :     case NS_ooxml::LN_EG_RPrBase_u:
    1802             :     case NS_ooxml::LN_EG_RPrBase_lang:
    1803             :     case NS_ooxml::LN_CT_PPrBase_spacing:
    1804             :     case NS_ooxml::LN_CT_PPrBase_ind:
    1805             :     case NS_ooxml::LN_CT_RPrDefault_rPr:
    1806             :     case NS_ooxml::LN_CT_PPrDefault_pPr:
    1807             :     case NS_ooxml::LN_CT_Style_pPr:
    1808             :     case NS_ooxml::LN_CT_Style_rPr:
    1809             :     case NS_ooxml::LN_CT_PPr_rPr:
    1810             :     case NS_ooxml::LN_CT_PPrBase_numPr:
    1811             :     {
    1812      201741 :         bool bTempGrabBag = !m_pImpl->isInteropGrabBagEnabled();
    1813      201741 :         if (nSprmId == NS_ooxml::LN_CT_PPr_sectPr)
    1814         686 :             m_pImpl->SetParaSectpr(true);
    1815      201055 :         else if (nSprmId == NS_ooxml::LN_EG_RPrBase_color && bTempGrabBag)
    1816             :             // if DomainMapper grab bag is not enabled, enable it temporarily
    1817       17400 :             m_pImpl->enableInteropGrabBag("TempColorPropsGrabBag");
    1818      201741 :         resolveSprmProps(*this, rSprm);
    1819      201741 :         if (nSprmId == NS_ooxml::LN_CT_PPrBase_spacing)
    1820       19227 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "spacing", m_pImpl->m_aSubInteropGrabBag);
    1821      182514 :         else if (nSprmId == NS_ooxml::LN_EG_RPrBase_rFonts)
    1822       63398 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "rFonts", m_pImpl->m_aSubInteropGrabBag);
    1823      119116 :         else if (nSprmId == NS_ooxml::LN_EG_RPrBase_lang)
    1824       22182 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "lang", m_pImpl->m_aSubInteropGrabBag);
    1825       96934 :         else if (nSprmId == NS_ooxml::LN_EG_RPrBase_color)
    1826             :         {
    1827       18206 :             std::vector<beans::PropertyValue>::iterator aIter = m_pImpl->m_aSubInteropGrabBag.begin();
    1828       40192 :             for (; aIter != m_pImpl->m_aSubInteropGrabBag.end(); ++aIter)
    1829             :             {
    1830       21986 :                 if (aIter->Name == "val")
    1831       17791 :                     m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_ORIGINAL_COLOR, aIter->Value, true, CHAR_GRAB_BAG);
    1832        4195 :                 else if (aIter->Name == "themeColor")
    1833        2828 :                     m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_COLOR, aIter->Value, true, CHAR_GRAB_BAG);
    1834        1367 :                 else if (aIter->Name == "themeShade")
    1835         939 :                     m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_COLOR_SHADE, aIter->Value, true, CHAR_GRAB_BAG);
    1836         428 :                 else if (aIter->Name == "themeTint")
    1837         428 :                     m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_COLOR_TINT, aIter->Value, true, CHAR_GRAB_BAG);
    1838             :             }
    1839       18206 :             if (bTempGrabBag)
    1840             :                 //disable and clear DomainMapper grab bag if it wasn't enabled before
    1841       17400 :                 m_pImpl->disableInteropGrabBag();
    1842             : 
    1843       18206 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "color", m_pImpl->m_aSubInteropGrabBag);
    1844             :         }
    1845       78728 :         else if (nSprmId == NS_ooxml::LN_CT_PPrBase_ind)
    1846        8655 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ind", m_pImpl->m_aSubInteropGrabBag);
    1847             :     }
    1848      201741 :     break;
    1849             :     case NS_ooxml::LN_CT_PPrBase_wordWrap:
    1850          86 :         m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "wordWrap", "");
    1851          86 :     break;
    1852             :     case NS_ooxml::LN_EG_SectPrContents_footnotePr:
    1853             :     case NS_ooxml::LN_EG_SectPrContents_endnotePr:
    1854        1240 :         m_pImpl->SetInFootnoteProperties( NS_ooxml::LN_EG_SectPrContents_footnotePr == nSprmId );
    1855        1240 :         resolveSprmProps(*this, rSprm);
    1856        1240 :     break;
    1857             :     case NS_ooxml::LN_EG_SectPrContents_lnNumType:
    1858             :     {
    1859          27 :         resolveSprmProps(*this, rSprm);
    1860          27 :         LineNumberSettings aSettings = m_pImpl->GetLineNumberSettings();
    1861          27 :         aSettings.bIsOn = true;
    1862          27 :         m_pImpl->SetLineNumberSettings( aSettings );
    1863             :         //apply settings at XLineNumberingProperties
    1864             :         try
    1865             :         {
    1866          27 :             uno::Reference< text::XLineNumberingProperties > xLineNumberingProperties( m_pImpl->GetTextDocument(), uno::UNO_QUERY_THROW );
    1867          54 :             uno::Reference< beans::XPropertySet > xLineNumberingPropSet = xLineNumberingProperties->getLineNumberingProperties();
    1868          27 :             PropertyNameSupplier& rNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
    1869          27 :             xLineNumberingPropSet->setPropertyValue(rNameSupplier.GetName( PROP_IS_ON ), uno::makeAny(true) );
    1870          27 :             if( aSettings.nInterval )
    1871          27 :                 xLineNumberingPropSet->setPropertyValue(rNameSupplier.GetName( PROP_INTERVAL ), uno::makeAny((sal_Int16)aSettings.nInterval) );
    1872          27 :             if( aSettings.nDistance )
    1873          22 :                 xLineNumberingPropSet->setPropertyValue(rNameSupplier.GetName( PROP_DISTANCE ), uno::makeAny(aSettings.nDistance) );
    1874          54 :             xLineNumberingPropSet->setPropertyValue(rNameSupplier.GetName( PROP_RESTART_AT_EACH_PAGE ), uno::makeAny(aSettings.bRestartAtEachPage) );
    1875             :         }
    1876           0 :         catch( const uno::Exception& )
    1877             :         {
    1878             :         }
    1879             : 
    1880             :     }
    1881          27 :     break;
    1882             :     case NS_ooxml::LN_CT_PPrBase_framePr:
    1883             :     // Avoid frames if we're inside a structured document tag, would just cause outer tables fail to create.
    1884         515 :     if (!m_pImpl->GetSdt())
    1885             :     {
    1886         514 :         PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH);
    1887         514 :         if( pContext.get() )
    1888             :         {
    1889         433 :             ParagraphPropertyMap* pParaContext = dynamic_cast< ParagraphPropertyMap* >( pContext.get() );
    1890         433 :             if (pParaContext)
    1891         433 :                 pParaContext->SetFrameMode();
    1892             :         }
    1893             :         else
    1894             :         {
    1895             :             //TODO: What about style sheet import of frame properties
    1896             :         }
    1897         514 :         resolveSprmProps(*this, rSprm);
    1898             :     }
    1899         515 :     break;
    1900             :     case NS_ooxml::LN_EG_SectPrContents_pgSz:
    1901        1890 :         CT_PageSz.code = 0;
    1902             :         {
    1903        1890 :             PaperInfo aLetter(PAPER_LETTER);
    1904        1890 :             CT_PageSz.w = aLetter.getWidth();
    1905        1890 :             CT_PageSz.h = aLetter.getHeight();
    1906             :         }
    1907        1890 :         CT_PageSz.orient = false;
    1908        1890 :         resolveSprmProps(*this, rSprm);
    1909             :         OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
    1910        1890 :         if(pSectionContext)
    1911             :         {
    1912        1890 :             pSectionContext->Insert( PROP_HEIGHT, uno::makeAny( CT_PageSz.h ) );
    1913        1890 :             pSectionContext->Insert( PROP_IS_LANDSCAPE, uno::makeAny( CT_PageSz.orient ));
    1914        1890 :             pSectionContext->Insert( PROP_WIDTH, uno::makeAny( CT_PageSz.w ) );
    1915        1890 :             pSectionContext->SetLandscape( CT_PageSz.orient );
    1916             :         }
    1917        1890 :         break;
    1918             : 
    1919             :     case NS_ooxml::LN_EG_SectPrContents_pgMar:
    1920        1892 :         m_pImpl->InitPageMargins();
    1921        1892 :         resolveSprmProps(*this, rSprm);
    1922             :         OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
    1923        1892 :         if(pSectionContext)
    1924             :         {
    1925        1892 :             const _PageMar& rPageMar = m_pImpl->GetPageMargins();
    1926        1892 :             pSectionContext->SetTopMargin( rPageMar.top );
    1927        1892 :             pSectionContext->SetRightMargin( rPageMar.right );
    1928        1892 :             pSectionContext->SetBottomMargin( rPageMar.bottom );
    1929        1892 :             pSectionContext->SetLeftMargin( rPageMar.left );
    1930        1892 :             pSectionContext->SetHeaderTop( rPageMar.header );
    1931        1892 :             pSectionContext->SetHeaderBottom( rPageMar.footer );
    1932             :         }
    1933        1892 :         break;
    1934             : 
    1935             :     case NS_ooxml::LN_EG_SectPrContents_cols:
    1936             :     {
    1937        1085 :         writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
    1938        1085 :         if( pProperties.get())
    1939             :         {
    1940             : 
    1941        1085 :             SectionColumnHandlerPtr pSectHdl( new SectionColumnHandler );
    1942        1085 :             pProperties->resolve(*pSectHdl);
    1943        1085 :             if(pSectionContext && !m_pImpl->isInIndexContext())
    1944             :             {
    1945        1066 :                 if( pSectHdl->IsEqualWidth() )
    1946             :                 {
    1947          10 :                     pSectionContext->SetEvenlySpaced( true );
    1948          10 :                     pSectionContext->SetColumnCount( (sal_Int16) (pSectHdl->GetNum() - 1) );
    1949          10 :                     pSectionContext->SetColumnDistance( pSectHdl->GetSpace() );
    1950          10 :                     pSectionContext->SetSeparatorLine( pSectHdl->IsSeparator() );
    1951             :                 }
    1952        1056 :                 else if( !pSectHdl->GetColumns().empty() )
    1953             :                 {
    1954          21 :                     pSectionContext->SetEvenlySpaced( false );
    1955          21 :                     pSectionContext->SetColumnDistance( pSectHdl->GetSpace() );
    1956          21 :                     pSectionContext->SetColumnCount( (sal_Int16)(pSectHdl->GetColumns().size() -1));
    1957          21 :                     std::vector<_Column>::const_iterator tmpIter = pSectHdl->GetColumns().begin();
    1958          67 :                     for (; tmpIter != pSectHdl->GetColumns().end(); ++tmpIter)
    1959             :                     {
    1960          46 :                         pSectionContext->AppendColumnWidth( tmpIter->nWidth );
    1961          46 :                         if ((tmpIter != pSectHdl->GetColumns().end() - 1) || (tmpIter->nSpace > 0))
    1962          25 :                             pSectionContext->AppendColumnSpacing( tmpIter->nSpace );
    1963             :                     }
    1964          21 :                     pSectionContext->SetSeparatorLine( pSectHdl->IsSeparator() );
    1965             :                 }
    1966        1035 :                 else if( pSectHdl->GetNum() > 0 )
    1967             :                 {
    1968          24 :                     pSectionContext->SetColumnCount( (sal_Int16)pSectHdl->GetNum() - 1 );
    1969          24 :                     pSectionContext->SetColumnDistance( pSectHdl->GetSpace() );
    1970          24 :                     pSectionContext->SetSeparatorLine( pSectHdl->IsSeparator() );
    1971             :                 }
    1972             :             }
    1973             : 
    1974          19 :             else if ( pSectionContext )
    1975             :             {
    1976          19 :                 FieldContextPtr pContext = m_pImpl->GetTopFieldContext();
    1977          38 :                 uno::Reference< beans::XPropertySet > xTOC = pContext->GetTOC();
    1978          19 :                 if( xTOC.is() )
    1979             :                 {
    1980          19 :                     uno::Reference<text::XTextColumns> xTextColumns;
    1981          19 :                     xTOC->getPropertyValue(rPropNameSupplier.GetName( PROP_TEXT_COLUMNS )) >>= xTextColumns;
    1982          19 :                     if (xTextColumns.is())
    1983             :                     {
    1984          19 :                         uno::Reference< beans::XPropertySet > xColumnPropSet( xTextColumns, uno::UNO_QUERY_THROW );
    1985          19 :                         if ( xColumnPropSet.is() )
    1986          19 :                             xColumnPropSet->setPropertyValue( rPropNameSupplier.GetName( PROP_AUTOMATIC_DISTANCE ), uno::makeAny( pSectHdl->GetSpace() ));
    1987          19 :                         xTOC->setPropertyValue( rPropNameSupplier.GetName( PROP_TEXT_COLUMNS ), uno::makeAny( xTextColumns ) );
    1988          19 :                     }
    1989          19 :                 }
    1990        1085 :             }
    1991        1085 :         }
    1992             :     }
    1993        1085 :     break;
    1994             :     case NS_ooxml::LN_EG_SectPrContents_docGrid:
    1995        1446 :         resolveSprmProps(*this, rSprm);
    1996        1446 :     break;
    1997             :     case NS_ooxml::LN_EG_SectPrContents_pgBorders:
    1998             :     {
    1999          34 :         writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
    2000          34 :         if( pProperties.get( ) && pSectionContext )
    2001             :         {
    2002          34 :             PageBordersHandlerPtr pHandler( new PageBordersHandler );
    2003          34 :             pProperties->resolve( *pHandler );
    2004             : 
    2005             :             // Set the borders to the context and apply them to the styles
    2006          34 :             pHandler->SetBorders( pSectionContext );
    2007          34 :             pSectionContext->SetBorderParams( pHandler->GetDisplayOffset( ) );
    2008          34 :         }
    2009             :     }
    2010          34 :     break;
    2011             : 
    2012             :     case NS_ooxml::LN_CT_PPrBase_snapToGrid:
    2013          86 :         if (!IsStyleSheetImport()||!m_pImpl->isInteropGrabBagEnabled())
    2014             :         {
    2015          83 :             rContext->Insert( PROP_SNAP_TO_GRID, uno::makeAny(bool(nIntValue)));
    2016             :         }
    2017             :         else
    2018             :         {
    2019           3 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "snapToGrid", OUString::number(nIntValue));
    2020             :         }
    2021          86 :     break;
    2022             :     case NS_ooxml::LN_CT_PPrBase_pStyle:
    2023             :     {
    2024       15327 :         m_pImpl->SetCurrentParaStyleId( sStringValue );
    2025       15327 :         StyleSheetTablePtr pStyleTable = m_pImpl->GetStyleSheetTable();
    2026       30654 :         const OUString sConvertedStyleName = pStyleTable->ConvertStyleName( sStringValue, true );
    2027       15327 :         if (m_pImpl->GetTopContext() && m_pImpl->GetTopContextType() != CONTEXT_SECTION)
    2028       15327 :             m_pImpl->GetTopContext()->Insert( PROP_PARA_STYLE_NAME, uno::makeAny( sConvertedStyleName ));
    2029             :         //apply numbering to paragraph if it was set at the style, but only if the paragraph itself
    2030             :         //does not specify the numbering
    2031       15327 :         if( !rContext->isSet(PROP_NUMBERING_RULES) ) // !contains
    2032             :         {
    2033       15327 :             const StyleSheetEntryPtr pEntry = pStyleTable->FindStyleSheetByISTD(sStringValue);
    2034             :             OSL_ENSURE( pEntry.get(), "no style sheet found" );
    2035       15327 :             const StyleSheetPropertyMap* pStyleSheetProperties = dynamic_cast<const StyleSheetPropertyMap*>(pEntry ? pEntry->pProperties.get() : nullptr);
    2036             : 
    2037       15327 :             sal_Int32 nListId = pEntry ? lcl_getListId(pEntry, pStyleTable) : -1;
    2038       15327 :             if( pStyleSheetProperties && nListId >= 0 )
    2039             :             {
    2040             :                 rContext->Insert( PROP_NUMBERING_STYLE_NAME, uno::makeAny(
    2041         258 :                             ListDef::GetStyleName( nListId ) ), false);
    2042             : 
    2043             :                 // We're inheriting properties from a numbering style. Make sure a possible right margin is inherited from the base style.
    2044         258 :                 sal_Int32 nParaRightMargin = 0;
    2045         258 :                 if (!pEntry->sBaseStyleIdentifier.isEmpty())
    2046             :                 {
    2047         247 :                     const StyleSheetEntryPtr pParent = pStyleTable->FindStyleSheetByISTD(pEntry->sBaseStyleIdentifier);
    2048         247 :                     const StyleSheetPropertyMap* pParentProperties = dynamic_cast<const StyleSheetPropertyMap*>(pParent ? pParent->pProperties.get() : nullptr);
    2049         494 :                     boost::optional<PropertyMap::Property> pPropMargin;
    2050         247 :                     if (pParentProperties && (pPropMargin = pParentProperties->getProperty(PROP_PARA_RIGHT_MARGIN)) )
    2051         257 :                         nParaRightMargin = pPropMargin->second.get<sal_Int32>();
    2052             :                 }
    2053         258 :                 if (nParaRightMargin != 0)
    2054             :                 {
    2055             :                     // If we're setting the right margin, we should set the first / left margin as well from the numbering style.
    2056           1 :                     sal_Int32 nFirstLineIndent = lcl_getCurrentNumberingProperty(m_pImpl->GetCurrentNumberingRules(), pStyleSheetProperties->GetListLevel(), "FirstLineIndent");
    2057           1 :                     sal_Int32 nParaLeftMargin = lcl_getCurrentNumberingProperty(m_pImpl->GetCurrentNumberingRules(), pStyleSheetProperties->GetListLevel(), "IndentAt");
    2058           1 :                     if (nFirstLineIndent != 0)
    2059           1 :                         rContext->Insert(PROP_PARA_FIRST_LINE_INDENT, uno::makeAny(nFirstLineIndent));
    2060           1 :                     if (nParaLeftMargin != 0)
    2061           1 :                         rContext->Insert(PROP_PARA_LEFT_MARGIN, uno::makeAny(nParaLeftMargin));
    2062             : 
    2063           1 :                     rContext->Insert(PROP_PARA_RIGHT_MARGIN, uno::makeAny(nParaRightMargin));
    2064             :                 }
    2065             :             }
    2066             : 
    2067       15327 :             if( pStyleSheetProperties && pStyleSheetProperties->GetListLevel() >= 0 )
    2068         112 :                 rContext->Insert( PROP_NUMBERING_LEVEL, uno::makeAny(pStyleSheetProperties->GetListLevel()), false);
    2069       15327 :         }
    2070             :     }
    2071       15327 :     break;
    2072             :     case NS_ooxml::LN_EG_RPrBase_rStyle:
    2073             :         {
    2074        5935 :             OUString sConvertedName( m_pImpl->GetStyleSheetTable()->ConvertStyleName( sStringValue, true ) );
    2075             :             // First check if the style exists in the document.
    2076       11870 :             StyleSheetEntryPtr pEntry = m_pImpl->GetStyleSheetTable( )->FindStyleSheetByStyleName( sConvertedName );
    2077        5935 :             bool bExists = pEntry.get( ) && ( pEntry->nStyleTypeCode == STYLE_TYPE_CHAR );
    2078             : 
    2079             :             // Add the property if the style exists
    2080        5935 :             if ( bExists && m_pImpl->GetTopContext() )
    2081       11373 :                 m_pImpl->GetTopContext()->Insert( PROP_CHAR_STYLE_NAME, uno::makeAny( sConvertedName ) );
    2082             :         }
    2083        5935 :     break;
    2084             :     case NS_ooxml::LN_CT_TblPrBase_tblCellMar: //cell margins
    2085             :     {
    2086           0 :         resolveSprmProps(*this, rSprm);//contains LN_CT_TblCellMar_top, LN_CT_TblCellMar_left, LN_CT_TblCellMar_bottom, LN_CT_TblCellMar_right
    2087             :     }
    2088           0 :     break;
    2089             :     case NS_ooxml::LN_CT_TblCellMar_top:
    2090             :     case NS_ooxml::LN_CT_TblCellMar_start:
    2091             :     case NS_ooxml::LN_CT_TblCellMar_left:
    2092             :     case NS_ooxml::LN_CT_TblCellMar_bottom:
    2093             :     case NS_ooxml::LN_CT_TblCellMar_end:
    2094             :     case NS_ooxml::LN_CT_TblCellMar_right:
    2095             :     {
    2096           0 :         writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
    2097           0 :         if( pProperties.get())
    2098             :         {
    2099           0 :             MeasureHandlerPtr pMeasureHandler( new MeasureHandler );
    2100           0 :             pProperties->resolve(*pMeasureHandler);
    2101           0 :             sal_Int32 nMeasureValue = pMeasureHandler->getMeasureValue();
    2102           0 :             PropertyIds eId = META_PROP_CELL_MAR_TOP;
    2103           0 :             bool rtl = false; // TODO
    2104           0 :             switch(nSprmId)
    2105             :             {
    2106             :                 case NS_ooxml::LN_CT_TblCellMar_top:
    2107           0 :                 break;
    2108             :                 case NS_ooxml::LN_CT_TblCellMar_start:
    2109           0 :                     eId = rtl ? META_PROP_CELL_MAR_RIGHT : META_PROP_CELL_MAR_LEFT;
    2110           0 :                 break;
    2111             :                 case NS_ooxml::LN_CT_TblCellMar_left:
    2112           0 :                     eId = META_PROP_CELL_MAR_LEFT;
    2113           0 :                 break;
    2114             :                 case NS_ooxml::LN_CT_TblCellMar_bottom:
    2115           0 :                     eId = META_PROP_CELL_MAR_BOTTOM;
    2116           0 :                 break;
    2117             :                 case NS_ooxml::LN_CT_TblCellMar_end:
    2118           0 :                     eId = rtl ? META_PROP_CELL_MAR_LEFT : META_PROP_CELL_MAR_RIGHT;
    2119           0 :                 break;
    2120             :                 case NS_ooxml::LN_CT_TblCellMar_right:
    2121           0 :                     eId = META_PROP_CELL_MAR_RIGHT;
    2122           0 :                 break;
    2123             :                 default:;
    2124             :             }
    2125           0 :             rContext->Insert( eId, uno::makeAny(nMeasureValue), false);
    2126           0 :         }
    2127             :     }
    2128           0 :     break;
    2129             :     case NS_ooxml::LN_EG_RPrBase_noProof: // no grammar and spell checking, unsupported
    2130       10006 :     break;
    2131             :     case NS_ooxml::LN_anchor_anchor: // at_character drawing
    2132             :     case NS_ooxml::LN_inline_inline: // as_character drawing
    2133             :     {
    2134        1373 :         writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
    2135        1373 :         if( pProperties.get())
    2136             :         {
    2137             :             GraphicImportType eGraphicType =
    2138             :                 (NS_ooxml::LN_anchor_anchor ==
    2139        1373 :                  sal::static_int_cast<Id>(nSprmId)) ?
    2140             :                 IMPORT_AS_DETECTED_ANCHOR :
    2141        1373 :                 IMPORT_AS_DETECTED_INLINE;
    2142             :             GraphicImportPtr pGraphicImport =
    2143        1373 :                 m_pImpl->GetGraphicImport(eGraphicType);
    2144        1373 :             pProperties->resolve(*pGraphicImport);
    2145        1373 :             m_pImpl->ImportGraphic(pProperties, eGraphicType);
    2146        1373 :             if( !pGraphicImport->IsGraphic() )
    2147             :             {
    2148           0 :                 m_pImpl->ResetGraphicImport();
    2149             :                 // todo: It's a shape, now start shape import
    2150        1373 :             }
    2151        1373 :         }
    2152             :     }
    2153        1373 :     break;
    2154             :     case NS_ooxml::LN_EG_RPrBase_vertAlign:
    2155             :     {
    2156         560 :         sal_Int16 nEscapement = 0;
    2157         560 :         sal_Int8 nProp  = 58;
    2158         560 :         if ( sStringValue == "superscript" )
    2159         407 :                 nEscapement = 101;
    2160         153 :         else if ( sStringValue == "subscript" )
    2161          64 :                 nEscapement = -101;
    2162             :         else
    2163          89 :             nProp = 100;
    2164             : 
    2165         560 :         rContext->Insert(PROP_CHAR_ESCAPEMENT,         uno::makeAny( nEscapement ) );
    2166         560 :         rContext->Insert(PROP_CHAR_ESCAPEMENT_HEIGHT,  uno::makeAny( nProp ) );
    2167             :     }
    2168         560 :     break;
    2169             :     case NS_ooxml::LN_CT_FtnProps_pos:
    2170             :     //footnotes in word can be at page end or beneath text - writer supports only the first
    2171             :     //endnotes in word can be at section end or document end - writer supports only the latter
    2172             :     // -> so this property can be ignored
    2173           4 :     break;
    2174             :     case NS_ooxml::LN_EG_FtnEdnNumProps_numStart:
    2175             :     case NS_ooxml::LN_EG_FtnEdnNumProps_numRestart:
    2176             :     case NS_ooxml::LN_CT_FtnProps_numFmt:
    2177             :     case NS_ooxml::LN_CT_EdnProps_numFmt:
    2178             :     {
    2179             :         try
    2180             :         {
    2181        3027 :             uno::Reference< beans::XPropertySet >  xFtnEdnSettings;
    2182        3027 :             if( m_pImpl->IsInFootnoteProperties() )
    2183             :             {
    2184        1803 :                 uno::Reference< text::XFootnotesSupplier> xFootnotesSupplier( m_pImpl->GetTextDocument(), uno::UNO_QUERY );
    2185        1803 :                 if (xFootnotesSupplier.is())
    2186        1365 :                     xFtnEdnSettings = xFootnotesSupplier->getFootnoteSettings();
    2187             :             }
    2188             :             else
    2189             :             {
    2190        1224 :                 uno::Reference< text::XEndnotesSupplier> xEndnotesSupplier( m_pImpl->GetTextDocument(), uno::UNO_QUERY );
    2191        1224 :                 if (xEndnotesSupplier.is())
    2192         932 :                     xFtnEdnSettings = xEndnotesSupplier->getEndnoteSettings();
    2193             :             }
    2194        3027 :             if( NS_ooxml::LN_EG_FtnEdnNumProps_numStart == nSprmId && xFtnEdnSettings.is())
    2195             :             {
    2196         908 :                 xFtnEdnSettings->setPropertyValue(
    2197         908 :                     PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_START_AT),
    2198        1816 :                                                                     uno::makeAny( sal_Int16( nIntValue - 1 )));
    2199             :             }
    2200        2119 :             else if( NS_ooxml::LN_EG_FtnEdnNumProps_numRestart == nSprmId && xFtnEdnSettings.is())
    2201             :             {
    2202         450 :                 sal_Int16 nFootnoteCounting = 0;
    2203         450 :                 switch (nIntValue)
    2204             :                 {
    2205         440 :                     case NS_ooxml::LN_Value_ST_RestartNumber_continuous: nFootnoteCounting = text::FootnoteNumbering::PER_DOCUMENT; break;
    2206           5 :                     case NS_ooxml::LN_Value_ST_RestartNumber_eachPage: nFootnoteCounting = text::FootnoteNumbering::PER_PAGE; break;
    2207           5 :                     case NS_ooxml::LN_Value_ST_RestartNumber_eachSect: nFootnoteCounting = text::FootnoteNumbering::PER_CHAPTER; break;
    2208           0 :                     default: break;
    2209             :                 }
    2210         450 :                 xFtnEdnSettings->setPropertyValue(
    2211         450 :                         PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_FOOTNOTE_COUNTING ),
    2212         900 :                         uno::makeAny( nFootnoteCounting ));
    2213             :             }
    2214        1669 :             else if (xFtnEdnSettings.is())
    2215             :             {
    2216         939 :                 sal_Int16 nNumType = ConversionHelper::ConvertNumberingType( nIntValue );
    2217         939 :                 xFtnEdnSettings->setPropertyValue(
    2218         939 :                     PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_NUMBERING_TYPE),
    2219        1878 :                                                                     uno::makeAny( nNumType ));
    2220        3027 :             }
    2221             :         }
    2222           0 :         catch( const uno::Exception& )
    2223             :         {
    2224             :         }
    2225             :     }
    2226        3027 :     break;
    2227             :     case NS_ooxml::LN_paratrackchange:
    2228         224 :         m_pImpl->StartParaMarkerChange( );
    2229             :         /* fallthrough */
    2230             :     case NS_ooxml::LN_CT_PPr_pPrChange:
    2231             :     case NS_ooxml::LN_trackchange:
    2232             :     case NS_ooxml::LN_EG_RPrContent_rPrChange:
    2233             :     case NS_ooxml::LN_EG_RangeMarkupElements_customXmlDelRangeStart:
    2234             :     case NS_ooxml::LN_EG_RangeMarkupElements_customXmlDelRangeEnd:
    2235             :     case NS_ooxml::LN_EG_RangeMarkupElements_customXmlMoveFromRangeStart:
    2236             :     case NS_ooxml::LN_EG_RangeMarkupElements_customXmlMoveFromRangeEnd:
    2237             :     case NS_ooxml::LN_EG_RangeMarkupElements_customXmlMoveToRangeStart:
    2238             :     case NS_ooxml::LN_EG_RangeMarkupElements_customXmlMoveToRangeEnd:
    2239             :     {
    2240         993 :         HandleRedline( rSprm );
    2241             :     }
    2242         993 :     break;
    2243             :     case NS_ooxml::LN_endtrackchange:
    2244         166 :         m_pImpl->RemoveTopRedline();
    2245         166 :     break;
    2246             :     case NS_ooxml::LN_CT_RPrChange_rPr:
    2247             :     {
    2248             :         // Push all the current 'Character' properties to the stack, so that we don't store them
    2249             :         // as 'tracked changes' by mistake
    2250         462 :         m_pImpl->PushProperties(CONTEXT_CHARACTER);
    2251             : 
    2252             :         // Resolve all the properties that are under the 'rPrChange'->'rPr' XML node
    2253         462 :         resolveSprmProps(*this, rSprm );
    2254             : 
    2255             :         // Get all the properties that were processed in the 'rPrChange'->'rPr' XML node
    2256         462 :         uno::Sequence< beans::PropertyValue > currentRedlineRevertProperties = m_pImpl->GetTopContext()->GetPropertyValues();
    2257             : 
    2258             :         // Pop back out the character properties that were on the run
    2259         462 :         m_pImpl->PopProperties(CONTEXT_CHARACTER);
    2260             : 
    2261             :         // Store these properties in the current redline object (do it after the PopProperties() above, since
    2262             :         // otherwise it'd be stored in the content dropped there).
    2263         462 :         m_pImpl->SetCurrentRedlineRevertProperties( currentRedlineRevertProperties );
    2264             :     }
    2265         462 :     break;
    2266             :     case NS_ooxml::LN_CT_PPrChange_pPr:
    2267             :     {
    2268             :         // Push all the current 'Paragraph' properties to the stack, so that we don't store them
    2269             :         // as 'tracked changes' by mistake
    2270         137 :         m_pImpl->PushProperties(CONTEXT_PARAGRAPH);
    2271             : 
    2272             :         // Resolve all the properties that are under the 'pPrChange'->'pPr' XML node
    2273         137 :         resolveSprmProps(*this, rSprm );
    2274             : 
    2275             :         // Get all the properties that were processed in the 'pPrChange'->'pPr' XML node
    2276         137 :         uno::Sequence< beans::PropertyValue > currentRedlineRevertProperties = m_pImpl->GetTopContext()->GetPropertyValues();
    2277             : 
    2278             :         // Pop back out the character properties that were on the run
    2279         137 :         m_pImpl->PopProperties(CONTEXT_PARAGRAPH);
    2280             : 
    2281             :         // Store these properties in the current redline object (do it after the PopProperties() above, since
    2282             :         // otherwise it'd be stored in the content dropped there).
    2283         137 :         m_pImpl->SetCurrentRedlineRevertProperties( currentRedlineRevertProperties );
    2284             :     }
    2285         137 :     break;
    2286             :     case NS_ooxml::LN_object:
    2287             :     {
    2288         299 :         writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
    2289         299 :         if( pProperties.get( ) )
    2290             :         {
    2291         299 :             OLEHandlerPtr pOLEHandler( new OLEHandler(*this) );
    2292         299 :             pProperties->resolve(*pOLEHandler);
    2293         299 :             if ( pOLEHandler->isOLEObject( ) )
    2294             :             {
    2295          57 :                 OUString sStreamName = pOLEHandler->copyOLEOStream( m_pImpl->GetTextDocument() );
    2296          57 :                 if( !sStreamName.isEmpty() )
    2297             :                 {
    2298          55 :                     m_pImpl->appendOLE( sStreamName, pOLEHandler );
    2299          57 :                 }
    2300         299 :             }
    2301         299 :         }
    2302             :     }
    2303         299 :     break;
    2304             :     case NS_ooxml::LN_EG_HdrFtrReferences_headerReference: // header reference - not needed
    2305             :     case NS_ooxml::LN_EG_HdrFtrReferences_footerReference: // footer reference - not needed
    2306        1312 :     break;
    2307             :     case NS_ooxml::LN_EG_RPrBase_snapToGrid: // "Use document grid  settings for inter-paragraph spacing"
    2308         159 :     break;
    2309             :     case NS_ooxml::LN_CT_PPrBase_contextualSpacing:
    2310        1165 :         rContext->Insert(PROP_PARA_CONTEXT_MARGIN, uno::makeAny( nIntValue != 0 ));
    2311        1165 :     break;
    2312             :     case NS_ooxml::LN_CT_PPrBase_mirrorIndents: // mirrorIndents
    2313           3 :         rContext->Insert(PROP_MIRROR_INDENTS, uno::makeAny( nIntValue != 0 ), true, PARA_GRAB_BAG);
    2314           3 :     break;
    2315             :     case NS_ooxml::LN_EG_SectPrContents_formProt: //section protection, only form editing is enabled - unsupported
    2316             :     case NS_ooxml::LN_EG_SectPrContents_vAlign:
    2317             :     case NS_ooxml::LN_EG_RPrBase_fitText:
    2318         778 :     break;
    2319             :     case NS_ooxml::LN_ffdata:
    2320             :     {
    2321          63 :         writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
    2322          63 :         if (pProperties.get() != nullptr)
    2323             :         {
    2324          63 :             FFDataHandler::Pointer_t pFFDataHandler(new FFDataHandler());
    2325             : 
    2326          63 :             pProperties->resolve(*pFFDataHandler);
    2327          63 :             m_pImpl->SetFieldFFData(pFFDataHandler);
    2328          63 :         }
    2329             :     }
    2330          63 :     break;
    2331             :     case NS_ooxml::LN_CT_SdtPr_dropDownList:
    2332             :     case NS_ooxml::LN_CT_SdtPr_comboBox:
    2333             :     {
    2334          16 :         writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
    2335          16 :         if (pProperties.get() != nullptr)
    2336          16 :             pProperties->resolve(*this);
    2337             :     }
    2338          16 :     break;
    2339             :     case NS_ooxml::LN_CT_SdtDropDownList_listItem:
    2340             :     {
    2341          62 :         writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
    2342          62 :         if (pProperties.get() != nullptr)
    2343          62 :             pProperties->resolve(*this);
    2344             :     }
    2345          62 :     break;
    2346             :     case NS_ooxml::LN_CT_SdtPr_date:
    2347             :     {
    2348          35 :         if (!IsInHeaderFooter())
    2349          18 :             resolveSprmProps(*this, rSprm);
    2350             :         else
    2351             :         {
    2352          17 :             OUString sName = "ooxml:CT_SdtPr_date";
    2353          17 :             enableInteropGrabBag(sName);
    2354          17 :             resolveSprmProps(*this, rSprm);
    2355          17 :             m_pImpl->m_pSdtHelper->appendToInteropGrabBag(getInteropGrabBag());
    2356          17 :             m_pImpl->disableInteropGrabBag();
    2357             :         }
    2358             :     }
    2359          35 :     break;
    2360             :     case NS_ooxml::LN_CT_SdtDate_dateFormat:
    2361             :     {
    2362          35 :         if (!IsInHeaderFooter())
    2363          18 :             m_pImpl->m_pSdtHelper->getDateFormat().append(sStringValue);
    2364             :         else
    2365          17 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtDate_dateFormat", sStringValue);
    2366             :     }
    2367          35 :     break;
    2368             :     case NS_ooxml::LN_CT_SdtDate_storeMappedDataAs:
    2369             :     {
    2370          35 :         if (IsInHeaderFooter())
    2371          17 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtDate_storeMappedDataAs", sStringValue);
    2372             :     }
    2373          35 :     break;
    2374             :     case NS_ooxml::LN_CT_SdtDate_calendar:
    2375             :     {
    2376          35 :         if (IsInHeaderFooter())
    2377          17 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtDate_calendar", sStringValue);
    2378             :     }
    2379          35 :     break;
    2380             :     case NS_ooxml::LN_CT_SdtDate_lid:
    2381             :     {
    2382          35 :         if (!IsInHeaderFooter())
    2383          18 :             m_pImpl->m_pSdtHelper->getLocale().append(sStringValue);
    2384             :         else
    2385          17 :             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtDate_lid", sStringValue);
    2386             :     }
    2387          35 :     break;
    2388             :     case NS_ooxml::LN_CT_SdtPr_dataBinding:
    2389             :     case NS_ooxml::LN_CT_SdtPr_equation:
    2390             :     case NS_ooxml::LN_CT_SdtPr_checkbox:
    2391             :     case NS_ooxml::LN_CT_SdtPr_docPartObj:
    2392             :     case NS_ooxml::LN_CT_SdtPr_docPartList:
    2393             :     case NS_ooxml::LN_CT_SdtPr_picture:
    2394             :     case NS_ooxml::LN_CT_SdtPr_citation:
    2395             :     case NS_ooxml::LN_CT_SdtPr_group:
    2396             :     case NS_ooxml::LN_CT_SdtPr_text:
    2397             :     case NS_ooxml::LN_CT_SdtPr_id:
    2398             :     case NS_ooxml::LN_CT_SdtPr_alias:
    2399             :     {
    2400             :         // this is an unsupported SDT property, create a grab bag for it
    2401         944 :         OUString sName;
    2402         944 :         switch (nSprmId)
    2403             :         {
    2404          99 :             case NS_ooxml::LN_CT_SdtPr_dataBinding: sName = "ooxml:CT_SdtPr_dataBinding"; break;
    2405           0 :             case NS_ooxml::LN_CT_SdtPr_equation:    sName = "ooxml:CT_SdtPr_equation"; break;
    2406          18 :             case NS_ooxml::LN_CT_SdtPr_checkbox:    sName = "ooxml:CT_SdtPr_checkbox"; break;
    2407         144 :             case NS_ooxml::LN_CT_SdtPr_docPartObj:  sName = "ooxml:CT_SdtPr_docPartObj"; break;
    2408           0 :             case NS_ooxml::LN_CT_SdtPr_docPartList: sName = "ooxml:CT_SdtPr_docPartList"; break;
    2409           5 :             case NS_ooxml::LN_CT_SdtPr_picture:     sName = "ooxml:CT_SdtPr_picture"; break;
    2410          21 :             case NS_ooxml::LN_CT_SdtPr_citation:    sName = "ooxml:CT_SdtPr_citation"; break;
    2411           3 :             case NS_ooxml::LN_CT_SdtPr_group:       sName = "ooxml:CT_SdtPr_group"; break;
    2412         150 :             case NS_ooxml::LN_CT_SdtPr_text:        sName = "ooxml:CT_SdtPr_text"; break;
    2413         379 :             case NS_ooxml::LN_CT_SdtPr_id:          sName = "ooxml:CT_SdtPr_id"; break;
    2414         125 :             case NS_ooxml::LN_CT_SdtPr_alias:       sName = "ooxml:CT_SdtPr_alias"; break;
    2415             :             default: assert(false);
    2416             :         };
    2417         944 :         enableInteropGrabBag(sName);
    2418             : 
    2419             :         // process subitems
    2420         944 :         writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
    2421         944 :         if (pProperties.get() != nullptr)
    2422         261 :             pProperties->resolve(*this);
    2423             : 
    2424         944 :         if (nSprmId == NS_ooxml::LN_CT_SdtPr_alias)
    2425             :         {
    2426         125 :             beans::PropertyValue aValue;
    2427         125 :             aValue.Name = sName;
    2428         125 :             aValue.Value <<= sStringValue;
    2429         125 :             m_pImpl->m_pSdtHelper->appendToInteropGrabBag(aValue);
    2430             :         }
    2431             :         else
    2432         819 :             m_pImpl->m_pSdtHelper->appendToInteropGrabBag(getInteropGrabBag());
    2433         944 :         m_pImpl->m_pSdtHelper->setOutsideAParagraph(m_pImpl->IsOutsideAParagraph());
    2434         944 :         m_pImpl->disableInteropGrabBag();
    2435             :     }
    2436         944 :     break;
    2437             :     case NS_ooxml::LN_CT_SdtCheckbox_checked:
    2438          18 :         m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtCheckbox_checked", sStringValue);
    2439          18 :         break;
    2440             :     case NS_ooxml::LN_CT_SdtCheckbox_checkedState:
    2441          18 :         m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtCheckbox_checkedState", sStringValue);
    2442          18 :         break;
    2443             :     case NS_ooxml::LN_CT_SdtCheckbox_uncheckedState:
    2444          18 :         m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtCheckbox_uncheckedState", sStringValue);
    2445          18 :         break;
    2446             :     case NS_ooxml::LN_CT_SdtDocPart_docPartGallery:
    2447         147 :         m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtDocPart_docPartGallery", sStringValue);
    2448         147 :         break;
    2449             :     case NS_ooxml::LN_CT_SdtDocPart_docPartCategory:
    2450           0 :         m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtDocPart_docPartCategory", sStringValue);
    2451           0 :         break;
    2452             :     case NS_ooxml::LN_CT_SdtDocPart_docPartUnique:
    2453         147 :         m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtDocPart_docPartUnique", sStringValue);
    2454         147 :         break;
    2455             :     case NS_ooxml::LN_EG_SectPrContents_pgNumType:
    2456             :     {
    2457         676 :         writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
    2458         676 :         if( pProperties.get())
    2459             :         {
    2460         676 :             pProperties->resolve(*this);
    2461         676 :         }
    2462             :     }
    2463         676 :     break;
    2464             :     case NS_ooxml::LN_tblStart:
    2465             : 
    2466             :         /*
    2467             :          * Hack for Importing Section Properties
    2468             :          * LO is not able to import section properties if first element in the
    2469             :          * section is a table. So in case first element is a table add a dummy para
    2470             :          * and remove it again when lcl_endSectionGroup is called
    2471             :          */
    2472        1548 :         if(m_pImpl->m_nTableDepth == 0 && m_pImpl->GetIsFirstParagraphInSection()
    2473         729 :                 && !m_pImpl->GetIsDummyParaAddedForTableInSection() && !m_pImpl->GetIsTextFrameInserted())
    2474             :         {
    2475         148 :             m_pImpl->AddDummyParaForTableInSection();
    2476             :         }
    2477         539 :         m_pImpl->m_nTableDepth++;
    2478             : 
    2479         539 :     break;
    2480             :     case NS_ooxml::LN_tblEnd:
    2481         525 :         m_pImpl->m_nTableDepth--;
    2482         525 :     break;
    2483             :     case NS_ooxml::LN_glow_glow:
    2484             :     case NS_ooxml::LN_shadow_shadow:
    2485             :     case NS_ooxml::LN_reflection_reflection:
    2486             :     case NS_ooxml::LN_textOutline_textOutline:
    2487             :     case NS_ooxml::LN_textFill_textFill:
    2488             :     case NS_ooxml::LN_scene3d_scene3d:
    2489             :     case NS_ooxml::LN_props3d_props3d:
    2490             :     case NS_ooxml::LN_ligatures_ligatures:
    2491             :     case NS_ooxml::LN_numForm_numForm:
    2492             :     case NS_ooxml::LN_numSpacing_numSpacing:
    2493             :     case NS_ooxml::LN_stylisticSets_stylisticSets:
    2494             :     case NS_ooxml::LN_cntxtAlts_cntxtAlts:
    2495             :     {
    2496         435 :         TextEffectsHandlerPtr pTextEffectsHandlerPtr( new TextEffectsHandler(nSprmId) );
    2497         870 :         boost::optional<PropertyIds> aPropertyId = pTextEffectsHandlerPtr->getGrabBagPropertyId();
    2498         435 :         if(aPropertyId)
    2499             :         {
    2500         435 :             writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
    2501         435 :             if( pProperties.get())
    2502             :             {
    2503         435 :                 pProperties->resolve(*pTextEffectsHandlerPtr);
    2504             : 
    2505         435 :                 rContext->Insert(*aPropertyId, uno::makeAny(pTextEffectsHandlerPtr->getInteropGrabBag()), true, CHAR_GRAB_BAG);
    2506         435 :             }
    2507         435 :         }
    2508             :     }
    2509         435 :     break;
    2510             :     case NS_ooxml::LN_CT_SdtPr_rPr:
    2511             :     {
    2512             :         // Make sure properties from a pervious SDT are not merged with the current ones.
    2513         166 :         m_pImpl->m_pSdtHelper->getInteropGrabBagAndClear();
    2514             :     }
    2515         166 :     break;
    2516             :     case NS_ooxml::LN_CT_TblPrBase_tblLook:
    2517             :     {
    2518        2583 :         writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
    2519        2583 :         if (pProperties.get())
    2520             :         {
    2521        2583 :             pProperties->resolve(*this);
    2522        2583 :             m_pImpl->getTableManager().finishTableLook();
    2523        2583 :         }
    2524             :     }
    2525        2583 :     break;
    2526             :     case NS_ooxml::LN_CT_TrPrBase_cnfStyle:
    2527             :     {
    2528         280 :         m_pImpl->enableInteropGrabBag("cnfStyle");
    2529         280 :         resolveSprmProps(*this, rSprm);
    2530             : 
    2531         280 :         TablePropertyMapPtr pPropMap(new TablePropertyMap());
    2532         280 :         pPropMap->Insert(PROP_ROW_CNF_STYLE, uno::makeAny(comphelper::containerToSequence(m_pImpl->m_aInteropGrabBag)), true, ROW_GRAB_BAG);
    2533         280 :         m_pImpl->getTableManager().insertRowProps(pPropMap);
    2534             : 
    2535         280 :         m_pImpl->disableInteropGrabBag();
    2536             :     }
    2537         280 :     break;
    2538             :     case NS_ooxml::LN_CT_TcPrBase_cnfStyle:
    2539             :     {
    2540         283 :         m_pImpl->enableInteropGrabBag("cnfStyle");
    2541         283 :         resolveSprmProps(*this, rSprm);
    2542             : 
    2543         283 :         TablePropertyMapPtr pPropMap(new TablePropertyMap());
    2544         283 :         pPropMap->Insert(PROP_CELL_CNF_STYLE, uno::makeAny(comphelper::containerToSequence(m_pImpl->m_aInteropGrabBag)), true, CELL_GRAB_BAG);
    2545         283 :         m_pImpl->getTableManager().cellProps(pPropMap);
    2546             : 
    2547         283 :         m_pImpl->disableInteropGrabBag();
    2548             :     }
    2549         283 :     break;
    2550             :     case NS_ooxml::LN_CT_PPrBase_cnfStyle:
    2551             :     {
    2552        1055 :         m_pImpl->enableInteropGrabBag("cnfStyle");
    2553        1055 :         resolveSprmProps(*this, rSprm);
    2554        1055 :         rContext->Insert(PROP_PARA_CNF_STYLE, uno::makeAny(comphelper::containerToSequence(m_pImpl->m_aInteropGrabBag)), true, PARA_GRAB_BAG);
    2555        1055 :         m_pImpl->disableInteropGrabBag();
    2556             :     }
    2557        1055 :     break;
    2558             :     default:
    2559             :         {
    2560             : #ifdef DEBUG_WRITERFILTER
    2561             :             TagLogger::getInstance().startElement("unhandled");
    2562             :             TagLogger::getInstance().attribute("id", nSprmId);
    2563             :             TagLogger::getInstance().attribute("name", rSprm.getName());
    2564             :             TagLogger::getInstance().endElement();
    2565             : #endif
    2566             :         }
    2567      435979 :     }
    2568             : }
    2569             : 
    2570         642 : void DomainMapper::setInTableStyleRunProps(bool bInTableStyleRunProps)
    2571             : {
    2572         642 :     m_pImpl->m_bInTableStyleRunProps = bInTableStyleRunProps;
    2573         642 : }
    2574             : 
    2575       16771 : void DomainMapper::processDeferredCharacterProperties( const std::map< sal_Int32, uno::Any >& deferredCharacterProperties )
    2576             : {
    2577             :     assert( m_pImpl->GetTopContextType() == CONTEXT_CHARACTER );
    2578       16771 :     PropertyMapPtr rContext = m_pImpl->GetTopContext();
    2579      130374 :     for( std::map< sal_Int32, uno::Any >::const_iterator it = deferredCharacterProperties.begin();
    2580       86916 :          it != deferredCharacterProperties.end();
    2581             :          ++it )
    2582             :     {
    2583       26687 :         sal_Int32 Id = it->first;
    2584       26687 :         sal_Int32 nIntValue = 0;
    2585       26687 :         OUString sStringValue;
    2586       26687 :         it->second >>= nIntValue;
    2587       26687 :         it->second >>= sStringValue;
    2588       26687 :         switch( Id )
    2589             :         {
    2590             :         case NS_ooxml::LN_EG_RPrBase_sz:
    2591             :         case NS_ooxml::LN_EG_RPrBase_szCs:
    2592       26678 :         break; // only for use by other properties, ignore here
    2593             :         case NS_ooxml::LN_EG_RPrBase_position:
    2594             :         {
    2595           9 :             sal_Int16 nEscapement = 0;
    2596           9 :             sal_Int8 nProp  = 100;
    2597           9 :             if(nIntValue == 0)
    2598           0 :                 nProp = 0;
    2599             :             else
    2600             :             {
    2601           9 :                 std::map< sal_Int32, uno::Any >::const_iterator font = deferredCharacterProperties.find( NS_ooxml::LN_EG_RPrBase_sz );
    2602           9 :                 PropertyMapPtr pDefaultCharProps = m_pImpl->GetStyleSheetTable()->GetDefaultCharProps();
    2603          18 :                 boost::optional<PropertyMap::Property> aDefaultFont = pDefaultCharProps->getProperty(PROP_CHAR_HEIGHT);
    2604           9 :                 if( font != deferredCharacterProperties.end())
    2605             :                 {
    2606           6 :                     double fontSize = 0;
    2607           6 :                     font->second >>= fontSize;
    2608           6 :                     nEscapement = nIntValue * 100 / fontSize;
    2609             :                 }
    2610             :                 // TODO if not direct formatting, check the style first, not directly the default char props.
    2611           3 :                 else if (aDefaultFont)
    2612             :                 {
    2613           3 :                     double fHeight = 0;
    2614           3 :                     aDefaultFont->second >>= fHeight;
    2615             :                     // fHeight is in points, nIntValue is in half points, nEscapement is in percents.
    2616           3 :                     nEscapement = nIntValue * 100 / fHeight / 2;
    2617             :                 }
    2618             :                 else
    2619             :                 { // TODO: Find out the font size. The 58/-58 values were here previous, but I have
    2620             :                   // no idea what they are (they are probably some random guess that did fit whatever
    2621             :                   // specific case somebody was trying to fix).
    2622           0 :                     nEscapement = ( nIntValue > 0 ) ? 58: -58;
    2623           9 :                 }
    2624             :             }
    2625           9 :             rContext->Insert(PROP_CHAR_ESCAPEMENT,         uno::makeAny( nEscapement ) );
    2626           9 :             rContext->Insert(PROP_CHAR_ESCAPEMENT_HEIGHT,  uno::makeAny( nProp ) );
    2627             :         }
    2628           9 :         break;
    2629             :         default:
    2630             :             SAL_WARN( "writerfilter", "Unhandled property in processDeferredCharacterProperty()" );
    2631           0 :             break;
    2632             :         }
    2633       43458 :     }
    2634       16771 : }
    2635             : 
    2636           0 : void DomainMapper::lcl_entry(int /*pos*/,
    2637             :                          writerfilter::Reference<Properties>::Pointer_t ref)
    2638             : {
    2639           0 :     ref->resolve(*this);
    2640           0 : }
    2641             : 
    2642           0 : void DomainMapper::data(const sal_uInt8* /*buf*/, size_t /*len*/,
    2643             :                         writerfilter::Reference<Properties>::Pointer_t /*ref*/)
    2644             : {
    2645           0 : }
    2646             : 
    2647        2281 : void DomainMapper::lcl_startSectionGroup()
    2648             : {
    2649        2281 :     if (!m_pImpl->isInIndexContext() && !m_pImpl->isInBibliographyContext())
    2650             :     {
    2651        2261 :         m_pImpl->PushProperties(CONTEXT_SECTION);
    2652             :     }
    2653        2281 :     m_pImpl->SetIsFirstParagraphInSection(true);
    2654        2281 : }
    2655             : 
    2656        2276 : void DomainMapper::lcl_endSectionGroup()
    2657             : {
    2658        2276 :     if (!m_pImpl->isInIndexContext() && !m_pImpl->isInBibliographyContext())
    2659             :     {
    2660        2256 :         m_pImpl->CheckUnregisteredFrameConversion();
    2661        2256 :         m_pImpl->ExecuteFrameConversion();
    2662             :         // First paragraph in a footnote doesn't count: that would create
    2663             :         // additional paragraphs before and after the real footnote content.
    2664             :         // Also, when pasting, it's fine to not have any paragraph inside the document at all.
    2665        2256 :         if (m_pImpl->GetIsFirstParagraphInSection() && !m_pImpl->IsInFootOrEndnote() && m_pImpl->IsNewDoc())
    2666             :         {
    2667             :             // This section has no paragraph at all (e.g. they are all actually in a frame).
    2668             :             // If this section has a page break, there would be nothing to apply to the page
    2669             :             // style, so force a dummy paragraph.
    2670           5 :             lcl_startParagraphGroup();
    2671           5 :             lcl_startCharacterGroup();
    2672           5 :             sal_uInt8 sBreak[] = { 0xd };
    2673           5 :             lcl_text(sBreak, 1);
    2674           5 :             lcl_endCharacterGroup();
    2675           5 :             lcl_endParagraphGroup();
    2676             :         }
    2677        2256 :         PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_SECTION);
    2678        2256 :         SectionPropertyMap* pSectionContext = dynamic_cast< SectionPropertyMap* >( pContext.get() );
    2679             :         OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
    2680        2256 :         if(pSectionContext)
    2681             :         {
    2682        2256 :             pSectionContext->CloseSectionGroup( *m_pImpl );
    2683             :             // Remove the dummy paragraph if added for
    2684             :             // handling the section properties if section starts with a table
    2685        2256 :             if (m_pImpl->GetIsDummyParaAddedForTableInSection())
    2686         179 :                 m_pImpl->RemoveDummyParaForTableInSection();
    2687             :         }
    2688        2256 :         m_pImpl->PopProperties(CONTEXT_SECTION);
    2689             :     }
    2690        2276 : }
    2691             : 
    2692       32569 : void DomainMapper::lcl_startParagraphGroup()
    2693             : {
    2694       32569 :     m_pImpl->getTableManager().startParagraphGroup();
    2695             :     /*
    2696             :      * Add new para properties only if paragraph is not split
    2697             :      * or the top context is not of paragraph properties
    2698             :      * Set mbIsSplitPara to false as it has been handled
    2699             :      */
    2700       32569 :     if (!mbIsSplitPara)
    2701       32566 :         m_pImpl->PushProperties(CONTEXT_PARAGRAPH);
    2702       32569 :     mbIsSplitPara = false;
    2703       32569 :     if (!(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) == m_pImpl->GetTopContext()))
    2704           3 :         m_pImpl->PushProperties(CONTEXT_PARAGRAPH);
    2705             : 
    2706             :     static const char sDefault[] = "Standard";
    2707       32569 :     if (m_pImpl->GetTopContext())
    2708             :     {
    2709       32569 :         if (!m_pImpl->IsInShape())
    2710             :         {
    2711       29572 :             m_pImpl->GetTopContext()->Insert( PROP_PARA_STYLE_NAME, uno::makeAny( OUString(sDefault) ) );
    2712       29572 :             m_pImpl->SetCurrentParaStyleId(sDefault);
    2713             :         }
    2714       32569 :         if (m_pImpl->isBreakDeferred(PAGE_BREAK))
    2715         321 :             m_pImpl->GetTopContext()->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_PAGE_BEFORE));
    2716       32248 :         else if (m_pImpl->isBreakDeferred(COLUMN_BREAK))
    2717           5 :             m_pImpl->GetTopContext()->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_COLUMN_BEFORE));
    2718             : 
    2719       32569 :         if (m_pImpl->isParaSdtEndDeferred())
    2720         257 :             m_pImpl->GetTopContext()->Insert(PROP_PARA_SDT_END_BEFORE, uno::makeAny(true), true, PARA_GRAB_BAG);
    2721             :     }
    2722       32569 :     m_pImpl->SetIsFirstRun(true);
    2723       32569 :     m_pImpl->SetIsOutsideAParagraph(false);
    2724       32569 :     m_pImpl->clearDeferredBreaks();
    2725       32569 :     m_pImpl->setParaSdtEndDeferred(false);
    2726       32569 : }
    2727             : 
    2728       32554 : void DomainMapper::lcl_endParagraphGroup()
    2729             : {
    2730       32554 :     m_pImpl->PopProperties(CONTEXT_PARAGRAPH);
    2731       32554 :     m_pImpl->getTableManager().endParagraphGroup();
    2732             :     //frame conversion has to be executed after table conversion
    2733       32554 :     m_pImpl->ExecuteFrameConversion();
    2734       32554 :     m_pImpl->SetIsOutsideAParagraph(true);
    2735       32554 : }
    2736             : 
    2737        1701 : void DomainMapper::markLastParagraphInSection( )
    2738             : {
    2739        1701 :     m_pImpl->SetIsLastParagraphInSection( true );
    2740        1701 : }
    2741             : 
    2742        1969 : void DomainMapper::markLastSectionGroup( )
    2743             : {
    2744        1969 :     m_pImpl->SetIsLastSectionGroup( true );
    2745        1969 : }
    2746             : 
    2747        1521 : void DomainMapper::lcl_startShape(uno::Reference<drawing::XShape> const& xShape)
    2748             : {
    2749        1521 :     if (m_pImpl->GetTopContext())
    2750             :     {
    2751             :         // If there is a deferred page break, handle it now, so that the
    2752             :         // started shape will be on the correct page.
    2753        1419 :         if (m_pImpl->isBreakDeferred(PAGE_BREAK))
    2754             :         {
    2755           0 :             m_pImpl->clearDeferredBreak(PAGE_BREAK);
    2756           0 :             lcl_startCharacterGroup();
    2757           0 :             sal_uInt8 sBreak[] = { 0xd };
    2758           0 :             lcl_text(sBreak, 1);
    2759           0 :             lcl_endCharacterGroup();
    2760           0 :             lcl_endParagraphGroup();
    2761           0 :             lcl_startParagraphGroup();
    2762           0 :             m_pImpl->GetTopContext()->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_PAGE_BEFORE));
    2763             :         }
    2764        1419 :         m_pImpl->PushShapeContext( xShape );
    2765        1419 :         lcl_startParagraphGroup();
    2766             :     }
    2767             :     else
    2768             :         // No context? Then this image should not appear directly inside the
    2769             :         // document, just save it for later usage.
    2770         102 :         m_pImpl->PushPendingShape(xShape);
    2771        1521 : }
    2772             : 
    2773        1521 : void DomainMapper::lcl_endShape( )
    2774             : {
    2775        1521 :     if (m_pImpl->GetTopContext())
    2776             :     {
    2777             :         // End the current table, if there are any. Otherwise the unavoidable
    2778             :         // empty paragraph at the end of the shape text will cause problems: if
    2779             :         // the shape text ends with a table, the extra paragraph will be
    2780             :         // handled as an additional row of the ending table.
    2781        1419 :         m_pImpl->getTableManager().endTable();
    2782             : 
    2783        1419 :         lcl_endParagraphGroup();
    2784        1419 :         m_pImpl->PopShapeContext( );
    2785             :         // A shape is always inside a shape (anchored or inline).
    2786        1419 :         m_pImpl->SetIsOutsideAParagraph(false);
    2787             :     }
    2788        1521 : }
    2789             : 
    2790      100696 : void DomainMapper::PushStyleSheetProperties( PropertyMapPtr pStyleProperties, bool bAffectTableMngr )
    2791             : {
    2792      100696 :     m_pImpl->PushStyleProperties( pStyleProperties );
    2793      100696 :     if ( bAffectTableMngr )
    2794        4902 :         m_pImpl->getTableManager( ).SetStyleProperties( pStyleProperties );
    2795      100696 : }
    2796             : 
    2797      100696 : void DomainMapper::PopStyleSheetProperties( bool bAffectTableMngr )
    2798             : {
    2799      100696 :     m_pImpl->PopProperties( CONTEXT_STYLESHEET );
    2800      100696 :     if ( bAffectTableMngr )
    2801             :     {
    2802        4902 :         PropertyMapPtr emptyPtr;
    2803        4902 :         m_pImpl->getTableManager( ).SetStyleProperties( emptyPtr );
    2804             :     }
    2805      100696 : }
    2806             : 
    2807       26497 : void DomainMapper::PushListProperties( ::std::shared_ptr<PropertyMap> pListProperties )
    2808             : {
    2809       26497 :     m_pImpl->PushListProperties( pListProperties );
    2810       26497 : }
    2811             : 
    2812       26497 : void DomainMapper::PopListProperties()
    2813             : {
    2814       26497 :     m_pImpl->PopProperties( CONTEXT_LIST );
    2815       26497 : }
    2816             : 
    2817       74856 : void DomainMapper::lcl_startCharacterGroup()
    2818             : {
    2819       74856 :     m_pImpl->PushProperties(CONTEXT_CHARACTER);
    2820       74856 :     if (m_pImpl->m_bFrameBtLr)
    2821             :         // No support for this in core, work around by char rotation, as we do so for table cells already.
    2822           9 :         m_pImpl->GetTopContext()->Insert(PROP_CHAR_ROTATION, uno::makeAny(sal_Int16(900)));
    2823       74856 :     if (m_pImpl->isSdtEndDeferred())
    2824             :     {
    2825             :         // Fields have an empty character group before the real one, so don't
    2826             :         // call setSdtEndDeferred(false) here, that will happen only in lcl_utext().
    2827         109 :         m_pImpl->GetTopContext()->Insert(PROP_SDT_END_BEFORE, uno::makeAny(true), true, CHAR_GRAB_BAG);
    2828             :     }
    2829             : 
    2830             :     // Remember formatting of the date control as it only supports plain strings natively.
    2831       74856 :     if (!m_pImpl->m_pSdtHelper->getDateFormat().isEmpty())
    2832          18 :         enableInteropGrabBag("CharFormat");
    2833       74856 : }
    2834             : 
    2835       74854 : void DomainMapper::lcl_endCharacterGroup()
    2836             : {
    2837       74854 :     m_pImpl->PopProperties(CONTEXT_CHARACTER);
    2838       74854 : }
    2839             : 
    2840        8835 : void DomainMapper::lcl_text(const sal_uInt8 * data_, size_t len)
    2841             : {
    2842             :     //TODO: Determine the right text encoding (FIB?)
    2843        8835 :     OUString sText( reinterpret_cast<const char*>(data_), len, RTL_TEXTENCODING_MS_1252 );
    2844             : #ifdef DEBUG_WRITERFILTER
    2845             :     TagLogger::getInstance().startElement("text");
    2846             :     TagLogger::getInstance().chars(sText);
    2847             :     TagLogger::getInstance().endElement();
    2848             : #endif
    2849             : 
    2850             :     try
    2851             :     {
    2852        8835 :         if(len == 1)
    2853             :         {
    2854        8835 :             switch(*data_)
    2855             :             {
    2856        8651 :                 case 0x02: return; //footnote character
    2857             :                 case 0x08: // Lock field if in field context
    2858          12 :                     if (m_pImpl->IsOpenField())
    2859          12 :                         m_pImpl->SetFieldLocked();
    2860          12 :                     return;
    2861             :                 case 0x0c: //page break
    2862         381 :                     m_pImpl->deferBreak(PAGE_BREAK);
    2863         381 :                     return;
    2864             :                 case 0x0e: //column break
    2865         141 :                     m_pImpl->deferBreak(COLUMN_BREAK);
    2866         141 :                     return;
    2867             :                 case 0x07:
    2868           0 :                     m_pImpl->getTableManager().text(data_, len);
    2869           0 :                     return;
    2870             :                 case 0x0d:
    2871             :                 {
    2872        2221 :                     PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH);
    2873        2221 :                     if (pContext && m_pImpl->isBreakDeferred(COLUMN_BREAK))
    2874             :                     {
    2875           1 :                         pContext->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_COLUMN_BEFORE));
    2876           1 :                         m_pImpl->clearDeferredBreak(COLUMN_BREAK);
    2877             :                     }
    2878        2221 :                     m_pImpl->finishParagraph(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH));
    2879        2221 :                     return;
    2880             :                 }
    2881             :                 case cFieldStart:
    2882        2007 :                     m_pImpl->PushFieldContext();
    2883        2007 :                     return;
    2884             :                 case cFieldSep:
    2885             :                     // delimiter not necessarily available
    2886             :                     // appears only if field contains further content
    2887        1882 :                     m_pImpl->CloseFieldCommand();
    2888        1882 :                     return;
    2889             :                 case cFieldEnd:
    2890        2007 :                     m_pImpl->PopFieldContext();
    2891        2007 :                     return;
    2892             :                 default:
    2893         184 :                     break;
    2894             :             }
    2895             :         }
    2896             : 
    2897         184 :         PropertyMapPtr pContext = m_pImpl->GetTopContext();
    2898         184 :         if (pContext && !pContext->GetFootnote().is())
    2899             :         {
    2900         184 :             if (m_pImpl->isBreakDeferred(PAGE_BREAK))
    2901           0 :                 m_pImpl->GetTopContext()->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_PAGE_BEFORE));
    2902         184 :             else if (m_pImpl->isBreakDeferred(COLUMN_BREAK))
    2903           0 :                 m_pImpl->GetTopContext()->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_COLUMN_BEFORE));
    2904         184 :             m_pImpl->clearDeferredBreaks();
    2905             :         }
    2906             : 
    2907         184 :         if( pContext->GetFootnote().is() && m_pImpl->IsCustomFtnMark() )
    2908             :         {
    2909           0 :             pContext->GetFootnote()->setLabel( sText );
    2910           0 :             m_pImpl->SetCustomFtnMark( false );
    2911             :             //otherwise ignore sText
    2912             :         }
    2913         184 :         else if( m_pImpl->IsOpenFieldCommand() )
    2914           0 :             m_pImpl->AppendFieldCommand(sText);
    2915         184 :         else if( m_pImpl->IsOpenField() && m_pImpl->IsFieldResultAsString())
    2916             :              /*depending on the success of the field insert operation this result will be
    2917             :               set at the field or directly inserted into the text*/
    2918           0 :             m_pImpl->AppendFieldResult(sText);
    2919             :         else
    2920             :         {
    2921         184 :             if (pContext == nullptr)
    2922           0 :                 pContext.reset(new PropertyMap());
    2923             : 
    2924         184 :             m_pImpl->appendTextPortion( sText, pContext );
    2925         184 :         }
    2926             :     }
    2927           0 :     catch( const uno::RuntimeException& e )
    2928             :     {
    2929             :         SAL_WARN("writerfilter", "failed. Message :" << e.Message);
    2930         184 :     }
    2931             : }
    2932             : 
    2933        1790 : void DomainMapper::lcl_positionOffset(const OUString& rText, bool bVertical)
    2934             : {
    2935        1790 :     if (bVertical)
    2936         905 :         m_pImpl->m_aPositionOffsets.second = rText;
    2937             :     else
    2938         885 :         m_pImpl->m_aPositionOffsets.first = rText;
    2939        1790 : }
    2940             : 
    2941        1702 : awt::Point DomainMapper::getPositionOffset()
    2942             : {
    2943        1702 :     awt::Point aRet;
    2944        1702 :     aRet.X = oox::drawingml::convertEmuToHmm(m_pImpl->m_aPositionOffsets.first.toInt32());
    2945        1702 :     aRet.Y = oox::drawingml::convertEmuToHmm(m_pImpl->m_aPositionOffsets.second.toInt32());
    2946        1702 :     return aRet;
    2947             : }
    2948             : 
    2949         116 : void DomainMapper::lcl_align(const OUString& rText, bool bVertical)
    2950             : {
    2951         116 :     if (bVertical)
    2952          47 :         m_pImpl->m_aAligns.second = rText;
    2953             :     else
    2954          69 :         m_pImpl->m_aAligns.first = rText;
    2955         116 : }
    2956             : 
    2957         842 : void DomainMapper::lcl_positivePercentage(const OUString& rText)
    2958             : {
    2959         842 :     m_pImpl->m_aPositivePercentages.push(rText);
    2960         842 : }
    2961             : 
    2962       79807 : void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
    2963             : {
    2964       79807 :     OUString sText;
    2965      159378 :     OUStringBuffer aBuffer = OUStringBuffer(sal::static_int_cast<int>(len));
    2966       79807 :     aBuffer.append( reinterpret_cast<const sal_Unicode *>(data_), len);
    2967       79807 :     sText = aBuffer.makeStringAndClear();
    2968             : 
    2969       79807 :     if (m_pImpl->isSdtEndDeferred())
    2970             :     {
    2971             :         // In case we have a field context, then save the property there, so
    2972             :         // SDT's ending right before a field start are handled as well.
    2973         150 :         PropertyMapPtr pContext = m_pImpl->GetTopContext();
    2974         150 :         if (m_pImpl->IsOpenField())
    2975           5 :             pContext = m_pImpl->GetTopFieldContext()->getProperties();
    2976         150 :         pContext->Insert(PROP_SDT_END_BEFORE, uno::makeAny(true), true, CHAR_GRAB_BAG);
    2977         150 :         m_pImpl->setSdtEndDeferred(false);
    2978             :     }
    2979             : 
    2980       79807 :     bool bNewLine = len == 1 && (sText[0] == 0x0d || sText[0] == 0x07);
    2981       79807 :     if (!m_pImpl->m_pSdtHelper->getDropDownItems().empty())
    2982             :     {
    2983          26 :         if (bNewLine)
    2984             :             // Dropdown control has single-line texts, so in case of newline, create the control.
    2985          10 :             m_pImpl->m_pSdtHelper->createDropDownControl();
    2986             :         else
    2987             :         {
    2988          16 :             m_pImpl->m_pSdtHelper->getSdtTexts().append(sText);
    2989          16 :             return;
    2990             :         }
    2991             :     }
    2992             :     // Form controls are not allowed in headers / footers; see sw::DocumentContentOperationsManager::InsertDrawObj()
    2993       79781 :     else if (!m_pImpl->m_pSdtHelper->getDateFormat().isEmpty() && !IsInHeaderFooter())
    2994             :     {
    2995             :         /*
    2996             :          * Here we assume w:sdt only contains a single text token. We need to
    2997             :          * create the control early, as in Writer, it's part of the cell, but
    2998             :          * in OOXML, the sdt contains the cell.
    2999             :          */
    3000          18 :         m_pImpl->m_pSdtHelper->createDateControl(sText, getInteropGrabBag());
    3001          18 :         return;
    3002             :     }
    3003       79763 :     else if (!m_pImpl->m_pSdtHelper->isInteropGrabBagEmpty())
    3004             :     {
    3005             :         // there are unsupported SDT properties in the document
    3006             :         // save them in the paragraph interop grab bag
    3007         395 :         if (m_pImpl->IsDiscardHeaderFooter())
    3008             :         {
    3009             :             // Unless we're supposed to ignore this header/footer.
    3010           3 :             m_pImpl->m_pSdtHelper->getInteropGrabBagAndClear();
    3011           3 :             return;
    3012             :         }
    3013        2316 :         if((m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_checkbox") ||
    3014        1588 :                 m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_text") ||
    3015        1264 :                 m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_dataBinding") ||
    3016        1198 :                 m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_citation") ||
    3017        1152 :                 m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_date") ||
    3018         953 :                 (m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_id") &&
    3019        1610 :                         m_pImpl->m_pSdtHelper->getInteropGrabBagSize() == 1)) && !m_pImpl->m_pSdtHelper->isOutsideAParagraph())
    3020             :         {
    3021         117 :             PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_CHARACTER);
    3022             : 
    3023         117 :             if (m_pImpl->IsOpenField())
    3024             :                 // We have a field, insert the SDT properties to the field's grab-bag, so they won't be lost.
    3025          23 :                 pContext = m_pImpl->GetTopFieldContext()->getProperties();
    3026             : 
    3027         117 :             pContext->Insert(PROP_SDTPR, uno::makeAny(m_pImpl->m_pSdtHelper->getInteropGrabBagAndClear()), true, CHAR_GRAB_BAG);
    3028             :         }
    3029             :         else
    3030             :             m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH)->Insert(PROP_SDTPR,
    3031         275 :                     uno::makeAny(m_pImpl->m_pSdtHelper->getInteropGrabBagAndClear()), true, PARA_GRAB_BAG);
    3032             :     }
    3033       79368 :     else if (len == 1 && sText[0] == 0x03)
    3034             :     {
    3035             :         // This is the uFtnEdnSep, remember that the document has a separator.
    3036          99 :         m_pImpl->m_bHasFtnSep = true;
    3037          99 :         return;
    3038             :     }
    3039       79269 :     else if (len == 1 && sText[0] == '\t' && m_pImpl->m_bIgnoreNextTab)
    3040             :     {
    3041          12 :         m_pImpl->m_bIgnoreNextTab = false;
    3042          12 :         return;
    3043             :     }
    3044             : 
    3045             :     try
    3046             :     {
    3047       79659 :         m_pImpl->getTableManager().utext(data_, len);
    3048             : 
    3049       79659 :         if (bNewLine)
    3050             :         {
    3051       28949 :             if (m_pImpl->m_bIgnoreNextPara)
    3052             :             {
    3053          88 :                 m_pImpl->m_bIgnoreNextPara = false;
    3054          88 :                 return;
    3055             :             }
    3056       28861 :             PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH);
    3057       28861 :             if (pContext && m_pImpl->GetSettingsTable()->GetSplitPgBreakAndParaMark())
    3058             :             {
    3059         291 :                 if (m_pImpl->isBreakDeferred(PAGE_BREAK))
    3060           1 :                     pContext->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_PAGE_BEFORE));
    3061         290 :                 else if (m_pImpl->isBreakDeferred(COLUMN_BREAK))
    3062           0 :                     pContext->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_COLUMN_BEFORE));
    3063         291 :                 m_pImpl->clearDeferredBreaks();
    3064             :             }
    3065             : 
    3066       28861 :             bool bSingleParagraph = m_pImpl->GetIsFirstParagraphInSection() && m_pImpl->GetIsLastParagraphInSection();
    3067             :             // If the paragraph contains only the section properties and it has
    3068             :             // no runs, we should not create a paragraph for it in Writer, unless that would remove the whole section.
    3069       28861 :             bool bRemove = !m_pImpl->GetParaChanged() && m_pImpl->GetParaSectpr() && !bSingleParagraph;
    3070       28861 :             m_pImpl->SetParaSectpr(false);
    3071       28861 :             m_pImpl->finishParagraph(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH));
    3072       28861 :             if (bRemove && !m_pImpl->GetIsDummyParaAddedForTableInSection())
    3073         120 :                 m_pImpl->RemoveLastParagraph();
    3074             :         }
    3075             :         else
    3076             :         {
    3077             : 
    3078       50710 :             PropertyMapPtr pContext = m_pImpl->GetTopContext();
    3079       50710 :             if ( pContext && !pContext->GetFootnote().is() )
    3080             :             {
    3081       50709 :                 if (m_pImpl->isBreakDeferred(PAGE_BREAK))
    3082             :                 {
    3083             :                     /* If PAGEBREAK appears in first paragraph of the section or
    3084             :                      * after first run of any paragraph then need to split paragraph
    3085             :                      * to handle it properly.
    3086             :                      */
    3087          47 :                     if (m_pImpl->GetIsFirstParagraphInSection() || !m_pImpl->IsFirstRun())
    3088             :                     {
    3089           6 :                         m_pImpl->m_bIsSplitPara = true;
    3090           6 :                         m_pImpl->finishParagraph(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH));
    3091           6 :                         lcl_startParagraphGroup();
    3092             :                     }
    3093          47 :                     m_pImpl->GetTopContext()->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_PAGE_BEFORE));
    3094             :                 }
    3095       50662 :                 else if (m_pImpl->isBreakDeferred(COLUMN_BREAK))
    3096             :                 {
    3097         138 :                     if (m_pImpl->GetIsFirstParagraphInSection() || !m_pImpl->IsFirstRun())
    3098             :                     {
    3099           3 :                         mbIsSplitPara = true;
    3100           3 :                         m_pImpl->finishParagraph(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH));
    3101           3 :                         lcl_startParagraphGroup();
    3102             :                     }
    3103         138 :                     m_pImpl->GetTopContext()->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_COLUMN_BEFORE));
    3104             :                 }
    3105       50709 :                 m_pImpl->clearDeferredBreaks();
    3106             :             }
    3107             : 
    3108       50710 :             if( pContext && pContext->GetFootnote().is() )
    3109             :             {
    3110           0 :                 if( !pContext->GetFootnoteSymbol() )
    3111           0 :                     pContext->GetFootnote()->setLabel( sText );
    3112             :                 //otherwise ignore sText
    3113             :             }
    3114       50710 :             else if( m_pImpl->IsOpenFieldCommand() )
    3115        2292 :                 m_pImpl->AppendFieldCommand(sText);
    3116       48418 :             else if( m_pImpl->IsOpenField() && m_pImpl->IsFieldResultAsString())
    3117             :                 /*depending on the success of the field insert operation this result will be
    3118             :                   set at the field or directly inserted into the text*/
    3119         373 :                 m_pImpl->AppendFieldResult(sText);
    3120             :             else
    3121             :             {
    3122       48045 :                 if (pContext == nullptr)
    3123           0 :                     pContext.reset(new PropertyMap());
    3124             : 
    3125       48045 :                 m_pImpl->appendTextPortion( sText, pContext );
    3126       50710 :             }
    3127             : 
    3128             :         }
    3129       79571 :         m_pImpl->SetIsFirstRun(false);
    3130             :     }
    3131           0 :     catch( const uno::RuntimeException& )
    3132             :     {
    3133       79571 :     }
    3134             : }
    3135             : 
    3136      149567 : void DomainMapper::lcl_props(writerfilter::Reference<Properties>::Pointer_t ref)
    3137             : {
    3138      149567 :     ref->resolve(*this);
    3139      149567 : }
    3140             : 
    3141        7159 : void DomainMapper::lcl_table(Id name, writerfilter::Reference<Table>::Pointer_t ref)
    3142             : {
    3143        7159 :     m_pImpl->SetAnyTableImport(true);
    3144        7159 :     switch(name)
    3145             :     {
    3146             :     case NS_ooxml::LN_FONTTABLE:
    3147             : 
    3148             :         // create a font table object that listens to the attributes
    3149             :         // each entry call inserts a new font entry
    3150        1716 :         ref->resolve( *m_pImpl->GetFontTable() );
    3151        1716 :         break;
    3152             :     case NS_ooxml::LN_STYLESHEET:
    3153             :         //same as above to import style sheets
    3154        1695 :         m_pImpl->SetStyleSheetImport( true );
    3155        1695 :         ref->resolve( *m_pImpl->GetStyleSheetTable() );
    3156        1695 :         m_pImpl->GetStyleSheetTable()->ApplyStyleSheets(m_pImpl->GetFontTable());
    3157        1695 :         m_pImpl->SetStyleSheetImport( false );
    3158        1695 :         break;
    3159             :     case NS_ooxml::LN_NUMBERING:
    3160             :         {
    3161             : 
    3162             :             //the same for list tables
    3163         379 :             ref->resolve( *m_pImpl->GetListTable() );
    3164         379 :             m_pImpl->GetListTable( )->CreateNumberingRules( );
    3165             :         }
    3166         379 :         break;
    3167             :     case NS_ooxml::LN_THEMETABLE:
    3168             :         m_pImpl->GetThemeTable()->setThemeFontLangProperties(
    3169        1380 :                 m_pImpl->GetSettingsTable()->GetThemeFontLangProperties() );
    3170        1380 :         ref->resolve ( *m_pImpl->GetThemeTable() );
    3171        1380 :     break;
    3172             :     case NS_ooxml::LN_settings_settings:
    3173        1989 :         ref->resolve ( *m_pImpl->GetSettingsTable() );
    3174        1989 :         m_pImpl->ApplySettingsTable();
    3175        1989 :     break;
    3176             :     default:
    3177             :         OSL_FAIL( "which table is to be filled here?");
    3178             :     }
    3179        7159 :     m_pImpl->SetAnyTableImport(false);
    3180        7159 : }
    3181             : 
    3182        1430 : void DomainMapper::lcl_substream(Id rName, ::writerfilter::Reference<Stream>::Pointer_t ref)
    3183             : {
    3184        1430 :     m_pImpl->substream(rName, ref);
    3185        1430 : }
    3186             : 
    3187       28475 : void DomainMapper::lcl_info(const std::string & /*info_*/)
    3188             : {
    3189       28475 : }
    3190             : 
    3191        2409 : void DomainMapper::handleUnderlineType(const Id nId, const ::std::shared_ptr<PropertyMap>& rContext)
    3192             : {
    3193        2409 :     sal_Int16 nUnderline = awt::FontUnderline::NONE;
    3194             : 
    3195        2409 :     switch (nId)
    3196             :     {
    3197             :     case NS_ooxml::LN_Value_ST_Underline_none:
    3198         382 :         nUnderline = awt::FontUnderline::NONE;
    3199         382 :         break;
    3200             :     case NS_ooxml::LN_Value_ST_Underline_words:
    3201           1 :         rContext->Insert(PROP_CHAR_WORD_MODE, uno::makeAny(true));
    3202             :         // fall-through intended
    3203             :     case NS_ooxml::LN_Value_ST_Underline_single:
    3204        1993 :         nUnderline = awt::FontUnderline::SINGLE;
    3205        1993 :         break;
    3206             :     case NS_ooxml::LN_Value_ST_Underline_double:
    3207          11 :         nUnderline = awt::FontUnderline::DOUBLE;
    3208          11 :         break;
    3209             :     case NS_ooxml::LN_Value_ST_Underline_dotted:
    3210           4 :         nUnderline = awt::FontUnderline::DOTTED;
    3211           4 :         break;
    3212             :     case NS_ooxml::LN_Value_ST_Underline_dash:
    3213           0 :         nUnderline = awt::FontUnderline::DASH;
    3214           0 :         break;
    3215             :     case NS_ooxml::LN_Value_ST_Underline_dotDash:
    3216           0 :         nUnderline = awt::FontUnderline::DASHDOT;
    3217           0 :         break;
    3218             :     case NS_ooxml::LN_Value_ST_Underline_dotDotDash:
    3219           0 :         nUnderline = awt::FontUnderline::DASHDOTDOT;
    3220           0 :         break;
    3221             :     case NS_ooxml::LN_Value_ST_Underline_thick:
    3222          19 :         nUnderline = awt::FontUnderline::BOLD;
    3223          19 :         break;
    3224             :     case NS_ooxml::LN_Value_ST_Underline_wave:
    3225           0 :         nUnderline = awt::FontUnderline::WAVE;
    3226           0 :         break;
    3227             :     case NS_ooxml::LN_Value_ST_Underline_dottedHeavy:
    3228           0 :         nUnderline = awt::FontUnderline::BOLDDOTTED;
    3229           0 :         break;
    3230             :     case NS_ooxml::LN_Value_ST_Underline_dashedHeavy:
    3231           0 :         nUnderline = awt::FontUnderline::BOLDDASH;
    3232           0 :         break;
    3233             :     case NS_ooxml::LN_Value_ST_Underline_dashLong:
    3234           0 :         nUnderline = awt::FontUnderline::LONGDASH;
    3235           0 :         break;
    3236             :     case NS_ooxml::LN_Value_ST_Underline_dashLongHeavy:
    3237           0 :         nUnderline = awt::FontUnderline::BOLDLONGDASH;
    3238           0 :         break;
    3239             :     case NS_ooxml::LN_Value_ST_Underline_dashDotHeavy:
    3240           0 :         nUnderline = awt::FontUnderline::BOLDDASHDOT;
    3241           0 :         break;
    3242             :     case NS_ooxml::LN_Value_ST_Underline_dashDotDotHeavy:
    3243           0 :         nUnderline = awt::FontUnderline::BOLDDASHDOTDOT;
    3244           0 :         break;
    3245             :     case NS_ooxml::LN_Value_ST_Underline_wavyHeavy:
    3246           0 :         nUnderline = awt::FontUnderline::BOLDWAVE;
    3247           0 :         break;
    3248             :     case NS_ooxml::LN_Value_ST_Underline_wavyDouble:
    3249           0 :         nUnderline = awt::FontUnderline::DOUBLEWAVE;
    3250           0 :         break;
    3251             :     }
    3252        2409 :     rContext->Insert(PROP_CHAR_UNDERLINE, uno::makeAny(nUnderline));
    3253        2409 : }
    3254             : 
    3255        8906 : void DomainMapper::handleParaJustification(const sal_Int32 nIntValue, const ::std::shared_ptr<PropertyMap>& rContext, const bool bExchangeLeftRight)
    3256             : {
    3257        8906 :     sal_Int16 nAdjust = 0;
    3258        8906 :     sal_Int16 nLastLineAdjust = 0;
    3259        8906 :     OUString aStringValue = "left";
    3260        8906 :     switch(nIntValue)
    3261             :     {
    3262             :     case NS_ooxml::LN_Value_ST_Jc_center:
    3263        3520 :         nAdjust = style::ParagraphAdjust_CENTER;
    3264        3520 :         aStringValue = "center";
    3265        3520 :         break;
    3266             :     case NS_ooxml::LN_Value_ST_Jc_right:
    3267             :     case NS_ooxml::LN_Value_ST_Jc_end:
    3268         467 :         nAdjust = static_cast< sal_Int16 > (bExchangeLeftRight ? style::ParagraphAdjust_LEFT : style::ParagraphAdjust_RIGHT);
    3269         467 :         aStringValue = "right";
    3270         467 :         break;
    3271             :     case 4:
    3272           0 :         nLastLineAdjust = style::ParagraphAdjust_BLOCK;
    3273             :         //no break;
    3274             :     case NS_ooxml::LN_Value_ST_Jc_both:
    3275        2075 :         nAdjust = style::ParagraphAdjust_BLOCK;
    3276        2075 :         aStringValue = "both";
    3277        2075 :         break;
    3278             :     case NS_ooxml::LN_Value_ST_Jc_left:
    3279             :     case NS_ooxml::LN_Value_ST_Jc_start:
    3280             :     default:
    3281        2844 :         nAdjust = static_cast< sal_Int16 > (bExchangeLeftRight ? style::ParagraphAdjust_RIGHT : style::ParagraphAdjust_LEFT);
    3282        2844 :         break;
    3283             :     }
    3284        8906 :     rContext->Insert( PROP_PARA_ADJUST, uno::makeAny( nAdjust ) );
    3285        8906 :     rContext->Insert( PROP_PARA_LAST_LINE_ADJUST, uno::makeAny( nLastLineAdjust ) );
    3286        8906 :     m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "jc", aStringValue);
    3287        8906 : }
    3288             : 
    3289         263 : bool DomainMapper::getColorFromId(const Id nId, sal_Int32 &nColor)
    3290             : {
    3291         263 :     nColor = 0;
    3292         263 :     if ((nId < NS_ooxml::LN_Value_ST_HighlightColor_black) || (nId > NS_ooxml::LN_Value_ST_HighlightColor_lightGray))
    3293           2 :         return false;
    3294             : 
    3295         261 :     switch (nId)
    3296             :     {
    3297          17 :     case NS_ooxml::LN_Value_ST_HighlightColor_black: nColor=0x000000; break;
    3298          19 :     case NS_ooxml::LN_Value_ST_HighlightColor_blue: nColor=0x0000ff; break;
    3299          12 :     case NS_ooxml::LN_Value_ST_HighlightColor_cyan: nColor=0x00ffff; break;
    3300          12 :     case NS_ooxml::LN_Value_ST_HighlightColor_green: nColor=0x00ff00; break;
    3301          12 :     case NS_ooxml::LN_Value_ST_HighlightColor_magenta: nColor=0xff00ff; break;
    3302          22 :     case NS_ooxml::LN_Value_ST_HighlightColor_red: nColor=0xff0000; break;
    3303          38 :     case NS_ooxml::LN_Value_ST_HighlightColor_yellow: nColor=0xffff00; break;
    3304          38 :     case NS_ooxml::LN_Value_ST_HighlightColor_white: nColor=0xffffff; break;
    3305          11 :     case NS_ooxml::LN_Value_ST_HighlightColor_darkBlue: nColor=0x000080;  break;
    3306          12 :     case NS_ooxml::LN_Value_ST_HighlightColor_darkCyan: nColor=0x008080; break;
    3307          11 :     case NS_ooxml::LN_Value_ST_HighlightColor_darkGreen: nColor=0x008000; break;
    3308          11 :     case NS_ooxml::LN_Value_ST_HighlightColor_darkMagenta: nColor=0x800080; break;
    3309          11 :     case NS_ooxml::LN_Value_ST_HighlightColor_darkRed: nColor=0x800000; break;
    3310          11 :     case NS_ooxml::LN_Value_ST_HighlightColor_darkYellow: nColor=0x808000; break;
    3311          11 :     case NS_ooxml::LN_Value_ST_HighlightColor_darkGray: nColor=0x808080; break;
    3312          13 :     case NS_ooxml::LN_Value_ST_HighlightColor_lightGray: nColor=0xC0C0C0; break;
    3313             :     default:
    3314           0 :         return false;
    3315             :     }
    3316         261 :     return true;
    3317             : }
    3318             : 
    3319          64 : sal_Int16 DomainMapper::getEmphasisValue(const sal_Int32 nIntValue)
    3320             : {
    3321          64 :     switch (nIntValue)
    3322             :     {
    3323             :     case NS_ooxml::LN_Value_ST_Em_dot:
    3324           6 :         return text::FontEmphasis::DOT_ABOVE;
    3325             :     case NS_ooxml::LN_Value_ST_Em_comma:
    3326           6 :         return text::FontEmphasis::ACCENT_ABOVE;
    3327             :     case NS_ooxml::LN_Value_ST_Em_circle:
    3328           6 :         return text::FontEmphasis::CIRCLE_ABOVE;
    3329             :     case NS_ooxml::LN_Value_ST_Em_underDot:
    3330           6 :         return text::FontEmphasis::DOT_BELOW;
    3331             :     default:
    3332          40 :         return text::FontEmphasis::NONE;
    3333             :     }
    3334             : }
    3335             : 
    3336           0 : OUString DomainMapper::getBracketStringFromEnum(const sal_Int32 nIntValue, const bool bIsPrefix)
    3337             : {
    3338           0 :     switch(nIntValue)
    3339             :     {
    3340             :     case NS_ooxml::LN_Value_ST_CombineBrackets_round:
    3341           0 :         if (bIsPrefix)
    3342           0 :             return OUString( "(" );
    3343           0 :         return OUString( ")" );
    3344             : 
    3345             :     case NS_ooxml::LN_Value_ST_CombineBrackets_square:
    3346           0 :         if (bIsPrefix)
    3347           0 :             return OUString( "[" );
    3348           0 :         return OUString( "]" );
    3349             : 
    3350             :     case NS_ooxml::LN_Value_ST_CombineBrackets_angle:
    3351           0 :         if (bIsPrefix)
    3352           0 :             return OUString( "<" );
    3353           0 :         return OUString( ">" );
    3354             : 
    3355             :     case NS_ooxml::LN_Value_ST_CombineBrackets_curly:
    3356           0 :         if (bIsPrefix)
    3357           0 :             return OUString( "{" );
    3358           0 :         return OUString( "}" );
    3359             : 
    3360             :     case NS_ooxml::LN_Value_ST_CombineBrackets_none:
    3361             :     default:
    3362           0 :         return OUString();
    3363             :     }
    3364             : }
    3365             : 
    3366        7184 : style::TabAlign DomainMapper::getTabAlignFromValue(const sal_Int32 nIntValue)
    3367             : {
    3368        7184 :     switch (nIntValue)
    3369             :     {
    3370             :     case NS_ooxml::LN_Value_ST_TabJc_start:
    3371             :     case NS_ooxml::LN_Value_ST_TabJc_left:
    3372             :     case NS_ooxml::LN_Value_ST_TabJc_bar: // bar not supported
    3373             :     case NS_ooxml::LN_Value_ST_TabJc_num: // num not supported
    3374        3423 :         return style::TabAlign_LEFT;
    3375             :     case NS_ooxml::LN_Value_ST_TabJc_center:
    3376        1152 :         return style::TabAlign_CENTER;
    3377             :     case NS_ooxml::LN_Value_ST_TabJc_end:
    3378             :     case NS_ooxml::LN_Value_ST_TabJc_right:
    3379        2605 :         return style::TabAlign_RIGHT;
    3380             :     case NS_ooxml::LN_Value_ST_TabJc_decimal:
    3381           4 :         return style::TabAlign_DECIMAL;
    3382             :     }
    3383           0 :     return style::TabAlign_LEFT;
    3384             : }
    3385             : 
    3386        3128 : sal_Unicode DomainMapper::getFillCharFromValue(const sal_Int32 nIntValue)
    3387             : {
    3388        3128 :     switch (nIntValue)
    3389             :     {
    3390             :     case NS_ooxml::LN_Value_ST_TabTlc_dot:
    3391        1059 :         return sal_Unicode(0x002e);
    3392             :     case NS_ooxml::LN_Value_ST_TabTlc_hyphen:
    3393           0 :         return sal_Unicode(0x002d);
    3394             :     case NS_ooxml::LN_Value_ST_TabTlc_underscore:
    3395             :     case NS_ooxml::LN_Value_ST_TabTlc_heavy: // FIXME ???
    3396           1 :         return sal_Unicode(0x005f);
    3397             :     case NS_ooxml::LN_Value_ST_TabTlc_middleDot: // middleDot
    3398           0 :         return sal_Unicode(0x00b7);
    3399             :     case NS_ooxml::LN_Value_ST_TabTlc_none:
    3400             :     default:
    3401        2068 :         return sal_Unicode(0x0020); // blank space
    3402             :     }
    3403             : }
    3404             : 
    3405       52929 : bool DomainMapper::IsOOXMLImport() const
    3406             : {
    3407       52929 :     return m_pImpl->IsOOXMLImport();
    3408             : }
    3409             : 
    3410        2486 : bool DomainMapper::IsRTFImport() const
    3411             : {
    3412        2486 :     return m_pImpl->IsRTFImport();
    3413             : }
    3414             : 
    3415        1476 : uno::Reference < lang::XMultiServiceFactory > DomainMapper::GetTextFactory() const
    3416             : {
    3417        1476 :     return m_pImpl->GetTextFactory();
    3418             : }
    3419             : 
    3420        1093 : uno::Reference< text::XTextRange > DomainMapper::GetCurrentTextRange()
    3421             : {
    3422        1093 :     return m_pImpl->GetTopTextAppend()->getEnd();
    3423             : }
    3424             : 
    3425       10391 : OUString DomainMapper::getOrCreateCharStyle( PropertyValueVector_t& rCharProperties )
    3426             : {
    3427       10391 :     StyleSheetTablePtr pStyleSheets = m_pImpl->GetStyleSheetTable();
    3428       10391 :     return pStyleSheets->getOrCreateCharStyle( rCharProperties );
    3429             : }
    3430             : 
    3431         800 : StyleSheetTablePtr DomainMapper::GetStyleSheetTable( )
    3432             : {
    3433         800 :     return m_pImpl->GetStyleSheetTable( );
    3434             : }
    3435             : 
    3436        1058 : GraphicZOrderHelper* DomainMapper::graphicZOrderHelper()
    3437             : {
    3438        1058 :     if( zOrderHelper.get() == nullptr )
    3439         438 :         zOrderHelper.reset( new GraphicZOrderHelper );
    3440        1058 :     return zOrderHelper.get();
    3441             : }
    3442             : 
    3443          71 : uno::Reference<drawing::XShape> DomainMapper::PopPendingShape()
    3444             : {
    3445          71 :     return m_pImpl->PopPendingShape();
    3446             : }
    3447             : 
    3448        1369 : bool DomainMapper::IsInHeaderFooter() const
    3449             : {
    3450        1369 :     return m_pImpl->IsInHeaderFooter();
    3451             : }
    3452             : 
    3453       94094 : bool DomainMapper::IsStyleSheetImport() const
    3454             : {
    3455       94094 :     return m_pImpl->IsStyleSheetImport();
    3456             : }
    3457             : 
    3458        7003 : void DomainMapper::enableInteropGrabBag(const OUString& aName)
    3459             : {
    3460        7003 :     m_pImpl->m_aInteropGrabBagName = aName;
    3461        7003 : }
    3462             : 
    3463        6878 : beans::PropertyValue DomainMapper::getInteropGrabBag()
    3464             : {
    3465        6878 :     beans::PropertyValue aRet;
    3466        6878 :     aRet.Name = m_pImpl->m_aInteropGrabBagName;
    3467             : 
    3468       13756 :     uno::Sequence<beans::PropertyValue> aSeq(m_pImpl->m_aInteropGrabBag.size());
    3469        6878 :     beans::PropertyValue* pSeq = aSeq.getArray();
    3470       13434 :     for (std::vector<beans::PropertyValue>::iterator i = m_pImpl->m_aInteropGrabBag.begin(); i != m_pImpl->m_aInteropGrabBag.end(); ++i)
    3471        6556 :         *pSeq++ = *i;
    3472             : 
    3473        6878 :     m_pImpl->m_aInteropGrabBag.clear();
    3474        6878 :     m_pImpl->m_aInteropGrabBagName.clear();
    3475        6878 :     aRet.Value = uno::makeAny(aSeq);
    3476       13756 :     return aRet;
    3477             : }
    3478             : 
    3479        1984 : uno::Sequence<beans::PropertyValue> DomainMapper::GetThemeFontLangProperties() const
    3480             : {
    3481        1984 :     return m_pImpl->GetSettingsTable()->GetThemeFontLangProperties();
    3482             : }
    3483             : 
    3484        1984 : uno::Sequence<beans::PropertyValue> DomainMapper::GetCompatSettings() const
    3485             : {
    3486        1984 :     return m_pImpl->GetSettingsTable()->GetCompatSettings();
    3487             : }
    3488             : 
    3489         993 : void DomainMapper::HandleRedline( Sprm& rSprm )
    3490             : {
    3491         993 :     sal_uInt32 nSprmId = rSprm.getId();
    3492             : 
    3493         993 :     m_pImpl->AddNewRedline( nSprmId );
    3494             : 
    3495         993 :     if (nSprmId == NS_ooxml::LN_CT_PPr_pPrChange)
    3496             :     {
    3497         138 :         m_pImpl->SetCurrentRedlineToken(XML_ParagraphFormat);
    3498             :     }
    3499         855 :     else if (nSprmId == NS_ooxml::LN_CT_TrPr_ins)
    3500             :     {
    3501           0 :         m_pImpl->SetCurrentRedlineToken(XML_tableRowInsert);
    3502             :     }
    3503         855 :     else if (nSprmId == NS_ooxml::LN_CT_TrPr_del)
    3504             :     {
    3505           0 :         m_pImpl->SetCurrentRedlineToken(XML_tableRowDelete);
    3506             :     }
    3507         855 :     else if (nSprmId == NS_ooxml::LN_CT_TcPrBase_cellIns)
    3508             :     {
    3509           0 :         m_pImpl->SetCurrentRedlineToken(XML_tableCellInsert);
    3510             :     }
    3511         855 :     else if (nSprmId == NS_ooxml::LN_CT_TcPrBase_cellDel)
    3512             :     {
    3513           0 :         m_pImpl->SetCurrentRedlineToken(XML_tableCellDelete);
    3514             :     }
    3515             : 
    3516         993 :     resolveSprmProps(*this, rSprm );
    3517             :     // now the properties author, date and id should be available
    3518         993 :     sal_Int32 nToken = m_pImpl->GetCurrentRedlineToken();
    3519         993 :     switch( nToken & 0xffff )
    3520             :     {
    3521             :         case XML_mod:
    3522             :         case XML_ins:
    3523             :         case XML_del:
    3524             :         case XML_ParagraphFormat:
    3525             :         case XML_tableRowInsert:
    3526             :         case XML_tableRowDelete:
    3527             :         case XML_tableCellInsert:
    3528             :         case XML_tableCellDelete:
    3529         993 :             break;
    3530           0 :         default: OSL_FAIL( "redline token other than mod, ins, del or table row" ); break;
    3531             :     }
    3532         993 :     m_pImpl->EndParaMarkerChange( );
    3533         993 :     m_pImpl->SetCurrentRedlineIsRead();
    3534         993 : }
    3535             : 
    3536             : } //namespace dmapper
    3537             : } //namespace writerfilter
    3538             : 
    3539             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11