| 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 |
#pragma once |
| 21 |
|
| 22 |
#include <com/sun/star/util/XCloneable.hpp> |
| 23 |
#include <com/sun/star/xml/sax/XAttributeList.hpp> |
| 24 |
|
| 25 |
#include <cppuhelper/implbase.hxx> |
| 26 |
#include <rtl/ref.hxx> |
| 27 |
|
| 28 |
namespace comphelper { class AttributeList; } |
| 29 |
|
| 30 |
class XMLMutableAttributeList : public ::cppu::WeakImplHelper< |
| 31 |
css::xml::sax::XAttributeList, |
| 32 |
css::util::XCloneable> |
| 33 |
{ |
| 34 |
css::uno::Reference< css::xml::sax::XAttributeList> m_xAttrList; |
| 35 |
|
| 36 |
rtl::Reference<comphelper::AttributeList> m_pMutableAttrList; |
| 37 |
|
| 38 |
comphelper::AttributeList *GetMutableAttrList(); |
| 39 |
|
| 40 |
public: |
| 41 |
XMLMutableAttributeList(); |
| 42 |
XMLMutableAttributeList( const css::uno::Reference< |
| 43 |
css::xml::sax::XAttributeList> & rAttrList, |
| 44 |
bool bClone=false ); |
| 45 |
virtual ~XMLMutableAttributeList() override; |
| 46 |
|
| 47 |
// css::xml::sax::XAttributeList |
| 48 |
virtual sal_Int16 SAL_CALL getLength() override; |
| 49 |
virtual OUString SAL_CALL getNameByIndex(sal_Int16 i) override; |
| 50 |
virtual OUString SAL_CALL getTypeByIndex(sal_Int16 i) override; |
| 51 |
virtual OUString SAL_CALL getTypeByName(const OUString& aName) override; |
| 52 |
virtual OUString SAL_CALL getValueByIndex(sal_Int16 i) override; |
| 53 |
virtual OUString SAL_CALL getValueByName(const OUString& aName) override; |
| 54 |
|
| 55 |
// css::util::XCloneable |
| 56 |
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override; |
| 57 |
|
| 58 |
// methods that are not contained in any interface |
| 59 |
void SetValueByIndex( sal_Int16 i, const OUString& rValue ); |
| 60 |
void AddAttribute( const OUString &sName , const OUString &sValue ); |
| 61 |
// void Clear(); |
| 62 |
void RemoveAttributeByIndex( sal_Int16 i ); |
| 63 |
void RenameAttributeByIndex( sal_Int16 i, const OUString& rNewName ); |
| 64 |
void AppendAttributeList( const css::uno::Reference< css::xml::sax::XAttributeList > & ); |
| 65 |
|
| 66 |
sal_Int16 GetIndexByName( const OUString& rName ) const; |
| 67 |
}; |
| 68 |
|
| 69 |
|
| 70 |
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |