Coverage Report

Created: 2026-10-14 09:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/chart2/source/inc/CloneHelper.hxx
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
#pragma once
20
21
#include <com/sun/star/util/XCloneable.hpp>
22
#include <rtl/ref.hxx>
23
#include <iterator>
24
#include <vector>
25
26
namespace chart::CloneHelper
27
{
28
29
/// functor that clones a UNO-Reference
30
template< class Interface >
31
    struct CreateRefClone
32
{
33
    css::uno::Reference<Interface> operator() ( const css::uno::Reference<Interface> & xOther )
34
0
    {
35
0
        css::uno::Reference<Interface> xResult;
36
0
        css::uno::Reference< css::util::XCloneable >
37
0
              xCloneable( xOther, css::uno::UNO_QUERY );
38
0
        if( xCloneable.is())
39
0
            xResult.set( xCloneable->createClone(), css::uno::UNO_QUERY );
40
41
0
        return xResult;
42
0
    }
Unexecuted instantiation: chart::CloneHelper::CreateRefClone<com::sun::star::chart2::data::XLabeledDataSequence>::operator()(com::sun::star::uno::Reference<com::sun::star::chart2::data::XLabeledDataSequence> const&)
Unexecuted instantiation: chart::CloneHelper::CreateRefClone<com::sun::star::chart2::XTitle>::operator()(com::sun::star::uno::Reference<com::sun::star::chart2::XTitle> const&)
Unexecuted instantiation: chart::CloneHelper::CreateRefClone<com::sun::star::chart2::XFormattedString>::operator()(com::sun::star::uno::Reference<com::sun::star::chart2::XFormattedString> const&)
Unexecuted instantiation: chart::CloneHelper::CreateRefClone<com::sun::star::style::XStyle>::operator()(com::sun::star::uno::Reference<com::sun::star::style::XStyle> const&)
Unexecuted instantiation: chart::CloneHelper::CreateRefClone<com::sun::star::beans::XPropertySet>::operator()(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> const&)
43
};
44
45
/// clones a vector of UNO-References
46
template< class Interface >
47
    void CloneRefVector(
48
        const std::vector< css::uno::Reference< Interface > > & rSource,
49
        std::vector< css::uno::Reference< Interface > > & rDestination )
50
0
{
51
0
    std::transform( rSource.begin(), rSource.end(),
52
0
                      std::back_inserter( rDestination ),
53
0
                      CreateRefClone< Interface >());
54
0
}
55
56
template< class T >
57
    void CloneRefVector(
58
        const std::vector< rtl::Reference< T > > & rSource,
59
        std::vector< rtl::Reference< T > > & rDestination )
60
0
{
61
0
    for (const auto & rSourceItem : rSource)
62
0
        rDestination.push_back(static_cast<T*>(rSourceItem->createClone().get()));
63
0
}
Unexecuted instantiation: void chart::CloneHelper::CloneRefVector<chart::Axis>(std::__1::vector<rtl::Reference<chart::Axis>, std::__1::allocator<rtl::Reference<chart::Axis> > > const&, std::__1::vector<rtl::Reference<chart::Axis>, std::__1::allocator<rtl::Reference<chart::Axis> > >&)
Unexecuted instantiation: void chart::CloneHelper::CloneRefVector<chart::RegressionCurveModel>(std::__1::vector<rtl::Reference<chart::RegressionCurveModel>, std::__1::allocator<rtl::Reference<chart::RegressionCurveModel> > > const&, std::__1::vector<rtl::Reference<chart::RegressionCurveModel>, std::__1::allocator<rtl::Reference<chart::RegressionCurveModel> > >&)
Unexecuted instantiation: void chart::CloneHelper::CloneRefVector<chart::DataSeries>(std::__1::vector<rtl::Reference<chart::DataSeries>, std::__1::allocator<rtl::Reference<chart::DataSeries> > > const&, std::__1::vector<rtl::Reference<chart::DataSeries>, std::__1::allocator<rtl::Reference<chart::DataSeries> > >&)
64
65
/// clones a UNO-sequence of UNO-References
66
template< class Interface >
67
    void CloneRefSequence(
68
        const css::uno::Sequence< css::uno::Reference<Interface> > & rSource,
69
        css::uno::Sequence< css::uno::Reference<Interface> > & rDestination )
70
0
{
71
0
    rDestination.realloc( rSource.getLength());
72
0
    std::transform( rSource.begin(), rSource.end(),
73
0
                      rDestination.getArray(),
74
0
                      CreateRefClone< Interface >());
75
0
}
76
77
} //  namespace chart::CloneHelper
78
79
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */