1b3f79822SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3b3f79822SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4b3f79822SAndrew Rist * or more contributor license agreements. See the NOTICE file
5b3f79822SAndrew Rist * distributed with this work for additional information
6b3f79822SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7b3f79822SAndrew Rist * to you under the Apache License, Version 2.0 (the
8b3f79822SAndrew Rist * "License"); you may not use this file except in compliance
9b3f79822SAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11b3f79822SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13b3f79822SAndrew Rist * Unless required by applicable law or agreed to in writing,
14b3f79822SAndrew Rist * software distributed under the License is distributed on an
15b3f79822SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16b3f79822SAndrew Rist * KIND, either express or implied. See the License for the
17b3f79822SAndrew Rist * specific language governing permissions and limitations
18b3f79822SAndrew Rist * under the License.
19cdf0e10cSrcweir *
20b3f79822SAndrew Rist *************************************************************/
21b3f79822SAndrew Rist
22b3f79822SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25*b77af630Sdamjan #include "precompiled_scui.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir
28cdf0e10cSrcweir #include <vcl/svapp.hxx>
29cdf0e10cSrcweir #include <svl/aeitem.hxx>
30cdf0e10cSrcweir #include <svl/stritem.hxx>
31cdf0e10cSrcweir #include <svl/eitem.hxx>
32cdf0e10cSrcweir #include <svl/intitem.hxx>
33cdf0e10cSrcweir #include <basic/sbmeth.hxx>
34cdf0e10cSrcweir #include <basic/sbstar.hxx>
35cdf0e10cSrcweir #include <basic/sbmod.hxx>
36cdf0e10cSrcweir #include <sfx2/app.hxx>
37cdf0e10cSrcweir
38cdf0e10cSrcweir #include "scresid.hxx"
39cdf0e10cSrcweir #include "sc.hrc" // -> Slot IDs
40cdf0e10cSrcweir
41cdf0e10cSrcweir #include "validat.hxx"
42cdf0e10cSrcweir #include "validate.hrc"
43cdf0e10cSrcweir #include "validate.hxx"
44cdf0e10cSrcweir #include "compiler.hxx"
45cdf0e10cSrcweir #include "formula/opcode.hxx" //CHINA001
46cdf0e10cSrcweir //<!--Added by PengYunQuan for Validity Cell Range Picker
47cdf0e10cSrcweir #include "tabvwsh.hxx"
48cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
49cdf0e10cSrcweir #include <sfx2/childwin.hxx>
50cdf0e10cSrcweir #include "reffact.hxx"
51cdf0e10cSrcweir //-->Added by PengYunQuan for Validity Cell Range Picker
52cdf0e10cSrcweir
53cdf0e10cSrcweir // ============================================================================
54cdf0e10cSrcweir
55cdf0e10cSrcweir static sal_uInt16 pValueRanges[] =
56cdf0e10cSrcweir {
57cdf0e10cSrcweir FID_VALID_MODE, FID_VALID_ERRTEXT,
58cdf0e10cSrcweir FID_VALID_LISTTYPE, FID_VALID_LISTTYPE,
59cdf0e10cSrcweir 0
60cdf0e10cSrcweir };
61cdf0e10cSrcweir
62cdf0e10cSrcweir
63cdf0e10cSrcweir // ============================================================================
64cdf0e10cSrcweir
65cdf0e10cSrcweir //<!--Modified by PengYunQuan for Validity Cell Range Picker
66cdf0e10cSrcweir //ScValidationDlg::ScValidationDlg( Window* pParent, const SfxItemSet* pArgSet ) :
67cdf0e10cSrcweir // SfxTabDialog( pParent, ScResId( TAB_DLG_VALIDATION ), pArgSet )
ScValidationDlg(Window * pParent,const SfxItemSet * pArgSet,ScTabViewShell * pTabViewSh,SfxBindings * pB)68cdf0e10cSrcweir ScValidationDlg::ScValidationDlg( Window* pParent,
69cdf0e10cSrcweir const SfxItemSet* pArgSet,
70cdf0e10cSrcweir ScTabViewShell *pTabViewSh,
71cdf0e10cSrcweir SfxBindings *pB /*= NULL*/
72cdf0e10cSrcweir ) :
73cdf0e10cSrcweir ScValidationDlgBase( pParent ? pParent : SFX_APP()->GetTopWindow(), TAB_DLG_VALIDATION, pArgSet, pB ),
74cdf0e10cSrcweir m_bOwnRefHdlr( false ),
75cdf0e10cSrcweir m_pTabVwSh( pTabViewSh ),
76cdf0e10cSrcweir m_bRefInputting( false )
77cdf0e10cSrcweir //-->Modified by PengYunQuan for Validity Cell Range Picker
78cdf0e10cSrcweir {
79cdf0e10cSrcweir AddTabPage( TP_VALIDATION_VALUES, ScTPValidationValue::Create, 0 );
80cdf0e10cSrcweir AddTabPage( TP_VALIDATION_INPUTHELP, ScTPValidationHelp::Create, 0 );
81cdf0e10cSrcweir AddTabPage( TP_VALIDATION_ERROR, ScTPValidationError::Create, 0 );
82cdf0e10cSrcweir FreeResource();
83cdf0e10cSrcweir }
84cdf0e10cSrcweir
85cdf0e10cSrcweir //<!--Added by PengYunQuan for Validity Cell Range Picker
SetReferenceHdl(const ScRange & rRange,ScDocument * pDoc)86cdf0e10cSrcweir void ScTPValidationValue::SetReferenceHdl( const ScRange&rRange , ScDocument* pDoc )
87cdf0e10cSrcweir {
88cdf0e10cSrcweir if ( rRange.aStart != rRange.aEnd )
89cdf0e10cSrcweir if ( ScValidationDlg *pValidationDlg = GetValidationDlg() )
90cdf0e10cSrcweir if( m_pRefEdit )
91cdf0e10cSrcweir pValidationDlg/*->GetRefHandler()*/->RefInputStart( m_pRefEdit );
92cdf0e10cSrcweir
93cdf0e10cSrcweir if ( m_pRefEdit )
94cdf0e10cSrcweir {
95cdf0e10cSrcweir String aStr;
96cdf0e10cSrcweir rRange.Format( aStr, SCR_ABS_3D, pDoc );
97cdf0e10cSrcweir m_pRefEdit->SetRefString( aStr );
98cdf0e10cSrcweir //m_pRefEdit->SetRefString( rRange.aStart != rRange.aEnd ? aStr : String::CreateFromAscii("=").Append( aStr ) );
99cdf0e10cSrcweir }
100cdf0e10cSrcweir }
101cdf0e10cSrcweir
SetActiveHdl()102cdf0e10cSrcweir void ScTPValidationValue:: SetActiveHdl()
103cdf0e10cSrcweir {
104cdf0e10cSrcweir if ( m_pRefEdit ) m_pRefEdit->GrabFocus();
105cdf0e10cSrcweir
106cdf0e10cSrcweir if ( ScValidationDlg *pValidationDlg = GetValidationDlg() )
107cdf0e10cSrcweir if( m_pRefEdit )
108cdf0e10cSrcweir {
109cdf0e10cSrcweir pValidationDlg/*->GetRefHandler()*/->RefInputDone();
110cdf0e10cSrcweir }
111cdf0e10cSrcweir }
112cdf0e10cSrcweir
RefInputStartPreHdl(ScRefEdit * pEdit,ScRefButton * pButton)113cdf0e10cSrcweir void ScTPValidationValue::RefInputStartPreHdl( ScRefEdit* pEdit, ScRefButton* pButton )
114cdf0e10cSrcweir {
115cdf0e10cSrcweir if ( ScValidationDlg *pValidationDlg = GetValidationDlg() )
116cdf0e10cSrcweir {
117cdf0e10cSrcweir if( pEdit == m_pRefEdit )
118cdf0e10cSrcweir {
119cdf0e10cSrcweir if( Window *pPreWnd = pEdit==&maEdMax?&maFtMax:(pEdit==&maEdMin?&maFtMin:NULL) )
120cdf0e10cSrcweir {
121cdf0e10cSrcweir pPreWnd->SetParent( pValidationDlg );
122cdf0e10cSrcweir pPreWnd->Hide();
123cdf0e10cSrcweir }
124cdf0e10cSrcweir
125cdf0e10cSrcweir m_pRefEdit->SetParent( pValidationDlg );
126cdf0e10cSrcweir }
127cdf0e10cSrcweir
128cdf0e10cSrcweir if( pButton == &m_btnRef )m_btnRef.SetParent( pValidationDlg );
129cdf0e10cSrcweir }
130cdf0e10cSrcweir }
131cdf0e10cSrcweir
RefInputDonePreHdl()132cdf0e10cSrcweir void ScTPValidationValue::RefInputDonePreHdl()
133cdf0e10cSrcweir {
134cdf0e10cSrcweir
135cdf0e10cSrcweir if( m_pRefEdit && m_pRefEdit->GetParent()!= this )
136cdf0e10cSrcweir {
137cdf0e10cSrcweir if( Window *pPreWnd = m_pRefEdit==&maEdMax?&maFtMax:(m_pRefEdit==&maEdMin?&maFtMin:NULL) )
138cdf0e10cSrcweir {
139cdf0e10cSrcweir pPreWnd->SetParent( this );
140cdf0e10cSrcweir pPreWnd->Show();
141cdf0e10cSrcweir }
142cdf0e10cSrcweir
143cdf0e10cSrcweir m_pRefEdit->SetParent( this );
144cdf0e10cSrcweir
145cdf0e10cSrcweir m_btnRef.SetParent( m_pRefEdit ); //if Edit SetParent but button not, the tab order will be incorrect, need button to setparent to anthor window and restore parent later in order to restore the tab order
146cdf0e10cSrcweir // aExample1.SetParent( m_pRefEdit ); // the aExample1's child order will affect acc key
147cdf0e10cSrcweir }
148cdf0e10cSrcweir
149cdf0e10cSrcweir if( m_btnRef.GetParent()!=this ) m_btnRef.SetParent( this );
150cdf0e10cSrcweir // if( aExample1.GetParent()!=this ) aExample1.SetParent( this );
151cdf0e10cSrcweir }
152cdf0e10cSrcweir
RefInputDonePostHdl()153cdf0e10cSrcweir void ScTPValidationValue::RefInputDonePostHdl()
154cdf0e10cSrcweir {
155cdf0e10cSrcweir
156cdf0e10cSrcweir
157cdf0e10cSrcweir if( m_pRefEdit && !m_pRefEdit->HasFocus() )
158cdf0e10cSrcweir m_pRefEdit->GrabFocus();
159cdf0e10cSrcweir
160cdf0e10cSrcweir }
161cdf0e10cSrcweir
162cdf0e10cSrcweir
Close()163cdf0e10cSrcweir sal_Bool ScValidationDlg::Close()
164cdf0e10cSrcweir {
165cdf0e10cSrcweir if( m_bOwnRefHdlr )
166cdf0e10cSrcweir if( SfxTabPage* pPage = GetTabPage( TP_VALIDATION_VALUES ) )
167cdf0e10cSrcweir static_cast<ScTPValidationValue*>(pPage)->RemoveRefDlg();
168cdf0e10cSrcweir
169cdf0e10cSrcweir return ScValidationDlgBase::Close();
170cdf0e10cSrcweir }
171cdf0e10cSrcweir //-->Added by PengYunQuan for Validity Cell Range Picker
172cdf0e10cSrcweir
~ScValidationDlg()173cdf0e10cSrcweir ScValidationDlg::~ScValidationDlg()
174cdf0e10cSrcweir {
175cdf0e10cSrcweir //<!--Added by PengYunQuan for Validity Cell Range Picker
176cdf0e10cSrcweir if( m_bOwnRefHdlr )
177cdf0e10cSrcweir RemoveRefDlg( sal_False );
178cdf0e10cSrcweir //-->Added by PengYunQuan for Validity Cell Range Picker
179cdf0e10cSrcweir }
180cdf0e10cSrcweir
181cdf0e10cSrcweir
182cdf0e10cSrcweir // ============================================================================
183cdf0e10cSrcweir
184cdf0e10cSrcweir namespace {
185cdf0e10cSrcweir
186cdf0e10cSrcweir /** Converts the passed ScValidationMode to the position in the list box. */
lclGetPosFromValMode(ScValidationMode eValMode)187cdf0e10cSrcweir sal_uInt16 lclGetPosFromValMode( ScValidationMode eValMode )
188cdf0e10cSrcweir {
189cdf0e10cSrcweir sal_uInt16 nLbPos = SC_VALIDDLG_ALLOW_ANY;
190cdf0e10cSrcweir switch( eValMode )
191cdf0e10cSrcweir {
192cdf0e10cSrcweir case SC_VALID_ANY: nLbPos = SC_VALIDDLG_ALLOW_ANY; break;
193cdf0e10cSrcweir case SC_VALID_WHOLE: nLbPos = SC_VALIDDLG_ALLOW_WHOLE; break;
194cdf0e10cSrcweir case SC_VALID_DECIMAL: nLbPos = SC_VALIDDLG_ALLOW_DECIMAL; break;
195cdf0e10cSrcweir case SC_VALID_DATE: nLbPos = SC_VALIDDLG_ALLOW_DATE; break;
196cdf0e10cSrcweir case SC_VALID_TIME: nLbPos = SC_VALIDDLG_ALLOW_TIME; break;
197cdf0e10cSrcweir case SC_VALID_TEXTLEN: nLbPos = SC_VALIDDLG_ALLOW_TEXTLEN; break;
198cdf0e10cSrcweir case SC_VALID_LIST: nLbPos = SC_VALIDDLG_ALLOW_RANGE; break;
199cdf0e10cSrcweir case SC_VALID_CUSTOM: nLbPos = SC_VALIDDLG_ALLOW_ANY; break; // not supported
200cdf0e10cSrcweir default: DBG_ERRORFILE( "lclGetPosFromValMode - unknown validity mode" );
201cdf0e10cSrcweir }
202cdf0e10cSrcweir return nLbPos;
203cdf0e10cSrcweir }
204cdf0e10cSrcweir
205cdf0e10cSrcweir /** Converts the passed list box position to an ScValidationMode. */
lclGetValModeFromPos(sal_uInt16 nLbPos)206cdf0e10cSrcweir ScValidationMode lclGetValModeFromPos( sal_uInt16 nLbPos )
207cdf0e10cSrcweir {
208cdf0e10cSrcweir ScValidationMode eValMode = SC_VALID_ANY;
209cdf0e10cSrcweir switch( nLbPos )
210cdf0e10cSrcweir {
211cdf0e10cSrcweir case SC_VALIDDLG_ALLOW_ANY: eValMode = SC_VALID_ANY; break;
212cdf0e10cSrcweir case SC_VALIDDLG_ALLOW_WHOLE: eValMode = SC_VALID_WHOLE; break;
213cdf0e10cSrcweir case SC_VALIDDLG_ALLOW_DECIMAL: eValMode = SC_VALID_DECIMAL; break;
214cdf0e10cSrcweir case SC_VALIDDLG_ALLOW_DATE: eValMode = SC_VALID_DATE; break;
215cdf0e10cSrcweir case SC_VALIDDLG_ALLOW_TIME: eValMode = SC_VALID_TIME; break;
216cdf0e10cSrcweir case SC_VALIDDLG_ALLOW_RANGE: eValMode = SC_VALID_LIST; break;
217cdf0e10cSrcweir case SC_VALIDDLG_ALLOW_LIST: eValMode = SC_VALID_LIST; break;
218cdf0e10cSrcweir case SC_VALIDDLG_ALLOW_TEXTLEN: eValMode = SC_VALID_TEXTLEN; break;
219cdf0e10cSrcweir default: DBG_ERRORFILE( "lclGetValModeFromPos - invalid list box position" );
220cdf0e10cSrcweir }
221cdf0e10cSrcweir return eValMode;
222cdf0e10cSrcweir }
223cdf0e10cSrcweir
224cdf0e10cSrcweir /** Converts the passed ScConditionMode to the position in the list box. */
lclGetPosFromCondMode(ScConditionMode eCondMode)225cdf0e10cSrcweir sal_uInt16 lclGetPosFromCondMode( ScConditionMode eCondMode )
226cdf0e10cSrcweir {
227cdf0e10cSrcweir sal_uInt16 nLbPos = SC_VALIDDLG_DATA_EQUAL;
228cdf0e10cSrcweir switch( eCondMode )
229cdf0e10cSrcweir {
230cdf0e10cSrcweir case SC_COND_NONE: // #111771# may occur in old XML files after Excel import
231cdf0e10cSrcweir case SC_COND_EQUAL: nLbPos = SC_VALIDDLG_DATA_EQUAL; break;
232cdf0e10cSrcweir case SC_COND_LESS: nLbPos = SC_VALIDDLG_DATA_LESS; break;
233cdf0e10cSrcweir case SC_COND_GREATER: nLbPos = SC_VALIDDLG_DATA_GREATER; break;
234cdf0e10cSrcweir case SC_COND_EQLESS: nLbPos = SC_VALIDDLG_DATA_EQLESS; break;
235cdf0e10cSrcweir case SC_COND_EQGREATER: nLbPos = SC_VALIDDLG_DATA_EQGREATER; break;
236cdf0e10cSrcweir case SC_COND_NOTEQUAL: nLbPos = SC_VALIDDLG_DATA_NOTEQUAL; break;
237cdf0e10cSrcweir case SC_COND_BETWEEN: nLbPos = SC_VALIDDLG_DATA_BETWEEN; break;
238cdf0e10cSrcweir case SC_COND_NOTBETWEEN: nLbPos = SC_VALIDDLG_DATA_NOTBETWEEN; break;
239cdf0e10cSrcweir default: DBG_ERRORFILE( "lclGetPosFromCondMode - unknown condition mode" );
240cdf0e10cSrcweir }
241cdf0e10cSrcweir return nLbPos;
242cdf0e10cSrcweir }
243cdf0e10cSrcweir
244cdf0e10cSrcweir /** Converts the passed list box position to an ScConditionMode. */
lclGetCondModeFromPos(sal_uInt16 nLbPos)245cdf0e10cSrcweir ScConditionMode lclGetCondModeFromPos( sal_uInt16 nLbPos )
246cdf0e10cSrcweir {
247cdf0e10cSrcweir ScConditionMode eCondMode = SC_COND_EQUAL;
248cdf0e10cSrcweir switch( nLbPos )
249cdf0e10cSrcweir {
250cdf0e10cSrcweir case SC_VALIDDLG_DATA_EQUAL: eCondMode = SC_COND_EQUAL; break;
251cdf0e10cSrcweir case SC_VALIDDLG_DATA_LESS: eCondMode = SC_COND_LESS; break;
252cdf0e10cSrcweir case SC_VALIDDLG_DATA_GREATER: eCondMode = SC_COND_GREATER; break;
253cdf0e10cSrcweir case SC_VALIDDLG_DATA_EQLESS: eCondMode = SC_COND_EQLESS; break;
254cdf0e10cSrcweir case SC_VALIDDLG_DATA_EQGREATER: eCondMode = SC_COND_EQGREATER; break;
255cdf0e10cSrcweir case SC_VALIDDLG_DATA_NOTEQUAL: eCondMode = SC_COND_NOTEQUAL; break;
256cdf0e10cSrcweir case SC_VALIDDLG_DATA_BETWEEN: eCondMode = SC_COND_BETWEEN; break;
257cdf0e10cSrcweir case SC_VALIDDLG_DATA_NOTBETWEEN: eCondMode = SC_COND_NOTBETWEEN; break;
258cdf0e10cSrcweir default: DBG_ERRORFILE( "lclGetCondModeFromPos - invalid list box position" );
259cdf0e10cSrcweir }
260cdf0e10cSrcweir return eCondMode;
261cdf0e10cSrcweir }
262cdf0e10cSrcweir
263cdf0e10cSrcweir /** Converts line feed separated string to a formula with strings separated by semicolons.
264cdf0e10cSrcweir @descr Keeps all empty strings.
265cdf0e10cSrcweir Example: abc\ndef\n\nghi -> "abc";"def";"";"ghi".
266cdf0e10cSrcweir @param rFmlaStr (out-param) The converted formula string. */
lclGetFormulaFromStringList(String & rFmlaStr,const String & rStringList,sal_Unicode cFmlaSep)267cdf0e10cSrcweir void lclGetFormulaFromStringList( String& rFmlaStr, const String& rStringList, sal_Unicode cFmlaSep )
268cdf0e10cSrcweir {
269cdf0e10cSrcweir rFmlaStr.Erase();
270cdf0e10cSrcweir xub_StrLen nTokenCnt = rStringList.GetTokenCount( '\n' );
271cdf0e10cSrcweir for( xub_StrLen nToken = 0, nStringIx = 0; nToken < nTokenCnt; ++nToken )
272cdf0e10cSrcweir {
273cdf0e10cSrcweir String aToken( rStringList.GetToken( 0, '\n', nStringIx ) );
274cdf0e10cSrcweir ScGlobal::AddQuotes( aToken, '"' );
275cdf0e10cSrcweir ScGlobal::AddToken( rFmlaStr, aToken, cFmlaSep );
276cdf0e10cSrcweir }
277cdf0e10cSrcweir if( !rFmlaStr.Len() )
278cdf0e10cSrcweir rFmlaStr.AssignAscii( "\"\"" );
279cdf0e10cSrcweir }
280cdf0e10cSrcweir
281cdf0e10cSrcweir
282cdf0e10cSrcweir /** Converts formula with strings separated by semicolons to line feed separated string.
283cdf0e10cSrcweir @descr Keeps all empty strings. Ignores all empty tokens (multiple semicolons).
284cdf0e10cSrcweir Example: "abc";;;"def";"";"ghi" -> abc\ndef\n\nghi.
285cdf0e10cSrcweir @param rStringList (out-param) The converted line feed separated string list.
286cdf0e10cSrcweir @return true = Conversion successful. */
lclGetStringListFromFormula(String & rStringList,const String & rFmlaStr,sal_Unicode cFmlaSep)287cdf0e10cSrcweir bool lclGetStringListFromFormula( String& rStringList, const String& rFmlaStr, sal_Unicode cFmlaSep )
288cdf0e10cSrcweir {
289cdf0e10cSrcweir String aQuotes( RTL_CONSTASCII_USTRINGPARAM( "\"\"" ) );
290cdf0e10cSrcweir xub_StrLen nTokenCnt = rFmlaStr.GetQuotedTokenCount( aQuotes, cFmlaSep );
291cdf0e10cSrcweir
292cdf0e10cSrcweir rStringList.Erase();
293cdf0e10cSrcweir bool bIsStringList = (nTokenCnt > 0);
294cdf0e10cSrcweir bool bTokenAdded = false;
295cdf0e10cSrcweir
296cdf0e10cSrcweir for( xub_StrLen nToken = 0, nStringIx = 0; bIsStringList && (nToken < nTokenCnt); ++nToken )
297cdf0e10cSrcweir {
298cdf0e10cSrcweir String aToken( rFmlaStr.GetQuotedToken( 0, aQuotes, cFmlaSep, nStringIx ) );
299cdf0e10cSrcweir aToken.EraseLeadingAndTrailingChars();
300cdf0e10cSrcweir if( aToken.Len() ) // ignore empty tokens, i.e. "a";;"b"
301cdf0e10cSrcweir {
302cdf0e10cSrcweir bIsStringList = ScGlobal::IsQuoted( aToken, '"' );
303cdf0e10cSrcweir if( bIsStringList )
304cdf0e10cSrcweir {
305cdf0e10cSrcweir ScGlobal::EraseQuotes( aToken, '"' );
306cdf0e10cSrcweir ScGlobal::AddToken( rStringList, aToken, '\n', 1, bTokenAdded );
307cdf0e10cSrcweir bTokenAdded = true;
308cdf0e10cSrcweir }
309cdf0e10cSrcweir }
310cdf0e10cSrcweir }
311cdf0e10cSrcweir
312cdf0e10cSrcweir return bIsStringList;
313cdf0e10cSrcweir }
314cdf0e10cSrcweir
315cdf0e10cSrcweir } // namespace
316cdf0e10cSrcweir
317cdf0e10cSrcweir // ----------------------------------------------------------------------------
318cdf0e10cSrcweir
ScTPValidationValue(Window * pParent,const SfxItemSet & rArgSet)319cdf0e10cSrcweir ScTPValidationValue::ScTPValidationValue( Window* pParent, const SfxItemSet& rArgSet ) :
320cdf0e10cSrcweir SfxTabPage( pParent, ScResId( TP_VALIDATION_VALUES ), rArgSet ),
321cdf0e10cSrcweir maFtAllow ( this, ScResId( FT_ALLOW ) ),
322cdf0e10cSrcweir maLbAllow ( this, ScResId( LB_ALLOW ) ),
323cdf0e10cSrcweir maCbAllow ( this, ScResId( TSB_ALLOW_BLANKS ) ),
324cdf0e10cSrcweir maCbShow ( this, ScResId( CB_SHOWLIST ) ),
325cdf0e10cSrcweir maCbSort ( this, ScResId( CB_SORTLIST ) ),
326cdf0e10cSrcweir maFtValue ( this, ScResId( FT_VALUE ) ),
327cdf0e10cSrcweir maLbValue ( this, ScResId( LB_VALUE ) ),
328cdf0e10cSrcweir maFtMin ( this, ScResId( FT_MIN ) ),
329cdf0e10cSrcweir maEdMin ( this, ScResId( EDT_MIN ) ),
330cdf0e10cSrcweir maEdList ( this, ScResId( EDT_LIST ) ),
331cdf0e10cSrcweir maFtMax ( this, ScResId( FT_MAX ) ),
332cdf0e10cSrcweir maEdMax ( this, ScResId( EDT_MAX ) ),
333cdf0e10cSrcweir maFtHint ( this, ScResId( FT_SOURCEHINT ) ),
334cdf0e10cSrcweir maStrMin ( ScResId( SCSTR_VALID_MINIMUM ) ),
335cdf0e10cSrcweir maStrMax ( ScResId( SCSTR_VALID_MAXIMUM ) ),
336cdf0e10cSrcweir maStrValue( ScResId( SCSTR_VALID_VALUE ) ),
337cdf0e10cSrcweir maStrRange( ScResId( SCSTR_VALID_RANGE ) ),
338cdf0e10cSrcweir maStrList ( ScResId( SCSTR_VALID_LIST ) ),
339cdf0e10cSrcweir //<!--Added by PengYunQuan for Validity Cell Range Picker
340cdf0e10cSrcweir m_btnRef( this, ScResId( RB_VALIDITY_REF ) )
341cdf0e10cSrcweir //-->Added by PengYunQuan for Validity Cell Range Picker
342cdf0e10cSrcweir {
343cdf0e10cSrcweir Init();
344cdf0e10cSrcweir FreeResource();
345cdf0e10cSrcweir
346cdf0e10cSrcweir // list separator in formulas
347cdf0e10cSrcweir //CHINA001 const String& rListSep = ScCompiler::pSymbolTableNative[ ocSep ];
348cdf0e10cSrcweir String aListSep = ::GetScCompilerNativeSymbol( ocSep ); //CHINA001
349cdf0e10cSrcweir DBG_ASSERT( aListSep.Len() == 1, "ScTPValidationValue::ScTPValidationValue - list separator error" );
350cdf0e10cSrcweir mcFmlaSep = aListSep.Len() ? aListSep.GetChar( 0 ) : ';';
351cdf0e10cSrcweir //<!--Added by PengYunQuan for Validity Cell Range Picker
352cdf0e10cSrcweir m_btnRef.Hide();
353cdf0e10cSrcweir //-->Added by PengYunQuan for Validity Cell Range Picker
354cdf0e10cSrcweir }
355cdf0e10cSrcweir
~ScTPValidationValue()356cdf0e10cSrcweir ScTPValidationValue::~ScTPValidationValue()
357cdf0e10cSrcweir {
358cdf0e10cSrcweir }
359cdf0e10cSrcweir
Init()360cdf0e10cSrcweir void ScTPValidationValue::Init()
361cdf0e10cSrcweir {
362cdf0e10cSrcweir maLbAllow.SetSelectHdl( LINK( this, ScTPValidationValue, SelectHdl ) );
363cdf0e10cSrcweir maLbValue.SetSelectHdl( LINK( this, ScTPValidationValue, SelectHdl ) );
364cdf0e10cSrcweir maCbShow.SetClickHdl( LINK( this, ScTPValidationValue, CheckHdl ) );
365cdf0e10cSrcweir //<!--Added by PengYunQuan for Validity Cell Range Picker
366cdf0e10cSrcweir maEdMin.SetGetFocusHdl( LINK( this, ScTPValidationValue, EditSetFocusHdl ) );
367cdf0e10cSrcweir maEdMin.SetLoseFocusHdl( LINK( this, ScTPValidationValue, KillFocusHdl ) );
368cdf0e10cSrcweir maEdMax.SetGetFocusHdl( LINK( this, ScTPValidationValue, EditSetFocusHdl ) );
369cdf0e10cSrcweir m_btnRef.SetLoseFocusHdl( LINK( this, ScTPValidationValue, KillFocusHdl ) );
370cdf0e10cSrcweir maEdMax.SetLoseFocusHdl( LINK( this, ScTPValidationValue, KillFocusHdl ) );
371cdf0e10cSrcweir //-->Added by PengYunQuan for Validity Cell Range Picker
372cdf0e10cSrcweir
373cdf0e10cSrcweir maLbAllow.SelectEntryPos( SC_VALIDDLG_ALLOW_ANY );
374cdf0e10cSrcweir maLbValue.SelectEntryPos( SC_VALIDDLG_DATA_EQUAL );
375cdf0e10cSrcweir
376cdf0e10cSrcweir SelectHdl( NULL );
377cdf0e10cSrcweir CheckHdl( NULL );
378cdf0e10cSrcweir }
379cdf0e10cSrcweir
Create(Window * pParent,const SfxItemSet & rArgSet)380cdf0e10cSrcweir SfxTabPage* ScTPValidationValue::Create( Window* pParent, const SfxItemSet& rArgSet )
381cdf0e10cSrcweir {
382cdf0e10cSrcweir return( new ScTPValidationValue( pParent, rArgSet ) );
383cdf0e10cSrcweir }
384cdf0e10cSrcweir
GetRanges()385cdf0e10cSrcweir sal_uInt16* ScTPValidationValue::GetRanges()
386cdf0e10cSrcweir {
387cdf0e10cSrcweir return pValueRanges;
388cdf0e10cSrcweir }
389cdf0e10cSrcweir
Reset(const SfxItemSet & rArgSet)390cdf0e10cSrcweir void ScTPValidationValue::Reset( const SfxItemSet& rArgSet )
391cdf0e10cSrcweir {
392cdf0e10cSrcweir const SfxPoolItem* pItem;
393cdf0e10cSrcweir
394cdf0e10cSrcweir sal_uInt16 nLbPos = SC_VALIDDLG_ALLOW_ANY;
395cdf0e10cSrcweir if( rArgSet.GetItemState( FID_VALID_MODE, sal_True, &pItem ) == SFX_ITEM_SET )
396cdf0e10cSrcweir nLbPos = lclGetPosFromValMode( static_cast< ScValidationMode >(
397cdf0e10cSrcweir static_cast< const SfxAllEnumItem* >( pItem )->GetValue() ) );
398cdf0e10cSrcweir maLbAllow.SelectEntryPos( nLbPos );
399cdf0e10cSrcweir
400cdf0e10cSrcweir nLbPos = SC_VALIDDLG_DATA_EQUAL;
401cdf0e10cSrcweir if( rArgSet.GetItemState( FID_VALID_CONDMODE, sal_True, &pItem ) == SFX_ITEM_SET )
402cdf0e10cSrcweir nLbPos = lclGetPosFromCondMode( static_cast< ScConditionMode >(
403cdf0e10cSrcweir static_cast< const SfxAllEnumItem* >( pItem )->GetValue() ) );
404cdf0e10cSrcweir maLbValue.SelectEntryPos( nLbPos );
405cdf0e10cSrcweir
406cdf0e10cSrcweir // *** check boxes ***
407cdf0e10cSrcweir sal_Bool bCheck = sal_True;
408cdf0e10cSrcweir if( rArgSet.GetItemState( FID_VALID_BLANK, sal_True, &pItem ) == SFX_ITEM_SET )
409cdf0e10cSrcweir bCheck = static_cast< const SfxBoolItem* >( pItem )->GetValue();
410cdf0e10cSrcweir maCbAllow.Check( bCheck );
411cdf0e10cSrcweir
412cdf0e10cSrcweir sal_Int32 nListType = ValidListType::UNSORTED;
413cdf0e10cSrcweir if( rArgSet.GetItemState( FID_VALID_LISTTYPE, sal_True, &pItem ) == SFX_ITEM_SET )
414cdf0e10cSrcweir nListType = static_cast< const SfxInt16Item* >( pItem )->GetValue();
415cdf0e10cSrcweir maCbShow.Check( nListType != ValidListType::INVISIBLE );
416cdf0e10cSrcweir maCbSort.Check( nListType == ValidListType::SORTEDASCENDING );
417cdf0e10cSrcweir
418cdf0e10cSrcweir // *** formulas ***
419cdf0e10cSrcweir String aFmlaStr;
420cdf0e10cSrcweir if ( rArgSet.GetItemState( FID_VALID_VALUE1, sal_True, &pItem ) == SFX_ITEM_SET )
421cdf0e10cSrcweir aFmlaStr = static_cast< const SfxStringItem* >( pItem )->GetValue();
422cdf0e10cSrcweir SetFirstFormula( aFmlaStr );
423cdf0e10cSrcweir
424cdf0e10cSrcweir aFmlaStr.Erase();
425cdf0e10cSrcweir if ( rArgSet.GetItemState( FID_VALID_VALUE2, sal_True, &pItem ) == SFX_ITEM_SET )
426cdf0e10cSrcweir aFmlaStr = static_cast< const SfxStringItem* >( pItem )->GetValue();
427cdf0e10cSrcweir SetSecondFormula( aFmlaStr );
428cdf0e10cSrcweir
429cdf0e10cSrcweir SelectHdl( NULL );
430cdf0e10cSrcweir CheckHdl( NULL );
431cdf0e10cSrcweir }
432cdf0e10cSrcweir
FillItemSet(SfxItemSet & rArgSet)433cdf0e10cSrcweir sal_Bool ScTPValidationValue::FillItemSet( SfxItemSet& rArgSet )
434cdf0e10cSrcweir {
435cdf0e10cSrcweir sal_Int16 nListType = maCbShow.IsChecked() ?
436cdf0e10cSrcweir (maCbSort.IsChecked() ? ValidListType::SORTEDASCENDING : ValidListType::UNSORTED) :
437cdf0e10cSrcweir ValidListType::INVISIBLE;
438cdf0e10cSrcweir
439cdf0e10cSrcweir rArgSet.Put( SfxAllEnumItem( FID_VALID_MODE, sal::static_int_cast<sal_uInt16>(
440cdf0e10cSrcweir lclGetValModeFromPos( maLbAllow.GetSelectEntryPos() ) ) ) );
441cdf0e10cSrcweir rArgSet.Put( SfxAllEnumItem( FID_VALID_CONDMODE, sal::static_int_cast<sal_uInt16>(
442cdf0e10cSrcweir lclGetCondModeFromPos( maLbValue.GetSelectEntryPos() ) ) ) );
443cdf0e10cSrcweir rArgSet.Put( SfxStringItem( FID_VALID_VALUE1, GetFirstFormula() ) );
444cdf0e10cSrcweir rArgSet.Put( SfxStringItem( FID_VALID_VALUE2, GetSecondFormula() ) );
445cdf0e10cSrcweir rArgSet.Put( SfxBoolItem( FID_VALID_BLANK, maCbAllow.IsChecked() ) );
446cdf0e10cSrcweir rArgSet.Put( SfxInt16Item( FID_VALID_LISTTYPE, nListType ) );
447cdf0e10cSrcweir return sal_True;
448cdf0e10cSrcweir }
449cdf0e10cSrcweir
GetFirstFormula() const450cdf0e10cSrcweir String ScTPValidationValue::GetFirstFormula() const
451cdf0e10cSrcweir {
452cdf0e10cSrcweir String aFmlaStr;
453cdf0e10cSrcweir if( maLbAllow.GetSelectEntryPos() == SC_VALIDDLG_ALLOW_LIST )
454cdf0e10cSrcweir lclGetFormulaFromStringList( aFmlaStr, maEdList.GetText(), mcFmlaSep );
455cdf0e10cSrcweir else
456cdf0e10cSrcweir aFmlaStr = maEdMin.GetText();
457cdf0e10cSrcweir return aFmlaStr;
458cdf0e10cSrcweir }
459cdf0e10cSrcweir
GetSecondFormula() const460cdf0e10cSrcweir String ScTPValidationValue::GetSecondFormula() const
461cdf0e10cSrcweir {
462cdf0e10cSrcweir return maEdMax.GetText();
463cdf0e10cSrcweir }
464cdf0e10cSrcweir
SetFirstFormula(const String & rFmlaStr)465cdf0e10cSrcweir void ScTPValidationValue::SetFirstFormula( const String& rFmlaStr )
466cdf0e10cSrcweir {
467cdf0e10cSrcweir // try if formula is a string list, validation mode must already be set
468cdf0e10cSrcweir String aStringList;
469cdf0e10cSrcweir if( (maLbAllow.GetSelectEntryPos() == SC_VALIDDLG_ALLOW_RANGE) &&
470cdf0e10cSrcweir lclGetStringListFromFormula( aStringList, rFmlaStr, mcFmlaSep ) )
471cdf0e10cSrcweir {
472cdf0e10cSrcweir maEdList.SetText( aStringList );
473cdf0e10cSrcweir maEdMin.SetText( EMPTY_STRING );
474cdf0e10cSrcweir // change validation mode to string list
475cdf0e10cSrcweir maLbAllow.SelectEntryPos( SC_VALIDDLG_ALLOW_LIST );
476cdf0e10cSrcweir }
477cdf0e10cSrcweir else
478cdf0e10cSrcweir {
479cdf0e10cSrcweir maEdMin.SetText( rFmlaStr );
480cdf0e10cSrcweir maEdList.SetText( EMPTY_STRING );
481cdf0e10cSrcweir }
482cdf0e10cSrcweir }
483cdf0e10cSrcweir
SetSecondFormula(const String & rFmlaStr)484cdf0e10cSrcweir void ScTPValidationValue::SetSecondFormula( const String& rFmlaStr )
485cdf0e10cSrcweir {
486cdf0e10cSrcweir maEdMax.SetText( rFmlaStr );
487cdf0e10cSrcweir }
488cdf0e10cSrcweir
489cdf0e10cSrcweir //<!--Added by PengYunQuan for Validity Cell Range Picker
GetValidationDlg()490cdf0e10cSrcweir ScValidationDlg * ScTPValidationValue::GetValidationDlg()
491cdf0e10cSrcweir {
492cdf0e10cSrcweir if( Window *pParent = GetParent() )
493cdf0e10cSrcweir do{
494cdf0e10cSrcweir if ( dynamic_cast<ScValidationDlg*>( pParent ) )
495cdf0e10cSrcweir return static_cast< ScValidationDlg * >( pParent );
496cdf0e10cSrcweir }while ( NULL != ( pParent = pParent->GetParent() ) );
497cdf0e10cSrcweir return NULL;
498cdf0e10cSrcweir }
SetupRefDlg()499cdf0e10cSrcweir void ScTPValidationValue::SetupRefDlg()
500cdf0e10cSrcweir {
501cdf0e10cSrcweir if( ScValidationDlg *pValidationDlg = GetValidationDlg() )
502cdf0e10cSrcweir if( pValidationDlg->SetupRefDlg() )
503cdf0e10cSrcweir {
504cdf0e10cSrcweir pValidationDlg->SetHandler( this );
505cdf0e10cSrcweir pValidationDlg->SetSetRefHdl( (ScRefHandlerHelper::PFUNCSETREFHDLTYPE)( &ScTPValidationValue::SetReferenceHdl ) );
506cdf0e10cSrcweir pValidationDlg->SetSetActHdl( (ScRefHandlerHelper::PCOMMONHDLTYPE)( &ScTPValidationValue::SetActiveHdl ) );
507cdf0e10cSrcweir pValidationDlg->SetRefInputStartPreHdl( (ScRefHandlerHelper::PINPUTSTARTDLTYPE)( &ScTPValidationValue::RefInputStartPreHdl ) );
508cdf0e10cSrcweir pValidationDlg->SetRefInputDonePreHdl( (ScRefHandlerHelper::PCOMMONHDLTYPE)( &ScTPValidationValue::RefInputDonePreHdl ) );
509cdf0e10cSrcweir pValidationDlg->SetRefInputDonePostHdl( (ScRefHandlerHelper::PCOMMONHDLTYPE)( &ScTPValidationValue::RefInputDonePostHdl ) );
510cdf0e10cSrcweir
511cdf0e10cSrcweir if ( maEdMax.IsVisible() ) { m_pRefEdit = &maEdMax; }
512cdf0e10cSrcweir else if ( maEdMin.IsVisible() ) { m_pRefEdit = &maEdMin; }
513cdf0e10cSrcweir
514cdf0e10cSrcweir if( m_pRefEdit && !m_pRefEdit->HasFocus() ) m_pRefEdit->GrabFocus();
515cdf0e10cSrcweir
516cdf0e10cSrcweir if( m_pRefEdit ) m_pRefEdit->SetRefDialog( pValidationDlg );
517cdf0e10cSrcweir m_btnRef.SetReferences( pValidationDlg, m_pRefEdit );
518cdf0e10cSrcweir }
519cdf0e10cSrcweir }
520cdf0e10cSrcweir
RemoveRefDlg()521cdf0e10cSrcweir void ScTPValidationValue::RemoveRefDlg()
522cdf0e10cSrcweir {
523cdf0e10cSrcweir if( ScValidationDlg *pValidationDlg = GetValidationDlg() )
524cdf0e10cSrcweir if( pValidationDlg->RemoveRefDlg() )
525cdf0e10cSrcweir {
526cdf0e10cSrcweir pValidationDlg->SetHandler( NULL );
527cdf0e10cSrcweir pValidationDlg->SetSetRefHdl( NULL );
528cdf0e10cSrcweir pValidationDlg->SetSetActHdl( NULL );
529cdf0e10cSrcweir pValidationDlg->SetRefInputStartPreHdl( NULL );
530cdf0e10cSrcweir pValidationDlg->SetRefInputDonePreHdl( NULL );
531cdf0e10cSrcweir pValidationDlg->SetRefInputDonePostHdl( NULL );
532cdf0e10cSrcweir
533cdf0e10cSrcweir if( m_pRefEdit ) m_pRefEdit->SetRefDialog( NULL );
534cdf0e10cSrcweir m_pRefEdit = NULL;
535cdf0e10cSrcweir
536cdf0e10cSrcweir m_btnRef.SetReferences( NULL, NULL );
537cdf0e10cSrcweir
538cdf0e10cSrcweir #if ! defined( WNT ) && !defined( _MSC_VER )
539cdf0e10cSrcweir TidyListBoxes();
540cdf0e10cSrcweir #endif
541cdf0e10cSrcweir }
542cdf0e10cSrcweir }
543cdf0e10cSrcweir
TidyListBoxes()544cdf0e10cSrcweir void ScTPValidationValue::TidyListBoxes()
545cdf0e10cSrcweir {
546cdf0e10cSrcweir if ( Window *pWnd = GetChild( 0 ) )
547cdf0e10cSrcweir {
548cdf0e10cSrcweir bool bFindLst = false;
549cdf0e10cSrcweir std::list<Window*> alstOrder;
550cdf0e10cSrcweir
551cdf0e10cSrcweir do{
552cdf0e10cSrcweir if( pWnd->GetParent() == this )
553cdf0e10cSrcweir {
554cdf0e10cSrcweir if ( !bFindLst )
555cdf0e10cSrcweir {
556cdf0e10cSrcweir try{
557cdf0e10cSrcweir if( dynamic_cast<ListBox*>(pWnd)||dynamic_cast<ListBox*>(pWnd->GetWindow(WINDOW_CLIENT) ) )
558cdf0e10cSrcweir bFindLst = true;
559cdf0e10cSrcweir }
560cdf0e10cSrcweir catch( ... )
561cdf0e10cSrcweir {
562cdf0e10cSrcweir if ( *(void**)pWnd == *(void**)&maLbValue )
563cdf0e10cSrcweir bFindLst = true;
564cdf0e10cSrcweir else if ( Window *pClient = pWnd->GetWindow( WINDOW_CLIENT ) )
565cdf0e10cSrcweir if ( *(void**)pClient == *(void**)&maLbValue )
566cdf0e10cSrcweir bFindLst = true;
567cdf0e10cSrcweir }
568cdf0e10cSrcweir }
569cdf0e10cSrcweir
570cdf0e10cSrcweir if ( bFindLst )
571cdf0e10cSrcweir alstOrder.push_back( pWnd->GetWindow( WINDOW_CLIENT ) );
572cdf0e10cSrcweir }
573cdf0e10cSrcweir }while( NULL != ( pWnd = pWnd->GetWindow( WINDOW_NEXT ) ) );
574cdf0e10cSrcweir
575cdf0e10cSrcweir pWnd = GetChild(0);
576cdf0e10cSrcweir
577cdf0e10cSrcweir while( std::find( alstOrder.begin(), alstOrder.end(), pWnd ) != alstOrder.end() && NULL != ( pWnd = pWnd->GetWindow( WINDOW_NEXT) ) ) ;
578cdf0e10cSrcweir
579cdf0e10cSrcweir if ( pWnd )
580cdf0e10cSrcweir {
581cdf0e10cSrcweir for ( std::list<Window*>::iterator i = alstOrder.begin(); i!=alstOrder.end(); i++ )
582cdf0e10cSrcweir {
583cdf0e10cSrcweir Window *pParent = (*i)->GetParent();
584cdf0e10cSrcweir (*i)->SetParent( pWnd );
585cdf0e10cSrcweir (*i)->SetParent( pParent );
586cdf0e10cSrcweir }
587cdf0e10cSrcweir }
588cdf0e10cSrcweir }
589cdf0e10cSrcweir }
590cdf0e10cSrcweir
591cdf0e10cSrcweir IMPL_LINK( ScTPValidationValue, EditSetFocusHdl, Edit *, /*pEdit*/ )
592cdf0e10cSrcweir {
593cdf0e10cSrcweir sal_uInt16 nPos=maLbAllow.GetSelectEntryPos();
594cdf0e10cSrcweir
595cdf0e10cSrcweir if ( nPos == SC_VALIDDLG_ALLOW_RANGE )
596cdf0e10cSrcweir {
597cdf0e10cSrcweir SetupRefDlg();
598cdf0e10cSrcweir }
599cdf0e10cSrcweir
600cdf0e10cSrcweir return 0;
601cdf0e10cSrcweir }
602cdf0e10cSrcweir
IMPL_LINK(ScTPValidationValue,KillFocusHdl,Window *,pWnd)603cdf0e10cSrcweir IMPL_LINK( ScTPValidationValue, KillFocusHdl, Window *, pWnd )
604cdf0e10cSrcweir {
605cdf0e10cSrcweir if( pWnd == m_pRefEdit || pWnd == &m_btnRef )
606cdf0e10cSrcweir if( ScValidationDlg *pValidationDlg = GetValidationDlg() )
607cdf0e10cSrcweir if ( (pValidationDlg->IsActive() || pValidationDlg->IsChildFocus() ) && !pValidationDlg->IsRefInputting() )
608cdf0e10cSrcweir if( ( !m_pRefEdit || !m_pRefEdit->HasFocus()) && !m_btnRef.HasFocus() )
609cdf0e10cSrcweir {
610cdf0e10cSrcweir RemoveRefDlg();
611cdf0e10cSrcweir }
612cdf0e10cSrcweir
613cdf0e10cSrcweir return 0;
614cdf0e10cSrcweir }
615cdf0e10cSrcweir //-->Added by PengYunQuan for Validity Cell Range Picker
616cdf0e10cSrcweir
617cdf0e10cSrcweir // ----------------------------------------------------------------------------
618cdf0e10cSrcweir
IMPL_LINK(ScTPValidationValue,SelectHdl,ListBox *,EMPTYARG)619cdf0e10cSrcweir IMPL_LINK( ScTPValidationValue, SelectHdl, ListBox*, EMPTYARG )
620cdf0e10cSrcweir {
621cdf0e10cSrcweir sal_uInt16 nLbPos = maLbAllow.GetSelectEntryPos();
622cdf0e10cSrcweir bool bEnable = (nLbPos != SC_VALIDDLG_ALLOW_ANY);
623cdf0e10cSrcweir bool bRange = (nLbPos == SC_VALIDDLG_ALLOW_RANGE);
624cdf0e10cSrcweir bool bList = (nLbPos == SC_VALIDDLG_ALLOW_LIST);
625cdf0e10cSrcweir
626cdf0e10cSrcweir maCbAllow.Enable( bEnable ); // Leerzellen
627cdf0e10cSrcweir maFtValue.Enable( bEnable );
628cdf0e10cSrcweir maLbValue.Enable( bEnable );
629cdf0e10cSrcweir maFtMin.Enable( bEnable );
630cdf0e10cSrcweir maEdMin.Enable( bEnable );
631cdf0e10cSrcweir maEdList.Enable( bEnable );
632cdf0e10cSrcweir maFtMax.Enable( bEnable );
633cdf0e10cSrcweir maEdMax.Enable( bEnable );
634cdf0e10cSrcweir
635cdf0e10cSrcweir bool bShowMax = false;
636cdf0e10cSrcweir if( bRange )
637cdf0e10cSrcweir maFtMin.SetText( maStrRange );
638cdf0e10cSrcweir else if( bList )
639cdf0e10cSrcweir maFtMin.SetText( maStrList );
640cdf0e10cSrcweir else
641cdf0e10cSrcweir {
642cdf0e10cSrcweir switch( maLbValue.GetSelectEntryPos() )
643cdf0e10cSrcweir {
644cdf0e10cSrcweir case SC_VALIDDLG_DATA_EQUAL:
645cdf0e10cSrcweir case SC_VALIDDLG_DATA_NOTEQUAL: maFtMin.SetText( maStrValue ); break;
646cdf0e10cSrcweir
647cdf0e10cSrcweir case SC_VALIDDLG_DATA_LESS:
648cdf0e10cSrcweir case SC_VALIDDLG_DATA_EQLESS: maFtMin.SetText( maStrMax ); break;
649cdf0e10cSrcweir
650cdf0e10cSrcweir case SC_VALIDDLG_DATA_BETWEEN:
651cdf0e10cSrcweir case SC_VALIDDLG_DATA_NOTBETWEEN: bShowMax = true; // fall through
652cdf0e10cSrcweir case SC_VALIDDLG_DATA_GREATER:
653cdf0e10cSrcweir case SC_VALIDDLG_DATA_EQGREATER: maFtMin.SetText( maStrMin ); break;
654cdf0e10cSrcweir
655cdf0e10cSrcweir default:
656cdf0e10cSrcweir DBG_ERRORFILE( "ScTPValidationValue::SelectHdl - unknown condition mode" );
657cdf0e10cSrcweir }
658cdf0e10cSrcweir }
659cdf0e10cSrcweir
660cdf0e10cSrcweir maCbShow.Show( bRange || bList );
661cdf0e10cSrcweir maCbSort.Show( bRange || bList );
662cdf0e10cSrcweir maFtValue.Show( !bRange && !bList );
663cdf0e10cSrcweir maLbValue.Show( !bRange && !bList );
664cdf0e10cSrcweir maEdMin.Show( !bList );
665cdf0e10cSrcweir maEdList.Show( bList );
666cdf0e10cSrcweir maFtMax.Show( bShowMax );
667cdf0e10cSrcweir maEdMax.Show( bShowMax );
668cdf0e10cSrcweir maFtHint.Show( bRange );
669cdf0e10cSrcweir //<!--Added by PengYunQuan for Validity Cell Range Picker
670cdf0e10cSrcweir m_btnRef.Show( bRange );
671cdf0e10cSrcweir //-->Added by PengYunQuan for Validity Cell Range Picker
672cdf0e10cSrcweir return 0;
673cdf0e10cSrcweir }
674cdf0e10cSrcweir
IMPL_LINK(ScTPValidationValue,CheckHdl,CheckBox *,EMPTYARG)675cdf0e10cSrcweir IMPL_LINK( ScTPValidationValue, CheckHdl, CheckBox*, EMPTYARG )
676cdf0e10cSrcweir {
677cdf0e10cSrcweir maCbSort.Enable( maCbShow.IsChecked() );
678cdf0e10cSrcweir return 0;
679cdf0e10cSrcweir }
680cdf0e10cSrcweir
681cdf0e10cSrcweir
682cdf0e10cSrcweir //========================================================================
683cdf0e10cSrcweir //========================================================================
684cdf0e10cSrcweir // Input Help Page
685cdf0e10cSrcweir
ScTPValidationHelp(Window * pParent,const SfxItemSet & rArgSet)686cdf0e10cSrcweir ScTPValidationHelp::ScTPValidationHelp( Window* pParent,
687cdf0e10cSrcweir const SfxItemSet& rArgSet )
688cdf0e10cSrcweir
689cdf0e10cSrcweir : SfxTabPage ( pParent,
690cdf0e10cSrcweir ScResId( TP_VALIDATION_INPUTHELP ),
691cdf0e10cSrcweir rArgSet ),
692cdf0e10cSrcweir aTsbHelp ( this, ScResId( TSB_HELP ) ),
693cdf0e10cSrcweir aFlContent ( this, ScResId( FL_CONTENT ) ),
694cdf0e10cSrcweir aFtTitle ( this, ScResId( FT_TITLE ) ),
695cdf0e10cSrcweir aEdtTitle ( this, ScResId( EDT_TITLE ) ),
696cdf0e10cSrcweir aFtInputHelp ( this, ScResId( FT_INPUTHELP ) ),
697cdf0e10cSrcweir aEdInputHelp ( this, ScResId( EDT_INPUTHELP ) ),
698cdf0e10cSrcweir
699cdf0e10cSrcweir mrArgSet ( rArgSet )
700cdf0e10cSrcweir {
701cdf0e10cSrcweir Init();
702cdf0e10cSrcweir FreeResource();
703cdf0e10cSrcweir }
704cdf0e10cSrcweir
705cdf0e10cSrcweir // -----------------------------------------------------------------------
706cdf0e10cSrcweir
~ScTPValidationHelp()707cdf0e10cSrcweir __EXPORT ScTPValidationHelp::~ScTPValidationHelp()
708cdf0e10cSrcweir {
709cdf0e10cSrcweir }
710cdf0e10cSrcweir
711cdf0e10cSrcweir // -----------------------------------------------------------------------
712cdf0e10cSrcweir
Init()713cdf0e10cSrcweir void ScTPValidationHelp::Init()
714cdf0e10cSrcweir {
715cdf0e10cSrcweir //aLb.SetSelectHdl( LINK( this, ScTPValidationHelp, SelectHdl ) );
716cdf0e10cSrcweir
717cdf0e10cSrcweir aTsbHelp.EnableTriState( sal_False );
718cdf0e10cSrcweir }
719cdf0e10cSrcweir
720cdf0e10cSrcweir //------------------------------------------------------------------------
721cdf0e10cSrcweir
GetRanges()722cdf0e10cSrcweir sal_uInt16* __EXPORT ScTPValidationHelp::GetRanges()
723cdf0e10cSrcweir {
724cdf0e10cSrcweir return pValueRanges;
725cdf0e10cSrcweir }
726cdf0e10cSrcweir
727cdf0e10cSrcweir // -----------------------------------------------------------------------
728cdf0e10cSrcweir
Create(Window * pParent,const SfxItemSet & rArgSet)729cdf0e10cSrcweir SfxTabPage* __EXPORT ScTPValidationHelp::Create( Window* pParent,
730cdf0e10cSrcweir const SfxItemSet& rArgSet )
731cdf0e10cSrcweir {
732cdf0e10cSrcweir return ( new ScTPValidationHelp( pParent, rArgSet ) );
733cdf0e10cSrcweir }
734cdf0e10cSrcweir
735cdf0e10cSrcweir // -----------------------------------------------------------------------
736cdf0e10cSrcweir
Reset(const SfxItemSet & rArgSet)737cdf0e10cSrcweir void __EXPORT ScTPValidationHelp::Reset( const SfxItemSet& rArgSet )
738cdf0e10cSrcweir {
739cdf0e10cSrcweir const SfxPoolItem* pItem;
740cdf0e10cSrcweir
741cdf0e10cSrcweir if ( rArgSet.GetItemState( FID_VALID_SHOWHELP, sal_True, &pItem ) == SFX_ITEM_SET )
742cdf0e10cSrcweir aTsbHelp.SetState( ((const SfxBoolItem*)pItem)->GetValue() ? STATE_CHECK : STATE_NOCHECK );
743cdf0e10cSrcweir else
744cdf0e10cSrcweir aTsbHelp.SetState( STATE_NOCHECK );
745cdf0e10cSrcweir
746cdf0e10cSrcweir if ( rArgSet.GetItemState( FID_VALID_HELPTITLE, sal_True, &pItem ) == SFX_ITEM_SET )
747cdf0e10cSrcweir aEdtTitle.SetText( ((const SfxStringItem*)pItem)->GetValue() );
748cdf0e10cSrcweir else
749cdf0e10cSrcweir aEdtTitle.SetText( EMPTY_STRING );
750cdf0e10cSrcweir
751cdf0e10cSrcweir if ( rArgSet.GetItemState( FID_VALID_HELPTEXT, sal_True, &pItem ) == SFX_ITEM_SET )
752cdf0e10cSrcweir aEdInputHelp.SetText( ((const SfxStringItem*)pItem)->GetValue() );
753cdf0e10cSrcweir else
754cdf0e10cSrcweir aEdInputHelp.SetText( EMPTY_STRING );
755cdf0e10cSrcweir }
756cdf0e10cSrcweir
757cdf0e10cSrcweir // -----------------------------------------------------------------------
758cdf0e10cSrcweir
FillItemSet(SfxItemSet & rArgSet)759cdf0e10cSrcweir sal_Bool __EXPORT ScTPValidationHelp::FillItemSet( SfxItemSet& rArgSet )
760cdf0e10cSrcweir {
761cdf0e10cSrcweir rArgSet.Put( SfxBoolItem( FID_VALID_SHOWHELP, aTsbHelp.GetState() == STATE_CHECK ) );
762cdf0e10cSrcweir rArgSet.Put( SfxStringItem( FID_VALID_HELPTITLE, aEdtTitle.GetText() ) );
763cdf0e10cSrcweir rArgSet.Put( SfxStringItem( FID_VALID_HELPTEXT, aEdInputHelp.GetText() ) );
764cdf0e10cSrcweir
765cdf0e10cSrcweir return sal_True;
766cdf0e10cSrcweir }
767cdf0e10cSrcweir
768cdf0e10cSrcweir //========================================================================
769cdf0e10cSrcweir //========================================================================
770cdf0e10cSrcweir // Error Alert Page
771cdf0e10cSrcweir
ScTPValidationError(Window * pParent,const SfxItemSet & rArgSet)772cdf0e10cSrcweir ScTPValidationError::ScTPValidationError( Window* pParent,
773cdf0e10cSrcweir const SfxItemSet& rArgSet )
774cdf0e10cSrcweir
775cdf0e10cSrcweir : SfxTabPage ( pParent,
776cdf0e10cSrcweir ScResId( TP_VALIDATION_ERROR ),
777cdf0e10cSrcweir rArgSet ),
778cdf0e10cSrcweir aTsbShow ( this, ScResId( TSB_SHOW ) ),
779cdf0e10cSrcweir aFlContent ( this, ScResId( FL_CONTENT ) ),
780cdf0e10cSrcweir aFtAction ( this, ScResId( FT_ACTION ) ),
781cdf0e10cSrcweir aLbAction ( this, ScResId( LB_ACTION ) ),
782cdf0e10cSrcweir aBtnSearch ( this, ScResId( BTN_SEARCH ) ),
783cdf0e10cSrcweir aFtTitle ( this, ScResId( FT_TITLE ) ),
784cdf0e10cSrcweir aEdtTitle ( this, ScResId( EDT_TITLE ) ),
785cdf0e10cSrcweir aFtError ( this, ScResId( FT_ERROR ) ),
786cdf0e10cSrcweir aEdError ( this, ScResId( EDT_ERROR ) ),
787cdf0e10cSrcweir
788cdf0e10cSrcweir mrArgSet ( rArgSet )
789cdf0e10cSrcweir {
790cdf0e10cSrcweir Init();
791cdf0e10cSrcweir FreeResource();
792cdf0e10cSrcweir }
793cdf0e10cSrcweir
794cdf0e10cSrcweir // -----------------------------------------------------------------------
795cdf0e10cSrcweir
~ScTPValidationError()796cdf0e10cSrcweir __EXPORT ScTPValidationError::~ScTPValidationError()
797cdf0e10cSrcweir {
798cdf0e10cSrcweir }
799cdf0e10cSrcweir
800cdf0e10cSrcweir // -----------------------------------------------------------------------
801cdf0e10cSrcweir
Init()802cdf0e10cSrcweir void ScTPValidationError::Init()
803cdf0e10cSrcweir {
804cdf0e10cSrcweir aLbAction.SetSelectHdl( LINK( this, ScTPValidationError, SelectActionHdl ) );
805cdf0e10cSrcweir aBtnSearch.SetClickHdl( LINK( this, ScTPValidationError, ClickSearchHdl ) );
806cdf0e10cSrcweir
807cdf0e10cSrcweir aLbAction.SelectEntryPos( 0 );
808cdf0e10cSrcweir aTsbShow.EnableTriState( sal_False );
809cdf0e10cSrcweir
810cdf0e10cSrcweir SelectActionHdl( NULL );
811cdf0e10cSrcweir }
812cdf0e10cSrcweir
813cdf0e10cSrcweir //------------------------------------------------------------------------
814cdf0e10cSrcweir
GetRanges()815cdf0e10cSrcweir sal_uInt16* __EXPORT ScTPValidationError::GetRanges()
816cdf0e10cSrcweir {
817cdf0e10cSrcweir return pValueRanges;
818cdf0e10cSrcweir }
819cdf0e10cSrcweir
820cdf0e10cSrcweir // -----------------------------------------------------------------------
821cdf0e10cSrcweir
Create(Window * pParent,const SfxItemSet & rArgSet)822cdf0e10cSrcweir SfxTabPage* __EXPORT ScTPValidationError::Create( Window* pParent,
823cdf0e10cSrcweir const SfxItemSet& rArgSet )
824cdf0e10cSrcweir {
825cdf0e10cSrcweir return ( new ScTPValidationError( pParent, rArgSet ) );
826cdf0e10cSrcweir }
827cdf0e10cSrcweir
828cdf0e10cSrcweir // -----------------------------------------------------------------------
829cdf0e10cSrcweir
Reset(const SfxItemSet & rArgSet)830cdf0e10cSrcweir void __EXPORT ScTPValidationError::Reset( const SfxItemSet& rArgSet )
831cdf0e10cSrcweir {
832cdf0e10cSrcweir const SfxPoolItem* pItem;
833cdf0e10cSrcweir
834cdf0e10cSrcweir if ( rArgSet.GetItemState( FID_VALID_SHOWERR, sal_True, &pItem ) == SFX_ITEM_SET )
835cdf0e10cSrcweir aTsbShow.SetState( ((const SfxBoolItem*)pItem)->GetValue() ? STATE_CHECK : STATE_NOCHECK );
836cdf0e10cSrcweir else
837cdf0e10cSrcweir aTsbShow.SetState( STATE_CHECK ); // #111720# check by default
838cdf0e10cSrcweir
839cdf0e10cSrcweir if ( rArgSet.GetItemState( FID_VALID_ERRSTYLE, sal_True, &pItem ) == SFX_ITEM_SET )
840cdf0e10cSrcweir aLbAction.SelectEntryPos( ((const SfxAllEnumItem*)pItem)->GetValue() );
841cdf0e10cSrcweir else
842cdf0e10cSrcweir aLbAction.SelectEntryPos( 0 );
843cdf0e10cSrcweir
844cdf0e10cSrcweir if ( rArgSet.GetItemState( FID_VALID_ERRTITLE, sal_True, &pItem ) == SFX_ITEM_SET )
845cdf0e10cSrcweir aEdtTitle.SetText( ((const SfxStringItem*)pItem)->GetValue() );
846cdf0e10cSrcweir else
847cdf0e10cSrcweir aEdtTitle.SetText( EMPTY_STRING );
848cdf0e10cSrcweir
849cdf0e10cSrcweir if ( rArgSet.GetItemState( FID_VALID_ERRTEXT, sal_True, &pItem ) == SFX_ITEM_SET )
850cdf0e10cSrcweir aEdError.SetText( ((const SfxStringItem*)pItem)->GetValue() );
851cdf0e10cSrcweir else
852cdf0e10cSrcweir aEdError.SetText( EMPTY_STRING );
853cdf0e10cSrcweir
854cdf0e10cSrcweir SelectActionHdl( NULL );
855cdf0e10cSrcweir }
856cdf0e10cSrcweir
857cdf0e10cSrcweir // -----------------------------------------------------------------------
858cdf0e10cSrcweir
FillItemSet(SfxItemSet & rArgSet)859cdf0e10cSrcweir sal_Bool __EXPORT ScTPValidationError::FillItemSet( SfxItemSet& rArgSet )
860cdf0e10cSrcweir {
861cdf0e10cSrcweir rArgSet.Put( SfxBoolItem( FID_VALID_SHOWERR, aTsbShow.GetState() == STATE_CHECK ) );
862cdf0e10cSrcweir rArgSet.Put( SfxAllEnumItem( FID_VALID_ERRSTYLE, aLbAction.GetSelectEntryPos() ) );
863cdf0e10cSrcweir rArgSet.Put( SfxStringItem( FID_VALID_ERRTITLE, aEdtTitle.GetText() ) );
864cdf0e10cSrcweir rArgSet.Put( SfxStringItem( FID_VALID_ERRTEXT, aEdError.GetText() ) );
865cdf0e10cSrcweir
866cdf0e10cSrcweir return sal_True;
867cdf0e10cSrcweir }
868cdf0e10cSrcweir
869cdf0e10cSrcweir // -----------------------------------------------------------------------
870cdf0e10cSrcweir
IMPL_LINK(ScTPValidationError,SelectActionHdl,ListBox *,EMPTYARG)871cdf0e10cSrcweir IMPL_LINK( ScTPValidationError, SelectActionHdl, ListBox*, EMPTYARG )
872cdf0e10cSrcweir {
873cdf0e10cSrcweir ScValidErrorStyle eStyle = (ScValidErrorStyle) aLbAction.GetSelectEntryPos();
874cdf0e10cSrcweir sal_Bool bMacro = ( eStyle == SC_VALERR_MACRO );
875cdf0e10cSrcweir
876cdf0e10cSrcweir aBtnSearch.Enable( bMacro );
877cdf0e10cSrcweir aFtError.Enable( !bMacro );
878cdf0e10cSrcweir aEdError.Enable( !bMacro );
879cdf0e10cSrcweir
880cdf0e10cSrcweir return( 0L );
881cdf0e10cSrcweir }
882cdf0e10cSrcweir
883cdf0e10cSrcweir // -----------------------------------------------------------------------
884cdf0e10cSrcweir
IMPL_LINK(ScTPValidationError,ClickSearchHdl,PushButton *,EMPTYARG)885cdf0e10cSrcweir IMPL_LINK( ScTPValidationError, ClickSearchHdl, PushButton*, EMPTYARG )
886cdf0e10cSrcweir {
887cdf0e10cSrcweir Window* pOld = Application::GetDefDialogParent();
888cdf0e10cSrcweir Application::SetDefDialogParent( this );
889cdf0e10cSrcweir
890cdf0e10cSrcweir // Use static SfxApplication method to bring up selector dialog for
891cdf0e10cSrcweir // choosing a script
892cdf0e10cSrcweir ::rtl::OUString aScriptURL = SfxApplication::ChooseScript();
893cdf0e10cSrcweir
894cdf0e10cSrcweir Application::SetDefDialogParent( pOld );
895cdf0e10cSrcweir
896cdf0e10cSrcweir if ( aScriptURL != NULL && aScriptURL.getLength() != 0 )
897cdf0e10cSrcweir {
898cdf0e10cSrcweir aEdtTitle.SetText( aScriptURL );
899cdf0e10cSrcweir }
900cdf0e10cSrcweir
901cdf0e10cSrcweir return( 0L );
902cdf0e10cSrcweir }
903cdf0e10cSrcweir
904cdf0e10cSrcweir //<!--Added by PengYunQuan for Validity Cell Range Picker
EnterRefStatus()905cdf0e10cSrcweir bool ScValidationDlg::EnterRefStatus()
906cdf0e10cSrcweir {
907cdf0e10cSrcweir ScTabViewShell *pTabViewShell = GetTabViewShell();
908cdf0e10cSrcweir
909cdf0e10cSrcweir if( !pTabViewShell ) return false;
910cdf0e10cSrcweir
911cdf0e10cSrcweir sal_uInt16 nId = SLOTID;
912cdf0e10cSrcweir SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
913cdf0e10cSrcweir SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
914cdf0e10cSrcweir
915cdf0e10cSrcweir if ( pWnd && pWnd->GetWindow()!= this ) pWnd = NULL;
916cdf0e10cSrcweir
917cdf0e10cSrcweir SC_MOD()->SetRefDialog( nId, pWnd ? sal_False : sal_True );
918cdf0e10cSrcweir
919cdf0e10cSrcweir return true;
920cdf0e10cSrcweir }
921cdf0e10cSrcweir
LeaveRefStatus()922cdf0e10cSrcweir bool ScValidationDlg::LeaveRefStatus()
923cdf0e10cSrcweir {
924cdf0e10cSrcweir ScTabViewShell *pTabViewShell = GetTabViewShell();
925cdf0e10cSrcweir
926cdf0e10cSrcweir if( !pTabViewShell ) return false;
927cdf0e10cSrcweir
928cdf0e10cSrcweir sal_uInt16 nId = SLOTID;
929cdf0e10cSrcweir SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
930cdf0e10cSrcweir //SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
931cdf0e10cSrcweir if ( pViewFrm->GetChildWindow( nId ) )
932cdf0e10cSrcweir {
933cdf0e10cSrcweir DoClose( nId );
934cdf0e10cSrcweir }
935cdf0e10cSrcweir return true;
936cdf0e10cSrcweir }
937cdf0e10cSrcweir
SetupRefDlg()938cdf0e10cSrcweir bool ScValidationDlg::SetupRefDlg()
939cdf0e10cSrcweir {
940cdf0e10cSrcweir if ( m_bOwnRefHdlr ) return false;
941cdf0e10cSrcweir if( EnterRefMode() )
942cdf0e10cSrcweir {
943cdf0e10cSrcweir SetModal( sal_False );
944cdf0e10cSrcweir return /*SetChkShell( GetDocShell() ),*/ m_bOwnRefHdlr = true && EnterRefStatus();
945cdf0e10cSrcweir }
946cdf0e10cSrcweir
947cdf0e10cSrcweir return false;
948cdf0e10cSrcweir }
949cdf0e10cSrcweir
RemoveRefDlg(sal_Bool bRestoreModal)950cdf0e10cSrcweir bool ScValidationDlg::RemoveRefDlg( sal_Bool bRestoreModal /* = sal_True */ )
951cdf0e10cSrcweir {
952cdf0e10cSrcweir bool bVisLock = false;
953cdf0e10cSrcweir bool bFreeWindowLock = false;
954cdf0e10cSrcweir
955cdf0e10cSrcweir ScTabViewShell *pTabVwSh = GetTabViewShell();
956cdf0e10cSrcweir
957cdf0e10cSrcweir if( !pTabVwSh ) return false;
958cdf0e10cSrcweir
959cdf0e10cSrcweir if ( SfxChildWindow* pWnd = pTabVwSh->GetViewFrame()->GetChildWindow( SID_VALIDITY_REFERENCE ) )
960cdf0e10cSrcweir {
961cdf0e10cSrcweir bVisLock = static_cast<ScValidityRefChildWin*>(pWnd)->LockVisible( true );
962cdf0e10cSrcweir bFreeWindowLock = static_cast<ScValidityRefChildWin*>(pWnd)->LockFreeWindow( true );
963cdf0e10cSrcweir }
964cdf0e10cSrcweir
965cdf0e10cSrcweir if ( !m_bOwnRefHdlr ) return false;
966cdf0e10cSrcweir if( LeaveRefStatus() && LeaveRefMode() )
967cdf0e10cSrcweir {
968cdf0e10cSrcweir m_bOwnRefHdlr = false;
969cdf0e10cSrcweir
970cdf0e10cSrcweir if( bRestoreModal )
971cdf0e10cSrcweir SetModal( sal_True );
972cdf0e10cSrcweir }
973cdf0e10cSrcweir
974cdf0e10cSrcweir if ( SfxChildWindow* pWnd = pTabVwSh->GetViewFrame()->GetChildWindow( SID_VALIDITY_REFERENCE ) )
975cdf0e10cSrcweir {
976cdf0e10cSrcweir static_cast<ScValidityRefChildWin*>(pWnd)->LockVisible( bVisLock );
977cdf0e10cSrcweir static_cast<ScValidityRefChildWin*>(pWnd)->LockFreeWindow( bFreeWindowLock );
978cdf0e10cSrcweir }
979cdf0e10cSrcweir
980cdf0e10cSrcweir return true;
981cdf0e10cSrcweir }
982cdf0e10cSrcweir
983cdf0e10cSrcweir //TYPEINIT1( ScTPValidationValue, SfxTabPage )
984cdf0e10cSrcweir
Click()985cdf0e10cSrcweir void ScTPValidationValue::ScRefButtonEx::Click()
986cdf0e10cSrcweir {
987cdf0e10cSrcweir if( ScTPValidationValue *pParent = dynamic_cast< ScTPValidationValue*>( GetParent() ) )
988cdf0e10cSrcweir pParent->OnClick( this );
989cdf0e10cSrcweir
990cdf0e10cSrcweir ScRefButton::Click();
991cdf0e10cSrcweir }
992cdf0e10cSrcweir
OnClick(Button * pBtn)993cdf0e10cSrcweir void ScTPValidationValue::OnClick( Button *pBtn )
994cdf0e10cSrcweir {
995cdf0e10cSrcweir if( pBtn == &m_btnRef )
996cdf0e10cSrcweir SetupRefDlg();
997cdf0e10cSrcweir }
998cdf0e10cSrcweir
IsChildFocus()999cdf0e10cSrcweir sal_Bool ScValidationDlg::IsChildFocus()
1000cdf0e10cSrcweir {
1001cdf0e10cSrcweir if ( const Window *pWin = Application::GetFocusWindow() )
1002cdf0e10cSrcweir while( NULL != ( pWin = pWin->GetParent() ) )
1003cdf0e10cSrcweir if( pWin == this )
1004cdf0e10cSrcweir return sal_True;
1005cdf0e10cSrcweir
1006cdf0e10cSrcweir return sal_False;
1007cdf0e10cSrcweir }
1008cdf0e10cSrcweir
1009cdf0e10cSrcweir
IsAlive()1010cdf0e10cSrcweir bool ScValidationDlg::IsAlive()
1011cdf0e10cSrcweir {
1012cdf0e10cSrcweir return SC_MOD()->IsAliveRefDlg( SLOTID, this );
1013cdf0e10cSrcweir }
1014cdf0e10cSrcweir //-->Added by PengYunQuan for Validity Cell Range Picker
1015