LibreOffice Module ucb (master) 1
hierarchycontent.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 <vector>
23#include <rtl/ref.hxx>
24#include <com/sun/star/ucb/XContentCreator.hpp>
26#include "hierarchydata.hxx"
27#include "hierarchyprovider.hxx"
28
29namespace com::sun::star::beans {
30 struct Property;
31 struct PropertyValue;
32}
33
34namespace com::sun::star::sdbc {
35 class XRow;
36}
37
38namespace com::sun::star::ucb {
39 struct TransferInfo;
40}
41
42namespace hierarchy_ucp
43{
44
45
47{
48public:
50
52 : m_aData( rType ),
55 : OUString( HIERARCHY_LINK_CONTENT_TYPE ) ) {}
56
58 : m_aData( rData ),
61 : OUString( HIERARCHY_LINK_CONTENT_TYPE ) ) {}
62
63 const OUString & getName() const { return m_aData.getName(); }
64 void setName( const OUString & rName ) { m_aData.setName( rName ); };
65
66 const OUString & getTitle() const { return m_aData.getTitle(); }
67 void setTitle( const OUString & rTitle )
68 { m_aData.setTitle( rTitle ); };
69
70 const OUString & getTargetURL() const
71 { return m_aData.getTargetURL(); }
72 void setTargetURL( const OUString & rURL )
73 { m_aData.setTargetURL( rURL ); };
74
75 const OUString & getContentType() const { return m_aContentType; }
76
77 bool getIsFolder() const
79
80 bool getIsDocument() const { return !getIsFolder(); }
81
82 css::uno::Sequence< css::ucb::ContentInfo >
84
86
87private:
90};
91
92
94
96 public css::ucb::XContentCreator
97{
99 enum ContentState { TRANSIENT, // created via CreateNewContent,
100 // but did not process "insert" yet
101 PERSISTENT, // processed "insert"
102 DEAD // processed "delete"
103 };
104
111
112private:
114 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
115 HierarchyContentProvider* pProvider,
116 const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier,
119 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
120 HierarchyContentProvider* pProvider,
121 const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier,
122 const css::ucb::ContentInfo& Info );
123
124 virtual css::uno::Sequence< css::beans::Property >
125 getProperties( const css::uno::Reference<css::ucb::XCommandEnvironment > & xEnv ) override;
126 virtual css::uno::Sequence< css::ucb::CommandInfo >
127 getCommands( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ) override;
128 virtual OUString getParentURL() override;
129
130 static bool hasData(
131 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
132 HierarchyContentProvider* pProvider,
133 const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier );
135 const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier )
137 static bool loadData(
138 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
139 HierarchyContentProvider* pProvider,
140 const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier,
142 bool storeData();
143 void renameData( const css::uno::Reference< css::ucb::XContentIdentifier >& xOldId,
144 const css::uno::Reference< css::ucb::XContentIdentifier >& xNewId );
145 bool removeData();
146
147 void setKind( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier );
148
149 bool isReadOnly();
150
151 bool isFolder() const { return ( m_eKind > LINK ); }
152
153 css::uno::Reference< css::ucb::XContentIdentifier >
154 makeNewIdentifier( const OUString& rTitle );
155
157 typedef std::vector< HierarchyContentRef > HierarchyContentRefVector;
158 void queryChildren( HierarchyContentRefVector& rChildren );
159
160 bool exchangeIdentity(
161 const css::uno::Reference< css::ucb::XContentIdentifier >& xNewId );
162
163 css::uno::Reference< css::sdbc::XRow >
164 getPropertyValues( const css::uno::Sequence< css::beans::Property >& rProperties );
166 css::uno::Sequence< css::uno::Any >
168 const css::uno::Sequence< css::beans::PropertyValue >& rValues,
169 const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv );
170
172 void insert( sal_Int32 nNameClashResolve,
173 const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv );
174
176 void destroy( bool bDeletePhysical,
177 const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv );
178
180 void transfer( const css::ucb::TransferInfo& rInfo,
181 const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv );
182
183public:
184 // Create existing content. Fail, if not already exists.
186 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
187 HierarchyContentProvider* pProvider,
188 const css::uno::Reference<
189 css::ucb::XContentIdentifier >& Identifier );
190
191 // Create new content. Fail, if already exists.
193 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
194 HierarchyContentProvider* pProvider,
195 const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier,
196 const css::ucb::ContentInfo& Info );
197
198 virtual ~HierarchyContent() override;
199
200 // XInterface
201 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
202 virtual void SAL_CALL acquire()
203 noexcept override;
204 virtual void SAL_CALL release()
205 noexcept override;
206
207 // XTypeProvider
208 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
209 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
210
211 // XServiceInfo
212 virtual OUString SAL_CALL
213 getImplementationName() override;
214 virtual css::uno::Sequence< OUString > SAL_CALL
215 getSupportedServiceNames() override;
216
217 // XContent
218 virtual OUString SAL_CALL
219 getContentType() override;
220 virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL
221 getIdentifier() override;
222
223 // XCommandProcessor
224 virtual css::uno::Any SAL_CALL
225 execute( const css::ucb::Command& aCommand,
226 sal_Int32 CommandId,
227 const css::uno::Reference< css::ucb::XCommandEnvironment >& Environment ) override;
228 virtual void SAL_CALL
229 abort( sal_Int32 CommandId ) override;
230
231
232 // Additional interfaces
233
234
235 // XContentCreator
236 virtual css::uno::Sequence< css::ucb::ContentInfo > SAL_CALL
238 virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
239 createNewContent( const css::ucb::ContentInfo& Info ) override;
240
241
242 // Non-interface methods.
243
244
245 static css::uno::Reference< css::sdbc::XRow >
246 getPropertyValues( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
247 const css::uno::Sequence< css::beans::Property >& rProperties,
248 const HierarchyContentProperties& rData,
249 HierarchyContentProvider* pProvider,
250 const OUString& rContentId );
251};
252
253} // namespace hierarchy_ucp
254
255/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Sequence< css::ucb::ContentInfo > getCreatableContentsInfo() const
const HierarchyEntryData & getHierarchyEntryData() const
HierarchyContentProperties(const HierarchyEntryData::Type &rType)
HierarchyContentProperties(const HierarchyEntryData &rData)
css::uno::Sequence< css::uno::Any > setPropertyValues(const css::uno::Sequence< css::beans::PropertyValue > &rValues, const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
std::vector< HierarchyContentRef > HierarchyContentRefVector
HierarchyContent(const css::uno::Reference< css::uno::XComponentContext > &rxContext, HierarchyContentProvider *pProvider, const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier, const css::ucb::ContentInfo &Info)
void destroy(bool bDeletePhysical, const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
virtual OUString SAL_CALL getImplementationName() override
HierarchyContentProvider * m_pProvider
void renameData(const css::uno::Reference< css::ucb::XContentIdentifier > &xOldId, const css::uno::Reference< css::ucb::XContentIdentifier > &xNewId)
bool exchangeIdentity(const css::uno::Reference< css::ucb::XContentIdentifier > &xNewId)
virtual void SAL_CALL abort(sal_Int32 CommandId) override
virtual css::uno::Sequence< css::ucb::ContentInfo > SAL_CALL queryCreatableContentsInfo() override
void insert(sal_Int32 nNameClashResolve, const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
void setKind(const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier)
void transfer(const css::ucb::TransferInfo &rInfo, const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
virtual OUString getParentURL() override
virtual css::uno::Sequence< css::beans::Property > getProperties(const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
css::uno::Reference< css::sdbc::XRow > getPropertyValues(const css::uno::Sequence< css::beans::Property > &rProperties)
virtual css::uno::Sequence< css::ucb::CommandInfo > getCommands(const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv) override
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL createNewContent(const css::ucb::ContentInfo &Info) override
virtual OUString SAL_CALL getContentType() override
static bool loadData(const css::uno::Reference< css::uno::XComponentContext > &rxContext, HierarchyContentProvider *pProvider, const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier, HierarchyContentProperties &rProps)
virtual css::uno::Any SAL_CALL execute(const css::ucb::Command &aCommand, sal_Int32 CommandId, const css::uno::Reference< css::ucb::XCommandEnvironment > &Environment) override
void queryChildren(HierarchyContentRefVector &rChildren)
static rtl::Reference< HierarchyContent > create(const css::uno::Reference< css::uno::XComponentContext > &rxContext, HierarchyContentProvider *pProvider, const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier, const css::ucb::ContentInfo &Info)
virtual void SAL_CALL release() noexcept override
css::uno::Reference< css::ucb::XContentIdentifier > makeNewIdentifier(const OUString &rTitle)
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
rtl::Reference< HierarchyContent > HierarchyContentRef
HierarchyContent(const css::uno::Reference< css::uno::XComponentContext > &rxContext, HierarchyContentProvider *pProvider, const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier, HierarchyContentProperties aProps)
HierarchyContentProperties m_aProps
static rtl::Reference< HierarchyContent > create(const css::uno::Reference< css::uno::XComponentContext > &rxContext, HierarchyContentProvider *pProvider, const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier)
virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL getIdentifier() override
virtual void SAL_CALL acquire() noexcept override
bool hasData(const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier)
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
static bool hasData(const css::uno::Reference< css::uno::XComponentContext > &rxContext, HierarchyContentProvider *pProvider, const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier)
void setName(const OUString &rName)
void setTargetURL(const OUString &rURL)
const OUString & getTitle() const
void setTitle(const OUString &rTitle)
const OUString & getName() const
const OUString & getTargetURL() const
css::uno::Reference< css::uno::XComponentContext > m_xContext
Type
constexpr OUStringLiteral HIERARCHY_LINK_CONTENT_TYPE
constexpr OUStringLiteral HIERARCHY_FOLDER_CONTENT_TYPE
bool getType(BSTR name, Type &type)
signed char sal_Int8