Update ooo320-m1
[ooovba.git] / ucb / source / ucp / hierarchy / hierarchydata.hxx
blob4add72a2835590f42c3c6807328f28a31745c450
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hierarchydata.hxx,v $
10 * $Revision: 1.14 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _HIERARCHYDATA_HXX
32 #define _HIERARCHYDATA_HXX
34 #include <rtl/ustring.hxx>
35 #include <osl/mutex.hxx>
36 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
38 namespace com { namespace sun { namespace star {
39 namespace container {
40 class XHierarchicalNameAccess;
42 namespace util {
43 class XOfficeInstallationDirectories;
45 } } }
47 namespace hierarchy_ucp
50 //=========================================================================
52 class HierarchyEntryData
54 public:
55 enum Type { NONE, LINK, FOLDER };
57 HierarchyEntryData() : m_aType( NONE ) {}
58 HierarchyEntryData( const Type & rType ) : m_aType( rType ) {}
60 const rtl::OUString & getName() const { return m_aName; }
61 void setName( const rtl::OUString & rName ) { m_aName = rName; }
63 const rtl::OUString & getTitle() const { return m_aTitle; }
64 void setTitle( const rtl::OUString & rTitle ) { m_aTitle = rTitle; }
66 const rtl::OUString & getTargetURL() const { return m_aTargetURL; }
67 void setTargetURL( const rtl::OUString & rURL ) { m_aTargetURL = rURL; }
69 Type getType() const
70 { return ( m_aType != NONE ) ? m_aType
71 : m_aTargetURL.getLength()
72 ? LINK
73 : FOLDER; }
74 void setType( const Type & rType ) { m_aType = rType; }
76 private:
77 rtl::OUString m_aName; // Name (language independent)
78 rtl::OUString m_aTitle; // Title (language dependent)
79 rtl::OUString m_aTargetURL; // Target URL ( links only )
80 Type m_aType; // Type
83 //=========================================================================
85 class HierarchyContentProvider;
86 class HierarchyUri;
88 class HierarchyEntry
90 ::rtl::OUString m_aServiceSpecifier;
91 ::rtl::OUString m_aName;
92 ::rtl::OUString m_aPath;
93 ::osl::Mutex m_aMutex;
94 ::com::sun::star::uno::Reference<
95 ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
96 ::com::sun::star::uno::Reference<
97 ::com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider;
98 ::com::sun::star::uno::Reference<
99 ::com::sun::star::container::XHierarchicalNameAccess >
100 m_xRootReadAccess;
101 ::com::sun::star::uno::Reference<
102 ::com::sun::star::util::XOfficeInstallationDirectories >
103 m_xOfficeInstDirs;
104 sal_Bool m_bTriedToGetRootReadAccess; // #82494#
106 private:
107 ::rtl::OUString createPathFromHierarchyURL( const HierarchyUri & rURI );
108 ::com::sun::star::uno::Reference<
109 ::com::sun::star::container::XHierarchicalNameAccess >
110 getRootReadAccess();
112 public:
113 HierarchyEntry( const ::com::sun::star::uno::Reference<
114 ::com::sun::star::lang::XMultiServiceFactory >& rSMgr,
115 HierarchyContentProvider* pProvider,
116 const ::rtl::OUString& rURL );
118 sal_Bool hasData();
120 sal_Bool getData( HierarchyEntryData& rData );
122 sal_Bool setData( const HierarchyEntryData& rData, sal_Bool bCreate );
124 sal_Bool move( const ::rtl::OUString& rNewURL,
125 const HierarchyEntryData& rData );
127 sal_Bool remove();
129 // Iteration.
131 struct iterator_Impl;
133 class iterator
135 friend class HierarchyEntry;
137 iterator_Impl* m_pImpl;
139 public:
140 iterator();
141 ~iterator();
143 const HierarchyEntryData& operator*() const;
146 sal_Bool first( iterator& it );
147 sal_Bool next ( iterator& it );
150 } // namespace hierarchy_ucp
152 #endif /* !_HIERARCHYDATA_HXX */