Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "shell.hxx"
21 : #include "prov.hxx"
22 : #include "filprp.hxx"
23 :
24 : using namespace fileaccess;
25 : using namespace com::sun::star;
26 : using namespace com::sun::star::uno;
27 : using namespace com::sun::star::ucb;
28 :
29 : #include "filinl.hxx"
30 :
31 : #if OSL_DEBUG_LEVEL > 0
32 : #define THROW_WHERE SAL_WHERE
33 : #else
34 : #define THROW_WHERE ""
35 : #endif
36 :
37 27232 : XPropertySetInfo_impl::XPropertySetInfo_impl( shell* pMyShell,const OUString& aUnqPath )
38 : : m_pMyShell( pMyShell ),
39 : m_xProvider( pMyShell->m_pProvider ),
40 : m_count( 0 ),
41 27232 : m_seq( 0 )
42 : {
43 27232 : m_pMyShell->m_pProvider->acquire();
44 :
45 27232 : shell::ContentMap::iterator it = m_pMyShell->m_aContent.find( aUnqPath );
46 :
47 27232 : shell::PropertySet& properties = *(it->second.properties);
48 27232 : shell::PropertySet::iterator it1 = properties.begin();
49 :
50 27232 : m_seq.realloc( properties.size() );
51 :
52 462944 : while( it1 != properties.end() )
53 : {
54 816960 : m_seq[ m_count++ ] = beans::Property( it1->getPropertyName(),
55 408480 : it1->getHandle(),
56 408480 : it1->getType(),
57 816960 : it1->getAttributes() );
58 408480 : ++it1;
59 : }
60 27232 : }
61 :
62 :
63 0 : XPropertySetInfo_impl::XPropertySetInfo_impl( shell* pMyShell,const Sequence< beans::Property >& seq )
64 : : m_pMyShell( pMyShell ),
65 0 : m_count( seq.getLength() ),
66 0 : m_seq( seq )
67 : {
68 0 : m_pMyShell->m_pProvider->acquire();
69 0 : }
70 :
71 :
72 81696 : XPropertySetInfo_impl::~XPropertySetInfo_impl()
73 : {
74 27232 : m_pMyShell->m_pProvider->release();
75 54464 : }
76 :
77 :
78 : beans::Property SAL_CALL
79 0 : XPropertySetInfo_impl::getPropertyByName(
80 : const OUString& aName )
81 : throw( beans::UnknownPropertyException,
82 : RuntimeException, std::exception)
83 : {
84 0 : for( sal_Int32 i = 0; i < m_seq.getLength(); ++i )
85 0 : if( m_seq[i].Name == aName ) return m_seq[i];
86 :
87 0 : throw beans::UnknownPropertyException( THROW_WHERE );
88 : }
89 :
90 :
91 :
92 : Sequence< beans::Property > SAL_CALL
93 0 : XPropertySetInfo_impl::getProperties(
94 : void )
95 : throw( RuntimeException, std::exception )
96 : {
97 0 : return m_seq;
98 : }
99 :
100 :
101 : sal_Bool SAL_CALL
102 39036 : XPropertySetInfo_impl::hasPropertyByName(
103 : const OUString& aName )
104 : throw( RuntimeException, std::exception )
105 : {
106 624576 : for( sal_Int32 i = 0; i < m_seq.getLength(); ++i )
107 585540 : if( m_seq[i].Name == aName ) return true;
108 39036 : return false;
109 : }
110 :
111 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|