1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hierarchydata.hxx,v $
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
{
40 class XHierarchicalNameAccess
;
43 class XOfficeInstallationDirectories
;
47 namespace hierarchy_ucp
50 //=========================================================================
52 class HierarchyEntryData
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
; }
70 { return ( m_aType
!= NONE
) ? m_aType
71 : m_aTargetURL
.getLength()
74 void setType( const Type
& rType
) { m_aType
= rType
; }
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 )
83 //=========================================================================
85 class HierarchyContentProvider
;
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
>
101 ::com::sun::star::uno::Reference
<
102 ::com::sun::star::util::XOfficeInstallationDirectories
>
104 sal_Bool m_bTriedToGetRootReadAccess
; // #82494#
107 ::rtl::OUString
createPathFromHierarchyURL( const HierarchyUri
& rURI
);
108 ::com::sun::star::uno::Reference
<
109 ::com::sun::star::container::XHierarchicalNameAccess
>
113 HierarchyEntry( const ::com::sun::star::uno::Reference
<
114 ::com::sun::star::lang::XMultiServiceFactory
>& rSMgr
,
115 HierarchyContentProvider
* pProvider
,
116 const ::rtl::OUString
& rURL
);
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
);
131 struct iterator_Impl
;
135 friend class HierarchyEntry
;
137 iterator_Impl
* m_pImpl
;
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 */