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