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