LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/unoobj - fmtuno.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 548 0.2 %
Date: 2012-12-27 Functions: 2 82 2.4 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10