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 
43 #include <sax/tools/converter.hxx>
44 
45 #include <xmloff/xmlnamespace.hxx>
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 
55 using namespace ::com::sun::star;
56 using namespace ::com::sun::star::uno;
57 using namespace ::com::sun::star::style;
58 using namespace ::com::sun::star::text;
59 using namespace ::com::sun::star::container;
60 using namespace ::com::sun::star::beans;
61 using namespace ::xmloff::token;
62 
63 void 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;
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 == "BulletChar" )
125  {
126  OUString sValue;
127  rProp.Value >>= sValue;
128  if( !sValue.isEmpty() )
129  {
130  cBullet = sValue.iterateCodePoints(&o3tl::temporary(sal_Int32(0)));
131  }
132  }
133  else if( rProp.Name == "BulletRelSize" )
134  {
135  rProp.Value >>= nBullRelSize;
136  }
137  else if( rProp.Name == "Adjust" )
138  {
139  sal_Int16 nValue = 0;
140  rProp.Value >>= nValue;
141  eAdjust = nValue;
142  }
143  else if( rProp.Name == "BulletFont" )
144  {
145  awt::FontDescriptor rFDesc;
146  if( rProp.Value >>= rFDesc )
147  {
148  sBulletFontName = rFDesc.Name;
149  sBulletFontStyleName = rFDesc.StyleName;
150  eBulletFontFamily = static_cast< FontFamily >( rFDesc.Family );
151  eBulletFontPitch = static_cast< FontPitch >( rFDesc.Pitch );
152  eBulletFontEncoding = static_cast<rtl_TextEncoding>(rFDesc.CharSet);
153  }
154  }
155  else if( rProp.Name == "GraphicBitmap" )
156  {
157  uno::Reference<awt::XBitmap> xBitmap;
158  rProp.Value >>= xBitmap;
159  xGraphic.set(xBitmap, uno::UNO_QUERY);
160  }
161  else if( rProp.Name == "BulletColor" )
162  {
163  rProp.Value >>= nColor;
164  bHasColor = true;
165  }
166  else if( rProp.Name == "StartWith" )
167  {
168  rProp.Value >>= nStartValue;
169  }
170  else if( rProp.Name == "LeftMargin" )
171  {
172  rProp.Value >>= nSpaceBefore;
173  }
174  else if( rProp.Name == "FirstLineOffset" )
175  {
176  rProp.Value >>= nMinLabelWidth;
177  }
178  else if( rProp.Name == "SymbolTextDistance" )
179  {
180  rProp.Value >>= nMinLabelDist;
181  }
182  else if( rProp.Name == "ParentNumbering" )
183  {
184  rProp.Value >>= nDisplayLevels;
185  if( nDisplayLevels > nLevel+1 )
186  nDisplayLevels = static_cast<sal_Int16>( nLevel )+1;
187  }
188  else if( rProp.Name == "CharStyleName" )
189  {
190  rProp.Value >>= sTextStyleName;
191  }
192  else if( rProp.Name == "GraphicSize" )
193  {
194  awt::Size aSize;
195  if( rProp.Value >>= aSize )
196  {
197  nImageWidth = aSize.Width;
198  nImageHeight = aSize.Height;
199  }
200  }
201  else if( rProp.Name == "VertOrient" )
202  {
203  sal_Int16 nValue = 0;
204  rProp.Value >>= nValue;
205  eImageVertOrient = nValue;
206  }
207  else if( rProp.Name == "PositionAndSpaceMode" )
208  {
209  sal_Int16 nValue = 0;
210  rProp.Value >>= nValue;
211  ePosAndSpaceMode = nValue;
212  }
213  else if( rProp.Name == "LabelFollowedBy" )
214  {
215  sal_Int16 nValue = 0;
216  rProp.Value >>= nValue;
217  eLabelFollowedBy = nValue;
218  }
219  else if( rProp.Name == "ListtabStopPosition" )
220  {
221  rProp.Value >>= nListtabStopPosition;
222  }
223  else if( rProp.Name == "FirstLineIndent" )
224  {
225  rProp.Value >>= nFirstLineIndent;
226  }
227  else if( rProp.Name == "IndentAt" )
228  {
229  rProp.Value >>= nIndentAt;
230  }
231  }
232 
233  if( bOutline && (NumberingType::CHAR_SPECIAL == eType ||
234  NumberingType::BITMAP == eType) )
235  {
236  SAL_WARN_IF( bOutline, "xmloff",
237  "SvxXMLNumRuleExport::exportLevelStyle: invalid style for outline" );
238  return;
239  }
240 
242 
243  // text:level
244  OUStringBuffer sTmp;
245  sTmp.append( nLevel + 1 );
246  GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_LEVEL, sTmp.makeStringAndClear() );
247  // #i110694#: no style-name on list-level-style-image
248  // #i116149#: neither prefix/suffix
249  if (NumberingType::BITMAP != eType)
250  {
251  if (!sTextStyleName.isEmpty())
252  {
254  GetExport().EncodeStyleName( sTextStyleName ) );
255  }
256  if (!sPrefix.isEmpty())
257  {
259  sPrefix );
260  }
261  if (!sSuffix.isEmpty())
262  {
264  sSuffix );
265  }
266  }
267 
269  if( NumberingType::CHAR_SPECIAL == eType )
270  {
271  // <text:list-level-style-bullet>
273 
274  if( cBullet )
275  {
276  if( cBullet < ' ' )
277  {
278  cBullet = 0xF000 + 149;
279  }
280  // text:bullet-char="..."
281  sTmp.append(OUString(&cBullet, 1));
283  sTmp.makeStringAndClear() );
284  }
285  else
286  {
287  // If 'cBullet' is zero, XML_BULLET_CHAR must exist with blank.
289  }
290  }
291  else if( NumberingType::BITMAP == eType )
292  {
293  // <text:list-level-style-image>
294 
296 
297  if (xGraphic.is())
298  {
299  OUString sUsedMimeType;
300  OUString sInternalURL = GetExport().AddEmbeddedXGraphic(xGraphic, sUsedMimeType);
301  if (!sInternalURL.isEmpty())
302  {
307  }
308  }
309  else
310  {
311  SAL_WARN_IF(xGraphic.is(), "xmloff", "embedded images are not supported by now");
312  }
313  }
314  else
315  {
316  // <text:list-level-style-number> or <text:outline-level-style>
317  if( bOutline )
318  eElem = XML_OUTLINE_LEVEL_STYLE;
319  else
321 
324  sTmp.makeStringAndClear() );
326  if( !sTmp.isEmpty() )
329  sTmp.makeStringAndClear() );
330 
331  if( nStartValue != 1 )
332  {
333  sTmp.append( static_cast<sal_Int32>(nStartValue) );
335  sTmp.makeStringAndClear() );
336  }
337  if( nDisplayLevels > 1 && NumberingType::NUMBER_NONE != eType )
338  {
339  sTmp.append( static_cast<sal_Int32>(nDisplayLevels) );
341  sTmp.makeStringAndClear() );
342  }
343  }
344 
345  {
347  true, true );
348 
349  if ( ePosAndSpaceMode == PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION )
350  {
351  nSpaceBefore += nMinLabelWidth;
352  nMinLabelWidth = -nMinLabelWidth;
353  if( nSpaceBefore != 0 )
354  {
356  nSpaceBefore );
358  }
359  if( nMinLabelWidth != 0 )
360  {
361  OUString s = GetExport().GetMM100UnitConverter().convertMeasureToXML( nMinLabelWidth );
363  }
364  if( nMinLabelDist > 0 )
365  {
367  nMinLabelDist );
369  }
370  }
371  /* Check, if properties for position-and-space-mode LABEL_ALIGNMENT
372  are allowed to be exported. (#i89178#)
373  */
374  else if ( ePosAndSpaceMode == PositionAndSpaceMode::LABEL_ALIGNMENT &&
376  {
380  }
381  if( HoriOrientation::LEFT != eAdjust )
382  {
383  enum XMLTokenEnum eValue = XML_TOKEN_INVALID;
384  switch( eAdjust )
385  {
386  case HoriOrientation::RIGHT: eValue = XML_END; break;
387  case HoriOrientation::CENTER: eValue = XML_CENTER; break;
388  }
389  if( eValue != XML_TOKEN_INVALID )
391  }
392 
393  if( NumberingType::BITMAP == eType )
394  {
395  enum XMLTokenEnum eValue = XML_TOKEN_INVALID;
396  switch( eImageVertOrient )
397  {
398  case VertOrientation::BOTTOM: // yes, it's OK: BOTTOM means that the baseline
399  // hits the frame at its topmost position
400  case VertOrientation::LINE_TOP:
401  case VertOrientation::CHAR_TOP:
402  eValue = XML_TOP;
403  break;
404  case VertOrientation::CENTER:
405  case VertOrientation::LINE_CENTER:
406  case VertOrientation::CHAR_CENTER:
407  eValue = XML_MIDDLE;
408  break;
409  case VertOrientation::TOP: // yes, it's OK: TOP means that the baseline
410  // hits the frame at its bottommost position
411  case VertOrientation::LINE_BOTTOM:
412  case VertOrientation::CHAR_BOTTOM:
413  eValue = XML_BOTTOM;
414  break;
415  }
416  if( eValue != XML_TOKEN_INVALID )
418 
419  eValue = XML_TOKEN_INVALID;
420  switch( eImageVertOrient )
421  {
422  case VertOrientation::TOP:
423  case VertOrientation::CENTER:
424  case VertOrientation::BOTTOM:
425  eValue = XML_BASELINE;
426  break;
427  case VertOrientation::LINE_TOP:
428  case VertOrientation::LINE_CENTER:
429  case VertOrientation::LINE_BOTTOM:
430  eValue = XML_LINE;
431  break;
432  case VertOrientation::CHAR_TOP:
433  case VertOrientation::CHAR_CENTER:
434  case VertOrientation::CHAR_BOTTOM:
435  eValue = XML_CHAR;
436  break;
437  }
438  if( eValue != XML_TOKEN_INVALID )
440 
441  if( nImageWidth > 0 )
442  {
444  nImageWidth );
446  }
447 
448  if( nImageHeight > 0 )
449  {
451  nImageHeight );
453  }
454  }
455 
456  {
458  XML_LIST_LEVEL_PROPERTIES, true, true );
459 
460  /* Check, if properties for position-and-space-mode LABEL_ALIGNMENT
461  are allowed to be exported. (#i89178#)
462  */
463  if ( ePosAndSpaceMode == PositionAndSpaceMode::LABEL_ALIGNMENT &&
465  {
466  enum XMLTokenEnum eValue = XML_LISTTAB;
467  if ( eLabelFollowedBy == LabelFollow::SPACE )
468  {
469  eValue = XML_SPACE;
470  }
471  else if ( eLabelFollowedBy == LabelFollow::NOTHING )
472  {
473  eValue = XML_NOTHING;
474  }
476  XML_LABEL_FOLLOWED_BY, eValue );
477 
478  if (eLabelFollowedBy == LabelFollow::NEWLINE)
479  {
480  eValue = XML_NEWLINE;
482  XML_LABEL_FOLLOWED_BY, eValue );
483  }
484 
485  if ( eLabelFollowedBy == LabelFollow::LISTTAB &&
486  nListtabStopPosition > 0 )
487  {
489  nListtabStopPosition );
492  sAttr );
493  }
494 
495  if ( nFirstLineIndent != 0 )
496  {
498  nFirstLineIndent );
501  sAttr );
502  }
503 
504  if ( nIndentAt != 0 )
505  {
507  nIndentAt );
510  sAttr );
511  }
512 
513  SvXMLElementExport aLabelAlignmentElement( GetExport(), XML_NAMESPACE_STYLE,
515  true, true );
516  }
517  }
518 
519  if( NumberingType::CHAR_SPECIAL == eType )
520  {
521  if( !sBulletFontName.isEmpty() )
522  {
523  OUString sStyleName =
525  sBulletFontName, sBulletFontStyleName,
526  eBulletFontFamily, eBulletFontPitch,
527  eBulletFontEncoding );
528 
529  if( !sStyleName.isEmpty() )
530  {
533  sStyleName );
534  }
535  else
536  {
537  OUString sTemp;
538 
539  const SvXMLUnitConverter& rUnitConv =
541  XMLFontFamilyNamePropHdl aFamilyNameHdl;
542  if( aFamilyNameHdl.exportXML( sTemp, Any(sBulletFontName), rUnitConv ) )
544  XML_FONT_FAMILY, sTemp );
545 
546  if( !sBulletFontStyleName.isEmpty() )
549  sBulletFontStyleName );
550 
551  XMLFontFamilyPropHdl aFamilyHdl;
552  if( aFamilyHdl.exportXML( sTemp, Any(static_cast<sal_Int16>(eBulletFontFamily)), rUnitConv ) )
555  sTemp );
556 
557  XMLFontPitchPropHdl aPitchHdl;
558  if( aPitchHdl.exportXML( sTemp, Any(static_cast<sal_Int16>(eBulletFontPitch)), rUnitConv ) )
560  XML_FONT_PITCH, sTemp );
561 
562  XMLFontEncodingPropHdl aEncHdl;
563  if( aEncHdl.exportXML( sTemp, Any(static_cast<sal_Int16>(eBulletFontEncoding)), rUnitConv ) )
565  XML_FONT_CHARSET, sTemp );
566  }
567  }
568  }
569  if( NumberingType::BITMAP != eType )
570  {
571  // fo:color = "#..."
572  if( bHasColor )
573  {
574  if (0xffffffff == static_cast<sal_uInt32>(nColor))
575  {
577  }
578  else
579  {
580  OUStringBuffer sBuffer;
581  ::sax::Converter::convertColor( sBuffer, nColor );
583  sBuffer.makeStringAndClear() );
584  }
585  }
586  // fo:height="...%"
587  if( nBullRelSize )
588  {
589  ::sax::Converter::convertPercent( sTmp, nBullRelSize );
591  sTmp.makeStringAndClear() );
592  }
593  }
594  if( GetExport().GetAttrList().getLength() > 0 )
595  {
597  XML_TEXT_PROPERTIES, true, true );
598  }
599  if (xGraphic.is() && NumberingType::BITMAP == eType)
600  {
601  // optional office:binary-data
603  }
604  }
605 }
606 
607 
608 constexpr OUStringLiteral gsNumberingRules( u"NumberingRules" );
609 constexpr OUStringLiteral gsIsPhysical( u"IsPhysical" );
610 constexpr OUStringLiteral gsIsContinuousNumbering( u"IsContinuousNumbering" );
611 
613  rExport( rExp ),
614  // Let list style creation depend on Load/Save option "ODF format version" (#i89178#)
615  mbExportPositionAndSpaceModeLabelAlignment( true )
616 {
617  switch (GetExport().getSaneDefaultVersion())
618  {
621  {
623  }
624  break;
625  default: // >= ODFSVER_012
626  {
628  }
629  }
630 }
631 
633 {
634 }
635 
637  const OUString& rName, bool bIsHidden,
638  const Reference< XIndexReplace >& rNumRule )
639 {
640  Reference< XPropertySet > xPropSet( rNumRule, UNO_QUERY );
641  Reference< XPropertySetInfo > xPropSetInfo;
642  if( xPropSet.is() )
643  xPropSetInfo = xPropSet->getPropertySetInfo();
644 
646 
647  // style:name="..."
648  if( !rName.isEmpty() )
649  {
650  bool bEncoded = false;
652  GetExport().EncodeStyleName( rName, &bEncoded ) );
653  if( bEncoded )
655  rName);
656  }
657 
658  // style:hidden="..."
659  if (bIsHidden
660  && GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
661  {
663  GetExport().AddAttribute(XML_NAMESPACE_STYLE, XML_HIDDEN, "true"); // FIXME for compatibility
664  }
665 
666  // text:consecutive-numbering="..."
667  bool bContNumbering = false;
668  if( xPropSetInfo.is() &&
669  xPropSetInfo->hasPropertyByName( gsIsContinuousNumbering ) )
670  {
671  Any aAny( xPropSet->getPropertyValue( gsIsContinuousNumbering ) );
672  bContNumbering = *o3tl::doAccess<bool>(aAny);
673  }
674  if( bContNumbering )
677 
678  {
680  true, true );
681  exportLevelStyles( rNumRule );
682  }
683 }
684 
685 void SvxXMLNumRuleExport::exportStyle( const Reference< XStyle >& rStyle )
686 {
687  Reference< XPropertySet > xPropSet( rStyle, UNO_QUERY );
688  Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
689 
690  Any aAny;
691 
692  // Don't export styles that aren't existing really. This may be the
693  // case for StarOffice Writer's pool styles.
694  if( xPropSetInfo->hasPropertyByName( gsIsPhysical ) )
695  {
696  aAny = xPropSet->getPropertyValue( gsIsPhysical );
697  if( !*o3tl::doAccess<bool>(aAny) )
698  return;
699  }
700 
701  aAny = xPropSet->getPropertyValue( gsNumberingRules );
702  Reference<XIndexReplace> xNumRule;
703  aAny >>= xNumRule;
704 
705  OUString sName = rStyle->getName();
706 
707  bool bHidden = false;
708  if ( xPropSetInfo->hasPropertyByName( "Hidden" ) )
709  {
710  aAny = xPropSet->getPropertyValue( "Hidden" );
711  aAny >>= bHidden;
712  }
713 
714  exportNumberingRule( sName, bHidden, xNumRule );
715 }
716 
718 {
719  Reference< XChapterNumberingSupplier > xCNSupplier( GetExport().GetModel(),
720  UNO_QUERY );
721  SAL_WARN_IF( !xCNSupplier.is(), "xmloff", "no chapter numbering supplier" );
722 
723  if( !xCNSupplier.is() )
724  return;
725 
726  Reference< XIndexReplace > xNumRule( xCNSupplier->getChapterNumberingRules() );
727  SAL_WARN_IF( !xNumRule.is(), "xmloff", "no chapter numbering rules" );
728 
729  if( !xNumRule.is() )
730  return;
731 
732  /* Outline style has property style:name since ODF 1.2
733  Thus, export this property and adjust fix for issue #i69627# (#i90780#)
734  */
735  OUString sOutlineStyleName;
736  {
737  Reference<XPropertySet> xNumRulePropSet(
738  xCNSupplier->getChapterNumberingRules(), UNO_QUERY );
739  if (xNumRulePropSet.is())
740  {
741  xNumRulePropSet->getPropertyValue( "Name" ) >>= sOutlineStyleName;
742  }
743  }
744  const SvtSaveOptions::ODFSaneDefaultVersion nODFVersion =
746  if ((nODFVersion == SvtSaveOptions::ODFSVER_010 ||
747  nODFVersion == SvtSaveOptions::ODFSVER_011)
748  && GetExport().writeOutlineStyleAsNormalListStyle())
749  {
750  exportNumberingRule( sOutlineStyleName, false, xNumRule );
751  }
752  else
753  {
754  if (nODFVersion != SvtSaveOptions::ODFSVER_010 &&
755  nODFVersion != SvtSaveOptions::ODFSVER_011)
756  {
757  // style:name="..."
759  if ( !sOutlineStyleName.isEmpty() )
760  {
761  bool bEncoded = false;
763  GetExport().EncodeStyleName( sOutlineStyleName,
764  &bEncoded ) );
765  if( bEncoded )
768  sOutlineStyleName );
769  }
770  }
772  XML_OUTLINE_STYLE, true, true );
773  exportLevelStyles( xNumRule, true );
774  }
775 }
776 
779  bool bExportChapterNumbering )
780 {
781  if( bExportChapterNumbering )
782  exportOutline();
783 
784  Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(), UNO_QUERY );
785  SAL_WARN_IF( !xFamiliesSupp.is(), "xmloff", "No XStyleFamiliesSupplier from XModel for export!" );
786  if( !xFamiliesSupp.is() )
787  return;
788 
789  Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
790  SAL_WARN_IF( !xFamiliesSupp.is(), "xmloff", "getStyleFamilies() from XModel failed for export!" );
791 
792  if( !xFamilies.is() )
793  return;
794 
795  const OUString aNumberStyleName( "NumberingStyles" );
796 
797  Reference< XIndexAccess > xStyles;
798  if( !xFamilies->hasByName( aNumberStyleName ) )
799  return;
800 
801  xFamilies->getByName( aNumberStyleName ) >>= xStyles;
802 
803  SAL_WARN_IF( !xStyles.is(), "xmloff", "Style not found for export!" );
804 
805  if( !xStyles.is() )
806  return;
807 
808  const sal_Int32 nStyles = xStyles->getCount();
809 
810  for( sal_Int32 i=0; i < nStyles; i++ )
811  {
812  Reference< XStyle > xStyle;
813  xStyles->getByIndex( i ) >>= xStyle;
814 
815  if( !bUsed || xStyle->isInUse() )
816  {
817  exportStyle( xStyle );
818  if( pPool )
819  pPool->RegisterName( xStyle->getName() );
820  }
821  }
822 }
823 
824 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvxXMLNumRuleExport(SvXMLExport &rExport)
Definition: xmlnume.cxx:612
SvXMLExport & GetExport()
Definition: xmlnume.hxx:55
sal_uInt32 sal_UCS4
PropertyHandler for the XML-data-type:
Definition: fonthdl.hxx:64
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
Definition: xmluconv.hxx:80
SAL_DLLPRIVATE void exportOutline()
Definition: xmlnume.cxx:717
SAL_DLLPRIVATE void exportStyle(const css::uno::Reference< css::style::XStyle > &rStyle)
Definition: xmlnume.cxx:685
constexpr OUStringLiteral gsNumberingRules(u"NumberingRules")
const SvXMLUnitConverter & GetMM100UnitConverter() const
Definition: xmlexp.hxx:394
void CheckAttrList()
Definition: xmlexp.cxx:1030
FAMILY_DONTKNOW
constexpr sal_uInt16 XML_NAMESPACE_XLINK
constexpr sal_uInt16 XML_NAMESPACE_LO_EXT
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
SvXMLAttributeList & GetAttrList()
Definition: xmlexp.hxx:380
OUString sSuffix
int nCount
void AddAttribute(sal_uInt16 nPrefix, const char *pName, const OUString &rValue)
Definition: xmlexp.cxx:909
OUString AddEmbeddedXGraphic(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic, OUString &rOutMimeType, OUString const &rRequestedName=OUString())
Definition: xmlexp.cxx:1858
const char * sName
XMLTokenEnum
The enumeration of all XML tokens.
Definition: xmltoken.hxx:49
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:686
PropertyHandler for the XML-data-type:
Definition: fonthdl.hxx:28
DocumentType eType
SvtSaveOptions::ODFSaneDefaultVersion getSaneDefaultVersion() const
returns the deterministic version for odf export
Definition: xmlexp.cxx:2297
OUString sPrefix
PropertyHandler for the XML-data-type:
Definition: fonthdl.hxx:52
constexpr sal_uInt16 XML_NAMESPACE_FO
int i
void RegisterName(const OUString &rName)
constexpr sal_uInt16 XML_NAMESPACE_TEXT
void exportStyles(bool bUsed, XMLTextListAutoStylePool *pPool, bool bExportChapterNumbering)
Definition: xmlnume.cxx:777
virtual sal_Int16 SAL_CALL getLength() override
Definition: attrlist.cxx:34
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
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
static bool convertColor(sal_Int32 &rColor, std::u16string_view rValue)
PITCH_DONTKNOW
constexpr OUStringLiteral gsIsPhysical(u"IsPhysical")
OUString sBulletFontName
FontPitch
constexpr T & temporary(T &&x)
static bool convertPercent(sal_Int32 &rValue, std::u16string_view rString)
bool mbExportPositionAndSpaceModeLabelAlignment
Definition: xmlnume.hxx:45
FontFamily
static void convertNumLetterSync(OUStringBuffer &rBuffer, sal_Int16 nType)
Definition: xmluconv.cxx:783
#define SAL_WARN_IF(condition, area, stream)
rtl::Reference< XMLFontAutoStylePool > const & GetFontAutoStylePool()
Definition: xmlexp.hxx:600
void exportLevelStyles(const css::uno::Reference< css::container::XIndexReplace > &xNumRule, bool bOutline=false)
Definition: xmlnume.cxx:63
Handling of tokens in XML:
void exportNumberingRule(const OUString &rName, bool bIsHidden, const css::uno::Reference< css::container::XIndexReplace > &xNumRule)
Definition: xmlnume.cxx:636
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
Sequence< sal_Int8 > aSeq
bool AddEmbeddedXGraphicAsBase64(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic)
Definition: xmlexp.cxx:1895
PropertyHandler for the XML-data-type:
Definition: fonthdl.hxx:40
css::uno::Any const SvXMLExport & rExport
Definition: ImageStyle.hxx:38
Reference< XGraphic > xGraphic
void convertMeasureToXML(OUStringBuffer &rBuffer, sal_Int32 nMeasure) const
convert measure to string: from meCoreMeasureUnit to meXMLMeasureUnit
Definition: xmluconv.cxx:191
constexpr sal_uInt16 XML_NAMESPACE_STYLE
constexpr OUStringLiteral gsIsContinuousNumbering(u"IsContinuousNumbering")
sal_Int16 nValue
SAL_DLLPRIVATE void exportLevelStyle(sal_Int32 nLevel, const css::uno::Sequence< css::beans::PropertyValue > &rProps, bool bOutline)
Definition: xmlnume.cxx:78