1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include "XMLErrorIndicatorPropertyHdl.hxx"
23 #include <rtl/ustrbuf.hxx>
25 #include <com/sun/star/uno/Any.hxx>
26 #include <com/sun/star/chart/ChartErrorIndicatorType.hpp>
28 #include <sax/tools/converter.hxx>
31 using namespace com::sun::star
;
33 XMLErrorIndicatorPropertyHdl::~XMLErrorIndicatorPropertyHdl()
36 bool XMLErrorIndicatorPropertyHdl::importXML( const OUString
& rStrImpValue
,
37 uno::Any
& rValue
, const SvXMLUnitConverter
& /*rUnitConverter*/ ) const
40 ::sax::Converter::convertBool( bValue
, rStrImpValue
);
42 // modify existing value
43 chart::ChartErrorIndicatorType eType
= chart::ChartErrorIndicatorType_NONE
;
44 if( rValue
.hasValue())
47 if( bValue
) // enable flag
49 if( eType
!= chart::ChartErrorIndicatorType_TOP_AND_BOTTOM
)
51 if( mbUpperIndicator
)
52 eType
= ( eType
== chart::ChartErrorIndicatorType_LOWER
)
53 ? chart::ChartErrorIndicatorType_TOP_AND_BOTTOM
54 : chart::ChartErrorIndicatorType_UPPER
;
56 eType
= ( eType
== chart::ChartErrorIndicatorType_UPPER
)
57 ? chart::ChartErrorIndicatorType_TOP_AND_BOTTOM
58 : chart::ChartErrorIndicatorType_LOWER
;
63 if( eType
!= chart::ChartErrorIndicatorType_NONE
)
65 if( mbUpperIndicator
)
66 eType
= ( eType
== chart::ChartErrorIndicatorType_UPPER
)
67 ? chart::ChartErrorIndicatorType_NONE
68 : chart::ChartErrorIndicatorType_LOWER
;
70 eType
= ( eType
== chart::ChartErrorIndicatorType_LOWER
)
71 ? chart::ChartErrorIndicatorType_NONE
72 : chart::ChartErrorIndicatorType_UPPER
;
81 bool XMLErrorIndicatorPropertyHdl::exportXML( OUString
& rStrExpValue
,
82 const uno::Any
& rValue
, const SvXMLUnitConverter
& /*rUnitConverter*/ ) const
84 OUStringBuffer aBuffer
;
85 chart::ChartErrorIndicatorType eType
;
88 bool bValue
= ( eType
== chart::ChartErrorIndicatorType_TOP_AND_BOTTOM
||
90 ? ( eType
== chart::ChartErrorIndicatorType_UPPER
)
91 : ( eType
== chart::ChartErrorIndicatorType_LOWER
)));
95 ::sax::Converter::convertBool( aBuffer
, bValue
);
96 rStrExpValue
= aBuffer
.makeStringAndClear();
99 // only export if set to true
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */