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>
72 const OUString& rValue )
117 mbDefaultStyle( bDefault )
127 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
156class SvXMLStyleIndex_Impl
174 nFamily( rStl->GetFamily() ),
175 mpStyle ( rStl.
get() )
184struct SvXMLStyleIndexCmp_Impl
186 bool operator()(
const SvXMLStyleIndex_Impl& r1,
const SvXMLStyleIndex_Impl& r2)
const
190 if( r1.GetFamily() < r2.GetFamily() )
192 else if( r1.GetFamily() > r2.GetFamily() )
195 nRet = r1.GetName().compareTo( r2.GetName() );
205 typedef std::set<SvXMLStyleIndex_Impl, SvXMLStyleIndexCmp_Impl>
IndicesType;
207 std::vector<rtl::Reference<SvXMLStyleContext>>
aStyles;
211#if OSL_DEBUG_LEVEL > 0
231 const OUString& rName,
232 bool bCreateIndex )
const;
237 bAutomaticStyle( bAuto )
238#
if OSL_DEBUG_LEVEL > 0
239 , m_nIndexCreated( 0 )
245#if OSL_DEBUG_LEVEL > 0
262 const OUString& rName,
263 bool bCreateIndex )
const
271#if OSL_DEBUG_LEVEL > 0
273 "Performance warning: sdbcx::Index created multiple times");
280 SvXMLStyleIndex_Impl
aIndex( nFamily, rName );
283 pStyle = aFind->GetStyle();
287 for(
size_t i = 0; !pStyle &&
i <
aStyles.size();
i++ )
290 if(
pS->GetFamily() == nFamily &&
291 pS->GetName() == rName )
301 return mpImpl->GetStyleCount();
316 return mpImpl->IsAutomaticStyle();
321 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
412 SAL_WARN(
"xmloff",
"Unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement));
419 const uno::Reference< xml::sax::XFastAttributeList > & )
434#if !ENABLE_WASM_STRIP_CHART
453 const uno::Reference< xml::sax::XFastAttributeList > & )
533 ->GetParaImportPropertySetMapper();
543 ->GetTextImportPropertySetMapper();
553 GetSectionImportPropertySetMapper();
561 GetRubyImportPropertySetMapper();
571 aImpHelper->GetPropertySetMapper();
575#if !ENABLE_WASM_STRIP_CHART
605 Reference < XAutoStyleFamily > xAutoStyles;
615 OUString
sName(bPara ? std::u16string_view(
u"ParagraphStyles" ): std::u16string_view(
u"CharacterStyles" ));
616 Reference< XAutoStylesSupplier > xAutoStylesSupp(
GetImport().GetModel(), UNO_QUERY );
617 Reference< XAutoStyles > xAutoStyleFamilies = xAutoStylesSupp->getAutoStyles();
618 if (xAutoStyleFamilies->hasByName(
sName))
620 Any aAny = xAutoStyleFamilies->getByName(
sName );
621 aAny >>= xAutoStyles;
635 Reference < XNameContainer > xStyles;
643 sName =
"ParagraphStyles";
650 sName =
"CharacterStyles";
654 if( !xStyles.is() && !
sName.isEmpty() )
656 Reference< XStyleFamiliesSupplier > xFamiliesSupp(
658 if ( xFamiliesSupp.is() )
660 Reference< XNameAccess > xFamilies = xFamiliesSupp->getStyleFamilies();
661 if (xFamilies->hasByName(
sName))
663 xStyles.set(xFamilies->getByName(
sName ),uno::UNO_QUERY);
711 sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
722 uno::Reference<drawing::XDrawPageSupplier>
const xDrawPageSupplier(
GetImport().GetModel(), uno::UNO_QUERY);
723 if (xDrawPageSupplier.is())
725 uno::Reference<drawing::XDrawPage> xPage = xDrawPageSupplier->getDrawPage();
736 mpImpl->AddStyle( &rNew );
806 pStyle->
Finish( bOverwrite );
812 const OUString& rName,
813 bool bCreateIndex )
const
815 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)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
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 gsParaStyleServiceName(u"com.sun.star.style.ParagraphStyle")
constexpr OUStringLiteral gsTextStyleServiceName(u"com.sun.star.style.CharacterStyle")