1*b3f79822SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*b3f79822SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*b3f79822SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*b3f79822SAndrew Rist * distributed with this work for additional information
6*b3f79822SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*b3f79822SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*b3f79822SAndrew Rist * "License"); you may not use this file except in compliance
9*b3f79822SAndrew Rist * with the License. You may obtain a copy of the License at
10*b3f79822SAndrew Rist *
11*b3f79822SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*b3f79822SAndrew Rist *
13*b3f79822SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*b3f79822SAndrew Rist * software distributed under the License is distributed on an
15*b3f79822SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b3f79822SAndrew Rist * KIND, either express or implied. See the License for the
17*b3f79822SAndrew Rist * specific language governing permissions and limitations
18*b3f79822SAndrew Rist * under the License.
19*b3f79822SAndrew Rist *
20*b3f79822SAndrew Rist *************************************************************/
21*b3f79822SAndrew Rist
22*b3f79822SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sc.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir
28cdf0e10cSrcweir
29cdf0e10cSrcweir #include <tools/debug.hxx>
30cdf0e10cSrcweir #include <rtl/uuid.h>
31cdf0e10cSrcweir
32cdf0e10cSrcweir #include <com/sun/star/sheet/ValidationAlertStyle.hpp>
33cdf0e10cSrcweir #include <com/sun/star/sheet/ValidationType.hpp>
34cdf0e10cSrcweir #include <com/sun/star/sheet/TableValidationVisibility.hpp>
35cdf0e10cSrcweir
36cdf0e10cSrcweir #include "fmtuno.hxx"
37cdf0e10cSrcweir #include "miscuno.hxx"
38cdf0e10cSrcweir #include "validat.hxx"
39cdf0e10cSrcweir #include "document.hxx"
40cdf0e10cSrcweir #include "unoguard.hxx"
41cdf0e10cSrcweir #include "unonames.hxx"
42cdf0e10cSrcweir #include "styleuno.hxx" // ScStyleNameConversion
43cdf0e10cSrcweir #include "tokenarray.hxx"
44cdf0e10cSrcweir #include "tokenuno.hxx"
45cdf0e10cSrcweir
46cdf0e10cSrcweir using namespace ::com::sun::star;
47cdf0e10cSrcweir using namespace ::formula;
48cdf0e10cSrcweir
49cdf0e10cSrcweir //------------------------------------------------------------------------
50cdf0e10cSrcweir
51cdf0e10cSrcweir // Map nur fuer PropertySetInfo
52cdf0e10cSrcweir
lcl_GetValidatePropertyMap()53cdf0e10cSrcweir const SfxItemPropertyMapEntry* lcl_GetValidatePropertyMap()
54cdf0e10cSrcweir {
55cdf0e10cSrcweir static SfxItemPropertyMapEntry aValidatePropertyMap_Impl[] =
56cdf0e10cSrcweir {
57cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ERRALSTY), 0, &getCppuType((sheet::ValidationAlertStyle*)0), 0, 0},
58cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ERRMESS), 0, &getCppuType((rtl::OUString*)0), 0, 0},
59cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_ERRTITLE), 0, &getCppuType((rtl::OUString*)0), 0, 0},
60cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_IGNOREBL), 0, &getBooleanCppuType(), 0, 0},
61cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_INPMESS), 0, &getCppuType((rtl::OUString*)0), 0, 0},
62cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_INPTITLE), 0, &getCppuType((rtl::OUString*)0), 0, 0},
63cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SHOWERR), 0, &getBooleanCppuType(), 0, 0},
64cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SHOWINP), 0, &getBooleanCppuType(), 0, 0},
65cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_SHOWLIST), 0, &getCppuType((sal_Int16*)0), 0, 0},
66cdf0e10cSrcweir {MAP_CHAR_LEN(SC_UNONAME_TYPE), 0, &getCppuType((sheet::ValidationType*)0), 0, 0},
67cdf0e10cSrcweir {0,0,0,0,0,0}
68cdf0e10cSrcweir };
69cdf0e10cSrcweir return aValidatePropertyMap_Impl;
70cdf0e10cSrcweir }
71cdf0e10cSrcweir
72cdf0e10cSrcweir //------------------------------------------------------------------------
73cdf0e10cSrcweir
74cdf0e10cSrcweir SC_SIMPLE_SERVICE_INFO( ScTableConditionalEntry, "ScTableConditionalEntry", "com.sun.star.sheet.TableConditionalEntry" )
75cdf0e10cSrcweir SC_SIMPLE_SERVICE_INFO( ScTableConditionalFormat, "ScTableConditionalFormat", "com.sun.star.sheet.TableConditionalFormat" )
76cdf0e10cSrcweir SC_SIMPLE_SERVICE_INFO( ScTableValidationObj, "ScTableValidationObj", "com.sun.star.sheet.TableValidation" )
77cdf0e10cSrcweir
78cdf0e10cSrcweir //------------------------------------------------------------------------
79cdf0e10cSrcweir
lcl_ConditionModeToOperator(ScConditionMode eMode)80cdf0e10cSrcweir sheet::ConditionOperator lcl_ConditionModeToOperator( ScConditionMode eMode )
81cdf0e10cSrcweir {
82cdf0e10cSrcweir sheet::ConditionOperator eOper = sheet::ConditionOperator_NONE;
83cdf0e10cSrcweir switch (eMode)
84cdf0e10cSrcweir {
85cdf0e10cSrcweir case SC_COND_EQUAL: eOper = sheet::ConditionOperator_EQUAL; break;
86cdf0e10cSrcweir case SC_COND_LESS: eOper = sheet::ConditionOperator_LESS; break;
87cdf0e10cSrcweir case SC_COND_GREATER: eOper = sheet::ConditionOperator_GREATER; break;
88cdf0e10cSrcweir case SC_COND_EQLESS: eOper = sheet::ConditionOperator_LESS_EQUAL; break;
89cdf0e10cSrcweir case SC_COND_EQGREATER: eOper = sheet::ConditionOperator_GREATER_EQUAL; break;
90cdf0e10cSrcweir case SC_COND_NOTEQUAL: eOper = sheet::ConditionOperator_NOT_EQUAL; break;
91cdf0e10cSrcweir case SC_COND_BETWEEN: eOper = sheet::ConditionOperator_BETWEEN; break;
92cdf0e10cSrcweir case SC_COND_NOTBETWEEN: eOper = sheet::ConditionOperator_NOT_BETWEEN; break;
93cdf0e10cSrcweir case SC_COND_DIRECT: eOper = sheet::ConditionOperator_FORMULA; break;
94cdf0e10cSrcweir default:
95cdf0e10cSrcweir {
96cdf0e10cSrcweir // added to avoid warnings
97cdf0e10cSrcweir }
98cdf0e10cSrcweir }
99cdf0e10cSrcweir return eOper;
100cdf0e10cSrcweir }
101cdf0e10cSrcweir
lcl_ConditionOperatorToMode(sheet::ConditionOperator eOper)102cdf0e10cSrcweir ScConditionMode lcl_ConditionOperatorToMode( sheet::ConditionOperator eOper )
103cdf0e10cSrcweir {
104cdf0e10cSrcweir ScConditionMode eMode = SC_COND_NONE;
105cdf0e10cSrcweir switch (eOper)
106cdf0e10cSrcweir {
107cdf0e10cSrcweir case sheet::ConditionOperator_EQUAL: eMode = SC_COND_EQUAL; break;
108cdf0e10cSrcweir case sheet::ConditionOperator_LESS: eMode = SC_COND_LESS; break;
109cdf0e10cSrcweir case sheet::ConditionOperator_GREATER: eMode = SC_COND_GREATER; break;
110cdf0e10cSrcweir case sheet::ConditionOperator_LESS_EQUAL: eMode = SC_COND_EQLESS; break;
111cdf0e10cSrcweir case sheet::ConditionOperator_GREATER_EQUAL: eMode = SC_COND_EQGREATER; break;
112cdf0e10cSrcweir case sheet::ConditionOperator_NOT_EQUAL: eMode = SC_COND_NOTEQUAL; break;
113cdf0e10cSrcweir case sheet::ConditionOperator_BETWEEN: eMode = SC_COND_BETWEEN; break;
114cdf0e10cSrcweir case sheet::ConditionOperator_NOT_BETWEEN: eMode = SC_COND_NOTBETWEEN; break;
115cdf0e10cSrcweir case sheet::ConditionOperator_FORMULA: eMode = SC_COND_DIRECT; break;
116cdf0e10cSrcweir default:
117cdf0e10cSrcweir {
118cdf0e10cSrcweir // added to avoid warnings
119cdf0e10cSrcweir }
120cdf0e10cSrcweir }
121cdf0e10cSrcweir return eMode;
122cdf0e10cSrcweir }
123cdf0e10cSrcweir
124cdf0e10cSrcweir //------------------------------------------------------------------------
125cdf0e10cSrcweir
ScCondFormatEntryItem()126cdf0e10cSrcweir ScCondFormatEntryItem::ScCondFormatEntryItem() :
127cdf0e10cSrcweir meGrammar1( FormulaGrammar::GRAM_UNSPECIFIED ),
128cdf0e10cSrcweir meGrammar2( FormulaGrammar::GRAM_UNSPECIFIED ),
129cdf0e10cSrcweir meMode( SC_COND_NONE )
130cdf0e10cSrcweir {
131cdf0e10cSrcweir }
132cdf0e10cSrcweir
133cdf0e10cSrcweir //------------------------------------------------------------------------
134cdf0e10cSrcweir
ScTableConditionalFormat(ScDocument * pDoc,sal_uLong nKey,FormulaGrammar::Grammar eGrammar)135cdf0e10cSrcweir ScTableConditionalFormat::ScTableConditionalFormat(
136cdf0e10cSrcweir ScDocument* pDoc, sal_uLong nKey, FormulaGrammar::Grammar eGrammar)
137cdf0e10cSrcweir {
138cdf0e10cSrcweir // Eintrag aus dem Dokument lesen...
139cdf0e10cSrcweir
140cdf0e10cSrcweir if ( pDoc && nKey )
141cdf0e10cSrcweir {
142cdf0e10cSrcweir ScConditionalFormatList* pList = pDoc->GetCondFormList();
143cdf0e10cSrcweir if (pList)
144cdf0e10cSrcweir {
145cdf0e10cSrcweir const ScConditionalFormat* pFormat = pList->GetFormat( nKey );
146cdf0e10cSrcweir if (pFormat)
147cdf0e10cSrcweir {
148cdf0e10cSrcweir // During save to XML.
149cdf0e10cSrcweir if (pDoc->IsInExternalReferenceMarking())
150cdf0e10cSrcweir pFormat->MarkUsedExternalReferences();
151cdf0e10cSrcweir
152cdf0e10cSrcweir sal_uInt16 nEntryCount = pFormat->Count();
153cdf0e10cSrcweir for (sal_uInt16 i=0; i<nEntryCount; i++)
154cdf0e10cSrcweir {
155cdf0e10cSrcweir ScCondFormatEntryItem aItem;
156cdf0e10cSrcweir const ScCondFormatEntry* pFormatEntry = pFormat->GetEntry(i);
157cdf0e10cSrcweir aItem.meMode = pFormatEntry->GetOperation();
158cdf0e10cSrcweir aItem.maPos = pFormatEntry->GetValidSrcPos();
159cdf0e10cSrcweir aItem.maExpr1 = pFormatEntry->GetExpression(aItem.maPos, 0, 0, eGrammar);
160cdf0e10cSrcweir aItem.maExpr2 = pFormatEntry->GetExpression(aItem.maPos, 1, 0, eGrammar);
161cdf0e10cSrcweir aItem.meGrammar1 = aItem.meGrammar2 = eGrammar;
162cdf0e10cSrcweir aItem.maStyle = pFormatEntry->GetStyle();
163cdf0e10cSrcweir
164cdf0e10cSrcweir AddEntry_Impl(aItem);
165cdf0e10cSrcweir }
166cdf0e10cSrcweir }
167cdf0e10cSrcweir }
168cdf0e10cSrcweir }
169cdf0e10cSrcweir }
170cdf0e10cSrcweir
171cdf0e10cSrcweir namespace {
172cdf0e10cSrcweir
lclResolveGrammar(FormulaGrammar::Grammar eExtGrammar,FormulaGrammar::Grammar eIntGrammar)173cdf0e10cSrcweir FormulaGrammar::Grammar lclResolveGrammar( FormulaGrammar::Grammar eExtGrammar, FormulaGrammar::Grammar eIntGrammar )
174cdf0e10cSrcweir {
175cdf0e10cSrcweir if( eExtGrammar != FormulaGrammar::GRAM_UNSPECIFIED )
176cdf0e10cSrcweir return eExtGrammar;
177cdf0e10cSrcweir OSL_ENSURE( eIntGrammar != FormulaGrammar::GRAM_UNSPECIFIED, "lclResolveGrammar - unspecified grammar, using GRAM_PODF_A1" );
178cdf0e10cSrcweir return (eIntGrammar == FormulaGrammar::GRAM_UNSPECIFIED) ? FormulaGrammar::GRAM_PODF_A1 : eIntGrammar;
179cdf0e10cSrcweir }
180cdf0e10cSrcweir
181cdf0e10cSrcweir } // namespace
182cdf0e10cSrcweir
FillFormat(ScConditionalFormat & rFormat,ScDocument * pDoc,FormulaGrammar::Grammar eGrammar) const183cdf0e10cSrcweir void ScTableConditionalFormat::FillFormat( ScConditionalFormat& rFormat,
184cdf0e10cSrcweir ScDocument* pDoc, FormulaGrammar::Grammar eGrammar) const
185cdf0e10cSrcweir {
186cdf0e10cSrcweir // ScConditionalFormat = Core-Struktur, muss leer sein
187cdf0e10cSrcweir
188cdf0e10cSrcweir DBG_ASSERT( rFormat.IsEmpty(), "FillFormat: Format nicht leer" );
189cdf0e10cSrcweir sal_uInt16 nCount = (sal_uInt16)aEntries.Count();
190cdf0e10cSrcweir for (sal_uInt16 i=0; i<nCount; i++)
191cdf0e10cSrcweir {
192cdf0e10cSrcweir ScTableConditionalEntry* pEntry = (ScTableConditionalEntry*)aEntries.GetObject(i);
193cdf0e10cSrcweir if ( !pEntry )
194cdf0e10cSrcweir continue;
195cdf0e10cSrcweir
196cdf0e10cSrcweir ScCondFormatEntryItem aData;
197cdf0e10cSrcweir pEntry->GetData(aData);
198cdf0e10cSrcweir
199cdf0e10cSrcweir FormulaGrammar::Grammar eGrammar1 = lclResolveGrammar( eGrammar, aData.meGrammar1 );
200cdf0e10cSrcweir FormulaGrammar::Grammar eGrammar2 = lclResolveGrammar( eGrammar, aData.meGrammar2 );
201cdf0e10cSrcweir
202cdf0e10cSrcweir ScCondFormatEntry aCoreEntry( aData.meMode, aData.maExpr1, aData.maExpr2,
203cdf0e10cSrcweir pDoc, aData.maPos, aData.maStyle, aData.maExprNmsp1, aData.maExprNmsp2, eGrammar1, eGrammar2 );
204cdf0e10cSrcweir
205cdf0e10cSrcweir if ( aData.maPosStr.Len() )
206cdf0e10cSrcweir aCoreEntry.SetSrcString( aData.maPosStr );
207cdf0e10cSrcweir
208cdf0e10cSrcweir if ( aData.maTokens1.getLength() )
209cdf0e10cSrcweir {
210cdf0e10cSrcweir ScTokenArray aTokenArray;
211cdf0e10cSrcweir if ( ScTokenConversion::ConvertToTokenArray(*pDoc, aTokenArray, aData.maTokens1) )
212cdf0e10cSrcweir aCoreEntry.SetFormula1(aTokenArray);
213cdf0e10cSrcweir }
214cdf0e10cSrcweir
215cdf0e10cSrcweir if ( aData.maTokens2.getLength() )
216cdf0e10cSrcweir {
217cdf0e10cSrcweir ScTokenArray aTokenArray;
218cdf0e10cSrcweir if ( ScTokenConversion::ConvertToTokenArray(*pDoc, aTokenArray, aData.maTokens2) )
219cdf0e10cSrcweir aCoreEntry.SetFormula2(aTokenArray);
220cdf0e10cSrcweir }
221cdf0e10cSrcweir rFormat.AddEntry( aCoreEntry );
222cdf0e10cSrcweir }
223cdf0e10cSrcweir }
224cdf0e10cSrcweir
~ScTableConditionalFormat()225cdf0e10cSrcweir ScTableConditionalFormat::~ScTableConditionalFormat()
226cdf0e10cSrcweir {
227cdf0e10cSrcweir ScTableConditionalEntry* pEntry;
228cdf0e10cSrcweir aEntries.First();
229cdf0e10cSrcweir while ( ( pEntry = (ScTableConditionalEntry*)aEntries.Remove() ) != NULL )
230cdf0e10cSrcweir pEntry->release();
231cdf0e10cSrcweir }
232cdf0e10cSrcweir
AddEntry_Impl(const ScCondFormatEntryItem & aEntry)233cdf0e10cSrcweir void ScTableConditionalFormat::AddEntry_Impl(const ScCondFormatEntryItem& aEntry)
234cdf0e10cSrcweir {
235cdf0e10cSrcweir ScTableConditionalEntry* pNew = new ScTableConditionalEntry(aEntry);
236cdf0e10cSrcweir pNew->acquire();
237cdf0e10cSrcweir aEntries.Insert( pNew, LIST_APPEND );
238cdf0e10cSrcweir }
239cdf0e10cSrcweir
240cdf0e10cSrcweir // XSheetConditionalFormat
241cdf0e10cSrcweir
GetObjectByIndex_Impl(sal_uInt16 nIndex) const242cdf0e10cSrcweir ScTableConditionalEntry* ScTableConditionalFormat::GetObjectByIndex_Impl(sal_uInt16 nIndex) const
243cdf0e10cSrcweir {
244cdf0e10cSrcweir return (ScTableConditionalEntry*)aEntries.GetObject(nIndex);
245cdf0e10cSrcweir }
246cdf0e10cSrcweir
addNew(const uno::Sequence<beans::PropertyValue> & aConditionalEntry)247cdf0e10cSrcweir void SAL_CALL ScTableConditionalFormat::addNew(
248cdf0e10cSrcweir const uno::Sequence<beans::PropertyValue >& aConditionalEntry )
249cdf0e10cSrcweir throw(uno::RuntimeException)
250cdf0e10cSrcweir {
251cdf0e10cSrcweir ScUnoGuard aGuard;
252cdf0e10cSrcweir ScCondFormatEntryItem aEntry;
253cdf0e10cSrcweir aEntry.meMode = SC_COND_NONE;
254cdf0e10cSrcweir
255cdf0e10cSrcweir const beans::PropertyValue* pPropArray = aConditionalEntry.getConstArray();
256cdf0e10cSrcweir long nPropCount = aConditionalEntry.getLength();
257cdf0e10cSrcweir for (long i = 0; i < nPropCount; i++)
258cdf0e10cSrcweir {
259cdf0e10cSrcweir const beans::PropertyValue& rProp = pPropArray[i];
260cdf0e10cSrcweir
261cdf0e10cSrcweir if ( rProp.Name.equalsAscii( SC_UNONAME_OPERATOR ) )
262cdf0e10cSrcweir {
263cdf0e10cSrcweir sheet::ConditionOperator eOper = (sheet::ConditionOperator)
264cdf0e10cSrcweir ScUnoHelpFunctions::GetEnumFromAny( rProp.Value );
265cdf0e10cSrcweir aEntry.meMode = lcl_ConditionOperatorToMode( eOper );
266cdf0e10cSrcweir }
267cdf0e10cSrcweir else if ( rProp.Name.equalsAscii( SC_UNONAME_FORMULA1 ) )
268cdf0e10cSrcweir {
269cdf0e10cSrcweir rtl::OUString aStrVal;
270cdf0e10cSrcweir uno::Sequence<sheet::FormulaToken> aTokens;
271cdf0e10cSrcweir if ( rProp.Value >>= aStrVal )
272cdf0e10cSrcweir aEntry.maExpr1 = aStrVal;
273cdf0e10cSrcweir else if ( rProp.Value >>= aTokens )
274cdf0e10cSrcweir {
275cdf0e10cSrcweir aEntry.maExpr1.Erase();
276cdf0e10cSrcweir aEntry.maTokens1 = aTokens;
277cdf0e10cSrcweir }
278cdf0e10cSrcweir }
279cdf0e10cSrcweir else if ( rProp.Name.equalsAscii( SC_UNONAME_FORMULA2 ) )
280cdf0e10cSrcweir {
281cdf0e10cSrcweir rtl::OUString aStrVal;
282cdf0e10cSrcweir uno::Sequence<sheet::FormulaToken> aTokens;
283cdf0e10cSrcweir if ( rProp.Value >>= aStrVal )
284cdf0e10cSrcweir aEntry.maExpr2 = aStrVal;
285cdf0e10cSrcweir else if ( rProp.Value >>= aTokens )
286cdf0e10cSrcweir {
287cdf0e10cSrcweir aEntry.maExpr2.Erase();
288cdf0e10cSrcweir aEntry.maTokens2 = aTokens;
289cdf0e10cSrcweir }
290cdf0e10cSrcweir }
291cdf0e10cSrcweir else if ( rProp.Name.equalsAscii( SC_UNONAME_SOURCEPOS ) )
292cdf0e10cSrcweir {
293cdf0e10cSrcweir table::CellAddress aAddress;
294cdf0e10cSrcweir if ( rProp.Value >>= aAddress )
295cdf0e10cSrcweir aEntry.maPos = ScAddress( (SCCOL)aAddress.Column, (SCROW)aAddress.Row, aAddress.Sheet );
296cdf0e10cSrcweir }
297cdf0e10cSrcweir else if ( rProp.Name.equalsAscii( SC_UNONAME_SOURCESTR ) )
298cdf0e10cSrcweir {
299cdf0e10cSrcweir rtl::OUString aStrVal;
300cdf0e10cSrcweir if ( rProp.Value >>= aStrVal )
301cdf0e10cSrcweir aEntry.maPosStr = String( aStrVal );
302cdf0e10cSrcweir }
303cdf0e10cSrcweir else if ( rProp.Name.equalsAscii( SC_UNONAME_STYLENAME ) )
304cdf0e10cSrcweir {
305cdf0e10cSrcweir rtl::OUString aStrVal;
306cdf0e10cSrcweir if ( rProp.Value >>= aStrVal )
307cdf0e10cSrcweir aEntry.maStyle = ScStyleNameConversion::ProgrammaticToDisplayName(
308cdf0e10cSrcweir aStrVal, SFX_STYLE_FAMILY_PARA );
309cdf0e10cSrcweir }
310cdf0e10cSrcweir else if ( rProp.Name.equalsAscii( SC_UNONAME_FORMULANMSP1 ) )
311cdf0e10cSrcweir {
312cdf0e10cSrcweir rtl::OUString aStrVal;
313cdf0e10cSrcweir if ( rProp.Value >>= aStrVal )
314cdf0e10cSrcweir aEntry.maExprNmsp1 = aStrVal;
315cdf0e10cSrcweir }
316cdf0e10cSrcweir else if ( rProp.Name.equalsAscii( SC_UNONAME_FORMULANMSP2 ) )
317cdf0e10cSrcweir {
318cdf0e10cSrcweir rtl::OUString aStrVal;
319cdf0e10cSrcweir if ( rProp.Value >>= aStrVal )
320cdf0e10cSrcweir aEntry.maExprNmsp2 = aStrVal;
321cdf0e10cSrcweir }
322cdf0e10cSrcweir else if ( rProp.Name.equalsAscii( SC_UNONAME_GRAMMAR1 ) )
323cdf0e10cSrcweir {
324cdf0e10cSrcweir sal_Int32 nVal = 0;
325cdf0e10cSrcweir if ( rProp.Value >>= nVal )
326cdf0e10cSrcweir aEntry.meGrammar1 = static_cast< FormulaGrammar::Grammar >( nVal );
327cdf0e10cSrcweir }
328cdf0e10cSrcweir else if ( rProp.Name.equalsAscii( SC_UNONAME_GRAMMAR2 ) )
329cdf0e10cSrcweir {
330cdf0e10cSrcweir sal_Int32 nVal = 0;
331cdf0e10cSrcweir if ( rProp.Value >>= nVal )
332cdf0e10cSrcweir aEntry.meGrammar2 = static_cast< FormulaGrammar::Grammar >( nVal );
333cdf0e10cSrcweir }
334cdf0e10cSrcweir else
335cdf0e10cSrcweir {
336cdf0e10cSrcweir DBG_ERROR("falsche Property");
337cdf0e10cSrcweir //! Exception...
338cdf0e10cSrcweir }
339cdf0e10cSrcweir }
340cdf0e10cSrcweir
341cdf0e10cSrcweir AddEntry_Impl(aEntry);
342cdf0e10cSrcweir }
343cdf0e10cSrcweir
removeByIndex(sal_Int32 nIndex)344cdf0e10cSrcweir void SAL_CALL ScTableConditionalFormat::removeByIndex( sal_Int32 nIndex )
345cdf0e10cSrcweir throw(uno::RuntimeException)
346cdf0e10cSrcweir {
347cdf0e10cSrcweir ScUnoGuard aGuard;
348cdf0e10cSrcweir ScTableConditionalEntry* pEntry = (ScTableConditionalEntry*)aEntries.GetObject(nIndex);
349cdf0e10cSrcweir if (pEntry)
350cdf0e10cSrcweir {
351cdf0e10cSrcweir aEntries.Remove(pEntry);
352cdf0e10cSrcweir pEntry->release();
353cdf0e10cSrcweir }
354cdf0e10cSrcweir }
355cdf0e10cSrcweir
clear()356cdf0e10cSrcweir void SAL_CALL ScTableConditionalFormat::clear() throw(uno::RuntimeException)
357cdf0e10cSrcweir {
358cdf0e10cSrcweir ScUnoGuard aGuard;
359cdf0e10cSrcweir ScTableConditionalEntry* pEntry;
360cdf0e10cSrcweir aEntries.First();
361cdf0e10cSrcweir while ( ( pEntry = (ScTableConditionalEntry*)aEntries.Remove() ) != NULL )
362cdf0e10cSrcweir pEntry->release();
363cdf0e10cSrcweir }
364cdf0e10cSrcweir
365cdf0e10cSrcweir // XEnumerationAccess
366cdf0e10cSrcweir
createEnumeration()367cdf0e10cSrcweir uno::Reference<container::XEnumeration> SAL_CALL ScTableConditionalFormat::createEnumeration()
368cdf0e10cSrcweir throw(uno::RuntimeException)
369cdf0e10cSrcweir {
370cdf0e10cSrcweir ScUnoGuard aGuard;
371cdf0e10cSrcweir return new ScIndexEnumeration(this, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.TableConditionalEntryEnumeration")));
372cdf0e10cSrcweir }
373cdf0e10cSrcweir
374cdf0e10cSrcweir // XIndexAccess
375cdf0e10cSrcweir
getCount()376cdf0e10cSrcweir sal_Int32 SAL_CALL ScTableConditionalFormat::getCount() throw(uno::RuntimeException)
377cdf0e10cSrcweir {
378cdf0e10cSrcweir ScUnoGuard aGuard;
379cdf0e10cSrcweir return aEntries.Count();
380cdf0e10cSrcweir }
381cdf0e10cSrcweir
getByIndex(sal_Int32 nIndex)382cdf0e10cSrcweir uno::Any SAL_CALL ScTableConditionalFormat::getByIndex( sal_Int32 nIndex )
383cdf0e10cSrcweir throw(lang::IndexOutOfBoundsException,
384cdf0e10cSrcweir lang::WrappedTargetException, uno::RuntimeException)
385cdf0e10cSrcweir {
386cdf0e10cSrcweir ScUnoGuard aGuard;
387cdf0e10cSrcweir uno::Reference<sheet::XSheetConditionalEntry> xEntry(GetObjectByIndex_Impl((sal_uInt16)nIndex));
388cdf0e10cSrcweir if (xEntry.is())
389cdf0e10cSrcweir return uno::makeAny(xEntry);
390cdf0e10cSrcweir else
391cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
392cdf0e10cSrcweir // return uno::Any();
393cdf0e10cSrcweir }
394cdf0e10cSrcweir
getElementType()395cdf0e10cSrcweir uno::Type SAL_CALL ScTableConditionalFormat::getElementType() throw(uno::RuntimeException)
396cdf0e10cSrcweir {
397cdf0e10cSrcweir ScUnoGuard aGuard;
398cdf0e10cSrcweir return getCppuType((uno::Reference<sheet::XSheetConditionalEntry>*)0);
399cdf0e10cSrcweir }
400cdf0e10cSrcweir
hasElements()401cdf0e10cSrcweir sal_Bool SAL_CALL ScTableConditionalFormat::hasElements() throw(uno::RuntimeException)
402cdf0e10cSrcweir {
403cdf0e10cSrcweir ScUnoGuard aGuard;
404cdf0e10cSrcweir return ( getCount() != 0 );
405cdf0e10cSrcweir }
406cdf0e10cSrcweir
407cdf0e10cSrcweir // conditional format entries have no real names
408cdf0e10cSrcweir // -> generate name from index
409cdf0e10cSrcweir
lcl_GetEntryNameFromIndex(sal_Int32 nIndex)410cdf0e10cSrcweir rtl::OUString lcl_GetEntryNameFromIndex( sal_Int32 nIndex )
411cdf0e10cSrcweir {
412cdf0e10cSrcweir rtl::OUString aRet( RTL_CONSTASCII_USTRINGPARAM( "Entry" ) );
413cdf0e10cSrcweir aRet += rtl::OUString::valueOf( nIndex );
414cdf0e10cSrcweir return aRet;
415cdf0e10cSrcweir }
416cdf0e10cSrcweir
getByName(const rtl::OUString & aName)417cdf0e10cSrcweir uno::Any SAL_CALL ScTableConditionalFormat::getByName( const rtl::OUString& aName )
418cdf0e10cSrcweir throw(container::NoSuchElementException,
419cdf0e10cSrcweir lang::WrappedTargetException, uno::RuntimeException)
420cdf0e10cSrcweir {
421cdf0e10cSrcweir ScUnoGuard aGuard;
422cdf0e10cSrcweir
423cdf0e10cSrcweir uno::Reference<sheet::XSheetConditionalEntry> xEntry;
424cdf0e10cSrcweir long nCount = aEntries.Count();
425cdf0e10cSrcweir for (long i=0; i<nCount; i++)
426cdf0e10cSrcweir if ( aName == lcl_GetEntryNameFromIndex(i) )
427cdf0e10cSrcweir {
428cdf0e10cSrcweir xEntry.set(GetObjectByIndex_Impl((sal_uInt16)i));
429cdf0e10cSrcweir break;
430cdf0e10cSrcweir }
431cdf0e10cSrcweir
432cdf0e10cSrcweir if (xEntry.is())
433cdf0e10cSrcweir return uno::makeAny(xEntry);
434cdf0e10cSrcweir else
435cdf0e10cSrcweir throw container::NoSuchElementException();
436cdf0e10cSrcweir // return uno::Any();
437cdf0e10cSrcweir }
438cdf0e10cSrcweir
getElementNames()439cdf0e10cSrcweir uno::Sequence<rtl::OUString> SAL_CALL ScTableConditionalFormat::getElementNames()
440cdf0e10cSrcweir throw(uno::RuntimeException)
441cdf0e10cSrcweir {
442cdf0e10cSrcweir ScUnoGuard aGuard;
443cdf0e10cSrcweir
444cdf0e10cSrcweir long nCount = aEntries.Count();
445cdf0e10cSrcweir uno::Sequence<rtl::OUString> aNames(nCount);
446cdf0e10cSrcweir rtl::OUString* pArray = aNames.getArray();
447cdf0e10cSrcweir for (long i=0; i<nCount; i++)
448cdf0e10cSrcweir pArray[i] = lcl_GetEntryNameFromIndex(i);
449cdf0e10cSrcweir
450cdf0e10cSrcweir return aNames;
451cdf0e10cSrcweir }
452cdf0e10cSrcweir
hasByName(const rtl::OUString & aName)453cdf0e10cSrcweir sal_Bool SAL_CALL ScTableConditionalFormat::hasByName( const rtl::OUString& aName )
454cdf0e10cSrcweir throw(uno::RuntimeException)
455cdf0e10cSrcweir {
456cdf0e10cSrcweir ScUnoGuard aGuard;
457cdf0e10cSrcweir
458cdf0e10cSrcweir long nCount = aEntries.Count();
459cdf0e10cSrcweir for (long i=0; i<nCount; i++)
460cdf0e10cSrcweir if ( aName == lcl_GetEntryNameFromIndex(i) )
461cdf0e10cSrcweir return sal_True;
462cdf0e10cSrcweir
463cdf0e10cSrcweir return sal_False;
464cdf0e10cSrcweir }
465cdf0e10cSrcweir
466cdf0e10cSrcweir // XUnoTunnel
467cdf0e10cSrcweir
getSomething(const uno::Sequence<sal_Int8> & rId)468cdf0e10cSrcweir sal_Int64 SAL_CALL ScTableConditionalFormat::getSomething(
469cdf0e10cSrcweir const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException)
470cdf0e10cSrcweir {
471cdf0e10cSrcweir if ( rId.getLength() == 16 &&
472cdf0e10cSrcweir 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
473cdf0e10cSrcweir rId.getConstArray(), 16 ) )
474cdf0e10cSrcweir {
475cdf0e10cSrcweir return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
476cdf0e10cSrcweir }
477cdf0e10cSrcweir return 0;
478cdf0e10cSrcweir }
479cdf0e10cSrcweir
480cdf0e10cSrcweir // static
getUnoTunnelId()481cdf0e10cSrcweir const uno::Sequence<sal_Int8>& ScTableConditionalFormat::getUnoTunnelId()
482cdf0e10cSrcweir {
483cdf0e10cSrcweir static uno::Sequence<sal_Int8> * pSeq = 0;
484cdf0e10cSrcweir if( !pSeq )
485cdf0e10cSrcweir {
486cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
487cdf0e10cSrcweir if( !pSeq )
488cdf0e10cSrcweir {
489cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aSeq( 16 );
490cdf0e10cSrcweir rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
491cdf0e10cSrcweir pSeq = &aSeq;
492cdf0e10cSrcweir }
493cdf0e10cSrcweir }
494cdf0e10cSrcweir return *pSeq;
495cdf0e10cSrcweir }
496cdf0e10cSrcweir
497cdf0e10cSrcweir // static
getImplementation(const uno::Reference<sheet::XSheetConditionalEntries> xObj)498cdf0e10cSrcweir ScTableConditionalFormat* ScTableConditionalFormat::getImplementation(
499cdf0e10cSrcweir const uno::Reference<sheet::XSheetConditionalEntries> xObj )
500cdf0e10cSrcweir {
501cdf0e10cSrcweir ScTableConditionalFormat* pRet = NULL;
502cdf0e10cSrcweir uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
503cdf0e10cSrcweir if (xUT.is())
504cdf0e10cSrcweir pRet = reinterpret_cast<ScTableConditionalFormat*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
505cdf0e10cSrcweir return pRet;
506cdf0e10cSrcweir }
507cdf0e10cSrcweir
508cdf0e10cSrcweir //------------------------------------------------------------------------
509cdf0e10cSrcweir
510cdf0e10cSrcweir //UNUSED2008-05 ScTableConditionalEntry::ScTableConditionalEntry() :
511cdf0e10cSrcweir //UNUSED2008-05 pParent( NULL )
512cdf0e10cSrcweir //UNUSED2008-05 {
513cdf0e10cSrcweir //UNUSED2008-05 }
514cdf0e10cSrcweir
ScTableConditionalEntry(const ScCondFormatEntryItem & aItem)515cdf0e10cSrcweir ScTableConditionalEntry::ScTableConditionalEntry(const ScCondFormatEntryItem& aItem) :
516cdf0e10cSrcweir aData( aItem )
517cdf0e10cSrcweir {
518cdf0e10cSrcweir // #i113668# only store the settings, keep no reference to parent object
519cdf0e10cSrcweir }
520cdf0e10cSrcweir
~ScTableConditionalEntry()521cdf0e10cSrcweir ScTableConditionalEntry::~ScTableConditionalEntry()
522cdf0e10cSrcweir {
523cdf0e10cSrcweir }
524cdf0e10cSrcweir
GetData(ScCondFormatEntryItem & rData) const525cdf0e10cSrcweir void ScTableConditionalEntry::GetData(ScCondFormatEntryItem& rData) const
526cdf0e10cSrcweir {
527cdf0e10cSrcweir rData = aData;
528cdf0e10cSrcweir }
529cdf0e10cSrcweir
530cdf0e10cSrcweir // XSheetCondition
531cdf0e10cSrcweir
getOperator()532cdf0e10cSrcweir sheet::ConditionOperator SAL_CALL ScTableConditionalEntry::getOperator()
533cdf0e10cSrcweir throw(uno::RuntimeException)
534cdf0e10cSrcweir {
535cdf0e10cSrcweir ScUnoGuard aGuard;
536cdf0e10cSrcweir return lcl_ConditionModeToOperator( aData.meMode );
537cdf0e10cSrcweir }
538cdf0e10cSrcweir
setOperator(sheet::ConditionOperator nOperator)539cdf0e10cSrcweir void SAL_CALL ScTableConditionalEntry::setOperator( sheet::ConditionOperator nOperator )
540cdf0e10cSrcweir throw(uno::RuntimeException)
541cdf0e10cSrcweir {
542cdf0e10cSrcweir ScUnoGuard aGuard;
543cdf0e10cSrcweir aData.meMode = lcl_ConditionOperatorToMode( nOperator );
544cdf0e10cSrcweir }
545cdf0e10cSrcweir
getFormula1()546cdf0e10cSrcweir rtl::OUString SAL_CALL ScTableConditionalEntry::getFormula1() throw(uno::RuntimeException)
547cdf0e10cSrcweir {
548cdf0e10cSrcweir ScUnoGuard aGuard;
549cdf0e10cSrcweir return aData.maExpr1;
550cdf0e10cSrcweir }
551cdf0e10cSrcweir
setFormula1(const rtl::OUString & aFormula1)552cdf0e10cSrcweir void SAL_CALL ScTableConditionalEntry::setFormula1( const rtl::OUString& aFormula1 )
553cdf0e10cSrcweir throw(uno::RuntimeException)
554cdf0e10cSrcweir {
555cdf0e10cSrcweir ScUnoGuard aGuard;
556cdf0e10cSrcweir aData.maExpr1 = String( aFormula1 );
557cdf0e10cSrcweir }
558cdf0e10cSrcweir
getFormula2()559cdf0e10cSrcweir rtl::OUString SAL_CALL ScTableConditionalEntry::getFormula2() throw(uno::RuntimeException)
560cdf0e10cSrcweir {
561cdf0e10cSrcweir ScUnoGuard aGuard;
562cdf0e10cSrcweir return aData.maExpr2;
563cdf0e10cSrcweir }
564cdf0e10cSrcweir
setFormula2(const rtl::OUString & aFormula2)565cdf0e10cSrcweir void SAL_CALL ScTableConditionalEntry::setFormula2( const rtl::OUString& aFormula2 )
566cdf0e10cSrcweir throw(uno::RuntimeException)
567cdf0e10cSrcweir {
568cdf0e10cSrcweir ScUnoGuard aGuard;
569cdf0e10cSrcweir aData.maExpr2 = String( aFormula2 );
570cdf0e10cSrcweir }
571cdf0e10cSrcweir
getSourcePosition()572cdf0e10cSrcweir table::CellAddress SAL_CALL ScTableConditionalEntry::getSourcePosition() throw(uno::RuntimeException)
573cdf0e10cSrcweir {
574cdf0e10cSrcweir ScUnoGuard aGuard;
575cdf0e10cSrcweir table::CellAddress aRet;
576cdf0e10cSrcweir aRet.Column = aData.maPos.Col();
577cdf0e10cSrcweir aRet.Row = aData.maPos.Row();
578cdf0e10cSrcweir aRet.Sheet = aData.maPos.Tab();
579cdf0e10cSrcweir return aRet;
580cdf0e10cSrcweir }
581cdf0e10cSrcweir
setSourcePosition(const table::CellAddress & aSourcePosition)582cdf0e10cSrcweir void SAL_CALL ScTableConditionalEntry::setSourcePosition( const table::CellAddress& aSourcePosition )
583cdf0e10cSrcweir throw(uno::RuntimeException)
584cdf0e10cSrcweir {
585cdf0e10cSrcweir ScUnoGuard aGuard;
586cdf0e10cSrcweir aData.maPos.Set( (SCCOL)aSourcePosition.Column, (SCROW)aSourcePosition.Row, aSourcePosition.Sheet );
587cdf0e10cSrcweir }
588cdf0e10cSrcweir
589cdf0e10cSrcweir // XSheetConditionalEntry
590cdf0e10cSrcweir
getStyleName()591cdf0e10cSrcweir rtl::OUString SAL_CALL ScTableConditionalEntry::getStyleName() throw(uno::RuntimeException)
592cdf0e10cSrcweir {
593cdf0e10cSrcweir ScUnoGuard aGuard;
594cdf0e10cSrcweir return ScStyleNameConversion::DisplayToProgrammaticName( aData.maStyle, SFX_STYLE_FAMILY_PARA );
595cdf0e10cSrcweir }
596cdf0e10cSrcweir
setStyleName(const rtl::OUString & aStyleName)597cdf0e10cSrcweir void SAL_CALL ScTableConditionalEntry::setStyleName( const rtl::OUString& aStyleName )
598cdf0e10cSrcweir throw(uno::RuntimeException)
599cdf0e10cSrcweir {
600cdf0e10cSrcweir ScUnoGuard aGuard;
601cdf0e10cSrcweir aData.maStyle = ScStyleNameConversion::ProgrammaticToDisplayName( aStyleName, SFX_STYLE_FAMILY_PARA );
602cdf0e10cSrcweir }
603cdf0e10cSrcweir
604cdf0e10cSrcweir //------------------------------------------------------------------------
605cdf0e10cSrcweir
ScTableValidationObj(ScDocument * pDoc,sal_uLong nKey,const formula::FormulaGrammar::Grammar eGrammar)606cdf0e10cSrcweir ScTableValidationObj::ScTableValidationObj(ScDocument* pDoc, sal_uLong nKey,
607cdf0e10cSrcweir const formula::FormulaGrammar::Grammar eGrammar) :
608cdf0e10cSrcweir aPropSet( lcl_GetValidatePropertyMap() )
609cdf0e10cSrcweir {
610cdf0e10cSrcweir // Eintrag aus dem Dokument lesen...
611cdf0e10cSrcweir
612cdf0e10cSrcweir sal_Bool bFound = sal_False;
613cdf0e10cSrcweir if ( pDoc && nKey )
614cdf0e10cSrcweir {
615cdf0e10cSrcweir const ScValidationData* pData = pDoc->GetValidationEntry( nKey );
616cdf0e10cSrcweir if (pData)
617cdf0e10cSrcweir {
618cdf0e10cSrcweir nMode = sal::static_int_cast<sal_uInt16>( pData->GetOperation() );
619cdf0e10cSrcweir aSrcPos = pData->GetValidSrcPos(); // #b4974740# valid pos for expressions
620cdf0e10cSrcweir aExpr1 = pData->GetExpression( aSrcPos, 0, 0, eGrammar );
621cdf0e10cSrcweir aExpr2 = pData->GetExpression( aSrcPos, 1, 0, eGrammar );
622cdf0e10cSrcweir meGrammar1 = meGrammar2 = eGrammar;
623cdf0e10cSrcweir nValMode = sal::static_int_cast<sal_uInt16>( pData->GetDataMode() );
624cdf0e10cSrcweir bIgnoreBlank = pData->IsIgnoreBlank();
625cdf0e10cSrcweir nShowList = pData->GetListType();
626cdf0e10cSrcweir bShowInput = pData->GetInput( aInputTitle, aInputMessage );
627cdf0e10cSrcweir ScValidErrorStyle eStyle;
628cdf0e10cSrcweir bShowError = pData->GetErrMsg( aErrorTitle, aErrorMessage, eStyle );
629cdf0e10cSrcweir nErrorStyle = sal::static_int_cast<sal_uInt16>( eStyle );
630cdf0e10cSrcweir
631cdf0e10cSrcweir // During save to XML, sheet::ValidationType_ANY formulas are not
632cdf0e10cSrcweir // saved, even if in the list, see
633cdf0e10cSrcweir // ScMyValidationsContainer::GetCondition(), so shall not mark
634cdf0e10cSrcweir // anything in use.
635cdf0e10cSrcweir if (nValMode != SC_VALID_ANY && pDoc->IsInExternalReferenceMarking())
636cdf0e10cSrcweir pData->MarkUsedExternalReferences();
637cdf0e10cSrcweir
638cdf0e10cSrcweir bFound = sal_True;
639cdf0e10cSrcweir }
640cdf0e10cSrcweir }
641cdf0e10cSrcweir if (!bFound)
642cdf0e10cSrcweir ClearData_Impl(); // Defaults
643cdf0e10cSrcweir }
644cdf0e10cSrcweir
CreateValidationData(ScDocument * pDoc,formula::FormulaGrammar::Grammar eGrammar) const645cdf0e10cSrcweir ScValidationData* ScTableValidationObj::CreateValidationData( ScDocument* pDoc,
646cdf0e10cSrcweir formula::FormulaGrammar::Grammar eGrammar ) const
647cdf0e10cSrcweir {
648cdf0e10cSrcweir // ScValidationData = Core-Struktur
649cdf0e10cSrcweir
650cdf0e10cSrcweir FormulaGrammar::Grammar eGrammar1 = lclResolveGrammar( eGrammar, meGrammar1 );
651cdf0e10cSrcweir FormulaGrammar::Grammar eGrammar2 = lclResolveGrammar( eGrammar, meGrammar2 );
652cdf0e10cSrcweir
653cdf0e10cSrcweir ScValidationData* pRet = new ScValidationData( (ScValidationMode)nValMode,
654cdf0e10cSrcweir (ScConditionMode)nMode,
655cdf0e10cSrcweir aExpr1, aExpr2, pDoc, aSrcPos,
656cdf0e10cSrcweir maExprNmsp1, maExprNmsp2,
657cdf0e10cSrcweir eGrammar1, eGrammar2 );
658cdf0e10cSrcweir pRet->SetIgnoreBlank(bIgnoreBlank);
659cdf0e10cSrcweir pRet->SetListType(nShowList);
660cdf0e10cSrcweir
661cdf0e10cSrcweir if ( aTokens1.getLength() )
662cdf0e10cSrcweir {
663cdf0e10cSrcweir ScTokenArray aTokenArray;
664cdf0e10cSrcweir if ( ScTokenConversion::ConvertToTokenArray(*pDoc, aTokenArray, aTokens1) )
665cdf0e10cSrcweir pRet->SetFormula1(aTokenArray);
666cdf0e10cSrcweir }
667cdf0e10cSrcweir
668cdf0e10cSrcweir if ( aTokens2.getLength() )
669cdf0e10cSrcweir {
670cdf0e10cSrcweir ScTokenArray aTokenArray;
671cdf0e10cSrcweir if ( ScTokenConversion::ConvertToTokenArray(*pDoc, aTokenArray, aTokens2) )
672cdf0e10cSrcweir pRet->SetFormula2(aTokenArray);
673cdf0e10cSrcweir }
674cdf0e10cSrcweir
675cdf0e10cSrcweir // set strings for error / input even if disabled (and disable afterwards)
676cdf0e10cSrcweir pRet->SetInput( aInputTitle, aInputMessage );
677cdf0e10cSrcweir if (!bShowInput)
678cdf0e10cSrcweir pRet->ResetInput();
679cdf0e10cSrcweir pRet->SetError( aErrorTitle, aErrorMessage, (ScValidErrorStyle)nErrorStyle );
680cdf0e10cSrcweir if (!bShowError)
681cdf0e10cSrcweir pRet->ResetError();
682cdf0e10cSrcweir
683cdf0e10cSrcweir if ( aPosString.Len() )
684cdf0e10cSrcweir pRet->SetSrcString( aPosString );
685cdf0e10cSrcweir
686cdf0e10cSrcweir return pRet;
687cdf0e10cSrcweir }
688cdf0e10cSrcweir
ClearData_Impl()689cdf0e10cSrcweir void ScTableValidationObj::ClearData_Impl()
690cdf0e10cSrcweir {
691cdf0e10cSrcweir nMode = SC_COND_NONE;
692cdf0e10cSrcweir nValMode = SC_VALID_ANY;
693cdf0e10cSrcweir bIgnoreBlank = sal_True;
694cdf0e10cSrcweir nShowList = sheet::TableValidationVisibility::UNSORTED;
695cdf0e10cSrcweir bShowInput = sal_False;
696cdf0e10cSrcweir bShowError = sal_False;
697cdf0e10cSrcweir nErrorStyle = SC_VALERR_STOP;
698cdf0e10cSrcweir aSrcPos.Set(0,0,0);
699cdf0e10cSrcweir aExpr1.Erase();
700cdf0e10cSrcweir aExpr2.Erase();
701cdf0e10cSrcweir maExprNmsp1.Erase();
702cdf0e10cSrcweir maExprNmsp2.Erase();
703cdf0e10cSrcweir meGrammar1 = meGrammar2 = FormulaGrammar::GRAM_UNSPECIFIED; // will be overriden when needed
704cdf0e10cSrcweir aInputTitle.Erase();
705cdf0e10cSrcweir aInputMessage.Erase();
706cdf0e10cSrcweir aErrorTitle.Erase();
707cdf0e10cSrcweir aErrorMessage.Erase();
708cdf0e10cSrcweir }
709cdf0e10cSrcweir
~ScTableValidationObj()710cdf0e10cSrcweir ScTableValidationObj::~ScTableValidationObj()
711cdf0e10cSrcweir {
712cdf0e10cSrcweir }
713cdf0e10cSrcweir
714cdf0e10cSrcweir // XSheetCondition
715cdf0e10cSrcweir
getOperator()716cdf0e10cSrcweir sheet::ConditionOperator SAL_CALL ScTableValidationObj::getOperator()
717cdf0e10cSrcweir throw(uno::RuntimeException)
718cdf0e10cSrcweir {
719cdf0e10cSrcweir ScUnoGuard aGuard;
720cdf0e10cSrcweir return lcl_ConditionModeToOperator( (ScConditionMode)nMode );
721cdf0e10cSrcweir }
722cdf0e10cSrcweir
setOperator(sheet::ConditionOperator nOperator)723cdf0e10cSrcweir void SAL_CALL ScTableValidationObj::setOperator( sheet::ConditionOperator nOperator )
724cdf0e10cSrcweir throw(uno::RuntimeException)
725cdf0e10cSrcweir {
726cdf0e10cSrcweir ScUnoGuard aGuard;
727cdf0e10cSrcweir nMode = sal::static_int_cast<sal_uInt16>( lcl_ConditionOperatorToMode( nOperator ) );
728cdf0e10cSrcweir }
729cdf0e10cSrcweir
getFormula1()730cdf0e10cSrcweir rtl::OUString SAL_CALL ScTableValidationObj::getFormula1() throw(uno::RuntimeException)
731cdf0e10cSrcweir {
732cdf0e10cSrcweir ScUnoGuard aGuard;
733cdf0e10cSrcweir return aExpr1;
734cdf0e10cSrcweir }
735cdf0e10cSrcweir
setFormula1(const rtl::OUString & aFormula1)736cdf0e10cSrcweir void SAL_CALL ScTableValidationObj::setFormula1( const rtl::OUString& aFormula1 )
737cdf0e10cSrcweir throw(uno::RuntimeException)
738cdf0e10cSrcweir {
739cdf0e10cSrcweir ScUnoGuard aGuard;
740cdf0e10cSrcweir aExpr1 = String( aFormula1 );
741cdf0e10cSrcweir }
742cdf0e10cSrcweir
getFormula2()743cdf0e10cSrcweir rtl::OUString SAL_CALL ScTableValidationObj::getFormula2() throw(uno::RuntimeException)
744cdf0e10cSrcweir {
745cdf0e10cSrcweir ScUnoGuard aGuard;
746cdf0e10cSrcweir return aExpr2;
747cdf0e10cSrcweir }
748cdf0e10cSrcweir
setFormula2(const rtl::OUString & aFormula2)749cdf0e10cSrcweir void SAL_CALL ScTableValidationObj::setFormula2( const rtl::OUString& aFormula2 )
750cdf0e10cSrcweir throw(uno::RuntimeException)
751cdf0e10cSrcweir {
752cdf0e10cSrcweir ScUnoGuard aGuard;
753cdf0e10cSrcweir aExpr2 = String( aFormula2 );
754cdf0e10cSrcweir }
755cdf0e10cSrcweir
getSourcePosition()756cdf0e10cSrcweir table::CellAddress SAL_CALL ScTableValidationObj::getSourcePosition() throw(uno::RuntimeException)
757cdf0e10cSrcweir {
758cdf0e10cSrcweir ScUnoGuard aGuard;
759cdf0e10cSrcweir table::CellAddress aRet;
760cdf0e10cSrcweir aRet.Column = aSrcPos.Col();
761cdf0e10cSrcweir aRet.Row = aSrcPos.Row();
762cdf0e10cSrcweir aRet.Sheet = aSrcPos.Tab();
763cdf0e10cSrcweir return aRet;
764cdf0e10cSrcweir }
765cdf0e10cSrcweir
setSourcePosition(const table::CellAddress & aSourcePosition)766cdf0e10cSrcweir void SAL_CALL ScTableValidationObj::setSourcePosition( const table::CellAddress& aSourcePosition )
767cdf0e10cSrcweir throw(uno::RuntimeException)
768cdf0e10cSrcweir {
769cdf0e10cSrcweir ScUnoGuard aGuard;
770cdf0e10cSrcweir aSrcPos.Set( (SCCOL)aSourcePosition.Column, (SCROW)aSourcePosition.Row, aSourcePosition.Sheet );
771cdf0e10cSrcweir }
772cdf0e10cSrcweir
getTokens(sal_Int32 nIndex)773cdf0e10cSrcweir uno::Sequence<sheet::FormulaToken> SAL_CALL ScTableValidationObj::getTokens( sal_Int32 nIndex )
774cdf0e10cSrcweir throw(uno::RuntimeException,lang::IndexOutOfBoundsException)
775cdf0e10cSrcweir {
776cdf0e10cSrcweir ScUnoGuard aGuard;
777cdf0e10cSrcweir if (nIndex >= 2 || nIndex < 0)
778cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
779cdf0e10cSrcweir
780cdf0e10cSrcweir return nIndex == 0 ? aTokens1 : aTokens2;
781cdf0e10cSrcweir }
782cdf0e10cSrcweir
setTokens(sal_Int32 nIndex,const uno::Sequence<sheet::FormulaToken> & aTokens)783cdf0e10cSrcweir void SAL_CALL ScTableValidationObj::setTokens( sal_Int32 nIndex, const uno::Sequence<sheet::FormulaToken>& aTokens )
784cdf0e10cSrcweir throw(uno::RuntimeException,lang::IndexOutOfBoundsException)
785cdf0e10cSrcweir {
786cdf0e10cSrcweir ScUnoGuard aGuard;
787cdf0e10cSrcweir if (nIndex >= 2 || nIndex < 0)
788cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
789cdf0e10cSrcweir
790cdf0e10cSrcweir if (nIndex == 0)
791cdf0e10cSrcweir {
792cdf0e10cSrcweir aTokens1 = aTokens;
793cdf0e10cSrcweir aExpr1.Erase();
794cdf0e10cSrcweir }
795cdf0e10cSrcweir else if (nIndex == 1)
796cdf0e10cSrcweir {
797cdf0e10cSrcweir aTokens2 = aTokens;
798cdf0e10cSrcweir aExpr2.Erase();
799cdf0e10cSrcweir }
800cdf0e10cSrcweir }
801cdf0e10cSrcweir
getCount()802cdf0e10cSrcweir sal_Int32 SAL_CALL ScTableValidationObj::getCount() throw(uno::RuntimeException)
803cdf0e10cSrcweir {
804cdf0e10cSrcweir return 2;
805cdf0e10cSrcweir }
806cdf0e10cSrcweir
getPropertySetInfo()807cdf0e10cSrcweir uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableValidationObj::getPropertySetInfo()
808cdf0e10cSrcweir throw(uno::RuntimeException)
809cdf0e10cSrcweir {
810cdf0e10cSrcweir ScUnoGuard aGuard;
811cdf0e10cSrcweir static uno::Reference<beans::XPropertySetInfo> aRef(
812cdf0e10cSrcweir new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ));
813cdf0e10cSrcweir return aRef;
814cdf0e10cSrcweir }
815cdf0e10cSrcweir
setPropertyValue(const rtl::OUString & aPropertyName,const uno::Any & aValue)816cdf0e10cSrcweir void SAL_CALL ScTableValidationObj::setPropertyValue(
817cdf0e10cSrcweir const rtl::OUString& aPropertyName, const uno::Any& aValue )
818cdf0e10cSrcweir throw(beans::UnknownPropertyException, beans::PropertyVetoException,
819cdf0e10cSrcweir lang::IllegalArgumentException, lang::WrappedTargetException,
820cdf0e10cSrcweir uno::RuntimeException)
821cdf0e10cSrcweir {
822cdf0e10cSrcweir ScUnoGuard aGuard;
823cdf0e10cSrcweir String aString(aPropertyName);
824cdf0e10cSrcweir
825cdf0e10cSrcweir if ( aString.EqualsAscii( SC_UNONAME_SHOWINP ) ) bShowInput = ScUnoHelpFunctions::GetBoolFromAny( aValue );
826cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_SHOWERR ) ) bShowError = ScUnoHelpFunctions::GetBoolFromAny( aValue );
827cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_IGNOREBL ) ) bIgnoreBlank = ScUnoHelpFunctions::GetBoolFromAny( aValue );
828cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_SHOWLIST ) ) aValue >>= nShowList;
829cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_INPTITLE ) )
830cdf0e10cSrcweir {
831cdf0e10cSrcweir rtl::OUString aStrVal;
832cdf0e10cSrcweir if ( aValue >>= aStrVal )
833cdf0e10cSrcweir aInputTitle = String( aStrVal );
834cdf0e10cSrcweir }
835cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_INPMESS ) )
836cdf0e10cSrcweir {
837cdf0e10cSrcweir rtl::OUString aStrVal;
838cdf0e10cSrcweir if ( aValue >>= aStrVal )
839cdf0e10cSrcweir aInputMessage = String( aStrVal );
840cdf0e10cSrcweir }
841cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_ERRTITLE ) )
842cdf0e10cSrcweir {
843cdf0e10cSrcweir rtl::OUString aStrVal;
844cdf0e10cSrcweir if ( aValue >>= aStrVal )
845cdf0e10cSrcweir aErrorTitle = String( aStrVal );
846cdf0e10cSrcweir }
847cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_ERRMESS ) )
848cdf0e10cSrcweir {
849cdf0e10cSrcweir rtl::OUString aStrVal;
850cdf0e10cSrcweir if ( aValue >>= aStrVal )
851cdf0e10cSrcweir aErrorMessage = String( aStrVal );
852cdf0e10cSrcweir }
853cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_TYPE ) )
854cdf0e10cSrcweir {
855cdf0e10cSrcweir sheet::ValidationType eType = (sheet::ValidationType)
856cdf0e10cSrcweir ScUnoHelpFunctions::GetEnumFromAny( aValue );
857cdf0e10cSrcweir switch (eType)
858cdf0e10cSrcweir {
859cdf0e10cSrcweir case sheet::ValidationType_ANY: nValMode = SC_VALID_ANY; break;
860cdf0e10cSrcweir case sheet::ValidationType_WHOLE: nValMode = SC_VALID_WHOLE; break;
861cdf0e10cSrcweir case sheet::ValidationType_DECIMAL: nValMode = SC_VALID_DECIMAL; break;
862cdf0e10cSrcweir case sheet::ValidationType_DATE: nValMode = SC_VALID_DATE; break;
863cdf0e10cSrcweir case sheet::ValidationType_TIME: nValMode = SC_VALID_TIME; break;
864cdf0e10cSrcweir case sheet::ValidationType_TEXT_LEN: nValMode = SC_VALID_TEXTLEN; break;
865cdf0e10cSrcweir case sheet::ValidationType_LIST: nValMode = SC_VALID_LIST; break;
866cdf0e10cSrcweir case sheet::ValidationType_CUSTOM: nValMode = SC_VALID_CUSTOM; break;
867cdf0e10cSrcweir default:
868cdf0e10cSrcweir {
869cdf0e10cSrcweir // added to avoid warnings
870cdf0e10cSrcweir }
871cdf0e10cSrcweir }
872cdf0e10cSrcweir }
873cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_ERRALSTY ) )
874cdf0e10cSrcweir {
875cdf0e10cSrcweir sheet::ValidationAlertStyle eStyle = (sheet::ValidationAlertStyle)
876cdf0e10cSrcweir ScUnoHelpFunctions::GetEnumFromAny( aValue );
877cdf0e10cSrcweir switch (eStyle)
878cdf0e10cSrcweir {
879cdf0e10cSrcweir case sheet::ValidationAlertStyle_STOP: nErrorStyle = SC_VALERR_STOP; break;
880cdf0e10cSrcweir case sheet::ValidationAlertStyle_WARNING: nErrorStyle = SC_VALERR_WARNING; break;
881cdf0e10cSrcweir case sheet::ValidationAlertStyle_INFO: nErrorStyle = SC_VALERR_INFO; break;
882cdf0e10cSrcweir case sheet::ValidationAlertStyle_MACRO: nErrorStyle = SC_VALERR_MACRO; break;
883cdf0e10cSrcweir default:
884cdf0e10cSrcweir {
885cdf0e10cSrcweir // added to avoid warnings
886cdf0e10cSrcweir }
887cdf0e10cSrcweir }
888cdf0e10cSrcweir }
889cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_SOURCESTR ) )
890cdf0e10cSrcweir {
891cdf0e10cSrcweir // internal - only for XML filter, not in PropertySetInfo, only set
892cdf0e10cSrcweir
893cdf0e10cSrcweir rtl::OUString aStrVal;
894cdf0e10cSrcweir if ( aValue >>= aStrVal )
895cdf0e10cSrcweir aPosString = String( aStrVal );
896cdf0e10cSrcweir }
897cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_FORMULANMSP1 ) )
898cdf0e10cSrcweir {
899cdf0e10cSrcweir // internal - only for XML filter, not in PropertySetInfo, only set
900cdf0e10cSrcweir
901cdf0e10cSrcweir rtl::OUString aStrVal;
902cdf0e10cSrcweir if ( aValue >>= aStrVal )
903cdf0e10cSrcweir maExprNmsp1 = aStrVal;
904cdf0e10cSrcweir }
905cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_FORMULANMSP2 ) )
906cdf0e10cSrcweir {
907cdf0e10cSrcweir // internal - only for XML filter, not in PropertySetInfo, only set
908cdf0e10cSrcweir
909cdf0e10cSrcweir rtl::OUString aStrVal;
910cdf0e10cSrcweir if ( aValue >>= aStrVal )
911cdf0e10cSrcweir maExprNmsp2 = aStrVal;
912cdf0e10cSrcweir }
913cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_GRAMMAR1 ) )
914cdf0e10cSrcweir {
915cdf0e10cSrcweir // internal - only for XML filter, not in PropertySetInfo, only set
916cdf0e10cSrcweir
917cdf0e10cSrcweir sal_Int32 nVal = 0;
918cdf0e10cSrcweir if ( aValue >>= nVal )
919cdf0e10cSrcweir meGrammar1 = static_cast< FormulaGrammar::Grammar >(nVal);
920cdf0e10cSrcweir }
921cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_GRAMMAR2 ) )
922cdf0e10cSrcweir {
923cdf0e10cSrcweir // internal - only for XML filter, not in PropertySetInfo, only set
924cdf0e10cSrcweir
925cdf0e10cSrcweir sal_Int32 nVal = 0;
926cdf0e10cSrcweir if ( aValue >>= nVal )
927cdf0e10cSrcweir meGrammar2 = static_cast< FormulaGrammar::Grammar >(nVal);
928cdf0e10cSrcweir }
929cdf0e10cSrcweir }
930cdf0e10cSrcweir
getPropertyValue(const rtl::OUString & aPropertyName)931cdf0e10cSrcweir uno::Any SAL_CALL ScTableValidationObj::getPropertyValue( const rtl::OUString& aPropertyName )
932cdf0e10cSrcweir throw(beans::UnknownPropertyException, lang::WrappedTargetException,
933cdf0e10cSrcweir uno::RuntimeException)
934cdf0e10cSrcweir {
935cdf0e10cSrcweir ScUnoGuard aGuard;
936cdf0e10cSrcweir String aString(aPropertyName);
937cdf0e10cSrcweir uno::Any aRet;
938cdf0e10cSrcweir
939cdf0e10cSrcweir if ( aString.EqualsAscii( SC_UNONAME_SHOWINP ) ) ScUnoHelpFunctions::SetBoolInAny( aRet, bShowInput );
940cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_SHOWERR ) ) ScUnoHelpFunctions::SetBoolInAny( aRet, bShowError );
941cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_IGNOREBL ) ) ScUnoHelpFunctions::SetBoolInAny( aRet, bIgnoreBlank );
942cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_SHOWLIST ) ) aRet <<= nShowList;
943cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_INPTITLE ) ) aRet <<= rtl::OUString( aInputTitle );
944cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_INPMESS ) ) aRet <<= rtl::OUString( aInputMessage );
945cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_ERRTITLE ) ) aRet <<= rtl::OUString( aErrorTitle );
946cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_ERRMESS ) ) aRet <<= rtl::OUString( aErrorMessage );
947cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_TYPE ) )
948cdf0e10cSrcweir {
949cdf0e10cSrcweir sheet::ValidationType eType = sheet::ValidationType_ANY;
950cdf0e10cSrcweir switch (nValMode)
951cdf0e10cSrcweir {
952cdf0e10cSrcweir case SC_VALID_ANY: eType = sheet::ValidationType_ANY; break;
953cdf0e10cSrcweir case SC_VALID_WHOLE: eType = sheet::ValidationType_WHOLE; break;
954cdf0e10cSrcweir case SC_VALID_DECIMAL: eType = sheet::ValidationType_DECIMAL; break;
955cdf0e10cSrcweir case SC_VALID_DATE: eType = sheet::ValidationType_DATE; break;
956cdf0e10cSrcweir case SC_VALID_TIME: eType = sheet::ValidationType_TIME; break;
957cdf0e10cSrcweir case SC_VALID_TEXTLEN: eType = sheet::ValidationType_TEXT_LEN; break;
958cdf0e10cSrcweir case SC_VALID_LIST: eType = sheet::ValidationType_LIST; break;
959cdf0e10cSrcweir case SC_VALID_CUSTOM: eType = sheet::ValidationType_CUSTOM; break;
960cdf0e10cSrcweir }
961cdf0e10cSrcweir aRet <<= eType;
962cdf0e10cSrcweir }
963cdf0e10cSrcweir else if ( aString.EqualsAscii( SC_UNONAME_ERRALSTY ) )
964cdf0e10cSrcweir {
965cdf0e10cSrcweir sheet::ValidationAlertStyle eStyle = sheet::ValidationAlertStyle_STOP;
966cdf0e10cSrcweir switch (nErrorStyle)
967cdf0e10cSrcweir {
968cdf0e10cSrcweir case SC_VALERR_STOP: eStyle = sheet::ValidationAlertStyle_STOP; break;
969cdf0e10cSrcweir case SC_VALERR_WARNING: eStyle = sheet::ValidationAlertStyle_WARNING; break;
970cdf0e10cSrcweir case SC_VALERR_INFO: eStyle = sheet::ValidationAlertStyle_INFO; break;
971cdf0e10cSrcweir case SC_VALERR_MACRO: eStyle = sheet::ValidationAlertStyle_MACRO; break;
972cdf0e10cSrcweir }
973cdf0e10cSrcweir aRet <<= eStyle;
974cdf0e10cSrcweir }
975cdf0e10cSrcweir
976cdf0e10cSrcweir return aRet;
977cdf0e10cSrcweir }
978cdf0e10cSrcweir
SC_IMPL_DUMMY_PROPERTY_LISTENER(ScTableValidationObj)979cdf0e10cSrcweir SC_IMPL_DUMMY_PROPERTY_LISTENER( ScTableValidationObj )
980cdf0e10cSrcweir
981cdf0e10cSrcweir // XUnoTunnel
982cdf0e10cSrcweir
983cdf0e10cSrcweir sal_Int64 SAL_CALL ScTableValidationObj::getSomething(
984cdf0e10cSrcweir const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException)
985cdf0e10cSrcweir {
986cdf0e10cSrcweir if ( rId.getLength() == 16 &&
987cdf0e10cSrcweir 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
988cdf0e10cSrcweir rId.getConstArray(), 16 ) )
989cdf0e10cSrcweir {
990cdf0e10cSrcweir return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
991cdf0e10cSrcweir }
992cdf0e10cSrcweir return 0;
993cdf0e10cSrcweir }
994cdf0e10cSrcweir
995cdf0e10cSrcweir // static
getUnoTunnelId()996cdf0e10cSrcweir const uno::Sequence<sal_Int8>& ScTableValidationObj::getUnoTunnelId()
997cdf0e10cSrcweir {
998cdf0e10cSrcweir static uno::Sequence<sal_Int8> * pSeq = 0;
999cdf0e10cSrcweir if( !pSeq )
1000cdf0e10cSrcweir {
1001cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
1002cdf0e10cSrcweir if( !pSeq )
1003cdf0e10cSrcweir {
1004cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aSeq( 16 );
1005cdf0e10cSrcweir rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
1006cdf0e10cSrcweir pSeq = &aSeq;
1007cdf0e10cSrcweir }
1008cdf0e10cSrcweir }
1009cdf0e10cSrcweir return *pSeq;
1010cdf0e10cSrcweir }
1011cdf0e10cSrcweir
1012cdf0e10cSrcweir // static
getImplementation(const uno::Reference<beans::XPropertySet> xObj)1013cdf0e10cSrcweir ScTableValidationObj* ScTableValidationObj::getImplementation(
1014cdf0e10cSrcweir const uno::Reference<beans::XPropertySet> xObj )
1015cdf0e10cSrcweir {
1016cdf0e10cSrcweir ScTableValidationObj* pRet = NULL;
1017cdf0e10cSrcweir uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
1018cdf0e10cSrcweir if (xUT.is())
1019cdf0e10cSrcweir pRet = reinterpret_cast<ScTableValidationObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
1020cdf0e10cSrcweir return pRet;
1021cdf0e10cSrcweir }
1022cdf0e10cSrcweir
1023cdf0e10cSrcweir //------------------------------------------------------------------------
1024cdf0e10cSrcweir
1025cdf0e10cSrcweir
1026cdf0e10cSrcweir
1027cdf0e10cSrcweir
1028