Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
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.
15 : : *
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).
21 : : *
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.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "shell.hxx"
30 : : #include "prov.hxx"
31 : : #include "filprp.hxx"
32 : :
33 : : using namespace fileaccess;
34 : : using namespace com::sun::star;
35 : : using namespace com::sun::star::uno;
36 : : using namespace com::sun::star::ucb;
37 : :
38 : :
39 : : #include "filinl.hxx"
40 : :
41 : :
42 : 2589 : 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 [ + - ][ + - ]: 2589 : m_seq( 0 )
[ + - ]
47 : : {
48 : 2589 : m_pMyShell->m_pProvider->acquire();
49 : :
50 [ + - ]: 2589 : shell::ContentMap::iterator it = m_pMyShell->m_aContent.find( aUnqPath );
51 : :
52 [ + - ]: 2589 : shell::PropertySet& properties = *(it->second.properties);
53 [ + - ]: 2589 : shell::PropertySet::iterator it1 = properties.begin();
54 : :
55 [ + - ]: 2589 : m_seq.realloc( properties.size() );
56 : :
57 [ + - ][ + + ]: 41424 : while( it1 != properties.end() )
58 : : {
59 [ + - ][ + - ]: 77670 : m_seq[ m_count++ ] = beans::Property( it1->getPropertyName(),
60 [ + - ]: 38835 : it1->getHandle(),
61 [ + - ]: 38835 : it1->getType(),
62 [ + - ]: 116505 : it1->getAttributes() );
63 : 38835 : ++it1;
64 : : }
65 : 2589 : }
66 : :
67 : :
68 : 0 : XPropertySetInfo_impl::XPropertySetInfo_impl( shell* pMyShell,const Sequence< beans::Property >& seq )
69 : : : m_pMyShell( pMyShell ),
70 : 0 : m_count( seq.getLength() ),
71 [ # # ]: 0 : m_seq( seq )
72 : : {
73 : 0 : m_pMyShell->m_pProvider->acquire();
74 : 0 : }
75 : :
76 : :
77 [ + - ]: 2589 : XPropertySetInfo_impl::~XPropertySetInfo_impl()
78 : : {
79 : 2589 : m_pMyShell->m_pProvider->release();
80 [ - + ]: 5178 : }
81 : :
82 : :
83 : : void SAL_CALL
84 : 7767 : XPropertySetInfo_impl::acquire(
85 : : void )
86 : : throw()
87 : : {
88 : 7767 : OWeakObject::acquire();
89 : 7767 : }
90 : :
91 : :
92 : : void SAL_CALL
93 : 7767 : XPropertySetInfo_impl::release(
94 : : void )
95 : : throw()
96 : : {
97 : 7767 : OWeakObject::release();
98 : 7767 : }
99 : :
100 : :
101 : :
102 [ # # ][ # # ]: 0 : XTYPEPROVIDER_IMPL_2( XPropertySetInfo_impl,
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
103 : : lang::XTypeProvider,
104 : : beans::XPropertySetInfo )
105 : :
106 : :
107 : : Any SAL_CALL
108 : 0 : XPropertySetInfo_impl::queryInterface(
109 : : const Type& rType )
110 : : throw( RuntimeException )
111 : : {
112 : : Any aRet = cppu::queryInterface( rType,
113 : : (static_cast< lang::XTypeProvider* >(this)),
114 [ # # ]: 0 : (static_cast< beans::XPropertySetInfo* >(this)) );
115 [ # # ][ # # ]: 0 : return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
116 : : }
117 : :
118 : :
119 : : beans::Property SAL_CALL
120 : 0 : XPropertySetInfo_impl::getPropertyByName(
121 : : const rtl::OUString& aName )
122 : : throw( beans::UnknownPropertyException,
123 : : RuntimeException)
124 : : {
125 [ # # ]: 0 : for( sal_Int32 i = 0; i < m_seq.getLength(); ++i )
126 [ # # ]: 0 : if( m_seq[i].Name == aName ) return m_seq[i];
127 : :
128 [ # # ][ # # ]: 0 : throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
129 : : }
130 : :
131 : :
132 : :
133 : : Sequence< beans::Property > SAL_CALL
134 : 124 : XPropertySetInfo_impl::getProperties(
135 : : void )
136 : : throw( RuntimeException )
137 : : {
138 : 124 : return m_seq;
139 : : }
140 : :
141 : :
142 : : sal_Bool SAL_CALL
143 : 4575 : XPropertySetInfo_impl::hasPropertyByName(
144 : : const rtl::OUString& aName )
145 : : throw( RuntimeException )
146 : : {
147 [ + + ]: 73200 : for( sal_Int32 i = 0; i < m_seq.getLength(); ++i )
148 [ - + ]: 68625 : if( m_seq[i].Name == aName ) return true;
149 : 4575 : return false;
150 : : }
151 : :
152 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|