1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: StyleSheetTable.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #include <StyleSheetTable.hxx>
31 #include <dmapper/DomainMapper.hxx>
32 #include <ConversionHelper.hxx>
33 #include <BorderHandler.hxx>
34 #include <doctok/resourceids.hxx>
35 #include <ooxml/resourceids.hxx>
37 #include <com/sun/star/beans/XMultiPropertySet.hpp>
38 #include <com/sun/star/beans/XPropertyState.hpp>
39 #include <com/sun/star/beans/PropertyValue.hpp>
40 #include <com/sun/star/container/XNameContainer.hpp>
41 #include <com/sun/star/text/XTextDocument.hpp>
42 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
43 #include <com/sun/star/style/XStyle.hpp>
44 #include <com/sun/star/text/WritingMode.hpp>
45 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
48 #include <rtl/ustrbuf.hxx>
50 using namespace ::com::sun::star
;
51 namespace writerfilter
{
55 typedef ::std::map
< ::rtl::OUString
, ::rtl::OUString
> StringPairMap_t
;
57 /*-- 21.06.2006 07:34:44---------------------------------------------------
59 -----------------------------------------------------------------------*/
60 StyleSheetEntry::StyleSheetEntry() :
63 ,bIsDefaultStyle(false)
64 ,bInvalidHeight(false)
66 ,nStyleTypeCode(STYLE_TYPE_UNKNOWN
)
67 ,sBaseStyleIdentifier()
68 ,sNextStyleIdentifier()
69 ,pProperties(new StyleSheetPropertyMap
)
73 /*-- 06.02.2008 11:30:46---------------------------------------------------
75 -----------------------------------------------------------------------*/
76 struct ListCharStylePropertyMap_t
78 ::rtl::OUString sCharStyleName
;
79 PropertyValueVector_t aPropertyValues
;
81 ListCharStylePropertyMap_t(const ::rtl::OUString
& rCharStyleName
, const PropertyValueVector_t
& rPropertyValues
):
82 sCharStyleName( rCharStyleName
),
83 aPropertyValues( rPropertyValues
)
86 typedef std::vector
< ListCharStylePropertyMap_t
> ListCharStylePropertyVector_t
;
87 /*-- 19.06.2006 12:04:32---------------------------------------------------
89 -----------------------------------------------------------------------*/
90 struct StyleSheetTable_Impl
92 DomainMapper
& m_rDMapper
;
93 uno::Reference
< text::XTextDocument
> m_xTextDocument
;
94 uno::Reference
< beans::XPropertySet
> m_xTextDefaults
;
95 std::vector
< StyleSheetEntry
> m_aStyleSheetEntries
;
96 StyleSheetEntry
*m_pCurrentEntry
;
97 PropertyMapPtr m_pDefaultParaProps
, m_pDefaultCharProps
;
98 PropertyMapPtr m_pCurrentProps
;
99 StringPairMap_t m_aStyleNameMap
;
100 ListCharStylePropertyVector_t m_aListCharStylePropertyVector
;
103 StyleSheetTable_Impl(DomainMapper
& rDMapper
, uno::Reference
< text::XTextDocument
> xTextDocument
);
105 ::rtl::OUString
HasListCharStyle( const PropertyValueVector_t
& rCharProperties
);
107 /*-- 15.11.2007 08:30:02---------------------------------------------------
109 -----------------------------------------------------------------------*/
110 StyleSheetTable_Impl::StyleSheetTable_Impl(DomainMapper
& rDMapper
, uno::Reference
< text::XTextDocument
> xTextDocument
) :
111 m_rDMapper( rDMapper
),
112 m_xTextDocument( xTextDocument
),
114 m_pDefaultParaProps(new PropertyMap
),
115 m_pDefaultCharProps(new PropertyMap
)
117 //set font height default to 10pt
118 uno::Any aVal
= uno::makeAny( double(10.) );
119 m_pDefaultCharProps
->Insert( PROP_CHAR_HEIGHT
, true, aVal
);
120 m_pDefaultCharProps
->Insert( PROP_CHAR_HEIGHT_ASIAN
, true, aVal
);
121 m_pDefaultCharProps
->Insert( PROP_CHAR_HEIGHT_COMPLEX
, true, aVal
);
123 /*-- 06.02.2008 11:45:21---------------------------------------------------
125 -----------------------------------------------------------------------*/
126 ::rtl::OUString
StyleSheetTable_Impl::HasListCharStyle( const PropertyValueVector_t
& rPropValues
)
128 ::rtl::OUString sRet
;
129 ListCharStylePropertyVector_t::const_iterator aListVectorIter
= m_aListCharStylePropertyVector
.begin();
130 while( aListVectorIter
!= m_aListCharStylePropertyVector
.end() )
132 //if size is identical
133 if( aListVectorIter
->aPropertyValues
.size() == rPropValues
.size() )
136 //then search for all contained properties
137 PropertyValueVector_t::const_iterator aList1Iter
= rPropValues
.begin();
138 while( aList1Iter
!= rPropValues
.end() && !bBreak
)
141 bool bElementFound
= false;
142 PropertyValueVector_t::const_iterator aList2Iter
= aListVectorIter
->aPropertyValues
.begin();
143 while( aList2Iter
!= aListVectorIter
->aPropertyValues
.end() && !bBreak
)
145 if( aList2Iter
->Name
== aList1Iter
->Name
)
147 bElementFound
= true;
148 if( aList2Iter
->Value
!= aList1Iter
->Value
)
154 //set break flag if property hasn't been found
163 return aListVectorIter
->sCharStyleName
;
169 /*-- 19.06.2006 12:04:32---------------------------------------------------
171 -----------------------------------------------------------------------*/
172 StyleSheetTable::StyleSheetTable(DomainMapper
& rDMapper
, uno::Reference
< text::XTextDocument
> xTextDocument
) :
173 m_pImpl( new StyleSheetTable_Impl(rDMapper
, xTextDocument
) )
176 /*-- 19.06.2006 12:04:33---------------------------------------------------
178 -----------------------------------------------------------------------*/
179 StyleSheetTable::~StyleSheetTable()
183 /*-- 19.06.2006 12:04:33---------------------------------------------------
185 -----------------------------------------------------------------------*/
186 void StyleSheetTable::attribute(Id Name
, Value
& val
)
188 OSL_ENSURE( m_pImpl
->m_pCurrentEntry
, "current entry has to be set here");
189 if(!m_pImpl
->m_pCurrentEntry
)
191 int nIntValue
= val
.getInt();
193 ::rtl::OUString sValue
= val
.getString();
194 // printf ( "StyleSheetTable::attribute(0x%.4x, 0x%.4x) [%s]\n", (unsigned int)Name, (unsigned int)nIntValue, ::rtl::OUStringToOString(sValue, RTL_TEXTENCODING_DONTKNOW).getStr());
195 /* WRITERFILTERSTATUS: table: StyleSheetTable_attributedata */
198 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
199 case NS_rtf::LN_ISTD
:
200 m_pImpl
->m_pCurrentEntry
->sStyleIdentifierD
= ::rtl::OUString::valueOf(static_cast<sal_Int32
>(nIntValue
), 16);
202 // case NS_rtf::LN_ISTARTAT: break;
203 // case NS_rtf::LN_NFC: break;
204 // case NS_rtf::LN_JC: break;
205 // case NS_rtf::LN_FLEGAL: break;
206 // case NS_rtf::LN_FNORESTART: break;
207 // case NS_rtf::LN_FPREV: break;
208 // case NS_rtf::LN_FPREVSPACE: break;
209 // case NS_rtf::LN_FWORD6: break;
210 // case NS_rtf::LN_UNUSED5_7: break;
211 // case NS_rtf::LN_RGBXCHNUMS: break;
212 // case NS_rtf::LN_IXCHFOLLOW: break;
213 // case NS_rtf::LN_DXASPACE: break;
214 // case NS_rtf::LN_DXAINDENT: break;
215 // case NS_rtf::LN_CBGRPPRLCHPX: break;
216 // case NS_rtf::LN_CBGRPPRLPAPX: break;
217 // case NS_rtf::LN_LSID: break;
218 // case NS_rtf::LN_TPLC: break;
219 // case NS_rtf::LN_RGISTD: break;
220 // case NS_rtf::LN_FSIMPLELIST: break;
221 // case NS_rtf::LN_FRESTARTHDN: break;
222 // case NS_rtf::LN_UNSIGNED26_2: break;
223 // case NS_rtf::LN_ILVL: break;
224 // case NS_rtf::LN_FSTARTAT: break;
225 // case NS_rtf::LN_FFORMATTING: break;
226 // case NS_rtf::LN_UNSIGNED4_6: break;
227 // case NS_rtf::LN_UNUSED4: break;
228 // case NS_rtf::LN_UNUSED8: break;
229 // case NS_rtf::LN_CLFOLVL: break;
230 // case NS_rtf::LN_CBFFNM1: break;
231 // case NS_rtf::LN_PRQ: break;
232 // case NS_rtf::LN_FTRUETYPE: break;
233 // case NS_rtf::LN_UNUSED1_3: break;
234 // case NS_rtf::LN_FF: break;
235 // case NS_rtf::LN_UNUSED1_7: break;
236 // case NS_rtf::LN_WWEIGHT: break;
237 // case NS_rtf::LN_CHS: break;
238 // case NS_rtf::LN_IXCHSZALT: break;
239 // case NS_rtf::LN_PANOSE: break;
240 // case NS_rtf::LN_FS: break;
241 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
244 ::rtl::OUString tempStyleIdentifier
= GetStyleIdFromIndex(static_cast<sal_uInt32
>(nIntValue
));
245 if (tempStyleIdentifier
.getLength())
246 m_pImpl
->m_pCurrentEntry
->sStyleIdentifierI
= tempStyleIdentifier
;
247 if (nIntValue
== 0 || nIntValue
== 65)
248 m_pImpl
->m_pCurrentEntry
->bIsDefaultStyle
= true;
251 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
253 m_pImpl
->m_pCurrentEntry
->nStyleTypeCode
= (StyleType
)nIntValue
;
255 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
256 case NS_rtf::LN_ISTDBASE
:
257 if (static_cast<sal_uInt32
>(nIntValue
) != 0xfff)
258 m_pImpl
->m_pCurrentEntry
->sBaseStyleIdentifier
= ::rtl::OUString::valueOf(static_cast<sal_Int32
>(nIntValue
), 16);
260 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
261 case NS_rtf::LN_ISTDNEXT
:
262 if (static_cast<sal_uInt32
>(nIntValue
) != 0xfff)
263 m_pImpl
->m_pCurrentEntry
->sNextStyleIdentifier
= ::rtl::OUString::valueOf(static_cast<sal_Int32
>(nIntValue
), 16);
265 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
266 case NS_rtf::LN_FSCRATCH
:
267 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
268 case NS_rtf::LN_FINVALHEIGHT
:
269 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
270 case NS_rtf::LN_FHASUPE
:
271 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
272 case NS_rtf::LN_FMASSCOPY
:
273 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
274 case NS_rtf::LN_CUPX
:
275 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
276 case NS_rtf::LN_BCHUPE
:
277 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
278 case NS_rtf::LN_FAUTOREDEF
:
279 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
280 case NS_rtf::LN_FHIDDEN
:
281 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
282 case NS_rtf::LN_UNUSED8_3
:
283 //noone seems to care about it
285 // case NS_rtf::LN_CSTD: break;
286 // case NS_rtf::LN_CBSTDBASEINFILE: break;
287 // case NS_rtf::LN_FSTDSTYLENAMESWRITTEN: break;
288 // case NS_rtf::LN_UNUSED4_2: break;
289 // case NS_rtf::LN_STIMAXWHENSAVED: break;
290 // case NS_rtf::LN_ISTDMAXFIXEDWHENSAVED: break;
291 // case NS_rtf::LN_NVERBUILTINNAMESWHENSAVED: break;
292 // case NS_rtf::LN_RGFTCSTANDARDCHPSTSH: break;
293 // case NS_rtf::LN_WIDENT: break;
294 // case NS_rtf::LN_NFIB: break;
295 // case NS_rtf::LN_NPRODUCT: break;
296 // case NS_rtf::LN_LID: break;
297 // case NS_rtf::LN_PNNEXT: break;
298 // case NS_rtf::LN_FDOT: break;
299 // case NS_rtf::LN_FGLSY: break;
300 // case NS_rtf::LN_FCOMPLEX: break;
301 // case NS_rtf::LN_FHASPIC: break;
302 // case NS_rtf::LN_CQUICKSAVES: break;
303 // case NS_rtf::LN_FENCRYPTED: break;
304 // case NS_rtf::LN_FWHICHTBLSTM: break;
305 // case NS_rtf::LN_FREADONLYRECOMMENDED: break;
306 // case NS_rtf::LN_FWRITERESERVATION: break;
307 // case NS_rtf::LN_FEXTCHAR: break;
308 // case NS_rtf::LN_FLOADOVERRIDE: break;
309 // case NS_rtf::LN_FFAREAST: break;
310 // case NS_rtf::LN_FCRYPTO: break;
311 // case NS_rtf::LN_NFIBBACK: break;
312 // case NS_rtf::LN_LKEY: break;
313 // case NS_rtf::LN_ENVR: break;
314 // case NS_rtf::LN_FMAC: break;
315 // case NS_rtf::LN_FEMPTYSPECIAL: break;
316 // case NS_rtf::LN_FLOADOVERRIDEPAGE: break;
317 // case NS_rtf::LN_FFUTURESAVEDUNDO: break;
318 // case NS_rtf::LN_FWORD97SAVED: break;
319 // case NS_rtf::LN_FSPARE0: break;
320 // case NS_rtf::LN_CHSTABLES: break;
321 // case NS_rtf::LN_FCMIN: break;
322 // case NS_rtf::LN_FCMAC: break;
323 // case NS_rtf::LN_CSW: break;
324 // case NS_rtf::LN_WMAGICCREATED: break;
325 // case NS_rtf::LN_WMAGICREVISED: break;
326 // case NS_rtf::LN_WMAGICCREATEDPRIVATE: break;
327 // case NS_rtf::LN_WMAGICREVISEDPRIVATE: break;
328 // case NS_rtf::LN_PNFBPCHPFIRST_W6: break;
329 // case NS_rtf::LN_PNCHPFIRST_W6: break;
330 // case NS_rtf::LN_CPNBTECHP_W6: break;
331 // case NS_rtf::LN_PNFBPPAPFIRST_W6: break;
332 // case NS_rtf::LN_PNPAPFIRST_W6: break;
333 // case NS_rtf::LN_CPNBTEPAP_W6: break;
334 // case NS_rtf::LN_PNFBPLVCFIRST_W6: break;
335 // case NS_rtf::LN_PNLVCFIRST_W6: break;
336 // case NS_rtf::LN_CPNBTELVC_W6: break;
337 // case NS_rtf::LN_LIDFE: break;
338 // case NS_rtf::LN_CLW: break;
339 // case NS_rtf::LN_CBMAC: break;
340 // case NS_rtf::LN_LPRODUCTCREATED: break;
341 // case NS_rtf::LN_LPRODUCTREVISED: break;
342 // case NS_rtf::LN_CCPTEXT: break;
343 // case NS_rtf::LN_CCPFTN: break;
344 // case NS_rtf::LN_CCPHDD: break;
345 // case NS_rtf::LN_CCPMCR: break;
346 // case NS_rtf::LN_CCPATN: break;
347 // case NS_rtf::LN_CCPEDN: break;
348 // case NS_rtf::LN_CCPTXBX: break;
349 // case NS_rtf::LN_CCPHDRTXBX: break;
350 // case NS_rtf::LN_PNFBPCHPFIRST: break;
351 // case NS_rtf::LN_PNCHPFIRST: break;
352 // case NS_rtf::LN_CPNBTECHP: break;
353 // case NS_rtf::LN_PNFBPPAPFIRST: break;
354 // case NS_rtf::LN_PNPAPFIRST: break;
355 // case NS_rtf::LN_CPNBTEPAP: break;
356 // case NS_rtf::LN_PNFBPLVCFIRST: break;
357 // case NS_rtf::LN_PNLVCFIRST: break;
358 // case NS_rtf::LN_CPNBTELVC: break;
359 // case NS_rtf::LN_FCISLANDFIRST: break;
360 // case NS_rtf::LN_FCISLANDLIM: break;
361 // case NS_rtf::LN_CFCLCB: break;
362 // case NS_rtf::LN_FCSTSHFORIG: break;
363 // case NS_rtf::LN_LCBSTSHFORIG: break;
364 // case NS_rtf::LN_FCSTSHF: break;
365 // case NS_rtf::LN_LCBSTSHF: break;
366 // case NS_rtf::LN_FCPLCFFNDREF: break;
367 // case NS_rtf::LN_LCBPLCFFNDREF: break;
368 // case NS_rtf::LN_FCPLCFFNDTXT: break;
369 // case NS_rtf::LN_LCBPLCFFNDTXT: break;
370 // case NS_rtf::LN_FCPLCFANDREF: break;
371 // case NS_rtf::LN_LCBPLCFANDREF: break;
372 // case NS_rtf::LN_FCPLCFANDTXT: break;
373 // case NS_rtf::LN_LCBPLCFANDTXT: break;
374 // case NS_rtf::LN_FCPLCFSED: break;
375 // case NS_rtf::LN_LCBPLCFSED: break;
376 // case NS_rtf::LN_FCPLCFPAD: break;
377 // case NS_rtf::LN_LCBPLCFPAD: break;
378 // case NS_rtf::LN_FCPLCFPHE: break;
379 // case NS_rtf::LN_LCBPLCFPHE: break;
380 // case NS_rtf::LN_FCSTTBFGLSY: break;
381 // case NS_rtf::LN_LCBSTTBFGLSY: break;
382 // case NS_rtf::LN_FCPLCFGLSY: break;
383 // case NS_rtf::LN_LCBPLCFGLSY: break;
384 // case NS_rtf::LN_FCPLCFHDD: break;
385 // case NS_rtf::LN_LCBPLCFHDD: break;
386 // case NS_rtf::LN_FCPLCFBTECHPX: break;
387 // case NS_rtf::LN_LCBPLCFBTECHPX: break;
388 // case NS_rtf::LN_FCPLCFBTEPAPX: break;
389 // case NS_rtf::LN_LCBPLCFBTEPAPX: break;
390 // case NS_rtf::LN_FCPLCFSEA: break;
391 // case NS_rtf::LN_LCBPLCFSEA: break;
392 // case NS_rtf::LN_FCSTTBFFFN: break;
393 // case NS_rtf::LN_LCBSTTBFFFN: break;
394 // case NS_rtf::LN_FCPLCFFLDMOM: break;
395 // case NS_rtf::LN_LCBPLCFFLDMOM: break;
396 // case NS_rtf::LN_FCPLCFFLDHDR: break;
397 // case NS_rtf::LN_LCBPLCFFLDHDR: break;
398 // case NS_rtf::LN_FCPLCFFLDFTN: break;
399 // case NS_rtf::LN_LCBPLCFFLDFTN: break;
400 // case NS_rtf::LN_FCPLCFFLDATN: break;
401 // case NS_rtf::LN_LCBPLCFFLDATN: break;
402 // case NS_rtf::LN_FCPLCFFLDMCR: break;
403 // case NS_rtf::LN_LCBPLCFFLDMCR: break;
404 // case NS_rtf::LN_FCSTTBFBKMK: break;
405 // case NS_rtf::LN_LCBSTTBFBKMK: break;
406 // case NS_rtf::LN_FCPLCFBKF: break;
407 // case NS_rtf::LN_LCBPLCFBKF: break;
408 // case NS_rtf::LN_FCPLCFBKL: break;
409 // case NS_rtf::LN_LCBPLCFBKL: break;
410 // case NS_rtf::LN_FCCMDS: break;
411 // case NS_rtf::LN_LCBCMDS: break;
412 // case NS_rtf::LN_FCPLCMCR: break;
413 // case NS_rtf::LN_LCBPLCMCR: break;
414 // case NS_rtf::LN_FCSTTBFMCR: break;
415 // case NS_rtf::LN_LCBSTTBFMCR: break;
416 // case NS_rtf::LN_FCPRDRVR: break;
417 // case NS_rtf::LN_LCBPRDRVR: break;
418 // case NS_rtf::LN_FCPRENVPORT: break;
419 // case NS_rtf::LN_LCBPRENVPORT: break;
420 // case NS_rtf::LN_FCPRENVLAND: break;
421 // case NS_rtf::LN_LCBPRENVLAND: break;
422 // case NS_rtf::LN_FCWSS: break;
423 // case NS_rtf::LN_LCBWSS: break;
424 // case NS_rtf::LN_FCDOP: break;
425 // case NS_rtf::LN_LCBDOP: break;
426 // case NS_rtf::LN_FCSTTBFASSOC: break;
427 // case NS_rtf::LN_LCBSTTBFASSOC: break;
428 // case NS_rtf::LN_FCCLX: break;
429 // case NS_rtf::LN_LCBCLX: break;
430 // case NS_rtf::LN_FCPLCFPGDFTN: break;
431 // case NS_rtf::LN_LCBPLCFPGDFTN: break;
432 // case NS_rtf::LN_FCAUTOSAVESOURCE: break;
433 // case NS_rtf::LN_LCBAUTOSAVESOURCE: break;
434 // case NS_rtf::LN_FCGRPXSTATNOWNERS: break;
435 // case NS_rtf::LN_LCBGRPXSTATNOWNERS: break;
436 // case NS_rtf::LN_FCSTTBFATNBKMK: break;
437 // case NS_rtf::LN_LCBSTTBFATNBKMK: break;
438 // case NS_rtf::LN_FCPLCDOAMOM: break;
439 // case NS_rtf::LN_LCBPLCDOAMOM: break;
440 // case NS_rtf::LN_FCPLCDOAHDR: break;
441 // case NS_rtf::LN_LCBPLCDOAHDR: break;
442 // case NS_rtf::LN_FCPLCSPAMOM: break;
443 // case NS_rtf::LN_LCBPLCSPAMOM: break;
444 // case NS_rtf::LN_FCPLCSPAHDR: break;
445 // case NS_rtf::LN_LCBPLCSPAHDR: break;
446 // case NS_rtf::LN_FCPLCFATNBKF: break;
447 // case NS_rtf::LN_LCBPLCFATNBKF: break;
448 // case NS_rtf::LN_FCPLCFATNBKL: break;
449 // case NS_rtf::LN_LCBPLCFATNBKL: break;
450 // case NS_rtf::LN_FCPMS: break;
451 // case NS_rtf::LN_LCBPMS: break;
452 // case NS_rtf::LN_FCFORMFLDSTTBF: break;
453 // case NS_rtf::LN_LCBFORMFLDSTTBF: break;
454 // case NS_rtf::LN_FCPLCFENDREF: break;
455 // case NS_rtf::LN_LCBPLCFENDREF: break;
456 // case NS_rtf::LN_FCPLCFENDTXT: break;
457 // case NS_rtf::LN_LCBPLCFENDTXT: break;
458 // case NS_rtf::LN_FCPLCFFLDEDN: break;
459 // case NS_rtf::LN_LCBPLCFFLDEDN: break;
460 // case NS_rtf::LN_FCPLCFPGDEDN: break;
461 // case NS_rtf::LN_LCBPLCFPGDEDN: break;
462 // case NS_rtf::LN_FCDGGINFO: break;
463 // case NS_rtf::LN_LCBDGGINFO: break;
464 // case NS_rtf::LN_FCSTTBFRMARK: break;
465 // case NS_rtf::LN_LCBSTTBFRMARK: break;
466 // case NS_rtf::LN_FCSTTBFCAPTION: break;
467 // case NS_rtf::LN_LCBSTTBFCAPTION: break;
468 // case NS_rtf::LN_FCSTTBFAUTOCAPTION: break;
469 // case NS_rtf::LN_LCBSTTBFAUTOCAPTION: break;
470 // case NS_rtf::LN_FCPLCFWKB: break;
471 // case NS_rtf::LN_LCBPLCFWKB: break;
472 // case NS_rtf::LN_FCPLCFSPL: break;
473 // case NS_rtf::LN_LCBPLCFSPL: break;
474 // case NS_rtf::LN_FCPLCFTXBXTXT: break;
475 // case NS_rtf::LN_LCBPLCFTXBXTXT: break;
476 // case NS_rtf::LN_FCPLCFFLDTXBX: break;
477 // case NS_rtf::LN_LCBPLCFFLDTXBX: break;
478 // case NS_rtf::LN_FCPLCFHDRTXBXTXT: break;
479 // case NS_rtf::LN_LCBPLCFHDRTXBXTXT: break;
480 // case NS_rtf::LN_FCPLCFFLDHDRTXBX: break;
481 // case NS_rtf::LN_LCBPLCFFLDHDRTXBX: break;
482 // case NS_rtf::LN_FCSTWUSER: break;
483 // case NS_rtf::LN_LCBSTWUSER: break;
484 // case NS_rtf::LN_FCSTTBTTMBD: break;
485 // case NS_rtf::LN_LCBSTTBTTMBD: break;
486 // case NS_rtf::LN_FCUNUSED: break;
487 // case NS_rtf::LN_LCBUNUSED: break;
488 // case NS_rtf::LN_FCPGDMOTHER: break;
489 // case NS_rtf::LN_LCBPGDMOTHER: break;
490 // case NS_rtf::LN_FCBKDMOTHER: break;
491 // case NS_rtf::LN_LCBBKDMOTHER: break;
492 // case NS_rtf::LN_FCPGDFTN: break;
493 // case NS_rtf::LN_LCBPGDFTN: break;
494 // case NS_rtf::LN_FCBKDFTN: break;
495 // case NS_rtf::LN_LCBBKDFTN: break;
496 // case NS_rtf::LN_FCPGDEDN: break;
497 // case NS_rtf::LN_LCBPGDEDN: break;
498 // case NS_rtf::LN_FCBKDEDN: break;
499 // case NS_rtf::LN_LCBBKDEDN: break;
500 // case NS_rtf::LN_FCSTTBFINTLFLD: break;
501 // case NS_rtf::LN_LCBSTTBFINTLFLD: break;
502 // case NS_rtf::LN_FCROUTESLIP: break;
503 // case NS_rtf::LN_LCBROUTESLIP: break;
504 // case NS_rtf::LN_FCSTTBSAVEDBY: break;
505 // case NS_rtf::LN_LCBSTTBSAVEDBY: break;
506 // case NS_rtf::LN_FCSTTBFNM: break;
507 // case NS_rtf::LN_LCBSTTBFNM: break;
508 // case NS_rtf::LN_FCPLCFLST: break;
509 // case NS_rtf::LN_LCBPLCFLST: break;
510 // case NS_rtf::LN_FCPLFLFO: break;
511 // case NS_rtf::LN_LCBPLFLFO: break;
512 // case NS_rtf::LN_FCPLCFTXBXBKD: break;
513 // case NS_rtf::LN_LCBPLCFTXBXBKD: break;
514 // case NS_rtf::LN_FCPLCFTXBXHDRBKD: break;
515 // case NS_rtf::LN_LCBPLCFTXBXHDRBKD: break;
516 // case NS_rtf::LN_FCDOCUNDO: break;
517 // case NS_rtf::LN_LCBDOCUNDO: break;
518 // case NS_rtf::LN_FCRGBUSE: break;
519 // case NS_rtf::LN_LCBRGBUSE: break;
520 // case NS_rtf::LN_FCUSP: break;
521 // case NS_rtf::LN_LCBUSP: break;
522 // case NS_rtf::LN_FCUSKF: break;
523 // case NS_rtf::LN_LCBUSKF: break;
524 // case NS_rtf::LN_FCPLCUPCRGBUSE: break;
525 // case NS_rtf::LN_LCBPLCUPCRGBUSE: break;
526 // case NS_rtf::LN_FCPLCUPCUSP: break;
527 // case NS_rtf::LN_LCBPLCUPCUSP: break;
528 // case NS_rtf::LN_FCSTTBGLSYSTYLE: break;
529 // case NS_rtf::LN_LCBSTTBGLSYSTYLE: break;
530 // case NS_rtf::LN_FCPLGOSL: break;
531 // case NS_rtf::LN_LCBPLGOSL: break;
532 // case NS_rtf::LN_FCPLCOCX: break;
533 // case NS_rtf::LN_LCBPLCOCX: break;
534 // case NS_rtf::LN_FCPLCFBTELVC: break;
535 // case NS_rtf::LN_LCBPLCFBTELVC: break;
536 // case NS_rtf::LN_DWLOWDATETIME: break;
537 // case NS_rtf::LN_DWHIGHDATETIME: break;
538 // case NS_rtf::LN_FCPLCFLVC: break;
539 // case NS_rtf::LN_LCBPLCFLVC: break;
540 // case NS_rtf::LN_FCPLCASUMY: break;
541 // case NS_rtf::LN_LCBPLCASUMY: break;
542 // case NS_rtf::LN_FCPLCFGRAM: break;
543 // case NS_rtf::LN_LCBPLCFGRAM: break;
544 // case NS_rtf::LN_FCSTTBLISTNAMES: break;
545 // case NS_rtf::LN_LCBSTTBLISTNAMES: break;
546 // case NS_rtf::LN_FCSTTBFUSSR: break;
547 // case NS_rtf::LN_LCBSTTBFUSSR: break;
548 // case NS_rtf::LN_FN: break;
549 // case NS_rtf::LN_FCSEPX: break;
550 // case NS_rtf::LN_FNMPR: break;
551 // case NS_rtf::LN_FCMPR: break;
552 // case NS_rtf::LN_ICOFORE: break;
553 // case NS_rtf::LN_ICOBACK: break;
554 // case NS_rtf::LN_IPAT: break;
555 // case NS_rtf::LN_SHDFORECOLOR: break;
556 // case NS_rtf::LN_SHDBACKCOLOR: break;
557 // case NS_rtf::LN_SHDPATTERN: break;
558 // case NS_rtf::LN_DPTLINEWIDTH: break;
559 // case NS_rtf::LN_BRCTYPE: break;
560 // case NS_rtf::LN_ICO: break;
561 // case NS_rtf::LN_DPTSPACE: break;
562 // case NS_rtf::LN_FSHADOW: break;
563 // case NS_rtf::LN_FFRAME: break;
564 // case NS_rtf::LN_UNUSED2_15: break;
565 // case NS_rtf::LN_FFIRSTMERGED: break;
566 // case NS_rtf::LN_FMERGED: break;
567 // case NS_rtf::LN_FVERTICAL: break;
568 // case NS_rtf::LN_FBACKWARD: break;
569 // case NS_rtf::LN_FROTATEFONT: break;
570 // case NS_rtf::LN_FVERTMERGE: break;
571 // case NS_rtf::LN_FVERTRESTART: break;
572 // case NS_rtf::LN_VERTALIGN: break;
573 // case NS_rtf::LN_FUNUSED: break;
574 // case NS_rtf::LN_WUNUSED: break;
575 // case NS_rtf::LN_BRCTOP: break;
576 // case NS_rtf::LN_BRCLEFT: break;
577 // case NS_rtf::LN_BRCBOTTOM: break;
578 // case NS_rtf::LN_BRCRIGHT: break;
579 // case NS_rtf::LN_IBKL: break;
580 // case NS_rtf::LN_ITCFIRST: break;
581 // case NS_rtf::LN_FPUB: break;
582 // case NS_rtf::LN_ITCLIM: break;
583 // case NS_rtf::LN_FCOL: break;
584 // case NS_rtf::LN_LINECOLOR: break;
585 // case NS_rtf::LN_LINEWIDTH: break;
586 // case NS_rtf::LN_LINETYPE: break;
587 // case NS_rtf::LN_MM: break;
588 // case NS_rtf::LN_XEXT: break;
589 // case NS_rtf::LN_YEXT: break;
590 // case NS_rtf::LN_HMF: break;
591 // case NS_rtf::LN_LCB: break;
592 // case NS_rtf::LN_CBHEADER: break;
593 // case NS_rtf::LN_MFP: break;
594 // case NS_rtf::LN_BM_RCWINMF: break;
595 // case NS_rtf::LN_DXAGOAL: break;
596 // case NS_rtf::LN_DYAGOAL: break;
597 // case NS_rtf::LN_MX: break;
598 // case NS_rtf::LN_MY: break;
599 // case NS_rtf::LN_DXACROPLEFT: break;
600 // case NS_rtf::LN_DYACROPTOP: break;
601 // case NS_rtf::LN_DXACROPRIGHT: break;
602 // case NS_rtf::LN_DYACROPBOTTOM: break;
603 // case NS_rtf::LN_BRCL: break;
604 // case NS_rtf::LN_FFRAMEEMPTY: break;
605 // case NS_rtf::LN_FBITMAP: break;
606 // case NS_rtf::LN_FDRAWHATCH: break;
607 // case NS_rtf::LN_FERROR: break;
608 // case NS_rtf::LN_BPP: break;
609 // case NS_rtf::LN_DXAORIGIN: break;
610 // case NS_rtf::LN_DYAORIGIN: break;
611 // case NS_rtf::LN_CPROPS: break;
612 // case NS_rtf::LN_LINEPROPSTOP: break;
613 // case NS_rtf::LN_LINEPROPSLEFT: break;
614 // case NS_rtf::LN_LINEPROPSBOTTOM: break;
615 // case NS_rtf::LN_LINEPROPSRIGHT: break;
616 // case NS_rtf::LN_LINEPROPSHORIZONTAL: break;
617 // case NS_rtf::LN_LINEPROPSVERTICAL: break;
618 // case NS_rtf::LN_headerr: break;
619 // case NS_rtf::LN_footerr: break;
620 // case NS_rtf::LN_endnote: break;
621 // case NS_rtf::LN_BOOKMARKNAME: break;
623 // case NS_rtf::LN_LISTLEVEL: break;
624 // case NS_rtf::LN_LFO: break;
625 // case NS_rtf::LN_F: break;
626 // case NS_rtf::LN_ALTFONTNAME: break;
627 // case NS_rtf::LN_XSZFFN: break;
628 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
629 case NS_rtf::LN_XSTZNAME
:
630 m_pImpl
->m_pCurrentEntry
->sStyleName1
= sValue
;
631 if (m_pImpl
->m_pCurrentEntry
->sStyleIdentifierI
.getLength())
632 m_pImpl
->m_pCurrentEntry
->sStyleIdentifierI
= sValue
;
634 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
635 case NS_rtf::LN_XSTZNAME1
:
636 m_pImpl
->m_pCurrentEntry
->sStyleName
= sValue
;
637 if (m_pImpl
->m_pCurrentEntry
->sStyleIdentifierI
.getLength())
638 m_pImpl
->m_pCurrentEntry
->sStyleIdentifierI
= sValue
;
640 // case NS_rtf::LN_UPXSTART: break;
641 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
643 resolveAttributeProperties(val
);
645 // case NS_rtf::LN_sed: break;
646 // case NS_rtf::LN_picf: break;
648 // case NS_rtf::LN_rgbrc: break;
649 // case NS_rtf::LN_shd: break;
650 // case NS_rtf::LN_cellShd: break;
651 // case NS_rtf::LN_cellTopColor: break;
652 // case NS_rtf::LN_cellLeftColor: break;
653 // case NS_rtf::LN_cellBottomColor: break;
654 // case NS_rtf::LN_cellRightColor: break;
656 // case NS_rtf::LN_LISTTABLE: break;
657 // case NS_rtf::LN_LFOTABLE: break;
658 // case NS_rtf::LN_StyleSheetTable: break;
659 // case NS_rtf::LN_STYLESHEET: break;
660 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
661 case NS_ooxml::LN_CT_Style_type
:
662 /* defaults should be set at the service "com.sun.star.text.Defaults"
664 *(m_pImpl->m_pCurrentEntry->pProperties) = *(m_pImpl->m_pDefaultParaProps);
665 else if (nIntValue == 2)
666 *(m_pImpl->m_pCurrentEntry->pProperties) = *(m_pImpl->m_pDefaultCharProps);*/
667 m_pImpl
->m_pCurrentEntry
->nStyleTypeCode
= (StyleType
)nIntValue
;
669 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
670 case NS_ooxml::LN_CT_Style_default
:
671 m_pImpl
->m_pCurrentEntry
->bIsDefaultStyle
= (nIntValue
!= 0);
673 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
674 case NS_ooxml::LN_CT_Style_customStyle
:
676 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
677 case NS_ooxml::LN_CT_Style_styleId
:
678 m_pImpl
->m_pCurrentEntry
->sStyleIdentifierI
= sValue
;
679 m_pImpl
->m_pCurrentEntry
->sStyleIdentifierD
= sValue
;
681 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
682 case NS_ooxml::LN_CT_TblWidth_w
:
683 dynamic_cast< StyleSheetPropertyMap
* >( m_pImpl
->m_pCurrentEntry
->pProperties
.get() )->SetCT_TblWidth_w( nIntValue
);
685 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
686 case NS_ooxml::LN_CT_TblWidth_type
:
687 dynamic_cast< StyleSheetPropertyMap
* >( m_pImpl
->m_pCurrentEntry
->pProperties
.get() )->SetCT_TblWidth_type( nIntValue
);
692 int nVal
= val
.getInt();
699 /*-- 19.06.2006 12:04:33---------------------------------------------------
701 -----------------------------------------------------------------------*/
702 void StyleSheetTable::sprm(Sprm
& rSprm
)
704 sal_uInt32 nSprmId
= rSprm
.getId();
705 Value::Pointer_t pValue
= rSprm
.getValue();
706 sal_Int32 nIntValue
= pValue
.get() ? pValue
->getInt() : 0;
708 rtl::OUString sStringValue
= pValue
.get() ? pValue
->getString() : rtl::OUString();
709 //printf ( "StyleSheetTable::sprm(0x%.4x, 0x%.4x) [%s]\n", (unsigned int)nSprmId, (unsigned int)nIntValue, ::rtl::OUStringToOString(sStringValue, RTL_TEXTENCODING_DONTKNOW).getStr());
711 /* WRITERFILTERSTATUS: table: StyleSheetTable_sprm */
714 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
715 case NS_ooxml::LN_CT_Style_name
:
716 //this is only a UI name!
717 m_pImpl
->m_pCurrentEntry
->sStyleName
= sStringValue
;
718 m_pImpl
->m_pCurrentEntry
->sStyleName1
= sStringValue
;
720 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
721 case NS_ooxml::LN_CT_Style_basedOn
:
722 m_pImpl
->m_pCurrentEntry
->sBaseStyleIdentifier
= sStringValue
;
724 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
725 case NS_ooxml::LN_CT_Style_next
:
726 m_pImpl
->m_pCurrentEntry
->sNextStyleIdentifier
= sStringValue
;
728 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
729 case NS_ooxml::LN_CT_Style_aliases
:
730 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
731 case NS_ooxml::LN_CT_Style_link
:
732 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
733 case NS_ooxml::LN_CT_Style_autoRedefine
:
734 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
735 case NS_ooxml::LN_CT_Style_hidden
:
736 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
737 case NS_ooxml::LN_CT_Style_uiPriority
:
738 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
739 case NS_ooxml::LN_CT_Style_semiHidden
:
740 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
741 case NS_ooxml::LN_CT_Style_unhideWhenUsed
:
742 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
743 case NS_ooxml::LN_CT_Style_qFormat
:
744 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
745 case NS_ooxml::LN_CT_Style_locked
:
746 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
747 case NS_ooxml::LN_CT_Style_personal
:
748 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
749 case NS_ooxml::LN_CT_Style_personalCompose
:
750 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
751 case NS_ooxml::LN_CT_Style_personalReply
:
752 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
753 case NS_ooxml::LN_CT_Style_rsid
:
754 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
755 case NS_ooxml::LN_CT_Style_trPr
:
756 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
757 case NS_ooxml::LN_CT_Style_tcPr
:
759 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
760 case NS_ooxml::LN_CT_Style_tblPr
: //contains table properties
761 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
762 case NS_ooxml::LN_CT_Style_tblStylePr
: //contains to table properties
763 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
764 case NS_ooxml::LN_CT_DocDefaults_pPrDefault
:
765 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
766 case NS_ooxml::LN_CT_DocDefaults_rPrDefault
:
767 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
768 case NS_ooxml::LN_CT_TblPrBase_tblInd
: //table properties - at least width value and type
769 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
770 case NS_ooxml::LN_EG_RPrBase_rFonts
: //table fonts
771 resolveSprmProps(rSprm
);
773 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
774 case NS_ooxml::LN_CT_PPrDefault_pPr
:
775 m_pImpl
->m_rDMapper
.PushStyleSheetProperties( m_pImpl
->m_pDefaultParaProps
);
776 m_pImpl
->m_rDMapper
.sprm( rSprm
);
777 m_pImpl
->m_rDMapper
.PopStyleSheetProperties();
778 applyDefaults( true );
780 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
781 case NS_ooxml::LN_CT_RPrDefault_rPr
:
782 m_pImpl
->m_rDMapper
.PushStyleSheetProperties( m_pImpl
->m_pDefaultCharProps
);
783 m_pImpl
->m_rDMapper
.sprm( rSprm
);
784 m_pImpl
->m_rDMapper
.PopStyleSheetProperties();
785 applyDefaults( false );
787 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
788 case NS_ooxml::LN_CT_TblPrBase_jc
: //table alignment - row properties!
789 m_pImpl
->m_pCurrentEntry
->pProperties
->Insert( PROP_HORI_ORIENT
, false,
790 uno::makeAny( ConversionHelper::convertTableJustification( nIntValue
)));
792 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
793 case NS_ooxml::LN_CT_TrPrBase_jc
: //table alignment - row properties!
794 dynamic_cast< StyleSheetPropertyMap
* >( m_pImpl
->m_pCurrentEntry
->pProperties
.get() )->SetCT_TrPrBase_jc(nIntValue
);
796 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
797 case NS_ooxml::LN_CT_TblPrBase_tblBorders
: //table borders, might be defined in table style
799 writerfilter::Reference
<Properties
>::Pointer_t pProperties
= rSprm
.getProps();
800 if( pProperties
.get())
802 BorderHandlerPtr
pBorderHandler( new BorderHandler(m_pImpl
->m_rDMapper
.IsOOXMLImport()) );
803 pProperties
->resolve(*pBorderHandler
);
804 m_pImpl
->m_pCurrentEntry
->pProperties
->insert( pBorderHandler
->getProperties(), true );
808 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
809 case NS_ooxml::LN_CT_Style_pPr
:
810 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
811 case NS_ooxml::LN_CT_Style_rPr
:
813 if (!m_pImpl
->m_pCurrentEntry
)
815 m_pImpl
->m_rDMapper
.sprm( rSprm
, m_pImpl
->m_pCurrentEntry
->pProperties
);
818 /*-- 19.06.2006 12:04:33---------------------------------------------------
820 -----------------------------------------------------------------------*/
821 void StyleSheetTable::entry(int /*pos*/, writerfilter::Reference
<Properties
>::Pointer_t ref
)
823 //create a new style entry
824 // printf("StyleSheetTable::entry(...)\n");
825 OSL_ENSURE( !m_pImpl
->m_pCurrentEntry
, "current entry has to be NULL here");
826 m_pImpl
->m_pCurrentEntry
= new StyleSheetEntry
;
827 m_pImpl
->m_rDMapper
.PushStyleSheetProperties( m_pImpl
->m_pCurrentEntry
->pProperties
);
829 //append it to the table
830 m_pImpl
->m_rDMapper
.PopStyleSheetProperties();
831 if( !m_pImpl
->m_rDMapper
.IsOOXMLImport() || m_pImpl
->m_pCurrentEntry
->sStyleName
.getLength() >0)
833 m_pImpl
->m_pCurrentEntry
->sConvertedStyleName
= ConvertStyleName( m_pImpl
->m_pCurrentEntry
->sStyleName
);
834 m_pImpl
->m_aStyleSheetEntries
.push_back( *m_pImpl
->m_pCurrentEntry
);
838 //TODO: this entry contains the default settings - they have to be added to the settings
840 m_pImpl
->m_pCurrentEntry
= 0;
842 /*-- 21.06.2006 15:34:49---------------------------------------------------
844 -----------------------------------------------------------------------*/
845 typedef std::vector
< beans::PropertyValue
> _PropValVector
;
846 class PropValVector
: public _PropValVector
851 void Insert( beans::PropertyValue aVal
);
852 uno::Sequence
< uno::Any
> getValues();
853 uno::Sequence
< ::rtl::OUString
> getNames();
855 void PropValVector::Insert( beans::PropertyValue aVal
)
857 _PropValVector::iterator aIt
= begin();
860 if(aIt
->Name
> aVal
.Name
)
869 uno::Sequence
< uno::Any
> PropValVector::getValues()
871 uno::Sequence
< uno::Any
> aRet( size() );
872 uno::Any
* pValues
= aRet
.getArray();
874 _PropValVector::iterator aIt
= begin();
877 pValues
[nVal
++] = aIt
->Value
;
882 uno::Sequence
< ::rtl::OUString
> PropValVector::getNames()
884 uno::Sequence
< ::rtl::OUString
> aRet( size() );
885 ::rtl::OUString
* pNames
= aRet
.getArray();
887 _PropValVector::iterator aIt
= begin();
890 pNames
[nVal
++] = aIt
->Name
;
895 /*-- 21.06.2006 13:35:48---------------------------------------------------
897 -----------------------------------------------------------------------*/
898 void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable
)
902 uno::Reference
< style::XStyleFamiliesSupplier
> xStylesSupplier( m_pImpl
->m_xTextDocument
, uno::UNO_QUERY_THROW
);
903 uno::Reference
< lang::XMultiServiceFactory
> xDocFactory( m_pImpl
->m_xTextDocument
, uno::UNO_QUERY_THROW
);
904 uno::Reference
< container::XNameAccess
> xStyleFamilies
= xStylesSupplier
->getStyleFamilies();
905 uno::Reference
<container::XNameContainer
> xCharStyles
;
906 uno::Reference
<container::XNameContainer
> xParaStyles
;
908 PropertyNameSupplier
& rPropNameSupplier
= PropertyNameSupplier::GetPropertyNameSupplier();
909 xStyleFamilies
->getByName(rPropNameSupplier
.GetName( PROP_CHARACTER_STYLES
)) >>= xCharStyles
;
910 xStyleFamilies
->getByName(rPropNameSupplier
.GetName( PROP_PARAGRAPH_STYLES
)) >>= xParaStyles
;
911 if(xCharStyles
.is() && xParaStyles
.is())
913 std::vector
< StyleSheetEntry
>::iterator aIt
= m_pImpl
->m_aStyleSheetEntries
.begin();
914 while( aIt
!= m_pImpl
->m_aStyleSheetEntries
.end() )
916 if( aIt
->nStyleTypeCode
== STYLE_TYPE_CHAR
|| aIt
->nStyleTypeCode
== STYLE_TYPE_PARA
)
918 bool bParaStyle
= aIt
->nStyleTypeCode
== STYLE_TYPE_PARA
;
919 bool bInsert
= false;
920 uno::Reference
< container::XNameContainer
> xStyles
= bParaStyle
? xParaStyles
: xCharStyles
;
921 uno::Reference
< style::XStyle
> xStyle
;
922 ::rtl::OUString sConvertedStyleName
= ConvertStyleName( aIt
->sStyleName
);
923 if(xStyles
->hasByName( sConvertedStyleName
))
924 xStyles
->getByName( sConvertedStyleName
) >>= xStyle
;
928 xStyle
= uno::Reference
< style::XStyle
>(xDocFactory
->createInstance(
930 rPropNameSupplier
.GetName( PROP_SERVICE_PARA_STYLE
) :
931 rPropNameSupplier
.GetName( PROP_SERVICE_CHAR_STYLE
)),
932 uno::UNO_QUERY_THROW
);
934 if( aIt
->sBaseStyleIdentifier
.getLength() )
938 //TODO: Handle cases where a paragraph <> character style relation is needed
939 xStyle
->setParentStyle(ConvertStyleName( aIt
->sBaseStyleIdentifier
));
941 catch( const uno::RuntimeException
& )
943 OSL_ENSURE( false, "Styles parent could not be set");
946 else if( bParaStyle
)
948 //now it's time to set the default parameters - for paragraph styles
949 //Fonts: Western first entry in font table
951 //CTL: third entry, if it exists
953 sal_uInt32 nFontCount
= rFontTable
->size();
954 if( !m_pImpl
->m_rDMapper
.IsOOXMLImport() && nFontCount
> 2 )
956 uno::Any aTwoHundredFortyTwip
= uno::makeAny(12.);
957 // font size to 240 twip (12 pts) for all if not set
958 aIt
->pProperties
->Insert(PROP_CHAR_HEIGHT
, true, aTwoHundredFortyTwip
, false);
959 // western font not already set -> apply first font
960 const FontEntry
* pWesternFontEntry
= rFontTable
->getFontEntry( 0 );
961 rtl::OUString sWesternFontName
= pWesternFontEntry
->sFontName
;
962 aIt
->pProperties
->Insert(PROP_CHAR_FONT_NAME
, true, uno::makeAny( sWesternFontName
), false);
964 // CJK ... apply second font
965 const FontEntry
* pCJKFontEntry
= rFontTable
->getFontEntry( 2 );
966 aIt
->pProperties
->Insert(PROP_CHAR_FONT_NAME_ASIAN
, true, uno::makeAny( pCJKFontEntry
->sFontName
), false);
967 aIt
->pProperties
->Insert(PROP_CHAR_HEIGHT_ASIAN
, true, aTwoHundredFortyTwip
, false);
968 // CTL ... apply third font, if available
971 const FontEntry
* pCTLFontEntry
= rFontTable
->getFontEntry( 3 );
972 aIt
->pProperties
->Insert(PROP_CHAR_FONT_NAME_COMPLEX
, true, uno::makeAny( pCTLFontEntry
->sFontName
), false);
973 aIt
->pProperties
->Insert(PROP_CHAR_HEIGHT_COMPLEX
, true, aTwoHundredFortyTwip
, false);
976 // Widow/Orphan -> set both to two if not already set
977 uno::Any aTwo
= uno::makeAny(sal_Int8(2));
978 aIt
->pProperties
->Insert(PROP_PARA_WIDOWS
, true, aTwo
, false);
979 aIt
->pProperties
->Insert(PROP_PARA_ORPHANS
, true, aTwo
, false);
980 // Left-to-right direction if not already set
981 aIt
->pProperties
->Insert(PROP_WRITING_MODE
, true, uno::makeAny( sal_Int16(text::WritingMode_LR_TB
) ), false);
982 // font color COL_AUTO if not already set
983 aIt
->pProperties
->Insert(PROP_CHAR_COLOR
, true, uno::makeAny( sal_Int32(0xffffffff) ), false);
986 uno::Sequence
< beans::PropertyValue
> aPropValues
= aIt
->pProperties
->GetPropertyValues();
987 bool bAddFollowStyle
= false;
988 if(bParaStyle
&& !aIt
->sNextStyleIdentifier
.getLength() )
990 bAddFollowStyle
= true;
992 //remove Left/RightMargin values from TOX heading styles
995 uno::Reference
< beans::XPropertyState
>xState( xStyle
, uno::UNO_QUERY_THROW
);
996 if( sConvertedStyleName
.equalsAscii( "Contents Heading" ) ||
997 sConvertedStyleName
.equalsAscii( "User Index Heading" ) ||
998 sConvertedStyleName
.equalsAscii( "Index Heading" ))
1000 //left margin is set to NULL by default
1001 uno::Reference
< beans::XPropertyState
>xState1( xStyle
, uno::UNO_QUERY_THROW
);
1002 xState1
->setPropertyToDefault(rPropNameSupplier
.GetName( PROP_PARA_LEFT_MARGIN
));
1004 else if( sConvertedStyleName
.equalsAscii( "Text body" ) )
1005 xState
->setPropertyToDefault(rPropNameSupplier
.GetName( PROP_PARA_BOTTOM_MARGIN
));
1006 else if( sConvertedStyleName
.equalsAscii( "Heading 1" ) ||
1007 sConvertedStyleName
.equalsAscii( "Heading 2" ) ||
1008 sConvertedStyleName
.equalsAscii( "Heading 3" ) ||
1009 sConvertedStyleName
.equalsAscii( "Heading 4" ) ||
1010 sConvertedStyleName
.equalsAscii( "Heading 5" ) ||
1011 sConvertedStyleName
.equalsAscii( "Heading 6" ) ||
1012 sConvertedStyleName
.equalsAscii( "Heading 7" ) ||
1013 sConvertedStyleName
.equalsAscii( "Heading 8" ) ||
1014 sConvertedStyleName
.equalsAscii( "Heading 9" ) )
1016 xState
->setPropertyToDefault(rPropNameSupplier
.GetName( PROP_CHAR_WEIGHT
));
1017 xState
->setPropertyToDefault(rPropNameSupplier
.GetName( PROP_CHAR_WEIGHT_ASIAN
));
1018 xState
->setPropertyToDefault(rPropNameSupplier
.GetName( PROP_CHAR_WEIGHT_COMPLEX
));
1019 xState
->setPropertyToDefault(rPropNameSupplier
.GetName( PROP_CHAR_POSTURE
));
1020 xState
->setPropertyToDefault(rPropNameSupplier
.GetName( PROP_CHAR_POSTURE_ASIAN
));
1021 xState
->setPropertyToDefault(rPropNameSupplier
.GetName( PROP_CHAR_POSTURE_COMPLEX
));
1022 xState
->setPropertyToDefault(rPropNameSupplier
.GetName( PROP_CHAR_PROP_HEIGHT
));
1023 xState
->setPropertyToDefault(rPropNameSupplier
.GetName( PROP_CHAR_PROP_HEIGHT_ASIAN
));
1024 xState
->setPropertyToDefault(rPropNameSupplier
.GetName( PROP_CHAR_PROP_HEIGHT_COMPLEX
));
1029 if(bAddFollowStyle
|| aPropValues
.getLength())
1031 const beans::PropertyValue
* pPropValues
= aPropValues
.getConstArray();
1032 PropValVector aSortedPropVals
;
1033 for( sal_Int32 nProp
= 0; nProp
< aPropValues
.getLength(); ++nProp
)
1035 aSortedPropVals
.Insert( pPropValues
[nProp
] );
1039 //find the name of the Next style
1040 std::vector
< StyleSheetEntry
>::iterator aNextStyleIt
= m_pImpl
->m_aStyleSheetEntries
.begin();
1041 for( ; aNextStyleIt
!= m_pImpl
->m_aStyleSheetEntries
.end(); ++aNextStyleIt
)
1043 if( aNextStyleIt
->sStyleName
.getLength() &&
1044 aNextStyleIt
->sStyleName
== aIt
->sNextStyleIdentifier
)
1046 beans::PropertyValue aNew
;
1047 aNew
.Name
= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FollowStyle"));
1048 aNew
.Value
= uno::makeAny(ConvertStyleName( aNextStyleIt
->sStyleIdentifierD
));
1049 aSortedPropVals
.Insert( aNew
);
1057 uno::Reference
< beans::XMultiPropertySet
> xMultiPropertySet( xStyle
, uno::UNO_QUERY_THROW
);
1058 xMultiPropertySet
->setPropertyValues( aSortedPropVals
.getNames(), aSortedPropVals
.getValues() );
1060 catch( const beans::UnknownPropertyException
& rUnknown
)
1063 OSL_ENSURE( false, "Some style properties could not be set");
1065 catch( const lang::WrappedTargetException
& rWrapped
)
1068 OSL_ENSURE( false, "Some style properties could not be set");
1072 xStyles
->insertByName( sConvertedStyleName
, uno::makeAny( xStyle
) );
1078 catch( uno::Exception
& rEx
)
1081 OSL_ENSURE( false, "Styles could not be imported completely");
1084 /*-- 22.06.2006 15:56:56---------------------------------------------------
1086 -----------------------------------------------------------------------*/
1087 const StyleSheetEntry
* StyleSheetTable::FindStyleSheetByISTD(const ::rtl::OUString
& sIndex
)
1089 const StyleSheetEntry
* pRet
= 0;
1090 for( sal_uInt32 nPos
= 0; nPos
< m_pImpl
->m_aStyleSheetEntries
.size(); ++nPos
)
1092 if( m_pImpl
->m_aStyleSheetEntries
[nPos
].sStyleIdentifierD
== sIndex
)
1094 pRet
= &m_pImpl
->m_aStyleSheetEntries
[nPos
];
1100 /*-- 28.12.2007 14:45:45---------------------------------------------------
1102 -----------------------------------------------------------------------*/
1103 const StyleSheetEntry
* StyleSheetTable::FindStyleSheetByStyleName(const ::rtl::OUString
& sIndex
)
1105 const StyleSheetEntry
* pRet
= 0;
1106 for( sal_uInt32 nPos
= 0; nPos
< m_pImpl
->m_aStyleSheetEntries
.size(); ++nPos
)
1108 if( m_pImpl
->m_aStyleSheetEntries
[nPos
].sStyleName
== sIndex
)
1110 pRet
= &m_pImpl
->m_aStyleSheetEntries
[nPos
];
1116 /*-- 28.12.2007 14:45:45---------------------------------------------------
1118 -----------------------------------------------------------------------*/
1119 const StyleSheetEntry
* StyleSheetTable::FindStyleSheetByConvertedStyleName(const ::rtl::OUString
& sIndex
)
1121 const StyleSheetEntry
* pRet
= 0;
1122 for( sal_uInt32 nPos
= 0; nPos
< m_pImpl
->m_aStyleSheetEntries
.size(); ++nPos
)
1124 if( m_pImpl
->m_aStyleSheetEntries
[nPos
].sConvertedStyleName
== sIndex
)
1126 pRet
= &m_pImpl
->m_aStyleSheetEntries
[nPos
];
1133 /*-- 17.07.2006 11:47:00---------------------------------------------------
1135 -----------------------------------------------------------------------*/
1136 const StyleSheetEntry
* StyleSheetTable::FindParentStyleSheet(::rtl::OUString sBaseStyle
)
1138 if( !sBaseStyle
.getLength() )
1140 if( m_pImpl
->m_pCurrentEntry
)
1141 sBaseStyle
= m_pImpl
->m_pCurrentEntry
->sBaseStyleIdentifier
;
1143 const StyleSheetEntry
* pRet
= 0;
1144 for( sal_uInt32 nPos
= 0; nPos
< m_pImpl
->m_aStyleSheetEntries
.size(); ++nPos
)
1146 if( m_pImpl
->m_aStyleSheetEntries
[nPos
].sStyleIdentifierD
== sBaseStyle
)
1148 pRet
= &m_pImpl
->m_aStyleSheetEntries
[nPos
];
1154 /*-- 21.12.2006 15:58:23---------------------------------------------------
1156 -----------------------------------------------------------------------*/
1157 static const sal_Char
*aStyleNamePairs
[] =
1159 "Normal", "Standard",
1160 "heading 1", "Heading 1",
1161 "heading 2", "Heading 2",
1162 "heading 3", "Heading 3",
1163 "heading 4", "Heading 4",
1164 "heading 5", "Heading 5",
1165 "heading 6", "Heading 6",
1166 "heading 7", "Heading 7",
1167 "heading 8", "Heading 8",
1168 "heading 9", "Heading 9",
1169 "Heading1", "Heading 1",
1170 "Heading2", "Heading 2",
1171 "Heading3", "Heading 3",
1172 "Heading4", "Heading 4",
1173 "Heading5", "Heading 5",
1174 "Heading6", "Heading 6",
1175 "Heading7", "Heading 7",
1176 "Heading8", "Heading 8",
1177 "Heading9", "Heading 9",
1178 "Heading 1", "Heading 1",
1179 "Heading 2", "Heading 2",
1180 "Heading 3", "Heading 3",
1181 "Heading 4", "Heading 4",
1182 "Heading 5", "Heading 5",
1183 "Heading 6", "Heading 6",
1184 "Heading 7", "Heading 7",
1185 "Heading 8", "Heading 8",
1186 "Heading 9", "Heading 9",
1187 "Index 1", "Index 1",
1188 "Index 2", "Index 2",
1189 "Index 3", "Index 3",
1196 "TOC 1", "Contents 1",
1197 "TOC 2", "Contents 2",
1198 "TOC 3", "Contents 3",
1199 "TOC 4", "Contents 4",
1200 "TOC 5", "Contents 5",
1201 "TOC 6", "Contents 6",
1202 "TOC 7", "Contents 7",
1203 "TOC 8", "Contents 8",
1204 "TOC 9", "Contents 9",
1205 "TOC Heading", "Contents Heading",
1206 "TOCHeading", "Contents Heading",
1207 "toc 1", "Contents 1",
1208 "toc 2", "Contents 2",
1209 "toc 3", "Contents 3",
1210 "toc 4", "Contents 4",
1211 "toc 5", "Contents 5",
1212 "toc 6", "Contents 6",
1213 "toc 7", "Contents 7",
1214 "toc 8", "Contents 8",
1215 "toc 9", "Contents 9",
1216 "TOC1", "Contents 1",
1217 "TOC2", "Contents 2",
1218 "TOC3", "Contents 3",
1219 "TOC4", "Contents 4",
1220 "TOC5", "Contents 5",
1221 "TOC6", "Contents 6",
1222 "TOC7", "Contents 7",
1223 "TOC8", "Contents 8",
1224 "TOC9", "Contents 9",
1226 "Footnote Text", "Footnote",
1227 "Annotation Text", 0,
1232 "Index Heading", "Index Heading",
1234 "Table of Figures", 0,
1235 "Envelope Address", "Addressee",
1236 "Envelope Return", "Sender",
1237 "Footnote Reference", "Footnote anchor",
1238 "Annotation Reference", 0,
1239 "Line Number", "Line numbering",
1240 "Page Number", "Page Number",
1241 "Endnote Reference", "Endnote anchor",
1242 "Endnote Text", "Endnote Symbol",
1243 "Table of Authorities", 0,
1263 "Signature", "Signature",
1264 "Default Paragraph Font", 0,
1265 "DefaultParagraphFont", "Default Paragraph Font",
1266 "Body Text", "Text body",
1267 "BodyText", "Text body",
1268 "BodyTextIndentItalic", "Text body indent italic",
1269 "Body Text Indent", "Text body indent",
1270 "BodyTextIndent", "Text body indent",
1271 "BodyTextIndent2", "Text body indent2",
1273 "List Continue 2", 0,
1274 "List Continue 3", 0,
1275 "List Continue 4", 0,
1276 "List Continue 5", 0,
1277 "Message Header", 0,
1278 "Subtitle", "Subtitle",
1281 "Body Text First Indent", "Body Text Indent",
1282 "Body Text First Indent 2", 0,
1286 "Body Text Indent 2", 0,
1287 "Body Text Indent 3", 0,
1289 "Hyperlink", "Internet link",
1290 "Followed Hyperlink", "Visited Internet Link",
1291 "Strong", "Strong Emphasis",
1292 "Emphasis", "Emphasis",
1295 "NoList", "No List",
1296 "AbstractHeading", "Abstract Heading",
1297 "AbstractBody", "Abstract Body",
1298 "PageNumber", "page number"
1299 "TableNormal", "Normal Table",
1300 "DocumentMap", "Document Map"
1304 ::rtl::OUString
StyleSheetTable::ConvertStyleName( const ::rtl::OUString
& rWWName
, bool bExtendedSearch
)
1306 ::rtl::OUString
sRet( rWWName
);
1307 if( bExtendedSearch
)
1309 //search for the rWWName in the IdentifierD of the existing styles and convert the sStyleName member
1310 std::vector
< StyleSheetEntry
>::iterator aIt
= m_pImpl
->m_aStyleSheetEntries
.begin();
1311 //TODO: performance issue - put styles list into a map sorted by it's sStyleIdentifierD members
1312 while( aIt
!= m_pImpl
->m_aStyleSheetEntries
.end() )
1314 if( rWWName
== aIt
->sStyleIdentifierD
)
1315 sRet
= aIt
->sStyleName
;
1319 if(!m_pImpl
->m_aStyleNameMap
.size())
1321 for( sal_uInt32 nPair
= 0; nPair
< sizeof(aStyleNamePairs
) / sizeof( sal_Char
*) / 2; ++nPair
)
1323 m_pImpl
->m_aStyleNameMap
.insert( StringPairMap_t::value_type(
1324 ::rtl::OUString::createFromAscii(aStyleNamePairs
[2 * nPair
]),
1325 ::rtl::OUString::createFromAscii(aStyleNamePairs
[2 * nPair
+ 1]) ));
1328 StringPairMap_t::iterator aIt
= m_pImpl
->m_aStyleNameMap
.find( sRet
);
1329 if(aIt
!= m_pImpl
->m_aStyleNameMap
.end() && aIt
->second
.getLength())
1334 ::rtl::OUString
StyleSheetTable::GetStyleIdFromIndex(const sal_uInt32 sti
)
1336 ::rtl::OUString sRet
;
1337 if (sti
>= (sizeof(aStyleNamePairs
) / sizeof( sal_Char
*) / 2))
1338 sRet
= ::rtl::OUString();
1340 sRet
= ::rtl::OUString::createFromAscii(aStyleNamePairs
[2 * sti
]);
1344 void StyleSheetTable::resolveSprmProps(Sprm
& rSprm
)
1346 writerfilter::Reference
<Properties
>::Pointer_t pProperties
= rSprm
.getProps();
1347 if( pProperties
.get())
1348 pProperties
->resolve(*this);
1351 void StyleSheetTable::resolveAttributeProperties(Value
& val
)
1353 writerfilter::Reference
<Properties
>::Pointer_t pProperties
= val
.getProperties();
1354 if( pProperties
.get())
1355 pProperties
->resolve(*this);
1357 /*-- 18.07.2007 15:59:34---------------------------------------------------
1359 -----------------------------------------------------------------------*/
1360 void StyleSheetTable::applyDefaults(bool bParaProperties
)
1363 if(!m_pImpl
->m_xTextDefaults
.is())
1365 m_pImpl
->m_xTextDefaults
= uno::Reference
< beans::XPropertySet
>(
1366 m_pImpl
->m_rDMapper
.GetTextFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Defaults"))),
1367 uno::UNO_QUERY_THROW
);
1369 PropertyNameSupplier
& rPropNameSupplier
= PropertyNameSupplier::GetPropertyNameSupplier();
1370 if( bParaProperties
&& m_pImpl
->m_pDefaultParaProps
.get() && m_pImpl
->m_pDefaultParaProps
->size())
1372 PropertyMap::iterator aMapIter
= m_pImpl
->m_pDefaultParaProps
->begin();
1373 for( ; aMapIter
!= m_pImpl
->m_pDefaultParaProps
->end(); ++aMapIter
)
1377 m_pImpl
->m_xTextDefaults
->setPropertyValue(rPropNameSupplier
.GetName( aMapIter
->first
.eId
), aMapIter
->second
);
1379 catch( const uno::Exception
& )
1381 OSL_ENSURE( false, "setPropertyValue exception");
1385 if( !bParaProperties
&& m_pImpl
->m_pDefaultCharProps
.get() && m_pImpl
->m_pDefaultCharProps
->size())
1387 PropertyMap::iterator aMapIter
= m_pImpl
->m_pDefaultCharProps
->begin();
1388 for( ; aMapIter
!= m_pImpl
->m_pDefaultCharProps
->end(); ++aMapIter
)
1392 m_pImpl
->m_xTextDefaults
->setPropertyValue(rPropNameSupplier
.GetName( aMapIter
->first
.eId
), aMapIter
->second
);
1394 catch( const uno::Exception
& )
1396 OSL_ENSURE( false, "setPropertyValue exception");
1401 catch( const uno::Exception
& )
1405 /*-- 05.02.2008 10:27:36---------------------------------------------------
1407 -----------------------------------------------------------------------*/
1408 ::rtl::OUString
StyleSheetTable::getOrCreateCharStyle( PropertyValueVector_t
& rCharProperties
)
1410 //find out if any of the styles already has the required properties then return it's name
1411 ::rtl::OUString sListLabel
= m_pImpl
->HasListCharStyle(rCharProperties
);
1412 if( sListLabel
.getLength() )
1414 const char cListLabel
[] = "ListLabel ";
1415 uno::Reference
< style::XStyleFamiliesSupplier
> xStylesSupplier( m_pImpl
->m_xTextDocument
, uno::UNO_QUERY_THROW
);
1416 uno::Reference
< container::XNameAccess
> xStyleFamilies
= xStylesSupplier
->getStyleFamilies();
1417 uno::Reference
<container::XNameContainer
> xCharStyles
;
1418 xStyleFamilies
->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharacterStyles"))) >>= xCharStyles
;
1419 //search for all character styles with the name sListLabel + <index>
1420 sal_Int32 nStyleFound
= 0;
1421 uno::Sequence
< ::rtl::OUString
> aStyleNames
= xCharStyles
->getElementNames();
1422 const ::rtl::OUString
* pStyleNames
= aStyleNames
.getConstArray();
1423 for( sal_Int32 nStyle
= 0; nStyle
< aStyleNames
.getLength(); ++nStyle
)
1425 if( pStyleNames
[nStyle
].matchAsciiL( cListLabel
, sizeof( cListLabel
) - 1 ))
1427 ::rtl::OUString sSuffix
= pStyleNames
[nStyle
].copy( sizeof( cListLabel
) - 1 );
1428 sal_Int32 nSuffix
= sSuffix
.toInt32();
1431 if( nSuffix
> nStyleFound
)
1432 nStyleFound
= nSuffix
;
1436 sListLabel
= ::rtl::OUString::createFromAscii( cListLabel
);
1437 sListLabel
+= ::rtl::OUString::valueOf( ++nStyleFound
);
1438 //create a new one otherwise
1439 uno::Reference
< lang::XMultiServiceFactory
> xDocFactory( m_pImpl
->m_xTextDocument
, uno::UNO_QUERY_THROW
);
1440 PropertyNameSupplier
& rPropNameSupplier
= PropertyNameSupplier::GetPropertyNameSupplier();
1443 uno::Reference
< style::XStyle
> xStyle( xDocFactory
->createInstance(
1444 rPropNameSupplier
.GetName( PROP_SERVICE_CHAR_STYLE
)), uno::UNO_QUERY_THROW
);
1445 //uno::Reference< container::XNamed >xNamed( xStyle, uno::UNO_QUERY_THROW );
1446 //xNamed->setName( sListLabel );
1447 uno::Reference
< beans::XPropertySet
> xStyleProps(xStyle
, uno::UNO_QUERY_THROW
);
1448 PropertyValueVector_t::const_iterator aCharPropIter
= rCharProperties
.begin();
1449 while( aCharPropIter
!= rCharProperties
.end())
1453 xStyleProps
->setPropertyValue( aCharPropIter
->Name
, aCharPropIter
->Value
);
1455 catch( const uno::Exception
& rEx
)
1458 OSL_ENSURE( false, "Exception in StyleSheetTable::getOrCreateCharStyle - Style::setPropertyValue");
1462 xCharStyles
->insertByName( sListLabel
, uno::makeAny( xStyle
) );
1463 m_pImpl
->m_aListCharStylePropertyVector
.push_back( ListCharStylePropertyMap_t( sListLabel
, rCharProperties
));
1465 catch( const uno::Exception
& rEx
)
1468 OSL_ENSURE( false, "Exception in StyleSheetTable::getOrCreateCharStyle");
1474 }//namespace dmapper
1475 }//namespace writerfilter