Coverage Report

Created: 2026-06-30 11:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/ucbhelper/source/provider/simplenameclashresolverequest.cxx
Line
Count
Source
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>
22
#include <cppuhelper/typeprovider.hxx>
23
#include <cppuhelper/queryinterface.hxx>
24
#include <ucbhelper/simplenameclashresolverequest.hxx>
25
26
using namespace com::sun::star;
27
28
namespace ucbhelper {
29
30
using InteractionSupplyName_BASE = cppu::ImplInheritanceHelper<InteractionContinuation,
31
                                                               css::ucb::XInteractionSupplyName>;
32
/**
33
  * This class implements a standard interaction continuation, namely the
34
  * interface XInteractionSupplyName. Instances of this class can be passed
35
  * along with an interaction request to indicate the possibility to
36
  * supply a new name.
37
  */
38
class InteractionSupplyName : public InteractionSupplyName_BASE
39
{
40
    OUString m_aName;
41
42
public:
43
    explicit InteractionSupplyName( InteractionRequest * pRequest )
44
0
    : InteractionSupplyName_BASE( pRequest ) {}
45
46
    // XInteractionContinuation
47
    virtual void SAL_CALL select() override;
48
49
    // XInteractionSupplyName
50
    virtual void SAL_CALL setName( const OUString& Name ) override;
51
52
    // Non-interface methods.
53
54
    /**
55
      * This method returns the name that was supplied by the interaction
56
      * handler.
57
      *
58
      * @return the name.
59
      */
60
0
    const OUString & getName() const { return m_aName; }
61
};
62
63
void SAL_CALL InteractionSupplyName::select()
64
0
{
65
0
    recordSelection();
66
0
}
67
68
void SAL_CALL
69
InteractionSupplyName::setName( const OUString& Name )
70
0
{
71
0
    m_aName = Name;
72
0
}
73
74
0
SimpleNameClashResolveRequest::~SimpleNameClashResolveRequest() {}
75
76
SimpleNameClashResolveRequest::SimpleNameClashResolveRequest(
77
                                    const OUString & rTargetFolderURL,
78
                                    const OUString & rClashingName )
79
0
{
80
    // Fill request...
81
0
    ucb::NameClashResolveRequest aRequest;
82
//    aRequest.Message        = // OUString
83
//    aRequest.Context        = // XInterface
84
0
    aRequest.Classification  = task::InteractionClassification_QUERY;
85
0
    aRequest.TargetFolderURL = rTargetFolderURL;
86
0
    aRequest.ClashingName    = rClashingName;
87
0
    aRequest.ProposedNewName = OUString();
88
89
0
    setRequest( uno::Any( aRequest ) );
90
91
    // Fill continuations...
92
0
    m_xNameSupplier = new InteractionSupplyName( this );
93
94
0
    setContinuations({ new InteractionAbort(this), m_xNameSupplier,
95
0
                       new InteractionReplaceExistingData(this) });
96
0
}
97
98
OUString const & SimpleNameClashResolveRequest::getNewName() const
99
0
{
100
0
    return m_xNameSupplier->getName();
101
0
}
102
103
}
104
105
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */