bump product version to 5.0.4.1
[LibreOffice.git] / ucb / source / ucp / hierarchy / hierarchydata.hxx
blobf6e00e42a8679fa65b9ca5a9457ccc6efa524e89
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 #ifndef INCLUDED_UCB_SOURCE_UCP_HIERARCHY_HIERARCHYDATA_HXX
21 #define INCLUDED_UCB_SOURCE_UCP_HIERARCHY_HIERARCHYDATA_HXX
23 #include <rtl/ustring.hxx>
24 #include <osl/mutex.hxx>
25 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 #include <com/sun/star/uno/XComponentContext.hpp>
28 namespace com { namespace sun { namespace star {
29 namespace container {
30 class XHierarchicalNameAccess;
32 namespace util {
33 class XOfficeInstallationDirectories;
35 } } }
37 namespace hierarchy_ucp
42 class HierarchyEntryData
44 public:
45 enum Type { NONE, LINK, FOLDER };
47 HierarchyEntryData() : m_aType( NONE ) {}
48 HierarchyEntryData( const Type & rType ) : m_aType( rType ) {}
50 const OUString & getName() const { return m_aName; }
51 void setName( const OUString & rName ) { m_aName = rName; }
53 const OUString & getTitle() const { return m_aTitle; }
54 void setTitle( const OUString & rTitle ) { m_aTitle = rTitle; }
56 const OUString & getTargetURL() const { return m_aTargetURL; }
57 void setTargetURL( const OUString & rURL ) { m_aTargetURL = rURL; }
59 Type getType() const
60 { return ( m_aType != NONE ) ? m_aType
61 : m_aTargetURL.getLength()
62 ? LINK
63 : FOLDER; }
64 void setType( const Type & rType ) { m_aType = rType; }
66 private:
67 OUString m_aName; // Name (language independent)
68 OUString m_aTitle; // Title (language dependent)
69 OUString m_aTargetURL; // Target URL ( links only )
70 Type m_aType; // Type
75 class HierarchyContentProvider;
76 class HierarchyUri;
78 class HierarchyEntry
80 OUString m_aServiceSpecifier;
81 OUString m_aName;
82 OUString m_aPath;
83 ::osl::Mutex m_aMutex;
84 ::com::sun::star::uno::Reference<
85 ::com::sun::star::uno::XComponentContext > m_xContext;
86 ::com::sun::star::uno::Reference<
87 ::com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider;
88 ::com::sun::star::uno::Reference<
89 ::com::sun::star::container::XHierarchicalNameAccess >
90 m_xRootReadAccess;
91 ::com::sun::star::uno::Reference<
92 ::com::sun::star::util::XOfficeInstallationDirectories >
93 m_xOfficeInstDirs;
94 bool m_bTriedToGetRootReadAccess; // #82494#
96 private:
97 static OUString createPathFromHierarchyURL( const HierarchyUri & rURI );
98 ::com::sun::star::uno::Reference<
99 ::com::sun::star::container::XHierarchicalNameAccess >
100 getRootReadAccess();
102 public:
103 HierarchyEntry( const ::com::sun::star::uno::Reference<
104 ::com::sun::star::uno::XComponentContext >& rxContext,
105 HierarchyContentProvider* pProvider,
106 const OUString& rURL );
108 bool hasData();
110 bool getData( HierarchyEntryData& rData );
112 bool setData( const HierarchyEntryData& rData, bool bCreate );
114 bool move( const OUString& rNewURL,
115 const HierarchyEntryData& rData );
117 bool remove();
119 // Iteration.
121 struct iterator_Impl;
123 class iterator
125 friend class HierarchyEntry;
127 iterator_Impl* m_pImpl;
129 public:
130 iterator();
131 ~iterator();
133 const HierarchyEntryData& operator*() const;
136 bool first( iterator& it );
137 bool next ( iterator& it );
140 } // namespace hierarchy_ucp
142 #endif // INCLUDED_UCB_SOURCE_UCP_HIERARCHY_HIERARCHYDATA_HXX
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */