Branch data 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 : : #ifndef _HIERARCHYDATA_HXX
21 : : #define _HIERARCHYDATA_HXX
22 : :
23 : : #include <rtl/ustring.hxx>
24 : : #include <osl/mutex.hxx>
25 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 : :
27 : : namespace com { namespace sun { namespace star {
28 : : namespace container {
29 : : class XHierarchicalNameAccess;
30 : : }
31 : : namespace util {
32 : : class XOfficeInstallationDirectories;
33 : : }
34 : : } } }
35 : :
36 : : namespace hierarchy_ucp
37 : : {
38 : :
39 : : //=========================================================================
40 : :
41 : 294 : class HierarchyEntryData
42 : : {
43 : : public:
44 : : enum Type { NONE, LINK, FOLDER };
45 : :
46 : 114 : HierarchyEntryData() : m_aType( NONE ) {}
47 : 34 : HierarchyEntryData( const Type & rType ) : m_aType( rType ) {}
48 : :
49 : 56 : const rtl::OUString & getName() const { return m_aName; }
50 : 62 : void setName( const rtl::OUString & rName ) { m_aName = rName; }
51 : :
52 : 182 : const rtl::OUString & getTitle() const { return m_aTitle; }
53 : 62 : void setTitle( const rtl::OUString & rTitle ) { m_aTitle = rTitle; }
54 : :
55 : 96 : const rtl::OUString & getTargetURL() const { return m_aTargetURL; }
56 : 52 : void setTargetURL( const rtl::OUString & rURL ) { m_aTargetURL = rURL; }
57 : :
58 : 154 : Type getType() const
59 : : { return ( m_aType != NONE ) ? m_aType
60 : 0 : : m_aTargetURL.getLength()
61 : : ? LINK
62 [ + - ][ # # ]: 154 : : FOLDER; }
63 : 32 : void setType( const Type & rType ) { m_aType = rType; }
64 : :
65 : : private:
66 : : rtl::OUString m_aName; // Name (language independent)
67 : : rtl::OUString m_aTitle; // Title (language dependent)
68 : : rtl::OUString m_aTargetURL; // Target URL ( links only )
69 : : Type m_aType; // Type
70 : : };
71 : :
72 : : //=========================================================================
73 : :
74 : : class HierarchyContentProvider;
75 : : class HierarchyUri;
76 : :
77 [ + - ]: 126 : class HierarchyEntry
78 : : {
79 : : ::rtl::OUString m_aServiceSpecifier;
80 : : ::rtl::OUString m_aName;
81 : : ::rtl::OUString m_aPath;
82 : : ::osl::Mutex m_aMutex;
83 : : ::com::sun::star::uno::Reference<
84 : : ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
85 : : ::com::sun::star::uno::Reference<
86 : : ::com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider;
87 : : ::com::sun::star::uno::Reference<
88 : : ::com::sun::star::container::XHierarchicalNameAccess >
89 : : m_xRootReadAccess;
90 : : ::com::sun::star::uno::Reference<
91 : : ::com::sun::star::util::XOfficeInstallationDirectories >
92 : : m_xOfficeInstDirs;
93 : : sal_Bool m_bTriedToGetRootReadAccess; // #82494#
94 : :
95 : : private:
96 : : ::rtl::OUString createPathFromHierarchyURL( const HierarchyUri & rURI );
97 : : ::com::sun::star::uno::Reference<
98 : : ::com::sun::star::container::XHierarchicalNameAccess >
99 : : getRootReadAccess();
100 : :
101 : : public:
102 : : HierarchyEntry( const ::com::sun::star::uno::Reference<
103 : : ::com::sun::star::lang::XMultiServiceFactory >& rSMgr,
104 : : HierarchyContentProvider* pProvider,
105 : : const ::rtl::OUString& rURL );
106 : :
107 : : sal_Bool hasData();
108 : :
109 : : sal_Bool getData( HierarchyEntryData& rData );
110 : :
111 : : sal_Bool setData( const HierarchyEntryData& rData, sal_Bool bCreate );
112 : :
113 : : sal_Bool move( const ::rtl::OUString& rNewURL,
114 : : const HierarchyEntryData& rData );
115 : :
116 : : sal_Bool remove();
117 : :
118 : : // Iteration.
119 : :
120 : : struct iterator_Impl;
121 : :
122 : : class iterator
123 : : {
124 : : friend class HierarchyEntry;
125 : :
126 : : iterator_Impl* m_pImpl;
127 : :
128 : : public:
129 : : iterator();
130 : : ~iterator();
131 : :
132 : : const HierarchyEntryData& operator*() const;
133 : : };
134 : :
135 : : sal_Bool first( iterator& it );
136 : : sal_Bool next ( iterator& it );
137 : : };
138 : :
139 : : } // namespace hierarchy_ucp
140 : :
141 : : #endif /* !_HIERARCHYDATA_HXX */
142 : :
143 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|