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: validat.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 ************************************************************************/
31 #ifndef SC_VALIDAT_HXX
32 #define SC_VALIDAT_HXX
34 #ifndef SC_CONDITIO_HXX
35 #include "conditio.hxx"
54 enum ScValidErrorStyle
63 // Eintrag fuer Gueltigkeit (es gibt nur eine Bedingung)
66 class ScValidationData
: public ScConditionEntry
68 sal_uInt32 nKey
; // Index in Attributen
70 ScValidationMode eDataMode
;
73 ScValidErrorStyle eErrorStyle
;
79 BOOL bIsUsed
; // temporaer beim Speichern
83 ScValidationData( ScValidationMode eMode
, ScConditionMode eOper
,
84 const String
& rExpr1
, const String
& rExpr2
,
85 ScDocument
* pDocument
, const ScAddress
& rPos
,
86 BOOL bCompileEnglish
= FALSE
, BOOL bCompileXML
= FALSE
);
87 ScValidationData( const ScValidationData
& r
);
88 ScValidationData( ScDocument
* pDocument
, const ScValidationData
& r
);
89 ScValidationData( SvStream
& rStream
, ScMultipleReadHeader
& rHdr
,
90 ScDocument
* pDocument
);
93 void Store(SvStream
& rStream
, ScMultipleWriteHeader
& rHdr
) const;
95 ScValidationData
* Clone() const // echte Kopie
96 { return new ScValidationData( GetDocument(), *this ); }
97 ScValidationData
* Clone(ScDocument
* pNew
) const
98 { return new ScValidationData( pNew
, *this ); }
102 void SetInput( const String
& rTitle
, const String
& rMsg
);
103 void SetError( const String
& rTitle
, const String
& rMsg
,
104 ScValidErrorStyle eStyle
);
106 BOOL
GetInput( String
& rTitle
, String
& rMsg
) const
107 { rTitle
= aInputTitle
; rMsg
= aInputMessage
; return bShowInput
; }
108 BOOL
GetErrMsg( String
& rTitle
, String
& rMsg
, ScValidErrorStyle
& rStyle
) const;
110 BOOL
HasErrMsg() const { return bShowError
; }
112 ScValidationMode
GetDataMode() const { return eDataMode
; }
115 BOOL
IsDataValid( ScBaseCell
* pCell
, const ScAddress
& rPos
) const;
119 BOOL
IsEmpty() const;
120 sal_uInt32
GetKey() const { return nKey
; }
121 void SetKey(sal_uInt32 nNew
) { nKey
= nNew
; } // nur wenn nicht eingefuegt!
123 void SetUsed(BOOL bSet
) { bIsUsed
= bSet
; }
124 BOOL
IsUsed() const { return bIsUsed
; }
126 BOOL
EqualEntries( const ScValidationData
& r
) const; // fuer Undo
128 // sortiert (per PTRARR) nach Index
129 // operator== nur fuer die Sortierung
130 BOOL
operator ==( const ScValidationData
& r
) const { return nKey
== r
.nKey
; }
131 BOOL
operator < ( const ScValidationData
& r
) const { return nKey
< r
.nKey
; }
135 // Liste der Bedingungen:
138 typedef ScValidationData
* ScValidationDataPtr
;
140 SV_DECL_PTRARR_SORT(ScValidationEntries_Impl
, ScValidationDataPtr
,
141 SC_COND_GROW
, SC_COND_GROW
)//STRIP008 ;
143 class ScValidationDataList
: public ScValidationEntries_Impl
146 ScValidationDataList() {}
147 ScValidationDataList(const ScValidationDataList
& rList
);
148 ~ScValidationDataList() {}
150 void InsertNew( ScValidationData
* pNew
)
151 { if (!Insert(pNew
)) delete pNew
; }
153 ScValidationData
* GetData( sal_uInt32 nKey
);
155 void Load( SvStream
& rStream
, ScDocument
* pDocument
);
156 void Store( SvStream
& rStream
) const;
163 } //namespace binfilter