1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
33 using namespace fileaccess
;
34 using namespace com::sun::star
;
35 using namespace com::sun::star::uno
;
36 using namespace com::sun::star::ucb
;
42 XPropertySetInfo_impl::XPropertySetInfo_impl( shell
* pMyShell
,const rtl::OUString
& aUnqPath
)
43 : m_pMyShell( pMyShell
),
44 m_xProvider( pMyShell
->m_pProvider
),
48 m_pMyShell
->m_pProvider
->acquire();
50 shell::ContentMap::iterator it
= m_pMyShell
->m_aContent
.find( aUnqPath
);
52 shell::PropertySet
& properties
= *(it
->second
.properties
);
53 shell::PropertySet::iterator it1
= properties
.begin();
55 m_seq
.realloc( properties
.size() );
57 while( it1
!= properties
.end() )
59 m_seq
[ m_count
++ ] = beans::Property( it1
->getPropertyName(),
62 it1
->getAttributes() );
68 XPropertySetInfo_impl::XPropertySetInfo_impl( shell
* pMyShell
,const Sequence
< beans::Property
>& seq
)
69 : m_pMyShell( pMyShell
),
70 m_count( seq
.getLength() ),
73 m_pMyShell
->m_pProvider
->acquire();
77 XPropertySetInfo_impl::~XPropertySetInfo_impl()
79 m_pMyShell
->m_pProvider
->release();
84 XPropertySetInfo_impl::acquire(
88 OWeakObject::acquire();
93 XPropertySetInfo_impl::release(
97 OWeakObject::release();
102 XTYPEPROVIDER_IMPL_2( XPropertySetInfo_impl
,
104 beans::XPropertySetInfo
)
108 XPropertySetInfo_impl::queryInterface(
110 throw( RuntimeException
)
112 Any aRet
= cppu::queryInterface( rType
,
113 (static_cast< lang::XTypeProvider
* >(this)),
114 (static_cast< beans::XPropertySetInfo
* >(this)) );
115 return aRet
.hasValue() ? aRet
: OWeakObject::queryInterface( rType
);
119 beans::Property SAL_CALL
120 XPropertySetInfo_impl::getPropertyByName(
121 const rtl::OUString
& aName
)
122 throw( beans::UnknownPropertyException
,
125 for( sal_Int32 i
= 0; i
< m_seq
.getLength(); ++i
)
126 if( m_seq
[i
].Name
== aName
) return m_seq
[i
];
128 throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX
) ), uno::Reference
< uno::XInterface
>() );
133 Sequence
< beans::Property
> SAL_CALL
134 XPropertySetInfo_impl::getProperties(
136 throw( RuntimeException
)
143 XPropertySetInfo_impl::hasPropertyByName(
144 const rtl::OUString
& aName
)
145 throw( RuntimeException
)
147 for( sal_Int32 i
= 0; i
< m_seq
.getLength(); ++i
)
148 if( m_seq
[i
].Name
== aName
) return true;
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */