LibreOffice Module ucb (master) 1
filprp.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 "filtask.hxx"
21#include "prov.hxx"
22#include "filprp.hxx"
23
24using namespace fileaccess;
25using namespace com::sun::star;
26using namespace com::sun::star::uno;
27using namespace com::sun::star::ucb;
28
29#include "filinl.hxx"
30
31XPropertySetInfo_impl::XPropertySetInfo_impl( TaskManager* pMyShell,const OUString& aUnqPath )
32 : m_pMyShell( pMyShell ),
33 m_seq( 0 )
34{
35 m_pMyShell->m_pProvider->acquire();
36
37 TaskManager::ContentMap::iterator it = m_pMyShell->m_aContent.find( aUnqPath );
38
39 TaskManager::PropertySet& properties = it->second.properties;
40
41 m_seq.realloc( properties.size() );
42 auto p_seq = m_seq.getArray();
43
44 sal_Int32 count = 0;
45 for( const auto& rProp : properties )
46 {
47 p_seq[ count++ ] = beans::Property( rProp.getPropertyName(),
48 rProp.getHandle(),
49 rProp.getType(),
50 rProp.getAttributes() );
51 }
52}
53
54
56 : m_pMyShell( pMyShell ),
57 m_seq( seq )
58{
59 m_pMyShell->m_pProvider->acquire();
60}
61
62
64{
65 m_pMyShell->m_pProvider->release();
66}
67
68
69beans::Property SAL_CALL
71{
72 auto pProp = std::find_if(std::cbegin(m_seq), std::cend(m_seq),
73 [&aName](const beans::Property& rProp) { return rProp.Name == aName; });
74 if (pProp != std::cend(m_seq))
75 return *pProp;
76
77 throw beans::UnknownPropertyException( aName );
78}
79
80
83{
84 return m_seq;
85}
86
87
88sal_Bool SAL_CALL
90{
91 return std::any_of(std::cbegin(m_seq), std::cend(m_seq),
92 [&aName](const beans::Property& rProp) { return rProp.Name == aName; });
93}
94
95/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
FileProvider * m_pProvider
Definition: filtask.hxx:477
XPropertySetInfo_impl(TaskManager *pMyShell, const OUString &aUnqPath)
Definition: filprp.cxx:31
virtual css::beans::Property SAL_CALL getPropertyByName(const OUString &aName) override
Definition: filprp.cxx:70
virtual css::uno::Sequence< css::beans::Property > SAL_CALL getProperties() override
Definition: filprp.cxx:82
virtual ~XPropertySetInfo_impl() override
Definition: filprp.cxx:63
css::uno::Sequence< css::beans::Property > m_seq
Definition: filprp.hxx:49
virtual sal_Bool SAL_CALL hasPropertyByName(const OUString &Name) override
Definition: filprp.cxx:89
OUString aName
unsigned char sal_Bool