20#include <config_wasm_strip.h>
24#include <com/sun/star/frame/XModel.hpp>
25#include <com/sun/star/xml/sax/XAttributeList.hpp>
26#include <com/sun/star/container/XNameContainer.hpp>
27#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
28#include <com/sun/star/style/XAutoStylesSupplier.hpp>
29#include <com/sun/star/style/XAutoStyleFamily.hpp>
30#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
74 const OUString& rValue )
119 mbDefaultStyle( bDefault )
129 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
158class SvXMLStyleIndex_Impl
175 sName( rStl->GetName() ),
176 nFamily( rStl->GetFamily() ),
177 mpStyle ( rStl.get() )
186struct SvXMLStyleIndexCmp_Impl
188 bool operator()(
const SvXMLStyleIndex_Impl& r1,
const SvXMLStyleIndex_Impl& r2)
const
192 if( r1.GetFamily() < r2.GetFamily() )
194 else if( r1.GetFamily() > r2.GetFamily() )
197 nRet = r1.GetName().compareTo( r2.GetName() );
207 typedef std::set<SvXMLStyleIndex_Impl, SvXMLStyleIndexCmp_Impl>
IndicesType;
209 std::vector<rtl::Reference<SvXMLStyleContext>>
aStyles;
213#if OSL_DEBUG_LEVEL > 0
233 const OUString& rName,
234 bool bCreateIndex )
const;
239 bAutomaticStyle( bAuto )
240#
if OSL_DEBUG_LEVEL > 0
241 , m_nIndexCreated( 0 )
247#if OSL_DEBUG_LEVEL > 0
264 const OUString& rName,
265 bool bCreateIndex )
const
273#if OSL_DEBUG_LEVEL > 0
275 "Performance warning: sdbcx::Index created multiple times");
282 SvXMLStyleIndex_Impl
aIndex( nFamily, rName );
285 pStyle = aFind->GetStyle();
289 for(
size_t i = 0; !pStyle &&
i <
aStyles.size();
i++ )
292 if(
pS->GetFamily() == nFamily &&
293 pS->GetName() == rName )
303 return mpImpl->GetStyleCount();
318 return mpImpl->IsAutomaticStyle();
323 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
414 SAL_WARN(
"xmloff",
"Unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement));
421 const uno::Reference< xml::sax::XFastAttributeList > & )
436#if !ENABLE_WASM_STRIP_CHART
455 const uno::Reference< xml::sax::XFastAttributeList > & )
535 ->GetParaImportPropertySetMapper();
545 ->GetTextImportPropertySetMapper();
555 GetSectionImportPropertySetMapper();
563 GetRubyImportPropertySetMapper();
573 aImpHelper->GetPropertySetMapper();
577#if !ENABLE_WASM_STRIP_CHART
607 Reference < XAutoStyleFamily > xAutoStyles;
615 Reference< XAutoStylesSupplier > xAutoStylesSupp(
GetImport().GetModel(), UNO_QUERY );
616 Reference< XAutoStyles > xAutoStyleFamilies = xAutoStylesSupp->getAutoStyles();
617 if (xAutoStyleFamilies->hasByName(
sName))
619 Any aAny = xAutoStyleFamilies->getByName(
sName );
620 aAny >>=
const_cast<Reference<XAutoStyleFamily>&
>(rxAutoStyles);
623 xAutoStyles = rxAutoStyles;
631 Reference < XNameContainer > xStyles;
639 Reference<XStyleFamiliesSupplier> xFamiliesSupp(
GetImport().GetModel(), UNO_QUERY);
640 if (xFamiliesSupp.is())
642 Reference<XNameAccess> xFamilies = xFamiliesSupp->getStyleFamilies();
643 if (xFamilies->hasByName(
sName))
645 Any aAny = xFamilies->getByName(
sName);
646 aAny >>=
const_cast<Reference<XNameContainer>&
>(rxStyles);
684 sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
695 uno::Reference<drawing::XDrawPageSupplier>
const xDrawPageSupplier(
GetImport().GetModel(), uno::UNO_QUERY);
696 if (xDrawPageSupplier.is())
698 uno::Reference<drawing::XDrawPage> xPage = xDrawPageSupplier->getDrawPage();
709 mpImpl->AddStyle( &rNew );
779 pStyle->
Finish( bOverwrite );
785 const OUString& rName,
786 bool bCreateIndex )
const
788 return mpImpl->FindStyleChildContext( nFamily, rName, bCreateIndex );
constexpr OUStringLiteral sServiceName
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)
virtual void Finish(bool bOverwrite)
virtual void CreateAndInsert(bool bOverwrite)
virtual void CreateAndInsertLate(bool bOverwrite)
XmlStyleFamily GetFamily() const
virtual bool IsTransient() const
if this method returns true, its parent styles context should not add it to its container.
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &) override
bool IsDefaultStyle() const
virtual void SetDefaults()
SvXMLStyleContext(SvXMLImport &rImport, XmlStyleFamily nFamily=XmlStyleFamily::DATA_STYLE, bool bDefaultStyle=false)
virtual ~SvXMLStyleContext() override
std::vector< rtl::Reference< SvXMLStyleContext > > aStyles
SvXMLStylesContext_Impl(bool bAuto)
bool IsAutomaticStyle() const
const SvXMLStyleContext * FindStyleChildContext(XmlStyleFamily nFamily, const OUString &rName, bool bCreateIndex) const
SvXMLStyleContext * GetStyle(size_t i)
sal_uInt32 m_nIndexCreated
std::set< SvXMLStyleIndex_Impl, SvXMLStyleIndexCmp_Impl > IndicesType
void AddStyle(SvXMLStyleContext *pStyle)
std::unique_ptr< IndicesType > pIndices
size_t GetStyleCount() const
static XmlStyleFamily GetFamily(std::u16string_view rFamily)
sal_uInt32 GetStyleCount() const
const SvXMLStyleContext * FindStyleChildContext(XmlStyleFamily nFamily, const OUString &rName, bool bCreateIndex=false) const
virtual css::uno::Reference< css::container::XNameContainer > GetStylesContainer(XmlStyleFamily nFamily) const
virtual SvXMLStyleContext * CreateDefaultStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
std::unique_ptr< SvXMLStylesContext_Impl > mpImpl
virtual ~SvXMLStylesContext() override
virtual bool InsertStyleFamily(XmlStyleFamily nFamily) const
SvXMLStyleContext * GetStyle(sal_uInt32 i)
void CopyStylesToDoc(bool bOverwrite, bool bFinish=true)
css::uno::Reference< css::container::XNameContainer > mxTextStyles
virtual rtl::Reference< SvXMLImportPropertyMapper > GetImportPropertyMapper(XmlStyleFamily nFamily) const
virtual SvXMLStyleContext * CreateStyleChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
virtual SvXMLStyleContext * CreateStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
rtl::Reference< SvXMLImportPropertyMapper > mxPageImpPropMapper
rtl::Reference< SvXMLImportPropertyMapper > mxParaImpPropMapper
rtl::Reference< SvXMLImportPropertyMapper > mxChartImpPropMapper
void FinishStyles(bool bOverwrite)
bool IsAutomaticStyle() const
css::uno::Reference< css::style::XAutoStyleFamily > mxParaAutoStyles
virtual OUString GetServiceName(XmlStyleFamily nFamily) const
rtl::Reference< SvXMLImportPropertyMapper > mxShapeImpPropMapper
SvXMLStylesContext(SvXMLStylesContext const &)=delete
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
void CopyAutoStylesToDoc()
css::uno::Reference< css::container::XNameContainer > mxParaStyles
css::uno::Reference< css::style::XAutoStyleFamily > GetAutoStyles(XmlStyleFamily nFamily) const
void AddStyle(SvXMLStyleContext &rNew)
css::uno::Reference< css::style::XAutoStyleFamily > mxTextAutoStyles
rtl::Reference< SvXMLImportPropertyMapper > mxTextImpPropMapper
Import bibliography configuration.
import <text:linenumbering-configuration> elements
virtual OUString GetName() const override
std::deque< AttacherIndex_Impl > aIndex
#define XML_STYLE_FAMILY_SD_POOL_NAME
constexpr OUStringLiteral XML_STYLE_FAMILY_SD_GRAPHICS_NAME
constexpr OUStringLiteral XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME
constexpr OUStringLiteral XML_STYLE_FAMILY_SCH_CHART_NAME
constexpr OUStringLiteral XML_STYLE_FAMILY_SD_PRESENTATION_NAME
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Handling of tokens in XML:
@ XML_BIBLIOGRAPHY_CONFIGURATION
@ XML_DEFAULT_PAGE_LAYOUT
@ XML_LINENUMBERING_CONFIGURATION
@ XML_NOTES_CONFIGURATION
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
#define XML_ELEMENT(prefix, name)
constexpr OUStringLiteral gsParagraphStyles(u"ParagraphStyles")
constexpr OUStringLiteral gsParaStyleServiceName(u"com.sun.star.style.ParagraphStyle")
constexpr OUStringLiteral gsCharacterStyles(u"CharacterStyles")
constexpr OUStringLiteral gsTextStyleServiceName(u"com.sun.star.style.CharacterStyle")