LibreOffice Module ucbhelper (master) 1
simplenameclashresolverequest.cxx
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#include <com/sun/star/ucb/NameClashResolveRequest.hpp>
21#include <com/sun/star/ucb/XInteractionSupplyName.hpp>
25
26using namespace com::sun::star;
27
28namespace ucbhelper {
29
37 public css::lang::XTypeProvider,
38 public css::ucb::XInteractionSupplyName
39{
40 OUString m_aName;
41
42public:
44 : InteractionContinuation( pRequest ) {}
45
46 // XInterface
47 virtual css::uno::Any SAL_CALL
48 queryInterface( const css::uno::Type & rType ) override;
49 virtual void SAL_CALL acquire()
50 noexcept override;
51 virtual void SAL_CALL release()
52 noexcept override;
53
54 // XTypeProvider
55 virtual css::uno::Sequence< css::uno::Type > SAL_CALL
56 getTypes() override;
57 virtual css::uno::Sequence< sal_Int8 > SAL_CALL
58 getImplementationId() override;
59
60 // XInteractionContinuation
61 virtual void SAL_CALL select() override;
62
63 // XInteractionSupplyName
64 virtual void SAL_CALL setName( const OUString& Name ) override;
65
66 // Non-interface methods.
67
74 const OUString & getName() const { return m_aName; }
75};
76
78 noexcept
79{
80 OWeakObject::acquire();
81}
82
84 noexcept
85{
86 OWeakObject::release();
87}
88
89uno::Any SAL_CALL
91{
92 uno::Any aRet = cppu::queryInterface( rType,
93 static_cast< lang::XTypeProvider * >( this ),
94 static_cast< task::XInteractionContinuation * >( this ),
95 static_cast< ucb::XInteractionSupplyName * >( this ) );
96
97 return aRet.hasValue()
99}
100
101uno::Sequence< sal_Int8 > SAL_CALL InteractionSupplyName::getImplementationId()
102{
103 return css::uno::Sequence<sal_Int8>();
104}
105
106uno::Sequence< uno::Type > SAL_CALL InteractionSupplyName::getTypes()
107{
108 static cppu::OTypeCollection s_aCollection(
111
112 return s_aCollection.getTypes();
113}
114
116{
118}
119
120void SAL_CALL
121InteractionSupplyName::setName( const OUString& Name )
122{
123 m_aName = Name;
124}
125
126SimpleNameClashResolveRequest::~SimpleNameClashResolveRequest() {}
127
128SimpleNameClashResolveRequest::SimpleNameClashResolveRequest(
129 const OUString & rTargetFolderURL,
130 const OUString & rClashingName )
131{
132 // Fill request...
133 ucb::NameClashResolveRequest aRequest;
134// aRequest.Message = // OUString
135// aRequest.Context = // XInterface
136 aRequest.Classification = task::InteractionClassification_QUERY;
137 aRequest.TargetFolderURL = rTargetFolderURL;
138 aRequest.ClashingName = rClashingName;
139 aRequest.ProposedNewName = OUString();
140
141 setRequest( uno::Any( aRequest ) );
142
143 // Fill continuations...
144 m_xNameSupplier = new InteractionSupplyName( this );
145
146 setContinuations({ new InteractionAbort(this), m_xNameSupplier,
147 new InteractionReplaceExistingData(this) });
148}
149
150OUString const & SimpleNameClashResolveRequest::getNewName() const
151{
152 return m_xNameSupplier->getName();
153}
154
155}
156
157/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) SAL_OVERRIDE
This class is the base for implementations of the interface XInteractionContinuation.
void recordSelection()
This method marks this continuation as "selected" at the request it belongs to.
This class implements a standard interaction continuation, namely the interface XInteractionSupplyNam...
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
InteractionSupplyName(InteractionRequest *pRequest)
virtual void SAL_CALL setName(const OUString &Name) override
const OUString & getName() const
This method returns the name that was supplied by the interaction handler.
virtual void SAL_CALL release() noexcept override
virtual void SAL_CALL acquire() noexcept override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Type
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
bool hasValue()
OUString Name
signed char sal_Int8