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 bHasColor = false;
88 sal_Int32 nColor = 0;
89 sal_Int32 nSpaceBefore = 0, nMinLabelWidth = 0, nMinLabelDist = 0;
90
91 sal_Int16 nStartValue = 1, nDisplayLevels = 1, nBullRelSize = 0;
92
93 sal_UCS4 cBullet = 0xf095;
94 OUString sBulletFontName, sBulletFontStyleName ;
95 FontFamily eBulletFontFamily = FAMILY_DONTKNOW;
96 FontPitch eBulletFontPitch = PITCH_DONTKNOW;
97 rtl_TextEncoding eBulletFontEncoding = RTL_TEXTENCODING_DONTKNOW;
98
99 uno::Reference<graphic::XGraphic> xGraphic;
100
101 sal_Int32 nImageWidth = 0, nImageHeight = 0;
102 sal_Int16 eImageVertOrient = VertOrientation::LINE_CENTER;
103
104 sal_Int16 ePosAndSpaceMode = PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION;
105 sal_Int16 eLabelFollowedBy = LabelFollow::LISTTAB;
106 sal_Int32 nListtabStopPosition( 0 );
107 sal_Int32 nFirstLineIndent( 0 );
108 sal_Int32 nIndentAt( 0 );
109
110 for( const beans::PropertyValue& rProp : rProps )
111 {
112 if( rProp.Name == "NumberingType" )
113 {
114 rProp.Value >>= eType;
115 }
116 else if( rProp.Name == "Prefix" )
117 {
118 rProp.Value >>= sPrefix;
119 }
120 else if( rProp.Name == "Suffix" )
121 {
122 rProp.Value >>= sSuffix;
123 }
124 else if (rProp.Name == "ListFormat")
125 {
126 rProp.Value >>= sListFormat;
127 }
128 else if (rProp.Name == "BulletChar")
129 {
130 OUString sValue;
131 rProp.Value >>= sValue;
132 if( !sValue.isEmpty() )
133 {
134 cBullet = sValue.iterateCodePoints(&o3tl::temporary(sal_Int32(0)));
135 }
136 }
137 else if( rProp.Name == "BulletRelSize" )
138 {
139 rProp.Value >>= nBullRelSize;
140 }
141 else if( rProp.Name == "Adjust" )
142 {
143 sal_Int16 nValue = 0;
144 rProp.Value >>= nValue;
145 eAdjust = nValue;
146 }
147 else if( rProp.Name == "BulletFont" )
148 {
149 awt::FontDescriptor rFDesc;
150 if( rProp.Value >>= rFDesc )
151 {
152 sBulletFontName = rFDesc.Name;
153 sBulletFontStyleName = rFDesc.StyleName;
154 eBulletFontFamily = static_cast< FontFamily >( rFDesc.Family );
155 eBulletFontPitch = static_cast< FontPitch >( rFDesc.Pitch );
156 eBulletFontEncoding = static_cast<rtl_TextEncoding>(rFDesc.CharSet);
157 }
158 }
159 else if( rProp.Name == "GraphicBitmap" )
160 {
161 uno::Reference<awt::XBitmap> xBitmap;
162 rProp.Value >>= xBitmap;
163 xGraphic.set(xBitmap, uno::UNO_QUERY);
164 }
165 else if( rProp.Name == "BulletColor" )
166 {
167 rProp.Value >>= nColor;
168 bHasColor = true;
169 }
170 else if( rProp.Name == "StartWith" )
171 {
172 rProp.Value >>= nStartValue;
173 }
174 else if( rProp.Name == "LeftMargin" )
175 {
176 rProp.Value >>= nSpaceBefore;
177 }
178 else if( rProp.Name == "FirstLineOffset" )
179 {
180 rProp.Value >>= nMinLabelWidth;
181 }
182 else if( rProp.Name == "SymbolTextDistance" )
183 {
184 rProp.Value >>= nMinLabelDist;
185 }
186 else if( rProp.Name == "ParentNumbering" )
187 {
188 rProp.Value >>= nDisplayLevels;
189 if( nDisplayLevels > nLevel+1 )
190 nDisplayLevels = static_cast<sal_Int16>( nLevel )+1;
191 }
192 else if( rProp.Name == "CharStyleName" )
193 {
194 rProp.Value >>= sTextStyleName;
195 }
196 else if( rProp.Name == "GraphicSize" )
197 {
198 awt::Size aSize;
199 if( rProp.Value >>= aSize )
200 {
201 nImageWidth = aSize.Width;
202 nImageHeight = aSize.Height;
203 }
204 }
205 else if( rProp.Name == "VertOrient" )
206 {
207 sal_Int16 nValue = 0;
208 rProp.Value >>= nValue;
209 eImageVertOrient = nValue;
210 }
211 else if( rProp.Name == "PositionAndSpaceMode" )
212 {
213 sal_Int16 nValue = 0;
214 rProp.Value >>= nValue;
215 ePosAndSpaceMode = nValue;
216 }
217 else if( rProp.Name == "LabelFollowedBy" )
218 {
219 sal_Int16 nValue = 0;
220 rProp.Value >>= nValue;
221 eLabelFollowedBy = nValue;
222 }
223 else if( rProp.Name == "ListtabStopPosition" )
224 {
225 rProp.Value >>= nListtabStopPosition;
226 }
227 else if( rProp.Name == "FirstLineIndent" )
228 {
229 rProp.Value >>= nFirstLineIndent;
230 }
231 else if( rProp.Name == "IndentAt" )
232 {
233 rProp.Value >>= nIndentAt;
234 }
235 }
236
237 if( bOutline && (NumberingType::CHAR_SPECIAL == eType ||
238 NumberingType::BITMAP == eType) )
239 {
240 SAL_WARN_IF( bOutline, "xmloff",
241 "SvxXMLNumRuleExport::exportLevelStyle: invalid style for outline" );
242 return;
243 }
244
246
247 // text:level
248 OUStringBuffer sTmp;
249 GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_LEVEL, OUString::number( nLevel + 1 ) );
250 // #i110694#: no style-name on list-level-style-image
251 // #i116149#: neither prefix/suffix
252 if (NumberingType::BITMAP != eType)
253 {
254 if (!sTextStyleName.isEmpty())
255 {
257 GetExport().EncodeStyleName( sTextStyleName ) );
258 }
259 if (!sListFormat.isEmpty())
260 {
261 if (GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
262 {
263 // Write only in extended mode: in ODF 1.3 we write only prefix/suffix,
264 // no list format yet available. Praying we did not lost some formatting.
266 }
267 }
268 if (!sPrefix.isEmpty())
269 {
271 sPrefix );
272 }
273 if (!sSuffix.isEmpty())
274 {
276 sSuffix );
277 }
278 }
279
281 if( NumberingType::CHAR_SPECIAL == eType )
282 {
283 // <text:list-level-style-bullet>
285
286 if( cBullet )
287 {
288 if( cBullet < ' ' )
289 {
290 cBullet = 0xF000 + 149;
291 }
292 // text:bullet-char="..."
293 sTmp.append(OUString(&cBullet, 1));
295 sTmp.makeStringAndClear() );
296 }
297 else
298 {
299 // If 'cBullet' is zero, XML_BULLET_CHAR must exist with blank.
301 }
302 }
303 else if( NumberingType::BITMAP == eType )
304 {
305 // <text:list-level-style-image>
306
308
309 if (xGraphic.is())
310 {
311 OUString sUsedMimeType;
312 OUString sInternalURL = GetExport().AddEmbeddedXGraphic(xGraphic, sUsedMimeType);
313 if (!sInternalURL.isEmpty())
314 {
319 }
320 }
321 else
322 {
323 SAL_WARN_IF(xGraphic.is(), "xmloff", "embedded images are not supported by now");
324 }
325 }
326 else
327 {
328 // <text:list-level-style-number> or <text:outline-level-style>
329 if( bOutline )
331 else
333
336 sTmp.makeStringAndClear() );
338 if( !sTmp.isEmpty() )
341 sTmp.makeStringAndClear() );
342
343 if( nStartValue != 1 )
344 {
345 sTmp.append( static_cast<sal_Int32>(nStartValue) );
347 sTmp.makeStringAndClear() );
348 }
349 if( nDisplayLevels > 1 && NumberingType::NUMBER_NONE != eType )
350 {
351 sTmp.append( static_cast<sal_Int32>(nDisplayLevels) );
353 sTmp.makeStringAndClear() );
354 }
355 }
356
357 {
359 true, true );
360
361 if ( ePosAndSpaceMode == PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION )
362 {
363 nSpaceBefore += nMinLabelWidth;
364 nMinLabelWidth = -nMinLabelWidth;
365 if( nSpaceBefore != 0 )
366 {
368 nSpaceBefore );
370 }
371 if( nMinLabelWidth != 0 )
372 {
373 OUString s = GetExport().GetMM100UnitConverter().convertMeasureToXML( nMinLabelWidth );
375 }
376 if( nMinLabelDist > 0 )
377 {
379 nMinLabelDist );
381 }
382 }
383 /* Check, if properties for position-and-space-mode LABEL_ALIGNMENT
384 are allowed to be exported. (#i89178#)
385 */
386 else if ( ePosAndSpaceMode == PositionAndSpaceMode::LABEL_ALIGNMENT &&
388 {
392 }
393 if( HoriOrientation::LEFT != eAdjust )
394 {
395 enum XMLTokenEnum eValue = XML_TOKEN_INVALID;
396 switch( eAdjust )
397 {
398 case HoriOrientation::RIGHT: eValue = XML_END; break;
399 case HoriOrientation::CENTER: eValue = XML_CENTER; break;
400 }
401 if( eValue != XML_TOKEN_INVALID )
403 }
404
405 if( NumberingType::BITMAP == eType )
406 {
407 enum XMLTokenEnum eValue = XML_TOKEN_INVALID;
408 switch( eImageVertOrient )
409 {
410 case VertOrientation::BOTTOM: // yes, it's OK: BOTTOM means that the baseline
411 // hits the frame at its topmost position
412 case VertOrientation::LINE_TOP:
413 case VertOrientation::CHAR_TOP:
414 eValue = XML_TOP;
415 break;
416 case VertOrientation::CENTER:
417 case VertOrientation::LINE_CENTER:
418 case VertOrientation::CHAR_CENTER:
419 eValue = XML_MIDDLE;
420 break;
421 case VertOrientation::TOP: // yes, it's OK: TOP means that the baseline
422 // hits the frame at its bottommost position
423 case VertOrientation::LINE_BOTTOM:
424 case VertOrientation::CHAR_BOTTOM:
425 eValue = XML_BOTTOM;
426 break;
427 }
428 if( eValue != XML_TOKEN_INVALID )
430
431 eValue = XML_TOKEN_INVALID;
432 switch( eImageVertOrient )
433 {
434 case VertOrientation::TOP:
435 case VertOrientation::CENTER:
436 case VertOrientation::BOTTOM:
437 eValue = XML_BASELINE;
438 break;
439 case VertOrientation::LINE_TOP:
440 case VertOrientation::LINE_CENTER:
441 case VertOrientation::LINE_BOTTOM:
442 eValue = XML_LINE;
443 break;
444 case VertOrientation::CHAR_TOP:
445 case VertOrientation::CHAR_CENTER:
446 case VertOrientation::CHAR_BOTTOM:
447 eValue = XML_CHAR;
448 break;
449 }
450 if( eValue != XML_TOKEN_INVALID )
452
453 if( nImageWidth > 0 )
454 {
456 nImageWidth );
458 }
459
460 if( nImageHeight > 0 )
461 {
463 nImageHeight );
465 }
466 }
467
468 {
470 XML_LIST_LEVEL_PROPERTIES, true, true );
471
472 /* Check, if properties for position-and-space-mode LABEL_ALIGNMENT
473 are allowed to be exported. (#i89178#)
474 */
475 if ( ePosAndSpaceMode == PositionAndSpaceMode::LABEL_ALIGNMENT &&
477 {
478 enum XMLTokenEnum eValue = XML_LISTTAB;
479 if ( eLabelFollowedBy == LabelFollow::SPACE )
480 {
481 eValue = XML_SPACE;
482 }
483 else if ( eLabelFollowedBy == LabelFollow::NOTHING )
484 {
485 eValue = XML_NOTHING;
486 }
488 XML_LABEL_FOLLOWED_BY, eValue );
489
490 if (eLabelFollowedBy == LabelFollow::NEWLINE)
491 {
492 eValue = XML_NEWLINE;
494 XML_LABEL_FOLLOWED_BY, eValue );
495 }
496
497 if ( eLabelFollowedBy == LabelFollow::LISTTAB &&
498 nListtabStopPosition > 0 )
499 {
501 nListtabStopPosition );
504 sAttr );
505 }
506
507 if ( nFirstLineIndent != 0 )
508 {
510 nFirstLineIndent );
513 sAttr );
514 }
515
516 if ( nIndentAt != 0 )
517 {
519 nIndentAt );
522 sAttr );
523 }
524
525 SvXMLElementExport aLabelAlignmentElement( GetExport(), XML_NAMESPACE_STYLE,
527 true, true );
528 }
529 }
530
531 if( NumberingType::CHAR_SPECIAL == eType )
532 {
533 if( !sBulletFontName.isEmpty() )
534 {
535 OUString sStyleName =
537 sBulletFontName, sBulletFontStyleName,
538 eBulletFontFamily, eBulletFontPitch,
539 eBulletFontEncoding );
540
541 if( !sStyleName.isEmpty() )
542 {
545 sStyleName );
546 }
547 else
548 {
549 OUString sTemp;
550
551 const SvXMLUnitConverter& rUnitConv =
553 XMLFontFamilyNamePropHdl aFamilyNameHdl;
554 if( aFamilyNameHdl.exportXML( sTemp, Any(sBulletFontName), rUnitConv ) )
556 XML_FONT_FAMILY, sTemp );
557
558 if( !sBulletFontStyleName.isEmpty() )
561 sBulletFontStyleName );
562
563 XMLFontFamilyPropHdl aFamilyHdl;
564 if( aFamilyHdl.exportXML( sTemp, Any(static_cast<sal_Int16>(eBulletFontFamily)), rUnitConv ) )
567 sTemp );
568
569 XMLFontPitchPropHdl aPitchHdl;
570 if( aPitchHdl.exportXML( sTemp, Any(static_cast<sal_Int16>(eBulletFontPitch)), rUnitConv ) )
572 XML_FONT_PITCH, sTemp );
573
575 if( aEncHdl.exportXML( sTemp, Any(static_cast<sal_Int16>(eBulletFontEncoding)), rUnitConv ) )
577 XML_FONT_CHARSET, sTemp );
578 }
579 }
580 }
581 if( NumberingType::BITMAP != eType )
582 {
583 // fo:color = "#..."
584 if( bHasColor )
585 {
586 if (0xffffffff == static_cast<sal_uInt32>(nColor))
587 {
589 }
590 else
591 {
592 OUStringBuffer sBuffer;
593 ::sax::Converter::convertColor( sBuffer, nColor );
595 sBuffer.makeStringAndClear() );
596 }
597 }
598 // fo:height="...%"
599 if( nBullRelSize )
600 {
601 ::sax::Converter::convertPercent( sTmp, nBullRelSize );
603 sTmp.makeStringAndClear() );
604 }
605 }
606 if( GetExport().GetAttrList().getLength() > 0 )
607 {
609 XML_TEXT_PROPERTIES, true, true );
610 }
611 if (xGraphic.is() && NumberingType::BITMAP == eType)
612 {
613 // optional office:binary-data
615 }
616 }
617}
618
619
620constexpr OUStringLiteral gsNumberingRules( u"NumberingRules" );
621constexpr OUStringLiteral gsIsPhysical( u"IsPhysical" );
622constexpr OUStringLiteral gsIsContinuousNumbering( u"IsContinuousNumbering" );
623
625 rExport( rExp ),
626 // Let list style creation depend on Load/Save option "ODF format version" (#i89178#)
627 mbExportPositionAndSpaceModeLabelAlignment( true )
628{
629 switch (GetExport().getSaneDefaultVersion())
630 {
633 {
635 }
636 break;
637 default: // >= ODFSVER_012
638 {
640 }
641 }
642}
643
645 const OUString& rName, bool bIsHidden,
646 const Reference< XIndexReplace >& rNumRule )
647{
648 Reference< XPropertySet > xPropSet( rNumRule, UNO_QUERY );
649 Reference< XPropertySetInfo > xPropSetInfo;
650 if( xPropSet.is() )
651 xPropSetInfo = xPropSet->getPropertySetInfo();
652
654
655 // style:name="..."
656 if( !rName.isEmpty() )
657 {
658 bool bEncoded = false;
660 GetExport().EncodeStyleName( rName, &bEncoded ) );
661 if( bEncoded )
663 rName);
664 }
665
666 // style:hidden="..."
667 if (bIsHidden
668 && GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
669 {
671 GetExport().AddAttribute(XML_NAMESPACE_STYLE, XML_HIDDEN, "true"); // FIXME for compatibility
672 }
673
674 // text:consecutive-numbering="..."
675 bool bContNumbering = false;
676 if( xPropSetInfo.is() &&
677 xPropSetInfo->hasPropertyByName( gsIsContinuousNumbering ) )
678 {
679 Any aAny( xPropSet->getPropertyValue( gsIsContinuousNumbering ) );
680 bContNumbering = *o3tl::doAccess<bool>(aAny);
681 }
682 if( bContNumbering )
685
686 {
688 true, true );
689 exportLevelStyles( rNumRule );
690 }
691}
692
693void SvxXMLNumRuleExport::exportStyle( const Reference< XStyle >& rStyle )
694{
695 Reference< XPropertySet > xPropSet( rStyle, UNO_QUERY );
696 Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
697
698 Any aAny;
699
700 // Don't export styles that aren't existing really. This may be the
701 // case for StarOffice Writer's pool styles.
702 if( xPropSetInfo->hasPropertyByName( gsIsPhysical ) )
703 {
704 aAny = xPropSet->getPropertyValue( gsIsPhysical );
705 if( !*o3tl::doAccess<bool>(aAny) )
706 return;
707 }
708
709 aAny = xPropSet->getPropertyValue( gsNumberingRules );
710 Reference<XIndexReplace> xNumRule;
711 aAny >>= xNumRule;
712
713 OUString sName = rStyle->getName();
714
715 bool bHidden = false;
716 if ( xPropSetInfo->hasPropertyByName( "Hidden" ) )
717 {
718 aAny = xPropSet->getPropertyValue( "Hidden" );
719 aAny >>= bHidden;
720 }
721
722 exportNumberingRule( sName, bHidden, xNumRule );
723}
724
726{
727 Reference< XChapterNumberingSupplier > xCNSupplier( GetExport().GetModel(),
728 UNO_QUERY );
729 SAL_WARN_IF( !xCNSupplier.is(), "xmloff", "no chapter numbering supplier" );
730
731 if( !xCNSupplier.is() )
732 return;
733
734 Reference< XIndexReplace > xNumRule( xCNSupplier->getChapterNumberingRules() );
735 SAL_WARN_IF( !xNumRule.is(), "xmloff", "no chapter numbering rules" );
736
737 if( !xNumRule.is() )
738 return;
739
740 /* Outline style has property style:name since ODF 1.2
741 Thus, export this property and adjust fix for issue #i69627# (#i90780#)
742 */
743 OUString sOutlineStyleName;
744 {
745 Reference<XPropertySet> xNumRulePropSet(
746 xCNSupplier->getChapterNumberingRules(), UNO_QUERY );
747 if (xNumRulePropSet.is())
748 {
749 xNumRulePropSet->getPropertyValue( "Name" ) >>= sOutlineStyleName;
750 }
751 }
752 const SvtSaveOptions::ODFSaneDefaultVersion nODFVersion =
754 if ((nODFVersion == SvtSaveOptions::ODFSVER_010 ||
755 nODFVersion == SvtSaveOptions::ODFSVER_011)
756 && GetExport().writeOutlineStyleAsNormalListStyle())
757 {
758 exportNumberingRule( sOutlineStyleName, false, xNumRule );
759 }
760 else
761 {
762 if (nODFVersion != SvtSaveOptions::ODFSVER_010 &&
763 nODFVersion != SvtSaveOptions::ODFSVER_011)
764 {
765 // style:name="..."
767 if ( !sOutlineStyleName.isEmpty() )
768 {
769 bool bEncoded = false;
771 GetExport().EncodeStyleName( sOutlineStyleName,
772 &bEncoded ) );
773 if( bEncoded )
776 sOutlineStyleName );
777 }
778 }
780 XML_OUTLINE_STYLE, true, true );
781 exportLevelStyles( xNumRule, true );
782 }
783}
784
785void SvxXMLNumRuleExport::exportStyles( bool bUsed, bool bExportChapterNumbering )
786{
787 if( bExportChapterNumbering )
789
790 Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(), UNO_QUERY );
791 SAL_WARN_IF( !xFamiliesSupp.is(), "xmloff", "No XStyleFamiliesSupplier from XModel for export!" );
792 if( !xFamiliesSupp.is() )
793 return;
794
795 Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
796 SAL_WARN_IF( !xFamiliesSupp.is(), "xmloff", "getStyleFamilies() from XModel failed for export!" );
797
798 if( !xFamilies.is() )
799 return;
800
801 static const OUStringLiteral aNumberStyleName( u"NumberingStyles" );
802
803 Reference< XIndexAccess > xStyles;
804 if( !xFamilies->hasByName( aNumberStyleName ) )
805 return;
806
807 xFamilies->getByName( aNumberStyleName ) >>= xStyles;
808
809 SAL_WARN_IF( !xStyles.is(), "xmloff", "Style not found for export!" );
810
811 if( !xStyles.is() )
812 return;
813
814 const sal_Int32 nStyles = xStyles->getCount();
815
816 for( sal_Int32 i=0; i < nStyles; i++ )
817 {
818 Reference< XStyle > xStyle;
819 xStyles->getByIndex( i ) >>= xStyle;
820
821 if( !bUsed || xStyle->isInUse() )
822 exportStyle( xStyle );
823
824 }
825}
826
827/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
Definition: xmlexp.cxx:911
rtl::Reference< XMLFontAutoStylePool > const & GetFontAutoStylePool()
Definition: xmlexp.hxx:602
SvtSaveOptions::ODFSaneDefaultVersion getSaneDefaultVersion() const
returns the deterministic version for odf export
Definition: xmlexp.cxx:2271
bool AddEmbeddedXGraphicAsBase64(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic)
Definition: xmlexp.cxx:1879
void CheckAttrList()
Definition: xmlexp.cxx:1016
const SvXMLUnitConverter & GetMM100UnitConverter() const
Definition: xmlexp.hxx:396
OUString AddEmbeddedXGraphic(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic, OUString &rOutMimeType, OUString const &rRequestedName=OUString())
Definition: xmlexp.cxx:1842
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:654
void convertMeasureToXML(OUStringBuffer &rBuffer, sal_Int32 nMeasure) const
convert measure to string: from meCoreMeasureUnit to meXMLMeasureUnit
Definition: xmluconv.cxx:207
static void convertNumLetterSync(OUStringBuffer &rBuffer, sal_Int16 nType)
Definition: xmluconv.cxx:751
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:785
SAL_DLLPRIVATE void exportStyle(const css::uno::Reference< css::style::XStyle > &rStyle)
Definition: xmlnume.cxx:693
void exportNumberingRule(const OUString &rName, bool bIsHidden, const css::uno::Reference< css::container::XIndexReplace > &xNumRule)
Definition: xmlnume.cxx:644
SAL_DLLPRIVATE void exportOutline()
Definition: xmlnume.cxx:725
SvxXMLNumRuleExport(SvXMLExport &rExport)
Definition: xmlnume.cxx:624
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:239
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:207
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:272
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 sPrefix
Sequence< sal_Int8 > aSeq
OUString sSuffix
OUString sBulletFontName
#define SAL_WARN_IF(condition, area, stream)
const char * sName
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:1217
@ XML_LIST_LEVEL_PROPERTIES
Definition: xmltoken.hxx:2634
@ XML_LIST_LEVEL_STYLE_NUMBER
Definition: xmltoken.hxx:1218
@ XML_LIST_TAB_STOP_POSITION
Definition: xmltoken.hxx:3288
@ XML_CONSECUTIVE_NUMBERING
Definition: xmltoken.hxx:500
@ XML_FONT_FAMILY_GENERIC
Definition: xmltoken.hxx:863
@ XML_LIST_LEVEL_POSITION_AND_SPACE_MODE
Definition: xmltoken.hxx:3280
@ XML_LIST_LEVEL_STYLE_BULLET
Definition: xmltoken.hxx:1216
@ XML_USE_WINDOW_FONT_COLOR
Definition: xmltoken.hxx:2079
@ XML_OUTLINE_LEVEL_STYLE
Definition: xmltoken.hxx:1453
@ XML_MIN_LABEL_DISTANCE
Definition: xmltoken.hxx:1303
@ XML_LIST_LEVEL_LABEL_ALIGNMENT
Definition: xmltoken.hxx:3283
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")