1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: filprp.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_ucb.hxx"
37 using namespace fileaccess
;
38 using namespace com::sun::star
;
39 using namespace com::sun::star::uno
;
40 using namespace com::sun::star::ucb
;
46 XPropertySetInfo_impl::XPropertySetInfo_impl( shell
* pMyShell
,const rtl::OUString
& aUnqPath
)
47 : m_pMyShell( pMyShell
),
48 m_xProvider( pMyShell
->m_pProvider
),
52 m_pMyShell
->m_pProvider
->acquire();
54 shell::ContentMap::iterator it
= m_pMyShell
->m_aContent
.find( aUnqPath
);
56 shell::PropertySet
& properties
= *(it
->second
.properties
);
57 shell::PropertySet::iterator it1
= properties
.begin();
59 m_seq
.realloc( properties
.size() );
61 while( it1
!= properties
.end() )
63 m_seq
[ m_count
++ ] = beans::Property( it1
->getPropertyName(),
66 it1
->getAttributes() );
72 XPropertySetInfo_impl::XPropertySetInfo_impl( shell
* pMyShell
,const Sequence
< beans::Property
>& seq
)
73 : m_pMyShell( pMyShell
),
74 m_count( seq
.getLength() ),
77 m_pMyShell
->m_pProvider
->acquire();
81 XPropertySetInfo_impl::~XPropertySetInfo_impl()
83 m_pMyShell
->m_pProvider
->release();
88 XPropertySetInfo_impl::acquire(
92 OWeakObject::acquire();
97 XPropertySetInfo_impl::release(
101 OWeakObject::release();
106 XTYPEPROVIDER_IMPL_2( XPropertySetInfo_impl
,
108 beans::XPropertySetInfo
)
112 XPropertySetInfo_impl::queryInterface(
114 throw( RuntimeException
)
116 Any aRet
= cppu::queryInterface( rType
,
117 SAL_STATIC_CAST( lang::XTypeProvider
*,this),
118 SAL_STATIC_CAST( beans::XPropertySetInfo
*,this) );
119 return aRet
.hasValue() ? aRet
: OWeakObject::queryInterface( rType
);
123 beans::Property SAL_CALL
124 XPropertySetInfo_impl::getPropertyByName(
125 const rtl::OUString
& aName
)
126 throw( beans::UnknownPropertyException
,
129 for( sal_Int32 i
= 0; i
< m_seq
.getLength(); ++i
)
130 if( m_seq
[i
].Name
== aName
) return m_seq
[i
];
132 throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX
) ), uno::Reference
< uno::XInterface
>() );
137 Sequence
< beans::Property
> SAL_CALL
138 XPropertySetInfo_impl::getProperties(
140 throw( RuntimeException
)
147 XPropertySetInfo_impl::hasPropertyByName(
148 const rtl::OUString
& aName
)
149 throw( RuntimeException
)
151 for( sal_Int32 i
= 0; i
< m_seq
.getLength(); ++i
)
152 if( m_seq
[i
].Name
== aName
) return true;