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 .
24 using namespace fileaccess
;
25 using namespace com::sun::star
;
26 using namespace com::sun::star::uno
;
27 using namespace com::sun::star::ucb
;
33 XPropertySetInfo_impl::XPropertySetInfo_impl( shell
* pMyShell
,const OUString
& aUnqPath
)
34 : m_pMyShell( pMyShell
),
35 m_xProvider( pMyShell
->m_pProvider
),
39 m_pMyShell
->m_pProvider
->acquire();
41 shell::ContentMap::iterator it
= m_pMyShell
->m_aContent
.find( aUnqPath
);
43 shell::PropertySet
& properties
= *(it
->second
.properties
);
44 shell::PropertySet::iterator it1
= properties
.begin();
46 m_seq
.realloc( properties
.size() );
48 while( it1
!= properties
.end() )
50 m_seq
[ m_count
++ ] = beans::Property( it1
->getPropertyName(),
53 it1
->getAttributes() );
59 XPropertySetInfo_impl::XPropertySetInfo_impl( shell
* pMyShell
,const Sequence
< beans::Property
>& seq
)
60 : m_pMyShell( pMyShell
),
61 m_count( seq
.getLength() ),
64 m_pMyShell
->m_pProvider
->acquire();
68 XPropertySetInfo_impl::~XPropertySetInfo_impl()
70 m_pMyShell
->m_pProvider
->release();
75 XPropertySetInfo_impl::acquire(
79 OWeakObject::acquire();
84 XPropertySetInfo_impl::release(
88 OWeakObject::release();
93 XTYPEPROVIDER_IMPL_2( XPropertySetInfo_impl
,
95 beans::XPropertySetInfo
)
99 XPropertySetInfo_impl::queryInterface(
101 throw( RuntimeException
)
103 Any aRet
= cppu::queryInterface( rType
,
104 (static_cast< lang::XTypeProvider
* >(this)),
105 (static_cast< beans::XPropertySetInfo
* >(this)) );
106 return aRet
.hasValue() ? aRet
: OWeakObject::queryInterface( rType
);
110 beans::Property SAL_CALL
111 XPropertySetInfo_impl::getPropertyByName(
112 const OUString
& aName
)
113 throw( beans::UnknownPropertyException
,
116 for( sal_Int32 i
= 0; i
< m_seq
.getLength(); ++i
)
117 if( m_seq
[i
].Name
== aName
) return m_seq
[i
];
119 throw beans::UnknownPropertyException( OUString( OSL_LOG_PREFIX
), uno::Reference
< uno::XInterface
>() );
124 Sequence
< beans::Property
> SAL_CALL
125 XPropertySetInfo_impl::getProperties(
127 throw( RuntimeException
)
134 XPropertySetInfo_impl::hasPropertyByName(
135 const OUString
& aName
)
136 throw( RuntimeException
)
138 for( sal_Int32 i
= 0; i
< m_seq
.getLength(); ++i
)
139 if( m_seq
[i
].Name
== aName
) return true;
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */