Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.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 "WrappedSceneProperty.hxx"
21
#include "Chart2ModelContact.hxx"
22
#include <BaseGFXHelper.hxx>
23
#include <utility>
24
25
using namespace ::com::sun::star;
26
using ::com::sun::star::uno::Any;
27
using ::com::sun::star::uno::Reference;
28
29
namespace chart::wrapper
30
{
31
32
void WrappedSceneProperty::addWrappedProperties( std::vector< std::unique_ptr<WrappedProperty> >& rList
33
                , const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact )
34
0
{
35
0
    rList.emplace_back( new WrappedD3DTransformMatrixProperty( spChart2ModelContact ) );
36
0
}
37
38
WrappedD3DTransformMatrixProperty::WrappedD3DTransformMatrixProperty(
39
            std::shared_ptr<Chart2ModelContact> spChart2ModelContact )
40
0
            : WrappedProperty(u"D3DTransformMatrix"_ustr,u"D3DTransformMatrix"_ustr)
41
0
            , m_spChart2ModelContact(std::move( spChart2ModelContact ))
42
0
{
43
0
}
44
45
WrappedD3DTransformMatrixProperty::~WrappedD3DTransformMatrixProperty()
46
0
{
47
0
}
48
49
void WrappedD3DTransformMatrixProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
50
0
{
51
0
    if( m_spChart2ModelContact->getDiagram()->isPieOrDonutChart() )
52
0
    {
53
0
        drawing::HomogenMatrix aHM;
54
0
        if( rOuterValue >>= aHM )
55
0
        {
56
0
            ::basegfx::B3DTuple aRotation( BaseGFXHelper::GetRotationFromMatrix(
57
0
                BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aHM ) ) );
58
59
0
            ::basegfx::B3DHomMatrix aMatrix;
60
0
            aMatrix.rotate( aRotation.getX(), aRotation.getY(), aRotation.getZ() );
61
0
            ::basegfx::B3DHomMatrix aObjectMatrix;
62
0
            ::basegfx::B3DHomMatrix aNewMatrix = aMatrix*aObjectMatrix;
63
64
0
            aHM = BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aNewMatrix);
65
66
0
            WrappedProperty::setPropertyValue( uno::Any(aHM), xInnerPropertySet );
67
0
            return;
68
0
        }
69
0
    }
70
71
0
    WrappedProperty::setPropertyValue( rOuterValue, xInnerPropertySet );
72
0
}
73
74
Any WrappedD3DTransformMatrixProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
75
0
{
76
0
    if( m_spChart2ModelContact->getDiagram()->isPieOrDonutChart() )
77
0
    {
78
0
        uno::Any aAMatrix( WrappedProperty::getPropertyValue( xInnerPropertySet ) );
79
0
        drawing::HomogenMatrix aHM;
80
0
        if( aAMatrix >>= aHM )
81
0
        {
82
0
            ::basegfx::B3DTuple aRotation( BaseGFXHelper::GetRotationFromMatrix(
83
0
                BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aHM ) ) );
84
85
0
            ::basegfx::B3DHomMatrix aMatrix;
86
0
            aMatrix.rotate( aRotation.getX(), aRotation.getY(), aRotation.getZ() );
87
0
            ::basegfx::B3DHomMatrix aObjectMatrix;
88
0
            ::basegfx::B3DHomMatrix aNewMatrix = aMatrix*aObjectMatrix;
89
90
0
            aHM = BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aNewMatrix);
91
92
0
            return uno::Any(aHM);
93
0
        }
94
0
    }
95
96
0
    return WrappedProperty::getPropertyValue( xInnerPropertySet );
97
0
}
98
99
} //namespace chart::wrapper
100
101
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */