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 
24 using namespace fileaccess;
25 using namespace com::sun::star;
26 using namespace com::sun::star::uno;
27 using namespace com::sun::star::ucb;
28 
29 #include "filinl.hxx"
30 
31 XPropertySetInfo_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 
43  sal_Int32 count = 0;
44  for( const auto& rProp : properties )
45  {
46  m_seq[ count++ ] = beans::Property( rProp.getPropertyName(),
47  rProp.getHandle(),
48  rProp.getType(),
49  rProp.getAttributes() );
50  }
51 }
52 
53 
55  : m_pMyShell( pMyShell ),
56  m_seq( seq )
57 {
58  m_pMyShell->m_pProvider->acquire();
59 }
60 
61 
63 {
64  m_pMyShell->m_pProvider->release();
65 }
66 
67 
68 beans::Property SAL_CALL
70 {
71  auto pProp = std::find_if(m_seq.begin(), m_seq.end(),
72  [&aName](const beans::Property& rProp) { return rProp.Name == aName; });
73  if (pProp != m_seq.end())
74  return *pProp;
75 
76  throw beans::UnknownPropertyException( aName );
77 }
78 
79 
82 {
83  return m_seq;
84 }
85 
86 
87 sal_Bool SAL_CALL
89 {
90  return std::any_of(m_seq.begin(), m_seq.end(),
91  [&aName](const beans::Property& rProp) { return rProp.Name == aName; });
92 }
93 
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const size_t count(pCandidateA->getBorderLines().size())
virtual css::beans::Property SAL_CALL getPropertyByName(const OUString &aName) override
Definition: filprp.cxx:69
FileProvider * m_pProvider
Definition: filtask.hxx:487
virtual css::uno::Sequence< css::beans::Property > SAL_CALL getProperties() override
Definition: filprp.cxx:81
unsigned char sal_Bool
css::uno::Sequence< css::beans::Property > m_seq
Definition: filprp.hxx:50
virtual ~XPropertySetInfo_impl() override
Definition: filprp.cxx:62
XPropertySetInfo_impl(TaskManager *pMyShell, const OUString &aUnqPath)
Definition: filprp.cxx:31
virtual sal_Bool SAL_CALL hasPropertyByName(const OUString &Name) override
Definition: filprp.cxx:88
std::unordered_set< MyProperty, hMyProperty, eMyProperty > PropertySet
Definition: filtask.hxx:207