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

Generated by: LCOV version 1.10