Stop leaking all ScPostIt instances.
[LibreOffice.git] / ucb / source / ucp / file / filprp.cxx
blob5b79d5a8b1122a46148b62f9657b7106ce8f65d0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #include "shell.hxx"
21 #include "prov.hxx"
22 #include "filprp.hxx"
24 using namespace fileaccess;
25 using namespace com::sun::star;
26 using namespace com::sun::star::uno;
27 using namespace com::sun::star::ucb;
30 #include "filinl.hxx"
33 XPropertySetInfo_impl::XPropertySetInfo_impl( shell* pMyShell,const OUString& aUnqPath )
34 : m_pMyShell( pMyShell ),
35 m_xProvider( pMyShell->m_pProvider ),
36 m_count( 0 ),
37 m_seq( 0 )
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(),
51 it1->getHandle(),
52 it1->getType(),
53 it1->getAttributes() );
54 ++it1;
59 XPropertySetInfo_impl::XPropertySetInfo_impl( shell* pMyShell,const Sequence< beans::Property >& seq )
60 : m_pMyShell( pMyShell ),
61 m_count( seq.getLength() ),
62 m_seq( seq )
64 m_pMyShell->m_pProvider->acquire();
68 XPropertySetInfo_impl::~XPropertySetInfo_impl()
70 m_pMyShell->m_pProvider->release();
74 void SAL_CALL
75 XPropertySetInfo_impl::acquire(
76 void )
77 throw()
79 OWeakObject::acquire();
83 void SAL_CALL
84 XPropertySetInfo_impl::release(
85 void )
86 throw()
88 OWeakObject::release();
93 XTYPEPROVIDER_IMPL_2( XPropertySetInfo_impl,
94 lang::XTypeProvider,
95 beans::XPropertySetInfo )
98 Any SAL_CALL
99 XPropertySetInfo_impl::queryInterface(
100 const Type& rType )
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,
114 RuntimeException)
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(
126 void )
127 throw( RuntimeException )
129 return m_seq;
133 sal_Bool SAL_CALL
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;
140 return false;
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */