LibreOffice Module ucb (master)  1
hierarchydata.hxx
Go to the documentation of this file.
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 #pragma once
21 
22 #include <rtl/ustring.hxx>
23 #include <osl/mutex.hxx>
24 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
25 #include <com/sun/star/uno/XComponentContext.hpp>
26 #include <memory>
27 
28 namespace com::sun::star {
29  namespace container {
30  class XHierarchicalNameAccess;
31  }
32  namespace util {
33  class XOfficeInstallationDirectories;
34  }
35 }
36 
37 namespace hierarchy_ucp
38 {
39 
40 
42 {
43 public:
44  enum Type { NONE, LINK, FOLDER };
45 
47  explicit HierarchyEntryData( const Type & rType ) : m_aType( rType ) {}
48 
49  const OUString & getName() const { return m_aName; }
50  void setName( const OUString & rName ) { m_aName = rName; }
51 
52  const OUString & getTitle() const { return m_aTitle; }
53  void setTitle( const OUString & rTitle ) { m_aTitle = rTitle; }
54 
55  const OUString & getTargetURL() const { return m_aTargetURL; }
56  void setTargetURL( const OUString & rURL ) { m_aTargetURL = rURL; }
57 
58  Type getType() const
59  { return ( m_aType != NONE ) ? m_aType
60  : m_aTargetURL.getLength()
61  ? LINK
62  : FOLDER; }
63  void setType( const Type & rType ) { m_aType = rType; }
64 
65 private:
66  OUString m_aName; // Name (language independent)
67  OUString m_aTitle; // Title (language dependent)
68  OUString m_aTargetURL; // Target URL ( links only )
69  Type m_aType; // Type
70 };
71 
72 
74 class HierarchyUri;
75 
77 {
79  OUString m_aName;
80  OUString m_aPath;
81  ::osl::Mutex m_aMutex;
82  css::uno::Reference< css::uno::XComponentContext > m_xContext;
83  css::uno::Reference< css::lang::XMultiServiceFactory > m_xConfigProvider;
84  css::uno::Reference< css::container::XHierarchicalNameAccess >
86  css::uno::Reference< css::util::XOfficeInstallationDirectories >
89 
90 private:
91  static OUString createPathFromHierarchyURL( const HierarchyUri & rURI );
92  css::uno::Reference< css::container::XHierarchicalNameAccess >
94 
95 public:
96  HierarchyEntry( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
97  HierarchyContentProvider* pProvider,
98  const OUString& rURL );
99 
100  bool hasData();
101 
102  bool getData( HierarchyEntryData& rData );
103 
104  bool setData( const HierarchyEntryData& rData );
105 
106  bool move( const OUString& rNewURL,
107  const HierarchyEntryData& rData );
108 
109  bool remove();
110 
111  // Iteration.
112 
113  struct iterator_Impl;
114 
115  class iterator
116  {
117  friend class HierarchyEntry;
118 
119  std::unique_ptr<iterator_Impl> m_pImpl;
120 
121  public:
122  iterator();
123  ~iterator();
124 
125  const HierarchyEntryData& operator*() const;
126  };
127 
128  bool first( iterator const & it );
129  bool next ( iterator const & it );
130 };
131 
132 } // namespace hierarchy_ucp
133 
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
exports com.sun.star.lib. util
bool setData(const HierarchyEntryData &rData)
exports com.sun.star. container
bool next(iterator const &it)
void setType(const Type &rType)
bool first(iterator const &it)
css::uno::Reference< css::util::XOfficeInstallationDirectories > m_xOfficeInstDirs
const HierarchyEntryData & operator*() const
HierarchyEntry(const css::uno::Reference< css::uno::XComponentContext > &rxContext, HierarchyContentProvider *pProvider, const OUString &rURL)
bool getData(HierarchyEntryData &rData)
static OUString createPathFromHierarchyURL(const HierarchyUri &rURI)
css::uno::Reference< css::container::XHierarchicalNameAccess > m_xRootReadAccess
void setTargetURL(const OUString &rURL)
css::uno::Reference< css::lang::XMultiServiceFactory > m_xConfigProvider
css::uno::Reference< css::container::XHierarchicalNameAccess > getRootReadAccess()
const OUString & getName() const
bool move(const OUString &rNewURL, const HierarchyEntryData &rData)
css::uno::Reference< css::uno::XComponentContext > m_xContext
std::unique_ptr< iterator_Impl > m_pImpl
void setTitle(const OUString &rTitle)
void setName(const OUString &rName)
HierarchyEntryData(const Type &rType)
const OUString & getTargetURL() const
const OUString & getTitle() const