LibreOffice Module xmloff (master) 1
xmlnume.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <sal/config.h>
21
22#include <com/sun/star/frame/XModel.hpp>
23#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
24#include <com/sun/star/style/NumberingType.hpp>
25#include <com/sun/star/style/XStyle.hpp>
26#include <com/sun/star/container/XIndexReplace.hpp>
27#include <com/sun/star/awt/XBitmap.hpp>
28#include <com/sun/star/graphic/XGraphic.hpp>
29#include <com/sun/star/awt/FontDescriptor.hpp>
30#include <com/sun/star/text/HoriOrientation.hpp>
31#include <com/sun/star/text/VertOrientation.hpp>
32#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
33#include <com/sun/star/text/PositionAndSpaceMode.hpp>
34#include <com/sun/star/text/LabelFollow.hpp>
35#include <com/sun/star/beans/PropertyValue.hpp>
36#include <com/sun/star/beans/XPropertySet.hpp>
37
38#include <o3tl/any.hxx>
39#include <o3tl/temporary.hxx>
40#include <rtl/ustrbuf.hxx>
41#include <sal/log.hxx>
42
44
46#include <xmloff/xmltoken.hxx>
47#include <xmloff/xmluconv.hxx>
48#include "fonthdl.hxx"
50#include <xmloff/xmlnume.hxx>
51#include <xmloff/xmlexp.hxx>
52#include <tools/fontenum.hxx>
53#include <vcl/vclenum.hxx>
54
55using namespace ::com::sun::star;
56using namespace ::com::sun::star::uno;
57using namespace ::com::sun::star::style;
58using namespace ::com::sun::star::text;
59using namespace ::com::sun::star::container;
60using namespace ::com::sun::star::beans;
61using namespace ::xmloff::token;
62
63void SvxXMLNumRuleExport::exportLevelStyles( const uno::Reference< css::container::XIndexReplace > & xNumRule,
64 bool bOutline )
65{
66 sal_Int32 nCount = xNumRule ->getCount();
67 for( sal_Int32 i=0; i<nCount; i++ )
68 {
69 uno::Any aEntry( xNumRule->getByIndex( i ) );
70 uno::Sequence<beans::PropertyValue> aSeq;
71 if( aEntry >>= aSeq )
72 {
73 exportLevelStyle( i, aSeq, bOutline );
74 }
75 }
76}
77
79 const uno::Sequence<beans::PropertyValue>& rProps,
80 bool bOutline )
81{
82 sal_Int16 eType = NumberingType::CHAR_SPECIAL;
83
84 sal_Int16 eAdjust = HoriOrientation::LEFT;
85 OUString sPrefix, sSuffix, sListFormat;
86 OUString sTextStyleName;
87 bool bIsLegal = false;
88 bool bHasColor = false;
89 sal_Int32 nColor = 0;
90 sal_Int32 nSpaceBefore = 0, nMinLabelWidth = 0, nMinLabelDist = 0;
91
92 sal_Int16 nStartValue = 1, nDisplayLevels = 1, nBullRelSize = 0;
93
94 sal_UCS4 cBullet = 0xf095;
95 OUString sBulletFontName, sBulletFontStyleName ;
96 FontFamily eBulletFontFamily = FAMILY_DONTKNOW;
97 FontPitch eBulletFontPitch = PITCH_DONTKNOW;
98 rtl_TextEncoding eBulletFontEncoding = RTL_TEXTENCODING_DONTKNOW;
99
100 uno::Reference<graphic::XGraphic> xGraphic;
101
102 sal_Int32 nImageWidth = 0, nImageHeight = 0;
103 sal_Int16 eImageVertOrient = VertOrientation::LINE_CENTER;
104
105 sal_Int16 ePosAndSpaceMode = PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION;
106 sal_Int16 eLabelFollowedBy = LabelFollow::LISTTAB;
107 sal_Int32 nListtabStopPosition( 0 );
108 sal_Int32 nFirstLineIndent( 0 );
109 sal_Int32 nIndentAt( 0 );
110
111 for( const beans::PropertyValue& rProp : rProps )
112 {
113 if( rProp.Name == "NumberingType" )
114 {
115 rProp.Value >>= eType;
116 }
117 else if( rProp.Name == "Prefix" )
118 {
119 rProp.Value >>= sPrefix;
120 }
121 else if( rProp.Name == "Suffix" )
122 {
123 rProp.Value >>= sSuffix;
124 }
125 else if (rProp.Name == "ListFormat")
126 {
127 rProp.Value >>= sListFormat;
128 }
129 else if (rProp.Name == "IsLegal")
130 {
131 rProp.Value >>= bIsLegal;
132 }
133 else if (rProp.Name == "BulletChar")
134 {
135 OUString sValue;
136 rProp.Value >>= sValue;
137 if( !sValue.isEmpty() )
138 {
139 cBullet = sValue.iterateCodePoints(&o3tl::temporary(sal_Int32(0)));
140 }
141 }
142 else if( rProp.Name == "BulletRelSize" )
143 {
144 rProp.Value >>= nBullRelSize;
145 }
146 else if( rProp.Name == "Adjust" )
147 {
148 sal_Int16 nValue = 0;
149 rProp.Value >>= nValue;
150 eAdjust = nValue;
151 }
152 else if( rProp.Name == "BulletFont" )
153 {
154 awt::FontDescriptor rFDesc;
155 if( rProp.Value >>= rFDesc )
156 {
157 sBulletFontName = rFDesc.Name;
158 sBulletFontStyleName = rFDesc.StyleName;
159 eBulletFontFamily = static_cast< FontFamily >( rFDesc.Family );
160 eBulletFontPitch = static_cast< FontPitch >( rFDesc.Pitch );
161 eBulletFontEncoding = static_cast<rtl_TextEncoding>(rFDesc.CharSet);
162 }
163 }
164 else if( rProp.Name == "GraphicBitmap" )
165 {
166 uno::Reference<awt::XBitmap> xBitmap;
167 rProp.Value >>= xBitmap;
168 xGraphic.set(xBitmap, uno::UNO_QUERY);
169 }
170 else if( rProp.Name == "BulletColor" )
171 {
172 rProp.Value >>= nColor;
173 bHasColor = true;
174 }
175 else if( rProp.Name == "StartWith" )
176 {
177 rProp.Value >>= nStartValue;
178 }
179 else if( rProp.Name == "LeftMargin" )
180 {
181 rProp.Value >>= nSpaceBefore;
182 }
183 else if( rProp.Name == "FirstLineOffset" )
184 {
185 rProp.Value >>= nMinLabelWidth;
186 }
187 else if( rProp.Name == "SymbolTextDistance" )
188 {
189 rProp.Value >>= nMinLabelDist;
190 }
191 else if( rProp.Name == "ParentNumbering" )
192 {
193 rProp.Value >>= nDisplayLevels;
194 if( nDisplayLevels > nLevel+1 )
195 nDisplayLevels = static_cast<sal_Int16>( nLevel )+1;
196 }
197 else if( rProp.Name == "CharStyleName" )
198 {
199 rProp.Value >>= sTextStyleName;
200 }
201 else if( rProp.Name == "GraphicSize" )
202 {
203 awt::Size aSize;
204 if( rProp.Value >>= aSize )
205 {
206 nImageWidth = aSize.Width;
207 nImageHeight = aSize.Height;
208 }
209 }
210 else if( rProp.Name == "VertOrient" )
211 {
212 sal_Int16 nValue = 0;
213 rProp.Value >>= nValue;
214 eImageVertOrient = nValue;
215 }
216 else if( rProp.Name == "PositionAndSpaceMode" )
217 {
218 sal_Int16 nValue = 0;
219 rProp.Value >>= nValue;
220 ePosAndSpaceMode = nValue;
221 }
222 else if( rProp.Name == "LabelFollowedBy" )
223 {
224 sal_Int16 nValue = 0;
225 rProp.Value >>= nValue;
226 eLabelFollowedBy = nValue;
227 }
228 else if( rProp.Name == "ListtabStopPosition" )
229 {
230 rProp.Value >>= nListtabStopPosition;
231 }
232 else if( rProp.Name == "FirstLineIndent" )
233 {
234 rProp.Value >>= nFirstLineIndent;
235 }
236 else if( rProp.Name == "IndentAt" )
237 {
238 rProp.Value >>= nIndentAt;
239 }
240 }
241
242 if( bOutline && (NumberingType::CHAR_SPECIAL == eType ||
243 NumberingType::BITMAP == eType) )
244 {
245 SAL_WARN_IF( bOutline, "xmloff",
246 "SvxXMLNumRuleExport::exportLevelStyle: invalid style for outline" );
247 return;
248 }
249
251
252 // text:level
253 OUStringBuffer sTmp;
254 GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_LEVEL, OUString::number( nLevel + 1 ) );
255 // #i110694#: no style-name on list-level-style-image
256 // #i116149#: neither prefix/suffix
257 if (NumberingType::BITMAP != eType)
258 {
259 if (!sTextStyleName.isEmpty())
260 {
262 GetExport().EncodeStyleName( sTextStyleName ) );
263 }
264 if (bIsLegal)
265 {
266 if (GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
268 }
269 if (!sListFormat.isEmpty())
270 {
271 if (GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
272 {
273 // Write only in extended mode: in ODF 1.3 we write only prefix/suffix,
274 // no list format yet available. Praying we did not lost some formatting.
276 }
277 }
278 if (!sPrefix.isEmpty())
279 {
281 sPrefix );
282 }
283 if (!sSuffix.isEmpty())
284 {
286 sSuffix );
287 }
288 }
289
291 if( NumberingType::CHAR_SPECIAL == eType )
292 {
293 // <text:list-level-style-bullet>
295
296 if( cBullet )
297 {
298 if( cBullet < ' ' )
299 {
300 cBullet = 0xF000 + 149;
301 }
302 // text:bullet-char="..."
303 sTmp.append(OUString(&cBullet, 1));
305 sTmp.makeStringAndClear() );
306 }
307 else
308 {
309 // If 'cBullet' is zero, XML_BULLET_CHAR must exist with blank.
311 }
312 }
313 else if( NumberingType::BITMAP == eType )
314 {
315 // <text:list-level-style-image>
316
318
319 if (xGraphic.is())
320 {
321 OUString sUsedMimeType;
322 OUString sInternalURL = GetExport().AddEmbeddedXGraphic(xGraphic, sUsedMimeType);
323 if (!sInternalURL.isEmpty())
324 {
329 }
330 }
331 else
332 {
333 SAL_WARN_IF(xGraphic.is(), "xmloff", "embedded images are not supported by now");
334 }
335 }
336 else
337 {
338 // <text:list-level-style-number> or <text:outline-level-style>
339 if( bOutline )
341 else
343
346 sTmp.makeStringAndClear() );
348 if( !sTmp.isEmpty() )
351 sTmp.makeStringAndClear() );
352
353 if( nStartValue != 1 )
354 {
355 sTmp.append( static_cast<sal_Int32>(nStartValue) );
357 sTmp.makeStringAndClear() );
358 }
359 if( nDisplayLevels > 1 && NumberingType::NUMBER_NONE != eType )
360 {
361 sTmp.append( static_cast<sal_Int32>(nDisplayLevels) );
363 sTmp.makeStringAndClear() );
364 }
365 }
366
367 {
369 true, true );
370
371 if ( ePosAndSpaceMode == PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION )
372 {
373 nSpaceBefore += nMinLabelWidth;
374 nMinLabelWidth = -nMinLabelWidth;
375 if( nSpaceBefore != 0 )
376 {
378 nSpaceBefore );
380 }
381 if( nMinLabelWidth != 0 )
382 {
383 OUString s = GetExport().GetMM100UnitConverter().convertMeasureToXML( nMinLabelWidth );
385 }
386 if( nMinLabelDist > 0 )
387 {
389 nMinLabelDist );
391 }
392 }
393 /* Check, if properties for position-and-space-mode LABEL_ALIGNMENT
394 are allowed to be exported. (#i89178#)
395 */
396 else if ( ePosAndSpaceMode == PositionAndSpaceMode::LABEL_ALIGNMENT &&
398 {
402 }
403 if( HoriOrientation::LEFT != eAdjust )
404 {
405 enum XMLTokenEnum eValue = XML_TOKEN_INVALID;
406 switch( eAdjust )
407 {
408 case HoriOrientation::RIGHT: eValue = XML_END; break;
409 case HoriOrientation::CENTER: eValue = XML_CENTER; break;
410 }
411 if( eValue != XML_TOKEN_INVALID )
413 }
414
415 if( NumberingType::BITMAP == eType )
416 {
417 enum XMLTokenEnum eValue = XML_TOKEN_INVALID;
418 switch( eImageVertOrient )
419 {
420 case VertOrientation::BOTTOM: // yes, it's OK: BOTTOM means that the baseline
421 // hits the frame at its topmost position
422 case VertOrientation::LINE_TOP:
423 case VertOrientation::CHAR_TOP:
424 eValue = XML_TOP;
425 break;
426 case VertOrientation::CENTER:
427 case VertOrientation::LINE_CENTER:
428 case VertOrientation::CHAR_CENTER:
429 eValue = XML_MIDDLE;
430 break;
431 case VertOrientation::TOP: // yes, it's OK: TOP means that the baseline
432 // hits the frame at its bottommost position
433 case VertOrientation::LINE_BOTTOM:
434 case VertOrientation::CHAR_BOTTOM:
435 eValue = XML_BOTTOM;
436 break;
437 }
438 if( eValue != XML_TOKEN_INVALID )
440
441 eValue = XML_TOKEN_INVALID;
442 switch( eImageVertOrient )
443 {
444 case VertOrientation::TOP:
445 case VertOrientation::CENTER:
446 case VertOrientation::BOTTOM:
447 eValue = XML_BASELINE;
448 break;
449 case VertOrientation::LINE_TOP:
450 case VertOrientation::LINE_CENTER:
451 case VertOrientation::LINE_BOTTOM:
452 eValue = XML_LINE;
453 break;
454 case VertOrientation::CHAR_TOP:
455 case VertOrientation::CHAR_CENTER:
456 case VertOrientation::CHAR_BOTTOM:
457 eValue = XML_CHAR;
458 break;
459 }
460 if( eValue != XML_TOKEN_INVALID )
462
463 if( nImageWidth > 0 )
464 {
466 nImageWidth );
468 }
469
470 if( nImageHeight > 0 )
471 {
473 nImageHeight );
475 }
476 }
477
478 {
480 XML_LIST_LEVEL_PROPERTIES, true, true );
481
482 /* Check, if properties for position-and-space-mode LABEL_ALIGNMENT
483 are allowed to be exported. (#i89178#)
484 */
485 if ( ePosAndSpaceMode == PositionAndSpaceMode::LABEL_ALIGNMENT &&
487 {
488 enum XMLTokenEnum eValue = XML_LISTTAB;
489 if ( eLabelFollowedBy == LabelFollow::SPACE )
490 {
491 eValue = XML_SPACE;
492 }
493 else if ( eLabelFollowedBy == LabelFollow::NOTHING )
494 {
495 eValue = XML_NOTHING;
496 }
498 XML_LABEL_FOLLOWED_BY, eValue );
499
500 if (eLabelFollowedBy == LabelFollow::NEWLINE)
501 {
502 eValue = XML_NEWLINE;
504 XML_LABEL_FOLLOWED_BY, eValue );
505 }
506
507 if ( eLabelFollowedBy == LabelFollow::LISTTAB &&
508 nListtabStopPosition > 0 )
509 {
511 nListtabStopPosition );
514 sAttr );
515 }
516
517 if ( nFirstLineIndent != 0 )
518 {
520 nFirstLineIndent );
523 sAttr );
524 }
525
526 if ( nIndentAt != 0 )
527 {
529 nIndentAt );
532 sAttr );
533 }
534
535 SvXMLElementExport aLabelAlignmentElement( GetExport(), XML_NAMESPACE_STYLE,
537 true, true );
538 }
539 }
540
541 if( NumberingType::CHAR_SPECIAL == eType )
542 {
543 if( !sBulletFontName.isEmpty() )
544 {
545 OUString sStyleName =
547 sBulletFontName, sBulletFontStyleName,
548 eBulletFontFamily, eBulletFontPitch,
549 eBulletFontEncoding );
550
551 if( !sStyleName.isEmpty() )
552 {
555 sStyleName );
556 }
557 else
558 {
559 OUString sTemp;
560
561 const SvXMLUnitConverter& rUnitConv =
563 XMLFontFamilyNamePropHdl aFamilyNameHdl;
564 if( aFamilyNameHdl.exportXML( sTemp, Any(sBulletFontName), rUnitConv ) )
566 XML_FONT_FAMILY, sTemp );
567
568 if( !sBulletFontStyleName.isEmpty() )
571 sBulletFontStyleName );
572
573 XMLFontFamilyPropHdl aFamilyHdl;
574 if( aFamilyHdl.exportXML( sTemp, Any(static_cast<sal_Int16>(eBulletFontFamily)), rUnitConv ) )
577 sTemp );
578
579 XMLFontPitchPropHdl aPitchHdl;
580 if( aPitchHdl.exportXML( sTemp, Any(static_cast<sal_Int16>(eBulletFontPitch)), rUnitConv ) )
582 XML_FONT_PITCH, sTemp );
583
585 if( aEncHdl.exportXML( sTemp, Any(static_cast<sal_Int16>(eBulletFontEncoding)), rUnitConv ) )
587 XML_FONT_CHARSET, sTemp );
588 }
589 }
590 }
591 if( NumberingType::BITMAP != eType )
592 {
593 // fo:color = "#..."
594 if( bHasColor )
595 {
596 if (0xffffffff == static_cast<sal_uInt32>(nColor))
597 {
599 }
600 else
601 {
602 OUStringBuffer sBuffer;
603 ::sax::Converter::convertColor( sBuffer, nColor );
605 sBuffer.makeStringAndClear() );
606 }
607 }
608 // fo:height="...%"
609 if( nBullRelSize )
610 {
611 ::sax::Converter::convertPercent( sTmp, nBullRelSize );
613 sTmp.makeStringAndClear() );
614 }
615 }
616 if( GetExport().GetAttrList().getLength() > 0 )
617 {
619 XML_TEXT_PROPERTIES, true, true );
620 }
621 if (xGraphic.is() && NumberingType::BITMAP == eType)
622 {
623 // optional office:binary-data
625 }
626 }
627}
628
629
630constexpr OUStringLiteral gsNumberingRules( u"NumberingRules" );
631constexpr OUStringLiteral gsIsPhysical( u"IsPhysical" );
632constexpr OUStringLiteral gsIsContinuousNumbering( u"IsContinuousNumbering" );
633
635 m_rExport( rExp ),
636 // Let list style creation depend on Load/Save option "ODF format version" (#i89178#)
637 mbExportPositionAndSpaceModeLabelAlignment( true )
638{
639 switch (GetExport().getSaneDefaultVersion())
640 {
643 {
645 }
646 break;
647 default: // >= ODFSVER_012
648 {
650 }
651 }
652}
653
655 const OUString& rName, bool bIsHidden,
656 const Reference< XIndexReplace >& rNumRule )
657{
658 Reference< XPropertySet > xPropSet( rNumRule, UNO_QUERY );
659 Reference< XPropertySetInfo > xPropSetInfo;
660 if( xPropSet.is() )
661 xPropSetInfo = xPropSet->getPropertySetInfo();
662
664
665 // style:name="..."
666 if( !rName.isEmpty() )
667 {
668 bool bEncoded = false;
670 GetExport().EncodeStyleName( rName, &bEncoded ) );
671 if( bEncoded )
673 rName);
674 }
675
676 // style:hidden="..."
677 if (bIsHidden
678 && GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
679 {
681 GetExport().AddAttribute(XML_NAMESPACE_STYLE, XML_HIDDEN, "true"); // FIXME for compatibility
682 }
683
684 // text:consecutive-numbering="..."
685 bool bContNumbering = false;
686 if( xPropSetInfo.is() &&
687 xPropSetInfo->hasPropertyByName( gsIsContinuousNumbering ) )
688 {
689 Any aAny( xPropSet->getPropertyValue( gsIsContinuousNumbering ) );
690 bContNumbering = *o3tl::doAccess<bool>(aAny);
691 }
692 if( bContNumbering )
695
696 {
698 true, true );
699 exportLevelStyles( rNumRule );
700 }
701}
702
703void SvxXMLNumRuleExport::exportStyle( const Reference< XStyle >& rStyle )
704{
705 Reference< XPropertySet > xPropSet( rStyle, UNO_QUERY );
706 Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
707
708 Any aAny;
709
710 // Don't export styles that aren't existing really. This may be the
711 // case for StarOffice Writer's pool styles.
712 if( xPropSetInfo->hasPropertyByName( gsIsPhysical ) )
713 {
714 aAny = xPropSet->getPropertyValue( gsIsPhysical );
715 if( !*o3tl::doAccess<bool>(aAny) )
716 return;
717 }
718
719 aAny = xPropSet->getPropertyValue( gsNumberingRules );
720 Reference<XIndexReplace> xNumRule;
721 aAny >>= xNumRule;
722
723 OUString sName = rStyle->getName();
724
725 bool bHidden = false;
726 if ( xPropSetInfo->hasPropertyByName( "Hidden" ) )
727 {
728 aAny = xPropSet->getPropertyValue( "Hidden" );
729 aAny >>= bHidden;
730 }
731
732 exportNumberingRule( sName, bHidden, xNumRule );
733}
734
736{
737 Reference< XChapterNumberingSupplier > xCNSupplier( GetExport().GetModel(),
738 UNO_QUERY );
739 SAL_WARN_IF( !xCNSupplier.is(), "xmloff", "no chapter numbering supplier" );
740
741 if( !xCNSupplier.is() )
742 return;
743
744 Reference< XIndexReplace > xNumRule( xCNSupplier->getChapterNumberingRules() );
745 SAL_WARN_IF( !xNumRule.is(), "xmloff", "no chapter numbering rules" );
746
747 if( !xNumRule.is() )
748 return;
749
750 /* Outline style has property style:name since ODF 1.2
751 Thus, export this property and adjust fix for issue #i69627# (#i90780#)
752 */
753 OUString sOutlineStyleName;
754 {
755 Reference<XPropertySet> xNumRulePropSet(
756 xCNSupplier->getChapterNumberingRules(), UNO_QUERY );
757 if (xNumRulePropSet.is())
758 {
759 xNumRulePropSet->getPropertyValue( "Name" ) >>= sOutlineStyleName;
760 }
761 }
762 const SvtSaveOptions::ODFSaneDefaultVersion nODFVersion =
764 if ((nODFVersion == SvtSaveOptions::ODFSVER_010 ||
765 nODFVersion == SvtSaveOptions::ODFSVER_011)
766 && GetExport().writeOutlineStyleAsNormalListStyle())
767 {
768 exportNumberingRule( sOutlineStyleName, false, xNumRule );
769 }
770 else
771 {
772 if (nODFVersion != SvtSaveOptions::ODFSVER_010 &&
773 nODFVersion != SvtSaveOptions::ODFSVER_011)
774 {
775 // style:name="..."
777 if ( !sOutlineStyleName.isEmpty() )
778 {
779 bool bEncoded = false;
781 GetExport().EncodeStyleName( sOutlineStyleName,
782 &bEncoded ) );
783 if( bEncoded )
786 sOutlineStyleName );
787 }
788 }
790 XML_OUTLINE_STYLE, true, true );
791 exportLevelStyles( xNumRule, true );
792 }
793}
794
795void SvxXMLNumRuleExport::exportStyles( bool bUsed, bool bExportChapterNumbering )
796{
797 if( bExportChapterNumbering )
799
800 Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(), UNO_QUERY );
801 SAL_WARN_IF( !xFamiliesSupp.is(), "xmloff", "No XStyleFamiliesSupplier from XModel for export!" );
802 if( !xFamiliesSupp.is() )
803 return;
804
805 Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
806 SAL_WARN_IF( !xFamiliesSupp.is(), "xmloff", "getStyleFamilies() from XModel failed for export!" );
807
808 if( !xFamilies.is() )
809 return;
810
811 static constexpr OUStringLiteral aNumberStyleName( u"NumberingStyles" );
812
813 Reference< XIndexAccess > xStyles;
814 if( !xFamilies->hasByName( aNumberStyleName ) )
815 return;
816
817 xFamilies->getByName( aNumberStyleName ) >>= xStyles;
818
819 SAL_WARN_IF( !xStyles.is(), "xmloff", "Style not found for export!" );
820
821 if( !xStyles.is() )
822 return;
823
824 const sal_Int32 nStyles = xStyles->getCount();
825
826 for( sal_Int32 i=0; i < nStyles; i++ )
827 {
828 Reference< XStyle > xStyle;
829 xStyles->getByIndex( i ) >>= xStyle;
830
831 if( !bUsed || xStyle->isInUse() )
832 exportStyle( xStyle );
833
834 }
835}
836
837/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
Definition: xmlexp.cxx:907
rtl::Reference< XMLFontAutoStylePool > const & GetFontAutoStylePool()
Definition: xmlexp.hxx:597
SvtSaveOptions::ODFSaneDefaultVersion getSaneDefaultVersion() const
returns the deterministic version for odf export
Definition: xmlexp.cxx:2264
bool AddEmbeddedXGraphicAsBase64(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic)
Definition: xmlexp.cxx:1875
void CheckAttrList()
Definition: xmlexp.cxx:1012
const SvXMLUnitConverter & GetMM100UnitConverter() const
Definition: xmlexp.hxx:391
OUString AddEmbeddedXGraphic(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic, OUString &rOutMimeType, OUString const &rRequestedName=OUString())
Definition: xmlexp.cxx:1838
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
Definition: xmluconv.hxx:83
bool convertNumFormat(sal_Int16 &rType, const OUString &rNumFormat, std::u16string_view rNumLetterSync, bool bNumberNone=false) const
convert num-format and num-letter-sync values to NumberingType
Definition: xmluconv.cxx:655
void convertMeasureToXML(OUStringBuffer &rBuffer, sal_Int32 nMeasure) const
convert measure to string: from meCoreMeasureUnit to meXMLMeasureUnit
Definition: xmluconv.cxx:208
static void convertNumLetterSync(OUStringBuffer &rBuffer, sal_Int16 nType)
Definition: xmluconv.cxx:752
SvXMLExport & GetExport()
Definition: xmlnume.hxx:55
void exportLevelStyles(const css::uno::Reference< css::container::XIndexReplace > &xNumRule, bool bOutline=false)
Definition: xmlnume.cxx:63
void exportStyles(bool bUsed, bool bExportChapterNumbering)
Definition: xmlnume.cxx:795
SAL_DLLPRIVATE void exportStyle(const css::uno::Reference< css::style::XStyle > &rStyle)
Definition: xmlnume.cxx:703
void exportNumberingRule(const OUString &rName, bool bIsHidden, const css::uno::Reference< css::container::XIndexReplace > &xNumRule)
Definition: xmlnume.cxx:654
SAL_DLLPRIVATE void exportOutline()
Definition: xmlnume.cxx:735
SvxXMLNumRuleExport(SvXMLExport &rExport)
Definition: xmlnume.cxx:634
bool mbExportPositionAndSpaceModeLabelAlignment
Definition: xmlnume.hxx:45
SAL_DLLPRIVATE void exportLevelStyle(sal_Int32 nLevel, const css::uno::Sequence< css::beans::PropertyValue > &rProps, bool bOutline)
Definition: xmlnume.cxx:78
PropertyHandler for the XML-data-type:
Definition: fonthdl.hxx:52
virtual bool exportXML(OUString &rStrExpValue, const css::uno::Any &rValue, const SvXMLUnitConverter &rUnitConverter) const override
Exports the given value according to the XML-data-type corresponding to the derived class.
Definition: fonthdl.cxx:236
PropertyHandler for the XML-data-type:
Definition: fonthdl.hxx:28
virtual bool exportXML(OUString &rStrExpValue, const css::uno::Any &rValue, const SvXMLUnitConverter &rUnitConverter) const override
Exports the given value according to the XML-data-type corresponding to the derived class.
Definition: fonthdl.cxx:117
PropertyHandler for the XML-data-type:
Definition: fonthdl.hxx:40
virtual bool exportXML(OUString &rStrExpValue, const css::uno::Any &rValue, const SvXMLUnitConverter &rUnitConverter) const override
Exports the given value according to the XML-data-type corresponding to the derived class.
Definition: fonthdl.cxx:204
PropertyHandler for the XML-data-type:
Definition: fonthdl.hxx:64
virtual bool exportXML(OUString &rStrExpValue, const css::uno::Any &rValue, const SvXMLUnitConverter &rUnitConverter) const override
Exports the given value according to the XML-data-type corresponding to the derived class.
Definition: fonthdl.cxx:269
static bool convertPercent(sal_Int32 &rValue, std::u16string_view rString)
static bool convertColor(sal_Int32 &rColor, std::u16string_view rValue)
int nCount
float u
DocumentType eType
sal_Int16 nValue
FontPitch
PITCH_DONTKNOW
FontFamily
FAMILY_DONTKNOW
OUString sName
OUString sPrefix
Sequence< sal_Int8 > aSeq
OUString sSuffix
OUString sBulletFontName
#define SAL_WARN_IF(condition, area, stream)
double getLength(const B2DPolygon &rCandidate)
int i
constexpr T & temporary(T &&x)
Handling of tokens in XML:
XMLTokenEnum
The enumeration of all XML tokens.
Definition: xmltoken.hxx:50
@ XML_LIST_LEVEL_STYLE_IMAGE
Definition: xmltoken.hxx:1221
@ XML_LIST_LEVEL_PROPERTIES
Definition: xmltoken.hxx:2641
@ XML_LIST_LEVEL_STYLE_NUMBER
Definition: xmltoken.hxx:1222
@ XML_LIST_TAB_STOP_POSITION
Definition: xmltoken.hxx:3296
@ XML_CONSECUTIVE_NUMBERING
Definition: xmltoken.hxx:502
@ XML_FONT_FAMILY_GENERIC
Definition: xmltoken.hxx:865
@ XML_LIST_LEVEL_POSITION_AND_SPACE_MODE
Definition: xmltoken.hxx:3288
@ XML_LIST_LEVEL_STYLE_BULLET
Definition: xmltoken.hxx:1220
@ XML_USE_WINDOW_FONT_COLOR
Definition: xmltoken.hxx:2085
@ XML_OUTLINE_LEVEL_STYLE
Definition: xmltoken.hxx:1458
@ XML_MIN_LABEL_DISTANCE
Definition: xmltoken.hxx:1308
@ XML_LIST_LEVEL_LABEL_ALIGNMENT
Definition: xmltoken.hxx:3291
sal_uInt32 sal_UCS4
constexpr sal_uInt16 XML_NAMESPACE_XLINK
constexpr sal_uInt16 XML_NAMESPACE_TEXT
constexpr sal_uInt16 XML_NAMESPACE_LO_EXT
constexpr sal_uInt16 XML_NAMESPACE_STYLE
constexpr sal_uInt16 XML_NAMESPACE_FO
constexpr OUStringLiteral gsIsPhysical(u"IsPhysical")
constexpr OUStringLiteral gsNumberingRules(u"NumberingRules")
constexpr OUStringLiteral gsIsContinuousNumbering(u"IsContinuousNumbering")