34#include <com/sun/star/beans/XPropertySet.hpp>
35#include <com/sun/star/container/XNameContainer.hpp>
36#include <com/sun/star/document/XEventsSupplier.hpp>
37#include <com/sun/star/drawing/FillStyle.hpp>
38#include <com/sun/star/frame/XModel.hpp>
39#include <com/sun/star/lang/XMultiServiceFactory.hpp>
40#include <com/sun/star/style/ParagraphStyleCategory.hpp>
41#include <com/sun/star/style/XStyle.hpp>
68 {
XML_TEXT, ParagraphStyleCategory::TEXT },
70 {
XML_LIST, ParagraphStyleCategory::LIST },
71 {
XML_INDEX, ParagraphStyleCategory::INDEX },
72 {
XML_EXTRA, ParagraphStyleCategory::EXTRA },
73 {
XML_HTML, ParagraphStyleCategory::HTML },
78 const OUString& rValue )
111 0 <= nTmp && nTmp <= 10 )
136, m_nOutlineLevel( -1 )
137, m_isAutoUpdate( false )
138, m_bHasMasterPageName( false )
139, m_bHasCombinedCharactersLetter( false )
141, m_bListStyleSet( false )
150 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
155 sal_uInt32 nFamily = 0;
192 Reference < XStyle > xStyle =
GetStyle();
193 if( !xStyle.is() || !(bOverwrite ||
IsNew()) )
196 Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
197 Reference< XPropertySetInfo > xPropSetInfo =
198 xPropSet->getPropertySetInfo();
200 static constexpr OUStringLiteral sIsAutoUpdate(
u"IsAutoUpdate");
201 if( xPropSetInfo->hasPropertyByName( sIsAutoUpdate ) )
206 sal_uInt16 nCategory = ParagraphStyleCategory::TEXT;
209 xPropSetInfo->hasPropertyByName(
"Category") &&
212 xPropSet->setPropertyValue(
"Category",
Any(
static_cast<sal_Int16
>(nCategory)));
219 Reference<document::XEventsSupplier> xEventsSupplier(xStyle,UNO_QUERY);
238 Reference < XMultiServiceFactory >
xFactory (
GetImport().GetModel(), UNO_QUERY);
241 Reference < XInterface > xInt =
xFactory->createInstance(
"com.sun.star.text.Defaults" );
242 Reference < XPropertySet > xProperties ( xInt, UNO_QUERY );
243 if ( xProperties.is() )
253 Reference < XStyle > xStyle =
GetStyle();
260 !( bOverwrite ||
IsNew() ) )
263 Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
264 Reference< XPropertySetInfo > xPropSetInfo =
265 xPropSet->getPropertySetInfo();
267 static constexpr OUStringLiteral sOutlineLevel(
u"OutlineLevel");
268 if( xPropSetInfo->hasPropertyByName( sOutlineLevel ))
277 static constexpr OUStringLiteral sNumberingStyleName(
u"NumberingStyleName");
279 xPropSetInfo->hasPropertyByName( sNumberingStyleName ) )
286 bool bApplyListStyle(
true );
289 if (
GetImport().IsTextDocInOOoFileFormat() )
291 bApplyListStyle =
false;
296 sal_Int32 nBuild( 0 );
298 if (
GetImport().getBuildIds( nUPD, nBuild ) &&
299 ( ( nUPD == 641 ) || ( nUPD == 645 ) ||
300 ( nUPD == 680 && nBuild <= 9073 ) ) )
302 bApplyListStyle =
false;
307 if ( bApplyListStyle )
316 OUString sDisplayListStyleName(
320 const Reference < XNameContainer >& rNumStyles =
321 GetImport().GetTextImport()->GetNumberingStyles();
324 if ( rNumStyles.is() &&
325 rNumStyles->hasByName( sDisplayListStyleName ) )
327 xPropSet->setPropertyValue( sNumberingStyleName,
Any(sDisplayListStyleName) );
341 OUString sDisplayDropCapTextStyleName(
345 const Reference < XNameContainer >& rTextStyles =
346 GetImport().GetTextImport()->GetTextStyles();
347 if( rTextStyles.is() &&
348 rTextStyles->hasByName( sDisplayDropCapTextStyleName ) &&
349 xPropSetInfo->hasPropertyByName(
"DropCapCharStyleName"))
351 xPropSet->setPropertyValue(
"DropCapCharStyleName",
Any(sDisplayDropCapTextStyleName));
362 const Reference < XNameContainer >& rPageStyles =
363 GetImport().GetTextImport()->GetPageStyles();
365 static constexpr OUStringLiteral sPageDescName(
u"PageDescName");
369 xPropSetInfo->hasPropertyByName( sPageDescName ) )
376 const Reference<XPropertySet > & rPropSet )
384 DBG_ASSERT(xImpPrMap.is(),
"Where is the import prop mapper?");
412 { -1, -1, drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE }
425 Reference< XPropertySetInfo > xInfo;
427 bool bAutomatic =
false;
437 OUString(
"CharAutoStyleName" ):
438 OUString(
"ParaAutoStyleName" );
444 xInfo = rPropSet->getPropertySetInfo();
447 if ( xInfo->hasPropertyByName( sAutoProp ) )
449 rPropSet->setPropertyValue( sAutoProp,
GetAutoName() );
467 xImpPrMap->CheckSpecialContext(
GetProperties(), rPropSet, aContextIDs );
471 xImpPrMap->FillPropertySet(
GetProperties(), rPropSet, aContextIDs );
480 bool bVal = *o3tl::doAccess<bool>(rAny);
491 OUString sIsSplitAllowed(
"IsSplitAllowed");
492 SAL_WARN_IF( !rPropSet->getPropertySetInfo()->hasPropertyByName( sIsSplitAllowed ),
"xmloff",
"property missing?" );
493 rPropSet->setPropertyValue(
500 OUString sCollapsingBorders(
"CollapsingBorders");
501 SAL_WARN_IF( !rPropSet->getPropertySetInfo()->hasPropertyByName( sCollapsingBorders ),
"xmloff",
"property missing?" );
502 rPropSet->setPropertyValue(
504 (aContextIDs[2].
nIndex == -1)
520 switch(aContextIDs[
i].nContextID)
532 sStyleName =
GetImport().GetStyleDisplayName(aFamilies[
i - 7], sStyleName);
552 SAL_INFO(
"xmloff.style",
"XMLTextStyleContext: dropping fill named item: " << sStyleName);
559 if(!rPropMapper.is())
561 rPropMapper = xImpPrMap->getPropertySetMapper();
565 const OUString& rPropertyName = rPropMapper->GetEntryAPIName(rState.
mnIndex);
569 xInfo = rPropSet->getPropertySetInfo();
572 if(xInfo->hasPropertyByName(rPropertyName))
574 rPropSet->setPropertyValue(rPropertyName,
Any(sStyleName));
577 catch(css::lang::IllegalArgumentException& e)
579 Sequence<OUString>
aSeq { sStyleName };
588 sal_Int32 nMapperIndex = rState.
mnIndex;
595 if ( !sFontName.isEmpty() )
597 if ( sFontName.equalsIgnoreAsciiCase(
"StarBats" ) ||
598 sFontName.equalsIgnoreAsciiCase(
"StarMath" ) )
601 sFontName =
"StarSymbol";
605 if(!rPropMapper.is())
607 rPropMapper = xImpPrMap->getPropertySetMapper();
611 OUString rPropertyName(rPropMapper->GetEntryAPIName(nMapperIndex));
615 xInfo = rPropSet->getPropertySetInfo();
618 if(xInfo->hasPropertyByName(rPropertyName))
620 rPropSet->setPropertyValue(rPropertyName,aAny);
SvXMLImport & GetImport()
const css::uno::Any & GetAutoName() const
XmlStyleFamily GetFamily() const
bool IsDefaultStyle() const
const OUString & GetDisplayName() const
virtual rtl::Reference< SvXMLImportPropertyMapper > GetImportPropertyMapper(XmlStyleFamily nFamily) const
bool IsAutomaticStyle() const
static bool convertEnum(EnumT &rEnum, std::u16string_view rValue, const SvXMLEnumMapEntry< EnumT > *pMap)
convert string to enum using given enum map, if the enum is not found in the map, this method will re...
Import <script:events> element.
const css::uno::Reference< css::style::XStyle > & GetStyle() const
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
::std::vector< XMLPropertyState > & GetProperties()
virtual void CreateAndInsert(bool bOverwrite) override
SvXMLStylesContext * GetStyles()
virtual void SetAttribute(sal_Int32 nElement, const OUString &rValue) override
virtual void Finish(bool bOverwrite) override
bool m_bHasCombinedCharactersLetter
virtual void Finish(bool bOverwrite) override
virtual void SetAttribute(sal_Int32 nElement, const OUString &rValue) override
virtual void CreateAndInsert(bool bOverwrite) override
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet) override
std::optional< sal_Int16 > m_aListLevel
Reads <style:style style:list-level="...">.
rtl::Reference< XMLEventsImportContext > m_xEventContext
bool m_bHasMasterPageName
XMLTextStyleContext(SvXMLImport &rImport, SvXMLStylesContext &rStyles, XmlStyleFamily nFamily, bool bDefaultStyle=false)
OUString m_sMasterPageName
OUString m_sDropCapTextStyleName
virtual void SetDefaults() override
OUString m_sDataStyleName
~XMLTextStyleContext() override
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
OUString m_sListStyleName
static bool convertNumber(sal_Int32 &rValue, std::u16string_view aString, sal_Int32 nMin=SAL_MIN_INT32, sal_Int32 nMax=SAL_MAX_INT32)
#define DBG_ASSERT(sCon, aError)
#define DBG_UNHANDLED_EXCEPTION(...)
Reference< XSingleServiceFactory > xFactory
Sequence< sal_Int8 > aSeq
#define SAL_WARN_IF(condition, area, stream)
#define SAL_INFO(area, stream)
Handling of tokens in XML:
@ XML_DEFAULT_OUTLINE_LEVEL
@ XML_PARAGRAPH_PROPERTIES
@ XML_TABLE_ROW_PROPERTIES
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
bool IsIgnoreFillStyleNamedItem(css::uno::Reference< css::beans::XPropertySet > const &xProps, drawing::FillStyle const nExpectedFillStyle)
This struct is used as an optional parameter to the static _FillPropertySet() methods.
Smart struct to transport an Any with an index to the appropriate property-name.
#define CTF_FONTFAMILYNAME
#define CTF_COMBINED_CHARACTERS_FIELD
#define CTF_FONTFAMILYNAME_CJK
#define CTF_FONTFAMILYNAME_CTL
#define CTF_KEEP_TOGETHER
const SvXMLEnumMapEntry< sal_uInt16 > aCategoryMap[]
#define XMLERROR_STYLE_PROP_VALUE
#define XMLERROR_FLAG_WARNING
#define XML_ELEMENT(prefix, name)
constexpr bool IsTokenInNamespace(sal_Int32 nToken, sal_uInt16 nNamespacePrefix)
constexpr sal_Int32 TOKEN_MASK
constexpr sal_uInt16 XML_NAMESPACE_STYLE
#define CTF_FILLBITMAPNAME
#define CTF_FILLGRADIENTNAME
#define CTF_FILLTRANSNAME
#define CTF_FILLHATCHNAME
#define XML_TYPE_PROP_SECTION
#define XML_TYPE_PROP_PARAGRAPH
#define XML_TYPE_PROP_TEXT
#define XML_TYPE_PROP_TABLE
#define XML_TYPE_PROP_TABLE_ROW