21#include <com/sun/star/xml/AttributeData.hpp>
23#include <rtl/ustrbuf.hxx>
42: mpContainer(
std::move( pContainer ) )
45 mpContainer = std::make_unique<SvXMLAttrContainerData>();
61 const sal_uInt16 nAttrCount =
mpContainer->GetAttrCount();
64 if(
nPos == std::u16string_view::npos )
66 for( sal_uInt16 nAttr = 0; nAttr < nAttrCount; nAttr++ )
75 const std::u16string_view aPrefix(
aName.substr( 0L,
nPos ) );
76 const std::u16string_view aLName(
aName.substr(
nPos+1 ) );
78 for( sal_uInt16 nAttr = 0; nAttr < nAttrCount; nAttr++ )
94 if( nAttr == USHRT_MAX )
95 throw container::NoSuchElementException();
97 xml::AttributeData
aData;
107 const sal_uInt16 nAttrCount =
mpContainer->GetAttrCount();
109 uno::Sequence< OUString > aElementNames(
static_cast<sal_Int32
>(nAttrCount) );
110 OUString *pNames = aElementNames.getArray();
112 for( sal_uInt16 nAttr = 0; nAttr < nAttrCount; nAttr++ )
114 OUStringBuffer sBuffer(
mpContainer->GetAttrPrefix(nAttr) );
115 if( !sBuffer.isEmpty() )
116 sBuffer.append(
':' );
117 sBuffer.append(
mpContainer->GetAttrLName(nAttr) );
118 *pNames++ = sBuffer.makeStringAndClear();
121 return aElementNames;
132 if(
auto pData = o3tl::tryAccess<xml::AttributeData>(aElement) )
135 if( nAttr == USHRT_MAX )
136 throw container::NoSuchElementException();
141 const OUString aPrefix(
aName.copy( 0L,
nPos ));
142 const OUString aLName(
aName.copy(
nPos+1 ));
144 if(
pData->Namespace.isEmpty() )
157 if(
pData->Namespace.isEmpty() )
165 throw lang::IllegalArgumentException();
171 auto pData = o3tl::tryAccess<xml::AttributeData>(aElement);
173 throw lang::IllegalArgumentException();
176 if( nAttr != USHRT_MAX )
177 throw container::ElementExistException();
182 const OUString aPrefix(
aName.copy( 0L,
nPos ));
183 const OUString aLName(
aName.copy(
nPos+1 ));
185 if(
pData->Namespace.isEmpty() )
198 if(
pData->Namespace.isEmpty() )
209 if( nAttr == USHRT_MAX )
210 throw container::NoSuchElementException();
218 return "SvUnoAttributeContainer";
223 return {
"com.sun.star.xml.AttributeContainer" };
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
SAL_DLLPRIVATE sal_uInt16 getIndexByName(std::u16string_view aName) const
SvUnoAttributeContainer(std::unique_ptr< SvXMLAttrContainerData > pContainer=nullptr)
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Type SAL_CALL getElementType() override
virtual void SAL_CALL removeByName(const OUString &Name) override
virtual void SAL_CALL replaceByName(const OUString &aName, const css::uno::Any &aElement) override
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
std::unique_ptr< SvXMLAttrContainerData > mpContainer
virtual void SAL_CALL insertByName(const OUString &aName, const css::uno::Any &aElement) override
virtual sal_Bool SAL_CALL hasElements() override
css::uno::Type const & get()
std::unique_ptr< sal_Int32[]> pData
constexpr OUStringLiteral aData
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
uno::Reference< uno::XInterface > SvUnoAttributeContainer_CreateInstance()