Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "XMLErrorIndicatorPropertyHdl.hxx"
31 : :
32 : : #include <rtl/ustrbuf.hxx>
33 : :
34 : : #include <com/sun/star/uno/Any.hxx>
35 : : #include <com/sun/star/chart/ChartErrorIndicatorType.hpp>
36 : :
37 : : #include <sax/tools/converter.hxx>
38 : :
39 : :
40 : : using namespace com::sun::star;
41 : :
42 : 66 : XMLErrorIndicatorPropertyHdl::~XMLErrorIndicatorPropertyHdl()
43 [ - + ]: 132 : {}
44 : :
45 : 0 : sal_Bool XMLErrorIndicatorPropertyHdl::importXML( const ::rtl::OUString& rStrImpValue,
46 : : uno::Any& rValue, const SvXMLUnitConverter& /*rUnitConverter*/ ) const
47 : : {
48 : 0 : bool bValue(false);
49 [ # # ]: 0 : ::sax::Converter::convertBool( bValue, rStrImpValue );
50 : :
51 : : // modify existing value
52 : 0 : chart::ChartErrorIndicatorType eType = chart::ChartErrorIndicatorType_NONE;
53 [ # # ]: 0 : if( rValue.hasValue())
54 [ # # ]: 0 : rValue >>= eType;
55 : :
56 [ # # ]: 0 : if( bValue ) // enable flag
57 : : {
58 [ # # ]: 0 : if( eType != chart::ChartErrorIndicatorType_TOP_AND_BOTTOM )
59 : : {
60 [ # # ]: 0 : if( mbUpperIndicator )
61 : : eType = ( eType == chart::ChartErrorIndicatorType_LOWER )
62 : : ? chart::ChartErrorIndicatorType_TOP_AND_BOTTOM
63 [ # # ]: 0 : : chart::ChartErrorIndicatorType_UPPER;
64 : : else
65 : : eType = ( eType == chart::ChartErrorIndicatorType_UPPER )
66 : : ? chart::ChartErrorIndicatorType_TOP_AND_BOTTOM
67 [ # # ]: 0 : : chart::ChartErrorIndicatorType_LOWER;
68 : : }
69 : : }
70 : : else // disable flag
71 : : {
72 [ # # ]: 0 : if( eType != chart::ChartErrorIndicatorType_NONE )
73 : : {
74 [ # # ]: 0 : if( mbUpperIndicator )
75 : : eType = ( eType == chart::ChartErrorIndicatorType_UPPER )
76 : : ? chart::ChartErrorIndicatorType_NONE
77 [ # # ]: 0 : : chart::ChartErrorIndicatorType_LOWER;
78 : : else
79 : : eType = ( eType == chart::ChartErrorIndicatorType_LOWER )
80 : : ? chart::ChartErrorIndicatorType_NONE
81 [ # # ]: 0 : : chart::ChartErrorIndicatorType_UPPER;
82 : : }
83 : : }
84 : :
85 [ # # ]: 0 : rValue <<= eType;
86 : :
87 : 0 : return sal_True;
88 : : }
89 : :
90 : 0 : sal_Bool XMLErrorIndicatorPropertyHdl::exportXML( ::rtl::OUString& rStrExpValue,
91 : : const uno::Any& rValue, const SvXMLUnitConverter& /*rUnitConverter*/ ) const
92 : : {
93 : 0 : rtl::OUStringBuffer aBuffer;
94 : : chart::ChartErrorIndicatorType eType;
95 : :
96 [ # # ]: 0 : rValue >>= eType;
97 : : sal_Bool bValue = ( eType == chart::ChartErrorIndicatorType_TOP_AND_BOTTOM ||
98 : : ( mbUpperIndicator
99 : : ? ( eType == chart::ChartErrorIndicatorType_UPPER )
100 [ # # ][ # # ]: 0 : : ( eType == chart::ChartErrorIndicatorType_LOWER )));
[ # # ][ # # ]
101 : :
102 [ # # ]: 0 : if( bValue )
103 : : {
104 [ # # ]: 0 : ::sax::Converter::convertBool( aBuffer, bValue );
105 [ # # ]: 0 : rStrExpValue = aBuffer.makeStringAndClear();
106 : : }
107 : :
108 : : // only export if set to true
109 : 0 : return bValue;
110 : : }
111 : :
112 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|