Bump for 3.6-28
[LibreOffice.git] / ucb / source / ucp / file / filprp.cxx
blobdb2adf886c0a0b10f4a6ec8407b689220898bc2f
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 ************************************************************************/
29 #include "shell.hxx"
30 #include "prov.hxx"
31 #include "filprp.hxx"
33 using namespace fileaccess;
34 using namespace com::sun::star;
35 using namespace com::sun::star::uno;
36 using namespace com::sun::star::ucb;
39 #include "filinl.hxx"
42 XPropertySetInfo_impl::XPropertySetInfo_impl( shell* pMyShell,const rtl::OUString& aUnqPath )
43 : m_pMyShell( pMyShell ),
44 m_xProvider( pMyShell->m_pProvider ),
45 m_count( 0 ),
46 m_seq( 0 )
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(),
60 it1->getHandle(),
61 it1->getType(),
62 it1->getAttributes() );
63 ++it1;
68 XPropertySetInfo_impl::XPropertySetInfo_impl( shell* pMyShell,const Sequence< beans::Property >& seq )
69 : m_pMyShell( pMyShell ),
70 m_count( seq.getLength() ),
71 m_seq( seq )
73 m_pMyShell->m_pProvider->acquire();
77 XPropertySetInfo_impl::~XPropertySetInfo_impl()
79 m_pMyShell->m_pProvider->release();
83 void SAL_CALL
84 XPropertySetInfo_impl::acquire(
85 void )
86 throw()
88 OWeakObject::acquire();
92 void SAL_CALL
93 XPropertySetInfo_impl::release(
94 void )
95 throw()
97 OWeakObject::release();
102 XTYPEPROVIDER_IMPL_2( XPropertySetInfo_impl,
103 lang::XTypeProvider,
104 beans::XPropertySetInfo )
107 Any SAL_CALL
108 XPropertySetInfo_impl::queryInterface(
109 const Type& rType )
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,
123 RuntimeException)
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(
135 void )
136 throw( RuntimeException )
138 return m_seq;
142 sal_Bool SAL_CALL
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;
149 return false;
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */