Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_sc / validat.hxx
blob6737142b6b905f45a9d2297c0f2dfcc32f39157d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: validat.hxx,v $
10 * $Revision: 1.8 $
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"
36 #endif
37 namespace binfilter {
39 class ScPatternAttr;
40 class ScTokenArray;
42 enum ScValidationMode
44 SC_VALID_ANY,
45 SC_VALID_WHOLE,
46 SC_VALID_DECIMAL,
47 SC_VALID_DATE,
48 SC_VALID_TIME,
49 SC_VALID_TEXTLEN,
50 SC_VALID_LIST,
51 SC_VALID_CUSTOM
54 enum ScValidErrorStyle
56 SC_VALERR_STOP,
57 SC_VALERR_WARNING,
58 SC_VALERR_INFO,
59 SC_VALERR_MACRO
63 // Eintrag fuer Gueltigkeit (es gibt nur eine Bedingung)
66 class ScValidationData : public ScConditionEntry
68 sal_uInt32 nKey; // Index in Attributen
70 ScValidationMode eDataMode;
71 BOOL bShowInput;
72 BOOL bShowError;
73 ScValidErrorStyle eErrorStyle;
74 String aInputTitle;
75 String aInputMessage;
76 String aErrorTitle;
77 String aErrorMessage;
79 BOOL bIsUsed; // temporaer beim Speichern
82 public:
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 );
91 ~ScValidationData();
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 ); }
100 void ResetInput();
101 void ResetError();
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;
117 // TRUE -> Abbruch
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
145 public:
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;
157 void ResetUsed();
159 void CompileXML();
163 } //namespace binfilter
164 #endif