LibreOffice Module xmloff (master) 1
MutableAttrList.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <xmloff/attrlist.hxx>
22#include "MutableAttrList.hxx"
23
24
25using namespace ::com::sun::star::uno;
26using namespace ::com::sun::star::lang;
27using namespace ::com::sun::star::util;
28
30{
32 {
35 }
36
37 return m_pMutableAttrList.get();
38}
39
41 m_pMutableAttrList( new SvXMLAttributeList )
42{
44}
45
47 XAttributeList> & rAttrList, bool bClone ) :
48 m_xAttrList( rAttrList.is() ? rAttrList : new SvXMLAttributeList )
49{
50 if( bClone )
52}
53
54
56{
57 m_xAttrList = nullptr;
58}
59
60const css::uno::Sequence<sal_Int8>& XMLMutableAttributeList::getUnoTunnelId() noexcept
61{
62 static const comphelper::UnoIdInit theXMLMutableAttributeListUnoTunnelId;
63 return theXMLMutableAttributeListUnoTunnelId.getSeq();
64}
65
66// XUnoTunnel
68 const Sequence< sal_Int8 >& rId )
69{
70 return comphelper::getSomethingImpl(rId, this);
71}
72
74{
75 return m_xAttrList->getLength();
76}
77
78
79OUString SAL_CALL XMLMutableAttributeList::getNameByIndex(sal_Int16 i)
80{
81 return m_xAttrList->getNameByIndex( i );
82}
83
84
85OUString SAL_CALL XMLMutableAttributeList::getTypeByIndex(sal_Int16 i)
86{
87 return m_xAttrList->getTypeByIndex( i );
88}
89
90OUString SAL_CALL XMLMutableAttributeList::getValueByIndex(sal_Int16 i)
91{
92 return m_xAttrList->getValueByIndex( i );
93}
94
96 const OUString& rName )
97{
98 return m_xAttrList->getTypeByName( rName );
99}
100
102 const OUString& rName)
103{
104 return m_xAttrList->getValueByName( rName );
105}
106
107
109{
110 // A cloned list will be a read only list!
111 Reference< XCloneable > r = new SvXMLAttributeList( m_xAttrList );
112 return r;
113}
114
116 const OUString& rValue )
117{
119}
120
121void XMLMutableAttributeList::AddAttribute( const OUString &rName ,
122 const OUString &rValue )
123{
124 GetMutableAttrList()->AddAttribute( rName, rValue );
125}
126
128{
130}
131
133 const OUString& rNewName )
134{
136}
137
139 const Reference< css::xml::sax::XAttributeList >& r )
140{
142}
143
144sal_Int16 XMLMutableAttributeList::GetIndexByName( const OUString& rName ) const
145{
146 sal_Int16 nIndex = -1;
148 {
149 nIndex = m_pMutableAttrList->GetIndexByName( rName );
150 }
151 else
152 {
153 sal_Int16 nCount = m_xAttrList->getLength();
154 for( sal_Int16 i=0; nIndex==-1 && i<nCount ; ++i )
155 {
156 if( m_xAttrList->getNameByIndex(i) == rName )
157 nIndex = i;
158 }
159 }
160 return nIndex;
161}
162
163/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void AddAttribute(const OUString &sName, const OUString &sValue)
Definition: attrlist.cxx:110
void RenameAttributeByIndex(sal_Int16 i, const OUString &rNewName)
Definition: attrlist.cxx:167
void SetValueByIndex(sal_Int16 i, const OUString &rValue)
Definition: attrlist.cxx:150
void RemoveAttributeByIndex(sal_Int16 i)
Definition: attrlist.cxx:160
void AppendAttributeList(const css::uno::Reference< css::xml::sax::XAttributeList > &)
Definition: attrlist.cxx:132
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
virtual OUString SAL_CALL getNameByIndex(sal_Int16 i) override
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
virtual ~XMLMutableAttributeList() override
virtual OUString SAL_CALL getValueByIndex(sal_Int16 i) override
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept
void AddAttribute(const OUString &sName, const OUString &sValue)
virtual OUString SAL_CALL getTypeByIndex(sal_Int16 i) override
virtual OUString SAL_CALL getValueByName(const OUString &aName) override
virtual OUString SAL_CALL getTypeByName(const OUString &aName) override
virtual sal_Int16 SAL_CALL getLength() override
SvXMLAttributeList * GetMutableAttrList()
sal_Int16 GetIndexByName(const OUString &rName) const
css::uno::Reference< css::xml::sax::XAttributeList > m_xAttrList
void RemoveAttributeByIndex(sal_Int16 i)
void AppendAttributeList(const css::uno::Reference< css::xml::sax::XAttributeList > &)
void RenameAttributeByIndex(sal_Int16 i, const OUString &rNewName)
rtl::Reference< SvXMLAttributeList > m_pMutableAttrList
void SetValueByIndex(sal_Int16 i, const OUString &rValue)
const css::uno::Sequence< sal_Int8 > & getSeq() const
int nCount
sal_Int32 nIndex
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
int i