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