2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-29 14:02:24 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2006-10-13 10:41:10 +00:00
|
|
|
|
|
|
|
#include <comphelper/attributelist.hxx>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
using namespace osl;
|
|
|
|
using namespace com::sun::star;
|
|
|
|
|
2011-02-26 22:46:43 +01:00
|
|
|
|
2006-10-13 10:41:10 +00:00
|
|
|
namespace comphelper {
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
OUString SAL_CALL AttributeList::getTypeByName( const OUString& sName )
|
2006-10-13 10:41:10 +00:00
|
|
|
{
|
2019-04-27 09:44:15 +02:00
|
|
|
for (auto const& attribute : mAttributes)
|
2018-02-26 21:45:06 +01:00
|
|
|
{
|
|
|
|
if( attribute.sName == sName ) {
|
|
|
|
return attribute.sType;
|
2006-10-13 10:41:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return OUString();
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
OUString SAL_CALL AttributeList::getValueByName(const OUString& sName)
|
2006-10-13 10:41:10 +00:00
|
|
|
{
|
2019-04-27 09:44:15 +02:00
|
|
|
for (auto const& attribute : mAttributes)
|
2018-02-26 21:45:06 +01:00
|
|
|
{
|
|
|
|
if( attribute.sName == sName ) {
|
|
|
|
return attribute.sValue;
|
2006-10-13 10:41:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return OUString();
|
|
|
|
}
|
|
|
|
|
|
|
|
AttributeList::AttributeList()
|
2016-03-11 09:45:39 +00:00
|
|
|
{
|
2019-04-27 09:44:15 +02:00
|
|
|
// performance improvement during adding
|
|
|
|
mAttributes.reserve(20);
|
2016-03-11 09:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AttributeList::AttributeList(const AttributeList &r)
|
2018-09-10 09:29:12 +02:00
|
|
|
: cppu::WeakImplHelper<XAttributeList, XCloneable>(r)
|
2006-10-13 10:41:10 +00:00
|
|
|
{
|
2019-04-27 09:44:15 +02:00
|
|
|
mAttributes = r.mAttributes;
|
2006-10-13 10:41:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AttributeList::~AttributeList()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
css::uno::Reference< css::util::XCloneable > AttributeList::createClone()
|
2016-03-11 09:45:39 +00:00
|
|
|
{
|
|
|
|
AttributeList *p = new AttributeList( *this );
|
|
|
|
return css::uno::Reference< css::util::XCloneable > ( static_cast<css::util::XCloneable *>(p) );
|
|
|
|
}
|
|
|
|
|
2006-10-13 10:41:10 +00:00
|
|
|
} // namespace comphelper
|
|
|
|
|
2010-10-14 08:27:31 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|