1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #include "PageBordersHandler.hxx"
21 #include <resourcemodel/ResourceModelHelper.hxx>
22 #include <SdtHelper.hxx>
23 #include <DomainMapper_Impl.hxx>
24 #include <ConversionHelper.hxx>
25 #include <ModelEventListener.hxx>
26 #include <MeasureHandler.hxx>
27 #include <i18nlangtag/languagetag.hxx>
28 #include <i18nutil/paper.hxx>
29 #include <ooxml/OOXMLFastTokens.hxx>
30 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
31 #include <com/sun/star/document/XOOXMLDocumentPropertiesImporter.hpp>
32 #include <com/sun/star/text/HoriOrientation.hpp>
33 #include <com/sun/star/text/RelOrientation.hpp>
34 #include <com/sun/star/text/VertOrientation.hpp>
35 #include <com/sun/star/text/WrapTextMode.hpp>
36 #include <com/sun/star/text/SizeType.hpp>
37 #include <com/sun/star/text/XEndnotesSupplier.hpp>
38 #include <com/sun/star/text/XFootnotesSupplier.hpp>
39 #include <com/sun/star/text/XLineNumberingProperties.hpp>
40 #include <com/sun/star/awt/FontRelief.hpp>
41 #include <com/sun/star/awt/FontWeight.hpp>
42 #include <com/sun/star/awt/FontUnderline.hpp>
43 #include <com/sun/star/awt/FontStrikeout.hpp>
44 #include <com/sun/star/awt/FontSlant.hpp>
45 #include <com/sun/star/document/XEventBroadcaster.hpp>
46 #include <com/sun/star/style/ParagraphAdjust.hpp>
47 #include <com/sun/star/style/BreakType.hpp>
48 #include <com/sun/star/style/CaseMap.hpp>
49 #include <com/sun/star/style/LineSpacing.hpp>
50 #include <com/sun/star/style/LineSpacingMode.hpp>
51 #include <com/sun/star/text/FootnoteNumbering.hpp>
52 #include <com/sun/star/text/TextGridMode.hpp>
53 #include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
54 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
55 #include <com/sun/star/text/WritingMode.hpp>
56 #include <com/sun/star/text/WritingMode2.hpp>
57 #include <com/sun/star/text/XFootnote.hpp>
58 #include <comphelper/types.hxx>
59 #include <comphelper/storagehelper.hxx>
61 #include <CellColorHandler.hxx>
62 #include <SectionColumnHandler.hxx>
63 #include <GraphicHelpers.hxx>
65 using namespace ::com::sun::star
;
66 using namespace ::rtl
;
68 namespace writerfilter
{
70 using resourcemodel::resolveSprmProps
;
71 using resourcemodel::resolveAttributeProperties
;
75 TagLogger::Pointer_t
dmapper_logger(TagLogger::getInstance("DOMAINMAPPER"));
86 DomainMapper::DomainMapper( const uno::Reference
< uno::XComponentContext
>& xContext
,
87 uno::Reference
< io::XInputStream
> xInputStream
,
88 uno::Reference
< lang::XComponent
> xModel
,
90 SourceDocumentType eDocumentType
,
91 uno::Reference
< text::XTextRange
> xInsertTextRange
,
93 LoggedProperties(dmapper_logger
, "DomainMapper"),
94 LoggedTable(dmapper_logger
, "DomainMapper"),
95 LoggedStream(dmapper_logger
, "DomainMapper"),
96 m_pImpl( new DomainMapper_Impl( *this, xContext
, xModel
, eDocumentType
, xInsertTextRange
, bIsNewDoc
)),
97 mnBackgroundColor(0), mbIsHighlightSet(false)
99 // #i24363# tab stops relative to indent
100 m_pImpl
->SetDocumentSettingsProperty(
101 PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_TABS_RELATIVE_TO_INDENT
),
102 uno::makeAny( false ) );
104 //import document properties
107 uno::Reference
< embed::XStorage
> xDocumentStorage
=
108 (comphelper::OStorageHelper::GetStorageOfFormatFromInputStream(OFOPXML_STORAGE_FORMAT_STRING
, xInputStream
, xContext
, bRepairStorage
));
110 uno::Reference
< uno::XInterface
> xTemp
= xContext
->getServiceManager()->createInstanceWithContext(
111 "com.sun.star.document.OOXMLDocumentPropertiesImporter",
114 uno::Reference
< document::XOOXMLDocumentPropertiesImporter
> xImporter( xTemp
, uno::UNO_QUERY_THROW
);
115 uno::Reference
< document::XDocumentPropertiesSupplier
> xPropSupplier( xModel
, uno::UNO_QUERY_THROW
);
116 xImporter
->importProperties( xDocumentStorage
, xPropSupplier
->getDocumentProperties() );
118 catch( const uno::Exception
& rEx
)
124 DomainMapper::~DomainMapper()
128 uno::Reference
< text::XDocumentIndexesSupplier
> xIndexesSupplier( m_pImpl
->GetTextDocument(), uno::UNO_QUERY
);
129 sal_Int32 nIndexes
= 0;
130 if( xIndexesSupplier
.is() )
132 uno::Reference
< container::XIndexAccess
> xIndexes
= xIndexesSupplier
->getDocumentIndexes();
133 nIndexes
= xIndexes
->getCount();
135 // If we have page references, those need updating as well, similar to the indexes.
136 uno::Reference
<text::XTextFieldsSupplier
> xTextFieldsSupplier(m_pImpl
->GetTextDocument(), uno::UNO_QUERY
);
137 if(xTextFieldsSupplier
.is())
139 uno::Reference
<container::XEnumeration
> xEnumeration
= xTextFieldsSupplier
->getTextFields()->createEnumeration();
140 while(xEnumeration
->hasMoreElements())
143 xEnumeration
->nextElement();
146 if( nIndexes
|| m_pImpl
->m_pSdtHelper
->hasElements())
148 //index update has to wait until first view is created
149 uno::Reference
< document::XEventBroadcaster
> xBroadcaster(xIndexesSupplier
, uno::UNO_QUERY
);
150 if (xBroadcaster
.is())
151 xBroadcaster
->addEventListener(uno::Reference
< document::XEventListener
>(new ModelEventListener(nIndexes
, m_pImpl
->m_pSdtHelper
->hasElements())));
155 // Apply the document settings after everything else
156 m_pImpl
->GetSettingsTable()->ApplyProperties( m_pImpl
->GetTextDocument( ) );
158 catch( const uno::Exception
& rEx
)
166 void DomainMapper::lcl_attribute(Id nName
, Value
& val
)
168 static OUString sLocalBookmarkName
;
169 sal_Int32 nIntValue
= val
.getInt();
170 OUString sStringValue
= val
.getString();
172 SectionPropertyMap
* pSectionContext
= m_pImpl
->GetSectionContext();
174 if( nName
>= NS_rtf::LN_WIDENT
&& nName
<= NS_rtf::LN_LCBSTTBFUSSR
)
175 m_pImpl
->GetFIB().SetData( nName
, nIntValue
);
182 /* attributes to be ignored */
183 case NS_rtf::LN_UNUSED1_3
:
184 case NS_rtf::LN_UNUSED1_7
:
185 case NS_rtf::LN_UNUSED8_3
:
186 case NS_rtf::LN_FWRITERESERVATION
:
187 case NS_rtf::LN_FLOADOVERRIDE
:
188 case NS_rtf::LN_FFAREAST
:
189 case NS_rtf::LN_FCRYPTO
:
190 case NS_rtf::LN_NFIBBACK
:
191 case NS_rtf::LN_LKEY
:
192 case NS_rtf::LN_ENVR
:
193 case NS_rtf::LN_FMAC
:
194 case NS_rtf::LN_FWORD97SAVED
:
195 case NS_rtf::LN_FCMAC
:
196 case NS_rtf::LN_PNFBPCHPFIRST_W6
:
197 case NS_rtf::LN_PNCHPFIRST_W6
:
198 case NS_rtf::LN_CPNBTECHP_W6
:
199 case NS_rtf::LN_PNFBPPAPFIRST_W6
:
200 case NS_rtf::LN_PNPAPFIRST_W6
:
201 case NS_rtf::LN_CPNBTEPAP_W6
:
202 case NS_rtf::LN_PNFBPLVCFIRST_W6
:
203 case NS_rtf::LN_PNLVCFIRST_W6
:
204 case NS_rtf::LN_CPNBTELVC_W6
:
205 case NS_rtf::LN_CBMAC
:
206 case NS_rtf::LN_LPRODUCTCREATED
:
207 case NS_rtf::LN_LPRODUCTREVISED
:
208 case NS_rtf::LN_CCPMCR
:
209 case NS_rtf::LN_PNFBPCHPFIRST
:
210 case NS_rtf::LN_PNFBPPAPFIRST
:
211 case NS_rtf::LN_PNFBPLVCFIRST
:
212 case NS_rtf::LN_FCISLANDFIRST
:
213 case NS_rtf::LN_FCISLANDLIM
:
214 case NS_rtf::LN_FCSTSHFORIG
:
215 case NS_rtf::LN_LCBSTSHFORIG
:
216 case NS_rtf::LN_FCPLCFPAD
:
217 case NS_rtf::LN_LCBPLCFPAD
:
218 case NS_rtf::LN_FCSTTBFGLSY
:
219 case NS_rtf::LN_LCBSTTBFGLSY
:
220 case NS_rtf::LN_FCPLCFGLSY
:
221 case NS_rtf::LN_LCBPLCFGLSY
:
222 case NS_rtf::LN_FCPLCFSEA
:
223 case NS_rtf::LN_LCBPLCFSEA
:
224 case NS_rtf::LN_FCPLCFFLDMCR
:
225 case NS_rtf::LN_LCBPLCFFLDMCR
:
226 case NS_rtf::LN_FCCMDS
:
227 case NS_rtf::LN_LCBCMDS
:
228 case NS_rtf::LN_FCPLCMCR
:
229 case NS_rtf::LN_LCBPLCMCR
:
230 case NS_rtf::LN_FCSTTBFMCR
:
231 case NS_rtf::LN_LCBSTTBFMCR
:
232 case NS_rtf::LN_FCPRDRVR
:
233 case NS_rtf::LN_LCBPRDRVR
:
234 case NS_rtf::LN_FCPRENVPORT
:
235 case NS_rtf::LN_LCBPRENVPORT
:
236 case NS_rtf::LN_FCPRENVLAND
:
237 case NS_rtf::LN_LCBPRENVLAND
:
238 case NS_rtf::LN_FCWSS
:
239 case NS_rtf::LN_LCBWSS
:
240 case NS_rtf::LN_FCPLCFPGDFTN
:
241 case NS_rtf::LN_LCBPLCFPGDFTN
:
242 case NS_rtf::LN_FCAUTOSAVESOURCE
:
243 case NS_rtf::LN_LCBAUTOSAVESOURCE
:
244 case NS_rtf::LN_FCPLCDOAMOM
:
245 case NS_rtf::LN_LCBPLCDOAMOM
:
246 case NS_rtf::LN_FCPLCDOAHDR
:
247 case NS_rtf::LN_LCBPLCDOAHDR
:
248 case NS_rtf::LN_FCPMS
:
249 case NS_rtf::LN_LCBPMS
:
250 case NS_rtf::LN_FCPLCFPGDEDN
:
251 case NS_rtf::LN_LCBPLCFPGDEDN
:
252 case NS_rtf::LN_FCPLCFWKB
:
253 case NS_rtf::LN_LCBPLCFWKB
:
254 case NS_rtf::LN_FCPLCFSPL
:
255 case NS_rtf::LN_LCBPLCFSPL
:
256 case NS_rtf::LN_FCSTWUSER
:
257 case NS_rtf::LN_LCBSTWUSER
:
258 case NS_rtf::LN_FCUNUSED
:
259 case NS_rtf::LN_LCBUNUSED
:
260 case NS_rtf::LN_FCSTTBFINTLFLD
:
261 case NS_rtf::LN_LCBSTTBFINTLFLD
:
262 case NS_rtf::LN_FCROUTESLIP
:
263 case NS_rtf::LN_LCBROUTESLIP
:
264 case NS_rtf::LN_FCSTTBSAVEDBY
:
265 case NS_rtf::LN_LCBSTTBSAVEDBY
:
266 case NS_rtf::LN_FCSTTBFNM
:
267 case NS_rtf::LN_LCBSTTBFNM
:
268 case NS_rtf::LN_FCDOCUNDO
:
269 case NS_rtf::LN_LCBDOCUNDO
:
270 case NS_rtf::LN_FCRGBUSE
:
271 case NS_rtf::LN_LCBRGBUSE
:
272 case NS_rtf::LN_FCUSP
:
273 case NS_rtf::LN_LCBUSP
:
274 case NS_rtf::LN_FCUSKF
:
275 case NS_rtf::LN_LCBUSKF
:
276 case NS_rtf::LN_FCPLCUPCRGBUSE
:
277 case NS_rtf::LN_LCBPLCUPCRGBUSE
:
278 case NS_rtf::LN_FCPLCUPCUSP
:
279 case NS_rtf::LN_LCBPLCUPCUSP
:
280 case NS_rtf::LN_FCPLGOSL
:
281 case NS_rtf::LN_LCBPLGOSL
:
282 case NS_rtf::LN_FCPLCOCX
:
283 case NS_rtf::LN_LCBPLCOCX
:
284 case NS_rtf::LN_DWLOWDATETIME
:
285 case NS_rtf::LN_DWHIGHDATETIME
:
286 case NS_rtf::LN_FCPLCASUMY
:
287 case NS_rtf::LN_LCBPLCASUMY
:
288 case NS_rtf::LN_FCPLCFGRAM
:
289 case NS_rtf::LN_LCBPLCFGRAM
:
290 case NS_rtf::LN_FCSTTBFUSSR
:
293 case NS_rtf::LN_ISTD
: //index of applied style
295 //search for the style with the given id and apply it
296 //as CharStyleName or ParaStyleName
297 //if the style is a user defined style then it must have an ISTD - built-in styles might not have it
298 StyleSheetTablePtr pStyleSheets
= m_pImpl
->GetStyleSheetTable();
299 OUString sValue
= OUString::valueOf(nIntValue
, 16);
300 const StyleSheetEntryPtr pEntry
= pStyleSheets
->FindStyleSheetByISTD(sValue
);
303 bool bParaStyle
= (pEntry
->nStyleTypeCode
== STYLE_TYPE_PARA
);
305 m_pImpl
->SetCurrentParaStyleId(OUString::valueOf(static_cast<sal_Int32
>(nIntValue
), 16));
306 if (m_pImpl
->GetTopContext() && m_pImpl
->GetTopContextType() != CONTEXT_SECTION
)
307 m_pImpl
->GetTopContext()->Insert(
309 PROP_PARA_STYLE_NAME
: PROP_CHAR_STYLE_NAME
,
312 m_pImpl
->GetStyleSheetTable()->ConvertStyleName( pEntry
->sStyleName
) ) );
316 case NS_rtf::LN_ISTARTAT
:
320 case NS_rtf::LN_FLEGAL
:
322 case NS_rtf::LN_FNORESTART
:
324 case NS_rtf::LN_FIDENTSAV
:
326 case NS_rtf::LN_FCONVERTED
:
328 case NS_rtf::LN_FTENTATIVE
:
330 case NS_rtf::LN_RGBXCHNUMS
:
332 case NS_rtf::LN_IXCHFOLLOW
:
334 case NS_rtf::LN_DXASPACE
:
336 case NS_rtf::LN_DXAINDENT
:
338 case NS_rtf::LN_CBGRPPRLCHPX
:
340 case NS_rtf::LN_CBGRPPRLPAPX
:
342 case NS_rtf::LN_LSID
:
344 case NS_rtf::LN_TPLC
:
346 case NS_rtf::LN_RGISTD
:
348 case NS_rtf::LN_FSIMPLELIST
:
350 case NS_rtf::LN_fAutoNum
:
352 case NS_rtf::LN_fHybrid
:
354 case NS_rtf::LN_ILVL
:
356 case NS_rtf::LN_FSTARTAT
:
358 case NS_rtf::LN_FFORMATTING
:
360 case NS_rtf::LN_UNSIGNED4_6
:
362 case NS_rtf::LN_clfolvl
:
364 case NS_rtf::LN_CBFFNM1
:
368 case NS_rtf::LN_FTRUETYPE
:
372 case NS_rtf::LN_WWEIGHT
:
377 m_pImpl
->GetFIB().SetLNCHS( nIntValue
);
380 case NS_rtf::LN_IXCHSZALT
:
382 case NS_rtf::LN_PANOSE
:
388 case NS_rtf::LN_FSCRATCH
:
390 case NS_rtf::LN_FINVALHEIGHT
:
392 case NS_rtf::LN_FHASUPE
:
394 case NS_rtf::LN_FMASSCOPY
:
398 case NS_rtf::LN_ISTDBASE
:
400 case NS_rtf::LN_CUPX
:
402 case NS_rtf::LN_ISTDNEXT
:
404 case NS_rtf::LN_BCHUPE
:
406 case NS_rtf::LN_FAUTOREDEF
:
408 case NS_rtf::LN_FHIDDEN
:
410 case NS_rtf::LN_CSTD
:
412 case NS_rtf::LN_CBSTDBASEINFILE
:
414 case NS_rtf::LN_FSTDSTYLENAMESWRITTEN
:
416 case NS_rtf::LN_UNUSED4_2
:
418 case NS_rtf::LN_STIMAXWHENSAVED
:
420 case NS_rtf::LN_ISTDMAXFIXEDWHENSAVED
:
422 case NS_rtf::LN_NVERBUILTINNAMESWHENSAVED
:
424 case NS_rtf::LN_RGFTCSTANDARDCHPSTSH
:
426 case NS_rtf::LN_WIDENT
:
428 case NS_rtf::LN_NFIB
:
430 case NS_rtf::LN_NPRODUCT
:
432 case NS_rtf::LN_PNNEXT
:
433 case NS_rtf::LN_FDOT
:
434 case NS_rtf::LN_FGLSY
:
435 case NS_rtf::LN_FCOMPLEX
:
436 case NS_rtf::LN_FHASPIC
:
437 case NS_rtf::LN_CQUICKSAVES
:
438 case NS_rtf::LN_FENCRYPTED
:
439 case NS_rtf::LN_FWHICHTBLSTM
:
440 case NS_rtf::LN_FREADONLYRECOMMENDED
:
441 case NS_rtf::LN_FEXTCHAR
:
442 case NS_rtf::LN_FEMPTYSPECIAL
:
443 case NS_rtf::LN_FLOADOVERRIDEPAGE
:
444 case NS_rtf::LN_FFUTURESAVEDUNDO
:
445 case NS_rtf::LN_FSPARE0
:
446 case NS_rtf::LN_CHSTABLES
:
447 case NS_rtf::LN_FCMIN
:
449 case NS_rtf::LN_WMAGICCREATED
:
450 case NS_rtf::LN_WMAGICREVISED
:
451 case NS_rtf::LN_WMAGICCREATEDPRIVATE
:
452 case NS_rtf::LN_WMAGICREVISEDPRIVATE
:
453 case NS_rtf::LN_LIDFE
:
455 case NS_rtf::LN_CCPTEXT
:
456 case NS_rtf::LN_CCPFTN
:
457 case NS_rtf::LN_CCPHDD
:
458 case NS_rtf::LN_CCPATN
:
459 case NS_rtf::LN_CCPEDN
:
460 case NS_rtf::LN_CCPTXBX
:
461 case NS_rtf::LN_CCPHDRTXBX
:
462 case NS_rtf::LN_PNCHPFIRST
:
463 case NS_rtf::LN_CPNBTECHP
:
464 case NS_rtf::LN_PNPAPFIRST
:
465 case NS_rtf::LN_CPNBTEPAP
:
466 case NS_rtf::LN_PNLVCFIRST
:
467 case NS_rtf::LN_CPNBTELVC
:
468 case NS_rtf::LN_CFCLCB
:
469 case NS_rtf::LN_FCSTSHF
:
470 case NS_rtf::LN_LCBSTSHF
:
471 case NS_rtf::LN_FCPLCFFNDREF
:
472 case NS_rtf::LN_LCBPLCFFNDREF
:
473 case NS_rtf::LN_FCPLCFFNDTXT
:
474 case NS_rtf::LN_LCBPLCFFNDTXT
:
475 case NS_rtf::LN_FCPLCFANDREF
:
476 case NS_rtf::LN_LCBPLCFANDREF
:
477 case NS_rtf::LN_FCPLCFANDTXT
:
478 case NS_rtf::LN_LCBPLCFANDTXT
:
479 case NS_rtf::LN_FCPLCFSED
:
480 case NS_rtf::LN_LCBPLCFSED
:
481 case NS_rtf::LN_FCPLCFPHE
:
482 case NS_rtf::LN_LCBPLCFPHE
:
483 case NS_rtf::LN_FCPLCFHDD
:
484 case NS_rtf::LN_LCBPLCFHDD
:
485 case NS_rtf::LN_FCPLCFBTECHPX
:
486 case NS_rtf::LN_LCBPLCFBTECHPX
:
487 case NS_rtf::LN_FCPLCFBTEPAPX
:
488 case NS_rtf::LN_LCBPLCFBTEPAPX
:
489 case NS_rtf::LN_FCSTTBFFFN
:
490 case NS_rtf::LN_LCBSTTBFFFN
:
491 case NS_rtf::LN_FCPLCFFLDMOM
:
492 case NS_rtf::LN_LCBPLCFFLDMOM
:
493 case NS_rtf::LN_FCPLCFFLDHDR
:
494 case NS_rtf::LN_LCBPLCFFLDHDR
:
495 case NS_rtf::LN_FCPLCFFLDFTN
:
496 case NS_rtf::LN_LCBPLCFFLDFTN
:
497 case NS_rtf::LN_FCPLCFFLDATN
:
498 case NS_rtf::LN_LCBPLCFFLDATN
:
499 case NS_rtf::LN_FCSTTBFBKMK
:
500 case NS_rtf::LN_LCBSTTBFBKMK
:
501 case NS_rtf::LN_FCPLCFBKF
:
502 case NS_rtf::LN_LCBPLCFBKF
:
503 case NS_rtf::LN_FCPLCFBKL
:
504 case NS_rtf::LN_LCBPLCFBKL
:
505 case NS_rtf::LN_FCDOP
:
506 case NS_rtf::LN_LCBDOP
:
507 case NS_rtf::LN_FCSTTBFASSOC
:
508 case NS_rtf::LN_LCBSTTBFASSOC
:
509 case NS_rtf::LN_FCCLX
:
510 case NS_rtf::LN_LCBCLX
:
511 case NS_rtf::LN_FCGRPXSTATNOWNERS
:
512 case NS_rtf::LN_LCBGRPXSTATNOWNERS
:
513 case NS_rtf::LN_FCSTTBFATNBKMK
:
514 case NS_rtf::LN_LCBSTTBFATNBKMK
:
515 case NS_rtf::LN_FCPLCSPAMOM
:
516 case NS_rtf::LN_LCBPLCSPAMOM
:
517 case NS_rtf::LN_FCPLCSPAHDR
:
518 case NS_rtf::LN_LCBPLCSPAHDR
:
519 case NS_rtf::LN_FCPLCFATNBKF
:
520 case NS_rtf::LN_LCBPLCFATNBKF
:
521 case NS_rtf::LN_FCPLCFATNBKL
:
522 case NS_rtf::LN_LCBPLCFATNBKL
:
523 case NS_rtf::LN_FCFORMFLDSTTBF
:
524 case NS_rtf::LN_LCBFORMFLDSTTBF
:
525 case NS_rtf::LN_FCPLCFENDREF
:
526 case NS_rtf::LN_LCBPLCFENDREF
:
527 case NS_rtf::LN_FCPLCFENDTXT
:
528 case NS_rtf::LN_LCBPLCFENDTXT
:
529 case NS_rtf::LN_FCPLCFFLDEDN
:
530 case NS_rtf::LN_LCBPLCFFLDEDN
:
531 case NS_rtf::LN_FCDGGINFO
:
532 case NS_rtf::LN_LCBDGGINFO
:
533 case NS_rtf::LN_FCSTTBFRMARK
:
534 case NS_rtf::LN_LCBSTTBFRMARK
:
535 case NS_rtf::LN_FCSTTBFCAPTION
:
536 case NS_rtf::LN_LCBSTTBFCAPTION
:
537 case NS_rtf::LN_FCSTTBFAUTOCAPTION
:
538 case NS_rtf::LN_LCBSTTBFAUTOCAPTION
:
539 case NS_rtf::LN_LCBPLCFTXBXTXT
:
540 case NS_rtf::LN_FCPLCFFLDTXBX
:
541 case NS_rtf::LN_LCBPLCFFLDTXBX
:
542 case NS_rtf::LN_FCPLCFHDRTXBXTXT
:
543 case NS_rtf::LN_LCBPLCFHDRTXBXTXT
:
544 case NS_rtf::LN_FCPLCFFLDHDRTXBX
:
545 case NS_rtf::LN_LCBPLCFFLDHDRTXBX
:
546 case NS_rtf::LN_FCSTTBTTMBD
:
547 case NS_rtf::LN_LCBSTTBTTMBD
:
548 case NS_rtf::LN_FCPGDMOTHER
:
549 case NS_rtf::LN_LCBPGDMOTHER
:
550 case NS_rtf::LN_FCBKDMOTHER
:
551 case NS_rtf::LN_LCBBKDMOTHER
:
552 case NS_rtf::LN_FCPGDFTN
:
553 case NS_rtf::LN_LCBPGDFTN
:
554 case NS_rtf::LN_FCBKDFTN
:
555 case NS_rtf::LN_LCBBKDFTN
:
556 case NS_rtf::LN_FCPGDEDN
:
557 case NS_rtf::LN_LCBPGDEDN
:
558 case NS_rtf::LN_FCBKDEDN
:
559 case NS_rtf::LN_LCBBKDEDN
:
560 case NS_rtf::LN_FCPLCFLST
:
561 case NS_rtf::LN_LCBPLCFLST
:
562 case NS_rtf::LN_FCPLFLFO
:
563 case NS_rtf::LN_LCBPLFLFO
:
564 case NS_rtf::LN_FCPLCFTXBXBKD
:
565 case NS_rtf::LN_LCBPLCFTXBXBKD
:
566 case NS_rtf::LN_FCPLCFTXBXHDRBKD
:
567 case NS_rtf::LN_LCBPLCFTXBXHDRBKD
:
568 case NS_rtf::LN_FCSTTBGLSYSTYLE
:
569 case NS_rtf::LN_LCBSTTBGLSYSTYLE
:
570 case NS_rtf::LN_FCPLCFBTELVC
:
571 case NS_rtf::LN_LCBPLCFBTELVC
:
572 case NS_rtf::LN_FCPLCFLVC
:
573 case NS_rtf::LN_LCBPLCFLVC
:
574 case NS_rtf::LN_FCSTTBLISTNAMES
:
575 case NS_rtf::LN_LCBSTTBLISTNAMES
:
576 case NS_rtf::LN_LCBSTTBFUSSR
:
578 m_pImpl
->GetFIB().SetData( nName
, nIntValue
);
582 case NS_rtf::LN_FCSEPX
:
583 case NS_rtf::LN_FNMPR
:
584 case NS_rtf::LN_FCMPR
:
586 //section descriptor, unused or internally used
588 case NS_rtf::LN_ICOFORE
:
590 case NS_rtf::LN_ICOBACK
:
592 case NS_rtf::LN_IPAT
:
594 case NS_rtf::LN_SHDFORECOLOR
:
596 case NS_rtf::LN_SHDBACKCOLOR
:
598 case NS_rtf::LN_SHDPATTERN
:
600 case NS_rtf::LN_DPTLINEWIDTH
:
602 case NS_rtf::LN_BRCTYPE
:
606 case NS_rtf::LN_DPTSPACE
:
608 case NS_rtf::LN_FSHADOW
:
610 case NS_rtf::LN_FFRAME
:
612 case NS_rtf::LN_UNUSED2_15
:
614 case NS_rtf::LN_FFIRSTMERGED
:
616 case NS_rtf::LN_FMERGED
:
618 case NS_rtf::LN_FVERTICAL
:
620 case NS_rtf::LN_FBACKWARD
:
622 case NS_rtf::LN_FROTATEFONT
:
624 case NS_rtf::LN_FVERTMERGE
:
626 case NS_rtf::LN_FVERTRESTART
:
628 case NS_rtf::LN_VERTALIGN
:
630 case NS_rtf::LN_FUNUSED
:
632 case NS_rtf::LN_BRCTOP
:
633 case NS_rtf::LN_BRCLEFT
:
634 case NS_rtf::LN_BRCBOTTOM
:
635 case NS_rtf::LN_BRCRIGHT
:
637 table::BorderLine2 aBorderLine
;
638 sal_Int32 nLineDistance
= ConversionHelper::MakeBorderLine( nIntValue
, aBorderLine
);
640 PropertyIds eBorderId
= PROP_LEFT_BORDER
;
641 PropertyIds eBorderDistId
= PROP_LEFT_BORDER_DISTANCE
;
644 case NS_rtf::LN_BRCTOP
:
645 eBorderId
= PROP_TOP_BORDER
;
646 eBorderDistId
= PROP_TOP_BORDER_DISTANCE
;
648 case NS_rtf::LN_BRCLEFT
:
650 case NS_rtf::LN_BRCBOTTOM
:
651 eBorderId
= PROP_BOTTOM_BORDER
;
652 eBorderDistId
= PROP_BOTTOM_BORDER_DISTANCE
;
654 case NS_rtf::LN_BRCRIGHT
:
655 eBorderId
= PROP_RIGHT_BORDER
;
656 eBorderDistId
= PROP_RIGHT_BORDER_DISTANCE
;
660 //todo: where to put the border properties
661 //rContext->Insert(eBorderId, uno::makeAny( aBorderLine ));
662 //rContext->Insert(eBorderDistId, uno::makeAny( nLineDistance ));
667 case NS_rtf::LN_ITCFIRST
:
669 case NS_rtf::LN_FPUB
:
671 case NS_rtf::LN_ITCLIM
:
673 case NS_rtf::LN_FCOL
:
675 case NS_rtf::LN_LINECOLOR
:
677 case NS_rtf::LN_LINEWIDTH
:
679 case NS_rtf::LN_LINETYPE
:
683 case NS_rtf::LN_XEXT
:
685 case NS_rtf::LN_YEXT
:
691 case NS_rtf::LN_CBHEADER
:
695 case NS_rtf::LN_BM_RCWINMF
:
697 case NS_rtf::LN_DXAGOAL
:
699 case NS_rtf::LN_DYAGOAL
:
705 case NS_rtf::LN_DXACROPLEFT
:
707 case NS_rtf::LN_DYACROPTOP
:
709 case NS_rtf::LN_DXACROPRIGHT
:
711 case NS_rtf::LN_DYACROPBOTTOM
:
713 case NS_rtf::LN_BRCL
:
715 case NS_rtf::LN_FFRAMEEMPTY
:
717 case NS_rtf::LN_FBITMAP
:
719 case NS_rtf::LN_FDRAWHATCH
:
721 case NS_rtf::LN_FERROR
:
725 case NS_rtf::LN_DXAORIGIN
:
727 case NS_rtf::LN_DYAORIGIN
:
729 case NS_rtf::LN_CPROPS
:
731 case NS_rtf::LN_LINEPROPSTOP
:
733 case NS_rtf::LN_LINEPROPSLEFT
:
735 case NS_rtf::LN_LINEPROPSBOTTOM
:
737 case NS_rtf::LN_LINEPROPSRIGHT
:
739 case NS_rtf::LN_LINEPROPSHORIZONTAL
:
741 case NS_rtf::LN_LINEPROPSVERTICAL
:
743 case NS_rtf::LN_headerr
:
745 case NS_rtf::LN_footerr
:
747 case NS_rtf::LN_endnote
:
749 case NS_rtf::LN_BOOKMARKNAME
:
750 // sStringValue contains the bookmark name
751 sLocalBookmarkName
= sStringValue
;
753 case NS_rtf::LN_IBKL
:
754 //contains the bookmark identifier - has to be added to the bookmark name imported before
755 //if it is already available then the bookmark should be inserted
756 m_pImpl
->AddBookmark( sLocalBookmarkName
, sStringValue
);
757 sLocalBookmarkName
= OUString();
759 case NS_rtf::LN_LISTLEVEL
:
761 case NS_rtf::LN_LFOData
:
765 case NS_rtf::LN_ALTFONTNAME
:
767 case NS_rtf::LN_XSZFFN
:
769 case NS_rtf::LN_XSTZNAME
:
771 case NS_rtf::LN_XSTZNAME1
:
773 case NS_rtf::LN_UPXSTART
:
779 resolveAttributeProperties(*this, val
);
781 case NS_rtf::LN_tbdAdd
:
784 writerfilter::Reference
<Properties
>::Pointer_t pProperties
= val
.getProperties();
785 if( pProperties
.get())
787 pProperties
->resolve(*this);
788 //increment to the next tab stop
789 m_pImpl
->NextTabStop();
793 case NS_rtf::LN_dxaDel
:
795 case NS_rtf::LN_dxaAdd
:
798 //tab leading characters - for decimal tabs
801 m_pImpl
->ModifyCurrentTabStop(nName
, nIntValue
);
803 case NS_rtf::LN_UNUSED0_6
:
806 case NS_rtf::LN_rgbrc
:
810 case NS_rtf::LN_cellShd
:
812 case NS_rtf::LN_cellTopColor
:
813 case NS_rtf::LN_cellLeftColor
:
814 case NS_rtf::LN_cellBottomColor
:
815 case NS_rtf::LN_cellRightColor
:
816 OSL_FAIL("handled by DomainMapperTableManager");
819 case NS_rtf::LN_LISTTABLE
:
821 case NS_rtf::LN_LFOTABLE
:
823 case NS_rtf::LN_FONTTABLE
:
825 case NS_rtf::LN_STYLESHEET
:
828 case NS_rtf::LN_fcEastAsianLayout
:
829 /* it seems that the value is following:
832 XX seems to be the run id
833 ZZ is the length of the function that is normally 6
834 Lower byte of YYYY determines whether it is
835 vertical text flow (0x01), or
836 two lines in one layout (0x02).
837 For 0x01, if the higher byte of YYYY is zero, the text is not scaled to fit the line height,
838 in opposite case, it is to be scaled.
839 For 0x02, the higher byte of YYYY is determining the prefix and suffix of the run:
841 () round brackets (0x01),
842 [] square brackets (0x02),
843 <> angle brackets (0x03) and
844 {} curly brackets (0x04).
845 ???? is different and we do not know its signification
848 if ((nIntValue
& 0x000000FF) == 6)
850 switch ((nIntValue
& 0x0000FF00) >> 8)
852 case 1: // vertical text
853 if (m_pImpl
->GetTopContext())
855 m_pImpl
->GetTopContext()->Insert(PROP_CHAR_ROTATION
, true, uno::makeAny ( sal_Int16(900) ));
856 m_pImpl
->GetTopContext()->Insert(PROP_CHAR_ROTATION_IS_FIT_TO_LINE
, true, uno::makeAny (((nIntValue
& 0x00FF0000) >> 16) != 0));
859 case 2: // two lines in one
860 if (m_pImpl
->GetTopContext())
862 m_pImpl
->GetTopContext()->Insert(PROP_CHAR_COMBINE_IS_ON
, true, uno::makeAny ( true ));
863 m_pImpl
->GetTopContext()->Insert(PROP_CHAR_COMBINE_PREFIX
, true, uno::makeAny ( getBracketStringFromEnum((nIntValue
& 0x00FF0000) >> 16)));
864 m_pImpl
->GetTopContext()->Insert(PROP_CHAR_COMBINE_SUFFIX
, true, uno::makeAny ( getBracketStringFromEnum((nIntValue
& 0x00FF0000) >> 16, false)));
872 case NS_rtf::LN_FRD
:
873 //footnote reference descriptor, if nIntValue > 0 then automatic, custom otherwise
876 case NS_rtf::LN_FONT
: //font of footnote symbol
877 if (m_pImpl
->GetTopContext())
878 m_pImpl
->GetTopContext()->SetFootnoteFontId( nIntValue
);
880 case NS_ooxml::LN_CT_Sym_char
:
881 if( m_pImpl
->GetTopContext() && m_pImpl
->GetTopContext()->GetFootnote().is())
883 m_pImpl
->GetTopContext()->GetFootnote()->setLabel(OUString( sal_Unicode(nIntValue
)));
886 else //it's a _real_ symbol
888 utext( reinterpret_cast < const sal_uInt8
* >( &nIntValue
), 1 );
891 case NS_rtf::LN_CHAR
: //footnote symbol character
892 if (m_pImpl
->GetTopContext())
893 m_pImpl
->GetTopContext()->SetFootnoteSymbol( sal_Unicode(nIntValue
));
895 case NS_ooxml::LN_CT_Sym_font
:
896 //the footnote symbol and font are provided after the footnote is already inserted
897 if( m_pImpl
->GetTopContext() && m_pImpl
->GetTopContext()->GetFootnote().is())
899 uno::Reference
< beans::XPropertySet
> xAnchorProps( m_pImpl
->GetTopContext()->GetFootnote()->getAnchor(), uno::UNO_QUERY
);
900 xAnchorProps
->setPropertyValue(
901 PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_CHAR_FONT_NAME
),
902 uno::makeAny( sStringValue
));
905 if (m_pImpl
->GetTopContext())
906 m_pImpl
->GetTopContext()->Insert(PROP_CHAR_FONT_NAME
, true, uno::makeAny( sStringValue
));
908 case NS_ooxml::LN_CT_Underline_val
:
909 handleUnderlineType(nIntValue
, m_pImpl
->GetTopContext());
911 case NS_ooxml::LN_CT_Color_val
:
912 if (m_pImpl
->GetTopContext())
913 m_pImpl
->GetTopContext()->Insert(PROP_CHAR_COLOR
, true, uno::makeAny( nIntValue
) );
915 case NS_ooxml::LN_CT_Underline_color
:
916 if (m_pImpl
->GetTopContext())
918 m_pImpl
->GetTopContext()->Insert(PROP_CHAR_UNDERLINE_HAS_COLOR
, true, uno::makeAny( true ) );
919 m_pImpl
->GetTopContext()->Insert(PROP_CHAR_UNDERLINE_COLOR
, true, uno::makeAny( nIntValue
) );
923 case NS_ooxml::LN_CT_TabStop_val
:
924 if (sal::static_int_cast
<Id
>(nIntValue
) == NS_ooxml::LN_Value_ST_TabJc_clear
)
926 m_pImpl
->m_aCurrentTabStop
.bDeleted
= true;
930 m_pImpl
->m_aCurrentTabStop
.bDeleted
= false;
931 m_pImpl
->m_aCurrentTabStop
.Alignment
= getTabAlignFromValue(nIntValue
);
934 case NS_ooxml::LN_CT_TabStop_leader
:
935 m_pImpl
->m_aCurrentTabStop
.FillChar
= getFillCharFromValue(nIntValue
);
937 case NS_ooxml::LN_CT_TabStop_pos
:
938 m_pImpl
->m_aCurrentTabStop
.Position
= ConversionHelper::convertTwipToMM100(nIntValue
);
941 case NS_ooxml::LN_CT_Fonts_ascii
:
942 if (m_pImpl
->GetTopContext())
943 m_pImpl
->GetTopContext()->Insert(PROP_CHAR_FONT_NAME
, true, uno::makeAny( sStringValue
));
945 case NS_ooxml::LN_CT_Fonts_asciiTheme
:
946 if (m_pImpl
->GetTopContext())
947 m_pImpl
->GetTopContext()->Insert(PROP_CHAR_FONT_NAME
, true, uno::makeAny( m_pImpl
->GetThemeTable()->getFontNameForTheme(nIntValue
) ));
949 case NS_ooxml::LN_CT_Fonts_hAnsi
:
951 case NS_ooxml::LN_CT_Fonts_hAnsiTheme
:
953 case NS_ooxml::LN_CT_Fonts_eastAsia
:
954 if (m_pImpl
->GetTopContext())
955 m_pImpl
->GetTopContext()->Insert(PROP_CHAR_FONT_NAME_ASIAN
, true, uno::makeAny( sStringValue
));
957 case NS_ooxml::LN_CT_Fonts_eastAsiaTheme
:
958 if (m_pImpl
->GetTopContext())
959 m_pImpl
->GetTopContext()->Insert(PROP_CHAR_FONT_NAME_COMPLEX
, true, uno::makeAny( m_pImpl
->GetThemeTable()->getFontNameForTheme(nIntValue
) ) );
961 case NS_ooxml::LN_CT_Fonts_cs
:
962 if (m_pImpl
->GetTopContext())
963 m_pImpl
->GetTopContext()->Insert(PROP_CHAR_FONT_NAME_COMPLEX
, true, uno::makeAny( sStringValue
));
965 case NS_ooxml::LN_CT_Fonts_cstheme
:
966 if (m_pImpl
->GetTopContext())
967 m_pImpl
->GetTopContext()->Insert(PROP_CHAR_FONT_NAME_COMPLEX
, true, uno::makeAny( m_pImpl
->GetThemeTable()->getFontNameForTheme(nIntValue
) ));
969 case NS_ooxml::LN_CT_Spacing_before
:
970 if (m_pImpl
->GetTopContext())
971 // Don't overwrite NS_ooxml::LN_CT_Spacing_beforeAutospacing.
972 m_pImpl
->GetTopContext()->Insert(PROP_PARA_TOP_MARGIN
, true, uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue
) ), false);
974 case NS_ooxml::LN_CT_Spacing_beforeLines
:
976 case NS_ooxml::LN_CT_Spacing_after
:
977 if (m_pImpl
->GetTopContext())
978 // Don't overwrite NS_ooxml::LN_CT_Spacing_afterAutospacing.
979 m_pImpl
->GetTopContext()->Insert(PROP_PARA_BOTTOM_MARGIN
, true, uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue
) ), false);
981 case NS_ooxml::LN_CT_Spacing_afterLines
:
983 case NS_ooxml::LN_CT_Spacing_line
: //91434
984 case NS_ooxml::LN_CT_Spacing_lineRule
: //91435
986 #define SINGLE_LINE_SPACING 240
987 style::LineSpacing aSpacing
;
988 PropertyMapPtr pTopContext
= m_pImpl
->GetTopContext();
990 PropertyMap::iterator aLineSpacingIter
;
993 aLineSpacingIter
= pTopContext
->find(PropertyDefinition( PROP_PARA_LINE_SPACING
, true ) );
994 bFound
= aLineSpacingIter
!= pTopContext
->end();
998 aLineSpacingIter
->second
>>= aSpacing
;
1002 //default to single line spacing
1003 aSpacing
.Mode
= style::LineSpacingMode::FIX
;
1004 aSpacing
.Height
= sal_Int16(ConversionHelper::convertTwipToMM100( SINGLE_LINE_SPACING
));
1006 if( nName
== NS_ooxml::LN_CT_Spacing_line
)
1008 //now set the value depending on the Mode
1009 if( aSpacing
.Mode
== style::LineSpacingMode::PROP
)
1010 aSpacing
.Height
= sal_Int16(sal_Int32(nIntValue
) * 100 / SINGLE_LINE_SPACING
);
1012 aSpacing
.Height
= sal_Int16(ConversionHelper::convertTwipToMM100( nIntValue
));
1014 else //NS_ooxml::LN_CT_Spacing_lineRule:
1016 // exactly, atLeast, auto
1017 if( sal::static_int_cast
<Id
>(nIntValue
) == NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_auto
)
1019 aSpacing
.Mode
= style::LineSpacingMode::PROP
;
1020 //reinterpret the already set value
1021 aSpacing
.Height
= sal_Int16( aSpacing
.Height
* 100 / ConversionHelper::convertTwipToMM100( SINGLE_LINE_SPACING
));
1023 else if( sal::static_int_cast
<Id
>(nIntValue
) == NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_atLeast
)
1024 aSpacing
.Mode
= style::LineSpacingMode::MINIMUM
;
1025 else // NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_exact
1026 aSpacing
.Mode
= style::LineSpacingMode::FIX
;
1029 pTopContext
->Insert(PROP_PARA_LINE_SPACING
, true, uno::makeAny( aSpacing
));
1032 case NS_ooxml::LN_CT_Ind_start
:
1033 case NS_ooxml::LN_CT_Ind_left
:
1034 if (m_pImpl
->GetTopContext())
1036 // Word inherits FirstLineIndent property of the numbering, even if ParaLeftMargin is set, Writer does not.
1037 // So copy it explicitly, if necessary.
1038 sal_Int32 nFirstLineIndent
= m_pImpl
->getCurrentNumberingProperty("FirstLineIndent");
1040 if (nFirstLineIndent
!= 0)
1041 m_pImpl
->GetTopContext()->Insert(PROP_PARA_FIRST_LINE_INDENT
, true, uno::makeAny(nFirstLineIndent
));
1043 m_pImpl
->GetTopContext()->Insert(
1044 PROP_PARA_LEFT_MARGIN
, true, uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue
) ));
1047 case NS_ooxml::LN_CT_Ind_end
:
1048 case NS_ooxml::LN_CT_Ind_right
:
1049 if (m_pImpl
->GetTopContext())
1051 // Word inherits FirstLineIndent/ParaLeftMargin property of the numbering, even if ParaRightMargin is set, Writer does not.
1052 // So copy it explicitly, if necessary.
1053 sal_Int32 nFirstLineIndent
= m_pImpl
->getCurrentNumberingProperty("FirstLineIndent");
1054 sal_Int32 nParaLeftMargin
= m_pImpl
->getCurrentNumberingProperty("IndentAt");
1056 if (nFirstLineIndent
!= 0)
1057 m_pImpl
->GetTopContext()->Insert(PROP_PARA_FIRST_LINE_INDENT
, true, uno::makeAny(nFirstLineIndent
));
1058 if (nParaLeftMargin
!= 0)
1059 m_pImpl
->GetTopContext()->Insert(PROP_PARA_LEFT_MARGIN
, true, uno::makeAny(nParaLeftMargin
));
1061 m_pImpl
->GetTopContext()->Insert(
1062 PROP_PARA_RIGHT_MARGIN
, true, uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue
) ));
1065 case NS_ooxml::LN_CT_Ind_hanging
:
1066 if (m_pImpl
->GetTopContext())
1068 sal_Int32 nValue
= ConversionHelper::convertTwipToMM100( nIntValue
);
1069 m_pImpl
->GetTopContext()->Insert(
1070 PROP_PARA_FIRST_LINE_INDENT
, true, uno::makeAny( - nValue
));
1073 case NS_ooxml::LN_CT_Ind_firstLine
:
1074 if (m_pImpl
->GetTopContext())
1075 m_pImpl
->GetTopContext()->Insert(
1076 PROP_PARA_FIRST_LINE_INDENT
, true, uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue
) ));
1079 case NS_ooxml::LN_CT_EastAsianLayout_id
:
1081 case NS_ooxml::LN_CT_EastAsianLayout_combine
:
1082 if (m_pImpl
->GetTopContext())
1083 m_pImpl
->GetTopContext()->Insert(PROP_CHAR_COMBINE_IS_ON
, true, uno::makeAny ( nIntValue
? true : false ));
1085 case NS_ooxml::LN_CT_EastAsianLayout_combineBrackets
:
1086 if (m_pImpl
->GetTopContext())
1088 OUString sCombinePrefix
= getBracketStringFromEnum(nIntValue
);
1089 OUString sCombineSuffix
= getBracketStringFromEnum(nIntValue
, false);
1090 m_pImpl
->GetTopContext()->Insert(PROP_CHAR_COMBINE_PREFIX
, true, uno::makeAny ( sCombinePrefix
));
1091 m_pImpl
->GetTopContext()->Insert(PROP_CHAR_COMBINE_SUFFIX
, true, uno::makeAny ( sCombineSuffix
));
1094 case NS_ooxml::LN_CT_EastAsianLayout_vert
:
1095 if (m_pImpl
->GetTopContext())
1097 sal_Int16 nRotationAngle
= (nIntValue
? 900 : 0);
1098 m_pImpl
->GetTopContext()->Insert(PROP_CHAR_ROTATION
, true, uno::makeAny ( nRotationAngle
));
1101 case NS_ooxml::LN_CT_EastAsianLayout_vertCompress
:
1102 if (m_pImpl
->GetTopContext())
1103 m_pImpl
->GetTopContext()->Insert(PROP_CHAR_ROTATION_IS_FIT_TO_LINE
, true, uno::makeAny ( nIntValue
? true : false));
1106 case NS_ooxml::LN_CT_PageSz_code
:
1107 CT_PageSz
.code
= nIntValue
;
1109 case NS_ooxml::LN_CT_PageSz_h
:
1111 sal_Int32 nHeight
= ConversionHelper::convertTwipToMM100(nIntValue
);
1112 CT_PageSz
.h
= PaperInfo::sloppyFitPageDimension(nHeight
);
1115 case NS_ooxml::LN_CT_PageSz_orient
:
1116 CT_PageSz
.orient
= (nIntValue
!= 0);
1118 case NS_ooxml::LN_CT_PageSz_w
:
1120 sal_Int32 nWidth
= ConversionHelper::convertTwipToMM100(nIntValue
);
1121 CT_PageSz
.w
= PaperInfo::sloppyFitPageDimension(nWidth
);
1125 case NS_ooxml::LN_CT_PageMar_top
:
1126 m_pImpl
->SetPageMarginTwip( PAGE_MAR_TOP
, nIntValue
);
1128 case NS_ooxml::LN_CT_PageMar_right
:
1129 m_pImpl
->SetPageMarginTwip( PAGE_MAR_RIGHT
, nIntValue
);
1131 case NS_ooxml::LN_CT_PageMar_bottom
:
1132 m_pImpl
->SetPageMarginTwip( PAGE_MAR_BOTTOM
, nIntValue
);
1134 case NS_ooxml::LN_CT_PageMar_left
:
1135 m_pImpl
->SetPageMarginTwip( PAGE_MAR_LEFT
, nIntValue
);
1137 case NS_ooxml::LN_CT_PageMar_header
:
1138 m_pImpl
->SetPageMarginTwip( PAGE_MAR_HEADER
, nIntValue
);
1140 case NS_ooxml::LN_CT_PageMar_footer
:
1141 m_pImpl
->SetPageMarginTwip( PAGE_MAR_FOOTER
, nIntValue
);
1143 case NS_ooxml::LN_CT_PageMar_gutter
:
1144 m_pImpl
->SetPageMarginTwip( PAGE_MAR_GUTTER
, nIntValue
);
1146 case NS_ooxml::LN_CT_Language_val
: //90314
1147 case NS_ooxml::LN_CT_Language_eastAsia
: //90315
1148 case NS_ooxml::LN_CT_Language_bidi
: //90316
1150 lang::Locale
aLocale( LanguageTag( sStringValue
).getLocale());
1151 if (m_pImpl
->GetTopContext())
1152 m_pImpl
->GetTopContext()->Insert(NS_ooxml::LN_CT_Language_val
== nName
? PROP_CHAR_LOCALE
:
1153 NS_ooxml::LN_CT_Language_eastAsia
== nName
? PROP_CHAR_LOCALE_ASIAN
: PROP_CHAR_LOCALE_COMPLEX
,
1155 uno::makeAny( aLocale
) );
1158 // See SwWW8ImplReader::GetParagraphAutoSpace() on why these are 100 and 280
1159 case NS_ooxml::LN_CT_Spacing_beforeAutospacing
:
1160 if (!m_pImpl
->GetSettingsTable()->GetDoNotUseHTMLParagraphAutoSpacing())
1161 m_pImpl
->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN
, false, uno::makeAny( ConversionHelper::convertTwipToMM100(280) ) );
1163 m_pImpl
->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN
, false, uno::makeAny( ConversionHelper::convertTwipToMM100(100) ) );
1165 case NS_ooxml::LN_CT_Spacing_afterAutospacing
:
1166 if (!m_pImpl
->GetSettingsTable()->GetDoNotUseHTMLParagraphAutoSpacing())
1167 m_pImpl
->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN
, false, uno::makeAny( ConversionHelper::convertTwipToMM100(280) ) );
1169 m_pImpl
->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN
, false, uno::makeAny( ConversionHelper::convertTwipToMM100(100) ) );
1171 case NS_ooxml::LN_CT_SmartTagRun_uri
:
1172 case NS_ooxml::LN_CT_SmartTagRun_element
:
1173 //TODO: add handling of SmartTags
1175 case NS_ooxml::LN_CT_Br_type
:
1176 //TODO: attributes for break (0x12) are not supported
1178 case NS_ooxml::LN_CT_Fonts_hint
:
1179 /* assigns script type to ambigous characters, values can be:
1180 NS_ooxml::LN_Value_ST_Hint_default
1181 NS_ooxml::LN_Value_ST_Hint_eastAsia
1182 NS_ooxml::LN_Value_ST_Hint_cs
1184 //TODO: unsupported?
1186 case NS_ooxml::LN_CT_TblCellMar_right
: // 92375;
1187 case NS_ooxml::LN_CT_TblBorders_top
: // 92377;
1188 case NS_ooxml::LN_CT_TblBorders_left
: // 92378;
1189 case NS_ooxml::LN_CT_TblBorders_bottom
: // 92379;
1190 //todo: handle cell mar
1192 case NS_rtf::LN_blip
: // contains the binary graphic
1193 case NS_ooxml::LN_shape
:
1195 //looks a bit like a hack - and it is. The graphic import is split into the inline_inline part and
1196 //afterwards the adding of the binary data.
1197 m_pImpl
->GetGraphicImport( IMPORT_AS_DETECTED_INLINE
)->attribute(nName
, val
);
1198 m_pImpl
->ImportGraphic( val
.getProperties(), IMPORT_AS_DETECTED_INLINE
);
1201 case NS_ooxml::LN_starmath
:
1202 m_pImpl
->appendStarMath( val
);
1204 case NS_ooxml::LN_CT_FramePr_dropCap
:
1205 case NS_ooxml::LN_CT_FramePr_lines
:
1206 case NS_ooxml::LN_CT_FramePr_hAnchor
:
1207 case NS_ooxml::LN_CT_FramePr_vAnchor
:
1208 case NS_ooxml::LN_CT_FramePr_x
:
1209 case NS_ooxml::LN_CT_FramePr_xAlign
:
1210 case NS_ooxml::LN_CT_FramePr_y
:
1211 case NS_ooxml::LN_CT_FramePr_yAlign
:
1212 case NS_ooxml::LN_CT_FramePr_hRule
:
1213 case NS_sprm::LN_PWr
:
1214 case NS_sprm::LN_PDxaWidth
:
1215 case NS_sprm::LN_PWHeightAbs
:
1216 case NS_sprm::LN_PDxaFromText
:
1217 case NS_sprm::LN_PDyaFromText
:
1219 ParagraphProperties
* pParaProperties
= dynamic_cast< ParagraphProperties
*>(
1220 m_pImpl
->GetTopContextOfType( CONTEXT_PARAGRAPH
).get() );
1221 if( pParaProperties
)
1225 case NS_ooxml::LN_CT_FramePr_dropCap
:
1226 pParaProperties
->SetDropCap( nIntValue
);
1228 case NS_ooxml::LN_CT_FramePr_lines
:
1229 pParaProperties
->SetLines( nIntValue
);
1231 case NS_ooxml::LN_CT_FramePr_hAnchor
:
1234 case NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_text
: //relative to column
1235 nIntValue
= text::RelOrientation::FRAME
; break;
1236 case NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_margin
: nIntValue
= text::RelOrientation::PAGE_PRINT_AREA
; break;
1237 case NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_page
: nIntValue
= text::RelOrientation::PAGE_FRAME
; break;
1240 pParaProperties
->SethAnchor( nIntValue
);
1242 case NS_ooxml::LN_CT_FramePr_vAnchor
:
1245 case NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_text
: //relative to paragraph
1246 nIntValue
= text::RelOrientation::FRAME
; break;
1247 case NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_margin
:nIntValue
= text::RelOrientation::PAGE_PRINT_AREA
; break;
1248 case NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_page
: nIntValue
= text::RelOrientation::PAGE_FRAME
; break;
1251 pParaProperties
->SetvAnchor( nIntValue
);
1253 case NS_ooxml::LN_CT_FramePr_x
:
1254 pParaProperties
->Setx( ConversionHelper::convertTwipToMM100(nIntValue
));
1256 case NS_ooxml::LN_CT_FramePr_xAlign
:
1259 case NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_center
: nIntValue
= text::HoriOrientation::CENTER
; break;
1260 case NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_right
: nIntValue
= text::HoriOrientation::RIGHT
; break;
1261 case NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_inside
: nIntValue
= text::HoriOrientation::INSIDE
; break;
1262 case NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_outside
: nIntValue
= text::HoriOrientation::OUTSIDE
; break;
1263 case NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_left
: nIntValue
= text::HoriOrientation::LEFT
; break;
1264 default: nIntValue
= text::HoriOrientation::NONE
;
1266 pParaProperties
->SetxAlign( nIntValue
);
1268 case NS_ooxml::LN_CT_FramePr_y
:
1269 pParaProperties
->Sety( ConversionHelper::convertTwipToMM100(nIntValue
));
1271 case NS_ooxml::LN_CT_FramePr_yAlign
:
1274 case NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_top
:
1275 case NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_inside
:nIntValue
= text::VertOrientation::TOP
; break;
1276 case NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_center
:nIntValue
= text::VertOrientation::CENTER
;break;
1277 case NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_bottom
:
1278 case NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_outside
:nIntValue
= text::VertOrientation::BOTTOM
;break;
1279 case NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_inline
:
1281 // HACK: This is for bnc#780851, where a table has one cell that has w:framePr,
1282 // which causes that paragraph to be converted to a text frame, and the original
1283 // paragraph object no longer exists, which makes table creation fail and futhermore
1284 // it would be missing in the table layout anyway. So actually no letting that paragraph
1285 // be a text frame "fixes" it. I'm not sure what "inline" is supposed to mean in practice
1286 // anyway, so as long as this doesn't cause trouble elsewhere ...
1287 PropertyMapPtr pContext
= m_pImpl
->GetTopContextOfType(CONTEXT_PARAGRAPH
);
1288 if( pContext
.get() )
1290 ParagraphPropertyMap
* pParaContext
= dynamic_cast< ParagraphPropertyMap
* >( pContext
.get() );
1291 pParaContext
->SetFrameMode(false);
1293 nIntValue
= text::VertOrientation::NONE
;
1295 default:nIntValue
= text::VertOrientation::NONE
;
1297 pParaProperties
->SetyAlign( nIntValue
);
1299 case NS_ooxml::LN_CT_FramePr_hRule
:
1302 case NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_exact
:
1303 nIntValue
= text::SizeType::FIX
;
1305 case NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_atLeast
:
1306 nIntValue
= text::SizeType::MIN
;
1308 case NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_auto
:
1311 nIntValue
= text::SizeType::VARIABLE
;
1313 pParaProperties
->SethRule( nIntValue
);
1315 case NS_sprm::LN_PWr
:
1317 //should be either LN_Value_wordprocessingml_ST_Wrap_notBeside or LN_Value_wordprocessingml_ST_Wrap_around
1318 OSL_ENSURE( sal::static_int_cast
<Id
>(nIntValue
) == NS_ooxml::LN_Value_wordprocessingml_ST_Wrap_around
||
1319 sal::static_int_cast
<Id
>(nIntValue
) == NS_ooxml::LN_Value_wordprocessingml_ST_Wrap_notBeside
,
1320 "wrap not around or not_Beside?");
1321 pParaProperties
->SetWrap(sal::static_int_cast
<Id
>(nIntValue
) == NS_ooxml::LN_Value_wordprocessingml_ST_Wrap_around
?
1322 text::WrapTextMode_DYNAMIC
: text::WrapTextMode_NONE
);
1325 case NS_sprm::LN_PDxaWidth
:
1326 pParaProperties
->Setw(ConversionHelper::convertTwipToMM100(nIntValue
));
1328 case NS_sprm::LN_PWHeightAbs
:
1329 pParaProperties
->Seth(ConversionHelper::convertTwipToMM100(nIntValue
));
1331 case NS_sprm::LN_PDxaFromText
:
1332 pParaProperties
->SethSpace( ConversionHelper::convertTwipToMM100(nIntValue
));
1334 case NS_sprm::LN_PDyaFromText
:
1335 pParaProperties
->SetvSpace( ConversionHelper::convertTwipToMM100(nIntValue
));
1342 //TODO: how to handle frame properties at styles
1346 case NS_ooxml::LN_CT_LineNumber_start
:
1347 case NS_ooxml::LN_CT_LineNumber_distance
:
1348 case NS_ooxml::LN_CT_TrackChange_author
:
1349 m_pImpl
->SetCurrentRedlineAuthor( sStringValue
);
1351 case NS_ooxml::LN_CT_TrackChange_date
:
1352 m_pImpl
->SetCurrentRedlineDate( sStringValue
);
1354 case NS_ooxml::LN_CT_Markup_id
:
1355 m_pImpl
->SetCurrentRedlineId( nIntValue
);
1357 case NS_ooxml::LN_EG_RangeMarkupElements_commentRangeStart
:
1358 m_pImpl
->AddAnnotationPosition(true);
1360 case NS_ooxml::LN_EG_RangeMarkupElements_commentRangeEnd
:
1361 m_pImpl
->AddAnnotationPosition(false);
1363 case NS_ooxml::LN_CT_Comment_initials
:
1364 m_pImpl
->SetCurrentRedlineInitials(sStringValue
);
1366 case NS_ooxml::LN_token
:
1367 m_pImpl
->SetCurrentRedlineToken( nIntValue
);
1369 case NS_ooxml::LN_CT_LineNumber_countBy
:
1370 case NS_ooxml::LN_CT_LineNumber_restart
:
1372 //line numbering in Writer is a global document setting
1373 //in Word is a section setting
1374 //if line numbering is switched on anywhere in the document it's set at the global settings
1375 LineNumberSettings aSettings
= m_pImpl
->GetLineNumberSettings();
1378 case NS_ooxml::LN_CT_LineNumber_countBy
:
1379 aSettings
.nInterval
= nIntValue
;
1381 case NS_ooxml::LN_CT_LineNumber_start
:
1382 aSettings
.nStartValue
= nIntValue
; // todo: has to be set at (each) first paragraph
1384 case NS_ooxml::LN_CT_LineNumber_distance
:
1385 aSettings
.nDistance
= ConversionHelper::convertTwipToMM100( nIntValue
);
1387 case NS_ooxml::LN_CT_LineNumber_restart
:
1388 //page:empty, probably 0,section:1,continuous:2;
1389 aSettings
.bRestartAtEachPage
= nIntValue
< 1;
1393 m_pImpl
->SetLineNumberSettings( aSettings
);
1396 case NS_ooxml::LN_CT_FtnEdnRef_customMarkFollows
:
1397 m_pImpl
->SetCustomFtnMark( true );
1399 case NS_ooxml::LN_CT_FtnEdnRef_id
:
1400 // footnote or endnote reference id - not needed
1401 case NS_ooxml::LN_CT_Color_themeColor
:
1402 case NS_ooxml::LN_CT_Color_themeTint
:
1403 case NS_ooxml::LN_CT_Color_themeShade
:
1406 case NS_ooxml::LN_CT_DocGrid_linePitch
:
1408 //see SwWW8ImplReader::SetDocumentGrid
1409 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
1412 pSectionContext
->SetGridLinePitch( ConversionHelper::convertTwipToMM100( nIntValue
) );
1416 case NS_ooxml::LN_CT_DocGrid_charSpace
:
1418 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
1421 pSectionContext
->SetDxtCharSpace( nIntValue
);
1425 case NS_ooxml::LN_CT_DocGrid_type
:
1427 if (pSectionContext
!= NULL
)
1429 pSectionContext
->SetGridType(nIntValue
);
1433 case NS_ooxml::LN_CT_SdtBlock_sdtContent
:
1434 m_pImpl
->SetSdt(true);
1436 case NS_ooxml::LN_CT_SdtBlock_sdtEndContent
:
1437 m_pImpl
->SetSdt(false);
1438 if (!m_pImpl
->m_pSdtHelper
->getDropDownItems().empty())
1439 m_pImpl
->m_pSdtHelper
->createDropDownControl();
1441 case NS_ooxml::LN_CT_SdtListItem_displayText
:
1442 // TODO handle when this is != value
1444 case NS_ooxml::LN_CT_SdtListItem_value
:
1445 m_pImpl
->m_pSdtHelper
->getDropDownItems().push_back(sStringValue
);
1447 case NS_ooxml::LN_CT_Background_color
:
1448 m_pImpl
->m_oBackgroundColor
.reset(nIntValue
);
1452 #if OSL_DEBUG_LEVEL > 0
1453 OString
sMessage("DomainMapper::attribute() - Id: ");
1454 sMessage
+= OString::valueOf( sal_Int32( nName
), 10 );
1455 sMessage
+= " / 0x";
1456 sMessage
+= OString::valueOf( sal_Int32( nName
), 16 );
1457 sMessage
+= " value: ";
1458 sMessage
+= OString::valueOf( sal_Int32( nIntValue
), 10 );
1459 sMessage
+= " / 0x";
1460 sMessage
+= OString::valueOf( sal_Int32( nIntValue
), 16 );
1461 SAL_WARN("writerfilter", sMessage
.getStr());
1468 void DomainMapper::lcl_sprm(Sprm
& rSprm
)
1470 if( !m_pImpl
->getTableManager().sprm(rSprm
))
1471 sprmWithProps( rSprm
, m_pImpl
->GetTopContext() );
1474 sal_Int32
lcl_getCurrentNumberingProperty(uno::Reference
<container::XIndexAccess
> xNumberingRules
, sal_Int32 nNumberingLevel
, OUString aProp
)
1480 if (nNumberingLevel
< 0) // It seems it's valid to omit numbering level, and in that case it means zero.
1481 nNumberingLevel
= 0;
1482 if (xNumberingRules
.is())
1484 uno::Sequence
<beans::PropertyValue
> aProps
;
1485 xNumberingRules
->getByIndex(nNumberingLevel
) >>= aProps
;
1486 for (int i
= 0; i
< aProps
.getLength(); ++i
)
1488 const beans::PropertyValue
& rProp
= aProps
[i
];
1490 if (rProp
.Name
== aProp
)
1492 rProp
.Value
>>= nRet
;
1498 catch( const uno::Exception
& )
1500 // This can happen when the doc contains some hand-crafted invalid list level.
1506 void DomainMapper::sprmWithProps( Sprm
& rSprm
, PropertyMapPtr rContext
, SprmType eSprmType
)
1508 OSL_ENSURE(rContext
.get(), "PropertyMap has to be valid!");
1512 sal_uInt32 nSprmId
= rSprm
.getId();
1513 //needed for page properties
1514 SectionPropertyMap
* pSectionContext
= m_pImpl
->GetSectionContext();
1516 //TODO: In rtl-paragraphs the meaning of left/right are to be exchanged
1517 bool bExchangeLeftRight
= false;
1518 Value::Pointer_t pValue
= rSprm
.getValue();
1519 sal_Int32 nIntValue
= pValue
->getInt();
1520 const OUString sStringValue
= pValue
->getString();
1521 PropertyNameSupplier
& rPropNameSupplier
= PropertyNameSupplier::GetPropertyNameSupplier();
1525 case 2: // sprmPIstd
1527 break; // sprmPIstd - style code
1528 case 3: // "sprmPIstdPermute
1529 case NS_sprm::LN_PIstdPermute
:
1530 break; // sprmPIstdPermute
1531 case NS_sprm::LN_PIncLvl
:
1532 break; // sprmPIncLvl
1533 case NS_sprm::LN_PJcExtra
: // sprmPJc Asian (undocumented)
1534 case NS_sprm::LN_PJc
: // sprmPJc
1535 handleParaJustification(nIntValue
, rContext
, bExchangeLeftRight
);
1537 case NS_sprm::LN_PFSideBySide
:
1538 break; // sprmPFSideBySide
1540 case NS_sprm::LN_PFKeep
: // sprmPFKeep
1541 rContext
->Insert(PROP_PARA_SPLIT
, true, uno::makeAny(nIntValue
? false : true));
1543 case NS_sprm::LN_PFKeepFollow
: // sprmPFKeepFollow
1544 rContext
->Insert(PROP_PARA_KEEP_TOGETHER
, true, uno::makeAny( nIntValue
? true : false) );
1546 case NS_sprm::LN_PFPageBreakBefore
:
1547 if ( nIntValue
== 1 )
1549 rContext
->Insert(PROP_BREAK_TYPE
, true, uno::makeAny( com::sun::star::style::BreakType_PAGE_BEFORE
) );
1551 break; // sprmPFPageBreakBefore
1552 case NS_sprm::LN_PBrcl
:
1554 case NS_sprm::LN_PBrcp
:
1556 case NS_sprm::LN_PIlvl
: // sprmPIlvl
1557 if (nIntValue
< 0 || 10 <= nIntValue
) // Writer can't do everything
1559 SAL_INFO("writerfilter",
1560 "unsupported numbering level " << nIntValue
);
1563 if( m_pImpl
->IsStyleSheetImport() )
1565 //style sheets cannot have a numbering rule attached
1566 StyleSheetPropertyMap
* pStyleSheetPropertyMap
= dynamic_cast< StyleSheetPropertyMap
* >( rContext
.get() );
1567 if (pStyleSheetPropertyMap
)
1568 pStyleSheetPropertyMap
->SetListLevel( (sal_Int16
)nIntValue
);
1571 rContext
->Insert( PROP_NUMBERING_LEVEL
, true, uno::makeAny( (sal_Int16
)nIntValue
));
1573 case NS_sprm::LN_PIlfo
: // sprmPIlfo
1575 //convert the ListTable entry to a NumberingRules propery and apply it
1576 ListsManager::Pointer pListTable
= m_pImpl
->GetListTable();
1577 ListDef::Pointer pList
= pListTable
->GetList( nIntValue
);
1578 if( m_pImpl
->IsStyleSheetImport() )
1580 //style sheets cannot have a numbering rule attached
1581 StyleSheetPropertyMap
* pStyleSheetPropertyMap
= dynamic_cast< StyleSheetPropertyMap
* >( rContext
.get() );
1582 if (pStyleSheetPropertyMap
)
1583 pStyleSheetPropertyMap
->SetListId( nIntValue
);
1587 if( !m_pImpl
->IsStyleSheetImport() )
1589 uno::Any aRules
= uno::makeAny( pList
->GetNumberingRules( ) );
1590 rContext
->Insert( PROP_NUMBERING_RULES
, true, aRules
);
1591 // erase numbering from pStyle if already set
1592 rContext
->erase( PropertyDefinition( PROP_NUMBERING_STYLE_NAME
, true ));
1597 if( m_pImpl
->IsStyleSheetImport() )
1599 // set the number id for AbstractNum references
1600 StyleSheetPropertyMap
* pStyleSheetPropertyMap
= dynamic_cast< StyleSheetPropertyMap
* >( rContext
.get() );
1601 if (pStyleSheetPropertyMap
)
1602 pStyleSheetPropertyMap
->SetNumId( nIntValue
);
1606 rContext
->Insert( PROP_NUMBERING_STYLE_NAME
, true, uno::makeAny( OUString() ) );
1611 case NS_sprm::LN_PFNoLineNumb
: // sprmPFNoLineNumb
1612 rContext
->Insert(PROP_PARA_LINE_NUMBER_COUNT
, true, uno::makeAny( nIntValue
? false : true) );
1614 case NS_sprm::LN_PChgTabsPapx
: // sprmPChgTabsPapx
1616 // Initialize tab stop vector from style sheet
1617 uno::Any aValue
= m_pImpl
->GetPropertyFromStyleSheet(PROP_PARA_TAB_STOPS
);
1618 uno::Sequence
< style::TabStop
> aStyleTabStops
;
1619 if(aValue
>>= aStyleTabStops
)
1621 m_pImpl
->InitTabStopFromStyle( aStyleTabStops
);
1624 //create a new tab stop property - this is done with the contained properties
1625 resolveSprmProps(*this, rSprm
);
1627 rContext
->Insert(PROP_PARA_TAB_STOPS
, true, uno::makeAny( m_pImpl
->GetCurrentTabStopAndClear()));
1630 case 0x845d: //right margin Asian - undocumented
1631 case 0x845e: //left margin Asian - undocumented
1632 case 16: // sprmPDxaRight - right margin
1633 case NS_sprm::LN_PDxaRight
: // sprmPDxaRight - right margin
1635 case NS_sprm::LN_PDxaLeft
: // sprmPDxaLeft
1636 if( NS_sprm::LN_PDxaLeft
== nSprmId
|| 0x17 == nSprmId
|| (bExchangeLeftRight
&& nSprmId
== 0x845d) || ( !bExchangeLeftRight
&& nSprmId
== 0x845e))
1638 eSprmType
== SPRM_DEFAULT
? PROP_PARA_LEFT_MARGIN
: PROP_LEFT_MARGIN
,
1640 uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue
) ));
1641 else if(eSprmType
== SPRM_DEFAULT
)
1643 PROP_PARA_RIGHT_MARGIN
, true,
1644 uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue
) ));
1645 //TODO: what happens to the right margins in numberings?
1647 case 18: // sprmPNest
1648 case NS_sprm::LN_PNest
: // sprmPNest
1649 //not handled in the old WW8 filter
1651 case NS_sprm::LN_PDxaLeft1
: // sprmPDxaLeft1
1653 case NS_sprm::LN_PDxaLeft180
: // sprmPDxaLeft180
1655 eSprmType
== SPRM_DEFAULT
? PROP_PARA_FIRST_LINE_INDENT
: PROP_FIRST_LINE_OFFSET
,
1657 uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue
) ));
1659 case 20 : // sprmPDyaLine
1660 case NS_sprm::LN_PDyaLine
: // sprmPDyaLine
1662 style::LineSpacing aSpacing
;
1663 sal_Int16 nDistance
= sal_Int16(nIntValue
& 0xffff);
1664 if(nIntValue
& 0xffff0000)
1666 // single line in Writer is 100, in Word it is 240
1667 aSpacing
.Mode
= style::LineSpacingMode::PROP
;
1668 aSpacing
.Height
= sal_Int16(sal_Int32(nDistance
) * 100 /240);
1674 aSpacing
.Mode
= style::LineSpacingMode::FIX
;
1675 aSpacing
.Height
= sal_Int16(ConversionHelper::convertTwipToMM100(-nDistance
));
1677 else if(nDistance
>0)
1679 aSpacing
.Mode
= style::LineSpacingMode::MINIMUM
;
1680 aSpacing
.Height
= sal_Int16(ConversionHelper::convertTwipToMM100(nDistance
));
1683 rContext
->Insert(PROP_PARA_LINE_SPACING
, true, uno::makeAny( aSpacing
));
1686 case 21 : // legacy version
1687 case NS_sprm::LN_PDyaBefore
: // sprmPDyaBefore
1688 rContext
->Insert(PROP_PARA_TOP_MARGIN
, true, uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue
) ));
1691 case NS_sprm::LN_PDyaAfter
: // sprmPDyaAfter
1692 rContext
->Insert(PROP_PARA_BOTTOM_MARGIN
, true, uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue
) ));
1695 case 23: //sprmPChgTabs
1696 case NS_sprm::LN_PChgTabs
: // sprmPChgTabs
1697 OSL_FAIL( "unhandled");
1698 //tabs of list level?
1700 case 24: // "sprmPFInTable"
1701 case NS_sprm::LN_PFInTable
:
1702 break; // sprmPFInTable
1703 case NS_sprm::LN_PTableDepth
: //sprmPTableDepth
1704 //not handled via sprm but via text( 0x07 )
1706 case 25: // "sprmPTtp" pap.fTtp
1707 case NS_sprm::LN_PFTtp
: // sprmPFTtp was: Read_TabRowEnd
1709 case 26: // "sprmPDxaAbs
1710 case NS_sprm::LN_PDxaAbs
:
1711 break; // sprmPDxaAbs
1712 case 27: //sprmPDyaAbs
1713 case NS_sprm::LN_PDyaAbs
:
1714 break; // sprmPDyaAbs
1715 case NS_sprm::LN_PDxaWidth
:
1716 break; // sprmPDxaWidth
1717 case NS_sprm::LN_PPc
:
1719 case NS_sprm::LN_PBrcTop10
:
1720 break; // sprmPBrcTop10
1721 case NS_sprm::LN_PBrcLeft10
:
1722 break; // sprmPBrcLeft10
1723 case NS_sprm::LN_PBrcBottom10
:
1724 break; // sprmPBrcBottom10
1725 case NS_sprm::LN_PBrcRight10
:
1726 break; // sprmPBrcRight10
1727 case NS_sprm::LN_PBrcBetween10
:
1728 break; // sprmPBrcBetween10
1729 case NS_sprm::LN_PBrcBar10
:
1730 break; // sprmPBrcBar10
1731 case NS_sprm::LN_PDxaFromText10
:
1732 break; // sprmPDxaFromText10
1733 case NS_sprm::LN_PWr
:
1736 case NS_ooxml::LN_CT_PrBase_pBdr
: //paragraph border
1737 resolveSprmProps(*this, rSprm
);
1739 case NS_sprm::LN_PBrcTop
: // sprmPBrcTop
1740 case NS_sprm::LN_PBrcLeft
: // sprmPBrcLeft
1741 case NS_sprm::LN_PBrcBottom
: // sprmPBrcBottom
1742 case NS_sprm::LN_PBrcRight
: // sprmPBrcRight
1743 case NS_sprm::LN_PBrcBetween
: // sprmPBrcBetween
1745 //in binary format the borders are directly provided in OOXML they are inside of properties
1746 if( IsOOXMLImport() || IsRTFImport() )
1748 writerfilter::Reference
<Properties
>::Pointer_t pProperties
= rSprm
.getProps();
1749 if( pProperties
.get())
1751 BorderHandlerPtr
pBorderHandler( new BorderHandler( true ) );
1752 pProperties
->resolve(*pBorderHandler
);
1753 PropertyIds eBorderId
= PropertyIds( 0 );
1754 PropertyIds eBorderDistId
= PropertyIds( 0 );
1757 case NS_sprm::LN_PBrcTop
:
1758 eBorderId
= PROP_TOP_BORDER
;
1759 eBorderDistId
= PROP_TOP_BORDER_DISTANCE
;
1761 case NS_sprm::LN_PBrcLeft
:
1762 eBorderId
= PROP_LEFT_BORDER
;
1763 eBorderDistId
= PROP_LEFT_BORDER_DISTANCE
;
1765 case NS_sprm::LN_PBrcBottom
:
1766 eBorderId
= PROP_BOTTOM_BORDER
;
1767 eBorderDistId
= PROP_BOTTOM_BORDER_DISTANCE
;
1769 case NS_sprm::LN_PBrcRight
:
1770 eBorderId
= PROP_RIGHT_BORDER
;
1771 eBorderDistId
= PROP_RIGHT_BORDER_DISTANCE
;
1773 case NS_sprm::LN_PBrcBetween
:
1779 rContext
->Insert( eBorderId
, true, uno::makeAny( pBorderHandler
->getBorderLine()) , true);
1781 rContext
->Insert(eBorderDistId
, true, uno::makeAny( pBorderHandler
->getLineDistance()), true);
1786 table::BorderLine2 aBorderLine
;
1787 sal_Int32 nLineDistance
= ConversionHelper::MakeBorderLine( nIntValue
, aBorderLine
);
1788 PropertyIds eBorderId
= PROP_LEFT_BORDER
;
1789 PropertyIds eBorderDistId
= PROP_LEFT_BORDER_DISTANCE
;
1792 case NS_sprm::LN_PBrcBetween
: // sprmPBrcBetween
1793 OSL_FAIL( "TODO: inner border is not handled");
1795 case NS_sprm::LN_PBrcLeft
: // sprmPBrcLeft
1796 eBorderId
= PROP_LEFT_BORDER
;
1797 eBorderDistId
= PROP_LEFT_BORDER_DISTANCE
;
1799 case NS_sprm::LN_PBrcRight
: // sprmPBrcRight
1800 eBorderId
= PROP_RIGHT_BORDER
;
1801 eBorderDistId
= PROP_RIGHT_BORDER_DISTANCE
;
1803 case NS_sprm::LN_PBrcTop
: // sprmPBrcTop
1804 eBorderId
= PROP_TOP_BORDER
;
1805 eBorderDistId
= PROP_TOP_BORDER_DISTANCE
;
1807 case NS_sprm::LN_PBrcBottom
: // sprmPBrcBottom
1809 eBorderId
= PROP_BOTTOM_BORDER
;
1810 eBorderDistId
= PROP_BOTTOM_BORDER_DISTANCE
;
1812 rContext
->Insert(eBorderId
, true, uno::makeAny( aBorderLine
));
1813 rContext
->Insert(eBorderDistId
, true, uno::makeAny( nLineDistance
));
1817 case NS_sprm::LN_PBorderTop
:
1818 case NS_sprm::LN_PBorderLeft
:
1819 case NS_sprm::LN_PBorderBottom
:
1820 case NS_sprm::LN_PBorderRight
:
1821 OSL_FAIL( "TODO: border color definition");
1823 case NS_sprm::LN_PBrcBar
:
1824 break; // sprmPBrcBar
1825 case NS_sprm::LN_PFNoAutoHyph
: // sprmPFNoAutoHyph
1826 rContext
->Insert(PROP_PARA_IS_HYPHENATION
, true, uno::makeAny( nIntValue
? false : true ));
1828 case NS_sprm::LN_PWHeightAbs
:
1829 break; // sprmPWHeightAbs
1830 case NS_sprm::LN_PDcs
:
1833 case NS_sprm::LN_PShd
: // sprmPShd
1835 //contains fore color, back color and shadow percentage, results in a brush
1836 writerfilter::Reference
<Properties
>::Pointer_t pProperties
= rSprm
.getProps();
1837 if( pProperties
.get())
1839 CellColorHandlerPtr
pCellColorHandler( new CellColorHandler
);
1840 pCellColorHandler
->setOutputFormat( CellColorHandler::Paragraph
);
1841 pProperties
->resolve(*pCellColorHandler
);
1842 rContext
->InsertProps(pCellColorHandler
->getProperties());
1846 case NS_sprm::LN_PDyaFromText
:
1847 break; // sprmPDyaFromText
1848 case NS_sprm::LN_PDxaFromText
:
1849 break; // sprmPDxaFromText
1850 case NS_sprm::LN_PFLocked
:
1851 break; // sprmPFLocked
1852 case NS_sprm::LN_PFWidowControl
:
1853 case NS_ooxml::LN_CT_PPrBase_widowControl
:
1855 uno::Any
aVal( uno::makeAny( sal_Int8(nIntValue
? 2 : 0 )));
1856 rContext
->Insert( PROP_PARA_WIDOWS
, true, aVal
);
1857 rContext
->Insert( PROP_PARA_ORPHANS
, true, aVal
);
1859 break; // sprmPFWidowControl
1860 case NS_sprm::LN_PRuler
:
1861 break; // sprmPRuler
1862 case NS_sprm::LN_PFKinsoku
:
1863 break; // sprmPFKinsoku
1864 case NS_sprm::LN_PFWordWrap
:
1865 break; // sprmPFWordWrap
1866 case NS_sprm::LN_PFOverflowPunct
: ; // sprmPFOverflowPunct - hanging punctuation
1867 rContext
->Insert(PROP_PARA_IS_HANGING_PUNCTUATION
, true, uno::makeAny( nIntValue
? false : true ));
1869 case NS_sprm::LN_PFTopLinePunct
:
1870 break; // sprmPFTopLinePunct
1871 case NS_sprm::LN_PFAutoSpaceDE
:
1872 break; // sprmPFAutoSpaceDE
1873 case NS_sprm::LN_PFAutoSpaceDN
:
1874 break; // sprmPFAutoSpaceDN
1875 case NS_sprm::LN_PWAlignFont
:
1877 sal_Int16 nAlignment
= 0;
1880 case NS_ooxml::LN_Value_wordprocessingml_ST_TextAlignment_top
:
1883 case NS_ooxml::LN_Value_wordprocessingml_ST_TextAlignment_center
:
1886 case NS_ooxml::LN_Value_wordprocessingml_ST_TextAlignment_baseline
:
1889 case NS_ooxml::LN_Value_wordprocessingml_ST_TextAlignment_bottom
:
1892 case NS_ooxml::LN_Value_wordprocessingml_ST_TextAlignment_auto
:
1896 rContext
->Insert( PROP_PARA_VERT_ALIGNMENT
, true, uno::makeAny( nAlignment
) );
1898 break; // sprmPWAlignFont
1899 case NS_sprm::LN_PFrameTextFlow
:
1900 break; // sprmPFrameTextFlow
1901 case NS_sprm::LN_PISnapBaseLine
:
1902 break; // sprmPISnapBaseLine
1903 case NS_sprm::LN_PAnld
:
1905 case NS_sprm::LN_PPropRMark
:
1906 break; // sprmPPropRMark
1907 case NS_sprm::LN_POutLvl
:
1909 sal_Int16 nLvl
= static_cast< sal_Int16
>( nIntValue
);
1910 if( m_pImpl
->IsStyleSheetImport() )
1913 StyleSheetPropertyMap
* pStyleSheetPropertyMap
= dynamic_cast< StyleSheetPropertyMap
* >( rContext
.get() );
1914 pStyleSheetPropertyMap
->SetOutlineLevel( nLvl
);
1918 nLvl
= nLvl
>= WW_OUTLINE_MIN
&& nLvl
< WW_OUTLINE_MAX
? nLvl
+1 : 0; //0 means no outline level set on
1919 rContext
->Insert(PROP_OUTLINE_LEVEL
, true, uno::makeAny ( nLvl
));
1922 break; // sprmPOutLvl
1923 case NS_sprm::LN_PFBiDi
:
1927 rContext
->Insert(PROP_WRITING_MODE
, false, uno::makeAny( text::WritingMode2::RL_TB
));
1928 rContext
->Insert(PROP_PARA_ADJUST
, false, uno::makeAny( style::ParagraphAdjust_RIGHT
));
1932 break; // sprmPFBiDi
1933 case NS_ooxml::LN_EG_SectPrContents_bidi
:
1934 if (pSectionContext
!= NULL
)
1935 pSectionContext
->Insert(PROP_WRITING_MODE
,false, uno::makeAny( text::WritingMode2::RL_TB
));
1937 case NS_sprm::LN_PFNumRMIns
:
1938 break; // sprmPFNumRMIns
1939 case NS_sprm::LN_PCrLf
:
1941 case NS_sprm::LN_PNumRM
:
1942 break; // sprmPNumRM
1943 case NS_sprm::LN_PHugePapx
:
1944 break; // sprmPHugePapx
1945 case NS_sprm::LN_PFUsePgsuSettings
:
1946 break; // sprmPFUsePgsuSettings
1947 case NS_sprm::LN_PFAdjustRight
:
1948 break; // sprmPFAdjustRight
1949 case NS_sprm::LN_CFRMarkDel
:
1950 break; // sprmCFRMarkDel
1951 case NS_sprm::LN_CFRMark
:
1952 break; // sprmCFRMark
1953 case NS_sprm::LN_CFFldVanish
:
1954 break; // sprmCFFldVanish
1955 case NS_sprm::LN_CFSpec
: // sprmCFSpec
1957 case NS_sprm::LN_CPicLocation
: // sprmCPicLocation
1958 //is being resolved on the tokenizer side
1960 case NS_sprm::LN_CIbstRMark
:
1961 break; // sprmCIbstRMark
1962 case NS_sprm::LN_CDttmRMark
:
1963 break; // sprmCDttmRMark
1964 case NS_sprm::LN_CFData
:
1965 break; // sprmCFData
1966 case NS_sprm::LN_CIdslRMark
:
1967 break; // sprmCIdslRMark
1968 case NS_sprm::LN_CChs
:
1970 case NS_sprm::LN_CSymbol
: // sprmCSymbol
1971 resolveSprmProps(*this, rSprm
); //resolves LN_FONT and LN_CHAR
1973 case NS_sprm::LN_CFOle2
:
1974 break; // sprmCFOle2
1975 case NS_sprm::LN_CIdCharType
:
1976 break; // sprmCIdCharType
1977 case NS_sprm::LN_CHighlight
:
1979 sal_Int32 nColor
= 0;
1980 if(true ==( mbIsHighlightSet
= getColorFromIndex(nIntValue
, nColor
)))
1981 rContext
->Insert(PROP_CHAR_BACK_COLOR
, true, uno::makeAny( nColor
));
1982 else if (mnBackgroundColor
)
1983 rContext
->Insert(PROP_CHAR_BACK_COLOR
, true, uno::makeAny( mnBackgroundColor
));
1985 break; // sprmCHighlight
1986 case NS_sprm::LN_CObjLocation
:
1987 break; // sprmCObjLocation
1988 case NS_sprm::LN_CFFtcAsciSymb
:
1989 break; // sprmCFFtcAsciSymb
1990 case NS_sprm::LN_CIstd
:
1992 case NS_sprm::LN_CIstdPermute
:
1993 break; // sprmCIstdPermute
1994 case NS_sprm::LN_CDefault
:
1995 break; // sprmCDefault
1996 case NS_sprm::LN_CPlain
:
1997 break; // sprmCPlain
1998 case NS_sprm::LN_CKcd
:
1999 rContext
->Insert(PROP_CHAR_EMPHASIS
, true, uno::makeAny ( getEmphasisValue (nIntValue
)));
2001 case NS_sprm::LN_CFEmboss
:// sprmCFEmboss
2002 case 60:// sprmCFBold
2003 case NS_sprm::LN_CFBoldBi
:// sprmCFBoldBi (offset 0x27 to normal bold)
2004 case NS_sprm::LN_CFItalicBi
:// sprmCFItalicBi (offset 0x27 to normal italic)
2005 case NS_sprm::LN_CFBold
: //sprmCFBold
2006 case 61: /*sprmCFItalic*/
2007 case NS_sprm::LN_CFItalic
: //sprmCFItalic
2008 case NS_sprm::LN_CFStrike
: //sprmCFStrike
2009 case NS_sprm::LN_CFOutline
: //sprmCFOutline
2010 case NS_sprm::LN_CFShadow
: //sprmCFShadow
2011 case NS_sprm::LN_CFSmallCaps
: //sprmCFSmallCaps
2012 case NS_sprm::LN_CFCaps
: //sprmCFCaps
2013 case NS_sprm::LN_CFVanish
: //sprmCFVanish
2014 case NS_sprm::LN_CFDStrike
: // sprmCFDStrike
2016 PropertyIds ePropertyId
= PROP_CHAR_WEIGHT
; //initialized to prevent warning!
2019 case 60:// sprmCFBold
2020 case NS_sprm::LN_CFBoldBi
: // sprmCFBoldBi
2021 case NS_sprm::LN_CFBold
: /*sprmCFBold*/
2022 ePropertyId
= nSprmId
!= NS_sprm::LN_CFBoldBi
? PROP_CHAR_WEIGHT
: PROP_CHAR_WEIGHT_COMPLEX
;
2024 case 61: /*sprmCFItalic*/
2025 case NS_sprm::LN_CFItalicBi
: // sprmCFItalicBi
2026 case NS_sprm::LN_CFItalic
: /*sprmCFItalic*/
2027 ePropertyId
= nSprmId
== 0x836 ? PROP_CHAR_POSTURE
: PROP_CHAR_POSTURE_COMPLEX
;
2029 case NS_sprm::LN_CFStrike
: /*sprmCFStrike*/
2030 case NS_sprm::LN_CFDStrike
: /*sprmCFDStrike double strike through*/
2031 ePropertyId
= PROP_CHAR_STRIKEOUT
;
2033 case NS_sprm::LN_CFOutline
: /*sprmCFOutline*/
2034 ePropertyId
= PROP_CHAR_CONTOURED
;
2036 case NS_sprm::LN_CFShadow
: /*sprmCFShadow*/
2037 ePropertyId
= PROP_CHAR_SHADOWED
;
2039 case NS_sprm::LN_CFSmallCaps
: /*sprmCFSmallCaps*/
2040 case NS_sprm::LN_CFCaps
: /*sprmCFCaps*/
2041 ePropertyId
= PROP_CHAR_CASE_MAP
;
2043 case NS_sprm::LN_CFVanish
: /*sprmCFVanish*/
2044 ePropertyId
= PROP_CHAR_HIDDEN
;
2046 case NS_sprm::LN_CFEmboss
: /*sprmCFEmboss*/
2047 ePropertyId
= PROP_CHAR_RELIEF
;
2050 //expected: 0,1,128,129
2051 if(nIntValue
!= 128) //inherited from paragraph - ignore
2053 if( nIntValue
== 129) //inverted style sheet value
2055 //get value from style sheet and invert it
2056 sal_Int16 nStyleValue
= 0;
2057 uno::Any aStyleVal
= m_pImpl
->GetPropertyFromStyleSheet(ePropertyId
);
2058 if( !aStyleVal
.hasValue() )
2060 nIntValue
= 0x83a == nSprmId
?
2063 else if(aStyleVal
.getValueTypeClass() == uno::TypeClass_FLOAT
)
2065 double fDoubleValue
= 0;
2066 //only in case of awt::FontWeight
2067 aStyleVal
>>= fDoubleValue
;
2068 nIntValue
= fDoubleValue
> 100. ? 0 : 1;
2070 else if((aStyleVal
>>= nStyleValue
) ||
2071 (nStyleValue
= (sal_Int16
)comphelper::getEnumAsINT32(aStyleVal
)) >= 0 )
2073 nIntValue
= 0x83a == nSprmId
?
2074 nStyleValue
? 0 : 4 :
2075 nStyleValue
? 0 : 1;
2079 OSL_FAIL( "what type was it");
2085 case 60:/*sprmCFBold*/
2086 case NS_sprm::LN_CFBold
: /*sprmCFBold*/
2087 case NS_sprm::LN_CFBoldBi
: // sprmCFBoldBi
2089 uno::Any
aBold( uno::makeAny( nIntValue
? awt::FontWeight::BOLD
: awt::FontWeight::NORMAL
) );
2091 rContext
->Insert(ePropertyId
, true, aBold
);
2092 if( nSprmId
!= NS_sprm::LN_CFBoldBi
) // sprmCFBoldBi
2093 rContext
->Insert(PROP_CHAR_WEIGHT_ASIAN
, true, aBold
);
2095 uno::Reference
<beans::XPropertySet
> xCharStyle(m_pImpl
->GetCurrentNumberingCharStyle());
2096 if (xCharStyle
.is())
2097 xCharStyle
->setPropertyValue(rPropNameSupplier
.GetName(PROP_CHAR_WEIGHT
), aBold
);
2100 case 61: /*sprmCFItalic*/
2101 case NS_sprm::LN_CFItalic
: /*sprmCFItalic*/
2102 case NS_sprm::LN_CFItalicBi
: // sprmCFItalicBi
2104 uno::Any
aPosture( uno::makeAny( nIntValue
? awt::FontSlant_ITALIC
: awt::FontSlant_NONE
) );
2105 rContext
->Insert( ePropertyId
, true, aPosture
);
2106 if( nSprmId
!= NS_sprm::LN_CFItalicBi
) // sprmCFItalicBi
2107 rContext
->Insert(PROP_CHAR_POSTURE_ASIAN
, true, aPosture
);
2110 case NS_sprm::LN_CFStrike
: /*sprmCFStrike*/
2111 rContext
->Insert(ePropertyId
, true,
2112 uno::makeAny( nIntValue
? awt::FontStrikeout::SINGLE
: awt::FontStrikeout::NONE
) );
2114 case NS_sprm::LN_CFDStrike
: /*sprmCFDStrike double strike through*/
2115 rContext
->Insert(ePropertyId
, true,
2116 uno::makeAny( nIntValue
? awt::FontStrikeout::DOUBLE
: awt::FontStrikeout::NONE
) );
2118 case NS_sprm::LN_CFOutline
: /*sprmCFOutline*/
2119 case NS_sprm::LN_CFShadow
: /*sprmCFShadow*/
2120 case NS_sprm::LN_CFVanish
: /*sprmCFVanish*/
2121 rContext
->Insert(ePropertyId
, true, uno::makeAny( nIntValue
? true : false ));
2123 case NS_sprm::LN_CFSmallCaps
: /*sprmCFSmallCaps*/
2124 rContext
->Insert(ePropertyId
, true,
2125 uno::makeAny( nIntValue
? style::CaseMap::SMALLCAPS
: style::CaseMap::NONE
));
2127 case NS_sprm::LN_CFCaps
: /*sprmCFCaps*/
2128 rContext
->Insert(ePropertyId
, true,
2129 uno::makeAny( nIntValue
? style::CaseMap::UPPERCASE
: style::CaseMap::NONE
));
2131 case NS_sprm::LN_CFEmboss
: /*sprmCFEmboss*/
2132 rContext
->Insert(ePropertyId
, true,
2133 uno::makeAny( nIntValue
? awt::FontRelief::EMBOSSED
: awt::FontRelief::NONE
));
2140 case NS_sprm::LN_CFtcDefault
:
2141 break; // sprmCFtcDefault
2142 case NS_sprm::LN_CKul
: // sprmCKul
2144 // Parameter: 0 = none, 1 = single, 2 = by Word,
2145 // 3 = double, 4 = dotted, 5 = hidden
2146 // 6 = thick, 7 = dash, 8 = dot(not used)
2147 // 9 = dotdash 10 = dotdotdash 11 = wave
2148 handleUnderlineType(nIntValue
, rContext
);
2151 case NS_sprm::LN_CSizePos
:
2152 break; // sprmCSizePos
2153 case NS_sprm::LN_CLid
:
2155 case NS_sprm::LN_CIco
:
2157 sal_Int32 nColor
= 0;
2158 if (getColorFromIndex(nIntValue
, nColor
))
2159 rContext
->Insert(PROP_CHAR_COLOR
, true, uno::makeAny( nColor
) );
2162 case NS_sprm::LN_CHpsBi
: // sprmCHpsBi
2163 case NS_sprm::LN_CHps
: // sprmCHps
2165 //multiples of half points (12pt == 24)
2166 double fVal
= double(nIntValue
) / 2.;
2167 uno::Any aVal
= uno::makeAny( fVal
);
2168 if( NS_sprm::LN_CHpsBi
== nSprmId
)
2170 rContext
->Insert( PROP_CHAR_HEIGHT_COMPLEX
, true, aVal
);
2172 else if (!m_pImpl
->m_bInTableStyleRunProps
)
2174 //Asian get the same value as Western
2175 rContext
->Insert( PROP_CHAR_HEIGHT
, true, aVal
);
2176 rContext
->Insert( PROP_CHAR_HEIGHT_ASIAN
, true, aVal
);
2178 uno::Reference
<beans::XPropertySet
> xCharStyle(m_pImpl
->GetCurrentNumberingCharStyle());
2179 if (xCharStyle
.is())
2180 xCharStyle
->setPropertyValue(rPropNameSupplier
.GetName(PROP_CHAR_HEIGHT
), aVal
);
2182 // Make sure char sizes defined in the stylesheets don't affect char props from direct formatting.
2183 if (!m_pImpl
->IsStyleSheetImport())
2184 m_pImpl
->deferCharacterProperty( nSprmId
, uno::makeAny( nIntValue
));
2187 case NS_sprm::LN_CHpsInc
:
2188 break; // sprmCHpsInc
2189 case NS_sprm::LN_CHpsPos
:
2190 // The spec says 0 is the same as the lack of the value, so don't parse that.
2192 m_pImpl
->deferCharacterProperty( nSprmId
, uno::makeAny( nIntValue
));
2193 break; // sprmCHpsPos
2194 case NS_sprm::LN_CHpsPosAdj
:
2195 break; // sprmCHpsPosAdj
2196 case NS_sprm::LN_CMajority
:
2197 break; // sprmCMajority
2198 case NS_sprm::LN_CIss
: // sprmCIss
2200 //sub/super script 1: super, 2: sub, 0: normal
2201 sal_Int16 nEscapement
= 0;
2202 sal_Int8 nProp
= 58;
2211 case 0: nProp
= 0;break; //none
2213 rContext
->Insert(PROP_CHAR_ESCAPEMENT
, true, uno::makeAny( nEscapement
) );
2214 rContext
->Insert(PROP_CHAR_ESCAPEMENT_HEIGHT
, true, uno::makeAny( nProp
) );
2217 case NS_sprm::LN_CHpsNew50
:
2218 break; // sprmCHpsNew50
2219 case NS_sprm::LN_CHpsInc1
:
2220 break; // sprmCHpsInc1
2221 case 71 : //"sprmCDxaSpace"
2222 case 96 : //"sprmCDxaSpace"
2223 case NS_sprm::LN_CDxaSpace
: // sprmCDxaSpace
2225 //Kerning half point values
2226 //TODO: there are two kerning values -
2227 // in ww8par6.cxx NS_sprm::LN_CHpsKern is used as boolean AutoKerning
2228 sal_Int16 nResult
= static_cast<sal_Int16
>(ConversionHelper::convertTwipToMM100(nIntValue
));
2229 if (m_pImpl
->IsInComments())
2231 nResult
= static_cast<sal_Int16
>(nIntValue
);
2233 rContext
->Insert(PROP_CHAR_CHAR_KERNING
, true, uno::makeAny(nResult
));
2236 case NS_sprm::LN_CHpsKern
: // sprmCHpsKern auto kerning is bound to a minimum font size in Word - but not in Writer :-(
2237 rContext
->Insert(PROP_CHAR_AUTO_KERNING
, true, uno::makeAny( sal_Bool(nIntValue
) ) );
2239 case NS_sprm::LN_CMajority50
:
2240 break; // sprmCMajority50
2241 case NS_sprm::LN_CHpsMul
:
2242 break; // sprmCHpsMul
2243 case NS_sprm::LN_CYsri
:
2245 case NS_sprm::LN_CRgFtc0
: // sprmCRgFtc0 //ascii font index
2246 case NS_sprm::LN_CRgFtc1
: // sprmCRgFtc1 //Asian font index
2247 case NS_sprm::LN_CRgFtc2
: // sprmCRgFtc2 //CTL font index
2248 case NS_sprm::LN_CFtcBi
: // sprmCFtcBi //font index of a CTL font
2250 FontTablePtr pFontTable
= m_pImpl
->GetFontTable();
2251 if(nIntValue
>= 0 && pFontTable
->size() > sal_uInt32(nIntValue
))
2253 PropertyIds eFontName
= PROP_CHAR_FONT_NAME
;
2254 PropertyIds eFontStyle
= PROP_CHAR_FONT_STYLE
;
2255 PropertyIds eFontFamily
= PROP_CHAR_FONT_FAMILY
;
2256 PropertyIds eFontCharSet
= PROP_CHAR_FONT_CHAR_SET
;
2257 PropertyIds eFontPitch
= PROP_CHAR_FONT_PITCH
;
2260 case NS_sprm::LN_CRgFtc0
:
2261 //already initialized
2263 case NS_sprm::LN_CRgFtc1
:
2264 eFontName
= PROP_CHAR_FONT_NAME_ASIAN
;
2265 eFontStyle
= PROP_CHAR_FONT_STYLE_ASIAN
;
2266 eFontFamily
= PROP_CHAR_FONT_FAMILY_ASIAN
;
2267 eFontCharSet
= PROP_CHAR_FONT_CHAR_SET_ASIAN
;
2268 eFontPitch
= PROP_CHAR_FONT_PITCH_ASIAN
;
2270 case NS_sprm::LN_CRgFtc2
:
2271 case NS_sprm::LN_CFtcBi
:
2272 eFontName
= PROP_CHAR_FONT_NAME_COMPLEX
;
2273 eFontStyle
= PROP_CHAR_FONT_STYLE_COMPLEX
;
2274 eFontFamily
= PROP_CHAR_FONT_FAMILY_COMPLEX
;
2275 eFontCharSet
= PROP_CHAR_FONT_CHAR_SET_COMPLEX
;
2276 eFontPitch
= PROP_CHAR_FONT_PITCH_COMPLEX
;
2281 const FontEntry::Pointer_t
pFontEntry(pFontTable
->getFontEntry(sal_uInt32(nIntValue
)));
2282 rContext
->Insert(eFontName
, true, uno::makeAny( pFontEntry
->sFontName
));
2283 rContext
->Insert(eFontCharSet
, true, uno::makeAny( (sal_Int16
)pFontEntry
->nTextEncoding
));
2284 rContext
->Insert(eFontPitch
, true, uno::makeAny( pFontEntry
->nPitchRequest
));
2288 case NS_sprm::LN_CCharScale
: // sprmCCharScale
2289 rContext
->Insert(PROP_CHAR_SCALE_WIDTH
, true,
2290 uno::makeAny( sal_Int16(nIntValue
) ));
2292 case NS_sprm::LN_CFImprint
: // sprmCFImprint 1 or 0
2293 // FontRelief: NONE, EMBOSSED, ENGRAVED
2294 rContext
->Insert(PROP_CHAR_RELIEF
, true,
2295 uno::makeAny( nIntValue
? awt::FontRelief::ENGRAVED
: awt::FontRelief::NONE
));
2297 case NS_sprm::LN_CFObj
:
2299 case NS_sprm::LN_CPropRMark
:
2300 break; // sprmCPropRMark
2301 case NS_sprm::LN_CSfxText
:
2302 // The file-format has many character animations. We have only
2303 // one, so we use it always. Suboptimal solution though.
2305 rContext
->Insert(PROP_CHAR_FLASH
, true, uno::makeAny( true ));
2307 rContext
->Insert(PROP_CHAR_FLASH
, true, uno::makeAny( false ));
2308 break; // sprmCSfxText
2309 case NS_sprm::LN_CFBiDi
:
2310 break; // sprmCFBiDi
2311 case NS_sprm::LN_CFDiacColor
:
2312 break; // sprmCFDiacColor
2313 case NS_sprm::LN_CIcoBi
:
2314 break; // sprmCIcoBi
2315 case NS_sprm::LN_CDispFldRMark
:
2316 break; // sprmCDispFldRMark
2317 case NS_sprm::LN_CIbstRMarkDel
:
2318 break; // sprmCIbstRMarkDel
2319 case NS_sprm::LN_CDttmRMarkDel
:
2320 break; // sprmCDttmRMarkDel
2321 case NS_sprm::LN_CBrc
:
2323 case NS_sprm::LN_CShd
:
2325 //contains fore color, back color and shadow percentage, results in a brush
2326 writerfilter::Reference
<Properties
>::Pointer_t pProperties
= rSprm
.getProps();
2327 if( pProperties
.get())
2329 CellColorHandlerPtr
pCellColorHandler( new CellColorHandler
);
2330 pCellColorHandler
->setOutputFormat( CellColorHandler::Character
);
2331 pProperties
->resolve(*pCellColorHandler
);
2332 rContext
->InsertProps(pCellColorHandler
->getProperties());
2336 case NS_sprm::LN_CIdslRMarkDel
:
2337 break; // sprmCIdslRMarkDel
2338 case NS_sprm::LN_CFUsePgsuSettings
:
2339 break; // sprmCFUsePgsuSettings
2340 case NS_sprm::LN_CCpg
:
2342 case NS_sprm::LN_CLidBi
: // sprmCLidBi language complex
2343 case NS_sprm::LN_CRgLid0_80
: // sprmCRgLid0_80 older language Western
2344 case NS_sprm::LN_CRgLid0
: // sprmCRgLid0 language Western
2345 case NS_sprm::LN_CRgLid1
: // sprmCRgLid1 language Asian
2346 case NS_sprm::LN_CRgLid1_80
: // sprmCRgLid1_80 older language Asian
2348 lang::Locale
aLocale( LanguageTag( (LanguageType
)nIntValue
).getLocale());
2350 PropertyIds aPropId
;
2353 case NS_sprm::LN_CRgLid0
:
2354 case NS_sprm::LN_CRgLid0_80
:
2355 aPropId
= PROP_CHAR_LOCALE
;
2357 case NS_sprm::LN_CRgLid1
:
2358 case NS_sprm::LN_CRgLid1_80
:
2359 aPropId
= PROP_CHAR_LOCALE_ASIAN
;
2362 aPropId
= PROP_CHAR_LOCALE_COMPLEX
;
2366 rContext
->Insert(aPropId
, true, uno::makeAny( aLocale
) );
2370 case NS_sprm::LN_CIdctHint
: // sprmCIdctHint
2371 //list table - text offset???
2373 case NS_sprm::LN_PicBrcl
:
2374 break; // sprmPicBrcl
2375 case NS_sprm::LN_PicScale
:
2376 break; // sprmPicScale
2377 case NS_sprm::LN_PicBrcTop
:
2378 break; // sprmPicBrcTop
2379 case NS_sprm::LN_PicBrcLeft
:
2380 break; // sprmPicBrcLeft
2381 case NS_sprm::LN_PicBrcBottom
:
2382 break; // sprmPicBrcBoConversionHelper::convertTwipToMM100ttom
2383 case NS_sprm::LN_PicBrcRight
:
2384 break; // sprmPicBrcRight
2385 case NS_sprm::LN_ScnsPgn
:
2386 break; // sprmScnsPgn
2387 case NS_sprm::LN_SiHeadingPgn
:
2388 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2390 pSectionContext
->SetEvenlySpaced( nIntValue
> 0 );
2392 break; // sprmSiHeadingPgn
2393 case NS_sprm::LN_SOlstAnm
:
2394 break; // sprmSOlstAnm
2396 case NS_sprm::LN_SDxaColWidth
: // sprmSDxaColWidth
2397 // contains the twip width of the column as 3-byte-code
2398 // the lowet byte contains the index
2399 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2401 pSectionContext
->AppendColumnWidth( ConversionHelper::convertTwipToMM100( (nIntValue
& 0xffff00) >> 8 ));
2403 case NS_sprm::LN_SDxaColSpacing
: // sprmSDxaColSpacing
2404 // the lowet byte contains the index
2405 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2407 pSectionContext
->AppendColumnSpacing( ConversionHelper::convertTwipToMM100( (nIntValue
& 0xffff00) >> 8 ));
2410 case NS_sprm::LN_SFEvenlySpaced
:
2411 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2413 pSectionContext
->SetEvenlySpaced( nIntValue
> 0 );
2414 break; // sprmSFEvenlySpaced
2415 case NS_sprm::LN_SFProtected
: // sprmSFProtected
2416 //todo: missing feature - unlocked sections in protected documents
2418 case NS_sprm::LN_SDmBinFirst
: // sprmSDmBinFirst
2419 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2421 pSectionContext
->SetFirstPaperBin(nIntValue
);
2423 case NS_sprm::LN_SDmBinOther
: // sprmSDmBinOther
2424 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2426 pSectionContext
->SetPaperBin( nIntValue
);
2428 case NS_sprm::LN_SBkc
: // sprmSBkc
2436 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2439 // Ignore continous section break at the end of the document, if the previous section had the same type as well
2440 // It makes the importer loose margin settings with no benefit
2441 SectionPropertyMap
* pLastContext
= m_pImpl
->GetLastSectionContext();
2442 int nPrevBreakType
= 0;
2443 bool bHasPrevSection
= false;
2446 bHasPrevSection
= true;
2447 nPrevBreakType
= pLastContext
->GetBreakType();
2449 if (m_pImpl
->GetParaSectpr() || nIntValue
!= 0 || (bHasPrevSection
&& nPrevBreakType
!= nIntValue
))
2450 pSectionContext
->SetBreakType( nIntValue
);
2454 case NS_sprm::LN_SFTitlePage
: // sprmSFTitlePage
2455 case NS_ooxml::LN_EG_SectPrContents_titlePg
:
2457 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2459 pSectionContext
->SetTitlePage( nIntValue
> 0 ? true : false );//section has title page
2463 case NS_sprm::LN_SCcolumns
: // sprmSCcolumns
2465 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2467 pSectionContext
->SetColumnCount( (sal_Int16
) nIntValue
);
2470 case NS_sprm::LN_SDxaColumns
: // sprmSDxaColumns
2471 //column distance - default 708 twip
2472 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2474 pSectionContext
->SetColumnDistance( ConversionHelper::convertTwipToMM100( nIntValue
) );
2476 case NS_sprm::LN_SFAutoPgn
:
2477 break; // sprmSFAutoPgn
2479 case NS_sprm::LN_SNfcPgn
: // sprmSNfcPgn
2480 //page numbering 0 - Arab, 1 - ROMAN, 2 - roman, 3 - ABC, 4 abc
2481 sal_Int16 nNumbering
;
2484 case 1: nNumbering
= style::NumberingType::ROMAN_UPPER
;break;
2485 case 2: nNumbering
= style::NumberingType::ROMAN_LOWER
;break;
2486 case 3: nNumbering
= style::NumberingType::CHARS_UPPER_LETTER
;break;
2487 case 4: nNumbering
= style::NumberingType::CHARS_LOWER_LETTER
;break;
2490 nNumbering
= style::NumberingType::ARABIC
;
2492 rContext
->Insert( PROP_NUMBERING_TYPE
, false, uno::makeAny( nNumbering
) );
2494 case NS_sprm::LN_SDyaPgn
:
2495 break; // sprmSDyaPgn
2496 case NS_sprm::LN_SDxaPgn
:
2497 break; // sprmSDxaPgn
2499 case NS_sprm::LN_SFPgnRestart
: // sprmSFPgnRestart
2501 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2503 pSectionContext
->SetPageNoRestart( nIntValue
> 0 );
2506 case NS_sprm::LN_SFEndnote
:
2507 break; // sprmSFEndnote
2509 case NS_sprm::LN_SNLnnMod
:// sprmSNLnnMod
2510 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2511 if( pSectionContext
)
2512 pSectionContext
->SetLnnMod( nIntValue
);
2515 case NS_sprm::LN_SDxaLnn
: // sprmSDxaLnn
2516 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2517 if( pSectionContext
)
2518 pSectionContext
->SetdxaLnn( nIntValue
);
2521 case NS_sprm::LN_SLnc
:// sprmSLnc
2522 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2523 if( pSectionContext
)
2524 pSectionContext
->SetLnc( nIntValue
);
2527 case NS_sprm::LN_SLnnMin
: // sprmSLnnMin
2528 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2529 if( pSectionContext
)
2530 pSectionContext
->SetLnnMin( nIntValue
);
2533 case NS_sprm::LN_SGprfIhdt
:
2534 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2535 //flags about header/footer sharing and footnotes?
2537 * WW8_HEADER_EVEN = 0x01, WW8_HEADER_ODD = 0x02, WW8_FOOTER_EVEN = 0x04,
2538 * WW8_FOOTER_ODD = 0x08, WW8_HEADER_FIRST = 0x10, WW8_FOOTER_FIRST = 0x20
2541 break; // sprmSGprfIhdt
2542 case NS_sprm::LN_SDyaHdrTop
: // sprmSDyaHdrTop
2544 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2546 pSectionContext
->SetHeaderTop( ConversionHelper::convertTwipToMM100( nIntValue
));
2548 case NS_sprm::LN_SDyaHdrBottom
: // sprmSDyaHdrBottom
2550 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2552 pSectionContext
->SetHeaderBottom( ConversionHelper::convertTwipToMM100( nIntValue
) );
2555 case NS_sprm::LN_SLBetween
: // sprmSLBetween
2556 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2558 pSectionContext
->SetSeparatorLine( nIntValue
> 0 );
2560 case NS_sprm::LN_SVjc
:
2563 case NS_sprm::LN_SPgnStart
: // sprmSPgnStart
2565 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2567 pSectionContext
->SetPageNumber( nIntValue
);
2570 case NS_sprm::LN_SBOrientation
:
2571 //todo: the old filter assumed that a value of 2 points to double-pages layout
2572 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2574 pSectionContext
->SetLandscape( nIntValue
> 0 );
2575 rContext
->Insert( PROP_IS_LANDSCAPE
, false, uno::makeAny( nIntValue
> 0 ));
2576 break; // sprmSBOrientation
2577 case NS_sprm::LN_SBCustomize
:
2578 break; // sprmSBCustomize
2580 case NS_sprm::LN_SYaPage
: // sprmSYaPage
2582 //page height, rounded to default values, default: 0x3dc0 twip
2583 sal_Int32 nHeight
= ConversionHelper::convertTwipToMM100( nIntValue
);
2584 rContext
->Insert( PROP_HEIGHT
, false, uno::makeAny( PaperInfo::sloppyFitPageDimension( nHeight
) ) );
2587 case NS_sprm::LN_SXaPage
: // sprmSXaPage
2589 //page width, rounded to default values, default 0x2fd0 twip
2590 sal_Int32 nWidth
= ConversionHelper::convertTwipToMM100( nIntValue
);
2591 rContext
->Insert( PROP_WIDTH
, false, uno::makeAny( PaperInfo::sloppyFitPageDimension( nWidth
) ) );
2595 case NS_sprm::LN_SDxaLeft
: // sprmSDxaLeft
2597 //left page margin default 0x708 twip
2598 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2599 sal_Int32 nConverted
= ConversionHelper::convertTwipToMM100( nIntValue
);
2601 pSectionContext
->SetLeftMargin( nConverted
);
2602 rContext
->Insert( PROP_LEFT_MARGIN
, false, uno::makeAny( nConverted
));
2606 case NS_sprm::LN_SDxaRight
: // sprmSDxaRight
2608 //right page margin default 0x708 twip
2609 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2610 sal_Int32 nConverted
= ConversionHelper::convertTwipToMM100( nIntValue
);
2612 pSectionContext
->SetRightMargin( nConverted
);
2613 rContext
->Insert( PROP_RIGHT_MARGIN
, false, uno::makeAny( nConverted
));
2617 case NS_sprm::LN_SDyaTop
: // sprmSDyaTop
2619 //top page margin default 1440 twip
2620 //todo: check cast of SVBT16
2621 sal_Int32 nConverted
= ConversionHelper::convertTwipToMM100( static_cast< sal_Int16
>( nIntValue
) );
2622 rContext
->Insert( PROP_TOP_MARGIN
, false, uno::makeAny( nConverted
) );
2623 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2625 pSectionContext
->SetTopMargin( nConverted
);
2629 case NS_sprm::LN_SDyaBottom
: // sprmSDyaBottom
2631 //bottom page margin default 1440 twip
2632 //todo: check cast of SVBT16
2633 sal_Int32 nConverted
= ConversionHelper::convertTwipToMM100( static_cast< sal_Int16
>( nIntValue
) );
2634 rContext
->Insert( PROP_BOTTOM_MARGIN
, false, uno::makeAny( nConverted
) );
2635 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2637 pSectionContext
->SetBottomMargin( nConverted
);
2641 case NS_sprm::LN_SDzaGutter
: // sprmSDzaGutter
2643 // gutter is added to one of the margins of a section depending on RTL, can be placed on top either
2644 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2647 pSectionContext
->SetDzaGutter( ConversionHelper::convertTwipToMM100( nIntValue
) );
2651 case NS_sprm::LN_SDmPaperReq
: // sprmSDmPaperReq
2652 //paper code - no handled in old filter
2654 case NS_sprm::LN_SPropRMark
:
2655 break; // sprmSPropRMark
2656 case NS_sprm::LN_SFBiDi
:// sprmSFBiDi
2658 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2660 pSectionContext
->SetSFBiDi( nIntValue
> 0 );
2663 case NS_sprm::LN_SFFacingCol
:
2664 break; // sprmSFFacingCol
2665 case NS_sprm::LN_SFRTLGutter
: // sprmSFRTLGutter
2667 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2669 pSectionContext
->SetGutterRTL( nIntValue
> 0 );
2672 case NS_sprm::LN_SBrcTop
: // sprmSBrcTop
2673 case NS_sprm::LN_SBrcLeft
: // sprmSBrcLeft
2674 case NS_sprm::LN_SBrcBottom
: // sprmSBrcBottom
2675 case NS_sprm::LN_SBrcRight
: // sprmSBrcRight
2677 table::BorderLine2 aBorderLine
;
2678 sal_Int32 nLineDistance
= ConversionHelper::MakeBorderLine( nIntValue
, aBorderLine
);
2679 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2682 static const BorderPosition aPositions
[4] =
2689 pSectionContext
->SetBorder( aPositions
[nSprmId
- NS_sprm::LN_SBrcTop
], nLineDistance
, aBorderLine
, /*bShadow =*/ false );
2694 case NS_sprm::LN_SPgbProp
: // sprmSPgbProp
2696 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2699 pSectionContext
->ApplyBorderToPageStyles( m_pImpl
->GetPageStyles(), m_pImpl
->GetTextFactory(), nIntValue
);
2703 case NS_sprm::LN_SDxtCharSpace
:
2705 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2708 pSectionContext
->SetDxtCharSpace( nIntValue
);
2711 break; // sprmSDxtCharSpace
2712 case NS_sprm::LN_SDyaLinePitch
: // sprmSDyaLinePitch
2714 //see SwWW8ImplReader::SetDocumentGrid
2715 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2718 pSectionContext
->SetGridLinePitch( ConversionHelper::convertTwipToMM100( nIntValue
) );
2722 case 0x703a: //undocumented, grid related?
2723 OSL_FAIL( "TODO: not handled yet"); //nIntValue like 0x008a2373 ?
2725 case NS_sprm::LN_SClm
:
2727 sal_Int16 nGridType
= text::TextGridMode::NONE
;
2731 nGridType
= text::TextGridMode::NONE
;
2734 //Text snaps to char grid, this doesn't make a lot of sense to
2735 //me. This is closer than LINES_CHARS
2736 nGridType
= text::TextGridMode::LINES
;
2739 nGridType
= text::TextGridMode::LINES_AND_CHARS
;
2742 nGridType
= text::TextGridMode::LINES
;
2746 rContext
->Insert( PROP_GRID_MODE
, false, uno::makeAny( nGridType
) );
2748 //Seems to force this behaviour in word ?
2749 if(nGridType
!= text::TextGridMode::NONE
)
2750 m_pImpl
->SetDocumentSettingsProperty(
2751 PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_ADD_EXTERNAL_LEADING
),
2752 uno::makeAny( true ) );
2755 case NS_sprm::LN_STextFlow
:
2756 case NS_ooxml::LN_EG_SectPrContents_textDirection
:
2758 /* 0 HoriLR 1 Vert TR 2 Vert TR 3 Vert TT 4 HoriLT
2759 only 0 and 1 can be imported correctly
2761 sal_Int16 nDirection
= text::WritingMode_LR_TB
;
2766 nDirection
= text::WritingMode_LR_TB
;
2771 nDirection
= text::WritingMode_TB_RL
;
2776 PropertyMap
* pTargetContext
= rContext
.get();
2778 if (pSectionContext
!= NULL
&&
2779 nSprmId
== NS_ooxml::LN_EG_SectPrContents_textDirection
)
2781 pTargetContext
= pSectionContext
;
2784 pTargetContext
->Insert(PROP_WRITING_MODE
, false, uno::makeAny( nDirection
) );
2786 break; // sprmSTextFlow
2787 case NS_sprm::LN_TJc
: // sprmTJc
2788 case NS_sprm::LN_TDxaLeft
:
2789 case NS_sprm::LN_TDxaGapHalf
:
2790 case NS_sprm::LN_TFCantSplit
:
2791 case NS_sprm::LN_TTableHeader
:
2792 case NS_sprm::LN_TTableBorders
: // sprmTTableBorders
2794 OSL_FAIL( "table propeties should be handled by the table manager");
2797 case NS_sprm::LN_TDefTable10
:
2798 break; // sprmTDefTable10
2799 case NS_sprm::LN_TDyaRowHeight
:
2800 break; // sprmTDyaRowHeight
2801 case NS_sprm::LN_TDefTable
:
2802 break; // sprmTDefTable
2803 case NS_sprm::LN_TDefTableShd
:
2804 break; // sprmTDefTableShd
2805 case NS_sprm::LN_TTlp
:
2807 case NS_sprm::LN_TFBiDi
:
2808 break; // sprmTFBiDi
2809 case NS_sprm::LN_THTMLProps
:
2810 break; // sprmTHTMLProps
2811 case NS_sprm::LN_TSetBrc
:
2812 break; // sprmTSetBrc
2813 case NS_sprm::LN_TInsert
:
2814 break; // sprmTInsert
2815 case NS_sprm::LN_TDelete
:
2816 break; // sprmTDelete
2817 case NS_sprm::LN_TDxaCol
:
2818 break; // sprmTDxaCol
2819 case NS_sprm::LN_TMerge
:
2820 break; // sprmTMerge
2821 case NS_sprm::LN_TSplit
:
2822 break; // sprmTSplit
2823 case NS_sprm::LN_TSetBrc10
:
2824 break; // sprmTSetBrc10
2825 case 164: // sprmTSetShd
2826 case NS_sprm::LN_TSetShd
:
2827 break; // sprmTSetShd
2828 case NS_sprm::LN_TSetShdOdd
:
2829 break; // sprmTSetShdOdd
2830 case NS_sprm::LN_TTextFlow
:
2831 break; // sprmTTextFlow
2832 case NS_sprm::LN_TDiagLine
:
2833 break; // sprmTDiagLine
2834 case NS_sprm::LN_TVertMerge
:
2835 break; // sprmTVertMerge
2836 case NS_sprm::LN_TVertAlign
:
2837 break; // sprmTVertAlign
2838 // the following are not part of the official documentation
2839 case 0x6870: //TxtForeColor
2841 //contains a color as 0xTTRRGGBB while SO uses 0xTTRRGGBB
2842 sal_Int32 nColor
= ConversionHelper::ConvertColor(nIntValue
);
2843 rContext
->Insert(PROP_CHAR_COLOR
, true, uno::makeAny( nColor
) );
2846 case 0x6877: //underlining color
2848 rContext
->Insert(PROP_CHAR_UNDERLINE_HAS_COLOR
, true, uno::makeAny( true ) );
2849 rContext
->Insert(PROP_CHAR_UNDERLINE_COLOR
, true, uno::makeAny( nIntValue
) );
2853 break; //undocumented
2854 case NS_sprm::LN_CIndrsid
:
2855 break; //undocumented
2857 break; //undocumented
2859 break; //undocumented
2860 case 0xd634: // sprmTNewSpacing - table spacing ( see WW8TabBandDesc::ProcessSpacing() )
2862 case NS_sprm::LN_TTRLeft
:
2863 break; //undocumented
2866 //properties of list levels - undocumented
2872 break;//undocumented section properties
2873 case NS_sprm::LN_CEastAsianLayout
:
2874 resolveSprmProps(*this, rSprm
);
2876 case NS_ooxml::LN_CT_Tabs_tab
:
2877 resolveSprmProps(*this, rSprm
);
2878 m_pImpl
->IncorporateTabStop(m_pImpl
->m_aCurrentTabStop
);
2879 m_pImpl
->m_aCurrentTabStop
= DeletableTabStop();
2881 case NS_ooxml::LN_CT_PPrBase_tabs
:
2883 // Initialize tab stop vector from style sheet
2884 if( !m_pImpl
->IsStyleSheetImport() )
2886 uno::Any aValue
= m_pImpl
->GetPropertyFromStyleSheet(PROP_PARA_TAB_STOPS
);
2887 uno::Sequence
< style::TabStop
> aStyleTabStops
;
2888 if(aValue
>>= aStyleTabStops
)
2890 m_pImpl
->InitTabStopFromStyle( aStyleTabStops
);
2893 resolveSprmProps(*this, rSprm
);
2894 rContext
->Insert(PROP_PARA_TAB_STOPS
, true, uno::makeAny( m_pImpl
->GetCurrentTabStopAndClear()));
2898 case NS_ooxml::LN_CT_DocDefaults_pPrDefault
:
2899 case NS_ooxml::LN_CT_DocDefaults_rPrDefault
:
2900 GetStyleSheetTable()->sprm( rSprm
);
2902 case NS_ooxml::LN_CT_PPr_sectPr
:
2903 case NS_ooxml::LN_EG_RPrBase_color
:
2904 case NS_ooxml::LN_EG_RPrBase_rFonts
:
2905 case NS_ooxml::LN_EG_RPrBase_bdr
:
2906 case NS_ooxml::LN_EG_RPrBase_eastAsianLayout
:
2907 case NS_ooxml::LN_EG_RPrBase_u
:
2908 case NS_ooxml::LN_EG_RPrBase_lang
:
2909 case NS_ooxml::LN_CT_PPrBase_spacing
:
2910 case NS_ooxml::LN_CT_PPrBase_ind
:
2911 case NS_ooxml::LN_CT_RPrDefault_rPr
:
2912 case NS_ooxml::LN_CT_PPrDefault_pPr
:
2913 case NS_ooxml::LN_CT_Style_pPr
:
2914 case NS_ooxml::LN_CT_Style_rPr
:
2915 case NS_ooxml::LN_CT_PPr_rPr
:
2916 case NS_ooxml::LN_CT_PPrBase_numPr
:
2917 if (nSprmId
== NS_ooxml::LN_CT_PPr_sectPr
)
2918 m_pImpl
->SetParaSectpr(true);
2919 resolveSprmProps(*this, rSprm
);
2921 case NS_ooxml::LN_EG_SectPrContents_footnotePr
:
2922 case NS_ooxml::LN_EG_SectPrContents_endnotePr
:
2923 m_pImpl
->SetInFootnoteProperties( NS_ooxml::LN_EG_SectPrContents_footnotePr
== nSprmId
);
2924 resolveSprmProps(*this, rSprm
);
2926 case NS_ooxml::LN_EG_SectPrContents_lnNumType
:
2928 resolveSprmProps(*this, rSprm
);
2929 LineNumberSettings aSettings
= m_pImpl
->GetLineNumberSettings();
2930 aSettings
.bIsOn
= true;
2931 m_pImpl
->SetLineNumberSettings( aSettings
);
2932 //apply settings at XLineNumberingProperties
2935 uno::Reference
< text::XLineNumberingProperties
> xLineNumberingProperties( m_pImpl
->GetTextDocument(), uno::UNO_QUERY_THROW
);
2936 uno::Reference
< beans::XPropertySet
> xLineNumberingPropSet
= xLineNumberingProperties
->getLineNumberingProperties();
2937 PropertyNameSupplier
& rNameSupplier
= PropertyNameSupplier::GetPropertyNameSupplier();
2938 xLineNumberingPropSet
->setPropertyValue(rNameSupplier
.GetName( PROP_IS_ON
), uno::makeAny(true) );
2939 if( aSettings
.nInterval
)
2940 xLineNumberingPropSet
->setPropertyValue(rNameSupplier
.GetName( PROP_INTERVAL
), uno::makeAny((sal_Int16
)aSettings
.nInterval
) );
2941 if( aSettings
.nDistance
)
2942 xLineNumberingPropSet
->setPropertyValue(rNameSupplier
.GetName( PROP_DISTANCE
), uno::makeAny(aSettings
.nDistance
) );
2943 xLineNumberingPropSet
->setPropertyValue(rNameSupplier
.GetName( PROP_RESTART_AT_EACH_PAGE
), uno::makeAny(aSettings
.bRestartAtEachPage
) );
2945 catch( const uno::Exception
& )
2951 case NS_ooxml::LN_CT_PPrBase_framePr
:
2952 // Avoid frames if we're inside a structured document tag, would just cause outer tables fail to create.
2953 if (!m_pImpl
->GetSdt())
2955 PropertyMapPtr pContext
= m_pImpl
->GetTopContextOfType(CONTEXT_PARAGRAPH
);
2956 if( pContext
.get() )
2958 ParagraphPropertyMap
* pParaContext
= dynamic_cast< ParagraphPropertyMap
* >( pContext
.get() );
2959 pParaContext
->SetFrameMode();
2963 //TODO: What about style sheet import of frame properties
2965 resolveSprmProps(*this, rSprm
);
2968 case NS_ooxml::LN_EG_SectPrContents_pgSz
:
2971 PaperInfo
aLetter(PAPER_LETTER
);
2972 CT_PageSz
.w
= aLetter
.getWidth();
2973 CT_PageSz
.h
= aLetter
.getHeight();
2975 CT_PageSz
.orient
= false;
2976 resolveSprmProps(*this, rSprm
);
2977 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2980 pSectionContext
->Insert( PROP_HEIGHT
, false, uno::makeAny( CT_PageSz
.h
) );
2981 pSectionContext
->Insert( PROP_IS_LANDSCAPE
, false, uno::makeAny( CT_PageSz
.orient
));
2982 pSectionContext
->Insert( PROP_WIDTH
, false, uno::makeAny( CT_PageSz
.w
) );
2983 pSectionContext
->SetLandscape( CT_PageSz
.orient
);
2987 case NS_ooxml::LN_EG_SectPrContents_pgMar
:
2988 m_pImpl
->InitPageMargins();
2989 resolveSprmProps(*this, rSprm
);
2990 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
2993 const _PageMar
& rPageMar
= m_pImpl
->GetPageMargins();
2994 pSectionContext
->SetTopMargin( rPageMar
.top
);
2995 pSectionContext
->SetRightMargin( rPageMar
.right
);
2996 pSectionContext
->SetBottomMargin( rPageMar
.bottom
);
2997 pSectionContext
->SetLeftMargin( rPageMar
.left
);
2998 pSectionContext
->SetHeaderTop( rPageMar
.header
);
2999 pSectionContext
->SetHeaderBottom( rPageMar
.footer
);
3003 case NS_ooxml::LN_EG_SectPrContents_cols
:
3005 writerfilter::Reference
<Properties
>::Pointer_t pProperties
= rSprm
.getProps();
3006 if( pProperties
.get())
3009 SectionColumnHandlerPtr
pSectHdl( new SectionColumnHandler
);
3010 pProperties
->resolve(*pSectHdl
);
3013 if( pSectHdl
->IsEqualWidth() )
3015 pSectionContext
->SetEvenlySpaced( true );
3016 pSectionContext
->SetColumnCount( (sal_Int16
) (pSectHdl
->GetNum() - 1) );
3017 pSectionContext
->SetColumnDistance( pSectHdl
->GetSpace() );
3018 pSectionContext
->SetSeparatorLine( pSectHdl
->IsSeparator() );
3020 else if( !pSectHdl
->GetColumns().empty() )
3022 pSectionContext
->SetEvenlySpaced( false );
3023 pSectionContext
->SetColumnDistance( pSectHdl
->GetSpace() );
3024 pSectionContext
->SetColumnCount( (sal_Int16
)(pSectHdl
->GetColumns().size() -1));
3025 std::vector
<_Column
>::const_iterator tmpIter
= pSectHdl
->GetColumns().begin();
3026 for (; tmpIter
!= pSectHdl
->GetColumns().end(); ++tmpIter
)
3028 pSectionContext
->AppendColumnWidth( tmpIter
->nWidth
);
3029 if ((tmpIter
!= pSectHdl
->GetColumns().end() - 1) || (tmpIter
->nSpace
> 0))
3030 pSectionContext
->AppendColumnSpacing( tmpIter
->nSpace
);
3032 pSectionContext
->SetSeparatorLine( pSectHdl
->IsSeparator() );
3034 else if( pSectHdl
->GetNum() > 0 )
3036 pSectionContext
->SetColumnCount( (sal_Int16
)pSectHdl
->GetNum() - 1 );
3037 pSectionContext
->SetColumnDistance( pSectHdl
->GetSpace() );
3043 case NS_ooxml::LN_EG_SectPrContents_docGrid
:
3044 resolveSprmProps(*this, rSprm
);
3046 case NS_ooxml::LN_EG_SectPrContents_pgBorders
:
3048 writerfilter::Reference
<Properties
>::Pointer_t pProperties
= rSprm
.getProps();
3049 if( pProperties
.get( ) && pSectionContext
)
3051 PageBordersHandlerPtr
pHandler( new PageBordersHandler
);
3052 pProperties
->resolve( *pHandler
);
3054 // Set the borders to the context and apply them to the styles
3055 pHandler
->SetBorders( pSectionContext
);
3056 pSectionContext
->SetBorderParams( pHandler
->GetDisplayOffset( ) );
3061 case NS_ooxml::LN_CT_PPrBase_pStyle
:
3063 m_pImpl
->SetCurrentParaStyleId( sStringValue
);
3064 StyleSheetTablePtr pStyleTable
= m_pImpl
->GetStyleSheetTable();
3065 const OUString sConvertedStyleName
= pStyleTable
->ConvertStyleName( sStringValue
, true );
3066 if (m_pImpl
->GetTopContext() && m_pImpl
->GetTopContextType() != CONTEXT_SECTION
)
3067 m_pImpl
->GetTopContext()->Insert( PROP_PARA_STYLE_NAME
, true, uno::makeAny( sConvertedStyleName
));
3068 //apply numbering to paragraph if it was set at the style, but only if the paragraph itself
3069 //does not specify the numbering
3070 if( rContext
->find( PropertyDefinition( PROP_NUMBERING_RULES
, true )) == rContext
->end()) // !contains
3072 const StyleSheetEntryPtr pEntry
= pStyleTable
->FindStyleSheetByISTD(sStringValue
);
3073 OSL_ENSURE( pEntry
.get(), "no style sheet found" );
3074 const StyleSheetPropertyMap
* pStyleSheetProperties
= dynamic_cast<const StyleSheetPropertyMap
*>(pEntry
? pEntry
->pProperties
.get() : 0);
3076 if( pStyleSheetProperties
&& pStyleSheetProperties
->GetListId() >= 0 )
3078 rContext
->Insert( PROP_NUMBERING_STYLE_NAME
, true, uno::makeAny(
3079 ListDef::GetStyleName( pStyleSheetProperties
->GetListId( ) ) ), false);
3081 // We're inheriting properties from a numbering style. Make sure a possible right margin is inherited from the base style.
3082 sal_Int32 nParaRightMargin
= 0;
3083 if (!pEntry
->sBaseStyleIdentifier
.isEmpty())
3085 const StyleSheetEntryPtr pParent
= pStyleTable
->FindStyleSheetByISTD(pEntry
->sBaseStyleIdentifier
);
3086 const StyleSheetPropertyMap
* pParentProperties
= dynamic_cast<const StyleSheetPropertyMap
*>(pParent
? pParent
->pProperties
.get() : 0);
3087 if (pParentProperties
->find( PropertyDefinition( PROP_PARA_RIGHT_MARGIN
, true )) != pParentProperties
->end())
3088 nParaRightMargin
= pParentProperties
->find( PropertyDefinition( PROP_PARA_RIGHT_MARGIN
, true ))->second
.get
<sal_Int32
>();
3090 if (nParaRightMargin
!= 0)
3092 // If we're setting the right margin, we should set the first / left margin as well from the numbering style.
3093 sal_Int32 nFirstLineIndent
= lcl_getCurrentNumberingProperty(m_pImpl
->GetCurrentNumberingRules(), pStyleSheetProperties
->GetListLevel(), "FirstLineIndent");
3094 sal_Int32 nParaLeftMargin
= lcl_getCurrentNumberingProperty(m_pImpl
->GetCurrentNumberingRules(), pStyleSheetProperties
->GetListLevel(), "IndentAt");
3095 if (nFirstLineIndent
!= 0)
3096 rContext
->Insert(PROP_PARA_FIRST_LINE_INDENT
, true, uno::makeAny(nFirstLineIndent
));
3097 if (nParaLeftMargin
!= 0)
3098 rContext
->Insert(PROP_PARA_LEFT_MARGIN
, true, uno::makeAny(nParaLeftMargin
));
3100 rContext
->Insert(PROP_PARA_RIGHT_MARGIN
, true, uno::makeAny(nParaRightMargin
));
3104 if( pStyleSheetProperties
&& pStyleSheetProperties
->GetListLevel() >= 0 )
3105 rContext
->Insert( PROP_NUMBERING_LEVEL
, true, uno::makeAny(pStyleSheetProperties
->GetListLevel()), false);
3109 case NS_ooxml::LN_EG_RPrBase_rStyle
:
3111 OUString
sConvertedName( m_pImpl
->GetStyleSheetTable()->ConvertStyleName( sStringValue
, true ) );
3112 // First check if the style exists in the document.
3113 StyleSheetEntryPtr pEntry
= m_pImpl
->GetStyleSheetTable( )->FindStyleSheetByStyleName( sConvertedName
);
3114 bool bExists
= pEntry
.get( ) && ( pEntry
->nStyleTypeCode
== STYLE_TYPE_CHAR
);
3116 // Add the property if the style exists
3117 if ( bExists
&& m_pImpl
->GetTopContext() )
3118 m_pImpl
->GetTopContext()->Insert( PROP_CHAR_STYLE_NAME
, true, uno::makeAny( sConvertedName
) );
3121 case NS_ooxml::LN_CT_TblPrBase_tblCellMar
: //cell margins
3123 resolveSprmProps(*this, rSprm
);//contains LN_CT_TblCellMar_top, LN_CT_TblCellMar_left, LN_CT_TblCellMar_bottom, LN_CT_TblCellMar_right
3126 case NS_ooxml::LN_CT_TblCellMar_top
:
3127 case NS_ooxml::LN_CT_TblCellMar_start
:
3128 case NS_ooxml::LN_CT_TblCellMar_left
:
3129 case NS_ooxml::LN_CT_TblCellMar_bottom
:
3130 case NS_ooxml::LN_CT_TblCellMar_end
:
3131 case NS_ooxml::LN_CT_TblCellMar_right
:
3133 writerfilter::Reference
<Properties
>::Pointer_t pProperties
= rSprm
.getProps();
3134 if( pProperties
.get())
3136 MeasureHandlerPtr
pMeasureHandler( new MeasureHandler
);
3137 pProperties
->resolve(*pMeasureHandler
);
3138 sal_Int32 nMeasureValue
= pMeasureHandler
->getMeasureValue();
3139 PropertyIds eId
= META_PROP_CELL_MAR_TOP
;
3140 bool rtl
= false; // TODO
3143 case NS_ooxml::LN_CT_TblCellMar_top
:
3145 case NS_ooxml::LN_CT_TblCellMar_start
:
3146 eId
= rtl
? META_PROP_CELL_MAR_RIGHT
: META_PROP_CELL_MAR_LEFT
;
3148 case NS_ooxml::LN_CT_TblCellMar_left
:
3149 eId
= META_PROP_CELL_MAR_LEFT
;
3151 case NS_ooxml::LN_CT_TblCellMar_bottom
:
3152 eId
= META_PROP_CELL_MAR_BOTTOM
;
3154 case NS_ooxml::LN_CT_TblCellMar_end
:
3155 eId
= rtl
? META_PROP_CELL_MAR_LEFT
: META_PROP_CELL_MAR_RIGHT
;
3157 case NS_ooxml::LN_CT_TblCellMar_right
:
3158 eId
= META_PROP_CELL_MAR_RIGHT
;
3162 rContext
->Insert( eId
, false, uno::makeAny(nMeasureValue
), false);
3166 case NS_sprm::LN_CFNoProof
: //0x875 no grammar and spell checking, unsupported
3168 case NS_ooxml::LN_anchor_anchor
: // at_character drawing
3169 case NS_ooxml::LN_inline_inline
: // as_character drawing
3171 writerfilter::Reference
<Properties
>::Pointer_t pProperties
= rSprm
.getProps();
3172 if( pProperties
.get())
3174 GraphicImportType eGraphicType
=
3175 (NS_ooxml::LN_anchor_anchor
==
3176 sal::static_int_cast
<Id
>(nSprmId
)) ?
3177 IMPORT_AS_DETECTED_ANCHOR
:
3178 IMPORT_AS_DETECTED_INLINE
;
3179 GraphicImportPtr pGraphicImport
=
3180 m_pImpl
->GetGraphicImport(eGraphicType
);
3181 pProperties
->resolve(*pGraphicImport
);
3182 m_pImpl
->ImportGraphic(pProperties
, eGraphicType
);
3183 if( !pGraphicImport
->IsGraphic() )
3185 m_pImpl
->ResetGraphicImport();
3186 // todo: It's a shape, now start shape import
3191 case NS_ooxml::LN_EG_RPrBase_vertAlign
:
3193 sal_Int16 nEscapement
= 0;
3194 sal_Int8 nProp
= 58;
3195 if ( sStringValue
== "superscript" )
3197 else if ( sStringValue
== "subscript" )
3202 rContext
->Insert(PROP_CHAR_ESCAPEMENT
, true, uno::makeAny( nEscapement
) );
3203 rContext
->Insert(PROP_CHAR_ESCAPEMENT_HEIGHT
, true, uno::makeAny( nProp
) );
3206 case NS_ooxml::LN_CT_FtnProps_pos
:
3207 //footnotes in word can be at page end or beneath text - writer supports only the first
3208 //endnotes in word can be at section end or document end - writer supports only the latter
3209 // -> so this property can be ignored
3211 case NS_ooxml::LN_EG_FtnEdnNumProps_numStart
:
3212 case NS_ooxml::LN_EG_FtnEdnNumProps_numRestart
:
3213 case NS_ooxml::LN_CT_FtnProps_numFmt
:
3214 case NS_ooxml::LN_CT_EdnProps_numFmt
:
3218 uno::Reference
< beans::XPropertySet
> xFtnEdnSettings
;
3219 if( m_pImpl
->IsInFootnoteProperties() )
3221 uno::Reference
< text::XFootnotesSupplier
> xFootnotesSupplier( m_pImpl
->GetTextDocument(), uno::UNO_QUERY
);
3222 if (xFootnotesSupplier
.is())
3223 xFtnEdnSettings
= xFootnotesSupplier
->getFootnoteSettings();
3227 uno::Reference
< text::XEndnotesSupplier
> xEndnotesSupplier( m_pImpl
->GetTextDocument(), uno::UNO_QUERY
);
3228 if (xEndnotesSupplier
.is())
3229 xFtnEdnSettings
= xEndnotesSupplier
->getEndnoteSettings();
3231 if( NS_ooxml::LN_EG_FtnEdnNumProps_numStart
== nSprmId
&& xFtnEdnSettings
.is())
3233 xFtnEdnSettings
->setPropertyValue(
3234 PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_START_AT
),
3235 uno::makeAny( sal_Int16( nIntValue
- 1 )));
3237 else if( NS_ooxml::LN_EG_FtnEdnNumProps_numRestart
== nSprmId
&& xFtnEdnSettings
.is())
3239 sal_Int16 nFootnoteCounting
= 0;
3242 case NS_ooxml::LN_Value_ST_RestartNumber_continuous
: nFootnoteCounting
= text::FootnoteNumbering::PER_DOCUMENT
; break;
3243 case NS_ooxml::LN_Value_ST_RestartNumber_eachPage
: nFootnoteCounting
= text::FootnoteNumbering::PER_PAGE
; break;
3244 case NS_ooxml::LN_Value_ST_RestartNumber_eachSect
: nFootnoteCounting
= text::FootnoteNumbering::PER_CHAPTER
; break;
3247 xFtnEdnSettings
->setPropertyValue(
3248 PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_FOOTNOTE_COUNTING
),
3249 uno::makeAny( nFootnoteCounting
));
3251 else if (xFtnEdnSettings
.is())
3253 sal_Int16 nNumType
= ConversionHelper::ConvertNumberingType( nIntValue
);
3254 xFtnEdnSettings
->setPropertyValue(
3255 PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_NUMBERING_TYPE
),
3256 uno::makeAny( nNumType
));
3259 catch( const uno::Exception
& )
3264 case NS_ooxml::LN_paratrackchange
:
3265 m_pImpl
->StartParaChange( );
3266 case NS_ooxml::LN_trackchange
:
3267 case NS_ooxml::LN_EG_RPrContent_rPrChange
:
3269 m_pImpl
->AddNewRedline( );
3270 resolveSprmProps(*this, rSprm
);
3271 // now the properties author, date and id should be available
3272 sal_Int32 nToken
= m_pImpl
->GetCurrentRedlineToken();
3273 switch( nToken
& 0xffff )
3275 case ooxml::OOXML_mod
:
3276 case ooxml::OOXML_ins
:
3277 case ooxml::OOXML_del
: break;
3278 default: OSL_FAIL( "redline token other than mod, ins or del" );
3280 m_pImpl
->EndParaChange( );
3283 case NS_ooxml::LN_endtrackchange
:
3284 m_pImpl
->RemoveCurrentRedline( );
3286 case NS_ooxml::LN_CT_RPrChange_rPr
:
3288 case NS_ooxml::LN_object
:
3290 writerfilter::Reference
<Properties
>::Pointer_t pProperties
= rSprm
.getProps();
3291 if( pProperties
.get( ) )
3293 OLEHandlerPtr
pOLEHandler( new OLEHandler
);
3294 pProperties
->resolve(*pOLEHandler
);
3295 if ( pOLEHandler
->isOLEObject( ) )
3297 OUString sStreamName
= pOLEHandler
->copyOLEOStream( m_pImpl
->GetTextDocument() );
3298 if( !sStreamName
.isEmpty() )
3300 m_pImpl
->appendOLE( sStreamName
, pOLEHandler
);
3306 case NS_ooxml::LN_EG_HdrFtrReferences_headerReference
: // header reference - not needed
3307 case NS_ooxml::LN_EG_HdrFtrReferences_footerReference
: // footer reference - not needed
3309 case NS_ooxml::LN_EG_RPrBase_snapToGrid
: // "Use document grid settings for inter-paragraph spacing"
3311 case NS_sprm::LN_PContextualSpacing
:
3312 rContext
->Insert(PROP_PARA_CONTEXT_MARGIN
, true, uno::makeAny( sal_Bool( nIntValue
) ));
3314 case NS_ooxml::LN_EG_SectPrContents_formProt
: //section protection, only form editing is enabled - unsupported
3315 case NS_ooxml::LN_EG_SectPrContents_vAlign
:
3316 case NS_ooxml::LN_EG_RPrBase_fitText
:
3318 case NS_ooxml::LN_ffdata
:
3320 writerfilter::Reference
<Properties
>::Pointer_t pProperties
= rSprm
.getProps();
3321 if (pProperties
.get() != NULL
)
3323 FFDataHandler::Pointer_t
pFFDataHandler(new FFDataHandler());
3325 pProperties
->resolve(*pFFDataHandler
);
3326 m_pImpl
->SetFieldFFData(pFFDataHandler
);
3330 case NS_ooxml::LN_CT_SdtPr_dropDownList
:
3332 writerfilter::Reference
<Properties
>::Pointer_t pProperties
= rSprm
.getProps();
3333 if (pProperties
.get() != NULL
)
3334 pProperties
->resolve(*this);
3337 case NS_ooxml::LN_CT_SdtDropDownList_listItem
:
3339 writerfilter::Reference
<Properties
>::Pointer_t pProperties
= rSprm
.getProps();
3340 if (pProperties
.get() != NULL
)
3341 pProperties
->resolve(*this);
3344 case NS_ooxml::LN_CT_SdtPr_date
:
3346 writerfilter::Reference
<Properties
>::Pointer_t pProperties
= rSprm
.getProps();
3347 if (pProperties
.get() != NULL
)
3348 pProperties
->resolve(*this);
3351 case NS_ooxml::LN_CT_SdtDate_dateFormat
:
3353 // See com/sun/star/awt/UnoControlDateFieldModel.idl, DateFormat; sadly there are no constants for this.
3354 if (sStringValue
== "M/d/yyyy" || sStringValue
== "M.d.yyyy")
3355 // Approximate with MM.dd.yyy
3356 m_pImpl
->m_pSdtHelper
->getDateFormat().reset(8);
3359 // Set default format, so at least the date picker is created.
3360 m_pImpl
->m_pSdtHelper
->getDateFormat().reset(0);
3361 SAL_WARN("writerfilter", "unhandled w:dateFormat value");
3365 case NS_ooxml::LN_tblStart
:
3366 m_pImpl
->m_nTableDepth
++;
3368 case NS_ooxml::LN_tblEnd
:
3369 m_pImpl
->m_nTableDepth
--;
3373 #ifdef DEBUG_DOMAINMAPPER
3374 dmapper_logger
->startElement("unhandled");
3375 dmapper_logger
->attribute("id", nSprmId
);
3376 dmapper_logger
->attribute("name", rSprm
.getName());
3377 dmapper_logger
->endElement();
3383 void DomainMapper::setInTableStyleRunProps(bool bInTableStyleRunProps
)
3385 m_pImpl
->m_bInTableStyleRunProps
= bInTableStyleRunProps
;
3388 void DomainMapper::processDeferredCharacterProperties( const std::map
< sal_Int32
, uno::Any
>& deferredCharacterProperties
)
3390 assert( m_pImpl
->GetTopContextType() == CONTEXT_CHARACTER
);
3391 PropertyMapPtr rContext
= m_pImpl
->GetTopContext();
3392 for( std::map
< sal_Int32
, uno::Any
>::const_iterator it
= deferredCharacterProperties
.begin();
3393 it
!= deferredCharacterProperties
.end();
3396 sal_Int32 Id
= it
->first
;
3397 sal_Int32 nIntValue
= 0;
3398 OUString sStringValue
;
3399 it
->second
>>= nIntValue
;
3400 it
->second
>>= sStringValue
;
3403 case NS_sprm::LN_CHps
:
3404 case NS_sprm::LN_CHpsBi
:
3405 break; // only for use by other properties, ignore here
3406 case NS_sprm::LN_CHpsPos
:
3408 sal_Int16 nEscapement
= 0;
3409 sal_Int8 nProp
= 100;
3414 std::map
< sal_Int32
, uno::Any
>::const_iterator font
= deferredCharacterProperties
.find( NS_sprm::LN_CHps
);
3415 PropertyMapPtr pDefaultCharProps
= m_pImpl
->GetStyleSheetTable()->GetDefaultCharProps();
3416 PropertyMap::iterator aDefaultFont
= pDefaultCharProps
->find(PropertyDefinition( PROP_CHAR_HEIGHT
, false ));
3417 if( font
!= deferredCharacterProperties
.end())
3419 double fontSize
= 0;
3420 font
->second
>>= fontSize
;
3421 nEscapement
= nIntValue
* 100 / fontSize
;
3423 // TODO if not direct formatting, check the style first, not directly the default char props.
3424 else if (aDefaultFont
!= pDefaultCharProps
->end())
3427 aDefaultFont
->second
>>= fHeight
;
3428 // fHeight is in points, nIntValue is in half points, nEscapement is in percents.
3429 nEscapement
= nIntValue
* 100 / fHeight
/ 2;
3432 { // TODO: Find out the font size. The 58/-58 values were here previous, but I have
3433 // no idea what they are (they are probably some random guess that did fit whatever
3434 // specific case somebody was trying to fix).
3435 nEscapement
= ( nIntValue
> 0 ) ? 58: -58;
3438 rContext
->Insert(PROP_CHAR_ESCAPEMENT
, true, uno::makeAny( nEscapement
) );
3439 rContext
->Insert(PROP_CHAR_ESCAPEMENT_HEIGHT
, true, uno::makeAny( nProp
) );
3441 break; // sprmCHpsPos
3443 SAL_WARN( "writerfilter", "Unhandled property in processDeferredCharacterProperty()" );
3449 void DomainMapper::lcl_entry(int /*pos*/,
3450 writerfilter::Reference
<Properties
>::Pointer_t ref
)
3452 ref
->resolve(*this);
3455 void DomainMapper::data(const sal_uInt8
* /*buf*/, size_t /*len*/,
3456 writerfilter::Reference
<Properties
>::Pointer_t
/*ref*/)
3460 void DomainMapper::lcl_startSectionGroup()
3462 m_pImpl
->PushProperties(CONTEXT_SECTION
);
3465 void DomainMapper::lcl_endSectionGroup()
3467 m_pImpl
->CheckUnregisteredFrameConversion();
3468 m_pImpl
->ExecuteFrameConversion();
3469 PropertyMapPtr pContext
= m_pImpl
->GetTopContextOfType(CONTEXT_SECTION
);
3470 SectionPropertyMap
* pSectionContext
= dynamic_cast< SectionPropertyMap
* >( pContext
.get() );
3471 OSL_ENSURE(pSectionContext
, "SectionContext unavailable!");
3473 pSectionContext
->CloseSectionGroup( *m_pImpl
);
3474 m_pImpl
->PopProperties(CONTEXT_SECTION
);
3477 void DomainMapper::lcl_startParagraphGroup()
3479 m_pImpl
->getTableManager().startParagraphGroup();
3480 m_pImpl
->PushProperties(CONTEXT_PARAGRAPH
);
3481 static OUString
sDefault("Standard");
3482 if (m_pImpl
->GetTopContext())
3484 if (!m_pImpl
->IsInShape())
3486 m_pImpl
->GetTopContext()->Insert( PROP_PARA_STYLE_NAME
, true, uno::makeAny( sDefault
) );
3487 m_pImpl
->SetCurrentParaStyleId(sDefault
);
3489 if (m_pImpl
->isBreakDeferred(PAGE_BREAK
))
3490 m_pImpl
->GetTopContext()->Insert( PROP_BREAK_TYPE
, true, uno::makeAny( com::sun::star::style::BreakType_PAGE_BEFORE
) );
3491 else if (m_pImpl
->isBreakDeferred(COLUMN_BREAK
))
3492 m_pImpl
->GetTopContext()->Insert( PROP_BREAK_TYPE
, true, uno::makeAny( com::sun::star::style::BreakType_COLUMN_BEFORE
) );
3494 m_pImpl
->clearDeferredBreaks();
3497 void DomainMapper::lcl_endParagraphGroup()
3499 m_pImpl
->PopProperties(CONTEXT_PARAGRAPH
);
3500 m_pImpl
->getTableManager().endParagraphGroup();
3501 //frame conversion has to be executed after table conversion
3502 m_pImpl
->ExecuteFrameConversion();
3505 void DomainMapper::markLastParagraphInSection( )
3507 m_pImpl
->SetIsLastParagraphInSection( true );
3510 void DomainMapper::lcl_startShape( uno::Reference
< drawing::XShape
> xShape
)
3512 if (m_pImpl
->GetTopContext())
3514 // If there is a deferred page break, handle it now, so that the
3515 // started shape will be on the correct page.
3516 if (m_pImpl
->isBreakDeferred(PAGE_BREAK
))
3518 m_pImpl
->clearDeferredBreak(PAGE_BREAK
);
3519 lcl_startCharacterGroup();
3520 sal_uInt8 sBreak
[] = { 0xd };
3521 lcl_text(sBreak
, 1);
3522 lcl_endCharacterGroup();
3523 lcl_endParagraphGroup();
3524 lcl_startParagraphGroup();
3525 m_pImpl
->GetTopContext()->Insert(PROP_BREAK_TYPE
, true, uno::makeAny( com::sun::star::style::BreakType_PAGE_BEFORE
));
3527 m_pImpl
->PushShapeContext( xShape
);
3528 lcl_startParagraphGroup();
3531 // No context? Then this image should not appear directly inside the
3532 // document, just save it for later usage.
3533 m_pImpl
->PushPendingShape(xShape
);
3536 void DomainMapper::lcl_endShape( )
3538 if (m_pImpl
->GetTopContext())
3540 lcl_endParagraphGroup();
3541 m_pImpl
->PopShapeContext( );
3545 void DomainMapper::PushStyleSheetProperties( PropertyMapPtr pStyleProperties
, bool bAffectTableMngr
)
3547 m_pImpl
->PushStyleProperties( pStyleProperties
);
3548 if ( bAffectTableMngr
)
3549 m_pImpl
->getTableManager( ).SetStyleProperties( pStyleProperties
);
3552 void DomainMapper::PopStyleSheetProperties( bool bAffectTableMngr
)
3554 m_pImpl
->PopProperties( CONTEXT_STYLESHEET
);
3555 if ( bAffectTableMngr
)
3557 PropertyMapPtr emptyPtr
;
3558 m_pImpl
->getTableManager( ).SetStyleProperties( emptyPtr
);
3562 void DomainMapper::PushListProperties( ::boost::shared_ptr
<PropertyMap
> pListProperties
)
3564 m_pImpl
->PushListProperties( pListProperties
);
3567 void DomainMapper::PopListProperties()
3569 m_pImpl
->PopProperties( CONTEXT_LIST
);
3572 void DomainMapper::lcl_startCharacterGroup()
3574 m_pImpl
->PushProperties(CONTEXT_CHARACTER
);
3577 void DomainMapper::lcl_endCharacterGroup()
3579 m_pImpl
->PopProperties(CONTEXT_CHARACTER
);
3582 void DomainMapper::lcl_text(const sal_uInt8
* data_
, size_t len
)
3584 //TODO: Determine the right text encoding (FIB?)
3585 OUString
sText( (const sal_Char
*) data_
, len
, RTL_TEXTENCODING_MS_1252
);
3586 #ifdef DEBUG_DOMAINMAPPER
3587 dmapper_logger
->startElement("text");
3588 dmapper_logger
->chars(sText
);
3589 dmapper_logger
->endElement();
3598 case 0x02: return; //footnote character
3599 case 0x0c: //page break
3600 m_pImpl
->deferBreak(PAGE_BREAK
);
3602 case 0x0e: //column break
3603 m_pImpl
->deferBreak(COLUMN_BREAK
);
3606 m_pImpl
->getTableManager().text(data_
, len
);
3608 m_pImpl
->finishParagraph(m_pImpl
->GetTopContextOfType(CONTEXT_PARAGRAPH
));
3611 m_pImpl
->PushFieldContext();
3614 // delimiter not necessarily available
3615 // appears only if field contains further content
3616 m_pImpl
->CloseFieldCommand();
3618 case 0x15: /* end of field */
3619 m_pImpl
->PopFieldContext();
3626 PropertyMapPtr pContext
= m_pImpl
->GetTopContext();
3627 if ( pContext
&& !pContext
->GetFootnote().is() )
3629 if (m_pImpl
->isBreakDeferred(PAGE_BREAK
))
3630 m_pImpl
->GetTopContext()->Insert( PROP_BREAK_TYPE
, true, uno::makeAny( com::sun::star::style::BreakType_PAGE_BEFORE
) );
3631 else if (m_pImpl
->isBreakDeferred(COLUMN_BREAK
))
3632 m_pImpl
->GetTopContext()->Insert( PROP_BREAK_TYPE
, true, uno::makeAny( com::sun::star::style::BreakType_COLUMN_BEFORE
) );
3633 m_pImpl
->clearDeferredBreaks();
3636 if( pContext
->GetFootnote().is() && m_pImpl
->IsCustomFtnMark() )
3638 pContext
->GetFootnote()->setLabel( sText
);
3639 m_pImpl
->SetCustomFtnMark( false );
3640 //otherwise ignore sText
3642 else if( m_pImpl
->IsOpenFieldCommand() )
3643 m_pImpl
->AppendFieldCommand(sText
);
3644 else if( m_pImpl
->IsOpenField() && m_pImpl
->IsFieldResultAsString())
3645 /*depending on the success of the field insert operation this result will be
3646 set at the field or directly inserted into the text*/
3647 m_pImpl
->SetFieldResult( sText
);
3650 if (pContext
== NULL
)
3651 pContext
.reset(new PropertyMap());
3653 m_pImpl
->appendTextPortion( sText
, pContext
);
3656 catch( const uno::RuntimeException
& e
)
3658 SAL_WARN("writerfilter", "failed. Message :" << e
.Message
);
3662 void DomainMapper::lcl_utext(const sal_uInt8
* data_
, size_t len
)
3665 OUStringBuffer aBuffer
= OUStringBuffer(len
);
3666 aBuffer
.append( (const sal_Unicode
*) data_
, len
);
3667 sText
= aBuffer
.makeStringAndClear();
3669 if (!m_pImpl
->m_pSdtHelper
->getDropDownItems().empty())
3671 m_pImpl
->m_pSdtHelper
->getSdtTexts().append(sText
);
3674 else if (m_pImpl
->m_pSdtHelper
->getDateFormat())
3677 * Here we assume w:sdt only contains a single text token. We need to
3678 * create the control early, as in Writer, it's part of the cell, but
3679 * in OOXML, the sdt contains the cell.
3681 m_pImpl
->m_pSdtHelper
->createDateControl(sText
);
3687 m_pImpl
->getTableManager().utext(data_
, len
);
3689 if(len
== 1 && (sText
[0] == 0x0d || sText
[0] == 0x07))
3691 PropertyMapPtr pContext
= m_pImpl
->GetTopContextOfType(CONTEXT_PARAGRAPH
);
3692 if (pContext
&& m_pImpl
->GetSettingsTable()->GetSplitPgBreakAndParaMark())
3694 if (m_pImpl
->isBreakDeferred(PAGE_BREAK
))
3695 pContext
->Insert(PROP_BREAK_TYPE
, true, uno::makeAny( com::sun::star::style::BreakType_PAGE_BEFORE
));
3696 else if (m_pImpl
->isBreakDeferred(COLUMN_BREAK
))
3697 pContext
->Insert(PROP_BREAK_TYPE
, true, uno::makeAny( com::sun::star::style::BreakType_COLUMN_BEFORE
));
3698 m_pImpl
->clearDeferredBreaks();
3701 bool bSingleParagraph
= m_pImpl
->GetIsFirstParagraphInSection() && m_pImpl
->GetIsLastParagraphInSection();
3702 // If the paragraph contains only the section properties and it has
3703 // no runs, we should not create a paragraph for it in Writer, unless that would remove the whole section.
3704 bool bRemove
= !m_pImpl
->GetParaChanged() && m_pImpl
->GetParaSectpr() && !bSingleParagraph
;
3705 m_pImpl
->SetParaSectpr(false);
3706 m_pImpl
->finishParagraph(m_pImpl
->GetTopContextOfType(CONTEXT_PARAGRAPH
));
3708 m_pImpl
->RemoveLastParagraph();
3713 PropertyMapPtr pContext
= m_pImpl
->GetTopContext();
3714 if ( pContext
&& !pContext
->GetFootnote().is() )
3716 if (m_pImpl
->isBreakDeferred(PAGE_BREAK
))
3717 m_pImpl
->GetTopContext()->Insert( PROP_BREAK_TYPE
, true, uno::makeAny( com::sun::star::style::BreakType_PAGE_BEFORE
) );
3718 else if (m_pImpl
->isBreakDeferred(COLUMN_BREAK
))
3719 m_pImpl
->GetTopContext()->Insert( PROP_BREAK_TYPE
, true, uno::makeAny( com::sun::star::style::BreakType_COLUMN_BEFORE
) );
3720 m_pImpl
->clearDeferredBreaks();
3723 if( pContext
&& pContext
->GetFootnote().is() )
3725 if( !pContext
->GetFootnoteSymbol() )
3726 pContext
->GetFootnote()->setLabel( sText
);
3727 //otherwise ignore sText
3729 else if( m_pImpl
->IsOpenFieldCommand() )
3730 m_pImpl
->AppendFieldCommand(sText
);
3731 else if( m_pImpl
->IsOpenField() && m_pImpl
->IsFieldResultAsString())
3732 /*depending on the success of the field insert operation this result will be
3733 set at the field or directly inserted into the text*/
3734 m_pImpl
->SetFieldResult( sText
);
3737 if (pContext
== NULL
)
3738 pContext
.reset(new PropertyMap());
3740 m_pImpl
->appendTextPortion( sText
, pContext
);
3745 catch( const uno::RuntimeException
& )
3750 void DomainMapper::lcl_props(writerfilter::Reference
<Properties
>::Pointer_t ref
)
3752 string sType
= ref
->getType();
3753 if( sType
== "PICF" )
3755 m_pImpl
->ImportGraphic(ref
, IMPORT_AS_GRAPHIC
);
3757 else if( sType
== "FSPA" )
3759 m_pImpl
->ImportGraphic(ref
, IMPORT_AS_SHAPE
);
3762 ref
->resolve(*this);
3765 void DomainMapper::lcl_table(Id name
, writerfilter::Reference
<Table
>::Pointer_t ref
)
3767 m_pImpl
->SetAnyTableImport(true);
3770 case NS_rtf::LN_FONTTABLE
:
3772 // create a font table object that listens to the attributes
3773 // each entry call inserts a new font entry
3774 ref
->resolve( *m_pImpl
->GetFontTable() );
3776 case NS_rtf::LN_STYLESHEET
:
3777 //same as above to import style sheets
3778 m_pImpl
->SetStyleSheetImport( true );
3779 ref
->resolve( *m_pImpl
->GetStyleSheetTable() );
3780 m_pImpl
->GetStyleSheetTable()->ApplyStyleSheets(m_pImpl
->GetFontTable());
3781 m_pImpl
->SetStyleSheetImport( false );
3783 case NS_ooxml::LN_NUMBERING
:
3784 case NS_rtf::LN_LISTTABLE
:
3787 //the same for list tables
3788 ref
->resolve( *m_pImpl
->GetListTable() );
3789 m_pImpl
->GetListTable( )->CreateNumberingRules( );
3792 case NS_rtf::LN_LFOTABLE
:
3794 m_pImpl
->GetListTable( )->SetLFOImport( true );
3795 ref
->resolve( *m_pImpl
->GetListTable() );
3796 m_pImpl
->GetListTable( )->CreateNumberingRules( );
3797 m_pImpl
->GetListTable( )->SetLFOImport( false );
3800 case NS_ooxml::LN_THEMETABLE
:
3801 ref
->resolve ( *m_pImpl
->GetThemeTable() );
3803 case NS_ooxml::LN_settings_settings
:
3804 ref
->resolve ( *m_pImpl
->GetSettingsTable() );
3805 m_pImpl
->ApplySettingsTable();
3808 OSL_FAIL( "which table is to be filled here?");
3810 m_pImpl
->SetAnyTableImport(false);
3813 void DomainMapper::lcl_substream(Id rName
, ::writerfilter::Reference
<Stream
>::Pointer_t ref
)
3815 m_pImpl
->appendTableManager( );
3816 // Appending a TableManager resets its TableHandler, so we need to append
3817 // that as well, or tables won't be imported properly in headers/footers.
3818 m_pImpl
->appendTableHandler( );
3819 m_pImpl
->getTableManager().startLevel();
3821 //import of page header/footer
3825 case NS_rtf::LN_headerl
:
3827 m_pImpl
->PushPageHeader(SectionPropertyMap::PAGE_LEFT
);
3829 case NS_rtf::LN_headerr
:
3831 m_pImpl
->PushPageHeader(SectionPropertyMap::PAGE_RIGHT
);
3833 case NS_rtf::LN_headerf
:
3835 m_pImpl
->PushPageHeader(SectionPropertyMap::PAGE_FIRST
);
3837 case NS_rtf::LN_footerl
:
3839 m_pImpl
->PushPageFooter(SectionPropertyMap::PAGE_LEFT
);
3841 case NS_rtf::LN_footerr
:
3843 m_pImpl
->PushPageFooter(SectionPropertyMap::PAGE_RIGHT
);
3845 case NS_rtf::LN_footerf
:
3847 m_pImpl
->PushPageFooter(SectionPropertyMap::PAGE_FIRST
);
3849 case NS_rtf::LN_footnote
:
3850 case NS_rtf::LN_endnote
:
3851 m_pImpl
->PushFootOrEndnote( NS_rtf::LN_footnote
== rName
);
3853 case NS_rtf::LN_annotation
:
3854 m_pImpl
->PushAnnotation();
3857 ref
->resolve(*this);
3860 case NS_rtf::LN_headerl
:
3861 case NS_rtf::LN_headerr
:
3862 case NS_rtf::LN_headerf
:
3863 case NS_rtf::LN_footerl
:
3864 case NS_rtf::LN_footerr
:
3865 case NS_rtf::LN_footerf
:
3866 m_pImpl
->PopPageHeaderFooter();
3868 case NS_rtf::LN_footnote
:
3869 case NS_rtf::LN_endnote
:
3870 m_pImpl
->PopFootOrEndnote();
3872 case NS_rtf::LN_annotation
:
3873 m_pImpl
->PopAnnotation();
3877 m_pImpl
->getTableManager().endLevel();
3878 m_pImpl
->popTableManager( );
3881 void DomainMapper::lcl_info(const string
& /*info_*/)
3885 void DomainMapper::handleUnderlineType(const sal_Int32 nIntValue
, const ::boost::shared_ptr
<PropertyMap
> pContext
)
3887 sal_Int16 eUnderline
= awt::FontUnderline::NONE
;
3891 case 0: eUnderline
= awt::FontUnderline::NONE
; break;
3892 case 2: pContext
->Insert(PROP_CHAR_WORD_MODE
, true, uno::makeAny( true ) ); // TODO: how to get rid of it?
3893 case 1: eUnderline
= awt::FontUnderline::SINGLE
; break;
3894 case 3: eUnderline
= awt::FontUnderline::DOUBLE
; break;
3895 case 4: eUnderline
= awt::FontUnderline::DOTTED
; break;
3896 case 7: eUnderline
= awt::FontUnderline::DASH
; break;
3897 case 9: eUnderline
= awt::FontUnderline::DASHDOT
; break;
3898 case 10:eUnderline
= awt::FontUnderline::DASHDOTDOT
; break;
3899 case 6: eUnderline
= awt::FontUnderline::BOLD
; break;
3900 case 11:eUnderline
= awt::FontUnderline::WAVE
; break;
3901 case 20:eUnderline
= awt::FontUnderline::BOLDDOTTED
; break;
3902 case 23:eUnderline
= awt::FontUnderline::BOLDDASH
; break;
3903 case 39:eUnderline
= awt::FontUnderline::LONGDASH
; break;
3904 case 55:eUnderline
= awt::FontUnderline::BOLDLONGDASH
; break;
3905 case 25:eUnderline
= awt::FontUnderline::BOLDDASHDOT
; break;
3906 case 26:eUnderline
= awt::FontUnderline::BOLDDASHDOTDOT
;break;
3907 case 27:eUnderline
= awt::FontUnderline::BOLDWAVE
; break;
3908 case 43:eUnderline
= awt::FontUnderline::DOUBLEWAVE
; break;
3911 pContext
->Insert(PROP_CHAR_UNDERLINE
, true, uno::makeAny( eUnderline
) );
3914 void DomainMapper::handleParaJustification(const sal_Int32 nIntValue
, const ::boost::shared_ptr
<PropertyMap
> pContext
, const bool bExchangeLeftRight
)
3916 sal_Int16 nAdjust
= 0;
3917 sal_Int16 nLastLineAdjust
= 0;
3921 nAdjust
= style::ParagraphAdjust_CENTER
;
3924 nAdjust
= static_cast< sal_Int16
> (bExchangeLeftRight
? style::ParagraphAdjust_LEFT
: style::ParagraphAdjust_RIGHT
);
3927 nLastLineAdjust
= style::ParagraphAdjust_BLOCK
;
3930 nAdjust
= style::ParagraphAdjust_BLOCK
;
3934 nAdjust
= static_cast< sal_Int16
> (bExchangeLeftRight
? style::ParagraphAdjust_RIGHT
: style::ParagraphAdjust_LEFT
);
3937 pContext
->Insert( PROP_PARA_ADJUST
, true, uno::makeAny( nAdjust
) );
3938 pContext
->Insert( PROP_PARA_LAST_LINE_ADJUST
, true, uno::makeAny( nLastLineAdjust
) );
3941 bool DomainMapper::getColorFromIndex(const sal_Int32 nIndex
, sal_Int32
&nColor
)
3944 if ((nIndex
< 1) || (nIndex
> 16))
3949 case 1: nColor
=0x000000; break; //black
3950 case 2: nColor
=0x0000ff; break; //blue
3951 case 3: nColor
=0x00ffff; break; //cyan
3952 case 4: nColor
=0x00ff00; break; //green
3953 case 5: nColor
=0xff00ff; break; //magenta
3954 case 6: nColor
=0xff0000; break; //red
3955 case 7: nColor
=0xffff00; break; //yellow
3956 case 8: nColor
=0xffffff; break; //white
3957 case 9: nColor
=0x000080; break;//dark blue
3958 case 10: nColor
=0x008080; break; //dark cyan
3959 case 11: nColor
=0x008000; break; //dark green
3960 case 12: nColor
=0x800080; break; //dark magenta
3961 case 13: nColor
=0x800000; break; //dark red
3962 case 14: nColor
=0x808000; break; //dark yellow
3963 case 15: nColor
=0x808080; break; //dark gray
3964 case 16: nColor
=0xC0C0C0; break; //light gray
3971 sal_Int16
DomainMapper::getEmphasisValue(const sal_Int32 nIntValue
)
3976 return com::sun::star::text::FontEmphasis::DOT_ABOVE
;
3978 return com::sun::star::text::FontEmphasis::ACCENT_ABOVE
;
3980 return com::sun::star::text::FontEmphasis::CIRCLE_ABOVE
;
3982 return com::sun::star::text::FontEmphasis::DOT_BELOW
;
3984 return com::sun::star::text::FontEmphasis::NONE
;
3988 OUString
DomainMapper::getBracketStringFromEnum(const sal_Int32 nIntValue
, const bool bIsPrefix
)
3994 return OUString( "(" );
3995 return OUString( ")" );
3999 return OUString( "[" );
4000 return OUString( "]" );
4004 return OUString( "<" );
4005 return OUString( ">" );
4009 return OUString( "{" );
4010 return OUString( "}" );
4018 com::sun::star::style::TabAlign
DomainMapper::getTabAlignFromValue(const sal_Int32 nIntValue
)
4023 case 4: // bar not supported
4024 case 5: // num not supported
4025 return com::sun::star::style::TabAlign_LEFT
;
4027 return com::sun::star::style::TabAlign_CENTER
;
4029 return com::sun::star::style::TabAlign_RIGHT
;
4031 return com::sun::star::style::TabAlign_DECIMAL
;
4033 return com::sun::star::style::TabAlign_LEFT
;
4036 sal_Unicode
DomainMapper::getFillCharFromValue(const sal_Int32 nIntValue
)
4041 return sal_Unicode(0x002e);
4043 return sal_Unicode(0x002d);
4044 case 3: // underscore
4045 case 4: // heavy FIXME ???
4046 return sal_Unicode(0x005f);
4047 case NS_ooxml::LN_Value_ST_TabTlc_middleDot
: // middleDot
4048 return sal_Unicode(0x00b7);
4051 return sal_Unicode(0x0020); // blank space
4055 bool DomainMapper::IsOOXMLImport() const
4057 return m_pImpl
->IsOOXMLImport();
4060 bool DomainMapper::IsRTFImport() const
4062 return m_pImpl
->IsRTFImport();
4065 uno::Reference
< lang::XMultiServiceFactory
> DomainMapper::GetTextFactory() const
4067 return m_pImpl
->GetTextFactory();
4070 uno::Reference
< text::XTextRange
> DomainMapper::GetCurrentTextRange()
4072 return m_pImpl
->GetTopTextAppend()->getEnd();
4075 OUString
DomainMapper::getOrCreateCharStyle( PropertyValueVector_t
& rCharProperties
)
4077 StyleSheetTablePtr pStyleSheets
= m_pImpl
->GetStyleSheetTable();
4078 return pStyleSheets
->getOrCreateCharStyle( rCharProperties
);
4081 StyleSheetTablePtr
DomainMapper::GetStyleSheetTable( )
4083 return m_pImpl
->GetStyleSheetTable( );
4086 GraphicZOrderHelper
* DomainMapper::graphicZOrderHelper()
4088 if( zOrderHelper
.get() == NULL
)
4089 zOrderHelper
.reset( new GraphicZOrderHelper
);
4090 return zOrderHelper
.get();
4093 uno::Reference
<drawing::XShape
> DomainMapper::PopPendingShape()
4095 return m_pImpl
->PopPendingShape();
4098 bool DomainMapper::IsInHeaderFooter() const
4100 return m_pImpl
->IsInHeaderFooter();
4103 } //namespace dmapper
4104 } //namespace writerfilter
4106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */