Update ooo320-m1
[ooovba.git] / ucb / source / ucp / file / filprp.cxx
blob3e24118a50300047ced7d44693ef702d0ac5bdfe
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: filprp.cxx,v $
10 * $Revision: 1.8 $
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"
33 #include "shell.hxx"
34 #include "prov.hxx"
35 #include "filprp.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;
43 #include "filinl.hxx"
46 XPropertySetInfo_impl::XPropertySetInfo_impl( shell* pMyShell,const rtl::OUString& aUnqPath )
47 : m_pMyShell( pMyShell ),
48 m_xProvider( pMyShell->m_pProvider ),
49 m_count( 0 ),
50 m_seq( 0 )
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(),
64 it1->getHandle(),
65 it1->getType(),
66 it1->getAttributes() );
67 ++it1;
72 XPropertySetInfo_impl::XPropertySetInfo_impl( shell* pMyShell,const Sequence< beans::Property >& seq )
73 : m_pMyShell( pMyShell ),
74 m_count( seq.getLength() ),
75 m_seq( seq )
77 m_pMyShell->m_pProvider->acquire();
81 XPropertySetInfo_impl::~XPropertySetInfo_impl()
83 m_pMyShell->m_pProvider->release();
87 void SAL_CALL
88 XPropertySetInfo_impl::acquire(
89 void )
90 throw()
92 OWeakObject::acquire();
96 void SAL_CALL
97 XPropertySetInfo_impl::release(
98 void )
99 throw()
101 OWeakObject::release();
106 XTYPEPROVIDER_IMPL_2( XPropertySetInfo_impl,
107 lang::XTypeProvider,
108 beans::XPropertySetInfo )
111 Any SAL_CALL
112 XPropertySetInfo_impl::queryInterface(
113 const Type& rType )
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,
127 RuntimeException)
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(
139 void )
140 throw( RuntimeException )
142 return m_seq;
146 sal_Bool SAL_CALL
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;
153 return false;