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 17668 : XPropertySetInfo_impl::XPropertySetInfo_impl( shell* pMyShell,const OUString& aUnqPath )
38 : : m_pMyShell( pMyShell ),
39 : m_xProvider( pMyShell->m_pProvider ),
40 : m_count( 0 ),
41 17668 : m_seq( 0 )
42 : {
43 17668 : m_pMyShell->m_pProvider->acquire();
44 :
45 17668 : shell::ContentMap::iterator it = m_pMyShell->m_aContent.find( aUnqPath );
46 :
47 17668 : shell::PropertySet& properties = *(it->second.properties);
48 17668 : shell::PropertySet::iterator it1 = properties.begin();
49 :
50 17668 : m_seq.realloc( properties.size() );
51 :
52 300356 : while( it1 != properties.end() )
53 : {
54 530040 : m_seq[ m_count++ ] = beans::Property( it1->getPropertyName(),
55 265020 : it1->getHandle(),
56 265020 : it1->getType(),
57 530040 : it1->getAttributes() );
58 265020 : ++it1;
59 : }
60 17668 : }
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 53004 : XPropertySetInfo_impl::~XPropertySetInfo_impl()
73 : {
74 17668 : m_pMyShell->m_pProvider->release();
75 35336 : }
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 25128 : XPropertySetInfo_impl::hasPropertyByName(
103 : const OUString& aName )
104 : throw( RuntimeException, std::exception )
105 : {
106 402048 : for( sal_Int32 i = 0; i < m_seq.getLength(); ++i )
107 376920 : if( m_seq[i].Name == aName ) return true;
108 25128 : return false;
109 : }
110 :
111 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|