20#include <com/sun/star/beans/PropertyValue.hpp>
21#include <com/sun/star/beans/XPropertySet.hpp>
22#include <com/sun/star/awt/Size.hpp>
23#include <com/sun/star/frame/XModel.hpp>
24#include <com/sun/star/graphic/XGraphic.hpp>
25#include <com/sun/star/awt/FontDescriptor.hpp>
26#include <com/sun/star/text/HoriOrientation.hpp>
27#include <com/sun/star/text/VertOrientation.hpp>
28#include <com/sun/star/text/PositionAndSpaceMode.hpp>
29#include <com/sun/star/text/LabelFollow.hpp>
30#include <com/sun/star/container/XNameContainer.hpp>
31#include <com/sun/star/lang/XMultiServiceFactory.hpp>
32#include <com/sun/star/style/XStyle.hpp>
33#include <com/sun/star/io/XOutputStream.hpp>
34#include <com/sun/star/awt/XBitmap.hpp>
35#include <com/sun/star/style/NumberingType.hpp>
36#include <com/sun/star/container/XIndexReplace.hpp>
40#include <rtl/ustrbuf.hxx>
92 const Reference< xml::sax::XFastAttributeList >& xAttrList,
97 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
override;
104 SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl(
106 const Reference< xml::sax::XFastAttributeList >& xAttrList,
187 const Reference< xml::sax::XFastAttributeList > & xAttrList );
191 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
override;
222 SvXMLImport& rImport, sal_Int32 nElement,
223 const Reference< xml::sax::XFastAttributeList > & xAttrList )
234, nNumDisplayLevels( 1 )
235, eAdjust( HoriOrientation::
LEFT )
238, eBulletFontEncoding( RTL_TEXTENCODING_DONTKNOW )
243, ePosAndSpaceMode( PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION )
244, eLabelFollowedBy( LabelFollow::LISTTAB )
245, nListtabStopPosition( 0 )
246, nFirstLineIndent( 0 )
269 switch( aIter.getToken() )
282 if (!aIter.isEmpty())
308 sListFormat = std::make_optional(aIter.toString());
320 sal_Int32 nTmp = aIter.toInt32();
322 (nTmp < 0) ? 1 : ( (nTmp>SHRT_MAX) ? SHRT_MAX
323 :
static_cast<sal_Int16
>(nTmp) );
329 sal_Int32 nTmp = aIter.toInt32();
331 (nTmp < 1) ? 1 : ( (nTmp>SHRT_MAX) ? SHRT_MAX
332 :
static_cast<sal_Int16
>(nTmp) );
343 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
370 return Sequence<beans::PropertyValue>();
373 sal_Int16
eType = NumberingType::NUMBER_NONE;
378 eType = NumberingType::CHAR_SPECIAL;
382 eType = NumberingType::BITMAP;
386 eType = NumberingType::ARABIC;
387 GetImport().GetMM100UnitConverter().convertNumFormat(
396 if (
GetImport().getBuildIds(nUPD, nBuildId)
397 && ( (SvXMLImport::OOo_1x ==
nVersion)
398 || (SvXMLImport::OOo_2x ==
nVersion)
399 || (310 == nUPD) || (320 == nUPD) || (330 == nUPD)
400 || ((300 == nUPD) && (nBuildId <= 9573))))
456 awt::FontDescriptor aFDesc;
465 bool bStarSymbol =
false;
466 if( aFDesc.Name.equalsIgnoreAsciiCase(
gsStarBats ) )
471 else if( aFDesc.Name.equalsIgnoreAsciiCase(
gsStarMath ) )
477 aFDesc.Name =
"StarSymbol" ;
488 uno::Reference<graphic::XGraphic> xGraphic;
498 uno::Reference<awt::XBitmap> xBitmap;
500 xBitmap.set(xGraphic, uno::UNO_QUERY);
536SvxXMLListLevelStyleAttrContext_Impl::SvxXMLListLevelStyleAttrContext_Impl(
537 SvXMLImport& rImport, sal_Int32 ,
538 const Reference< xml::sax::XFastAttributeList > & xAttrList,
541 rListLevel( rLLevel )
545 OUString sFontName, sFontFamily, sFontStyleName, sFontFamilyGeneric,
546 sFontPitch, sFontCharset;
547 OUString sVerticalPos, sVerticalRel;
552 switch( aIter.getToken() )
555 if (rUnitConv.convertMeasureToCore(nVal, aIter.toView(), SHRT_MIN, SHRT_MAX))
559 if (rUnitConv.convertMeasureToCore( nVal, aIter.toView(), 0, SHRT_MAX ))
563 if (rUnitConv.convertMeasureToCore( nVal, aIter.toView(), 0, USHRT_MAX ))
568 if( !aIter.isEmpty() )
570 sal_Int16
eAdjust = HoriOrientation::LEFT;
572 eAdjust = HoriOrientation::CENTER;
574 eAdjust = HoriOrientation::RIGHT;
575 rListLevel.SetAdjust(
eAdjust );
586 sFontFamilyGeneric = aIter.
toString();
605 if (rUnitConv.convertMeasureToCore(nVal, aIter.toView()))
610 if (rUnitConv.convertMeasureToCore(nVal, aIter.toView()))
618 rListLevel.SetColor( nColor );
624 rListLevel.SetColor(COL_AUTO);
629 if (::
sax::Converter::convertPercent( nVal, aIter.toView() ))
630 rListLevel.
SetRelSize( static_cast<sal_Int16>(nVal) );
634 sal_Int16
ePosAndSpaceMode = PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION;
645 if( !sFontName.isEmpty() )
651 ::std::vector < XMLPropertyState > aProps;
652 if( pFontDecls->
FillProperties( sFontName, aProps, 0, 1, 2, 3, 4 ) )
656 for(
const auto& rProp : aProps )
658 switch( rProp.mnIndex )
661 rProp.maValue >>= sTmp;
662 rListLevel.SetBulletFontName( sTmp);
665 rProp.maValue >>= sTmp;
666 rListLevel.SetBulletFontStyleName( sTmp );
669 rProp.maValue >>= nTmp;
670 rListLevel.SetBulletFontFamily( nTmp );
673 rProp.maValue >>= nTmp;
674 rListLevel.SetBulletFontPitch( nTmp );
677 rProp.maValue >>= nTmp;
678 rListLevel.SetBulletFontEncoding( nTmp );
685 if( !sFontFamily.isEmpty() )
690 if( aFamilyNameHdl.
importXML( sFontFamily, aAny, rUnitConv ) )
694 rListLevel.SetBulletFontName( sTmp);
698 if( !sFontFamilyGeneric.isEmpty() &&
699 aFamilyHdl.
importXML( sFontFamilyGeneric, aAny, rUnitConv ) )
703 rListLevel.SetBulletFontFamily( nTmp );
706 if( !sFontStyleName.isEmpty() )
707 rListLevel.SetBulletFontStyleName( sFontStyleName );
710 if( !sFontPitch.isEmpty() &&
711 aPitchHdl.
importXML( sFontPitch, aAny, rUnitConv ) )
715 rListLevel.SetBulletFontPitch( nTmp );
719 if( !sFontCharset.isEmpty() &&
720 aEncHdl.
importXML( sFontCharset, aAny, rUnitConv ) )
724 rListLevel.SetBulletFontEncoding( nTmp );
728 sal_Int16 eVertOrient = VertOrientation::LINE_CENTER;
729 if( !sVerticalPos.isEmpty() )
732 eVertOrient = VertOrientation::LINE_TOP;
734 eVertOrient = VertOrientation::LINE_BOTTOM;
736 if( !sVerticalRel.isEmpty() )
741 switch( eVertOrient )
743 case VertOrientation::LINE_TOP:
744 eVertOrient = VertOrientation::BOTTOM;
746 case VertOrientation::LINE_CENTER:
747 eVertOrient = VertOrientation::CENTER;
749 case VertOrientation::LINE_BOTTOM:
750 eVertOrient = VertOrientation::TOP;
756 switch( eVertOrient )
758 case VertOrientation::LINE_TOP:
759 eVertOrient = VertOrientation::CHAR_TOP;
761 case VertOrientation::LINE_CENTER:
762 eVertOrient = VertOrientation::CHAR_CENTER;
764 case VertOrientation::LINE_BOTTOM:
765 eVertOrient = VertOrientation::CHAR_BOTTOM;
770 rListLevel.SetImageVertOrient( eVertOrient );
773css::uno::Reference< css::xml::sax::XFastContextHandler > SvxXMLListLevelStyleAttrContext_Impl::createFastChildContext(
775 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
779 return new SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl( GetImport(),
789SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl::SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl(
790 SvXMLImport& rImport, sal_Int32 ,
791 const Reference< xml::sax::XFastAttributeList > & xAttrList,
801 switch( aIter.getToken() )
818 if (rUnitConv.convertMeasureToCore(nVal, aIter.toView(), 0, SHRT_MAX))
823 if (rUnitConv.convertMeasureToCore(nVal, aIter.toView(), SHRT_MIN, SHRT_MAX))
828 if (rUnitConv.convertMeasureToCore(nVal, aIter.toView(), SHRT_MIN, SHRT_MAX))
839 const OUString& rValue )
858, m_bConsecutive( false )
867 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
888 const Reference<container::XIndexReplace> & rNumRule)
const
894 sal_Int32 l_nLevels = rNumRule->getCount();
897 sal_Int32 nLevel = pLevelStyle->GetLevel();
898 if( nLevel >= 0 && nLevel < l_nLevels )
900 Sequence<beans::PropertyValue> aProps =
901 pLevelStyle->GetProperties();
902 rNumRule->replaceByIndex( nLevel,
Any(aProps) );
907 Reference < XPropertySet > xPropSet( rNumRule, UNO_QUERY );
908 Reference< XPropertySetInfo > xPropSetInfo;
910 xPropSetInfo = xPropSet->getPropertySetInfo();
911 if( xPropSetInfo.is() &&
929 const Reference< XIndexReplace >& rNumRule =
930 GetImport().GetTextImport()->GetChapterNumbering();
939 Reference < XStyle > xStyle;
941 if( rName.isEmpty() )
947 const Reference < XNameContainer >& rNumStyles =
948 GetImport().GetTextImport()->GetNumberingStyles();
949 if( !rNumStyles.is() )
956 if( rNumStyles->hasByName( rName ) )
958 Any aAny = rNumStyles->getByName( rName );
969 Reference < XInterface > xIfc =
xFactory->createInstance(
"com.sun.star.style.NumberingStyle");
972 Reference < XStyle > xTmp( xIfc, UNO_QUERY );
977 rNumStyles->insertByName( rName,
Any(xStyle) );
981 Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
982 Reference< XPropertySetInfo > xPropSetInfo =
983 xPropSet->getPropertySetInfo();
984 if( !bNew && xPropSetInfo->hasPropertyByName(
sIsPhysical ) )
987 bNew = !*o3tl::doAccess<bool>(aAny);
990 if ( xPropSetInfo->hasPropertyByName(
"Hidden" ) )
999 if( bOverwrite || bNew )
1018 const OUString& rName =
GetName();
1032 const Reference < XModel > & rModel )
1034 Reference<XIndexReplace> xNumRule;
1036 Reference< XMultiServiceFactory >
xFactory( rModel, UNO_QUERY );
1041 Reference < XInterface > xIfc =
xFactory->createInstance(
"com.sun.star.text.NumberingRules");
1045 xNumRule.set( xIfc, UNO_QUERY );
1046 SAL_WARN_IF( !xNumRule.is(),
"xmloff",
"go no numbering rule" );
1052 const Reference < XIndexReplace > & rNumRule,
1056 Sequence<beans::PropertyValue> aPropSeq( bOrdered ? 1 : 4 );
1057 beans::PropertyValue *pProps = aPropSeq.getArray();
1059 pProps->Name =
"NumberingType";
1060 (pProps++)->
Value <<=
static_cast<sal_Int16
>(bOrdered ? NumberingType::ARABIC
1061 : NumberingType::CHAR_SPECIAL );
1065 awt::FontDescriptor aFDesc;
1075 aFDesc.CharSet = RTL_TEXTENCODING_SYMBOL ;
1077 pProps->Name =
"BulletFont";
1078 (pProps++)->
Value <<= aFDesc;
1080 pProps->Name =
"BulletChar";
1082 pProps->Name =
"CharStyleName";
1083 (pProps++)->
Value <<= OUString(
"Numbering Symbols" );
1086 rNumRule->replaceByIndex( nLevel,
Any(aPropSeq) );
PropertiesInfo aProperties
This class deliberately does not support XWeak, to improve performance when loading large documents.
SvXMLImport & GetImport()
virtual void SetAttribute(sal_Int32 nElement, const OUString &rValue)
const OUString & GetName() const
const OUString & GetDisplayName() const
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
void SetRelSize(sal_Int16 nRel)
void SetListtabStopPosition(sal_Int32 nValue)
void SetMinLabelDist(sal_Int32 nSet)
sal_Int32 nListtabStopPosition
void SetBulletFontPitch(sal_Int16 eSet)
void SetIndentAt(sal_Int32 nValue)
std::optional< OUString > sListFormat
sal_Int16 nNumDisplayLevels
Sequence< beans::PropertyValue > GetProperties()
SvxXMLListLevelStyleContext_Impl(SvXMLImport &rImport, sal_Int32 nElement, const Reference< xml::sax::XFastAttributeList > &xAttrList)
sal_Int32 GetLevel() const
sal_Int32 nFirstLineIndent
sal_Int16 eLabelFollowedBy
void SetBulletFontFamily(sal_Int16 eSet)
void SetImageVertOrient(sal_Int16 eSet)
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
sal_Int16 ePosAndSpaceMode
void SetImageHeight(sal_Int32 nSet)
sal_Int16 eBulletFontPitch
void SetSpaceBefore(sal_Int32 nSet)
sal_Int16 eImageVertOrient
rtl_TextEncoding eBulletFontEncoding
void SetLabelFollowedBy(sal_Int16 eValue)
friend SvxXMLListLevelStyleAttrContext_Impl
void SetFirstLineIndent(sal_Int32 nValue)
sal_Int16 eBulletFontFamily
void SetBulletFontEncoding(rtl_TextEncoding eSet)
void SetBulletFontName(const OUString &rSet)
OUString sBulletFontStyleName
void SetMinLabelWidth(sal_Int32 nSet)
void SetBulletFontStyleName(const OUString &rSet)
void SetPosAndSpaceMode(sal_Int16 eValue)
Reference< XOutputStream > xBase64Stream
void SetAdjust(sal_Int16 eSet)
void SetColor(Color nColor)
void SetImageWidth(sal_Int32 nSet)
void FillUnoNumRule(const css::uno::Reference< css::container::XIndexReplace > &rNumRule) const
static css::uno::Reference< css::container::XIndexReplace > CreateNumRule(const css::uno::Reference< css::frame::XModel > &rModel)
virtual SAL_DLLPRIVATE void SetAttribute(sal_Int32 nElement, const OUString &rValue) override
SvxXMLListStyleContext(SvXMLImport &rImport, bool bOutl=false)
std::unique_ptr< SvxXMLListStyle_Impl > m_pLevelStyles
static void SetDefaultStyle(const css::uno::Reference< css::container::XIndexReplace > &rNumRule, sal_Int16 nLevel, bool bOrdered)
void CreateAndInsertAuto() const
css::uno::Reference< css::container::XIndexReplace > m_xNumRules
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
virtual void CreateAndInsertLate(bool bOverwrite) override
~SvxXMLListStyleContext() override
PropertyHandler for the XML-data-type:
virtual bool importXML(const OUString &rStrImpValue, css::uno::Any &rValue, const SvXMLUnitConverter &rUnitConverter) const override
Imports the given value according to the XML-data-type corresponding to the derived class.
PropertyHandler for the XML-data-type:
virtual bool importXML(const OUString &rStrImpValue, css::uno::Any &rValue, const SvXMLUnitConverter &rUnitConverter) const override
Imports the given value according to the XML-data-type corresponding to the derived class.
PropertyHandler for the XML-data-type:
virtual bool importXML(const OUString &rStrImpValue, css::uno::Any &rValue, const SvXMLUnitConverter &rUnitConverter) const override
Imports the given value according to the XML-data-type corresponding to the derived class.
PropertyHandler for the XML-data-type:
virtual bool importXML(const OUString &rStrImpValue, css::uno::Any &rValue, const SvXMLUnitConverter &rUnitConverter) const override
Imports the given value according to the XML-data-type corresponding to the derived class.
bool FillProperties(const OUString &rName, ::std::vector< XMLPropertyState > &rProps, sal_Int32 nFamilyNameIdx, sal_Int32 nStyleNameIdx, sal_Int32 nFamilyIdx, sal_Int32 nPitchIdx, sal_Int32 nCharsetIdx) const
static bool convertColor(sal_Int32 &rColor, std::u16string_view rValue)
#define TOOLS_WARN_EXCEPTION(area, stream)
Reference< XSingleServiceFactory > xFactory
sal_Int32 nFirstLineOffset
#define SAL_WARN_IF(condition, area, stream)
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
tools::Long const nLeftMargin
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
constexpr T & temporary(T &&x)
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
OUString toString(OptionInfo const *info)
Handling of tokens in XML:
@ XML_LIST_LEVEL_STYLE_IMAGE
@ XML_LIST_LEVEL_PROPERTIES
@ XML_LIST_LEVEL_STYLE_NUMBER
@ XML_LIST_TAB_STOP_POSITION
@ XML_CONSECUTIVE_NUMBERING
@ XML_FONT_FAMILY_GENERIC
@ XML_LIST_LEVEL_POSITION_AND_SPACE_MODE
@ XML_LIST_LEVEL_STYLE_BULLET
@ XML_USE_WINDOW_FONT_COLOR
@ XML_OUTLINE_LEVEL_STYLE
@ XML_LIST_LEVEL_LABEL_ALIGNMENT
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
#define XMLOFF_WARN_UNKNOWN_ELEMENT(area, token)
#define XMLOFF_WARN_UNKNOWN(area, rIter)
#define XML_ELEMENT(prefix, name)
constexpr sal_Int32 TOKEN_MASK
constexpr OUStringLiteral gsStarBats(u"StarBats")
constexpr OUStringLiteral sIsContinuousNumbering(u"IsContinuousNumbering")
constexpr OUStringLiteral sNumberingRules(u"NumberingRules")
constexpr OUStringLiteral sIsPhysical(u"IsPhysical")
constexpr OUStringLiteral gsStarMath(u"StarMath")