1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cellfml.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #ifndef _STRING_HXX //autogen
35 #include <tools/string.hxx>
41 class SwTableSortBoxes
;
45 class SwTableFmlUpdate
;
49 const SwTableBox
* pLastTblBox
;
50 USHORT nStackCnt
, nMaxSize
;
53 SwTableSortBoxes
*pBoxStk
; // Stack fuers erkennen von Rekursionen !
54 SwCalc
& rCalc
; // akt. Calculator
55 const SwTable
* pTbl
; // akt. Tabelle
57 SwTblCalcPara( SwCalc
& rCalculator
, const SwTable
& rTable
);
60 BOOL
IsStackOverFlow() const { return nMaxSize
== nStackCnt
; }
61 BOOL
IncStackCnt() { return nMaxSize
== ++nStackCnt
; }
62 void DecStackCnt() { if( nStackCnt
) --nStackCnt
; }
63 void SetLastTblBox( const SwTableBox
* pBox
) { pLastTblBox
= pBox
; }
70 typedef void (SwTableFormula:: *FnScanFormel
)( const SwTable
&, String
&,
71 String
&, String
*, void* ) const;
73 void BoxNmsToPtr( const SwTable
&, String
&, String
&, String
* = 0,
74 void* pPara
= 0 ) const;
75 void PtrToBoxNms( const SwTable
&, String
&, String
&, String
* = 0,
76 void* pPara
= 0 ) const;
77 void _MakeFormel( const SwTable
&, String
&, String
&, String
* = 0,
78 void* pPara
= 0 ) const;
79 void _SplitMergeBoxNm( const SwTable
&, String
&, String
&, String
* = 0,
80 void* pPara
= 0 ) const{DBG_BF_ASSERT(0, "STRIP");} //STRIP001 void* pPara = 0 ) const;
82 void GetBoxes( const SwTableBox
& rStt
, const SwTableBox
& rEnd
,
83 SwSelBoxes
& rBoxes
) const;
84 String
ScanString( FnScanFormel fnFormel
, const SwTable
& rTbl
,
89 enum NameType
{ EXTRNL_NAME
, INTRNL_NAME
, REL_NAME
};
91 String sFormel
; // akt. Formel
92 NameType eNmType
; // akt. Darstellungs Art
93 BOOL bValidValue
; // TRUE: Formel neu berechnen
95 // suche den Node, in dem die Formel steht:
96 // TextFeld -> TextNode,
97 // BoxAttribut -> BoxStartNode
98 // !!! MUSS VON JEDER ABLEITUNG UEBERLADEN WERDEN !!!
99 virtual const SwNode
* GetNodeOfFormula() const = 0;
101 SwTableFormula( const String
& rFormel
);
103 String
MakeFormel( SwTblCalcPara
& rCalcPara
) const
105 return ScanString( &SwTableFormula::_MakeFormel
,
106 *rCalcPara
.pTbl
, &rCalcPara
);
111 SwTableFormula( const SwTableFormula
& rCpy
) { *this = rCpy
; }
112 SwTableFormula
& operator=( const SwTableFormula
& rCpy
)
114 sFormel
= rCpy
.sFormel
;
115 eNmType
= rCpy
.eNmType
;
116 bValidValue
= rCpy
.bValidValue
;
120 // erzeuge aus der internen (fuer CORE) die externe (fuer UI) Formel
121 void PtrToBoxNm( const SwTable
* pTbl
);
122 // erzeuge aus der externen (fuer UI) die interne (fuer CORE) Formel
123 void BoxNmToPtr( const SwTable
* pTbl
);
125 // ist gerade eine intern Darstellung aktiv
126 BOOL
IsIntrnlName() const { return eNmType
== INTRNL_NAME
; }
127 // erfrage die akt. Darstellung der Formel
128 NameType
GetNameType() const { return eNmType
; }
130 // erfrage/setze das Flag, ob der akt. Wert gueltig ist
131 BOOL
IsValid() const { return bValidValue
; }
132 inline void ChgValid( BOOL bNew
) { bValidValue
= bNew
; }
134 const String
& GetFormula() const { return sFormel
; }
135 void SetFormula( const String
& rNew
)
139 eNmType
= EXTRNL_NAME
;
142 // sind alle Boxen gueltig, auf die sich die Formel bezieht?
147 } //namespace binfilter