1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "filtask.hxx"
25 using namespace fileaccess
;
26 using namespace com::sun::star
;
27 using namespace com::sun::star::uno
;
29 XPropertySetInfo_impl::XPropertySetInfo_impl( TaskManager
* pMyShell
,const OUString
& aUnqPath
)
30 : m_pMyShell( pMyShell
),
33 m_pMyShell
->m_pProvider
->acquire();
35 TaskManager::ContentMap::iterator it
= m_pMyShell
->m_aContent
.find( aUnqPath
);
37 TaskManager::PropertySet
& properties
= it
->second
.properties
;
39 m_seq
.realloc( properties
.size() );
40 auto p_seq
= m_seq
.getArray();
43 for( const auto& rProp
: properties
)
45 p_seq
[ count
++ ] = beans::Property( rProp
.getPropertyName(),
48 rProp
.getAttributes() );
53 XPropertySetInfo_impl::XPropertySetInfo_impl( TaskManager
* pMyShell
,const Sequence
< beans::Property
>& seq
)
54 : m_pMyShell( pMyShell
),
57 m_pMyShell
->m_pProvider
->acquire();
61 XPropertySetInfo_impl::~XPropertySetInfo_impl()
63 m_pMyShell
->m_pProvider
->release();
67 beans::Property SAL_CALL
68 XPropertySetInfo_impl::getPropertyByName( const OUString
& aName
)
70 auto pProp
= std::find_if(std::cbegin(m_seq
), std::cend(m_seq
),
71 [&aName
](const beans::Property
& rProp
) { return rProp
.Name
== aName
; });
72 if (pProp
!= std::cend(m_seq
))
75 throw beans::UnknownPropertyException( aName
);
79 Sequence
< beans::Property
> SAL_CALL
80 XPropertySetInfo_impl::getProperties()
87 XPropertySetInfo_impl::hasPropertyByName( const OUString
& aName
)
89 return std::any_of(std::cbegin(m_seq
), std::cend(m_seq
),
90 [&aName
](const beans::Property
& rProp
) { return rProp
.Name
== aName
; });
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */