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/ResourceModelHelper.hxx>
22 : #include <SdtHelper.hxx>
23 : #include <DomainMapper_Impl.hxx>
24 : #include <ConversionHelper.hxx>
25 : #include <ModelEventListener.hxx>
26 : #include <MeasureHandler.hxx>
27 : #include <i18nlangtag/languagetag.hxx>
28 : #include <i18nutil/paper.hxx>
29 : #include <ooxml/OOXMLFastTokens.hxx>
30 : #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
31 : #include <com/sun/star/document/XOOXMLDocumentPropertiesImporter.hpp>
32 : #include <com/sun/star/text/HoriOrientation.hpp>
33 : #include <com/sun/star/text/RelOrientation.hpp>
34 : #include <com/sun/star/text/VertOrientation.hpp>
35 : #include <com/sun/star/text/WrapTextMode.hpp>
36 : #include <com/sun/star/text/SizeType.hpp>
37 : #include <com/sun/star/text/XEndnotesSupplier.hpp>
38 : #include <com/sun/star/text/XFootnotesSupplier.hpp>
39 : #include <com/sun/star/text/XLineNumberingProperties.hpp>
40 : #include <com/sun/star/awt/FontRelief.hpp>
41 : #include <com/sun/star/awt/FontWeight.hpp>
42 : #include <com/sun/star/awt/FontUnderline.hpp>
43 : #include <com/sun/star/awt/FontStrikeout.hpp>
44 : #include <com/sun/star/awt/FontSlant.hpp>
45 : #include <com/sun/star/document/XEventBroadcaster.hpp>
46 : #include <com/sun/star/style/ParagraphAdjust.hpp>
47 : #include <com/sun/star/style/BreakType.hpp>
48 : #include <com/sun/star/style/CaseMap.hpp>
49 : #include <com/sun/star/style/LineSpacing.hpp>
50 : #include <com/sun/star/style/LineSpacingMode.hpp>
51 : #include <com/sun/star/text/FootnoteNumbering.hpp>
52 : #include <com/sun/star/text/TextGridMode.hpp>
53 : #include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
54 : #include <com/sun/star/text/XTextFieldsSupplier.hpp>
55 : #include <com/sun/star/text/WritingMode.hpp>
56 : #include <com/sun/star/text/WritingMode2.hpp>
57 : #include <com/sun/star/text/XFootnote.hpp>
58 : #include <comphelper/types.hxx>
59 : #include <comphelper/storagehelper.hxx>
60 :
61 : #include <CellColorHandler.hxx>
62 : #include <SectionColumnHandler.hxx>
63 : #include <GraphicHelpers.hxx>
64 :
65 : using namespace ::com::sun::star;
66 : using namespace ::rtl;
67 :
68 : namespace writerfilter {
69 :
70 : using resourcemodel::resolveSprmProps;
71 : using resourcemodel::resolveAttributeProperties;
72 :
73 : namespace dmapper{
74 :
75 8 : TagLogger::Pointer_t dmapper_logger(TagLogger::getInstance("DOMAINMAPPER"));
76 :
77 : struct _PageSz
78 : {
79 : sal_Int32 code;
80 : sal_Int32 h;
81 : bool orient;
82 : sal_Int32 w;
83 : } CT_PageSz;
84 :
85 :
86 357 : DomainMapper::DomainMapper( const uno::Reference< uno::XComponentContext >& xContext,
87 : uno::Reference< io::XInputStream > xInputStream,
88 : uno::Reference< lang::XComponent > xModel,
89 : bool bRepairStorage,
90 : SourceDocumentType eDocumentType,
91 : uno::Reference< text::XTextRange > xInsertTextRange,
92 : bool bIsNewDoc ) :
93 : LoggedProperties(dmapper_logger, "DomainMapper"),
94 : LoggedTable(dmapper_logger, "DomainMapper"),
95 : LoggedStream(dmapper_logger, "DomainMapper"),
96 358 : m_pImpl( new DomainMapper_Impl( *this, xContext, xModel, eDocumentType, xInsertTextRange, bIsNewDoc )),
97 714 : mnBackgroundColor(0), mbIsHighlightSet(false)
98 : {
99 : // #i24363# tab stops relative to indent
100 : m_pImpl->SetDocumentSettingsProperty(
101 356 : PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_TABS_RELATIVE_TO_INDENT ),
102 712 : uno::makeAny( false ) );
103 :
104 : //import document properties
105 : try
106 : {
107 : uno::Reference< embed::XStorage > xDocumentStorage =
108 549 : (comphelper::OStorageHelper::GetStorageOfFormatFromInputStream(OFOPXML_STORAGE_FORMAT_STRING, xInputStream, xContext, bRepairStorage ));
109 :
110 326 : uno::Reference< uno::XInterface > xTemp = xContext->getServiceManager()->createInstanceWithContext(
111 : "com.sun.star.document.OOXMLDocumentPropertiesImporter",
112 326 : xContext);
113 :
114 326 : uno::Reference< document::XOOXMLDocumentPropertiesImporter > xImporter( xTemp, uno::UNO_QUERY_THROW );
115 326 : uno::Reference< document::XDocumentPropertiesSupplier > xPropSupplier( xModel, uno::UNO_QUERY_THROW);
116 326 : xImporter->importProperties( xDocumentStorage, xPropSupplier->getDocumentProperties() );
117 : }
118 193 : catch( const uno::Exception& rEx )
119 : {
120 : (void)rEx;
121 : }
122 356 : }
123 :
124 1068 : DomainMapper::~DomainMapper()
125 : {
126 : try
127 : {
128 356 : uno::Reference< text::XDocumentIndexesSupplier> xIndexesSupplier( m_pImpl->GetTextDocument(), uno::UNO_QUERY );
129 356 : sal_Int32 nIndexes = 0;
130 356 : if( xIndexesSupplier.is() )
131 : {
132 343 : uno::Reference< container::XIndexAccess > xIndexes = xIndexesSupplier->getDocumentIndexes();
133 343 : nIndexes = xIndexes->getCount();
134 : }
135 : // If we have page references, those need updating as well, similar to the indexes.
136 712 : uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(m_pImpl->GetTextDocument(), uno::UNO_QUERY);
137 356 : if(xTextFieldsSupplier.is())
138 : {
139 343 : uno::Reference<container::XEnumeration> xEnumeration = xTextFieldsSupplier->getTextFields()->createEnumeration();
140 700 : while(xEnumeration->hasMoreElements())
141 : {
142 14 : ++nIndexes;
143 14 : xEnumeration->nextElement();
144 343 : }
145 : }
146 356 : if( nIndexes || m_pImpl->m_pSdtHelper->hasElements())
147 : {
148 : //index update has to wait until first view is created
149 17 : uno::Reference< document::XEventBroadcaster > xBroadcaster(xIndexesSupplier, uno::UNO_QUERY);
150 17 : if (xBroadcaster.is())
151 17 : xBroadcaster->addEventListener(uno::Reference< document::XEventListener >(new ModelEventListener(nIndexes, m_pImpl->m_pSdtHelper->hasElements())));
152 : }
153 :
154 :
155 : // Apply the document settings after everything else
156 712 : m_pImpl->GetSettingsTable()->ApplyProperties( m_pImpl->GetTextDocument( ) );
157 : }
158 0 : catch( const uno::Exception& rEx )
159 : {
160 : (void)rEx;
161 : }
162 :
163 356 : delete m_pImpl;
164 712 : }
165 :
166 12907 : void DomainMapper::lcl_attribute(Id nName, Value & val)
167 : {
168 12907 : static OUString sLocalBookmarkName;
169 12907 : sal_Int32 nIntValue = val.getInt();
170 12907 : OUString sStringValue = val.getString();
171 :
172 12907 : SectionPropertyMap * pSectionContext = m_pImpl->GetSectionContext();
173 :
174 12907 : if( nName >= NS_rtf::LN_WIDENT && nName <= NS_rtf::LN_LCBSTTBFUSSR )
175 0 : m_pImpl->GetFIB().SetData( nName, nIntValue );
176 : else
177 : {
178 :
179 :
180 12907 : switch( nName )
181 : {
182 : /* attributes to be ignored */
183 : case NS_rtf::LN_UNUSED1_3:
184 : case NS_rtf::LN_UNUSED1_7:
185 : case NS_rtf::LN_UNUSED8_3:
186 : case NS_rtf::LN_FWRITERESERVATION:
187 : case NS_rtf::LN_FLOADOVERRIDE:
188 : case NS_rtf::LN_FFAREAST:
189 : case NS_rtf::LN_FCRYPTO:
190 : case NS_rtf::LN_NFIBBACK:
191 : case NS_rtf::LN_LKEY:
192 : case NS_rtf::LN_ENVR:
193 : case NS_rtf::LN_FMAC:
194 : case NS_rtf::LN_FWORD97SAVED:
195 : case NS_rtf::LN_FCMAC:
196 : case NS_rtf::LN_PNFBPCHPFIRST_W6:
197 : case NS_rtf::LN_PNCHPFIRST_W6:
198 : case NS_rtf::LN_CPNBTECHP_W6:
199 : case NS_rtf::LN_PNFBPPAPFIRST_W6:
200 : case NS_rtf::LN_PNPAPFIRST_W6:
201 : case NS_rtf::LN_CPNBTEPAP_W6:
202 : case NS_rtf::LN_PNFBPLVCFIRST_W6:
203 : case NS_rtf::LN_PNLVCFIRST_W6:
204 : case NS_rtf::LN_CPNBTELVC_W6:
205 : case NS_rtf::LN_CBMAC:
206 : case NS_rtf::LN_LPRODUCTCREATED:
207 : case NS_rtf::LN_LPRODUCTREVISED:
208 : case NS_rtf::LN_CCPMCR:
209 : case NS_rtf::LN_PNFBPCHPFIRST:
210 : case NS_rtf::LN_PNFBPPAPFIRST:
211 : case NS_rtf::LN_PNFBPLVCFIRST:
212 : case NS_rtf::LN_FCISLANDFIRST:
213 : case NS_rtf::LN_FCISLANDLIM:
214 : case NS_rtf::LN_FCSTSHFORIG:
215 : case NS_rtf::LN_LCBSTSHFORIG:
216 : case NS_rtf::LN_FCPLCFPAD:
217 : case NS_rtf::LN_LCBPLCFPAD:
218 : case NS_rtf::LN_FCSTTBFGLSY:
219 : case NS_rtf::LN_LCBSTTBFGLSY:
220 : case NS_rtf::LN_FCPLCFGLSY:
221 : case NS_rtf::LN_LCBPLCFGLSY:
222 : case NS_rtf::LN_FCPLCFSEA:
223 : case NS_rtf::LN_LCBPLCFSEA:
224 : case NS_rtf::LN_FCPLCFFLDMCR:
225 : case NS_rtf::LN_LCBPLCFFLDMCR:
226 : case NS_rtf::LN_FCCMDS:
227 : case NS_rtf::LN_LCBCMDS:
228 : case NS_rtf::LN_FCPLCMCR:
229 : case NS_rtf::LN_LCBPLCMCR:
230 : case NS_rtf::LN_FCSTTBFMCR:
231 : case NS_rtf::LN_LCBSTTBFMCR:
232 : case NS_rtf::LN_FCPRDRVR:
233 : case NS_rtf::LN_LCBPRDRVR:
234 : case NS_rtf::LN_FCPRENVPORT:
235 : case NS_rtf::LN_LCBPRENVPORT:
236 : case NS_rtf::LN_FCPRENVLAND:
237 : case NS_rtf::LN_LCBPRENVLAND:
238 : case NS_rtf::LN_FCWSS:
239 : case NS_rtf::LN_LCBWSS:
240 : case NS_rtf::LN_FCPLCFPGDFTN:
241 : case NS_rtf::LN_LCBPLCFPGDFTN:
242 : case NS_rtf::LN_FCAUTOSAVESOURCE:
243 : case NS_rtf::LN_LCBAUTOSAVESOURCE:
244 : case NS_rtf::LN_FCPLCDOAMOM:
245 : case NS_rtf::LN_LCBPLCDOAMOM:
246 : case NS_rtf::LN_FCPLCDOAHDR:
247 : case NS_rtf::LN_LCBPLCDOAHDR:
248 : case NS_rtf::LN_FCPMS:
249 : case NS_rtf::LN_LCBPMS:
250 : case NS_rtf::LN_FCPLCFPGDEDN:
251 : case NS_rtf::LN_LCBPLCFPGDEDN:
252 : case NS_rtf::LN_FCPLCFWKB:
253 : case NS_rtf::LN_LCBPLCFWKB:
254 : case NS_rtf::LN_FCPLCFSPL:
255 : case NS_rtf::LN_LCBPLCFSPL:
256 : case NS_rtf::LN_FCSTWUSER:
257 : case NS_rtf::LN_LCBSTWUSER:
258 : case NS_rtf::LN_FCUNUSED:
259 : case NS_rtf::LN_LCBUNUSED:
260 : case NS_rtf::LN_FCSTTBFINTLFLD:
261 : case NS_rtf::LN_LCBSTTBFINTLFLD:
262 : case NS_rtf::LN_FCROUTESLIP:
263 : case NS_rtf::LN_LCBROUTESLIP:
264 : case NS_rtf::LN_FCSTTBSAVEDBY:
265 : case NS_rtf::LN_LCBSTTBSAVEDBY:
266 : case NS_rtf::LN_FCSTTBFNM:
267 : case NS_rtf::LN_LCBSTTBFNM:
268 : case NS_rtf::LN_FCDOCUNDO:
269 : case NS_rtf::LN_LCBDOCUNDO:
270 : case NS_rtf::LN_FCRGBUSE:
271 : case NS_rtf::LN_LCBRGBUSE:
272 : case NS_rtf::LN_FCUSP:
273 : case NS_rtf::LN_LCBUSP:
274 : case NS_rtf::LN_FCUSKF:
275 : case NS_rtf::LN_LCBUSKF:
276 : case NS_rtf::LN_FCPLCUPCRGBUSE:
277 : case NS_rtf::LN_LCBPLCUPCRGBUSE:
278 : case NS_rtf::LN_FCPLCUPCUSP:
279 : case NS_rtf::LN_LCBPLCUPCUSP:
280 : case NS_rtf::LN_FCPLGOSL:
281 : case NS_rtf::LN_LCBPLGOSL:
282 : case NS_rtf::LN_FCPLCOCX:
283 : case NS_rtf::LN_LCBPLCOCX:
284 : case NS_rtf::LN_DWLOWDATETIME:
285 : case NS_rtf::LN_DWHIGHDATETIME:
286 : case NS_rtf::LN_FCPLCASUMY:
287 : case NS_rtf::LN_LCBPLCASUMY:
288 : case NS_rtf::LN_FCPLCFGRAM:
289 : case NS_rtf::LN_LCBPLCFGRAM:
290 : case NS_rtf::LN_FCSTTBFUSSR:
291 0 : break;
292 :
293 : case NS_rtf::LN_ISTD: //index of applied style
294 : {
295 : //search for the style with the given id and apply it
296 : //as CharStyleName or ParaStyleName
297 : //if the style is a user defined style then it must have an ISTD - built-in styles might not have it
298 181 : StyleSheetTablePtr pStyleSheets = m_pImpl->GetStyleSheetTable();
299 362 : OUString sValue = OUString::valueOf(nIntValue, 16);
300 362 : const StyleSheetEntryPtr pEntry = pStyleSheets->FindStyleSheetByISTD(sValue);
301 181 : if( pEntry.get( ) )
302 : {
303 170 : bool bParaStyle = (pEntry->nStyleTypeCode == STYLE_TYPE_PARA);
304 170 : if(bParaStyle)
305 167 : m_pImpl->SetCurrentParaStyleId(OUString::valueOf(static_cast<sal_Int32>(nIntValue), 16));
306 170 : if (m_pImpl->GetTopContext() && m_pImpl->GetTopContextType() != CONTEXT_SECTION)
307 : m_pImpl->GetTopContext()->Insert(
308 : bParaStyle ?
309 : PROP_PARA_STYLE_NAME : PROP_CHAR_STYLE_NAME,
310 : uno::makeAny(
311 170 : m_pImpl->GetStyleSheetTable()->ConvertStyleName( pEntry->sStyleName ) ) );
312 181 : }
313 : }
314 181 : break;
315 : case NS_rtf::LN_ISTARTAT:
316 0 : break;
317 : case NS_rtf::LN_NFC:
318 0 : break;
319 : case NS_rtf::LN_FLEGAL:
320 0 : break;
321 : case NS_rtf::LN_FNORESTART:
322 0 : break;
323 : case NS_rtf::LN_FIDENTSAV:
324 0 : break;
325 : case NS_rtf::LN_FCONVERTED:
326 0 : break;
327 : case NS_rtf::LN_FTENTATIVE:
328 0 : break;
329 : case NS_rtf::LN_RGBXCHNUMS:
330 0 : break;
331 : case NS_rtf::LN_IXCHFOLLOW:
332 0 : break;
333 : case NS_rtf::LN_DXASPACE:
334 0 : break;
335 : case NS_rtf::LN_DXAINDENT:
336 0 : break;
337 : case NS_rtf::LN_CBGRPPRLCHPX:
338 0 : break;
339 : case NS_rtf::LN_CBGRPPRLPAPX:
340 0 : break;
341 : case NS_rtf::LN_LSID:
342 0 : break;
343 : case NS_rtf::LN_TPLC:
344 0 : break;
345 : case NS_rtf::LN_RGISTD:
346 0 : break;
347 : case NS_rtf::LN_FSIMPLELIST:
348 0 : break;
349 : case NS_rtf::LN_fAutoNum:
350 0 : break;
351 : case NS_rtf::LN_fHybrid:
352 0 : break;
353 : case NS_rtf::LN_ILVL:
354 0 : break;
355 : case NS_rtf::LN_FSTARTAT:
356 0 : break;
357 : case NS_rtf::LN_FFORMATTING:
358 0 : break;
359 : case NS_rtf::LN_UNSIGNED4_6:
360 0 : break;
361 : case NS_rtf::LN_clfolvl:
362 0 : break;
363 : case NS_rtf::LN_CBFFNM1:
364 0 : break;
365 : case NS_rtf::LN_PRQ:
366 0 : break;
367 : case NS_rtf::LN_FTRUETYPE:
368 0 : break;
369 : case NS_rtf::LN_FF:
370 0 : break;
371 : case NS_rtf::LN_WWEIGHT:
372 0 : break;
373 : case NS_rtf::LN_CHS:
374 :
375 : {
376 0 : m_pImpl->GetFIB().SetLNCHS( nIntValue );
377 : }
378 0 : break;
379 : case NS_rtf::LN_IXCHSZALT:
380 0 : break;
381 : case NS_rtf::LN_PANOSE:
382 0 : break;
383 : case NS_rtf::LN_FS:
384 0 : break;
385 : case NS_rtf::LN_STI:
386 0 : break;
387 : case NS_rtf::LN_FSCRATCH:
388 0 : break;
389 : case NS_rtf::LN_FINVALHEIGHT:
390 0 : break;
391 : case NS_rtf::LN_FHASUPE:
392 0 : break;
393 : case NS_rtf::LN_FMASSCOPY:
394 0 : break;
395 : case NS_rtf::LN_SGC:
396 0 : break;
397 : case NS_rtf::LN_ISTDBASE:
398 0 : break;
399 : case NS_rtf::LN_CUPX:
400 0 : break;
401 : case NS_rtf::LN_ISTDNEXT:
402 0 : break;
403 : case NS_rtf::LN_BCHUPE:
404 0 : break;
405 : case NS_rtf::LN_FAUTOREDEF:
406 0 : break;
407 : case NS_rtf::LN_FHIDDEN:
408 0 : break;
409 : case NS_rtf::LN_CSTD:
410 0 : break;
411 : case NS_rtf::LN_CBSTDBASEINFILE:
412 0 : break;
413 : case NS_rtf::LN_FSTDSTYLENAMESWRITTEN:
414 0 : break;
415 : case NS_rtf::LN_UNUSED4_2:
416 0 : break;
417 : case NS_rtf::LN_STIMAXWHENSAVED:
418 0 : break;
419 : case NS_rtf::LN_ISTDMAXFIXEDWHENSAVED:
420 0 : break;
421 : case NS_rtf::LN_NVERBUILTINNAMESWHENSAVED:
422 0 : break;
423 : case NS_rtf::LN_RGFTCSTANDARDCHPSTSH:
424 0 : break;
425 : case NS_rtf::LN_WIDENT:
426 :
427 : case NS_rtf::LN_NFIB:
428 :
429 : case NS_rtf::LN_NPRODUCT:
430 : case NS_rtf::LN_LID:
431 : case NS_rtf::LN_PNNEXT:
432 : case NS_rtf::LN_FDOT:
433 : case NS_rtf::LN_FGLSY:
434 : case NS_rtf::LN_FCOMPLEX:
435 : case NS_rtf::LN_FHASPIC:
436 : case NS_rtf::LN_CQUICKSAVES:
437 : case NS_rtf::LN_FENCRYPTED:
438 : case NS_rtf::LN_FWHICHTBLSTM:
439 : case NS_rtf::LN_FREADONLYRECOMMENDED:
440 : case NS_rtf::LN_FEXTCHAR:
441 : case NS_rtf::LN_FEMPTYSPECIAL:
442 : case NS_rtf::LN_FLOADOVERRIDEPAGE:
443 : case NS_rtf::LN_FFUTURESAVEDUNDO:
444 : case NS_rtf::LN_FSPARE0:
445 : case NS_rtf::LN_CHSTABLES:
446 : case NS_rtf::LN_FCMIN:
447 : case NS_rtf::LN_CSW:
448 : case NS_rtf::LN_WMAGICCREATED:
449 : case NS_rtf::LN_WMAGICREVISED:
450 : case NS_rtf::LN_WMAGICCREATEDPRIVATE:
451 : case NS_rtf::LN_WMAGICREVISEDPRIVATE:
452 : case NS_rtf::LN_LIDFE:
453 : case NS_rtf::LN_CLW:
454 : case NS_rtf::LN_CCPTEXT:
455 : case NS_rtf::LN_CCPFTN:
456 : case NS_rtf::LN_CCPHDD:
457 : case NS_rtf::LN_CCPATN:
458 : case NS_rtf::LN_CCPEDN:
459 : case NS_rtf::LN_CCPTXBX:
460 : case NS_rtf::LN_CCPHDRTXBX:
461 : case NS_rtf::LN_PNCHPFIRST:
462 : case NS_rtf::LN_CPNBTECHP:
463 : case NS_rtf::LN_PNPAPFIRST:
464 : case NS_rtf::LN_CPNBTEPAP:
465 : case NS_rtf::LN_PNLVCFIRST:
466 : case NS_rtf::LN_CPNBTELVC:
467 : case NS_rtf::LN_CFCLCB:
468 : case NS_rtf::LN_FCSTSHF:
469 : case NS_rtf::LN_LCBSTSHF:
470 : case NS_rtf::LN_FCPLCFFNDREF:
471 : case NS_rtf::LN_LCBPLCFFNDREF:
472 : case NS_rtf::LN_FCPLCFFNDTXT:
473 : case NS_rtf::LN_LCBPLCFFNDTXT:
474 : case NS_rtf::LN_FCPLCFANDREF:
475 : case NS_rtf::LN_LCBPLCFANDREF:
476 : case NS_rtf::LN_FCPLCFANDTXT:
477 : case NS_rtf::LN_LCBPLCFANDTXT:
478 : case NS_rtf::LN_FCPLCFSED:
479 : case NS_rtf::LN_LCBPLCFSED:
480 : case NS_rtf::LN_FCPLCFPHE:
481 : case NS_rtf::LN_LCBPLCFPHE:
482 : case NS_rtf::LN_FCPLCFHDD:
483 : case NS_rtf::LN_LCBPLCFHDD:
484 : case NS_rtf::LN_FCPLCFBTECHPX:
485 : case NS_rtf::LN_LCBPLCFBTECHPX:
486 : case NS_rtf::LN_FCPLCFBTEPAPX:
487 : case NS_rtf::LN_LCBPLCFBTEPAPX:
488 : case NS_rtf::LN_FCSTTBFFFN:
489 : case NS_rtf::LN_LCBSTTBFFFN:
490 : case NS_rtf::LN_FCPLCFFLDMOM:
491 : case NS_rtf::LN_LCBPLCFFLDMOM:
492 : case NS_rtf::LN_FCPLCFFLDHDR:
493 : case NS_rtf::LN_LCBPLCFFLDHDR:
494 : case NS_rtf::LN_FCPLCFFLDFTN:
495 : case NS_rtf::LN_LCBPLCFFLDFTN:
496 : case NS_rtf::LN_FCPLCFFLDATN:
497 : case NS_rtf::LN_LCBPLCFFLDATN:
498 : case NS_rtf::LN_FCSTTBFBKMK:
499 : case NS_rtf::LN_LCBSTTBFBKMK:
500 : case NS_rtf::LN_FCPLCFBKF:
501 : case NS_rtf::LN_LCBPLCFBKF:
502 : case NS_rtf::LN_FCPLCFBKL:
503 : case NS_rtf::LN_LCBPLCFBKL:
504 : case NS_rtf::LN_FCDOP:
505 : case NS_rtf::LN_LCBDOP:
506 : case NS_rtf::LN_FCSTTBFASSOC:
507 : case NS_rtf::LN_LCBSTTBFASSOC:
508 : case NS_rtf::LN_FCCLX:
509 : case NS_rtf::LN_LCBCLX:
510 : case NS_rtf::LN_FCGRPXSTATNOWNERS:
511 : case NS_rtf::LN_LCBGRPXSTATNOWNERS:
512 : case NS_rtf::LN_FCSTTBFATNBKMK:
513 : case NS_rtf::LN_LCBSTTBFATNBKMK:
514 : case NS_rtf::LN_FCPLCSPAMOM:
515 : case NS_rtf::LN_LCBPLCSPAMOM:
516 : case NS_rtf::LN_FCPLCSPAHDR:
517 : case NS_rtf::LN_LCBPLCSPAHDR:
518 : case NS_rtf::LN_FCPLCFATNBKF:
519 : case NS_rtf::LN_LCBPLCFATNBKF:
520 : case NS_rtf::LN_FCPLCFATNBKL:
521 : case NS_rtf::LN_LCBPLCFATNBKL:
522 : case NS_rtf::LN_FCFORMFLDSTTBF:
523 : case NS_rtf::LN_LCBFORMFLDSTTBF:
524 : case NS_rtf::LN_FCPLCFENDREF:
525 : case NS_rtf::LN_LCBPLCFENDREF:
526 : case NS_rtf::LN_FCPLCFENDTXT:
527 : case NS_rtf::LN_LCBPLCFENDTXT:
528 : case NS_rtf::LN_FCPLCFFLDEDN:
529 : case NS_rtf::LN_LCBPLCFFLDEDN:
530 : case NS_rtf::LN_FCDGGINFO:
531 : case NS_rtf::LN_LCBDGGINFO:
532 : case NS_rtf::LN_FCSTTBFRMARK:
533 : case NS_rtf::LN_LCBSTTBFRMARK:
534 : case NS_rtf::LN_FCSTTBFCAPTION:
535 : case NS_rtf::LN_LCBSTTBFCAPTION:
536 : case NS_rtf::LN_FCSTTBFAUTOCAPTION:
537 : case NS_rtf::LN_LCBSTTBFAUTOCAPTION:
538 : case NS_rtf::LN_LCBPLCFTXBXTXT:
539 : case NS_rtf::LN_FCPLCFFLDTXBX:
540 : case NS_rtf::LN_LCBPLCFFLDTXBX:
541 : case NS_rtf::LN_FCPLCFHDRTXBXTXT:
542 : case NS_rtf::LN_LCBPLCFHDRTXBXTXT:
543 : case NS_rtf::LN_FCPLCFFLDHDRTXBX:
544 : case NS_rtf::LN_LCBPLCFFLDHDRTXBX:
545 : case NS_rtf::LN_FCSTTBTTMBD:
546 : case NS_rtf::LN_LCBSTTBTTMBD:
547 : case NS_rtf::LN_FCPGDMOTHER:
548 : case NS_rtf::LN_LCBPGDMOTHER:
549 : case NS_rtf::LN_FCBKDMOTHER:
550 : case NS_rtf::LN_LCBBKDMOTHER:
551 : case NS_rtf::LN_FCPGDFTN:
552 : case NS_rtf::LN_LCBPGDFTN:
553 : case NS_rtf::LN_FCBKDFTN:
554 : case NS_rtf::LN_LCBBKDFTN:
555 : case NS_rtf::LN_FCPGDEDN:
556 : case NS_rtf::LN_LCBPGDEDN:
557 : case NS_rtf::LN_FCBKDEDN:
558 : case NS_rtf::LN_LCBBKDEDN:
559 : case NS_rtf::LN_FCPLCFLST:
560 : case NS_rtf::LN_LCBPLCFLST:
561 : case NS_rtf::LN_FCPLFLFO:
562 : case NS_rtf::LN_LCBPLFLFO:
563 : case NS_rtf::LN_FCPLCFTXBXBKD:
564 : case NS_rtf::LN_LCBPLCFTXBXBKD:
565 : case NS_rtf::LN_FCPLCFTXBXHDRBKD:
566 : case NS_rtf::LN_LCBPLCFTXBXHDRBKD:
567 : case NS_rtf::LN_FCSTTBGLSYSTYLE:
568 : case NS_rtf::LN_LCBSTTBGLSYSTYLE:
569 : case NS_rtf::LN_FCPLCFBTELVC:
570 : case NS_rtf::LN_LCBPLCFBTELVC:
571 : case NS_rtf::LN_FCPLCFLVC:
572 : case NS_rtf::LN_LCBPLCFLVC:
573 : case NS_rtf::LN_FCSTTBLISTNAMES:
574 : case NS_rtf::LN_LCBSTTBLISTNAMES:
575 : case NS_rtf::LN_LCBSTTBFUSSR:
576 : {
577 0 : m_pImpl->GetFIB().SetData( nName, nIntValue );
578 : }
579 0 : break;
580 : case NS_rtf::LN_FN:
581 : case NS_rtf::LN_FCSEPX:
582 : case NS_rtf::LN_FNMPR:
583 : case NS_rtf::LN_FCMPR:
584 :
585 : //section descriptor, unused or internally used
586 0 : break;
587 : case NS_rtf::LN_ICOFORE:
588 0 : break;
589 : case NS_rtf::LN_ICOBACK:
590 0 : break;
591 : case NS_rtf::LN_IPAT:
592 0 : break;
593 : case NS_rtf::LN_SHDFORECOLOR:
594 0 : break;
595 : case NS_rtf::LN_SHDBACKCOLOR:
596 0 : break;
597 : case NS_rtf::LN_SHDPATTERN:
598 0 : break;
599 : case NS_rtf::LN_DPTLINEWIDTH:
600 0 : break;
601 : case NS_rtf::LN_BRCTYPE:
602 0 : break;
603 : case NS_rtf::LN_ICO:
604 0 : break;
605 : case NS_rtf::LN_DPTSPACE:
606 0 : break;
607 : case NS_rtf::LN_FSHADOW:
608 0 : break;
609 : case NS_rtf::LN_FFRAME:
610 0 : break;
611 : case NS_rtf::LN_UNUSED2_15:
612 0 : break;
613 : case NS_rtf::LN_FFIRSTMERGED:
614 0 : break;
615 : case NS_rtf::LN_FMERGED:
616 0 : break;
617 : case NS_rtf::LN_FVERTICAL:
618 0 : break;
619 : case NS_rtf::LN_FBACKWARD:
620 0 : break;
621 : case NS_rtf::LN_FROTATEFONT:
622 0 : break;
623 : case NS_rtf::LN_FVERTMERGE:
624 0 : break;
625 : case NS_rtf::LN_FVERTRESTART:
626 0 : break;
627 : case NS_rtf::LN_VERTALIGN:
628 0 : break;
629 : case NS_rtf::LN_FUNUSED:
630 0 : break;
631 : case NS_rtf::LN_BRCTOP:
632 : case NS_rtf::LN_BRCLEFT:
633 : case NS_rtf::LN_BRCBOTTOM:
634 : case NS_rtf::LN_BRCRIGHT:
635 : {
636 0 : table::BorderLine2 aBorderLine;
637 0 : sal_Int32 nLineDistance = ConversionHelper::MakeBorderLine( nIntValue, aBorderLine );
638 : (void)nLineDistance;
639 0 : PropertyIds eBorderId = PROP_LEFT_BORDER;
640 0 : PropertyIds eBorderDistId = PROP_LEFT_BORDER_DISTANCE ;
641 0 : switch( nName )
642 : {
643 : case NS_rtf::LN_BRCTOP:
644 0 : eBorderId = PROP_TOP_BORDER ;
645 0 : eBorderDistId = PROP_TOP_BORDER_DISTANCE;
646 0 : break;
647 : case NS_rtf::LN_BRCLEFT:
648 0 : break;
649 : case NS_rtf::LN_BRCBOTTOM:
650 0 : eBorderId = PROP_BOTTOM_BORDER ;
651 0 : eBorderDistId = PROP_BOTTOM_BORDER_DISTANCE;
652 0 : break;
653 : case NS_rtf::LN_BRCRIGHT:
654 0 : eBorderId = PROP_RIGHT_BORDER ;
655 0 : eBorderDistId = PROP_RIGHT_BORDER_DISTANCE ;
656 0 : break;
657 : default:;
658 : }
659 : //todo: where to put the border properties
660 : //rContext->Insert(eBorderId, uno::makeAny( aBorderLine ));
661 : //rContext->Insert(eBorderDistId, uno::makeAny( nLineDistance ));
662 : (void)eBorderId;
663 : (void)eBorderDistId;
664 : }
665 0 : break;
666 : case NS_rtf::LN_ITCFIRST:
667 0 : break;
668 : case NS_rtf::LN_FPUB:
669 0 : break;
670 : case NS_rtf::LN_ITCLIM:
671 0 : break;
672 : case NS_rtf::LN_FCOL:
673 0 : break;
674 : case NS_rtf::LN_LINECOLOR:
675 0 : break;
676 : case NS_rtf::LN_LINEWIDTH:
677 0 : break;
678 : case NS_rtf::LN_LINETYPE:
679 0 : break;
680 : case NS_rtf::LN_MM:
681 0 : break;
682 : case NS_rtf::LN_XEXT:
683 0 : break;
684 : case NS_rtf::LN_YEXT:
685 0 : break;
686 : case NS_rtf::LN_HMF:
687 0 : break;
688 : case NS_rtf::LN_LCB:
689 0 : break;
690 : case NS_rtf::LN_CBHEADER:
691 0 : break;
692 : case NS_rtf::LN_MFP:
693 0 : break;
694 : case NS_rtf::LN_BM_RCWINMF:
695 0 : break;
696 : case NS_rtf::LN_DXAGOAL:
697 0 : break;
698 : case NS_rtf::LN_DYAGOAL:
699 0 : break;
700 : case NS_rtf::LN_MX:
701 0 : break;
702 : case NS_rtf::LN_MY:
703 0 : break;
704 : case NS_rtf::LN_DXACROPLEFT:
705 0 : break;
706 : case NS_rtf::LN_DYACROPTOP:
707 0 : break;
708 : case NS_rtf::LN_DXACROPRIGHT:
709 0 : break;
710 : case NS_rtf::LN_DYACROPBOTTOM:
711 0 : break;
712 : case NS_rtf::LN_BRCL:
713 0 : break;
714 : case NS_rtf::LN_FFRAMEEMPTY:
715 0 : break;
716 : case NS_rtf::LN_FBITMAP:
717 0 : break;
718 : case NS_rtf::LN_FDRAWHATCH:
719 0 : break;
720 : case NS_rtf::LN_FERROR:
721 0 : break;
722 : case NS_rtf::LN_BPP:
723 0 : break;
724 : case NS_rtf::LN_DXAORIGIN:
725 0 : break;
726 : case NS_rtf::LN_DYAORIGIN:
727 0 : break;
728 : case NS_rtf::LN_CPROPS:
729 0 : break;
730 : case NS_rtf::LN_LINEPROPSTOP:
731 0 : break;
732 : case NS_rtf::LN_LINEPROPSLEFT:
733 0 : break;
734 : case NS_rtf::LN_LINEPROPSBOTTOM:
735 0 : break;
736 : case NS_rtf::LN_LINEPROPSRIGHT:
737 0 : break;
738 : case NS_rtf::LN_LINEPROPSHORIZONTAL:
739 0 : break;
740 : case NS_rtf::LN_LINEPROPSVERTICAL:
741 0 : break;
742 : case NS_rtf::LN_headerr:
743 0 : break;
744 : case NS_rtf::LN_footerr:
745 0 : break;
746 : case NS_rtf::LN_endnote:
747 0 : break;
748 : case NS_rtf::LN_BOOKMARKNAME:
749 : // sStringValue contains the bookmark name
750 46 : sLocalBookmarkName = sStringValue;
751 46 : break;
752 : case NS_rtf::LN_IBKL:
753 : //contains the bookmark identifier - has to be added to the bookmark name imported before
754 : //if it is already available then the bookmark should be inserted
755 88 : m_pImpl->AddBookmark( sLocalBookmarkName, sStringValue );
756 88 : sLocalBookmarkName = OUString();
757 88 : break;
758 : case NS_rtf::LN_LISTLEVEL:
759 0 : break;
760 : case NS_rtf::LN_LFOData:
761 0 : break;
762 : case NS_rtf::LN_F:
763 0 : break;
764 : case NS_rtf::LN_ALTFONTNAME:
765 0 : break;
766 : case NS_rtf::LN_XSZFFN:
767 0 : break;
768 : case NS_rtf::LN_XSTZNAME:
769 0 : break;
770 : case NS_rtf::LN_XSTZNAME1:
771 0 : break;
772 : case NS_rtf::LN_UPXSTART:
773 0 : break;
774 : case NS_rtf::LN_UPX:
775 0 : break;
776 : case NS_rtf::LN_sed:
777 : //section properties
778 0 : resolveAttributeProperties(*this, val);
779 0 : break;
780 : case NS_rtf::LN_tbdAdd:
781 : //
782 : {
783 0 : writerfilter::Reference<Properties>::Pointer_t pProperties = val.getProperties();
784 0 : if( pProperties.get())
785 : {
786 0 : pProperties->resolve(*this);
787 : //increment to the next tab stop
788 0 : m_pImpl->NextTabStop();
789 0 : }
790 : }
791 0 : break;
792 : case NS_rtf::LN_dxaDel:
793 : //deleted tab
794 : case NS_rtf::LN_dxaAdd:
795 : //set tab
796 : case NS_rtf::LN_TLC:
797 : //tab leading characters - for decimal tabs
798 : case NS_rtf::LN_JC:
799 : //tab justification
800 0 : m_pImpl->ModifyCurrentTabStop(nName, nIntValue);
801 0 : break;
802 : case NS_rtf::LN_UNUSED0_6:
803 : // really unused
804 0 : break;
805 : case NS_rtf::LN_rgbrc:
806 0 : break;
807 : case NS_rtf::LN_shd:
808 0 : break;
809 : case NS_rtf::LN_cellShd:
810 0 : break;
811 : case NS_rtf::LN_cellTopColor:
812 : case NS_rtf::LN_cellLeftColor:
813 : case NS_rtf::LN_cellBottomColor:
814 : case NS_rtf::LN_cellRightColor:
815 : OSL_FAIL("handled by DomainMapperTableManager");
816 0 : break;
817 :
818 : case NS_rtf::LN_LISTTABLE:
819 0 : break;
820 : case NS_rtf::LN_LFOTABLE:
821 0 : break;
822 : case NS_rtf::LN_FONTTABLE:
823 0 : break;
824 : case NS_rtf::LN_STYLESHEET:
825 0 : break;
826 :
827 : case NS_rtf::LN_fcEastAsianLayout:
828 : /* it seems that the value is following:
829 : ???? XX YYYY ZZ
830 : where
831 : XX seems to be the run id
832 : ZZ is the length of the function that is normally 6
833 : Lower byte of YYYY determines whether it is
834 : vertical text flow (0x01), or
835 : two lines in one layout (0x02).
836 : For 0x01, if the higher byte of YYYY is zero, the text is not scaled to fit the line height,
837 : in opposite case, it is to be scaled.
838 : For 0x02, the higher byte of YYYY is determining the prefix and suffix of the run:
839 : no brackets (0x00) ,
840 : () round brackets (0x01),
841 : [] square brackets (0x02),
842 : <> angle brackets (0x03) and
843 : {} curly brackets (0x04).
844 : ???? is different and we do not know its signification
845 : */
846 :
847 0 : if ((nIntValue & 0x000000FF) == 6)
848 : {
849 0 : switch ((nIntValue & 0x0000FF00) >> 8)
850 : {
851 : case 1: // vertical text
852 0 : if (m_pImpl->GetTopContext())
853 : {
854 0 : m_pImpl->GetTopContext()->Insert(PROP_CHAR_ROTATION, uno::makeAny ( sal_Int16(900) ));
855 0 : m_pImpl->GetTopContext()->Insert(PROP_CHAR_ROTATION_IS_FIT_TO_LINE, uno::makeAny (((nIntValue & 0x00FF0000) >> 16) != 0));
856 : }
857 0 : break;
858 : case 2: // two lines in one
859 0 : if (m_pImpl->GetTopContext())
860 : {
861 0 : m_pImpl->GetTopContext()->Insert(PROP_CHAR_COMBINE_IS_ON, uno::makeAny ( true ));
862 0 : m_pImpl->GetTopContext()->Insert(PROP_CHAR_COMBINE_PREFIX, uno::makeAny ( getBracketStringFromEnum((nIntValue & 0x00FF0000) >> 16)));
863 0 : m_pImpl->GetTopContext()->Insert(PROP_CHAR_COMBINE_SUFFIX, uno::makeAny ( getBracketStringFromEnum((nIntValue & 0x00FF0000) >> 16, false)));
864 : }
865 0 : break;
866 : default:
867 0 : break;
868 : }
869 : }
870 0 : break;
871 : case NS_rtf::LN_FRD :
872 : //footnote reference descriptor, if nIntValue > 0 then automatic, custom otherwise
873 : //ignored
874 0 : break;
875 : case NS_rtf::LN_FONT: //font of footnote symbol
876 0 : if (m_pImpl->GetTopContext())
877 0 : m_pImpl->GetTopContext()->SetFootnoteFontId( nIntValue );
878 0 : break;
879 : case NS_ooxml::LN_CT_Sym_char:
880 0 : if( m_pImpl->GetTopContext() && m_pImpl->GetTopContext()->GetFootnote().is())
881 : {
882 0 : m_pImpl->GetTopContext()->GetFootnote()->setLabel(OUString( sal_Unicode(nIntValue)));
883 0 : break;
884 : }
885 : else //it's a _real_ symbol
886 : {
887 0 : utext( reinterpret_cast < const sal_uInt8 * >( &nIntValue ), 1 );
888 : }
889 0 : break;
890 : case NS_rtf::LN_CHAR: //footnote symbol character
891 0 : if (m_pImpl->GetTopContext())
892 0 : m_pImpl->GetTopContext()->SetFootnoteSymbol( sal_Unicode(nIntValue));
893 0 : break;
894 : case NS_ooxml::LN_CT_Sym_font:
895 : //the footnote symbol and font are provided after the footnote is already inserted
896 0 : if( m_pImpl->GetTopContext() && m_pImpl->GetTopContext()->GetFootnote().is())
897 : {
898 0 : uno::Reference< beans::XPropertySet > xAnchorProps( m_pImpl->GetTopContext()->GetFootnote()->getAnchor(), uno::UNO_QUERY );
899 0 : xAnchorProps->setPropertyValue(
900 0 : PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_CHAR_FONT_NAME),
901 0 : uno::makeAny( sStringValue ));
902 : }
903 : else //a real symbol
904 0 : if (m_pImpl->GetTopContext())
905 0 : m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME, uno::makeAny( sStringValue ));
906 0 : break;
907 : case NS_ooxml::LN_CT_Underline_val:
908 66 : handleUnderlineType(nIntValue, m_pImpl->GetTopContext());
909 66 : break;
910 : case NS_ooxml::LN_CT_Color_val:
911 504 : if (m_pImpl->GetTopContext())
912 504 : m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR, uno::makeAny( nIntValue ) );
913 504 : break;
914 : case NS_ooxml::LN_CT_Underline_color:
915 4 : if (m_pImpl->GetTopContext())
916 : {
917 4 : m_pImpl->GetTopContext()->Insert(PROP_CHAR_UNDERLINE_HAS_COLOR, uno::makeAny( true ) );
918 4 : m_pImpl->GetTopContext()->Insert(PROP_CHAR_UNDERLINE_COLOR, uno::makeAny( nIntValue ) );
919 : }
920 4 : break;
921 :
922 : case NS_ooxml::LN_CT_TabStop_val:
923 252 : if (sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_ST_TabJc_clear)
924 : {
925 2 : m_pImpl->m_aCurrentTabStop.bDeleted = true;
926 : }
927 : else
928 : {
929 250 : m_pImpl->m_aCurrentTabStop.bDeleted = false;
930 250 : m_pImpl->m_aCurrentTabStop.Alignment = getTabAlignFromValue(nIntValue);
931 : }
932 252 : break;
933 : case NS_ooxml::LN_CT_TabStop_leader:
934 80 : m_pImpl->m_aCurrentTabStop.FillChar = getFillCharFromValue(nIntValue);
935 80 : break;
936 : case NS_ooxml::LN_CT_TabStop_pos:
937 369 : m_pImpl->m_aCurrentTabStop.Position = ConversionHelper::convertTwipToMM100(nIntValue);
938 369 : break;
939 :
940 : case NS_ooxml::LN_CT_Fonts_ascii:
941 921 : if (m_pImpl->GetTopContext())
942 921 : m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME, uno::makeAny( sStringValue ));
943 921 : break;
944 : case NS_ooxml::LN_CT_Fonts_asciiTheme:
945 206 : if (m_pImpl->GetTopContext())
946 206 : m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME, uno::makeAny( m_pImpl->GetThemeTable()->getFontNameForTheme(nIntValue) ));
947 206 : break;
948 : case NS_ooxml::LN_CT_Fonts_hAnsi:
949 921 : break;//unsupported
950 : case NS_ooxml::LN_CT_Fonts_hAnsiTheme:
951 206 : break; //unsupported
952 : case NS_ooxml::LN_CT_Fonts_eastAsia:
953 373 : if (m_pImpl->GetTopContext())
954 373 : m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME_ASIAN, uno::makeAny( sStringValue ));
955 373 : break;
956 : case NS_ooxml::LN_CT_Fonts_eastAsiaTheme:
957 181 : if (m_pImpl->GetTopContext())
958 181 : m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME_COMPLEX, uno::makeAny( m_pImpl->GetThemeTable()->getFontNameForTheme(nIntValue) ) );
959 181 : break;
960 : case NS_ooxml::LN_CT_Fonts_cs:
961 986 : if (m_pImpl->GetTopContext())
962 986 : m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME_COMPLEX, uno::makeAny( sStringValue ));
963 986 : break;
964 : case NS_ooxml::LN_CT_Fonts_cstheme:
965 163 : if (m_pImpl->GetTopContext())
966 163 : m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME_COMPLEX, uno::makeAny( m_pImpl->GetThemeTable()->getFontNameForTheme(nIntValue) ));
967 163 : break;
968 : case NS_ooxml::LN_CT_Spacing_before:
969 873 : if (m_pImpl->GetTopContext())
970 873 : m_pImpl->GetTopContext()->Insert(PROP_PARA_TOP_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue ) ));
971 873 : break;
972 : case NS_ooxml::LN_CT_Spacing_beforeLines:
973 2 : break;
974 : case NS_ooxml::LN_CT_Spacing_after:
975 948 : if (m_pImpl->GetTopContext())
976 948 : m_pImpl->GetTopContext()->Insert(PROP_PARA_BOTTOM_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue ) ));
977 948 : break;
978 : case NS_ooxml::LN_CT_Spacing_afterLines:
979 2 : break;
980 : case NS_ooxml::LN_CT_Spacing_line: //91434
981 : case NS_ooxml::LN_CT_Spacing_lineRule: //91435
982 : {
983 : #define SINGLE_LINE_SPACING 240
984 750 : style::LineSpacing aSpacing;
985 750 : PropertyMapPtr pTopContext = m_pImpl->GetTopContext();
986 750 : bool bFound = false;
987 750 : PropertyMap::iterator aLineSpacingIter;
988 750 : if (pTopContext)
989 : {
990 750 : aLineSpacingIter = pTopContext->find(PropertyDefinition( PROP_PARA_LINE_SPACING ) );
991 750 : bFound = aLineSpacingIter != pTopContext->end();
992 : }
993 750 : if (bFound)
994 : {
995 375 : aLineSpacingIter->second >>= aSpacing;
996 : }
997 : else
998 : {
999 : //default to single line spacing
1000 375 : aSpacing.Mode = style::LineSpacingMode::FIX;
1001 375 : aSpacing.Height = sal_Int16(ConversionHelper::convertTwipToMM100( SINGLE_LINE_SPACING ));
1002 : }
1003 750 : if( nName == NS_ooxml::LN_CT_Spacing_line )
1004 : {
1005 : //now set the value depending on the Mode
1006 375 : if( aSpacing.Mode == style::LineSpacingMode::PROP )
1007 259 : aSpacing.Height = sal_Int16(sal_Int32(nIntValue) * 100 / SINGLE_LINE_SPACING );
1008 : else
1009 116 : aSpacing.Height = sal_Int16(ConversionHelper::convertTwipToMM100( nIntValue ));
1010 : }
1011 : else //NS_ooxml::LN_CT_Spacing_lineRule:
1012 : {
1013 : // exactly, atLeast, auto
1014 375 : if( sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_auto)
1015 : {
1016 259 : aSpacing.Mode = style::LineSpacingMode::PROP;
1017 : //reinterpret the already set value
1018 259 : aSpacing.Height = sal_Int16( aSpacing.Height * 100 / ConversionHelper::convertTwipToMM100( SINGLE_LINE_SPACING ));
1019 : }
1020 116 : else if( sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_atLeast)
1021 104 : aSpacing.Mode = style::LineSpacingMode::MINIMUM;
1022 : else // NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_exact
1023 12 : aSpacing.Mode = style::LineSpacingMode::FIX;
1024 : }
1025 750 : if (pTopContext)
1026 750 : pTopContext->Insert(PROP_PARA_LINE_SPACING, uno::makeAny( aSpacing ));
1027 : }
1028 750 : break;
1029 : case NS_ooxml::LN_CT_Ind_start:
1030 : case NS_ooxml::LN_CT_Ind_left:
1031 99 : if (m_pImpl->GetTopContext())
1032 : {
1033 : // Word inherits FirstLineIndent property of the numbering, even if ParaLeftMargin is set, Writer does not.
1034 : // So copy it explicitly, if necessary.
1035 99 : sal_Int32 nFirstLineIndent = m_pImpl->getCurrentNumberingProperty("FirstLineIndent");
1036 :
1037 99 : if (nFirstLineIndent != 0)
1038 2 : m_pImpl->GetTopContext()->Insert(PROP_PARA_FIRST_LINE_INDENT, uno::makeAny(nFirstLineIndent));
1039 :
1040 : m_pImpl->GetTopContext()->Insert(
1041 99 : PROP_PARA_LEFT_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue ) ));
1042 : }
1043 99 : break;
1044 : case NS_ooxml::LN_CT_Ind_end:
1045 : case NS_ooxml::LN_CT_Ind_right:
1046 39 : if (m_pImpl->GetTopContext())
1047 : {
1048 : // Word inherits FirstLineIndent/ParaLeftMargin property of the numbering, even if ParaRightMargin is set, Writer does not.
1049 : // So copy it explicitly, if necessary.
1050 39 : sal_Int32 nFirstLineIndent = m_pImpl->getCurrentNumberingProperty("FirstLineIndent");
1051 39 : sal_Int32 nParaLeftMargin = m_pImpl->getCurrentNumberingProperty("IndentAt");
1052 :
1053 39 : if (nFirstLineIndent != 0)
1054 1 : m_pImpl->GetTopContext()->Insert(PROP_PARA_FIRST_LINE_INDENT, uno::makeAny(nFirstLineIndent));
1055 39 : if (nParaLeftMargin != 0)
1056 1 : m_pImpl->GetTopContext()->Insert(PROP_PARA_LEFT_MARGIN, uno::makeAny(nParaLeftMargin));
1057 :
1058 : m_pImpl->GetTopContext()->Insert(
1059 39 : PROP_PARA_RIGHT_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue ) ));
1060 : }
1061 39 : break;
1062 : case NS_ooxml::LN_CT_Ind_hanging:
1063 16 : if (m_pImpl->GetTopContext())
1064 : {
1065 16 : sal_Int32 nValue = ConversionHelper::convertTwipToMM100( nIntValue );
1066 : m_pImpl->GetTopContext()->Insert(
1067 16 : PROP_PARA_FIRST_LINE_INDENT, uno::makeAny( - nValue ));
1068 : }
1069 16 : break;
1070 : case NS_ooxml::LN_CT_Ind_firstLine:
1071 14 : if (m_pImpl->GetTopContext())
1072 : m_pImpl->GetTopContext()->Insert(
1073 14 : PROP_PARA_FIRST_LINE_INDENT, uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue ) ));
1074 14 : break;
1075 :
1076 : case NS_ooxml::LN_CT_EastAsianLayout_id:
1077 0 : break;
1078 : case NS_ooxml::LN_CT_EastAsianLayout_combine:
1079 0 : if (m_pImpl->GetTopContext())
1080 0 : m_pImpl->GetTopContext()->Insert(PROP_CHAR_COMBINE_IS_ON, uno::makeAny ( nIntValue ? true : false ));
1081 0 : break;
1082 : case NS_ooxml::LN_CT_EastAsianLayout_combineBrackets:
1083 0 : if (m_pImpl->GetTopContext())
1084 : {
1085 0 : OUString sCombinePrefix = getBracketStringFromEnum(nIntValue);
1086 0 : OUString sCombineSuffix = getBracketStringFromEnum(nIntValue, false);
1087 0 : m_pImpl->GetTopContext()->Insert(PROP_CHAR_COMBINE_PREFIX, uno::makeAny ( sCombinePrefix ));
1088 0 : m_pImpl->GetTopContext()->Insert(PROP_CHAR_COMBINE_SUFFIX, uno::makeAny ( sCombineSuffix ));
1089 : }
1090 0 : break;
1091 : case NS_ooxml::LN_CT_EastAsianLayout_vert:
1092 0 : if (m_pImpl->GetTopContext())
1093 : {
1094 0 : sal_Int16 nRotationAngle = (nIntValue ? 900 : 0);
1095 0 : m_pImpl->GetTopContext()->Insert(PROP_CHAR_ROTATION, uno::makeAny ( nRotationAngle ));
1096 : }
1097 0 : break;
1098 : case NS_ooxml::LN_CT_EastAsianLayout_vertCompress:
1099 0 : if (m_pImpl->GetTopContext())
1100 0 : m_pImpl->GetTopContext()->Insert(PROP_CHAR_ROTATION_IS_FIT_TO_LINE, uno::makeAny ( nIntValue ? true : false));
1101 0 : break;
1102 :
1103 : case NS_ooxml::LN_CT_PageSz_code:
1104 24 : CT_PageSz.code = nIntValue;
1105 24 : break;
1106 : case NS_ooxml::LN_CT_PageSz_h:
1107 : {
1108 255 : sal_Int32 nHeight = ConversionHelper::convertTwipToMM100(nIntValue);
1109 255 : CT_PageSz.h = PaperInfo::sloppyFitPageDimension(nHeight);
1110 : }
1111 255 : break;
1112 : case NS_ooxml::LN_CT_PageSz_orient:
1113 6 : CT_PageSz.orient = (nIntValue != 0);
1114 6 : break;
1115 : case NS_ooxml::LN_CT_PageSz_w:
1116 : {
1117 255 : sal_Int32 nWidth = ConversionHelper::convertTwipToMM100(nIntValue);
1118 255 : CT_PageSz.w = PaperInfo::sloppyFitPageDimension(nWidth);
1119 : }
1120 255 : break;
1121 :
1122 : case NS_ooxml::LN_CT_PageMar_top:
1123 254 : m_pImpl->SetPageMarginTwip( PAGE_MAR_TOP, nIntValue );
1124 254 : break;
1125 : case NS_ooxml::LN_CT_PageMar_right:
1126 256 : m_pImpl->SetPageMarginTwip( PAGE_MAR_RIGHT, nIntValue );
1127 256 : break;
1128 : case NS_ooxml::LN_CT_PageMar_bottom:
1129 253 : m_pImpl->SetPageMarginTwip( PAGE_MAR_BOTTOM, nIntValue );
1130 253 : break;
1131 : case NS_ooxml::LN_CT_PageMar_left:
1132 256 : m_pImpl->SetPageMarginTwip( PAGE_MAR_LEFT, nIntValue );
1133 256 : break;
1134 : case NS_ooxml::LN_CT_PageMar_header:
1135 179 : m_pImpl->SetPageMarginTwip( PAGE_MAR_HEADER, nIntValue );
1136 179 : break;
1137 : case NS_ooxml::LN_CT_PageMar_footer:
1138 178 : m_pImpl->SetPageMarginTwip( PAGE_MAR_FOOTER, nIntValue );
1139 178 : break;
1140 : case NS_ooxml::LN_CT_PageMar_gutter:
1141 174 : m_pImpl->SetPageMarginTwip( PAGE_MAR_GUTTER, nIntValue );
1142 174 : break;
1143 : case NS_ooxml::LN_CT_Language_val: //90314
1144 : case NS_ooxml::LN_CT_Language_eastAsia: //90315
1145 : case NS_ooxml::LN_CT_Language_bidi: //90316
1146 : {
1147 928 : lang::Locale aLocale( LanguageTag( sStringValue).getLocale());
1148 928 : if (m_pImpl->GetTopContext())
1149 : m_pImpl->GetTopContext()->Insert(NS_ooxml::LN_CT_Language_val== nName ? PROP_CHAR_LOCALE :
1150 : NS_ooxml::LN_CT_Language_eastAsia == nName ? PROP_CHAR_LOCALE_ASIAN : PROP_CHAR_LOCALE_COMPLEX,
1151 928 : uno::makeAny( aLocale ) );
1152 : }
1153 928 : break;
1154 : // This is the value when the compat option is not enabled. No idea where it comes from, the spec doesn't mention it.
1155 : #define AUTO_PARA_SPACING sal_Int32(49)
1156 : case NS_ooxml::LN_CT_Spacing_beforeAutospacing:
1157 226 : if (!m_pImpl->GetSettingsTable()->GetDoNotUseHTMLParagraphAutoSpacing())
1158 224 : m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, uno::makeAny( AUTO_PARA_SPACING ) );
1159 : else
1160 2 : m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(100) ) );
1161 226 : break;
1162 : case NS_ooxml::LN_CT_Spacing_afterAutospacing:
1163 16 : if (!m_pImpl->GetSettingsTable()->GetDoNotUseHTMLParagraphAutoSpacing())
1164 14 : m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN, uno::makeAny( AUTO_PARA_SPACING ) );
1165 : else
1166 2 : m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(100) ) );
1167 16 : break;
1168 : case NS_ooxml::LN_CT_SmartTagRun_uri:
1169 : case NS_ooxml::LN_CT_SmartTagRun_element:
1170 : //TODO: add handling of SmartTags
1171 2 : break;
1172 : case NS_ooxml::LN_CT_Br_type :
1173 : //TODO: attributes for break (0x12) are not supported
1174 13 : break;
1175 : case NS_ooxml::LN_CT_Fonts_hint :
1176 : /* assigns script type to ambigous characters, values can be:
1177 : NS_ooxml::LN_Value_ST_Hint_default
1178 : NS_ooxml::LN_Value_ST_Hint_eastAsia
1179 : NS_ooxml::LN_Value_ST_Hint_cs
1180 : */
1181 : //TODO: unsupported?
1182 309 : break;
1183 : case NS_ooxml::LN_CT_TblCellMar_right: // 92375;
1184 : case NS_ooxml::LN_CT_TblBorders_top: // 92377;
1185 : case NS_ooxml::LN_CT_TblBorders_left: // 92378;
1186 : case NS_ooxml::LN_CT_TblBorders_bottom: // 92379;
1187 : //todo: handle cell mar
1188 0 : break;
1189 : case NS_rtf::LN_blip: // contains the binary graphic
1190 : case NS_ooxml::LN_shape:
1191 : {
1192 : //looks a bit like a hack - and it is. The graphic import is split into the inline_inline part and
1193 : //afterwards the adding of the binary data.
1194 0 : m_pImpl->GetGraphicImport( IMPORT_AS_DETECTED_INLINE )->attribute(nName, val);
1195 0 : m_pImpl->ImportGraphic( val.getProperties(), IMPORT_AS_DETECTED_INLINE );
1196 : }
1197 0 : break;
1198 : case NS_ooxml::LN_starmath:
1199 148 : m_pImpl->appendStarMath( val );
1200 148 : break;
1201 : case NS_ooxml::LN_CT_FramePr_dropCap:
1202 : case NS_ooxml::LN_CT_FramePr_lines:
1203 : case NS_ooxml::LN_CT_FramePr_hAnchor:
1204 : case NS_ooxml::LN_CT_FramePr_vAnchor:
1205 : case NS_ooxml::LN_CT_FramePr_x:
1206 : case NS_ooxml::LN_CT_FramePr_xAlign:
1207 : case NS_ooxml::LN_CT_FramePr_y:
1208 : case NS_ooxml::LN_CT_FramePr_yAlign:
1209 : case NS_ooxml::LN_CT_FramePr_hRule:
1210 : case NS_sprm::LN_PWr:
1211 : case NS_sprm::LN_PDxaWidth:
1212 : case NS_sprm::LN_PWHeightAbs:
1213 : case NS_sprm::LN_PDxaFromText:
1214 : case NS_sprm::LN_PDyaFromText:
1215 : {
1216 : ParagraphProperties* pParaProperties = dynamic_cast< ParagraphProperties*>(
1217 205 : m_pImpl->GetTopContextOfType( CONTEXT_PARAGRAPH ).get() );
1218 205 : if( pParaProperties )
1219 : {
1220 194 : switch( nName )
1221 : {
1222 : case NS_ooxml::LN_CT_FramePr_dropCap:
1223 0 : pParaProperties->SetDropCap( nIntValue );
1224 0 : break;
1225 : case NS_ooxml::LN_CT_FramePr_lines:
1226 0 : pParaProperties->SetLines( nIntValue );
1227 0 : break;
1228 : case NS_ooxml::LN_CT_FramePr_hAnchor:
1229 22 : switch(nIntValue)
1230 : {
1231 : case NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_text: //relative to column
1232 1 : nIntValue = text::RelOrientation::FRAME; break;
1233 5 : case NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_margin: nIntValue = text::RelOrientation::PAGE_PRINT_AREA; break;
1234 16 : case NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_page: nIntValue = text::RelOrientation::PAGE_FRAME; break;
1235 : default:;
1236 : }
1237 22 : pParaProperties->SethAnchor( nIntValue );
1238 22 : break;
1239 : case NS_ooxml::LN_CT_FramePr_vAnchor:
1240 21 : switch(nIntValue)
1241 : {
1242 : case NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_text: //relative to paragraph
1243 0 : nIntValue = text::RelOrientation::FRAME; break;
1244 3 : case NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_margin:nIntValue = text::RelOrientation::PAGE_PRINT_AREA ; break;
1245 18 : case NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_page: nIntValue = text::RelOrientation::PAGE_FRAME; break;
1246 : default:;
1247 : }
1248 21 : pParaProperties->SetvAnchor( nIntValue );
1249 21 : break;
1250 : case NS_ooxml::LN_CT_FramePr_x:
1251 21 : pParaProperties->Setx( ConversionHelper::convertTwipToMM100(nIntValue ));
1252 21 : break;
1253 : case NS_ooxml::LN_CT_FramePr_xAlign:
1254 21 : switch( nIntValue )
1255 : {
1256 0 : case NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_center : nIntValue = text::HoriOrientation::CENTER; break;
1257 0 : case NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_right : nIntValue = text::HoriOrientation::RIGHT; break;
1258 0 : case NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_inside : nIntValue = text::HoriOrientation::INSIDE; break;
1259 0 : case NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_outside : nIntValue = text::HoriOrientation::OUTSIDE; break;
1260 0 : case NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_left : nIntValue = text::HoriOrientation::LEFT; break;
1261 21 : default: nIntValue = text::HoriOrientation::NONE;
1262 : }
1263 21 : pParaProperties->SetxAlign( nIntValue );
1264 21 : break;
1265 : case NS_ooxml::LN_CT_FramePr_y:
1266 21 : pParaProperties->Sety( ConversionHelper::convertTwipToMM100(nIntValue ));
1267 21 : break;
1268 : case NS_ooxml::LN_CT_FramePr_yAlign:
1269 22 : switch( nIntValue )
1270 : {
1271 : case NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_top :
1272 0 : case NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_inside :nIntValue = text::VertOrientation::TOP; break;
1273 0 : case NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_center :nIntValue = text::VertOrientation::CENTER;break;
1274 : case NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_bottom :
1275 1 : case NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_outside :nIntValue = text::VertOrientation::BOTTOM;break;
1276 : case NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_inline :
1277 : {
1278 : // HACK: This is for bnc#780851, where a table has one cell that has w:framePr,
1279 : // which causes that paragraph to be converted to a text frame, and the original
1280 : // paragraph object no longer exists, which makes table creation fail and futhermore
1281 : // it would be missing in the table layout anyway. So actually no letting that paragraph
1282 : // be a text frame "fixes" it. I'm not sure what "inline" is supposed to mean in practice
1283 : // anyway, so as long as this doesn't cause trouble elsewhere ...
1284 0 : PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH);
1285 0 : if( pContext.get() )
1286 : {
1287 0 : ParagraphPropertyMap* pParaContext = dynamic_cast< ParagraphPropertyMap* >( pContext.get() );
1288 0 : pParaContext->SetFrameMode(false);
1289 : }
1290 0 : nIntValue = text::VertOrientation::NONE;
1291 : }
1292 21 : default:nIntValue = text::VertOrientation::NONE;
1293 : }
1294 22 : pParaProperties->SetyAlign( nIntValue );
1295 22 : break;
1296 : case NS_ooxml::LN_CT_FramePr_hRule:
1297 21 : switch( nIntValue )
1298 : {
1299 : case NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_exact:
1300 18 : nIntValue = text::SizeType::FIX;
1301 18 : break;
1302 : case NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_atLeast:
1303 1 : nIntValue = text::SizeType::MIN;
1304 1 : break;
1305 : case NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_auto:
1306 : //no break;
1307 : default:;
1308 2 : nIntValue = text::SizeType::VARIABLE;
1309 : }
1310 21 : pParaProperties->SethRule( nIntValue );
1311 21 : break;
1312 : case NS_sprm::LN_PWr:
1313 : {
1314 : //should be either LN_Value_wordprocessingml_ST_Wrap_notBeside or LN_Value_wordprocessingml_ST_Wrap_around
1315 : OSL_ENSURE( sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_wordprocessingml_ST_Wrap_around ||
1316 : sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_wordprocessingml_ST_Wrap_notBeside,
1317 : "wrap not around or not_Beside?");
1318 2 : pParaProperties->SetWrap(sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_wordprocessingml_ST_Wrap_around ?
1319 2 : text::WrapTextMode_DYNAMIC : text::WrapTextMode_NONE );
1320 : }
1321 2 : break;
1322 : case NS_sprm::LN_PDxaWidth:
1323 21 : pParaProperties->Setw(ConversionHelper::convertTwipToMM100(nIntValue));
1324 21 : break;
1325 : case NS_sprm::LN_PWHeightAbs:
1326 19 : pParaProperties->Seth(ConversionHelper::convertTwipToMM100(nIntValue));
1327 19 : break;
1328 : case NS_sprm::LN_PDxaFromText:
1329 2 : pParaProperties->SethSpace( ConversionHelper::convertTwipToMM100(nIntValue ));
1330 2 : break;
1331 : case NS_sprm::LN_PDyaFromText:
1332 1 : pParaProperties->SetvSpace( ConversionHelper::convertTwipToMM100(nIntValue ));
1333 1 : break;
1334 : default:;
1335 : }
1336 : }
1337 : else
1338 : {
1339 : //TODO: how to handle frame properties at styles
1340 : }
1341 : }
1342 205 : break;
1343 : case NS_ooxml::LN_CT_TrackChange_author:
1344 13 : m_pImpl->SetCurrentRedlineAuthor( sStringValue );
1345 13 : break;
1346 : case NS_ooxml::LN_CT_TrackChange_date:
1347 13 : m_pImpl->SetCurrentRedlineDate( sStringValue );
1348 13 : break;
1349 : case NS_ooxml::LN_CT_Markup_id:
1350 13 : m_pImpl->SetCurrentRedlineId( nIntValue );
1351 13 : break;
1352 : case NS_ooxml::LN_EG_RangeMarkupElements_commentRangeStart:
1353 4 : m_pImpl->AddAnnotationPosition(true);
1354 4 : break;
1355 : case NS_ooxml::LN_EG_RangeMarkupElements_commentRangeEnd:
1356 4 : m_pImpl->AddAnnotationPosition(false);
1357 4 : break;
1358 : case NS_ooxml::LN_CT_Comment_initials:
1359 4 : m_pImpl->SetCurrentRedlineInitials(sStringValue);
1360 4 : break;
1361 : case NS_ooxml::LN_token:
1362 5 : m_pImpl->SetCurrentRedlineToken( nIntValue );
1363 5 : break;
1364 : case NS_ooxml::LN_CT_LineNumber_start:
1365 : case NS_ooxml::LN_CT_LineNumber_distance:
1366 : case NS_ooxml::LN_CT_LineNumber_countBy:
1367 : case NS_ooxml::LN_CT_LineNumber_restart:
1368 : {
1369 : //line numbering in Writer is a global document setting
1370 : //in Word is a section setting
1371 : //if line numbering is switched on anywhere in the document it's set at the global settings
1372 7 : LineNumberSettings aSettings = m_pImpl->GetLineNumberSettings();
1373 7 : switch( nName )
1374 : {
1375 : case NS_ooxml::LN_CT_LineNumber_countBy:
1376 3 : aSettings.nInterval = nIntValue;
1377 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
1378 3 : if( pSectionContext )
1379 3 : pSectionContext->SetLnnMod( nIntValue );
1380 3 : break;
1381 : case NS_ooxml::LN_CT_LineNumber_start:
1382 2 : aSettings.nStartValue = nIntValue; // todo: has to be set at (each) first paragraph
1383 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
1384 2 : if( pSectionContext )
1385 2 : pSectionContext->SetLnnMin( nIntValue );
1386 2 : break;
1387 : case NS_ooxml::LN_CT_LineNumber_distance:
1388 0 : aSettings.nDistance = ConversionHelper::convertTwipToMM100( nIntValue );
1389 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
1390 0 : if( pSectionContext )
1391 0 : pSectionContext->SetdxaLnn( nIntValue );
1392 0 : break;
1393 : case NS_ooxml::LN_CT_LineNumber_restart:
1394 : //page:empty, probably 0,section:1,continuous:2;
1395 2 : aSettings.bRestartAtEachPage = nIntValue < 1;
1396 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
1397 2 : if( pSectionContext )
1398 2 : pSectionContext->SetLnc( nIntValue );
1399 2 : break;
1400 : default:;
1401 : }
1402 7 : m_pImpl->SetLineNumberSettings( aSettings );
1403 : }
1404 7 : break;
1405 : case NS_ooxml::LN_CT_FtnEdnRef_customMarkFollows:
1406 0 : m_pImpl->SetCustomFtnMark( true );
1407 0 : break;
1408 : case NS_ooxml::LN_CT_FtnEdnRef_id:
1409 : // footnote or endnote reference id - not needed
1410 : case NS_ooxml::LN_CT_Color_themeColor:
1411 : case NS_ooxml::LN_CT_Color_themeTint:
1412 : case NS_ooxml::LN_CT_Color_themeShade:
1413 : //unsupported
1414 338 : break;
1415 : case NS_ooxml::LN_endtrackchange:
1416 5 : m_pImpl->RemoveCurrentRedline( );
1417 5 : break;
1418 : case NS_ooxml::LN_CT_DocGrid_linePitch:
1419 : {
1420 : //see SwWW8ImplReader::SetDocumentGrid
1421 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
1422 134 : if(pSectionContext)
1423 : {
1424 134 : pSectionContext->SetGridLinePitch( ConversionHelper::convertTwipToMM100( nIntValue ) );
1425 : }
1426 : }
1427 134 : break;
1428 : case NS_ooxml::LN_CT_DocGrid_charSpace:
1429 : {
1430 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
1431 55 : if(pSectionContext)
1432 : {
1433 55 : pSectionContext->SetDxtCharSpace( nIntValue );
1434 : }
1435 : }
1436 55 : break;
1437 : case NS_ooxml::LN_CT_DocGrid_type:
1438 : {
1439 56 : if (pSectionContext != NULL)
1440 : {
1441 56 : pSectionContext->SetGridType(nIntValue);
1442 : }
1443 : }
1444 56 : break;
1445 : case NS_ooxml::LN_CT_SdtBlock_sdtContent:
1446 7 : m_pImpl->SetSdt(true);
1447 7 : break;
1448 : case NS_ooxml::LN_CT_SdtBlock_sdtEndContent:
1449 7 : m_pImpl->SetSdt(false);
1450 7 : if (!m_pImpl->m_pSdtHelper->getDropDownItems().empty())
1451 1 : m_pImpl->m_pSdtHelper->createDropDownControl();
1452 7 : break;
1453 : case NS_ooxml::LN_CT_SdtListItem_displayText:
1454 : // TODO handle when this is != value
1455 2 : break;
1456 : case NS_ooxml::LN_CT_SdtListItem_value:
1457 2 : m_pImpl->m_pSdtHelper->getDropDownItems().push_back(sStringValue);
1458 2 : break;
1459 : case NS_ooxml::LN_CT_Background_color:
1460 5 : m_pImpl->m_oBackgroundColor.reset(nIntValue);
1461 5 : break;
1462 : default:
1463 : {
1464 : #if OSL_DEBUG_LEVEL > 0
1465 : OString sMessage("DomainMapper::attribute() - Id: ");
1466 : sMessage += OString::valueOf( sal_Int32( nName ), 10 );
1467 : sMessage += " / 0x";
1468 : sMessage += OString::valueOf( sal_Int32( nName ), 16 );
1469 : sMessage += " value: ";
1470 : sMessage += OString::valueOf( sal_Int32( nIntValue ), 10 );
1471 : sMessage += " / 0x";
1472 : sMessage += OString::valueOf( sal_Int32( nIntValue ), 16 );
1473 : SAL_WARN("writerfilter", sMessage.getStr());
1474 : #endif
1475 : }
1476 : }
1477 12907 : }
1478 12907 : }
1479 :
1480 35961 : void DomainMapper::lcl_sprm(Sprm & rSprm)
1481 : {
1482 35961 : if( !m_pImpl->getTableManager().sprm(rSprm))
1483 28774 : sprmWithProps( rSprm, m_pImpl->GetTopContext() );
1484 35961 : }
1485 :
1486 2 : sal_Int32 lcl_getCurrentNumberingProperty(uno::Reference<container::XIndexAccess> xNumberingRules, sal_Int32 nNumberingLevel, OUString aProp)
1487 : {
1488 2 : sal_Int32 nRet = 0;
1489 :
1490 : try
1491 : {
1492 2 : if (nNumberingLevel < 0) // It seems it's valid to omit numbering level, and in that case it means zero.
1493 2 : nNumberingLevel = 0;
1494 2 : if (xNumberingRules.is())
1495 : {
1496 2 : uno::Sequence<beans::PropertyValue> aProps;
1497 2 : xNumberingRules->getByIndex(nNumberingLevel) >>= aProps;
1498 21 : for (int i = 0; i < aProps.getLength(); ++i)
1499 : {
1500 21 : const beans::PropertyValue& rProp = aProps[i];
1501 :
1502 21 : if (rProp.Name == aProp)
1503 : {
1504 2 : rProp.Value >>= nRet;
1505 2 : break;
1506 : }
1507 2 : }
1508 : }
1509 : }
1510 0 : catch( const uno::Exception& )
1511 : {
1512 : // This can happen when the doc contains some hand-crafted invalid list level.
1513 : }
1514 :
1515 2 : return nRet;
1516 : }
1517 :
1518 : // In rtl-paragraphs the meaning of left/right are to be exchanged
1519 1222 : static bool ExchangeLeftRight( const PropertyMapPtr rContext )
1520 : {
1521 1222 : bool bExchangeLeftRight = false;
1522 1222 : PropertyMap::const_iterator aPropParaIte = rContext->find( PropertyDefinition( PROP_WRITING_MODE ));
1523 1222 : if( aPropParaIte != rContext->end())
1524 : {
1525 : sal_Int32 aAdjust ;
1526 5 : if( (aPropParaIte->second >>= aAdjust) && aAdjust == text::WritingMode2::RL_TB )
1527 3 : bExchangeLeftRight = true;
1528 : }
1529 1222 : return bExchangeLeftRight;
1530 : }
1531 :
1532 32374 : void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmType )
1533 : {
1534 : OSL_ENSURE(rContext.get(), "PropertyMap has to be valid!");
1535 32374 : if(!rContext.get())
1536 32381 : return ;
1537 :
1538 32367 : sal_uInt32 nSprmId = rSprm.getId();
1539 : //needed for page properties
1540 32367 : SectionPropertyMap * pSectionContext = m_pImpl->GetSectionContext();
1541 32367 : Value::Pointer_t pValue = rSprm.getValue();
1542 32367 : sal_Int32 nIntValue = pValue->getInt();
1543 64734 : OUString sStringValue = pValue->getString();
1544 32367 : PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
1545 :
1546 32367 : switch(nSprmId)
1547 : {
1548 : case 2: // sprmPIstd
1549 : case 0x4600:
1550 31935 : break; // sprmPIstd - style code
1551 : case 3: // "sprmPIstdPermute
1552 : case NS_sprm::LN_PIstdPermute:
1553 0 : break; // sprmPIstdPermute
1554 : case NS_sprm::LN_PIncLvl:
1555 0 : break; // sprmPIncLvl
1556 : case NS_sprm::LN_PJcExtra: // sprmPJc Asian (undocumented)
1557 : case NS_sprm::LN_PJc: // sprmPJc
1558 350 : handleParaJustification(nIntValue, rContext, ExchangeLeftRight( rContext ));
1559 350 : break;
1560 : case NS_sprm::LN_PFSideBySide:
1561 0 : break; // sprmPFSideBySide
1562 :
1563 : case NS_sprm::LN_PFKeep: // sprmPFKeep
1564 41 : rContext->Insert(PROP_PARA_SPLIT, uno::makeAny(nIntValue ? false : true));
1565 41 : break;
1566 : case NS_sprm::LN_PFKeepFollow: // sprmPFKeepFollow
1567 185 : rContext->Insert(PROP_PARA_KEEP_TOGETHER, uno::makeAny( nIntValue ? true : false) );
1568 185 : break;
1569 : case NS_sprm::LN_PFPageBreakBefore:
1570 10 : rContext->Insert(PROP_BREAK_TYPE, uno::makeAny( com::sun::star::style::BreakType_PAGE_BEFORE ) );
1571 10 : break; // sprmPFPageBreakBefore
1572 : case NS_sprm::LN_PBrcl:
1573 0 : break; // sprmPBrcl
1574 : case NS_sprm::LN_PBrcp:
1575 0 : break; // sprmPBrcp
1576 : case NS_sprm::LN_PIlvl: // sprmPIlvl
1577 55 : if (nIntValue < 0 || 10 <= nIntValue) // Writer can't do everything
1578 : {
1579 : SAL_INFO("writerfilter",
1580 : "unsupported numbering level " << nIntValue);
1581 1 : break;
1582 : }
1583 54 : if( m_pImpl->IsStyleSheetImport() )
1584 : {
1585 : //style sheets cannot have a numbering rule attached
1586 22 : StyleSheetPropertyMap* pStyleSheetPropertyMap = dynamic_cast< StyleSheetPropertyMap* >( rContext.get() );
1587 22 : pStyleSheetPropertyMap->SetListLevel( (sal_Int16)nIntValue );
1588 : }
1589 : else
1590 32 : rContext->Insert( PROP_NUMBERING_LEVEL, uno::makeAny( (sal_Int16)nIntValue ));
1591 54 : break;
1592 : case NS_sprm::LN_PIlfo: // sprmPIlfo
1593 : {
1594 : //convert the ListTable entry to a NumberingRules propery and apply it
1595 75 : ListsManager::Pointer pListTable = m_pImpl->GetListTable();
1596 150 : ListDef::Pointer pList = pListTable->GetList( nIntValue );
1597 75 : if( m_pImpl->IsStyleSheetImport() )
1598 : {
1599 : //style sheets cannot have a numbering rule attached
1600 35 : StyleSheetPropertyMap* pStyleSheetPropertyMap = dynamic_cast< StyleSheetPropertyMap* >( rContext.get() );
1601 35 : pStyleSheetPropertyMap->SetListId( nIntValue );
1602 : }
1603 75 : if( pList.get( ) )
1604 : {
1605 40 : if( !m_pImpl->IsStyleSheetImport() )
1606 : {
1607 40 : uno::Any aRules = uno::makeAny( pList->GetNumberingRules( ) );
1608 40 : rContext->Insert( PROP_NUMBERING_RULES, aRules );
1609 : // erase numbering from pStyle if already set
1610 40 : rContext->erase( PropertyDefinition( PROP_NUMBERING_STYLE_NAME ));
1611 : }
1612 : }
1613 : else
1614 : {
1615 35 : if( m_pImpl->IsStyleSheetImport() )
1616 : {
1617 : // set the number id for AbstractNum references
1618 35 : StyleSheetPropertyMap* pStyleSheetPropertyMap = dynamic_cast< StyleSheetPropertyMap* >( rContext.get() );
1619 35 : pStyleSheetPropertyMap->SetNumId( nIntValue );
1620 : }
1621 : else
1622 : {
1623 0 : rContext->Insert( PROP_NUMBERING_STYLE_NAME, uno::makeAny( OUString() ) );
1624 : }
1625 75 : }
1626 : }
1627 75 : break;
1628 : case NS_sprm::LN_PFNoLineNumb: // sprmPFNoLineNumb
1629 157 : rContext->Insert(PROP_PARA_LINE_NUMBER_COUNT, uno::makeAny( nIntValue ? false : true) );
1630 157 : break;
1631 : case NS_sprm::LN_PChgTabsPapx: // sprmPChgTabsPapx
1632 : {
1633 : // Initialize tab stop vector from style sheet
1634 0 : uno::Any aValue = m_pImpl->GetPropertyFromStyleSheet(PROP_PARA_TAB_STOPS);
1635 0 : uno::Sequence< style::TabStop > aStyleTabStops;
1636 0 : if(aValue >>= aStyleTabStops)
1637 : {
1638 0 : m_pImpl->InitTabStopFromStyle( aStyleTabStops );
1639 : }
1640 :
1641 : //create a new tab stop property - this is done with the contained properties
1642 0 : resolveSprmProps(*this, rSprm);
1643 : //add this property
1644 0 : rContext->Insert(PROP_PARA_TAB_STOPS, uno::makeAny( m_pImpl->GetCurrentTabStopAndClear()));
1645 : }
1646 0 : break;
1647 : case 0x845d: //right margin Asian - undocumented
1648 : case 0x845e: //left margin Asian - undocumented
1649 : case 16: // sprmPDxaRight - right margin
1650 : case NS_sprm::LN_PDxaRight: // sprmPDxaRight - right margin
1651 : case 17:
1652 : case NS_sprm::LN_PDxaLeft: // sprmPDxaLeft
1653 : {
1654 872 : bool bExchangeLeftRight = ExchangeLeftRight( rContext );
1655 872 : if( NS_sprm::LN_PDxaLeft == nSprmId || 0x17 == nSprmId|| (bExchangeLeftRight && nSprmId == 0x845d) || ( !bExchangeLeftRight && nSprmId == 0x845e))
1656 : rContext->Insert(
1657 : eSprmType == SPRM_DEFAULT ? PROP_PARA_LEFT_MARGIN : PROP_LEFT_MARGIN,
1658 465 : uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue ) ));
1659 407 : else if(eSprmType == SPRM_DEFAULT)
1660 : rContext->Insert(
1661 : PROP_PARA_RIGHT_MARGIN,
1662 407 : uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue ) ));
1663 : }
1664 : //TODO: what happens to the right margins in numberings?
1665 872 : break;
1666 : case 18: // sprmPNest
1667 : case NS_sprm::LN_PNest: // sprmPNest
1668 : //not handled in the old WW8 filter
1669 0 : break;
1670 : case NS_sprm::LN_PDxaLeft1: // sprmPDxaLeft1
1671 : case 19:
1672 : case NS_sprm::LN_PDxaLeft180: // sprmPDxaLeft180
1673 : rContext->Insert(
1674 : eSprmType == SPRM_DEFAULT ? PROP_PARA_FIRST_LINE_INDENT : PROP_FIRST_LINE_OFFSET,
1675 267 : uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue ) ));
1676 267 : break;
1677 : case 20 : // sprmPDyaLine
1678 : case NS_sprm::LN_PDyaLine: // sprmPDyaLine
1679 : {
1680 0 : style::LineSpacing aSpacing;
1681 0 : sal_Int16 nDistance = sal_Int16(nIntValue & 0xffff);
1682 0 : if(nIntValue & 0xffff0000)
1683 : {
1684 : // single line in Writer is 100, in Word it is 240
1685 0 : aSpacing.Mode = style::LineSpacingMode::PROP;
1686 0 : aSpacing.Height = sal_Int16(sal_Int32(nDistance) * 100 /240);
1687 : }
1688 : else
1689 : {
1690 0 : if(nDistance < 0)
1691 : {
1692 0 : aSpacing.Mode = style::LineSpacingMode::FIX;
1693 0 : aSpacing.Height = sal_Int16(ConversionHelper::convertTwipToMM100(-nDistance));
1694 : }
1695 0 : else if(nDistance >0)
1696 : {
1697 0 : aSpacing.Mode = style::LineSpacingMode::MINIMUM;
1698 0 : aSpacing.Height = sal_Int16(ConversionHelper::convertTwipToMM100(nDistance));
1699 : }
1700 : }
1701 0 : rContext->Insert(PROP_PARA_LINE_SPACING, uno::makeAny( aSpacing ));
1702 : }
1703 0 : break;
1704 : case 21 : // legacy version
1705 : case NS_sprm::LN_PDyaBefore: // sprmPDyaBefore
1706 0 : rContext->Insert(PROP_PARA_TOP_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue ) ));
1707 0 : break;
1708 : case 22 :
1709 : case NS_sprm::LN_PDyaAfter: // sprmPDyaAfter
1710 0 : rContext->Insert(PROP_PARA_BOTTOM_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue ) ));
1711 0 : break;
1712 :
1713 : case 23: //sprmPChgTabs
1714 : case NS_sprm::LN_PChgTabs: // sprmPChgTabs
1715 : OSL_FAIL( "unhandled");
1716 : //tabs of list level?
1717 0 : break;
1718 : case 24: // "sprmPFInTable"
1719 : case NS_sprm::LN_PFInTable:
1720 0 : break; // sprmPFInTable
1721 : case NS_sprm::LN_PTableDepth: //sprmPTableDepth
1722 : //not handled via sprm but via text( 0x07 )
1723 9 : break;
1724 : case 25: // "sprmPTtp" pap.fTtp
1725 : case NS_sprm::LN_PFTtp: // sprmPFTtp was: Read_TabRowEnd
1726 0 : break;
1727 : case 26: // "sprmPDxaAbs
1728 : case NS_sprm::LN_PDxaAbs:
1729 0 : break; // sprmPDxaAbs
1730 : case 27: //sprmPDyaAbs
1731 : case NS_sprm::LN_PDyaAbs:
1732 0 : break; // sprmPDyaAbs
1733 : case NS_sprm::LN_PDxaWidth:
1734 0 : break; // sprmPDxaWidth
1735 : case NS_sprm::LN_PPc:
1736 0 : break; // sprmPPc
1737 : case NS_sprm::LN_PBrcTop10:
1738 0 : break; // sprmPBrcTop10
1739 : case NS_sprm::LN_PBrcLeft10:
1740 0 : break; // sprmPBrcLeft10
1741 : case NS_sprm::LN_PBrcBottom10:
1742 0 : break; // sprmPBrcBottom10
1743 : case NS_sprm::LN_PBrcRight10:
1744 0 : break; // sprmPBrcRight10
1745 : case NS_sprm::LN_PBrcBetween10:
1746 0 : break; // sprmPBrcBetween10
1747 : case NS_sprm::LN_PBrcBar10:
1748 0 : break; // sprmPBrcBar10
1749 : case NS_sprm::LN_PDxaFromText10:
1750 0 : break; // sprmPDxaFromText10
1751 : case NS_sprm::LN_PWr:
1752 0 : break; // sprmPWr
1753 :
1754 : case NS_ooxml::LN_CT_PrBase_pBdr: //paragraph border
1755 18 : resolveSprmProps(*this, rSprm);
1756 18 : break;
1757 : case NS_sprm::LN_PBrcTop: // sprmPBrcTop
1758 : case NS_sprm::LN_PBrcLeft: // sprmPBrcLeft
1759 : case NS_sprm::LN_PBrcBottom: // sprmPBrcBottom
1760 : case NS_sprm::LN_PBrcRight: // sprmPBrcRight
1761 : case NS_sprm::LN_PBrcBetween: // sprmPBrcBetween
1762 : {
1763 : //in binary format the borders are directly provided in OOXML they are inside of properties
1764 29 : if( IsOOXMLImport() || IsRTFImport() )
1765 : {
1766 29 : writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
1767 29 : if( pProperties.get())
1768 : {
1769 29 : BorderHandlerPtr pBorderHandler( new BorderHandler( true ) );
1770 29 : pProperties->resolve(*pBorderHandler);
1771 29 : PropertyIds eBorderId = PropertyIds( 0 );
1772 29 : PropertyIds eBorderDistId = PropertyIds( 0 );
1773 29 : switch( nSprmId )
1774 : {
1775 : case NS_sprm::LN_PBrcTop:
1776 8 : eBorderId = PROP_TOP_BORDER;
1777 8 : eBorderDistId = PROP_TOP_BORDER_DISTANCE;
1778 8 : break;
1779 : case NS_sprm::LN_PBrcLeft:
1780 2 : eBorderId = PROP_LEFT_BORDER;
1781 2 : eBorderDistId = PROP_LEFT_BORDER_DISTANCE;
1782 2 : break;
1783 : case NS_sprm::LN_PBrcBottom:
1784 17 : eBorderId = PROP_BOTTOM_BORDER ;
1785 17 : eBorderDistId = PROP_BOTTOM_BORDER_DISTANCE;
1786 17 : break;
1787 : case NS_sprm::LN_PBrcRight:
1788 2 : eBorderId = PROP_RIGHT_BORDER;
1789 2 : eBorderDistId = PROP_RIGHT_BORDER_DISTANCE ;
1790 2 : break;
1791 : case NS_sprm::LN_PBrcBetween:
1792 : //not supported
1793 0 : break;
1794 : default:;
1795 : }
1796 29 : if( eBorderId )
1797 29 : rContext->Insert( eBorderId, uno::makeAny( pBorderHandler->getBorderLine()) , true);
1798 29 : if(eBorderDistId)
1799 29 : rContext->Insert(eBorderDistId, uno::makeAny( pBorderHandler->getLineDistance()), true);
1800 29 : }
1801 : }
1802 : else
1803 : {
1804 0 : table::BorderLine2 aBorderLine;
1805 0 : sal_Int32 nLineDistance = ConversionHelper::MakeBorderLine( nIntValue, aBorderLine );
1806 0 : PropertyIds eBorderId = PROP_LEFT_BORDER;
1807 0 : PropertyIds eBorderDistId = PROP_LEFT_BORDER_DISTANCE ;
1808 0 : switch( nSprmId )
1809 : {
1810 : case NS_sprm::LN_PBrcBetween: // sprmPBrcBetween
1811 : OSL_FAIL( "TODO: inner border is not handled");
1812 0 : break;
1813 : case NS_sprm::LN_PBrcLeft: // sprmPBrcLeft
1814 0 : eBorderId = PROP_LEFT_BORDER;
1815 0 : eBorderDistId = PROP_LEFT_BORDER_DISTANCE ;
1816 0 : break;
1817 : case NS_sprm::LN_PBrcRight: // sprmPBrcRight
1818 0 : eBorderId = PROP_RIGHT_BORDER ;
1819 0 : eBorderDistId = PROP_RIGHT_BORDER_DISTANCE ;
1820 0 : break;
1821 : case NS_sprm::LN_PBrcTop: // sprmPBrcTop
1822 0 : eBorderId = PROP_TOP_BORDER ;
1823 0 : eBorderDistId = PROP_TOP_BORDER_DISTANCE;
1824 0 : break;
1825 : case NS_sprm::LN_PBrcBottom: // sprmPBrcBottom
1826 : default:
1827 0 : eBorderId = PROP_BOTTOM_BORDER ;
1828 0 : eBorderDistId = PROP_BOTTOM_BORDER_DISTANCE;
1829 : }
1830 0 : rContext->Insert(eBorderId, uno::makeAny( aBorderLine ));
1831 0 : rContext->Insert(eBorderDistId, uno::makeAny( nLineDistance ));
1832 : }
1833 : }
1834 29 : break;
1835 : case NS_sprm::LN_PBorderTop:
1836 : case NS_sprm::LN_PBorderLeft:
1837 : case NS_sprm::LN_PBorderBottom:
1838 : case NS_sprm::LN_PBorderRight:
1839 : OSL_FAIL( "TODO: border color definition");
1840 0 : break;
1841 : case NS_sprm::LN_PBrcBar:
1842 0 : break; // sprmPBrcBar
1843 : case NS_sprm::LN_PFNoAutoHyph: // sprmPFNoAutoHyph
1844 83 : rContext->Insert(PROP_PARA_IS_HYPHENATION, uno::makeAny( nIntValue ? false : true ));
1845 83 : break;
1846 : case NS_sprm::LN_PWHeightAbs:
1847 0 : break; // sprmPWHeightAbs
1848 : case NS_sprm::LN_PDcs:
1849 0 : break; // sprmPDcs
1850 :
1851 : case NS_sprm::LN_PShd: // sprmPShd
1852 : {
1853 : //contains fore color, back color and shadow percentage, results in a brush
1854 3 : writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
1855 3 : if( pProperties.get())
1856 : {
1857 3 : CellColorHandlerPtr pCellColorHandler( new CellColorHandler );
1858 3 : pCellColorHandler->setOutputFormat( CellColorHandler::Paragraph );
1859 3 : pProperties->resolve(*pCellColorHandler);
1860 3 : rContext->InsertProps(pCellColorHandler->getProperties());
1861 3 : }
1862 : }
1863 3 : break;
1864 : case NS_sprm::LN_PDyaFromText:
1865 0 : break; // sprmPDyaFromText
1866 : case NS_sprm::LN_PDxaFromText:
1867 0 : break; // sprmPDxaFromText
1868 : case NS_sprm::LN_PFLocked:
1869 0 : break; // sprmPFLocked
1870 : case NS_sprm::LN_PFWidowControl:
1871 : case NS_ooxml::LN_CT_PPrBase_widowControl:
1872 : {
1873 352 : uno::Any aVal( uno::makeAny( sal_Int8(nIntValue ? 2 : 0 )));
1874 352 : rContext->Insert( PROP_PARA_WIDOWS, aVal );
1875 352 : rContext->Insert( PROP_PARA_ORPHANS, aVal );
1876 : }
1877 352 : break; // sprmPFWidowControl
1878 : case NS_sprm::LN_PRuler:
1879 0 : break; // sprmPRuler
1880 : case NS_sprm::LN_PFKinsoku:
1881 0 : break; // sprmPFKinsoku
1882 : case NS_sprm::LN_PFWordWrap:
1883 0 : break; // sprmPFWordWrap
1884 : case NS_sprm::LN_PFOverflowPunct: ; // sprmPFOverflowPunct - hanging punctuation
1885 16 : rContext->Insert(PROP_PARA_IS_HANGING_PUNCTUATION, uno::makeAny( nIntValue ? false : true ));
1886 16 : break;
1887 : case NS_sprm::LN_PFTopLinePunct:
1888 0 : break; // sprmPFTopLinePunct
1889 : case NS_sprm::LN_PFAutoSpaceDE:
1890 153 : break; // sprmPFAutoSpaceDE
1891 : case NS_sprm::LN_PFAutoSpaceDN:
1892 16 : break; // sprmPFAutoSpaceDN
1893 : case NS_sprm::LN_PWAlignFont:
1894 : {
1895 192 : sal_Int16 nAlignment = 0;
1896 192 : switch (nIntValue)
1897 : {
1898 : case NS_ooxml::LN_Value_wordprocessingml_ST_TextAlignment_top:
1899 0 : nAlignment = 2;
1900 0 : break;
1901 : case NS_ooxml::LN_Value_wordprocessingml_ST_TextAlignment_center:
1902 0 : nAlignment = 3;
1903 0 : break;
1904 : case NS_ooxml::LN_Value_wordprocessingml_ST_TextAlignment_baseline:
1905 0 : nAlignment = 1;
1906 0 : break;
1907 : case NS_ooxml::LN_Value_wordprocessingml_ST_TextAlignment_bottom:
1908 0 : nAlignment = 4;
1909 0 : break;
1910 : case NS_ooxml::LN_Value_wordprocessingml_ST_TextAlignment_auto:
1911 : default:
1912 192 : break;
1913 : }
1914 192 : rContext->Insert( PROP_PARA_VERT_ALIGNMENT, uno::makeAny( nAlignment) );
1915 : }
1916 192 : break; // sprmPWAlignFont
1917 : case NS_sprm::LN_PFrameTextFlow:
1918 177 : break; // sprmPFrameTextFlow
1919 : case NS_sprm::LN_PISnapBaseLine:
1920 0 : break; // sprmPISnapBaseLine
1921 : case NS_sprm::LN_PAnld:
1922 0 : break; // sprmPAnld
1923 : case NS_sprm::LN_PPropRMark:
1924 0 : break; // sprmPPropRMark
1925 : case NS_sprm::LN_POutLvl:
1926 : {
1927 93 : sal_Int16 nLvl = static_cast< sal_Int16 >( nIntValue );
1928 93 : if( m_pImpl->IsStyleSheetImport() )
1929 : {
1930 :
1931 93 : StyleSheetPropertyMap* pStyleSheetPropertyMap = dynamic_cast< StyleSheetPropertyMap* >( rContext.get() );
1932 93 : pStyleSheetPropertyMap->SetOutlineLevel( nLvl );
1933 : }
1934 : else
1935 : {
1936 0 : nLvl = nLvl >= WW_OUTLINE_MIN && nLvl < WW_OUTLINE_MAX? nLvl+1 : 0; //0 means no outline level set on
1937 0 : rContext->Insert(PROP_OUTLINE_LEVEL, uno::makeAny ( nLvl ));
1938 : }
1939 : }
1940 93 : break; // sprmPOutLvl
1941 : case NS_sprm::LN_PFBiDi:
1942 : {
1943 12 : if (nIntValue != 0)
1944 : {
1945 4 : rContext->Insert(PROP_WRITING_MODE, uno::makeAny( text::WritingMode2::RL_TB ));
1946 4 : rContext->Insert(PROP_PARA_ADJUST, uno::makeAny( style::ParagraphAdjust_RIGHT ));
1947 : }
1948 : }
1949 :
1950 12 : break; // sprmPFBiDi
1951 : case NS_ooxml::LN_EG_SectPrContents_bidi:
1952 1 : if (pSectionContext != NULL)
1953 1 : pSectionContext->Insert(PROP_WRITING_MODE, uno::makeAny( text::WritingMode2::RL_TB));
1954 1 : break;
1955 : case NS_sprm::LN_PFNumRMIns:
1956 0 : break; // sprmPFNumRMIns
1957 : case NS_sprm::LN_PCrLf:
1958 0 : break; // sprmPCrLf
1959 : case NS_sprm::LN_PNumRM:
1960 0 : break; // sprmPNumRM
1961 : case NS_sprm::LN_PHugePapx:
1962 0 : break; // sprmPHugePapx
1963 : case NS_sprm::LN_PFUsePgsuSettings:
1964 0 : break; // sprmPFUsePgsuSettings
1965 : case NS_sprm::LN_PFAdjustRight:
1966 0 : break; // sprmPFAdjustRight
1967 : case NS_sprm::LN_CFRMarkDel:
1968 0 : break; // sprmCFRMarkDel
1969 : case NS_sprm::LN_CFRMark:
1970 0 : break; // sprmCFRMark
1971 : case NS_sprm::LN_CFFldVanish:
1972 0 : break; // sprmCFFldVanish
1973 : case NS_sprm::LN_CFSpec: // sprmCFSpec
1974 0 : break;
1975 : case NS_sprm::LN_CPicLocation: // sprmCPicLocation
1976 : //is being resolved on the tokenizer side
1977 0 : break;
1978 : case NS_sprm::LN_CIbstRMark:
1979 0 : break; // sprmCIbstRMark
1980 : case NS_sprm::LN_CDttmRMark:
1981 0 : break; // sprmCDttmRMark
1982 : case NS_sprm::LN_CFData:
1983 0 : break; // sprmCFData
1984 : case NS_sprm::LN_CIdslRMark:
1985 0 : break; // sprmCIdslRMark
1986 : case NS_sprm::LN_CChs:
1987 0 : break; // sprmCChs
1988 : case NS_sprm::LN_CSymbol: // sprmCSymbol
1989 0 : resolveSprmProps(*this, rSprm); //resolves LN_FONT and LN_CHAR
1990 0 : break;
1991 : case NS_sprm::LN_CFOle2:
1992 0 : break; // sprmCFOle2
1993 : case NS_sprm::LN_CIdCharType:
1994 0 : break; // sprmCIdCharType
1995 : case NS_sprm::LN_CHighlight:
1996 : {
1997 1 : sal_Int32 nColor = 0;
1998 1 : if(true ==( mbIsHighlightSet = getColorFromIndex(nIntValue, nColor)))
1999 0 : rContext->Insert(PROP_CHAR_BACK_COLOR, uno::makeAny( nColor ));
2000 1 : else if (mnBackgroundColor)
2001 0 : rContext->Insert(PROP_CHAR_BACK_COLOR, uno::makeAny( mnBackgroundColor ));
2002 : }
2003 1 : break; // sprmCHighlight
2004 : case NS_sprm::LN_CObjLocation:
2005 0 : break; // sprmCObjLocation
2006 : case NS_sprm::LN_CFFtcAsciSymb:
2007 0 : break; // sprmCFFtcAsciSymb
2008 : case NS_sprm::LN_CIstd:
2009 0 : break; // sprmCIstd
2010 : case NS_sprm::LN_CIstdPermute:
2011 0 : break; // sprmCIstdPermute
2012 : case NS_sprm::LN_CDefault:
2013 0 : break; // sprmCDefault
2014 : case NS_sprm::LN_CPlain:
2015 0 : break; // sprmCPlain
2016 : case NS_sprm::LN_CKcd:
2017 0 : rContext->Insert(PROP_CHAR_EMPHASIS, uno::makeAny ( getEmphasisValue (nIntValue)));
2018 0 : break; // sprmCKcd
2019 : case NS_sprm::LN_CFEmboss:// sprmCFEmboss
2020 : case 60:// sprmCFBold
2021 : case NS_sprm::LN_CFBoldBi:// sprmCFBoldBi (offset 0x27 to normal bold)
2022 : case NS_sprm::LN_CFItalicBi:// sprmCFItalicBi (offset 0x27 to normal italic)
2023 : case NS_sprm::LN_CFBold: //sprmCFBold
2024 : case 61: /*sprmCFItalic*/
2025 : case NS_sprm::LN_CFItalic: //sprmCFItalic
2026 : case NS_sprm::LN_CFStrike: //sprmCFStrike
2027 : case NS_sprm::LN_CFOutline: //sprmCFOutline
2028 : case NS_sprm::LN_CFShadow: //sprmCFShadow
2029 : case NS_sprm::LN_CFSmallCaps: //sprmCFSmallCaps
2030 : case NS_sprm::LN_CFCaps: //sprmCFCaps
2031 : case NS_sprm::LN_CFVanish: //sprmCFVanish
2032 : case NS_sprm::LN_CFDStrike: // sprmCFDStrike
2033 : {
2034 1150 : PropertyIds ePropertyId = PROP_CHAR_WEIGHT; //initialized to prevent warning!
2035 1150 : switch( nSprmId )
2036 : {
2037 : case 60:// sprmCFBold
2038 : case NS_sprm::LN_CFBoldBi: // sprmCFBoldBi
2039 : case NS_sprm::LN_CFBold: /*sprmCFBold*/
2040 612 : ePropertyId = nSprmId != NS_sprm::LN_CFBoldBi ? PROP_CHAR_WEIGHT : PROP_CHAR_WEIGHT_COMPLEX;
2041 612 : break;
2042 : case 61: /*sprmCFItalic*/
2043 : case NS_sprm::LN_CFItalicBi: // sprmCFItalicBi
2044 : case NS_sprm::LN_CFItalic: /*sprmCFItalic*/
2045 444 : ePropertyId = nSprmId == 0x836 ? PROP_CHAR_POSTURE : PROP_CHAR_POSTURE_COMPLEX;
2046 444 : break;
2047 : case NS_sprm::LN_CFStrike: /*sprmCFStrike*/
2048 : case NS_sprm::LN_CFDStrike : /*sprmCFDStrike double strike through*/
2049 14 : ePropertyId = PROP_CHAR_STRIKEOUT;
2050 14 : break;
2051 : case NS_sprm::LN_CFOutline: /*sprmCFOutline*/
2052 0 : ePropertyId = PROP_CHAR_CONTOURED;
2053 0 : break;
2054 : case NS_sprm::LN_CFShadow: /*sprmCFShadow*/
2055 0 : ePropertyId = PROP_CHAR_SHADOWED;
2056 0 : break;
2057 : case NS_sprm::LN_CFSmallCaps: /*sprmCFSmallCaps*/
2058 : case NS_sprm::LN_CFCaps: /*sprmCFCaps*/
2059 77 : ePropertyId = PROP_CHAR_CASE_MAP;
2060 77 : break;
2061 : case NS_sprm::LN_CFVanish: /*sprmCFVanish*/
2062 3 : ePropertyId = PROP_CHAR_HIDDEN;
2063 3 : break;
2064 : case NS_sprm::LN_CFEmboss: /*sprmCFEmboss*/
2065 0 : ePropertyId = PROP_CHAR_RELIEF;
2066 0 : break;
2067 : }
2068 : //expected: 0,1,128,129
2069 1150 : if(nIntValue != 128) //inherited from paragraph - ignore
2070 : {
2071 1150 : if( nIntValue == 129) //inverted style sheet value
2072 : {
2073 : //get value from style sheet and invert it
2074 0 : sal_Int16 nStyleValue = 0;
2075 0 : uno::Any aStyleVal = m_pImpl->GetPropertyFromStyleSheet(ePropertyId);
2076 0 : if( !aStyleVal.hasValue() )
2077 : {
2078 : nIntValue = 0x83a == nSprmId ?
2079 0 : 4 : 1;
2080 : }
2081 0 : else if(aStyleVal.getValueTypeClass() == uno::TypeClass_FLOAT )
2082 : {
2083 0 : double fDoubleValue = 0;
2084 : //only in case of awt::FontWeight
2085 0 : aStyleVal >>= fDoubleValue;
2086 0 : nIntValue = fDoubleValue > 100. ? 0 : 1;
2087 : }
2088 0 : else if((aStyleVal >>= nStyleValue) ||
2089 0 : (nStyleValue = (sal_Int16)comphelper::getEnumAsINT32(aStyleVal)) >= 0 )
2090 : {
2091 : nIntValue = 0x83a == nSprmId ?
2092 : nStyleValue ? 0 : 4 :
2093 0 : nStyleValue ? 0 : 1;
2094 : }
2095 : else
2096 : {
2097 : OSL_FAIL( "what type was it");
2098 0 : }
2099 : }
2100 :
2101 1150 : switch( nSprmId )
2102 : {
2103 : case 60:/*sprmCFBold*/
2104 : case NS_sprm::LN_CFBold: /*sprmCFBold*/
2105 : case NS_sprm::LN_CFBoldBi: // sprmCFBoldBi
2106 : {
2107 612 : uno::Any aBold( uno::makeAny( nIntValue ? awt::FontWeight::BOLD : awt::FontWeight::NORMAL ) );
2108 :
2109 612 : rContext->Insert(ePropertyId, aBold );
2110 612 : if( nSprmId != NS_sprm::LN_CFBoldBi ) // sprmCFBoldBi
2111 417 : rContext->Insert(PROP_CHAR_WEIGHT_ASIAN, aBold );
2112 :
2113 1224 : uno::Reference<beans::XPropertySet> xCharStyle(m_pImpl->GetCurrentNumberingCharStyle());
2114 612 : if (xCharStyle.is())
2115 613 : xCharStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_CHAR_WEIGHT), aBold);
2116 : }
2117 612 : break;
2118 : case 61: /*sprmCFItalic*/
2119 : case NS_sprm::LN_CFItalic: /*sprmCFItalic*/
2120 : case NS_sprm::LN_CFItalicBi: // sprmCFItalicBi
2121 : {
2122 444 : uno::Any aPosture( uno::makeAny( nIntValue ? awt::FontSlant_ITALIC : awt::FontSlant_NONE ) );
2123 444 : rContext->Insert( ePropertyId, aPosture );
2124 444 : if( nSprmId != NS_sprm::LN_CFItalicBi ) // sprmCFItalicBi
2125 258 : rContext->Insert(PROP_CHAR_POSTURE_ASIAN, aPosture );
2126 : }
2127 444 : break;
2128 : case NS_sprm::LN_CFStrike: /*sprmCFStrike*/
2129 : rContext->Insert(ePropertyId,
2130 12 : uno::makeAny( nIntValue ? awt::FontStrikeout::SINGLE : awt::FontStrikeout::NONE ) );
2131 12 : break;
2132 : case NS_sprm::LN_CFDStrike : /*sprmCFDStrike double strike through*/
2133 : rContext->Insert(ePropertyId,
2134 2 : uno::makeAny( nIntValue ? awt::FontStrikeout::DOUBLE : awt::FontStrikeout::NONE ) );
2135 2 : break;
2136 : case NS_sprm::LN_CFOutline: /*sprmCFOutline*/
2137 : case NS_sprm::LN_CFShadow: /*sprmCFShadow*/
2138 : case NS_sprm::LN_CFVanish: /*sprmCFVanish*/
2139 3 : rContext->Insert(ePropertyId, uno::makeAny( nIntValue ? true : false ));
2140 3 : break;
2141 : case NS_sprm::LN_CFSmallCaps: /*sprmCFSmallCaps*/
2142 : rContext->Insert(ePropertyId,
2143 59 : uno::makeAny( nIntValue ? style::CaseMap::SMALLCAPS : style::CaseMap::NONE));
2144 59 : break;
2145 : case NS_sprm::LN_CFCaps: /*sprmCFCaps*/
2146 : rContext->Insert(ePropertyId,
2147 18 : uno::makeAny( nIntValue ? style::CaseMap::UPPERCASE : style::CaseMap::NONE));
2148 18 : break;
2149 : case NS_sprm::LN_CFEmboss: /*sprmCFEmboss*/
2150 : rContext->Insert(ePropertyId,
2151 0 : uno::makeAny( nIntValue ? awt::FontRelief::EMBOSSED : awt::FontRelief::NONE ));
2152 0 : break;
2153 :
2154 : }
2155 : }
2156 : }
2157 1150 : break;
2158 : case NS_sprm::LN_CFtcDefault:
2159 0 : break; // sprmCFtcDefault
2160 : case NS_sprm::LN_CKul: // sprmCKul
2161 : {
2162 : // Parameter: 0 = none, 1 = single, 2 = by Word,
2163 : // 3 = double, 4 = dotted, 5 = hidden
2164 : // 6 = thick, 7 = dash, 8 = dot(not used)
2165 : // 9 = dotdash 10 = dotdotdash 11 = wave
2166 17 : handleUnderlineType(nIntValue, rContext);
2167 : }
2168 17 : break;
2169 : case NS_sprm::LN_CSizePos:
2170 0 : break; // sprmCSizePos
2171 : case NS_sprm::LN_CLid:
2172 0 : break; // sprmCLid
2173 : case NS_sprm::LN_CIco:
2174 : {
2175 0 : sal_Int32 nColor = 0;
2176 0 : if (getColorFromIndex(nIntValue, nColor))
2177 0 : rContext->Insert(PROP_CHAR_COLOR, uno::makeAny( nColor ) );
2178 : }
2179 0 : break; // sprmCIco
2180 : case NS_sprm::LN_CHpsBi: // sprmCHpsBi
2181 : case NS_sprm::LN_CHps: // sprmCHps
2182 : {
2183 : //multiples of half points (12pt == 24)
2184 6518 : double fVal = double(nIntValue) / 2.;
2185 6518 : uno::Any aVal = uno::makeAny( fVal );
2186 6518 : if( NS_sprm::LN_CHpsBi == nSprmId )
2187 : {
2188 1306 : rContext->Insert( PROP_CHAR_HEIGHT_COMPLEX, aVal );
2189 : }
2190 5212 : else if (!m_pImpl->m_bInTableStyleRunProps)
2191 : {
2192 : //Asian get the same value as Western
2193 5209 : rContext->Insert( PROP_CHAR_HEIGHT, aVal );
2194 5209 : rContext->Insert( PROP_CHAR_HEIGHT_ASIAN, aVal );
2195 :
2196 5209 : uno::Reference<beans::XPropertySet> xCharStyle(m_pImpl->GetCurrentNumberingCharStyle());
2197 5209 : if (xCharStyle.is())
2198 1 : xCharStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_CHAR_HEIGHT), aVal);
2199 : }
2200 : // Make sure char sizes defined in the stylesheets don't affect char props from direct formatting.
2201 6518 : if (!m_pImpl->IsStyleSheetImport())
2202 4938 : m_pImpl->deferCharacterProperty( nSprmId, uno::makeAny( nIntValue ));
2203 : }
2204 6518 : break;
2205 : case NS_sprm::LN_CHpsInc:
2206 0 : break; // sprmCHpsInc
2207 : case NS_sprm::LN_CHpsPos:
2208 : // The spec says 0 is the same as the lack of the value, so don't parse that.
2209 7 : if (nIntValue)
2210 5 : m_pImpl->deferCharacterProperty( nSprmId, uno::makeAny( nIntValue ));
2211 7 : break; // sprmCHpsPos
2212 : case NS_sprm::LN_CHpsPosAdj:
2213 0 : break; // sprmCHpsPosAdj
2214 : case NS_sprm::LN_CMajority:
2215 0 : break; // sprmCMajority
2216 : case NS_sprm::LN_CIss: // sprmCIss
2217 : {
2218 : //sub/super script 1: super, 2: sub, 0: normal
2219 0 : sal_Int16 nEscapement = 0;
2220 0 : sal_Int8 nProp = 58;
2221 0 : switch(nIntValue)
2222 : {
2223 : case 1: //super
2224 0 : nEscapement = 101;
2225 0 : break;
2226 : case 2: //sub
2227 0 : nEscapement = -101;
2228 0 : break;
2229 0 : case 0: nProp = 0;break; //none
2230 : }
2231 0 : rContext->Insert(PROP_CHAR_ESCAPEMENT, uno::makeAny( nEscapement ) );
2232 0 : rContext->Insert(PROP_CHAR_ESCAPEMENT_HEIGHT, uno::makeAny( nProp ) );
2233 : }
2234 0 : break;
2235 : case NS_sprm::LN_CHpsNew50:
2236 0 : break; // sprmCHpsNew50
2237 : case NS_sprm::LN_CHpsInc1:
2238 0 : break; // sprmCHpsInc1
2239 : case 71 : //"sprmCDxaSpace"
2240 : case 96 : //"sprmCDxaSpace"
2241 : case NS_sprm::LN_CDxaSpace: // sprmCDxaSpace
2242 : {
2243 : //Kerning half point values
2244 : //TODO: there are two kerning values -
2245 : // in ww8par6.cxx NS_sprm::LN_CHpsKern is used as boolean AutoKerning
2246 66 : sal_Int16 nResult = static_cast<sal_Int16>(ConversionHelper::convertTwipToMM100(nIntValue));
2247 66 : if (m_pImpl->IsInComments())
2248 : {
2249 0 : nResult = static_cast<sal_Int16>(nIntValue);
2250 : }
2251 66 : rContext->Insert(PROP_CHAR_CHAR_KERNING, uno::makeAny(nResult));
2252 : }
2253 66 : break;
2254 : case NS_sprm::LN_CHpsKern: // sprmCHpsKern auto kerning is bound to a minimum font size in Word - but not in Writer :-(
2255 143 : rContext->Insert(PROP_CHAR_AUTO_KERNING, uno::makeAny( sal_Bool(nIntValue) ) );
2256 143 : break;
2257 : case NS_sprm::LN_CMajority50:
2258 0 : break; // sprmCMajority50
2259 : case NS_sprm::LN_CHpsMul:
2260 0 : break; // sprmCHpsMul
2261 : case NS_sprm::LN_CYsri:
2262 0 : break; // sprmCYsri
2263 : case NS_sprm::LN_CRgFtc0: // sprmCRgFtc0 //ascii font index
2264 : case NS_sprm::LN_CRgFtc1: // sprmCRgFtc1 //Asian font index
2265 : case NS_sprm::LN_CRgFtc2: // sprmCRgFtc2 //CTL font index
2266 : case NS_sprm::LN_CFtcBi: // sprmCFtcBi //font index of a CTL font
2267 : {
2268 4912 : FontTablePtr pFontTable = m_pImpl->GetFontTable();
2269 4912 : if(nIntValue >= 0 && pFontTable->size() > sal_uInt32(nIntValue))
2270 : {
2271 4746 : PropertyIds eFontName = PROP_CHAR_FONT_NAME;
2272 4746 : PropertyIds eFontStyle = PROP_CHAR_FONT_STYLE;
2273 4746 : PropertyIds eFontFamily = PROP_CHAR_FONT_FAMILY;
2274 4746 : PropertyIds eFontCharSet = PROP_CHAR_FONT_CHAR_SET;
2275 4746 : PropertyIds eFontPitch = PROP_CHAR_FONT_PITCH;
2276 4746 : switch(nSprmId)
2277 : {
2278 : case NS_sprm::LN_CRgFtc0:
2279 : //already initialized
2280 4184 : break;
2281 : case NS_sprm::LN_CRgFtc1:
2282 151 : eFontName = PROP_CHAR_FONT_NAME_ASIAN;
2283 151 : eFontStyle = PROP_CHAR_FONT_STYLE_ASIAN;
2284 151 : eFontFamily = PROP_CHAR_FONT_FAMILY_ASIAN;
2285 151 : eFontCharSet = PROP_CHAR_FONT_CHAR_SET_ASIAN;
2286 151 : eFontPitch = PROP_CHAR_FONT_PITCH_ASIAN;
2287 151 : break;
2288 : case NS_sprm::LN_CRgFtc2:
2289 : case NS_sprm::LN_CFtcBi:
2290 411 : eFontName = PROP_CHAR_FONT_NAME_COMPLEX;
2291 411 : eFontStyle = PROP_CHAR_FONT_STYLE_COMPLEX;
2292 411 : eFontFamily = PROP_CHAR_FONT_FAMILY_COMPLEX;
2293 411 : eFontCharSet = PROP_CHAR_FONT_CHAR_SET_COMPLEX;
2294 411 : eFontPitch = PROP_CHAR_FONT_PITCH_COMPLEX;
2295 411 : break;
2296 : }
2297 : (void)eFontFamily;
2298 : (void)eFontStyle;
2299 4746 : const FontEntry::Pointer_t pFontEntry(pFontTable->getFontEntry(sal_uInt32(nIntValue)));
2300 4746 : rContext->Insert(eFontName, uno::makeAny( pFontEntry->sFontName ));
2301 4746 : rContext->Insert(eFontCharSet, uno::makeAny( (sal_Int16)pFontEntry->nTextEncoding ));
2302 4746 : rContext->Insert(eFontPitch, uno::makeAny( pFontEntry->nPitchRequest ));
2303 4912 : }
2304 : }
2305 4912 : break;
2306 : case NS_sprm::LN_CCharScale: // sprmCCharScale
2307 : rContext->Insert(PROP_CHAR_SCALE_WIDTH,
2308 4 : uno::makeAny( sal_Int16(nIntValue) ));
2309 4 : break;
2310 : case NS_sprm::LN_CFImprint: // sprmCFImprint 1 or 0
2311 : // FontRelief: NONE, EMBOSSED, ENGRAVED
2312 : rContext->Insert(PROP_CHAR_RELIEF,
2313 0 : uno::makeAny( nIntValue ? awt::FontRelief::ENGRAVED : awt::FontRelief::NONE ));
2314 0 : break;
2315 : case NS_sprm::LN_CFObj:
2316 0 : break; // sprmCFObj
2317 : case NS_sprm::LN_CPropRMark:
2318 0 : break; // sprmCPropRMark
2319 : case NS_sprm::LN_CSfxText:
2320 : // The file-format has many character animations. We have only
2321 : // one, so we use it always. Suboptimal solution though.
2322 2 : if (nIntValue)
2323 0 : rContext->Insert(PROP_CHAR_FLASH, uno::makeAny( true ));
2324 : else
2325 2 : rContext->Insert(PROP_CHAR_FLASH, uno::makeAny( false ));
2326 2 : break; // sprmCSfxText
2327 : case NS_sprm::LN_CFBiDi:
2328 1 : break; // sprmCFBiDi
2329 : case NS_sprm::LN_CFDiacColor:
2330 0 : break; // sprmCFDiacColor
2331 : case NS_sprm::LN_CIcoBi:
2332 0 : break; // sprmCIcoBi
2333 : case NS_sprm::LN_CDispFldRMark:
2334 0 : break; // sprmCDispFldRMark
2335 : case NS_sprm::LN_CIbstRMarkDel:
2336 0 : break; // sprmCIbstRMarkDel
2337 : case NS_sprm::LN_CDttmRMarkDel:
2338 0 : break; // sprmCDttmRMarkDel
2339 : case NS_sprm::LN_CBrc:
2340 0 : break; // sprmCBrc
2341 : case NS_sprm::LN_CShd:
2342 : {
2343 : //contains fore color, back color and shadow percentage, results in a brush
2344 8 : writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
2345 8 : if( pProperties.get())
2346 : {
2347 8 : CellColorHandlerPtr pCellColorHandler( new CellColorHandler );
2348 8 : pCellColorHandler->setOutputFormat( CellColorHandler::Character );
2349 8 : pProperties->resolve(*pCellColorHandler);
2350 8 : rContext->InsertProps(pCellColorHandler->getProperties());
2351 : }
2352 8 : break;
2353 : }
2354 : case NS_sprm::LN_CIdslRMarkDel:
2355 0 : break; // sprmCIdslRMarkDel
2356 : case NS_sprm::LN_CFUsePgsuSettings:
2357 0 : break; // sprmCFUsePgsuSettings
2358 : case NS_sprm::LN_CCpg:
2359 0 : break; // sprmCCpg
2360 : case NS_sprm::LN_CLidBi: // sprmCLidBi language complex
2361 : case NS_sprm::LN_CRgLid0_80: // sprmCRgLid0_80 older language Western
2362 : case NS_sprm::LN_CRgLid0: // sprmCRgLid0 language Western
2363 : case NS_sprm::LN_CRgLid1: // sprmCRgLid1 language Asian
2364 : case NS_sprm::LN_CRgLid1_80: // sprmCRgLid1_80 older language Asian
2365 : {
2366 4886 : lang::Locale aLocale( LanguageTag( (LanguageType)nIntValue).getLocale());
2367 :
2368 : PropertyIds aPropId;
2369 4886 : switch (nSprmId)
2370 : {
2371 : case NS_sprm::LN_CRgLid0:
2372 : case NS_sprm::LN_CRgLid0_80:
2373 4255 : aPropId = PROP_CHAR_LOCALE;
2374 4255 : break;
2375 : case NS_sprm::LN_CRgLid1:
2376 : case NS_sprm::LN_CRgLid1_80:
2377 309 : aPropId = PROP_CHAR_LOCALE_ASIAN;
2378 309 : break;
2379 : default:
2380 322 : aPropId = PROP_CHAR_LOCALE_COMPLEX;
2381 322 : break;
2382 : }
2383 :
2384 4886 : rContext->Insert(aPropId, uno::makeAny( aLocale ) );
2385 : }
2386 4886 : break;
2387 :
2388 : case NS_sprm::LN_CIdctHint: // sprmCIdctHint
2389 : //list table - text offset???
2390 0 : break;
2391 : case NS_sprm::LN_PicBrcl:
2392 0 : break; // sprmPicBrcl
2393 : case NS_sprm::LN_PicScale:
2394 0 : break; // sprmPicScale
2395 : case NS_sprm::LN_PicBrcTop:
2396 0 : break; // sprmPicBrcTop
2397 : case NS_sprm::LN_PicBrcLeft:
2398 0 : break; // sprmPicBrcLeft
2399 : case NS_sprm::LN_PicBrcBottom:
2400 0 : break; // sprmPicBrcBoConversionHelper::convertTwipToMM100ttom
2401 : case NS_sprm::LN_PicBrcRight:
2402 0 : break; // sprmPicBrcRight
2403 : case NS_sprm::LN_ScnsPgn:
2404 0 : break; // sprmScnsPgn
2405 : case NS_sprm::LN_SiHeadingPgn:
2406 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2407 0 : if(pSectionContext)
2408 0 : pSectionContext->SetEvenlySpaced( nIntValue > 0 );
2409 :
2410 0 : break; // sprmSiHeadingPgn
2411 : case NS_sprm::LN_SOlstAnm:
2412 0 : break; // sprmSOlstAnm
2413 : case 136:
2414 : case NS_sprm::LN_SDxaColWidth: // sprmSDxaColWidth
2415 : // contains the twip width of the column as 3-byte-code
2416 : // the lowet byte contains the index
2417 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2418 0 : if(pSectionContext)
2419 0 : pSectionContext->AppendColumnWidth( ConversionHelper::convertTwipToMM100( (nIntValue & 0xffff00) >> 8 ));
2420 0 : break;
2421 : case NS_sprm::LN_SDxaColSpacing: // sprmSDxaColSpacing
2422 : // the lowet byte contains the index
2423 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2424 0 : if(pSectionContext)
2425 0 : pSectionContext->AppendColumnSpacing( ConversionHelper::convertTwipToMM100( (nIntValue & 0xffff00) >> 8 ));
2426 0 : break;
2427 : case 138:
2428 : case NS_sprm::LN_SFEvenlySpaced:
2429 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2430 0 : if(pSectionContext)
2431 0 : pSectionContext->SetEvenlySpaced( nIntValue > 0 );
2432 0 : break; // sprmSFEvenlySpaced
2433 : case NS_sprm::LN_SFProtected: // sprmSFProtected
2434 : //todo: missing feature - unlocked sections in protected documents
2435 0 : break;
2436 : case NS_sprm::LN_SDmBinFirst: // sprmSDmBinFirst
2437 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2438 0 : if(pSectionContext)
2439 0 : pSectionContext->SetFirstPaperBin(nIntValue);
2440 0 : break;
2441 : case NS_sprm::LN_SDmBinOther: // sprmSDmBinOther
2442 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2443 0 : if(pSectionContext)
2444 0 : pSectionContext->SetPaperBin( nIntValue );
2445 0 : break;
2446 : case NS_sprm::LN_SBkc: // sprmSBkc
2447 : /* break type
2448 : 0 - No break
2449 : 1 - New Column
2450 : 2 - New page
2451 : 3 - Even page
2452 : 4 - odd page
2453 : */
2454 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2455 95 : if(pSectionContext)
2456 : {
2457 : // Ignore continous section break at the end of the document, if the previous section had the same type as well
2458 : // It makes the importer loose margin settings with no benefit
2459 95 : SectionPropertyMap* pLastContext = m_pImpl->GetLastSectionContext();
2460 95 : int nPrevBreakType = 0;
2461 95 : bool bHasPrevSection = false;
2462 95 : if (pLastContext)
2463 : {
2464 20 : bHasPrevSection = true;
2465 20 : nPrevBreakType = pLastContext->GetBreakType();
2466 : }
2467 95 : if (m_pImpl->GetParaSectpr() || nIntValue != 0 || (bHasPrevSection && nPrevBreakType != nIntValue))
2468 90 : pSectionContext->SetBreakType( nIntValue );
2469 : }
2470 95 : break;
2471 : case 143:
2472 : case NS_sprm::LN_SFTitlePage: // sprmSFTitlePage
2473 : case NS_ooxml::LN_EG_SectPrContents_titlePg:
2474 : {
2475 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2476 17 : if(pSectionContext)
2477 17 : pSectionContext->SetTitlePage( nIntValue > 0 ? true : false );//section has title page
2478 : }
2479 17 : break;
2480 : case 144:
2481 : case NS_sprm::LN_SCcolumns: // sprmSCcolumns
2482 : //no of columns - 1
2483 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2484 0 : if(pSectionContext)
2485 0 : pSectionContext->SetColumnCount( (sal_Int16) nIntValue );
2486 0 : break;
2487 : case 145:
2488 : case NS_sprm::LN_SDxaColumns: // sprmSDxaColumns
2489 : //column distance - default 708 twip
2490 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2491 0 : if(pSectionContext)
2492 0 : pSectionContext->SetColumnDistance( ConversionHelper::convertTwipToMM100( nIntValue ) );
2493 0 : break;
2494 : case NS_sprm::LN_SFAutoPgn:
2495 0 : break; // sprmSFAutoPgn
2496 : case 147:
2497 : case NS_sprm::LN_SNfcPgn: // sprmSNfcPgn
2498 : //page numbering 0 - Arab, 1 - ROMAN, 2 - roman, 3 - ABC, 4 abc
2499 : sal_Int16 nNumbering;
2500 0 : switch( nIntValue )
2501 : {
2502 0 : case 1: nNumbering = style::NumberingType::ROMAN_UPPER;break;
2503 0 : case 2: nNumbering = style::NumberingType::ROMAN_LOWER;break;
2504 0 : case 3: nNumbering = style::NumberingType::CHARS_UPPER_LETTER;break;
2505 0 : case 4: nNumbering = style::NumberingType::CHARS_LOWER_LETTER;break;
2506 : case 0:
2507 : default:
2508 0 : nNumbering = style::NumberingType::ARABIC;
2509 : }
2510 0 : rContext->Insert( PROP_NUMBERING_TYPE, uno::makeAny( nNumbering ) );
2511 0 : break;
2512 : case NS_sprm::LN_SDyaPgn:
2513 0 : break; // sprmSDyaPgn
2514 : case NS_sprm::LN_SDxaPgn:
2515 0 : break; // sprmSDxaPgn
2516 : case 150:
2517 : case NS_sprm::LN_SFPgnRestart: // sprmSFPgnRestart
2518 : {
2519 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2520 0 : if(pSectionContext)
2521 0 : pSectionContext->SetPageNoRestart( nIntValue > 0 );
2522 : }
2523 0 : break;
2524 : case NS_sprm::LN_SFEndnote:
2525 0 : break; // sprmSFEndnote
2526 : case 154:
2527 : case NS_sprm::LN_SNLnnMod:// sprmSNLnnMod
2528 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2529 0 : if( pSectionContext )
2530 0 : pSectionContext->SetLnnMod( nIntValue );
2531 0 : break;
2532 : case 155:
2533 : case NS_sprm::LN_SDxaLnn: // sprmSDxaLnn
2534 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2535 0 : if( pSectionContext )
2536 0 : pSectionContext->SetdxaLnn( nIntValue );
2537 0 : break;
2538 : case 152:
2539 : case NS_sprm::LN_SLnc:// sprmSLnc
2540 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2541 0 : if( pSectionContext )
2542 0 : pSectionContext->SetLnc( nIntValue );
2543 0 : break;
2544 : case 160:
2545 : case NS_sprm::LN_SLnnMin: // sprmSLnnMin
2546 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2547 0 : if( pSectionContext )
2548 0 : pSectionContext->SetLnnMin( nIntValue + 1 ); // Sending '+1' because the value of 'sprmSLnnMin' is one less than the starting value for line numbers.
2549 0 : break;
2550 :
2551 : case NS_sprm::LN_SGprfIhdt:
2552 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2553 : //flags about header/footer sharing and footnotes?
2554 : /* ww8scan.hxx:
2555 : * WW8_HEADER_EVEN = 0x01, WW8_HEADER_ODD = 0x02, WW8_FOOTER_EVEN = 0x04,
2556 : * WW8_FOOTER_ODD = 0x08, WW8_HEADER_FIRST = 0x10, WW8_FOOTER_FIRST = 0x20
2557 : */
2558 :
2559 0 : break; // sprmSGprfIhdt
2560 : case NS_sprm::LN_SDyaHdrTop: // sprmSDyaHdrTop
2561 : // default 720 twip
2562 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2563 0 : if(pSectionContext)
2564 0 : pSectionContext->SetHeaderTop( ConversionHelper::convertTwipToMM100( nIntValue ));
2565 0 : break;
2566 : case NS_sprm::LN_SDyaHdrBottom: // sprmSDyaHdrBottom
2567 : // default 720 twip
2568 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2569 0 : if(pSectionContext)
2570 0 : pSectionContext->SetHeaderBottom( ConversionHelper::convertTwipToMM100( nIntValue ) );
2571 0 : break;
2572 : case 158:
2573 : case NS_sprm::LN_SLBetween: // sprmSLBetween
2574 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2575 0 : if(pSectionContext)
2576 0 : pSectionContext->SetSeparatorLine( nIntValue > 0 );
2577 0 : break;
2578 : case NS_sprm::LN_SVjc:
2579 0 : break; // sprmSVjc
2580 : case 161:
2581 : case NS_sprm::LN_SPgnStart: // sprmSPgnStart
2582 : //page number
2583 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2584 0 : if(pSectionContext)
2585 0 : pSectionContext->SetPageNumber( nIntValue );
2586 0 : break;
2587 : case 162:
2588 : case NS_sprm::LN_SBOrientation:
2589 : //todo: the old filter assumed that a value of 2 points to double-pages layout
2590 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2591 0 : if(pSectionContext)
2592 0 : pSectionContext->SetLandscape( nIntValue > 0 );
2593 0 : rContext->Insert( PROP_IS_LANDSCAPE , uno::makeAny( nIntValue > 0 ));
2594 0 : break; // sprmSBOrientation
2595 : case NS_sprm::LN_SBCustomize:
2596 0 : break; // sprmSBCustomize
2597 : case 165:
2598 : case NS_sprm::LN_SYaPage: // sprmSYaPage
2599 : {
2600 : //page height, rounded to default values, default: 0x3dc0 twip
2601 0 : sal_Int32 nHeight = ConversionHelper::convertTwipToMM100( nIntValue );
2602 0 : rContext->Insert( PROP_HEIGHT, uno::makeAny( PaperInfo::sloppyFitPageDimension( nHeight ) ) );
2603 : }
2604 0 : break;
2605 : case NS_sprm::LN_SXaPage: // sprmSXaPage
2606 : {
2607 : //page width, rounded to default values, default 0x2fd0 twip
2608 0 : sal_Int32 nWidth = ConversionHelper::convertTwipToMM100( nIntValue );
2609 0 : rContext->Insert( PROP_WIDTH, uno::makeAny( PaperInfo::sloppyFitPageDimension( nWidth ) ) );
2610 : }
2611 0 : break;
2612 : case 166:
2613 : case NS_sprm::LN_SDxaLeft: // sprmSDxaLeft
2614 : {
2615 : //left page margin default 0x708 twip
2616 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2617 0 : sal_Int32 nConverted = ConversionHelper::convertTwipToMM100( nIntValue );
2618 0 : if(pSectionContext)
2619 0 : pSectionContext->SetLeftMargin( nConverted );
2620 0 : rContext->Insert( PROP_LEFT_MARGIN, uno::makeAny( nConverted ));
2621 : }
2622 0 : break;
2623 : case 167:
2624 : case NS_sprm::LN_SDxaRight: // sprmSDxaRight
2625 : {
2626 : //right page margin default 0x708 twip
2627 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2628 0 : sal_Int32 nConverted = ConversionHelper::convertTwipToMM100( nIntValue );
2629 0 : if(pSectionContext)
2630 0 : pSectionContext->SetRightMargin( nConverted );
2631 0 : rContext->Insert( PROP_RIGHT_MARGIN, uno::makeAny( nConverted ));
2632 : }
2633 0 : break;
2634 : case 168:
2635 : case NS_sprm::LN_SDyaTop: // sprmSDyaTop
2636 : {
2637 : //top page margin default 1440 twip
2638 : //todo: check cast of SVBT16
2639 0 : sal_Int32 nConverted = ConversionHelper::convertTwipToMM100( static_cast< sal_Int16 >( nIntValue ) );
2640 0 : rContext->Insert( PROP_TOP_MARGIN, uno::makeAny( nConverted ) );
2641 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2642 0 : if(pSectionContext)
2643 0 : pSectionContext->SetTopMargin( nConverted );
2644 : }
2645 0 : break;
2646 : case 169:
2647 : case NS_sprm::LN_SDyaBottom: // sprmSDyaBottom
2648 : {
2649 : //bottom page margin default 1440 twip
2650 : //todo: check cast of SVBT16
2651 0 : sal_Int32 nConverted = ConversionHelper::convertTwipToMM100( static_cast< sal_Int16 >( nIntValue ) );
2652 0 : rContext->Insert( PROP_BOTTOM_MARGIN, uno::makeAny( nConverted) );
2653 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2654 0 : if(pSectionContext)
2655 0 : pSectionContext->SetBottomMargin( nConverted );
2656 : }
2657 0 : break;
2658 : case 170:
2659 : case NS_sprm::LN_SDzaGutter: // sprmSDzaGutter
2660 : {
2661 : // gutter is added to one of the margins of a section depending on RTL, can be placed on top either
2662 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2663 0 : if(pSectionContext)
2664 : {
2665 0 : pSectionContext->SetDzaGutter( ConversionHelper::convertTwipToMM100( nIntValue ) );
2666 : }
2667 : }
2668 0 : break;
2669 : case NS_sprm::LN_SDmPaperReq: // sprmSDmPaperReq
2670 : //paper code - no handled in old filter
2671 0 : break;
2672 : case NS_sprm::LN_SPropRMark:
2673 0 : break; // sprmSPropRMark
2674 : case NS_sprm::LN_SFBiDi:// sprmSFBiDi
2675 : {
2676 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2677 0 : if(pSectionContext)
2678 0 : pSectionContext->SetSFBiDi( nIntValue > 0 );
2679 : }
2680 0 : break;
2681 : case NS_sprm::LN_SFFacingCol:
2682 0 : break; // sprmSFFacingCol
2683 : case NS_sprm::LN_SFRTLGutter: // sprmSFRTLGutter
2684 : {
2685 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2686 0 : if(pSectionContext)
2687 0 : pSectionContext->SetGutterRTL( nIntValue > 0 );
2688 : }
2689 0 : break;
2690 : case NS_sprm::LN_SBrcTop: // sprmSBrcTop
2691 : case NS_sprm::LN_SBrcLeft: // sprmSBrcLeft
2692 : case NS_sprm::LN_SBrcBottom: // sprmSBrcBottom
2693 : case NS_sprm::LN_SBrcRight: // sprmSBrcRight
2694 : {
2695 0 : table::BorderLine2 aBorderLine;
2696 0 : sal_Int32 nLineDistance = ConversionHelper::MakeBorderLine( nIntValue, aBorderLine );
2697 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2698 0 : if(pSectionContext)
2699 : {
2700 : static const BorderPosition aPositions[4] =
2701 : {
2702 : BORDER_TOP,
2703 : BORDER_LEFT,
2704 : BORDER_BOTTOM,
2705 : BORDER_RIGHT
2706 : };
2707 0 : pSectionContext->SetBorder( aPositions[nSprmId - NS_sprm::LN_SBrcTop], nLineDistance, aBorderLine, /*bShadow =*/ false );
2708 : }
2709 : }
2710 0 : break;
2711 :
2712 : case NS_sprm::LN_SPgbProp: // sprmSPgbProp
2713 : {
2714 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2715 0 : if(pSectionContext)
2716 : {
2717 0 : pSectionContext->ApplyBorderToPageStyles( m_pImpl->GetPageStyles(), m_pImpl->GetTextFactory(), nIntValue );
2718 : }
2719 : }
2720 0 : break;
2721 : case NS_sprm::LN_SDxtCharSpace:
2722 : {
2723 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2724 0 : if(pSectionContext)
2725 : {
2726 0 : pSectionContext->SetDxtCharSpace( nIntValue );
2727 : }
2728 : }
2729 0 : break; // sprmSDxtCharSpace
2730 : case NS_sprm::LN_SDyaLinePitch: // sprmSDyaLinePitch
2731 : {
2732 : //see SwWW8ImplReader::SetDocumentGrid
2733 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2734 0 : if(pSectionContext)
2735 : {
2736 0 : pSectionContext->SetGridLinePitch( ConversionHelper::convertTwipToMM100( nIntValue ) );
2737 : }
2738 : }
2739 0 : break;
2740 : case 0x703a: //undocumented, grid related?
2741 : OSL_FAIL( "TODO: not handled yet"); //nIntValue like 0x008a2373 ?
2742 0 : break;
2743 : case NS_sprm::LN_SClm:
2744 : {
2745 0 : sal_Int16 nGridType = text::TextGridMode::NONE;
2746 0 : switch( nIntValue )
2747 : {
2748 : case 0:
2749 0 : nGridType = text::TextGridMode::NONE;
2750 0 : break;
2751 : case 3:
2752 : //Text snaps to char grid, this doesn't make a lot of sense to
2753 : //me. This is closer than LINES_CHARS
2754 0 : nGridType = text::TextGridMode::LINES;
2755 0 : break;
2756 : case 1:
2757 0 : nGridType = text::TextGridMode::LINES_AND_CHARS;
2758 0 : break;
2759 : case 2:
2760 0 : nGridType = text::TextGridMode::LINES;
2761 0 : break;
2762 : default:;
2763 : }
2764 0 : rContext->Insert( PROP_GRID_MODE, uno::makeAny( nGridType ) );
2765 :
2766 : //Seems to force this behaviour in word ?
2767 0 : if(nGridType != text::TextGridMode::NONE)
2768 : m_pImpl->SetDocumentSettingsProperty(
2769 0 : PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_ADD_EXTERNAL_LEADING ),
2770 0 : uno::makeAny( true ) );
2771 : }
2772 0 : break; // sprmSClm
2773 : case NS_sprm::LN_STextFlow:
2774 : case NS_ooxml::LN_EG_SectPrContents_textDirection:
2775 : {
2776 : /* 0 HoriLR 1 Vert TR 2 Vert TR 3 Vert TT 4 HoriLT
2777 : only 0 and 1 can be imported correctly
2778 : */
2779 71 : sal_Int16 nDirection = text::WritingMode_LR_TB;
2780 71 : switch( nIntValue )
2781 : {
2782 : case 0:
2783 : case 4:
2784 71 : nDirection = text::WritingMode_LR_TB;
2785 71 : break;
2786 : case 1:
2787 : case 2:
2788 : case 3:
2789 0 : nDirection = text::WritingMode_TB_RL;
2790 0 : break;
2791 : default:;
2792 : }
2793 :
2794 71 : PropertyMap * pTargetContext = rContext.get();
2795 :
2796 71 : if (pSectionContext != NULL &&
2797 : nSprmId == NS_ooxml::LN_EG_SectPrContents_textDirection)
2798 : {
2799 70 : pTargetContext = pSectionContext;
2800 : }
2801 :
2802 71 : pTargetContext->Insert(PROP_WRITING_MODE, uno::makeAny( nDirection ) );
2803 : }
2804 71 : break; // sprmSTextFlow
2805 : case NS_sprm::LN_TJc: // sprmTJc
2806 : case NS_sprm::LN_TDxaLeft:
2807 : case NS_sprm::LN_TDxaGapHalf:
2808 : case NS_sprm::LN_TFCantSplit:
2809 : case NS_sprm::LN_TTableHeader:
2810 : case NS_sprm::LN_TTableBorders: // sprmTTableBorders
2811 : {
2812 : OSL_FAIL( "table propeties should be handled by the table manager");
2813 : }
2814 0 : break;
2815 : case NS_sprm::LN_TDefTable10:
2816 0 : break; // sprmTDefTable10
2817 : case NS_sprm::LN_TDyaRowHeight:
2818 0 : break; // sprmTDyaRowHeight
2819 : case NS_sprm::LN_TDefTable:
2820 0 : break; // sprmTDefTable
2821 : case NS_sprm::LN_TDefTableShd:
2822 0 : break; // sprmTDefTableShd
2823 : case NS_sprm::LN_TTlp:
2824 0 : break; // sprmTTlp
2825 : case NS_sprm::LN_TFBiDi:
2826 0 : break; // sprmTFBiDi
2827 : case NS_sprm::LN_THTMLProps:
2828 0 : break; // sprmTHTMLProps
2829 : case NS_sprm::LN_TSetBrc:
2830 0 : break; // sprmTSetBrc
2831 : case NS_sprm::LN_TInsert:
2832 0 : break; // sprmTInsert
2833 : case NS_sprm::LN_TDelete:
2834 0 : break; // sprmTDelete
2835 : case NS_sprm::LN_TDxaCol:
2836 0 : break; // sprmTDxaCol
2837 : case NS_sprm::LN_TMerge:
2838 0 : break; // sprmTMerge
2839 : case NS_sprm::LN_TSplit:
2840 0 : break; // sprmTSplit
2841 : case NS_sprm::LN_TSetBrc10:
2842 0 : break; // sprmTSetBrc10
2843 : case 164: // sprmTSetShd
2844 : case NS_sprm::LN_TSetShd:
2845 0 : break; // sprmTSetShd
2846 : case NS_sprm::LN_TSetShdOdd:
2847 0 : break; // sprmTSetShdOdd
2848 : case NS_sprm::LN_TTextFlow:
2849 141 : break; // sprmTTextFlow
2850 : case NS_sprm::LN_TDiagLine:
2851 0 : break; // sprmTDiagLine
2852 : case NS_sprm::LN_TVertMerge:
2853 0 : break; // sprmTVertMerge
2854 : case NS_sprm::LN_TVertAlign:
2855 0 : break; // sprmTVertAlign
2856 : // the following are not part of the official documentation
2857 : case 0x6870: //TxtForeColor
2858 : {
2859 : //contains a color as 0xTTRRGGBB while SO uses 0xTTRRGGBB
2860 0 : sal_Int32 nColor = ConversionHelper::ConvertColor(nIntValue);
2861 0 : rContext->Insert(PROP_CHAR_COLOR, uno::makeAny( nColor ) );
2862 : }
2863 0 : break;
2864 : case 0x6877: //underlining color
2865 : {
2866 3 : rContext->Insert(PROP_CHAR_UNDERLINE_HAS_COLOR, uno::makeAny( true ) );
2867 3 : rContext->Insert(PROP_CHAR_UNDERLINE_COLOR, uno::makeAny( nIntValue ) );
2868 : }
2869 3 : break;
2870 : case 0x6815:
2871 0 : break; //undocumented
2872 : case NS_sprm::LN_CIndrsid:
2873 0 : break; //undocumented
2874 : case 0x6467:
2875 0 : break; //undocumented
2876 : case 0xF617:
2877 0 : break; //undocumented
2878 : case 0xd634: // sprmTNewSpacing - table spacing ( see WW8TabBandDesc::ProcessSpacing() )
2879 0 : break;
2880 : case NS_sprm::LN_TTRLeft:
2881 0 : break; //undocumented
2882 : case 0x4888:
2883 : case 0x6887:
2884 : //properties of list levels - undocumented
2885 0 : break;
2886 : case 0xd234:
2887 : case 0xd235:
2888 : case 0xd236:
2889 : case 0xd237:
2890 0 : break;//undocumented section properties
2891 : case NS_sprm::LN_CEastAsianLayout:
2892 0 : resolveSprmProps(*this, rSprm);
2893 0 : break;
2894 : case NS_ooxml::LN_CT_Tabs_tab:
2895 369 : resolveSprmProps(*this, rSprm);
2896 369 : m_pImpl->IncorporateTabStop(m_pImpl->m_aCurrentTabStop);
2897 369 : m_pImpl->m_aCurrentTabStop = DeletableTabStop();
2898 369 : break;
2899 : case NS_ooxml::LN_CT_PPrBase_tabs:
2900 : {
2901 : // Initialize tab stop vector from style sheet
2902 180 : if( !m_pImpl->IsStyleSheetImport() )
2903 : {
2904 32 : uno::Any aValue = m_pImpl->GetPropertyFromStyleSheet(PROP_PARA_TAB_STOPS);
2905 64 : uno::Sequence< style::TabStop > aStyleTabStops;
2906 32 : if(aValue >>= aStyleTabStops)
2907 : {
2908 0 : m_pImpl->InitTabStopFromStyle( aStyleTabStops );
2909 32 : }
2910 : }
2911 180 : resolveSprmProps(*this, rSprm);
2912 180 : rContext->Insert(PROP_PARA_TAB_STOPS, uno::makeAny( m_pImpl->GetCurrentTabStopAndClear()));
2913 : }
2914 180 : break;
2915 :
2916 : case NS_ooxml::LN_CT_DocDefaults_pPrDefault:
2917 : case NS_ooxml::LN_CT_DocDefaults_rPrDefault:
2918 0 : GetStyleSheetTable()->sprm( rSprm );
2919 0 : break;
2920 : case NS_ooxml::LN_CT_PPr_sectPr:
2921 : case NS_ooxml::LN_EG_RPrBase_color:
2922 : case NS_ooxml::LN_EG_RPrBase_rFonts:
2923 : case NS_ooxml::LN_EG_RPrBase_bdr:
2924 : case NS_ooxml::LN_EG_RPrBase_eastAsianLayout:
2925 : case NS_ooxml::LN_EG_RPrBase_u:
2926 : case NS_ooxml::LN_EG_RPrBase_lang:
2927 : case NS_ooxml::LN_CT_PPrBase_spacing:
2928 : case NS_ooxml::LN_CT_PPrBase_ind:
2929 : case NS_ooxml::LN_CT_RPrDefault_rPr:
2930 : case NS_ooxml::LN_CT_PPrDefault_pPr:
2931 : case NS_ooxml::LN_CT_Style_pPr:
2932 : case NS_ooxml::LN_CT_Style_rPr:
2933 : case NS_ooxml::LN_CT_PPr_rPr:
2934 : case NS_ooxml::LN_CT_PPrBase_numPr:
2935 6947 : if (nSprmId == NS_ooxml::LN_CT_PPr_sectPr)
2936 222 : m_pImpl->SetParaSectpr(true);
2937 6947 : resolveSprmProps(*this, rSprm);
2938 6947 : break;
2939 : case NS_ooxml::LN_EG_SectPrContents_footnotePr:
2940 : case NS_ooxml::LN_EG_SectPrContents_endnotePr:
2941 322 : m_pImpl->SetInFootnoteProperties( NS_ooxml::LN_EG_SectPrContents_footnotePr == nSprmId );
2942 322 : resolveSprmProps(*this, rSprm);
2943 322 : break;
2944 : case NS_ooxml::LN_EG_SectPrContents_lnNumType:
2945 : {
2946 3 : resolveSprmProps(*this, rSprm);
2947 3 : LineNumberSettings aSettings = m_pImpl->GetLineNumberSettings();
2948 3 : aSettings.bIsOn = true;
2949 3 : m_pImpl->SetLineNumberSettings( aSettings );
2950 : //apply settings at XLineNumberingProperties
2951 : try
2952 : {
2953 3 : uno::Reference< text::XLineNumberingProperties > xLineNumberingProperties( m_pImpl->GetTextDocument(), uno::UNO_QUERY_THROW );
2954 6 : uno::Reference< beans::XPropertySet > xLineNumberingPropSet = xLineNumberingProperties->getLineNumberingProperties();
2955 3 : PropertyNameSupplier& rNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
2956 3 : xLineNumberingPropSet->setPropertyValue(rNameSupplier.GetName( PROP_IS_ON ), uno::makeAny(true) );
2957 3 : if( aSettings.nInterval )
2958 3 : xLineNumberingPropSet->setPropertyValue(rNameSupplier.GetName( PROP_INTERVAL ), uno::makeAny((sal_Int16)aSettings.nInterval) );
2959 3 : if( aSettings.nDistance )
2960 0 : xLineNumberingPropSet->setPropertyValue(rNameSupplier.GetName( PROP_DISTANCE ), uno::makeAny(aSettings.nDistance) );
2961 6 : xLineNumberingPropSet->setPropertyValue(rNameSupplier.GetName( PROP_RESTART_AT_EACH_PAGE ), uno::makeAny(aSettings.bRestartAtEachPage) );
2962 : }
2963 0 : catch( const uno::Exception& )
2964 : {
2965 : }
2966 :
2967 : }
2968 3 : break;
2969 : case NS_ooxml::LN_CT_PPrBase_framePr:
2970 : // Avoid frames if we're inside a structured document tag, would just cause outer tables fail to create.
2971 25 : if (!m_pImpl->GetSdt())
2972 : {
2973 24 : PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH);
2974 24 : if( pContext.get() )
2975 : {
2976 22 : ParagraphPropertyMap* pParaContext = dynamic_cast< ParagraphPropertyMap* >( pContext.get() );
2977 22 : pParaContext->SetFrameMode();
2978 : }
2979 : else
2980 : {
2981 : //TODO: What about style sheet import of frame properties
2982 : }
2983 24 : resolveSprmProps(*this, rSprm);
2984 : }
2985 25 : break;
2986 : case NS_ooxml::LN_EG_SectPrContents_pgSz:
2987 255 : CT_PageSz.code = 0;
2988 : {
2989 255 : PaperInfo aLetter(PAPER_LETTER);
2990 255 : CT_PageSz.w = aLetter.getWidth();
2991 255 : CT_PageSz.h = aLetter.getHeight();
2992 : }
2993 255 : CT_PageSz.orient = false;
2994 255 : resolveSprmProps(*this, rSprm);
2995 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
2996 255 : if(pSectionContext)
2997 : {
2998 255 : pSectionContext->Insert( PROP_HEIGHT, uno::makeAny( CT_PageSz.h ) );
2999 255 : pSectionContext->Insert( PROP_IS_LANDSCAPE, uno::makeAny( CT_PageSz.orient ));
3000 255 : pSectionContext->Insert( PROP_WIDTH, uno::makeAny( CT_PageSz.w ) );
3001 255 : pSectionContext->SetLandscape( CT_PageSz.orient );
3002 : }
3003 255 : break;
3004 :
3005 : case NS_ooxml::LN_EG_SectPrContents_pgMar:
3006 258 : m_pImpl->InitPageMargins();
3007 258 : resolveSprmProps(*this, rSprm);
3008 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
3009 258 : if(pSectionContext)
3010 : {
3011 258 : const _PageMar& rPageMar = m_pImpl->GetPageMargins();
3012 258 : pSectionContext->SetTopMargin( rPageMar.top );
3013 258 : pSectionContext->SetRightMargin( rPageMar.right );
3014 258 : pSectionContext->SetBottomMargin( rPageMar.bottom );
3015 258 : pSectionContext->SetLeftMargin( rPageMar.left );
3016 258 : pSectionContext->SetHeaderTop( rPageMar.header );
3017 258 : pSectionContext->SetHeaderBottom( rPageMar.footer );
3018 : }
3019 258 : break;
3020 :
3021 : case NS_ooxml::LN_EG_SectPrContents_cols:
3022 : {
3023 101 : writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
3024 101 : if( pProperties.get())
3025 : {
3026 :
3027 101 : SectionColumnHandlerPtr pSectHdl( new SectionColumnHandler );
3028 101 : pProperties->resolve(*pSectHdl);
3029 101 : if(pSectionContext)
3030 : {
3031 101 : if( pSectHdl->IsEqualWidth() )
3032 : {
3033 0 : pSectionContext->SetEvenlySpaced( true );
3034 0 : pSectionContext->SetColumnCount( (sal_Int16) (pSectHdl->GetNum() - 1) );
3035 0 : pSectionContext->SetColumnDistance( pSectHdl->GetSpace() );
3036 0 : pSectionContext->SetSeparatorLine( pSectHdl->IsSeparator() );
3037 : }
3038 101 : else if( !pSectHdl->GetColumns().empty() )
3039 : {
3040 7 : pSectionContext->SetEvenlySpaced( false );
3041 7 : pSectionContext->SetColumnDistance( pSectHdl->GetSpace() );
3042 7 : pSectionContext->SetColumnCount( (sal_Int16)(pSectHdl->GetColumns().size() -1));
3043 7 : std::vector<_Column>::const_iterator tmpIter = pSectHdl->GetColumns().begin();
3044 16 : for (; tmpIter != pSectHdl->GetColumns().end(); ++tmpIter)
3045 : {
3046 9 : pSectionContext->AppendColumnWidth( tmpIter->nWidth );
3047 9 : if ((tmpIter != pSectHdl->GetColumns().end() - 1) || (tmpIter->nSpace > 0))
3048 2 : pSectionContext->AppendColumnSpacing( tmpIter->nSpace );
3049 : }
3050 7 : pSectionContext->SetSeparatorLine( pSectHdl->IsSeparator() );
3051 : }
3052 94 : else if( pSectHdl->GetNum() > 0 )
3053 : {
3054 1 : pSectionContext->SetColumnCount( (sal_Int16)pSectHdl->GetNum() - 1 );
3055 1 : pSectionContext->SetColumnDistance( pSectHdl->GetSpace() );
3056 : }
3057 101 : }
3058 101 : }
3059 : }
3060 101 : break;
3061 : case NS_ooxml::LN_EG_SectPrContents_docGrid:
3062 134 : resolveSprmProps(*this, rSprm);
3063 134 : break;
3064 : case NS_ooxml::LN_EG_SectPrContents_pgBorders:
3065 : {
3066 3 : writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
3067 3 : if( pProperties.get( ) && pSectionContext )
3068 : {
3069 3 : PageBordersHandlerPtr pHandler( new PageBordersHandler );
3070 3 : pProperties->resolve( *pHandler );
3071 :
3072 : // Set the borders to the context and apply them to the styles
3073 3 : pHandler->SetBorders( pSectionContext );
3074 3 : pSectionContext->SetBorderParams( pHandler->GetDisplayOffset( ) );
3075 3 : }
3076 : }
3077 3 : break;
3078 :
3079 : case NS_ooxml::LN_CT_PPrBase_pStyle:
3080 : {
3081 615 : m_pImpl->SetCurrentParaStyleId( sStringValue );
3082 615 : StyleSheetTablePtr pStyleTable = m_pImpl->GetStyleSheetTable();
3083 1230 : const OUString sConvertedStyleName = pStyleTable->ConvertStyleName( sStringValue, true );
3084 615 : if (m_pImpl->GetTopContext() && m_pImpl->GetTopContextType() != CONTEXT_SECTION)
3085 615 : m_pImpl->GetTopContext()->Insert( PROP_PARA_STYLE_NAME, uno::makeAny( sConvertedStyleName ));
3086 : //apply numbering to paragraph if it was set at the style, but only if the paragraph itself
3087 : //does not specify the numbering
3088 615 : if( rContext->find( PropertyDefinition( PROP_NUMBERING_RULES )) == rContext->end()) // !contains
3089 : {
3090 615 : const StyleSheetEntryPtr pEntry = pStyleTable->FindStyleSheetByISTD(sStringValue);
3091 : OSL_ENSURE( pEntry.get(), "no style sheet found" );
3092 615 : const StyleSheetPropertyMap* pStyleSheetProperties = dynamic_cast<const StyleSheetPropertyMap*>(pEntry ? pEntry->pProperties.get() : 0);
3093 :
3094 615 : if( pStyleSheetProperties && pStyleSheetProperties->GetListId() >= 0 )
3095 : {
3096 : rContext->Insert( PROP_NUMBERING_STYLE_NAME, uno::makeAny(
3097 9 : ListDef::GetStyleName( pStyleSheetProperties->GetListId( ) ) ), false);
3098 :
3099 : // We're inheriting properties from a numbering style. Make sure a possible right margin is inherited from the base style.
3100 9 : sal_Int32 nParaRightMargin = 0;
3101 9 : if (!pEntry->sBaseStyleIdentifier.isEmpty())
3102 : {
3103 9 : const StyleSheetEntryPtr pParent = pStyleTable->FindStyleSheetByISTD(pEntry->sBaseStyleIdentifier);
3104 9 : const StyleSheetPropertyMap* pParentProperties = dynamic_cast<const StyleSheetPropertyMap*>(pParent ? pParent->pProperties.get() : 0);
3105 9 : if (pParentProperties->find( PropertyDefinition( PROP_PARA_RIGHT_MARGIN )) != pParentProperties->end())
3106 1 : nParaRightMargin = pParentProperties->find( PropertyDefinition( PROP_PARA_RIGHT_MARGIN ))->second.get<sal_Int32>();
3107 : }
3108 9 : if (nParaRightMargin != 0)
3109 : {
3110 : // If we're setting the right margin, we should set the first / left margin as well from the numbering style.
3111 1 : sal_Int32 nFirstLineIndent = lcl_getCurrentNumberingProperty(m_pImpl->GetCurrentNumberingRules(), pStyleSheetProperties->GetListLevel(), "FirstLineIndent");
3112 1 : sal_Int32 nParaLeftMargin = lcl_getCurrentNumberingProperty(m_pImpl->GetCurrentNumberingRules(), pStyleSheetProperties->GetListLevel(), "IndentAt");
3113 1 : if (nFirstLineIndent != 0)
3114 1 : rContext->Insert(PROP_PARA_FIRST_LINE_INDENT, uno::makeAny(nFirstLineIndent));
3115 1 : if (nParaLeftMargin != 0)
3116 1 : rContext->Insert(PROP_PARA_LEFT_MARGIN, uno::makeAny(nParaLeftMargin));
3117 :
3118 1 : rContext->Insert(PROP_PARA_RIGHT_MARGIN, uno::makeAny(nParaRightMargin));
3119 : }
3120 : }
3121 :
3122 615 : if( pStyleSheetProperties && pStyleSheetProperties->GetListLevel() >= 0 )
3123 7 : rContext->Insert( PROP_NUMBERING_LEVEL, uno::makeAny(pStyleSheetProperties->GetListLevel()), false);
3124 615 : }
3125 : }
3126 615 : break;
3127 : case NS_ooxml::LN_EG_RPrBase_rStyle:
3128 : {
3129 24 : OUString sConvertedName( m_pImpl->GetStyleSheetTable()->ConvertStyleName( sStringValue, true ) );
3130 : // First check if the style exists in the document.
3131 48 : StyleSheetEntryPtr pEntry = m_pImpl->GetStyleSheetTable( )->FindStyleSheetByStyleName( sConvertedName );
3132 24 : bool bExists = pEntry.get( ) && ( pEntry->nStyleTypeCode == STYLE_TYPE_CHAR );
3133 :
3134 : // Add the property if the style exists
3135 24 : if ( bExists && m_pImpl->GetTopContext() )
3136 39 : m_pImpl->GetTopContext()->Insert( PROP_CHAR_STYLE_NAME, uno::makeAny( sConvertedName ) );
3137 : }
3138 24 : break;
3139 : case NS_ooxml::LN_CT_TblPrBase_tblCellMar: //cell margins
3140 : {
3141 0 : resolveSprmProps(*this, rSprm);//contains LN_CT_TblCellMar_top, LN_CT_TblCellMar_left, LN_CT_TblCellMar_bottom, LN_CT_TblCellMar_right
3142 : }
3143 0 : break;
3144 : case NS_ooxml::LN_CT_TblCellMar_top:
3145 : case NS_ooxml::LN_CT_TblCellMar_start:
3146 : case NS_ooxml::LN_CT_TblCellMar_left:
3147 : case NS_ooxml::LN_CT_TblCellMar_bottom:
3148 : case NS_ooxml::LN_CT_TblCellMar_end:
3149 : case NS_ooxml::LN_CT_TblCellMar_right:
3150 : {
3151 0 : writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
3152 0 : if( pProperties.get())
3153 : {
3154 0 : MeasureHandlerPtr pMeasureHandler( new MeasureHandler );
3155 0 : pProperties->resolve(*pMeasureHandler);
3156 0 : sal_Int32 nMeasureValue = pMeasureHandler->getMeasureValue();
3157 0 : PropertyIds eId = META_PROP_CELL_MAR_TOP;
3158 0 : bool rtl = false; // TODO
3159 0 : switch(nSprmId)
3160 : {
3161 : case NS_ooxml::LN_CT_TblCellMar_top:
3162 0 : break;
3163 : case NS_ooxml::LN_CT_TblCellMar_start:
3164 0 : eId = rtl ? META_PROP_CELL_MAR_RIGHT : META_PROP_CELL_MAR_LEFT;
3165 0 : break;
3166 : case NS_ooxml::LN_CT_TblCellMar_left:
3167 0 : eId = META_PROP_CELL_MAR_LEFT;
3168 0 : break;
3169 : case NS_ooxml::LN_CT_TblCellMar_bottom:
3170 0 : eId = META_PROP_CELL_MAR_BOTTOM;
3171 0 : break;
3172 : case NS_ooxml::LN_CT_TblCellMar_end:
3173 0 : eId = rtl ? META_PROP_CELL_MAR_LEFT : META_PROP_CELL_MAR_RIGHT;
3174 0 : break;
3175 : case NS_ooxml::LN_CT_TblCellMar_right:
3176 0 : eId = META_PROP_CELL_MAR_RIGHT;
3177 0 : break;
3178 : default:;
3179 : }
3180 0 : rContext->Insert( eId, uno::makeAny(nMeasureValue), false);
3181 0 : }
3182 : }
3183 0 : break;
3184 : case NS_sprm::LN_CFNoProof: //0x875 no grammar and spell checking, unsupported
3185 53 : break;
3186 : case NS_ooxml::LN_anchor_anchor: // at_character drawing
3187 : case NS_ooxml::LN_inline_inline: // as_character drawing
3188 : {
3189 28 : writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
3190 28 : if( pProperties.get())
3191 : {
3192 : GraphicImportType eGraphicType =
3193 : (NS_ooxml::LN_anchor_anchor ==
3194 28 : sal::static_int_cast<Id>(nSprmId)) ?
3195 : IMPORT_AS_DETECTED_ANCHOR :
3196 28 : IMPORT_AS_DETECTED_INLINE;
3197 : GraphicImportPtr pGraphicImport =
3198 28 : m_pImpl->GetGraphicImport(eGraphicType);
3199 28 : pProperties->resolve(*pGraphicImport);
3200 28 : m_pImpl->ImportGraphic(pProperties, eGraphicType);
3201 28 : if( !pGraphicImport->IsGraphic() )
3202 : {
3203 0 : m_pImpl->ResetGraphicImport();
3204 : // todo: It's a shape, now start shape import
3205 28 : }
3206 28 : }
3207 : }
3208 28 : break;
3209 : case NS_ooxml::LN_EG_RPrBase_vertAlign:
3210 : {
3211 42 : sal_Int16 nEscapement = 0;
3212 42 : sal_Int8 nProp = 58;
3213 42 : if ( sStringValue == "superscript" )
3214 39 : nEscapement = 101;
3215 3 : else if ( sStringValue == "subscript" )
3216 1 : nEscapement = -101;
3217 : else
3218 2 : nProp = 100;
3219 :
3220 42 : rContext->Insert(PROP_CHAR_ESCAPEMENT, uno::makeAny( nEscapement ) );
3221 42 : rContext->Insert(PROP_CHAR_ESCAPEMENT_HEIGHT, uno::makeAny( nProp ) );
3222 : }
3223 42 : break;
3224 : case NS_ooxml::LN_CT_FtnProps_pos:
3225 : //footnotes in word can be at page end or beneath text - writer supports only the first
3226 : //endnotes in word can be at section end or document end - writer supports only the latter
3227 : // -> so this property can be ignored
3228 2 : break;
3229 : case NS_ooxml::LN_EG_FtnEdnNumProps_numStart:
3230 : case NS_ooxml::LN_EG_FtnEdnNumProps_numRestart:
3231 : case NS_ooxml::LN_CT_FtnProps_numFmt:
3232 : case NS_ooxml::LN_CT_EdnProps_numFmt:
3233 : {
3234 : try
3235 : {
3236 790 : uno::Reference< beans::XPropertySet > xFtnEdnSettings;
3237 790 : if( m_pImpl->IsInFootnoteProperties() )
3238 : {
3239 470 : uno::Reference< text::XFootnotesSupplier> xFootnotesSupplier( m_pImpl->GetTextDocument(), uno::UNO_QUERY );
3240 470 : if (xFootnotesSupplier.is())
3241 326 : xFtnEdnSettings = xFootnotesSupplier->getFootnoteSettings();
3242 : }
3243 : else
3244 : {
3245 320 : uno::Reference< text::XEndnotesSupplier> xEndnotesSupplier( m_pImpl->GetTextDocument(), uno::UNO_QUERY );
3246 320 : if (xEndnotesSupplier.is())
3247 224 : xFtnEdnSettings = xEndnotesSupplier->getEndnoteSettings();
3248 : }
3249 790 : if( NS_ooxml::LN_EG_FtnEdnNumProps_numStart == nSprmId && xFtnEdnSettings.is())
3250 : {
3251 222 : xFtnEdnSettings->setPropertyValue(
3252 222 : PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_START_AT),
3253 444 : uno::makeAny( sal_Int16( nIntValue - 1 )));
3254 : }
3255 568 : else if( NS_ooxml::LN_EG_FtnEdnNumProps_numRestart == nSprmId && xFtnEdnSettings.is())
3256 : {
3257 104 : sal_Int16 nFootnoteCounting = 0;
3258 104 : switch (nIntValue)
3259 : {
3260 104 : case NS_ooxml::LN_Value_ST_RestartNumber_continuous: nFootnoteCounting = text::FootnoteNumbering::PER_DOCUMENT; break;
3261 0 : case NS_ooxml::LN_Value_ST_RestartNumber_eachPage: nFootnoteCounting = text::FootnoteNumbering::PER_PAGE; break;
3262 0 : case NS_ooxml::LN_Value_ST_RestartNumber_eachSect: nFootnoteCounting = text::FootnoteNumbering::PER_CHAPTER; break;
3263 0 : default: break;
3264 : }
3265 104 : xFtnEdnSettings->setPropertyValue(
3266 104 : PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_FOOTNOTE_COUNTING ),
3267 208 : uno::makeAny( nFootnoteCounting ));
3268 : }
3269 464 : else if (xFtnEdnSettings.is())
3270 : {
3271 224 : sal_Int16 nNumType = ConversionHelper::ConvertNumberingType( nIntValue );
3272 224 : xFtnEdnSettings->setPropertyValue(
3273 224 : PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_NUMBERING_TYPE),
3274 448 : uno::makeAny( nNumType ));
3275 790 : }
3276 : }
3277 0 : catch( const uno::Exception& )
3278 : {
3279 : }
3280 : }
3281 790 : break;
3282 : case NS_ooxml::LN_paratrackchange:
3283 0 : m_pImpl->StartParaChange( );
3284 : case NS_ooxml::LN_trackchange:
3285 : case NS_ooxml::LN_EG_RPrContent_rPrChange:
3286 : {
3287 9 : m_pImpl->AddNewRedline( );
3288 9 : resolveSprmProps(*this, rSprm );
3289 : // now the properties author, date and id should be available
3290 9 : sal_Int32 nToken = m_pImpl->GetCurrentRedlineToken();
3291 9 : switch( nToken & 0xffff )
3292 : {
3293 : case ooxml::OOXML_mod :
3294 : case ooxml::OOXML_ins :
3295 9 : case ooxml::OOXML_del : break;
3296 : default: OSL_FAIL( "redline token other than mod, ins or del" );
3297 : }
3298 9 : m_pImpl->EndParaChange( );
3299 : }
3300 9 : break;
3301 : case NS_ooxml::LN_CT_RPrChange_rPr:
3302 4 : break;
3303 : case NS_ooxml::LN_object:
3304 : {
3305 47 : writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
3306 47 : if( pProperties.get( ) )
3307 : {
3308 47 : OLEHandlerPtr pOLEHandler( new OLEHandler );
3309 47 : pProperties->resolve(*pOLEHandler);
3310 47 : if ( pOLEHandler->isOLEObject( ) )
3311 : {
3312 5 : OUString sStreamName = pOLEHandler->copyOLEOStream( m_pImpl->GetTextDocument() );
3313 5 : if( !sStreamName.isEmpty() )
3314 : {
3315 5 : m_pImpl->appendOLE( sStreamName, pOLEHandler );
3316 5 : }
3317 47 : }
3318 47 : }
3319 : }
3320 47 : break;
3321 : case NS_ooxml::LN_EG_HdrFtrReferences_headerReference: // header reference - not needed
3322 : case NS_ooxml::LN_EG_HdrFtrReferences_footerReference: // footer reference - not needed
3323 79 : break;
3324 : case NS_ooxml::LN_EG_RPrBase_snapToGrid: // "Use document grid settings for inter-paragraph spacing"
3325 0 : break;
3326 : case NS_sprm::LN_PContextualSpacing:
3327 291 : rContext->Insert(PROP_PARA_CONTEXT_MARGIN, uno::makeAny( sal_Bool( nIntValue ) ));
3328 291 : break;
3329 : case NS_ooxml::LN_EG_SectPrContents_formProt: //section protection, only form editing is enabled - unsupported
3330 : case NS_ooxml::LN_EG_SectPrContents_vAlign:
3331 : case NS_ooxml::LN_EG_RPrBase_fitText:
3332 120 : break;
3333 : case NS_ooxml::LN_ffdata:
3334 : {
3335 15 : writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
3336 15 : if (pProperties.get() != NULL)
3337 : {
3338 15 : FFDataHandler::Pointer_t pFFDataHandler(new FFDataHandler());
3339 :
3340 15 : pProperties->resolve(*pFFDataHandler);
3341 15 : m_pImpl->SetFieldFFData(pFFDataHandler);
3342 15 : }
3343 : }
3344 15 : break;
3345 : case NS_ooxml::LN_CT_SdtPr_dropDownList:
3346 : {
3347 1 : writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
3348 1 : if (pProperties.get() != NULL)
3349 1 : pProperties->resolve(*this);
3350 : }
3351 1 : break;
3352 : case NS_ooxml::LN_CT_SdtDropDownList_listItem:
3353 : {
3354 2 : writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
3355 2 : if (pProperties.get() != NULL)
3356 2 : pProperties->resolve(*this);
3357 : }
3358 2 : break;
3359 : case NS_ooxml::LN_CT_SdtPr_date:
3360 : {
3361 4 : writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
3362 4 : if (pProperties.get() != NULL)
3363 4 : pProperties->resolve(*this);
3364 : }
3365 4 : break;
3366 : case NS_ooxml::LN_CT_SdtDate_dateFormat:
3367 : {
3368 : // See com/sun/star/awt/UnoControlDateFieldModel.idl, DateFormat; sadly there are no constants for this.
3369 4 : if (sStringValue == "M/d/yyyy" || sStringValue == "M.d.yyyy")
3370 : // Approximate with MM.dd.yyy
3371 4 : m_pImpl->m_pSdtHelper->getDateFormat().reset(8);
3372 : else
3373 : {
3374 : // Set default format, so at least the date picker is created.
3375 0 : m_pImpl->m_pSdtHelper->getDateFormat().reset(0);
3376 : SAL_WARN("writerfilter", "unhandled w:dateFormat value");
3377 : }
3378 : }
3379 4 : break;
3380 : default:
3381 : {
3382 : #ifdef DEBUG_DOMAINMAPPER
3383 : dmapper_logger->startElement("unhandled");
3384 : dmapper_logger->attribute("id", nSprmId);
3385 : dmapper_logger->attribute("name", rSprm.getName());
3386 : dmapper_logger->endElement();
3387 : #endif
3388 : }
3389 32367 : }
3390 : }
3391 :
3392 14 : void DomainMapper::setInTableStyleRunProps(bool bInTableStyleRunProps)
3393 : {
3394 14 : m_pImpl->m_bInTableStyleRunProps = bInTableStyleRunProps;
3395 14 : }
3396 :
3397 4166 : void DomainMapper::processDeferredCharacterProperties( const std::map< sal_Int32, uno::Any >& deferredCharacterProperties )
3398 : {
3399 : assert( m_pImpl->GetTopContextType() == CONTEXT_CHARACTER );
3400 4166 : PropertyMapPtr rContext = m_pImpl->GetTopContext();
3401 26148 : for( std::map< sal_Int32, uno::Any >::const_iterator it = deferredCharacterProperties.begin();
3402 17432 : it != deferredCharacterProperties.end();
3403 : ++it )
3404 : {
3405 4550 : sal_Int32 Id = it->first;
3406 4550 : sal_Int32 nIntValue = 0;
3407 4550 : OUString sStringValue;
3408 4550 : it->second >>= nIntValue;
3409 4550 : it->second >>= sStringValue;
3410 4550 : switch( Id )
3411 : {
3412 : case NS_sprm::LN_CHps:
3413 : case NS_sprm::LN_CHpsBi:
3414 4545 : break; // only for use by other properties, ignore here
3415 : case NS_sprm::LN_CHpsPos:
3416 : {
3417 5 : sal_Int16 nEscapement = 0;
3418 5 : sal_Int8 nProp = 100;
3419 5 : if(nIntValue == 0)
3420 0 : nProp = 0;
3421 : else
3422 : {
3423 5 : std::map< sal_Int32, uno::Any >::const_iterator font = deferredCharacterProperties.find( NS_sprm::LN_CHps );
3424 5 : PropertyMapPtr pDefaultCharProps = m_pImpl->GetStyleSheetTable()->GetDefaultCharProps();
3425 5 : PropertyMap::iterator aDefaultFont = pDefaultCharProps->find(PropertyDefinition( PROP_CHAR_HEIGHT ));
3426 5 : if( font != deferredCharacterProperties.end())
3427 : {
3428 3 : double fontSize = 0;
3429 3 : font->second >>= fontSize;
3430 3 : nEscapement = nIntValue * 100 / fontSize;
3431 : }
3432 : // TODO if not direct formatting, check the style first, not directly the default char props.
3433 2 : else if (aDefaultFont != pDefaultCharProps->end())
3434 : {
3435 2 : double fHeight = 0;
3436 2 : aDefaultFont->second >>= fHeight;
3437 : // fHeight is in points, nIntValue is in half points, nEscapement is in percents.
3438 2 : nEscapement = nIntValue * 100 / fHeight / 2;
3439 : }
3440 : else
3441 : { // TODO: Find out the font size. The 58/-58 values were here previous, but I have
3442 : // no idea what they are (they are probably some random guess that did fit whatever
3443 : // specific case somebody was trying to fix).
3444 0 : nEscapement = ( nIntValue > 0 ) ? 58: -58;
3445 5 : }
3446 : }
3447 5 : rContext->Insert(PROP_CHAR_ESCAPEMENT, uno::makeAny( nEscapement ) );
3448 5 : rContext->Insert(PROP_CHAR_ESCAPEMENT_HEIGHT, uno::makeAny( nProp ) );
3449 : }
3450 5 : break; // sprmCHpsPos
3451 : default:
3452 : SAL_WARN( "writerfilter", "Unhandled property in processDeferredCharacterProperty()" );
3453 0 : break;
3454 : }
3455 8716 : }
3456 4166 : }
3457 :
3458 0 : void DomainMapper::lcl_entry(int /*pos*/,
3459 : writerfilter::Reference<Properties>::Pointer_t ref)
3460 : {
3461 0 : ref->resolve(*this);
3462 0 : }
3463 :
3464 0 : void DomainMapper::data(const sal_uInt8* /*buf*/, size_t /*len*/,
3465 : writerfilter::Reference<Properties>::Pointer_t /*ref*/)
3466 : {
3467 0 : }
3468 :
3469 375 : void DomainMapper::lcl_startSectionGroup()
3470 : {
3471 375 : m_pImpl->PushProperties(CONTEXT_SECTION);
3472 375 : }
3473 :
3474 373 : void DomainMapper::lcl_endSectionGroup()
3475 : {
3476 373 : m_pImpl->CheckUnregisteredFrameConversion();
3477 373 : m_pImpl->ExecuteFrameConversion();
3478 373 : PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_SECTION);
3479 373 : SectionPropertyMap* pSectionContext = dynamic_cast< SectionPropertyMap* >( pContext.get() );
3480 : OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
3481 373 : if(pSectionContext)
3482 373 : pSectionContext->CloseSectionGroup( *m_pImpl );
3483 373 : m_pImpl->PopProperties(CONTEXT_SECTION);
3484 373 : }
3485 :
3486 2307 : void DomainMapper::lcl_startParagraphGroup()
3487 : {
3488 2307 : m_pImpl->getTableManager().startParagraphGroup();
3489 2307 : m_pImpl->PushProperties(CONTEXT_PARAGRAPH);
3490 2307 : static OUString sDefault("Standard");
3491 2307 : if (m_pImpl->GetTopContext())
3492 : {
3493 2307 : if (!m_pImpl->IsInShape())
3494 : {
3495 2128 : m_pImpl->GetTopContext()->Insert( PROP_PARA_STYLE_NAME, uno::makeAny( sDefault ) );
3496 2128 : m_pImpl->SetCurrentParaStyleId(sDefault);
3497 : }
3498 2307 : if (m_pImpl->isBreakDeferred(PAGE_BREAK))
3499 64 : m_pImpl->GetTopContext()->Insert( PROP_BREAK_TYPE, uno::makeAny( com::sun::star::style::BreakType_PAGE_BEFORE) );
3500 2243 : else if (m_pImpl->isBreakDeferred(COLUMN_BREAK))
3501 0 : m_pImpl->GetTopContext()->Insert( PROP_BREAK_TYPE, uno::makeAny( com::sun::star::style::BreakType_COLUMN_BEFORE) );
3502 : }
3503 2307 : m_pImpl->clearDeferredBreaks();
3504 2307 : }
3505 :
3506 2226 : void DomainMapper::lcl_endParagraphGroup()
3507 : {
3508 2226 : m_pImpl->PopProperties(CONTEXT_PARAGRAPH);
3509 2226 : m_pImpl->getTableManager().endParagraphGroup();
3510 : //frame conversion has to be executed after table conversion
3511 2226 : m_pImpl->ExecuteFrameConversion();
3512 2226 : }
3513 :
3514 176 : void DomainMapper::markLastParagraphInSection( )
3515 : {
3516 176 : m_pImpl->SetIsLastParagraphInSection( true );
3517 176 : }
3518 :
3519 114 : void DomainMapper::lcl_startShape( uno::Reference< drawing::XShape > xShape )
3520 : {
3521 114 : if (m_pImpl->GetTopContext())
3522 : {
3523 : // If there is a deferred page break, handle it now, so that the
3524 : // started shape will be on the correct page.
3525 89 : if (m_pImpl->isBreakDeferred(PAGE_BREAK))
3526 : {
3527 0 : m_pImpl->clearDeferredBreak(PAGE_BREAK);
3528 0 : lcl_startCharacterGroup();
3529 0 : sal_uInt8 sBreak[] = { 0xd };
3530 0 : lcl_text(sBreak, 1);
3531 0 : lcl_endCharacterGroup();
3532 0 : lcl_endParagraphGroup();
3533 0 : lcl_startParagraphGroup();
3534 0 : m_pImpl->GetTopContext()->Insert(PROP_BREAK_TYPE, uno::makeAny( com::sun::star::style::BreakType_PAGE_BEFORE));
3535 : }
3536 89 : m_pImpl->PushShapeContext( xShape );
3537 89 : lcl_startParagraphGroup();
3538 : }
3539 : else
3540 : // No context? Then this image should not appear directly inside the
3541 : // document, just save it for later usage.
3542 25 : m_pImpl->PushPendingShape(xShape);
3543 114 : }
3544 :
3545 114 : void DomainMapper::lcl_endShape( )
3546 : {
3547 114 : if (m_pImpl->GetTopContext())
3548 : {
3549 89 : lcl_endParagraphGroup();
3550 89 : m_pImpl->PopShapeContext( );
3551 : }
3552 114 : }
3553 :
3554 5872 : void DomainMapper::PushStyleSheetProperties( PropertyMapPtr pStyleProperties, bool bAffectTableMngr )
3555 : {
3556 5872 : m_pImpl->PushStyleProperties( pStyleProperties );
3557 5872 : if ( bAffectTableMngr )
3558 68 : m_pImpl->getTableManager( ).SetStyleProperties( pStyleProperties );
3559 5872 : }
3560 :
3561 5872 : void DomainMapper::PopStyleSheetProperties( bool bAffectTableMngr )
3562 : {
3563 5872 : m_pImpl->PopProperties( CONTEXT_STYLESHEET );
3564 5872 : if ( bAffectTableMngr )
3565 : {
3566 68 : PropertyMapPtr emptyPtr;
3567 68 : m_pImpl->getTableManager( ).SetStyleProperties( emptyPtr );
3568 : }
3569 5872 : }
3570 :
3571 449 : void DomainMapper::PushListProperties( ::boost::shared_ptr<PropertyMap> pListProperties )
3572 : {
3573 449 : m_pImpl->PushListProperties( pListProperties );
3574 449 : }
3575 :
3576 449 : void DomainMapper::PopListProperties()
3577 : {
3578 449 : m_pImpl->PopProperties( CONTEXT_LIST );
3579 449 : }
3580 :
3581 6507 : void DomainMapper::lcl_startCharacterGroup()
3582 : {
3583 6507 : m_pImpl->PushProperties(CONTEXT_CHARACTER);
3584 6507 : }
3585 :
3586 6427 : void DomainMapper::lcl_endCharacterGroup()
3587 : {
3588 6427 : m_pImpl->PopProperties(CONTEXT_CHARACTER);
3589 6427 : }
3590 :
3591 920 : void DomainMapper::lcl_text(const sal_uInt8 * data_, size_t len)
3592 : {
3593 : //TODO: Determine the right text encoding (FIB?)
3594 920 : OUString sText( (const sal_Char*) data_, len, RTL_TEXTENCODING_MS_1252 );
3595 : #ifdef DEBUG_DOMAINMAPPER
3596 : dmapper_logger->startElement("text");
3597 : dmapper_logger->chars(sText);
3598 : dmapper_logger->endElement();
3599 : #endif
3600 :
3601 : try
3602 : {
3603 920 : if(len == 1)
3604 : {
3605 920 : switch(*data_)
3606 : {
3607 865 : case 0x02: return; //footnote character
3608 : case 0x0c: //page break
3609 69 : m_pImpl->deferBreak(PAGE_BREAK);
3610 69 : return;
3611 : case 0x0e: //column break
3612 0 : m_pImpl->deferBreak(COLUMN_BREAK);
3613 0 : return;
3614 : case 0x07:
3615 0 : m_pImpl->getTableManager().text(data_, len);
3616 : case 0x0d:
3617 719 : m_pImpl->finishParagraph(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH));
3618 719 : return;
3619 : case 0x13:
3620 27 : m_pImpl->PushFieldContext();
3621 27 : return;
3622 : case 0x14:
3623 : // delimiter not necessarily available
3624 : // appears only if field contains further content
3625 23 : m_pImpl->CloseFieldCommand();
3626 23 : return;
3627 : case 0x15: /* end of field */
3628 27 : m_pImpl->PopFieldContext();
3629 27 : return;
3630 : default:
3631 55 : break;
3632 : }
3633 : }
3634 :
3635 55 : PropertyMapPtr pContext = m_pImpl->GetTopContext();
3636 55 : if ( pContext && !pContext->GetFootnote().is() )
3637 : {
3638 55 : if (m_pImpl->isBreakDeferred(PAGE_BREAK))
3639 0 : m_pImpl->GetTopContext()->Insert( PROP_BREAK_TYPE, uno::makeAny( com::sun::star::style::BreakType_PAGE_BEFORE) );
3640 55 : else if (m_pImpl->isBreakDeferred(COLUMN_BREAK))
3641 0 : m_pImpl->GetTopContext()->Insert( PROP_BREAK_TYPE, uno::makeAny( com::sun::star::style::BreakType_COLUMN_BEFORE) );
3642 55 : m_pImpl->clearDeferredBreaks();
3643 : }
3644 :
3645 55 : if( pContext->GetFootnote().is() && m_pImpl->IsCustomFtnMark() )
3646 : {
3647 0 : pContext->GetFootnote()->setLabel( sText );
3648 0 : m_pImpl->SetCustomFtnMark( false );
3649 : //otherwise ignore sText
3650 : }
3651 55 : else if( m_pImpl->IsOpenFieldCommand() )
3652 0 : m_pImpl->AppendFieldCommand(sText);
3653 55 : else if( m_pImpl->IsOpenField() && m_pImpl->IsFieldResultAsString())
3654 : /*depending on the success of the field insert operation this result will be
3655 : set at the field or directly inserted into the text*/
3656 0 : m_pImpl->SetFieldResult( sText );
3657 : else
3658 : {
3659 55 : if (pContext == 0)
3660 0 : pContext.reset(new PropertyMap());
3661 :
3662 55 : m_pImpl->appendTextPortion( sText, pContext );
3663 55 : }
3664 : }
3665 0 : catch( const uno::RuntimeException& e )
3666 : {
3667 : SAL_WARN("writerfilter", "failed. Message :" << e.Message);
3668 55 : }
3669 : }
3670 :
3671 6144 : void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
3672 : {
3673 6144 : OUString sText;
3674 12283 : OUStringBuffer aBuffer = OUStringBuffer(len);
3675 6144 : aBuffer.append( (const sal_Unicode *) data_, len);
3676 6144 : sText = aBuffer.makeStringAndClear();
3677 :
3678 6144 : if (!m_pImpl->m_pSdtHelper->getDropDownItems().empty())
3679 : {
3680 1 : m_pImpl->m_pSdtHelper->getSdtTexts().append(sText);
3681 1 : return;
3682 : }
3683 6143 : else if (m_pImpl->m_pSdtHelper->getDateFormat())
3684 : {
3685 : /*
3686 : * Here we assume w:sdt only contains a single text token. We need to
3687 : * create the control early, as in Writer, it's part of the cell, but
3688 : * in OOXML, the sdt contains the cell.
3689 : */
3690 4 : m_pImpl->m_pSdtHelper->createDateControl(sText);
3691 4 : return;
3692 : }
3693 :
3694 : try
3695 : {
3696 6139 : m_pImpl->getTableManager().utext(data_, len);
3697 :
3698 6139 : if(len == 1 && (sText[0] == 0x0d || sText[0] == 0x07))
3699 : {
3700 1273 : PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH);
3701 1273 : if (pContext && m_pImpl->GetSettingsTable()->GetSplitPgBreakAndParaMark())
3702 : {
3703 23 : if (m_pImpl->isBreakDeferred(PAGE_BREAK))
3704 1 : pContext->Insert(PROP_BREAK_TYPE, uno::makeAny( com::sun::star::style::BreakType_PAGE_BEFORE));
3705 22 : else if (m_pImpl->isBreakDeferred(COLUMN_BREAK))
3706 0 : pContext->Insert(PROP_BREAK_TYPE, uno::makeAny( com::sun::star::style::BreakType_COLUMN_BEFORE));
3707 23 : m_pImpl->clearDeferredBreaks();
3708 : }
3709 :
3710 1273 : bool bSingleParagraph = m_pImpl->GetIsFirstParagraphInSection() && m_pImpl->GetIsLastParagraphInSection();
3711 : // If the paragraph contains only the section properties and it has
3712 : // no runs, we should not create a paragraph for it in Writer, unless that would remove the whole section.
3713 1273 : bool bRemove = !m_pImpl->GetParaChanged() && m_pImpl->GetParaSectpr() && !bSingleParagraph;
3714 1273 : m_pImpl->SetParaSectpr(false);
3715 1273 : m_pImpl->finishParagraph(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH));
3716 1273 : if (bRemove)
3717 9 : m_pImpl->RemoveLastParagraph();
3718 : }
3719 : else
3720 : {
3721 :
3722 4866 : PropertyMapPtr pContext = m_pImpl->GetTopContext();
3723 4866 : if ( pContext && !pContext->GetFootnote().is() )
3724 : {
3725 4866 : if (m_pImpl->isBreakDeferred(PAGE_BREAK))
3726 3 : m_pImpl->GetTopContext()->Insert( PROP_BREAK_TYPE, uno::makeAny( com::sun::star::style::BreakType_PAGE_BEFORE) );
3727 4863 : else if (m_pImpl->isBreakDeferred(COLUMN_BREAK))
3728 0 : m_pImpl->GetTopContext()->Insert( PROP_BREAK_TYPE, uno::makeAny( com::sun::star::style::BreakType_COLUMN_BEFORE) );
3729 4866 : m_pImpl->clearDeferredBreaks();
3730 : }
3731 :
3732 4866 : if( pContext && pContext->GetFootnote().is() )
3733 : {
3734 0 : if( !pContext->GetFootnoteSymbol() )
3735 0 : pContext->GetFootnote()->setLabel( sText );
3736 : //otherwise ignore sText
3737 : }
3738 4866 : else if( m_pImpl->IsOpenFieldCommand() )
3739 60 : m_pImpl->AppendFieldCommand(sText);
3740 4806 : else if( m_pImpl->IsOpenField() && m_pImpl->IsFieldResultAsString())
3741 : /*depending on the success of the field insert operation this result will be
3742 : set at the field or directly inserted into the text*/
3743 6 : m_pImpl->SetFieldResult( sText );
3744 : else
3745 : {
3746 4800 : if (pContext == 0)
3747 0 : pContext.reset(new PropertyMap());
3748 :
3749 4800 : m_pImpl->appendTextPortion( sText, pContext );
3750 4866 : }
3751 :
3752 : }
3753 : }
3754 0 : catch( const uno::RuntimeException& )
3755 : {
3756 6139 : }
3757 : }
3758 :
3759 11327 : void DomainMapper::lcl_props(writerfilter::Reference<Properties>::Pointer_t ref)
3760 : {
3761 11327 : string sType = ref->getType();
3762 11327 : if( sType == "PICF" )
3763 : {
3764 0 : m_pImpl->ImportGraphic(ref, IMPORT_AS_GRAPHIC);
3765 : }
3766 11327 : else if( sType == "FSPA" )
3767 : {
3768 0 : m_pImpl->ImportGraphic(ref, IMPORT_AS_SHAPE);
3769 : }
3770 : else
3771 11327 : ref->resolve(*this);
3772 11327 : }
3773 :
3774 937 : void DomainMapper::lcl_table(Id name, writerfilter::Reference<Table>::Pointer_t ref)
3775 : {
3776 937 : m_pImpl->SetAnyTableImport(true);
3777 937 : switch(name)
3778 : {
3779 : case NS_rtf::LN_FONTTABLE:
3780 :
3781 : // create a font table object that listens to the attributes
3782 : // each entry call inserts a new font entry
3783 238 : ref->resolve( *m_pImpl->GetFontTable() );
3784 238 : break;
3785 : case NS_rtf::LN_STYLESHEET:
3786 : //same as above to import style sheets
3787 226 : m_pImpl->SetStyleSheetImport( true );
3788 226 : ref->resolve( *m_pImpl->GetStyleSheetTable() );
3789 226 : m_pImpl->GetStyleSheetTable()->ApplyStyleSheets(m_pImpl->GetFontTable());
3790 226 : m_pImpl->SetStyleSheetImport( false );
3791 226 : break;
3792 : case NS_ooxml::LN_NUMBERING:
3793 : case NS_rtf::LN_LISTTABLE:
3794 : {
3795 :
3796 : //the same for list tables
3797 36 : ref->resolve( *m_pImpl->GetListTable() );
3798 36 : m_pImpl->GetListTable( )->CreateNumberingRules( );
3799 : }
3800 36 : break;
3801 : case NS_rtf::LN_LFOTABLE:
3802 : {
3803 0 : m_pImpl->GetListTable( )->SetLFOImport( true );
3804 0 : ref->resolve( *m_pImpl->GetListTable() );
3805 0 : m_pImpl->GetListTable( )->CreateNumberingRules( );
3806 0 : m_pImpl->GetListTable( )->SetLFOImport( false );
3807 : }
3808 0 : break;
3809 : case NS_ooxml::LN_THEMETABLE:
3810 91 : ref->resolve ( *m_pImpl->GetThemeTable() );
3811 91 : break;
3812 : case NS_ooxml::LN_settings_settings:
3813 346 : ref->resolve ( *m_pImpl->GetSettingsTable() );
3814 346 : m_pImpl->ApplySettingsTable();
3815 346 : break;
3816 : default:
3817 : OSL_FAIL( "which table is to be filled here?");
3818 : }
3819 937 : m_pImpl->SetAnyTableImport(false);
3820 937 : }
3821 :
3822 94 : void DomainMapper::lcl_substream(Id rName, ::writerfilter::Reference<Stream>::Pointer_t ref)
3823 : {
3824 94 : m_pImpl->appendTableManager( );
3825 : // Appending a TableManager resets its TableHandler, so we need to append
3826 : // that as well, or tables won't be imported properly in headers/footers.
3827 94 : m_pImpl->appendTableHandler( );
3828 94 : m_pImpl->getTableManager().startLevel();
3829 :
3830 : //import of page header/footer
3831 :
3832 94 : switch( rName )
3833 : {
3834 : case NS_rtf::LN_headerl:
3835 :
3836 8 : m_pImpl->PushPageHeader(SectionPropertyMap::PAGE_LEFT);
3837 8 : break;
3838 : case NS_rtf::LN_headerr:
3839 :
3840 26 : m_pImpl->PushPageHeader(SectionPropertyMap::PAGE_RIGHT);
3841 26 : break;
3842 : case NS_rtf::LN_headerf:
3843 :
3844 10 : m_pImpl->PushPageHeader(SectionPropertyMap::PAGE_FIRST);
3845 10 : break;
3846 : case NS_rtf::LN_footerl:
3847 :
3848 11 : m_pImpl->PushPageFooter(SectionPropertyMap::PAGE_LEFT);
3849 11 : break;
3850 : case NS_rtf::LN_footerr:
3851 :
3852 21 : m_pImpl->PushPageFooter(SectionPropertyMap::PAGE_RIGHT);
3853 21 : break;
3854 : case NS_rtf::LN_footerf:
3855 :
3856 9 : m_pImpl->PushPageFooter(SectionPropertyMap::PAGE_FIRST);
3857 9 : break;
3858 : case NS_rtf::LN_footnote:
3859 : case NS_rtf::LN_endnote:
3860 5 : m_pImpl->PushFootOrEndnote( NS_rtf::LN_footnote == rName );
3861 5 : break;
3862 : case NS_rtf::LN_annotation :
3863 4 : m_pImpl->PushAnnotation();
3864 4 : break;
3865 : }
3866 94 : ref->resolve(*this);
3867 94 : switch( rName )
3868 : {
3869 : case NS_rtf::LN_headerl:
3870 : case NS_rtf::LN_headerr:
3871 : case NS_rtf::LN_headerf:
3872 : case NS_rtf::LN_footerl:
3873 : case NS_rtf::LN_footerr:
3874 : case NS_rtf::LN_footerf:
3875 85 : m_pImpl->PopPageHeaderFooter();
3876 85 : break;
3877 : case NS_rtf::LN_footnote:
3878 : case NS_rtf::LN_endnote:
3879 5 : m_pImpl->PopFootOrEndnote();
3880 5 : break;
3881 : case NS_rtf::LN_annotation :
3882 4 : m_pImpl->PopAnnotation();
3883 4 : break;
3884 : }
3885 :
3886 94 : m_pImpl->getTableManager().endLevel();
3887 94 : m_pImpl->popTableManager( );
3888 94 : }
3889 :
3890 1302 : void DomainMapper::lcl_info(const string & /*info_*/)
3891 : {
3892 1302 : }
3893 :
3894 83 : void DomainMapper::handleUnderlineType(const sal_Int32 nIntValue, const ::boost::shared_ptr<PropertyMap> pContext)
3895 : {
3896 83 : sal_Int16 eUnderline = awt::FontUnderline::NONE;
3897 :
3898 83 : switch(nIntValue)
3899 : {
3900 15 : case 0: eUnderline = awt::FontUnderline::NONE; break;
3901 1 : case 2: pContext->Insert(PROP_CHAR_WORD_MODE, uno::makeAny( true ) ); // TODO: how to get rid of it?
3902 62 : case 1: eUnderline = awt::FontUnderline::SINGLE; break;
3903 1 : case 3: eUnderline = awt::FontUnderline::DOUBLE; break;
3904 1 : case 4: eUnderline = awt::FontUnderline::DOTTED; break;
3905 0 : case 7: eUnderline = awt::FontUnderline::DASH; break;
3906 0 : case 9: eUnderline = awt::FontUnderline::DASHDOT; break;
3907 0 : case 10:eUnderline = awt::FontUnderline::DASHDOTDOT; break;
3908 4 : case 6: eUnderline = awt::FontUnderline::BOLD; break;
3909 0 : case 11:eUnderline = awt::FontUnderline::WAVE; break;
3910 0 : case 20:eUnderline = awt::FontUnderline::BOLDDOTTED; break;
3911 0 : case 23:eUnderline = awt::FontUnderline::BOLDDASH; break;
3912 0 : case 39:eUnderline = awt::FontUnderline::LONGDASH; break;
3913 0 : case 55:eUnderline = awt::FontUnderline::BOLDLONGDASH; break;
3914 0 : case 25:eUnderline = awt::FontUnderline::BOLDDASHDOT; break;
3915 0 : case 26:eUnderline = awt::FontUnderline::BOLDDASHDOTDOT;break;
3916 0 : case 27:eUnderline = awt::FontUnderline::BOLDWAVE; break;
3917 0 : case 43:eUnderline = awt::FontUnderline::DOUBLEWAVE; break;
3918 : default: ;
3919 : }
3920 83 : pContext->Insert(PROP_CHAR_UNDERLINE, uno::makeAny( eUnderline ) );
3921 83 : }
3922 :
3923 350 : void DomainMapper::handleParaJustification(const sal_Int32 nIntValue, const ::boost::shared_ptr<PropertyMap> pContext, const bool bExchangeLeftRight)
3924 : {
3925 350 : sal_Int16 nAdjust = 0;
3926 350 : sal_Int16 nLastLineAdjust = 0;
3927 350 : switch(nIntValue)
3928 : {
3929 : case 1:
3930 80 : nAdjust = style::ParagraphAdjust_CENTER;
3931 80 : break;
3932 : case 2:
3933 27 : nAdjust = static_cast< sal_Int16 > (bExchangeLeftRight ? style::ParagraphAdjust_LEFT : style::ParagraphAdjust_RIGHT);
3934 27 : break;
3935 : case 4:
3936 0 : nLastLineAdjust = style::ParagraphAdjust_BLOCK;
3937 : //no break;
3938 : case 3:
3939 24 : nAdjust = style::ParagraphAdjust_BLOCK;
3940 24 : break;
3941 : case 0:
3942 : default:
3943 219 : nAdjust = static_cast< sal_Int16 > (bExchangeLeftRight ? style::ParagraphAdjust_RIGHT : style::ParagraphAdjust_LEFT);
3944 219 : break;
3945 : }
3946 350 : pContext->Insert( PROP_PARA_ADJUST, uno::makeAny( nAdjust ) );
3947 350 : pContext->Insert( PROP_PARA_LAST_LINE_ADJUST, uno::makeAny( nLastLineAdjust ) );
3948 350 : }
3949 :
3950 1 : bool DomainMapper::getColorFromIndex(const sal_Int32 nIndex, sal_Int32 &nColor)
3951 : {
3952 1 : nColor = 0;
3953 1 : if ((nIndex < 1) || (nIndex > 16))
3954 1 : return false;
3955 :
3956 0 : switch (nIndex)
3957 : {
3958 0 : case 1: nColor=0x000000; break; //black
3959 0 : case 2: nColor=0x0000ff; break; //blue
3960 0 : case 3: nColor=0x00ffff; break; //cyan
3961 0 : case 4: nColor=0x00ff00; break; //green
3962 0 : case 5: nColor=0xff00ff; break; //magenta
3963 0 : case 6: nColor=0xff0000; break; //red
3964 0 : case 7: nColor=0xffff00; break; //yellow
3965 0 : case 8: nColor=0xffffff; break; //white
3966 0 : case 9: nColor=0x000080; break;//dark blue
3967 0 : case 10: nColor=0x008080; break; //dark cyan
3968 0 : case 11: nColor=0x008000; break; //dark green
3969 0 : case 12: nColor=0x800080; break; //dark magenta
3970 0 : case 13: nColor=0x800000; break; //dark red
3971 0 : case 14: nColor=0x808000; break; //dark yellow
3972 0 : case 15: nColor=0x808080; break; //dark gray
3973 0 : case 16: nColor=0xC0C0C0; break; //light gray
3974 : default:
3975 0 : return false;
3976 : }
3977 0 : return true;
3978 : }
3979 :
3980 0 : sal_Int16 DomainMapper::getEmphasisValue(const sal_Int32 nIntValue)
3981 : {
3982 0 : switch (nIntValue)
3983 : {
3984 : case 1:
3985 0 : return com::sun::star::text::FontEmphasis::DOT_ABOVE;
3986 : case 2:
3987 0 : return com::sun::star::text::FontEmphasis::ACCENT_ABOVE;
3988 : case 3:
3989 0 : return com::sun::star::text::FontEmphasis::CIRCLE_ABOVE;
3990 : case 4:
3991 0 : return com::sun::star::text::FontEmphasis::DOT_BELOW;
3992 : default:
3993 0 : return com::sun::star::text::FontEmphasis::NONE;
3994 : }
3995 : }
3996 :
3997 0 : OUString DomainMapper::getBracketStringFromEnum(const sal_Int32 nIntValue, const bool bIsPrefix)
3998 : {
3999 0 : switch(nIntValue)
4000 : {
4001 : case 1:
4002 0 : if (bIsPrefix)
4003 0 : return OUString( "(" );
4004 0 : return OUString( ")" );
4005 :
4006 : case 2:
4007 0 : if (bIsPrefix)
4008 0 : return OUString( "[" );
4009 0 : return OUString( "]" );
4010 :
4011 : case 3:
4012 0 : if (bIsPrefix)
4013 0 : return OUString( "<" );
4014 0 : return OUString( ">" );
4015 :
4016 : case 4:
4017 0 : if (bIsPrefix)
4018 0 : return OUString( "{" );
4019 0 : return OUString( "}" );
4020 :
4021 : case 0:
4022 : default:
4023 0 : return OUString();
4024 : }
4025 : }
4026 :
4027 250 : com::sun::star::style::TabAlign DomainMapper::getTabAlignFromValue(const sal_Int32 nIntValue)
4028 : {
4029 250 : switch (nIntValue)
4030 : {
4031 : case 0:
4032 : case 4: // bar not supported
4033 : case 5: // num not supported
4034 79 : return com::sun::star::style::TabAlign_LEFT;
4035 : case 1:
4036 72 : return com::sun::star::style::TabAlign_CENTER;
4037 : case 2:
4038 97 : return com::sun::star::style::TabAlign_RIGHT;
4039 : case 3:
4040 1 : return com::sun::star::style::TabAlign_DECIMAL;
4041 : }
4042 1 : return com::sun::star::style::TabAlign_LEFT;
4043 : }
4044 :
4045 80 : sal_Unicode DomainMapper::getFillCharFromValue(const sal_Int32 nIntValue)
4046 : {
4047 80 : switch (nIntValue)
4048 : {
4049 : case 1: // dot
4050 19 : return sal_Unicode(0x002e);
4051 : case 2: // hyphen
4052 0 : return sal_Unicode(0x002d);
4053 : case 3: // underscore
4054 : case 4: // heavy FIXME ???
4055 0 : return sal_Unicode(0x005f);
4056 : case NS_ooxml::LN_Value_ST_TabTlc_middleDot: // middleDot
4057 0 : return sal_Unicode(0x00b7);
4058 : case 0: // none
4059 : default:
4060 61 : return sal_Unicode(0x0020); // blank space
4061 : }
4062 : }
4063 :
4064 2310 : bool DomainMapper::IsOOXMLImport() const
4065 : {
4066 2310 : return m_pImpl->IsOOXMLImport();
4067 : }
4068 :
4069 18 : bool DomainMapper::IsRTFImport() const
4070 : {
4071 18 : return m_pImpl->IsRTFImport();
4072 : }
4073 :
4074 90 : uno::Reference < lang::XMultiServiceFactory > DomainMapper::GetTextFactory() const
4075 : {
4076 90 : return m_pImpl->GetTextFactory();
4077 : }
4078 :
4079 2 : uno::Reference< text::XTextRange > DomainMapper::GetCurrentTextRange()
4080 : {
4081 2 : return m_pImpl->GetTopTextAppend()->getEnd();
4082 : }
4083 :
4084 267 : OUString DomainMapper::getOrCreateCharStyle( PropertyValueVector_t& rCharProperties )
4085 : {
4086 267 : StyleSheetTablePtr pStyleSheets = m_pImpl->GetStyleSheetTable();
4087 267 : return pStyleSheets->getOrCreateCharStyle( rCharProperties );
4088 : }
4089 :
4090 25 : StyleSheetTablePtr DomainMapper::GetStyleSheetTable( )
4091 : {
4092 25 : return m_pImpl->GetStyleSheetTable( );
4093 : }
4094 :
4095 47 : GraphicZOrderHelper* DomainMapper::graphicZOrderHelper()
4096 : {
4097 47 : if( zOrderHelper.get() == NULL )
4098 24 : zOrderHelper.reset( new GraphicZOrderHelper );
4099 47 : return zOrderHelper.get();
4100 : }
4101 :
4102 9 : uno::Reference<drawing::XShape> DomainMapper::PopPendingShape()
4103 : {
4104 9 : return m_pImpl->PopPendingShape();
4105 : }
4106 :
4107 9 : bool DomainMapper::IsInHeaderFooter() const
4108 : {
4109 9 : return m_pImpl->IsInHeaderFooter();
4110 : }
4111 :
4112 : } //namespace dmapper
4113 24 : } //namespace writerfilter
4114 :
4115 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|