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/xmlnmspe.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 
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_Unicode 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[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( cBullet );
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 static const OUStringLiteral gsNumberingRules( "NumberingRules" );
609 static const OUStringLiteral gsIsPhysical( "IsPhysical" );
610 static const OUStringLiteral gsIsContinuousNumbering( "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 && GetExport( ).getDefaultVersion( ) == SvtSaveOptions::ODFVER_LATEST )
661 
662  // text:consecutive-numbering="..."
663  bool bContNumbering = false;
664  if( xPropSetInfo.is() &&
665  xPropSetInfo->hasPropertyByName( gsIsContinuousNumbering ) )
666  {
667  Any aAny( xPropSet->getPropertyValue( gsIsContinuousNumbering ) );
668  bContNumbering = *o3tl::doAccess<bool>(aAny);
669  }
670  if( bContNumbering )
673 
674  {
676  true, true );
677  exportLevelStyles( rNumRule );
678  }
679 }
680 
681 void SvxXMLNumRuleExport::exportStyle( const Reference< XStyle >& rStyle )
682 {
683  Reference< XPropertySet > xPropSet( rStyle, UNO_QUERY );
684  Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
685 
686  Any aAny;
687 
688  // Don't export styles that aren't existing really. This may be the
689  // case for StarOffice Writer's pool styles.
690  if( xPropSetInfo->hasPropertyByName( gsIsPhysical ) )
691  {
692  aAny = xPropSet->getPropertyValue( gsIsPhysical );
693  if( !*o3tl::doAccess<bool>(aAny) )
694  return;
695  }
696 
697  aAny = xPropSet->getPropertyValue( gsNumberingRules );
698  Reference<XIndexReplace> xNumRule;
699  aAny >>= xNumRule;
700 
701  OUString sName = rStyle->getName();
702 
703  bool bHidden = false;
704  if ( xPropSetInfo->hasPropertyByName( "Hidden" ) )
705  {
706  aAny = xPropSet->getPropertyValue( "Hidden" );
707  aAny >>= bHidden;
708  }
709 
710  exportNumberingRule( sName, bHidden, xNumRule );
711 }
712 
714 {
715  Reference< XChapterNumberingSupplier > xCNSupplier( GetExport().GetModel(),
716  UNO_QUERY );
717  SAL_WARN_IF( !xCNSupplier.is(), "xmloff", "no chapter numbering supplier" );
718 
719  if( xCNSupplier.is() )
720  {
721  Reference< XIndexReplace > xNumRule( xCNSupplier->getChapterNumberingRules() );
722  SAL_WARN_IF( !xNumRule.is(), "xmloff", "no chapter numbering rules" );
723 
724  if( xNumRule.is() )
725  {
726  /* Outline style has property style:name since ODF 1.2
727  Thus, export this property and adjust fix for issue #i69627# (#i90780#)
728  */
729  OUString sOutlineStyleName;
730  {
731  Reference<XPropertySet> xNumRulePropSet(
732  xCNSupplier->getChapterNumberingRules(), UNO_QUERY );
733  if (xNumRulePropSet.is())
734  {
735  const OUString sName( "Name" );
736  xNumRulePropSet->getPropertyValue( sName ) >>= sOutlineStyleName;
737  }
738  }
739  const SvtSaveOptions::ODFSaneDefaultVersion nODFVersion =
741  if ((nODFVersion == SvtSaveOptions::ODFSVER_010 ||
742  nODFVersion == SvtSaveOptions::ODFSVER_011)
743  && GetExport().writeOutlineStyleAsNormalListStyle())
744  {
745  exportNumberingRule( sOutlineStyleName, false, xNumRule );
746  }
747  else
748  {
749  if (nODFVersion != SvtSaveOptions::ODFSVER_010 &&
750  nODFVersion != SvtSaveOptions::ODFSVER_011)
751  {
752  // style:name="..."
754  if ( !sOutlineStyleName.isEmpty() )
755  {
756  bool bEncoded = false;
758  GetExport().EncodeStyleName( sOutlineStyleName,
759  &bEncoded ) );
760  if( bEncoded )
763  sOutlineStyleName );
764  }
765  }
767  XML_OUTLINE_STYLE, true, true );
768  exportLevelStyles( xNumRule, true );
769  }
770  }
771  }
772 }
773 
776  bool bExportChapterNumbering )
777 {
778  if( bExportChapterNumbering )
779  exportOutline();
780 
781  Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(), UNO_QUERY );
782  SAL_WARN_IF( !xFamiliesSupp.is(), "xmloff", "No XStyleFamiliesSupplier from XModel for export!" );
783  if( xFamiliesSupp.is() )
784  {
785  Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
786  SAL_WARN_IF( !xFamiliesSupp.is(), "xmloff", "getStyleFamilies() from XModel failed for export!" );
787 
788  if( xFamilies.is() )
789  {
790  const OUString aNumberStyleName( "NumberingStyles" );
791 
792  Reference< XIndexAccess > xStyles;
793  if( xFamilies->hasByName( aNumberStyleName ) )
794  {
795  xFamilies->getByName( aNumberStyleName ) >>= xStyles;
796 
797  SAL_WARN_IF( !xStyles.is(), "xmloff", "Style not found for export!" );
798 
799  if( xStyles.is() )
800  {
801  const sal_Int32 nStyles = xStyles->getCount();
802 
803  for( sal_Int32 i=0; i < nStyles; i++ )
804  {
805  Reference< XStyle > xStyle;
806  xStyles->getByIndex( i ) >>= xStyle;
807 
808  if( !bUsed || xStyle->isInUse() )
809  {
810  exportStyle( xStyle );
811  if( pPool )
812  pPool->RegisterName( xStyle->getName() );
813  }
814  }
815  }
816  }
817  }
818  }
819 }
820 
821 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr sal_uInt16 XML_NAMESPACE_LO_EXT
Definition: xmlnmspe.hxx:80
SvxXMLNumRuleExport(SvXMLExport &rExport)
Definition: xmlnume.cxx:612
constexpr sal_uInt16 XML_NAMESPACE_STYLE
Definition: xmlnmspe.hxx:30
SvXMLExport & GetExport()
Definition: xmlnume.hxx:55
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:713
SAL_DLLPRIVATE void exportStyle(const css::uno::Reference< css::style::XStyle > &rStyle)
Definition: xmlnume.cxx:681
const SvXMLUnitConverter & GetMM100UnitConverter() const
Definition: xmlexp.hxx:395
void CheckAttrList()
Definition: xmlexp.cxx:1047
FAMILY_DONTKNOW
static const OUStringLiteral gsIsContinuousNumbering("IsContinuousNumbering")
constexpr sal_uInt16 XML_NAMESPACE_TEXT
Definition: xmlnmspe.hxx:31
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:274
SvXMLAttributeList & GetAttrList()
Definition: xmlexp.hxx:381
sal_uInt16 sal_Unicode
OUString sSuffix
int nCount
void AddAttribute(sal_uInt16 nPrefix, const char *pName, const OUString &rValue)
Definition: xmlexp.cxx:926
OUString AddEmbeddedXGraphic(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic, OUString &rOutMimeType, OUString const &rRequestedName=OUString())
Definition: xmlexp.cxx:1863
const char * sName
XMLTokenEnum
The enumeration of all XML tokens.
Definition: xmltoken.hxx:47
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:2312
OUString sPrefix
PropertyHandler for the XML-data-type:
Definition: fonthdl.hxx:52
int i
static const OUStringLiteral gsIsPhysical("IsPhysical")
void RegisterName(const OUString &rName)
void exportStyles(bool bUsed, XMLTextListAutoStylePool *pPool, bool bExportChapterNumbering)
Definition: xmlnume.cxx:774
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
OUString sBulletFontName
FontPitch
bool mbExportPositionAndSpaceModeLabelAlignment
Definition: xmlnume.hxx:45
constexpr sal_uInt16 XML_NAMESPACE_XLINK
Definition: xmlnmspe.hxx:35
FontFamily
constexpr sal_uInt16 XML_NAMESPACE_FO
Definition: xmlnmspe.hxx:34
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:601
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:1900
PropertyHandler for the XML-data-type:
Definition: fonthdl.hxx:40
static const OUStringLiteral gsNumberingRules("NumberingRules")
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
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