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