bump product version to 5.0.4.1
[LibreOffice.git] / ucb / source / ucp / file / filprp.cxx
blob9bf21571f58732d1422553d1921d55b81300983d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "shell.hxx"
21 #include "prov.hxx"
22 #include "filprp.hxx"
24 using namespace fileaccess;
25 using namespace com::sun::star;
26 using namespace com::sun::star::uno;
27 using namespace com::sun::star::ucb;
29 #include "filinl.hxx"
31 #if OSL_DEBUG_LEVEL > 0
32 #define THROW_WHERE SAL_WHERE
33 #else
34 #define THROW_WHERE ""
35 #endif
37 XPropertySetInfo_impl::XPropertySetInfo_impl( shell* pMyShell,const OUString& aUnqPath )
38 : m_pMyShell( pMyShell ),
39 m_xProvider( pMyShell->m_pProvider ),
40 m_count( 0 ),
41 m_seq( 0 )
43 m_pMyShell->m_pProvider->acquire();
45 shell::ContentMap::iterator it = m_pMyShell->m_aContent.find( aUnqPath );
47 shell::PropertySet& properties = *(it->second.properties);
48 shell::PropertySet::iterator it1 = properties.begin();
50 m_seq.realloc( properties.size() );
52 while( it1 != properties.end() )
54 m_seq[ m_count++ ] = beans::Property( it1->getPropertyName(),
55 it1->getHandle(),
56 it1->getType(),
57 it1->getAttributes() );
58 ++it1;
63 XPropertySetInfo_impl::XPropertySetInfo_impl( shell* pMyShell,const Sequence< beans::Property >& seq )
64 : m_pMyShell( pMyShell ),
65 m_count( seq.getLength() ),
66 m_seq( seq )
68 m_pMyShell->m_pProvider->acquire();
72 XPropertySetInfo_impl::~XPropertySetInfo_impl()
74 m_pMyShell->m_pProvider->release();
78 beans::Property SAL_CALL
79 XPropertySetInfo_impl::getPropertyByName(
80 const OUString& aName )
81 throw( beans::UnknownPropertyException,
82 RuntimeException, std::exception)
84 for( sal_Int32 i = 0; i < m_seq.getLength(); ++i )
85 if( m_seq[i].Name == aName ) return m_seq[i];
87 throw beans::UnknownPropertyException( THROW_WHERE );
92 Sequence< beans::Property > SAL_CALL
93 XPropertySetInfo_impl::getProperties(
94 void )
95 throw( RuntimeException, std::exception )
97 return m_seq;
101 sal_Bool SAL_CALL
102 XPropertySetInfo_impl::hasPropertyByName(
103 const OUString& aName )
104 throw( RuntimeException, std::exception )
106 for( sal_Int32 i = 0; i < m_seq.getLength(); ++i )
107 if( m_seq[i].Name == aName ) return true;
108 return false;
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */