Line data Source code
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 :
21 : #include <main.hxx>
22 : #include <chart.hxx>
23 :
24 : // ---------------------------------------------------------------
25 :
26 0 : CGMChart::CGMChart( CGM& rCGM ) :
27 0 : mpCGM ( &rCGM )
28 : {
29 0 : for ( sal_Int8 i = 0; i < 7; i++ )
30 : {
31 0 : mDataNode[ i ].nBoxX1 = mDataNode[ i ].nBoxY1 = 0 ;
32 0 : mDataNode[ i ].nBoxX2 = mDataNode[ i ].nBoxY2 = 0 ;
33 :
34 0 : mDataNode[ i ].nZoneEnum = i;
35 : }
36 0 : };
37 :
38 : // ---------------------------------------------------------------
39 :
40 0 : CGMChart::~CGMChart()
41 : {
42 : // delete the whole textentry structure
43 :
44 0 : while( !maTextEntryList.empty() )
45 : {
46 0 : DeleteTextEntry( maTextEntryList[ 0 ] );
47 : }
48 0 : };
49 :
50 : // ---------------------------------------------------------------
51 :
52 0 : void CGMChart::DeleteTextEntry( TextEntry* pTextEntry )
53 : {
54 0 : if ( pTextEntry )
55 : {
56 0 : delete pTextEntry->pText;
57 0 : for ( TextAttribute* pTAttr = pTextEntry->pAttribute; pTAttr != NULL ; )
58 : {
59 0 : TextAttribute* pTempTAttr = pTAttr;
60 0 : pTAttr = pTAttr->pNextAttribute;
61 0 : delete pTempTAttr;
62 : }
63 0 : ::std::vector< TextEntry* >::iterator it;
64 0 : for ( it = maTextEntryList.begin(); it != maTextEntryList.end(); ++it )
65 : {
66 0 : if ( *it == pTextEntry )
67 : {
68 0 : maTextEntryList.erase( it );
69 0 : break;
70 : }
71 : }
72 0 : delete pTextEntry;
73 : }
74 0 : };
75 :
76 : // ---------------------------------------------------------------
77 :
78 0 : void CGMChart::InsertTextEntry( TextEntry* pTextEntry )
79 : {
80 0 : maTextEntryList.push_back( pTextEntry );
81 0 : };
82 :
83 : // ---------------------------------------------------------------
84 :
85 : // ---------------------------------------------------------------
86 0 : void CGMChart::ResetAnnotation()
87 : {
88 0 : mDataNode[ 0 ].nZoneEnum = 0;
89 0 : }
90 :
91 : // ---------------------------------------------------------------
92 :
93 0 : sal_Bool CGMChart::IsAnnotation()
94 : {
95 0 : return ( mDataNode[ 0 ].nZoneEnum == 0 );
96 : };
97 :
98 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|