LCOV - code coverage report
Current view: top level - sc/source/ui/unoobj - fielduno.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 446 728 61.3 %
Date: 2014-04-11 Functions: 63 93 67.7 %
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             : #include "fielduno.hxx"
      21             : #include "textuno.hxx"
      22             : #include "miscuno.hxx"
      23             : #include "docsh.hxx"
      24             : #include "hints.hxx"
      25             : #include "editsrc.hxx"
      26             : #include "cellsuno.hxx"
      27             : #include "servuno.hxx"
      28             : #include "unonames.hxx"
      29             : #include "editutil.hxx"
      30             : 
      31             : #include <svl/smplhint.hxx>
      32             : #include <vcl/svapp.hxx>
      33             : 
      34             : 
      35             : #include <editeng/eeitem.hxx>
      36             : 
      37             : #include <editeng/editeng.hxx>
      38             : #include <editeng/editobj.hxx>
      39             : #include <editeng/flditem.hxx>
      40             : #include <comphelper/servicehelper.hxx>
      41             : #include <cppuhelper/supportsservice.hxx>
      42             : 
      43             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      44             : #include <com/sun/star/text/TextContentAnchorType.hpp>
      45             : #include <com/sun/star/text/WrapTextMode.hpp>
      46             : #include <com/sun/star/text/FilenameDisplayFormat.hpp>
      47             : #include <com/sun/star/text/textfield/Type.hpp>
      48             : 
      49             : using namespace com::sun::star;
      50             : 
      51             : namespace {
      52             : 
      53             : //  alles ohne Which-ID, Map nur fuer PropertySetInfo
      54             : 
      55         230 : const SfxItemPropertySet* getDateTimePropertySet()
      56             : {
      57             :     static const SfxItemPropertyMapEntry aMapContent[] =
      58             :     {
      59          22 :         { OUString(SC_UNONAME_DATETIME), 0, getCppuType((const util::DateTime*)0), 0, 0 },
      60          22 :         { OUString(SC_UNONAME_ISFIXED),  0, getBooleanCppuType(),                  0, 0 },
      61          22 :         { OUString(SC_UNONAME_ISDATE),   0, getBooleanCppuType(),                  0, 0 },
      62          22 :         { OUString(SC_UNONAME_NUMFMT),   0, getCppuType((const sal_Int32*)0),      0, 0 },
      63             :         { OUString(), 0, css::uno::Type(), 0, 0 }
      64         340 :     };
      65         230 :     static SfxItemPropertySet aMap(aMapContent);
      66         230 :     return &aMap;
      67             : }
      68             : 
      69         110 : const SfxItemPropertySet* getEmptyPropertySet()
      70             : {
      71             :     static const SfxItemPropertyMapEntry aMapContent[] =
      72             :     {
      73             :         { OUString(), 0, css::uno::Type(), 0, 0 }
      74         131 :     };
      75         110 :     static SfxItemPropertySet aMap(aMapContent);
      76         110 :     return &aMap;
      77             : }
      78             : 
      79          16 : const SfxItemPropertySet* lcl_GetURLPropertySet()
      80             : {
      81             :     static const SfxItemPropertyMapEntry aURLPropertyMap_Impl[] =
      82             :     {
      83           2 :         {OUString(SC_UNONAME_ANCTYPE),  0,  getCppuType((text::TextContentAnchorType*)0), beans::PropertyAttribute::READONLY, 0 },
      84           2 :         {OUString(SC_UNONAME_ANCTYPES), 0,  getCppuType((uno::Sequence<text::TextContentAnchorType>*)0), beans::PropertyAttribute::READONLY, 0 },
      85           2 :         {OUString(SC_UNONAME_REPR),     0,  getCppuType((OUString*)0),    0, 0},
      86           2 :         {OUString(SC_UNONAME_TARGET),   0,  getCppuType((OUString*)0),    0, 0},
      87           2 :         {OUString(SC_UNONAME_TEXTWRAP), 0,  getCppuType((text::WrapTextMode*)0), beans::PropertyAttribute::READONLY, 0 },
      88           2 :         {OUString(SC_UNONAME_URL),      0,  getCppuType((OUString*)0),    0, 0},
      89             :         { OUString(), 0, css::uno::Type(), 0, 0 }
      90          30 :     };
      91          16 :     static SfxItemPropertySet aURLPropertySet_Impl( aURLPropertyMap_Impl );
      92          16 :     return &aURLPropertySet_Impl;
      93             : }
      94             : 
      95         623 : const SfxItemPropertySet* lcl_GetHeaderFieldPropertySet()
      96             : {
      97             :     static const SfxItemPropertyMapEntry aHeaderFieldPropertyMap_Impl[] =
      98             :     {
      99          20 :         {OUString(SC_UNONAME_ANCTYPE),  0,  getCppuType((text::TextContentAnchorType*)0), beans::PropertyAttribute::READONLY, 0 },
     100          20 :         {OUString(SC_UNONAME_ANCTYPES), 0,  getCppuType((uno::Sequence<text::TextContentAnchorType>*)0), beans::PropertyAttribute::READONLY, 0 },
     101          20 :         {OUString(SC_UNONAME_TEXTWRAP), 0,  getCppuType((text::WrapTextMode*)0), beans::PropertyAttribute::READONLY, 0 },
     102             :         { OUString(), 0, css::uno::Type(), 0, 0 }
     103         703 :     };
     104         623 :     static SfxItemPropertySet aHeaderFieldPropertySet_Impl( aHeaderFieldPropertyMap_Impl );
     105         623 :     return &aHeaderFieldPropertySet_Impl;
     106             : }
     107             : 
     108           2 : const SfxItemPropertySet* lcl_GetFileFieldPropertySet()
     109             : {
     110             :     static const SfxItemPropertyMapEntry aFileFieldPropertyMap_Impl[] =
     111             :     {
     112           1 :         {OUString(SC_UNONAME_ANCTYPE),  0,  getCppuType((text::TextContentAnchorType*)0), beans::PropertyAttribute::READONLY, 0 },
     113           1 :         {OUString(SC_UNONAME_ANCTYPES), 0,  getCppuType((uno::Sequence<text::TextContentAnchorType>*)0), beans::PropertyAttribute::READONLY, 0 },
     114           1 :         {OUString(SC_UNONAME_FILEFORM), 0,  getCppuType((sal_Int16*)0),        0, 0 },
     115           1 :         {OUString(SC_UNONAME_TEXTWRAP), 0,  getCppuType((text::WrapTextMode*)0), beans::PropertyAttribute::READONLY, 0 },
     116             :         { OUString(), 0, css::uno::Type(), 0, 0 }
     117           7 :     };
     118           2 :     static SfxItemPropertySet aFileFieldPropertySet_Impl( aFileFieldPropertyMap_Impl );
     119           2 :     return &aFileFieldPropertySet_Impl;
     120             : }
     121             : 
     122           0 : SvxFileFormat lcl_UnoToSvxFileFormat( sal_Int16 nUnoValue )
     123             : {
     124           0 :     switch( nUnoValue )
     125             :     {
     126           0 :         case text::FilenameDisplayFormat::FULL: return SVXFILEFORMAT_FULLPATH;
     127           0 :         case text::FilenameDisplayFormat::PATH: return SVXFILEFORMAT_PATH;
     128           0 :         case text::FilenameDisplayFormat::NAME: return SVXFILEFORMAT_NAME;
     129             :         default:
     130           0 :             return SVXFILEFORMAT_NAME_EXT;
     131             :     }
     132             : }
     133             : 
     134           0 : sal_Int16 lcl_SvxToUnoFileFormat( SvxFileFormat nSvxValue )
     135             : {
     136           0 :     switch( nSvxValue )
     137             :     {
     138           0 :         case SVXFILEFORMAT_NAME_EXT:    return text::FilenameDisplayFormat::NAME_AND_EXT;
     139           0 :         case SVXFILEFORMAT_FULLPATH:    return text::FilenameDisplayFormat::FULL;
     140           0 :         case SVXFILEFORMAT_PATH:        return text::FilenameDisplayFormat::PATH;
     141             :         default:
     142           0 :             return text::FilenameDisplayFormat::NAME;
     143             :     }
     144             : }
     145             : 
     146             : }
     147             : 
     148             : 
     149           0 : SC_SIMPLE_SERVICE_INFO( ScCellFieldsObj, "ScCellFieldsObj", "com.sun.star.text.TextFields" )
     150           0 : SC_SIMPLE_SERVICE_INFO( ScHeaderFieldsObj, "ScHeaderFieldsObj", "com.sun.star.text.TextFields" )
     151             : 
     152             : //  ScUnoEditEngine nur um aus einer EditEngine die Felder herauszubekommen...
     153             : 
     154             : enum ScUnoCollectMode
     155             : {
     156             :     SC_UNO_COLLECT_NONE,
     157             :     SC_UNO_COLLECT_COUNT,
     158             :     SC_UNO_COLLECT_FINDINDEX,
     159             :     SC_UNO_COLLECT_FINDPOS
     160             : };
     161             : 
     162             : /**
     163             :  * This class exists solely to allow searching through field items.  TODO:
     164             :  * Look into providing the same functionality directly in EditEngine, to
     165             :  * avoid having this class altogether.
     166             :  */
     167             : class ScUnoEditEngine : public ScEditEngineDefaulter
     168             : {
     169             :     ScUnoCollectMode    eMode;
     170             :     sal_uInt16              nFieldCount;
     171             :     sal_Int32           mnFieldType;
     172             :     SvxFieldData*       pFound;         // lokale Kopie
     173             :     sal_Int32           nFieldPar;
     174             :     sal_Int32           nFieldPos;
     175             :     sal_uInt16              nFieldIndex;
     176             : 
     177             : public:
     178             :                 ScUnoEditEngine(ScEditEngineDefaulter* pSource);
     179             :                 virtual ~ScUnoEditEngine();
     180             : 
     181             :     virtual OUString  CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos,
     182             :                                     Color*& rTxtColor, Color*& rFldColor ) SAL_OVERRIDE;
     183             : 
     184             :     sal_uInt16 CountFields();
     185             :     SvxFieldData* FindByIndex(sal_uInt16 nIndex);
     186             :     SvxFieldData* FindByPos(sal_Int32 nPar, sal_Int32 nPos, sal_Int32 nType);
     187             : 
     188           2 :     sal_Int32       GetFieldPar() const     { return nFieldPar; }
     189           2 :     sal_Int32       GetFieldPos() const     { return nFieldPos; }
     190             : };
     191             : 
     192          86 : ScUnoEditEngine::ScUnoEditEngine(ScEditEngineDefaulter* pSource)
     193             :     : ScEditEngineDefaulter(*pSource)
     194             :     , eMode(SC_UNO_COLLECT_NONE)
     195             :     , nFieldCount(0)
     196             :     , mnFieldType(text::textfield::Type::UNSPECIFIED)
     197             :     , pFound(NULL)
     198             :     , nFieldPar(0)
     199             :     , nFieldPos(0)
     200          86 :     , nFieldIndex(0)
     201             : {
     202          86 :     if (pSource)
     203             :     {
     204          86 :         EditTextObject* pData = pSource->CreateTextObject();
     205          86 :         SetText( *pData );
     206          86 :         delete pData;
     207             :     }
     208          86 : }
     209             : 
     210         172 : ScUnoEditEngine::~ScUnoEditEngine()
     211             : {
     212          86 :     delete pFound;
     213          86 : }
     214             : 
     215         172 : OUString ScUnoEditEngine::CalcFieldValue( const SvxFieldItem& rField,
     216             :             sal_Int32 nPara, sal_Int32 nPos, Color*& rTxtColor, Color*& rFldColor )
     217             : {
     218         172 :     OUString aRet(EditEngine::CalcFieldValue( rField, nPara, nPos, rTxtColor, rFldColor ));
     219         172 :     if (eMode != SC_UNO_COLLECT_NONE)
     220             :     {
     221          86 :         const SvxFieldData* pFieldData = rField.GetField();
     222          86 :         if ( pFieldData )
     223             :         {
     224          86 :             if (mnFieldType == text::textfield::Type::UNSPECIFIED || pFieldData->GetClassId() == mnFieldType)
     225             :             {
     226          86 :                 if ( eMode == SC_UNO_COLLECT_FINDINDEX && !pFound && nFieldCount == nFieldIndex )
     227             :                 {
     228           2 :                     pFound = pFieldData->Clone();
     229           2 :                     nFieldPar = nPara;
     230           2 :                     nFieldPos = nPos;
     231             :                 }
     232         163 :                 if ( eMode == SC_UNO_COLLECT_FINDPOS && !pFound &&
     233         154 :                         nPara == nFieldPar && nPos == nFieldPos )
     234             :                 {
     235          77 :                     pFound = pFieldData->Clone();
     236          77 :                     nFieldIndex = nFieldCount;
     237             :                 }
     238          86 :                 ++nFieldCount;
     239             :             }
     240             :         }
     241             :     }
     242         172 :     return aRet;
     243             : }
     244             : 
     245           6 : sal_uInt16 ScUnoEditEngine::CountFields()
     246             : {
     247           6 :     eMode = SC_UNO_COLLECT_COUNT;
     248           6 :     mnFieldType = text::textfield::Type::UNSPECIFIED;
     249           6 :     nFieldCount = 0;
     250           6 :     UpdateFields();
     251           6 :     eMode = SC_UNO_COLLECT_NONE;
     252             : 
     253           6 :     return nFieldCount;
     254             : }
     255             : 
     256           3 : SvxFieldData* ScUnoEditEngine::FindByIndex(sal_uInt16 nIndex)
     257             : {
     258           3 :     eMode = SC_UNO_COLLECT_FINDINDEX;
     259           3 :     nFieldIndex = nIndex;
     260           3 :     mnFieldType = text::textfield::Type::UNSPECIFIED;
     261           3 :     nFieldCount = 0;
     262           3 :     UpdateFields();
     263           3 :     eMode = SC_UNO_COLLECT_NONE;
     264             : 
     265           3 :     return pFound;
     266             : }
     267             : 
     268          77 : SvxFieldData* ScUnoEditEngine::FindByPos(sal_Int32 nPar, sal_Int32 nPos, sal_Int32 nType)
     269             : {
     270          77 :     eMode = SC_UNO_COLLECT_FINDPOS;
     271          77 :     nFieldPar = nPar;
     272          77 :     nFieldPos = nPos;
     273          77 :     mnFieldType = nType;
     274          77 :     nFieldCount = 0;
     275          77 :     UpdateFields();
     276          77 :     mnFieldType = text::textfield::Type::UNSPECIFIED;
     277          77 :     eMode = SC_UNO_COLLECT_NONE;
     278             : 
     279          77 :     return pFound;
     280             : }
     281             : 
     282           4 : ScCellFieldsObj::ScCellFieldsObj(
     283             :     const uno::Reference<text::XTextRange>& xContent,
     284             :     ScDocShell* pDocSh, const ScAddress& rPos) :
     285             :     mxContent(xContent),
     286             :     pDocShell( pDocSh ),
     287             :     aCellPos( rPos ),
     288           4 :     mpRefreshListeners( NULL )
     289             : {
     290           4 :     pDocShell->GetDocument()->AddUnoObject(*this);
     291             : 
     292           4 :     mpEditSource = new ScCellEditSource( pDocShell, aCellPos );
     293           4 : }
     294             : 
     295          12 : ScCellFieldsObj::~ScCellFieldsObj()
     296             : {
     297           4 :     if (pDocShell)
     298           0 :         pDocShell->GetDocument()->RemoveUnoObject(*this);
     299             : 
     300           4 :     delete mpEditSource;
     301             : 
     302             :     // increment refcount to prevent double call off dtor
     303           4 :     osl_atomic_increment( &m_refCount );
     304             : 
     305           4 :     if (mpRefreshListeners)
     306             :     {
     307           1 :         lang::EventObject aEvent;
     308           1 :         aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
     309           1 :         if (mpRefreshListeners)
     310             :         {
     311           1 :             mpRefreshListeners->disposeAndClear(aEvent);
     312           1 :             DELETEZ( mpRefreshListeners );
     313           1 :         }
     314             :     }
     315           8 : }
     316             : 
     317           4 : void ScCellFieldsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
     318             : {
     319           4 :     if ( rHint.ISA( ScUpdateRefHint ) )
     320             :     {
     321             :         //! Ref-Update
     322             :     }
     323           8 :     else if ( rHint.ISA( SfxSimpleHint ) &&
     324           4 :             ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
     325             :     {
     326           4 :         pDocShell = NULL;       // ungueltig geworden
     327             :     }
     328             : 
     329             :     //  EditSource hat sich selber als Listener angemeldet
     330           4 : }
     331             : 
     332             : // XIndexAccess (via XTextFields)
     333             : 
     334           3 : uno::Reference<text::XTextField> ScCellFieldsObj::GetObjectByIndex_Impl(sal_Int32 Index) const
     335             : {
     336             :     //! Feld-Funktionen muessen an den Forwarder !!!
     337           3 :     ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
     338           3 :     ScUnoEditEngine aTempEngine(pEditEngine);
     339           3 :     SvxFieldData* pData = aTempEngine.FindByIndex(static_cast<sal_uInt16>(Index));
     340           3 :     if (!pData)
     341           1 :         return uno::Reference<text::XTextField>();
     342             : 
     343           2 :     sal_Int32 nPar = aTempEngine.GetFieldPar();
     344           2 :     sal_Int32 nPos = aTempEngine.GetFieldPos();
     345           2 :     ESelection aSelection( nPar, nPos, nPar, nPos+1 );      // Feld ist 1 Zeichen
     346             : 
     347           2 :     sal_Int32 eType = pData->GetClassId();
     348             :     uno::Reference<text::XTextField> xRet(
     349           4 :         new ScEditFieldObj(mxContent, new ScCellEditSource(pDocShell, aCellPos), eType, aSelection));
     350           5 :     return xRet;
     351             : }
     352             : 
     353           5 : sal_Int32 SAL_CALL ScCellFieldsObj::getCount() throw(uno::RuntimeException, std::exception)
     354             : {
     355           5 :     SolarMutexGuard aGuard;
     356             : 
     357             :     //! Feld-Funktionen muessen an den Forwarder !!!
     358           5 :     ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
     359          10 :     ScUnoEditEngine aTempEngine(pEditEngine);
     360             : 
     361          10 :     return aTempEngine.CountFields();       // Felder zaehlen, in Zelle ist der Typ egal
     362             : }
     363             : 
     364           3 : uno::Any SAL_CALL ScCellFieldsObj::getByIndex( sal_Int32 nIndex )
     365             :                             throw(lang::IndexOutOfBoundsException,
     366             :                                     lang::WrappedTargetException, uno::RuntimeException, std::exception)
     367             : {
     368           3 :     SolarMutexGuard aGuard;
     369           6 :     uno::Reference<text::XTextField> xField(GetObjectByIndex_Impl(nIndex));
     370           3 :     if (xField.is())
     371           4 :         return uno::makeAny(xField);
     372             :     else
     373           4 :         throw lang::IndexOutOfBoundsException();
     374             : }
     375             : 
     376           1 : uno::Type SAL_CALL ScCellFieldsObj::getElementType() throw(uno::RuntimeException, std::exception)
     377             : {
     378           1 :     SolarMutexGuard aGuard;
     379           1 :     return getCppuType((uno::Reference<text::XTextField>*)0);
     380             : }
     381             : 
     382           1 : sal_Bool SAL_CALL ScCellFieldsObj::hasElements() throw(uno::RuntimeException, std::exception)
     383             : {
     384           1 :     SolarMutexGuard aGuard;
     385           1 :     return ( getCount() != 0 );
     386             : }
     387             : 
     388           3 : uno::Reference<container::XEnumeration> SAL_CALL ScCellFieldsObj::createEnumeration()
     389             :                                                     throw(uno::RuntimeException, std::exception)
     390             : {
     391           3 :     SolarMutexGuard aGuard;
     392           3 :     return new ScIndexEnumeration(this, OUString("com.sun.star.text.TextFieldEnumeration"));
     393             : }
     394             : 
     395           0 : void SAL_CALL ScCellFieldsObj::addContainerListener(
     396             :                                 const uno::Reference<container::XContainerListener>& /* xListener */ )
     397             :                                     throw(uno::RuntimeException, std::exception)
     398             : {
     399             :     OSL_FAIL("not implemented");
     400           0 : }
     401             : 
     402           0 : void SAL_CALL ScCellFieldsObj::removeContainerListener(
     403             :                                 const uno::Reference<container::XContainerListener>& /* xListener */ )
     404             :                                     throw(uno::RuntimeException, std::exception)
     405             : {
     406             :     OSL_FAIL("not implemented");
     407           0 : }
     408             : 
     409             : // XRefreshable
     410           2 : void SAL_CALL ScCellFieldsObj::refresh(  )
     411             :                                     throw (uno::RuntimeException, std::exception)
     412             : {
     413           2 :     if (mpRefreshListeners)
     414             :     {
     415             :         //  Call all listeners.
     416           2 :         uno::Sequence< uno::Reference< uno::XInterface > > aListeners(mpRefreshListeners->getElements());
     417           2 :         sal_uInt32 nLength(aListeners.getLength());
     418           2 :         if (nLength)
     419             :         {
     420           1 :             const uno::Reference< uno::XInterface >* pInterfaces = aListeners.getConstArray();
     421           1 :             if (pInterfaces)
     422             :             {
     423           1 :                 lang::EventObject aEvent;
     424           1 :                 aEvent.Source.set(uno::Reference< util::XRefreshable >(const_cast<ScCellFieldsObj*>(this)));
     425           1 :                 sal_uInt32 i(0);
     426           3 :                 while (i < nLength)
     427             :                 {
     428             :                     try
     429             :                     {
     430           3 :                         while(i < nLength)
     431             :                         {
     432           1 :                             static_cast< util::XRefreshListener* >(pInterfaces->get())->refreshed(aEvent);
     433           1 :                             ++pInterfaces;
     434           1 :                             ++i;
     435             :                         }
     436             :                     }
     437           0 :                     catch(uno::RuntimeException&)
     438             :                     {
     439           0 :                         ++pInterfaces;
     440           0 :                         ++i;
     441             :                     }
     442           1 :                 }
     443             :             }
     444           2 :         }
     445             :     }
     446           2 : }
     447             : 
     448           1 : void SAL_CALL ScCellFieldsObj::addRefreshListener( const uno::Reference< util::XRefreshListener >& xListener )
     449             :                                     throw (uno::RuntimeException, std::exception)
     450             : {
     451           1 :     if (xListener.is())
     452             :     {
     453           1 :         SolarMutexGuard aGuard;
     454           1 :         if (!mpRefreshListeners)
     455           1 :             mpRefreshListeners = new cppu::OInterfaceContainerHelper(aMutex);
     456           1 :         mpRefreshListeners->addInterface(xListener);
     457             :     }
     458           1 : }
     459             : 
     460           1 : void SAL_CALL ScCellFieldsObj::removeRefreshListener( const uno::Reference<util::XRefreshListener >& xListener )
     461             :                                     throw (uno::RuntimeException, std::exception)
     462             : {
     463           1 :     if (xListener.is())
     464             :     {
     465           1 :         SolarMutexGuard aGuard;
     466           1 :         if (mpRefreshListeners)
     467           1 :             mpRefreshListeners->removeInterface(xListener);
     468             :     }
     469           1 : }
     470             : 
     471           1 : ScHeaderFieldsObj::ScHeaderFieldsObj(ScHeaderFooterTextData& rData) :
     472             :     mrData(rData),
     473           1 :     mpRefreshListeners( NULL )
     474             : {
     475           1 :     mpEditSource = new ScHeaderFooterEditSource(rData);
     476           1 : }
     477             : 
     478           3 : ScHeaderFieldsObj::~ScHeaderFieldsObj()
     479             : {
     480           1 :     delete mpEditSource;
     481             : 
     482             :     // increment refcount to prevent double call off dtor
     483           1 :     osl_atomic_increment( &m_refCount );
     484             : 
     485           1 :     if (mpRefreshListeners)
     486             :     {
     487           1 :         lang::EventObject aEvent;
     488           1 :         aEvent.Source = static_cast<cppu::OWeakObject*>(this);
     489           1 :         if (mpRefreshListeners)
     490             :         {
     491           1 :             mpRefreshListeners->disposeAndClear(aEvent);
     492           1 :             DELETEZ( mpRefreshListeners );
     493           1 :         }
     494             :     }
     495           2 : }
     496             : 
     497             : // XIndexAccess (via XTextFields)
     498             : 
     499           0 : uno::Reference<text::XTextField> ScHeaderFieldsObj::GetObjectByIndex_Impl(sal_Int32 Index) const
     500             : {
     501             :     //! Feld-Funktionen muessen an den Forwarder !!!
     502           0 :     ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
     503           0 :     ScUnoEditEngine aTempEngine(pEditEngine);
     504             : 
     505           0 :     SvxFieldData* pData = aTempEngine.FindByIndex(static_cast<sal_uInt16>(Index));
     506           0 :     if (!pData)
     507           0 :         return NULL;
     508             : 
     509             :     // Get the parent text range instance.
     510           0 :     uno::Reference<text::XTextRange> xTextRange;
     511           0 :     ScHeaderFooterContentObj& rContentObj = mrData.GetContentObj();
     512           0 :     uno::Reference<text::XText> xText;
     513           0 :     sal_uInt16 nPart = mrData.GetPart();
     514           0 :     if (nPart == SC_HDFT_LEFT)
     515           0 :         xText = rContentObj.getLeftText();
     516           0 :     else if (nPart == SC_HDFT_CENTER)
     517           0 :         xText = rContentObj.getCenterText();
     518             :     else
     519           0 :         xText = rContentObj.getRightText();
     520             : 
     521           0 :     uno::Reference<text::XTextRange> xTemp(xText, uno::UNO_QUERY);
     522           0 :     xTextRange = xTemp;
     523             : 
     524           0 :     sal_Int32 nPar = aTempEngine.GetFieldPar();
     525           0 :     sal_Int32 nPos = aTempEngine.GetFieldPos();
     526           0 :     ESelection aSelection( nPar, nPos, nPar, nPos+1 );      // Field is 1 character
     527             : 
     528           0 :     sal_Int32 eRealType = pData->GetClassId();
     529             :     uno::Reference<text::XTextField> xRet(
     530           0 :         new ScEditFieldObj(xTextRange, new ScHeaderFooterEditSource(mrData), eRealType, aSelection));
     531           0 :     return xRet;
     532             : }
     533             : 
     534           1 : sal_Int32 SAL_CALL ScHeaderFieldsObj::getCount() throw(uno::RuntimeException, std::exception)
     535             : {
     536           1 :     SolarMutexGuard aGuard;
     537             : 
     538             :     //! Feld-Funktionen muessen an den Forwarder !!!
     539           1 :     ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
     540           2 :     ScUnoEditEngine aTempEngine(pEditEngine);
     541           2 :     return aTempEngine.CountFields();
     542             : }
     543             : 
     544           0 : uno::Any SAL_CALL ScHeaderFieldsObj::getByIndex( sal_Int32 nIndex )
     545             :                             throw(lang::IndexOutOfBoundsException,
     546             :                                     lang::WrappedTargetException, uno::RuntimeException, std::exception)
     547             : {
     548           0 :     SolarMutexGuard aGuard;
     549           0 :     uno::Reference<text::XTextField> xField(GetObjectByIndex_Impl(nIndex));
     550           0 :     if (xField.is())
     551           0 :         return uno::makeAny(xField);
     552             :     else
     553           0 :         throw lang::IndexOutOfBoundsException();
     554             : }
     555             : 
     556           1 : uno::Type SAL_CALL ScHeaderFieldsObj::getElementType() throw(uno::RuntimeException, std::exception)
     557             : {
     558           1 :     SolarMutexGuard aGuard;
     559           1 :     return getCppuType((uno::Reference<text::XTextField>*)0);
     560             : }
     561             : 
     562           1 : sal_Bool SAL_CALL ScHeaderFieldsObj::hasElements() throw(uno::RuntimeException, std::exception)
     563             : {
     564           1 :     SolarMutexGuard aGuard;
     565           1 :     return ( getCount() != 0 );
     566             : }
     567             : 
     568           1 : uno::Reference<container::XEnumeration> SAL_CALL ScHeaderFieldsObj::createEnumeration()
     569             :                                                     throw(uno::RuntimeException, std::exception)
     570             : {
     571           1 :     SolarMutexGuard aGuard;
     572           1 :     return new ScIndexEnumeration(this, OUString("com.sun.star.text.TextFieldEnumeration"));
     573             : }
     574             : 
     575           0 : void SAL_CALL ScHeaderFieldsObj::addContainerListener(
     576             :                                 const uno::Reference<container::XContainerListener>& /* xListener */ )
     577             :                                     throw(uno::RuntimeException, std::exception)
     578             : {
     579             :     OSL_FAIL("not implemented");
     580           0 : }
     581             : 
     582           0 : void SAL_CALL ScHeaderFieldsObj::removeContainerListener(
     583             :                                 const uno::Reference<container::XContainerListener>& /* xListener */ )
     584             :                                     throw(uno::RuntimeException, std::exception)
     585             : {
     586             :     OSL_FAIL("not implemented");
     587           0 : }
     588             : 
     589             : // XRefreshable
     590           2 : void SAL_CALL ScHeaderFieldsObj::refresh(  )
     591             :                                     throw (uno::RuntimeException, std::exception)
     592             : {
     593           2 :     if (mpRefreshListeners)
     594             :     {
     595             :         //  Call all listeners.
     596           2 :         uno::Sequence< uno::Reference< uno::XInterface > > aListeners(mpRefreshListeners->getElements());
     597           2 :         sal_uInt32 nLength(aListeners.getLength());
     598           2 :         if (nLength)
     599             :         {
     600           1 :             const uno::Reference< uno::XInterface >* pInterfaces = aListeners.getConstArray();
     601           1 :             if (pInterfaces)
     602             :             {
     603           1 :                 lang::EventObject aEvent;
     604           1 :                 aEvent.Source.set(uno::Reference< util::XRefreshable >(const_cast<ScHeaderFieldsObj*>(this)));
     605           1 :                 sal_uInt32 i(0);
     606           3 :                 while (i < nLength)
     607             :                 {
     608             :                     try
     609             :                     {
     610           3 :                         while(i < nLength)
     611             :                         {
     612           1 :                             static_cast< util::XRefreshListener* >(pInterfaces->get())->refreshed(aEvent);
     613           1 :                             ++pInterfaces;
     614           1 :                             ++i;
     615             :                         }
     616             :                     }
     617           0 :                     catch(uno::RuntimeException&)
     618             :                     {
     619           0 :                         ++pInterfaces;
     620           0 :                         ++i;
     621             :                     }
     622           1 :                 }
     623             :             }
     624           2 :         }
     625             :     }
     626           2 : }
     627             : 
     628           1 : void SAL_CALL ScHeaderFieldsObj::addRefreshListener( const uno::Reference< util::XRefreshListener >& xListener )
     629             :                                     throw (uno::RuntimeException, std::exception)
     630             : {
     631           1 :     if (xListener.is())
     632             :     {
     633           1 :         SolarMutexGuard aGuard;
     634           1 :         if (!mpRefreshListeners)
     635           1 :             mpRefreshListeners = new cppu::OInterfaceContainerHelper(aMutex);
     636           1 :         mpRefreshListeners->addInterface(xListener);
     637             :     }
     638           1 : }
     639             : 
     640           1 : void SAL_CALL ScHeaderFieldsObj::removeRefreshListener( const uno::Reference<util::XRefreshListener >& xListener )
     641             :                                     throw (uno::RuntimeException, std::exception)
     642             : {
     643           1 :     if (xListener.is())
     644             :     {
     645           1 :         SolarMutexGuard aGuard;
     646           1 :         if (mpRefreshListeners)
     647           1 :             mpRefreshListeners->removeInterface(xListener);
     648             :     }
     649           1 : }
     650             : 
     651         955 : SvxFieldData* ScEditFieldObj::getData()
     652             : {
     653         955 :     if (!mpData)
     654             :     {
     655         951 :         switch (meType)
     656             :         {
     657             :             case text::textfield::Type::DATE:
     658           0 :                 mpData.reset(new SvxDateField);
     659           0 :             break;
     660             :             case text::textfield::Type::EXTENDED_FILE:
     661             :                 mpData.reset(
     662           0 :                     new SvxExtFileField(OUString(), SVXFILETYPE_VAR, SVXFILEFORMAT_NAME_EXT));
     663           0 :             break;
     664             :             case text::textfield::Type::PAGE:
     665         252 :                 mpData.reset(new SvxPageField);
     666         252 :             break;
     667             :             case text::textfield::Type::PAGES:
     668         107 :                 mpData.reset(new SvxPagesField);
     669         107 :             break;
     670             :             case text::textfield::Type::TABLE:
     671         258 :                 mpData.reset(new SvxTableField);
     672         258 :             break;
     673             :             case text::textfield::Type::TIME:
     674           3 :                 mpData.reset(new SvxTimeField);
     675           3 :             break;
     676             :             case text::textfield::Type::EXTENDED_TIME:
     677             :             {
     678         218 :                 if (mbIsDate)
     679         111 :                     mpData.reset(new SvxDateField);
     680             :                 else
     681         107 :                     mpData.reset(new SvxExtTimeField);
     682             :             }
     683         218 :             break;
     684             :             case text::textfield::Type::DOCINFO_TITLE:
     685         107 :                 mpData.reset(new SvxFileField);
     686         107 :             break;
     687             :             case text::textfield::Type::URL:
     688             :                 mpData.reset(
     689           6 :                     new SvxURLField(OUString(), OUString(), SVXURLFORMAT_APPDEFAULT));
     690           6 :             break;
     691             :             default:
     692           0 :                 mpData.reset(new SvxFieldData);
     693             :         }
     694             :     }
     695         955 :     return mpData.get();
     696             : }
     697             : 
     698          16 : void ScEditFieldObj::setPropertyValueURL(const OUString& rName, const com::sun::star::uno::Any& rVal)
     699             : {
     700          16 :     OUString aStrVal;
     701          16 :     if (mpEditSource)
     702             :     {
     703             :         // Edit engine instance already exists for this field item.  Use it.
     704          12 :         ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
     705          12 :         ScUnoEditEngine aTempEngine(pEditEngine);
     706             : 
     707             :         //  Typ egal (in Zellen gibts nur URLs)
     708             :         SvxFieldData* pField = aTempEngine.FindByPos(
     709          12 :             aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::UNSPECIFIED);
     710             :         OSL_ENSURE(pField,"setPropertyValue: Feld nicht gefunden");
     711          12 :         if (!pField)
     712           0 :             return;
     713             : 
     714          12 :         if (pField->GetClassId() != text::textfield::Type::URL)
     715             :             // Make sure this is indeed a URL field.
     716           0 :             return;
     717             : 
     718          12 :         SvxURLField* pURL = static_cast<SvxURLField*>(pField);
     719             : 
     720          12 :         if (rName == SC_UNONAME_URL)
     721             :         {
     722           4 :             if (rVal >>= aStrVal)
     723           4 :                 pURL->SetURL(aStrVal);
     724             :         }
     725           8 :         else if (rName == SC_UNONAME_REPR)
     726             :         {
     727           4 :             if (rVal >>= aStrVal)
     728           4 :                 pURL->SetRepresentation(aStrVal);
     729             :         }
     730           4 :         else if (rName == SC_UNONAME_TARGET)
     731             :         {
     732           4 :             if (rVal >>= aStrVal)
     733           4 :                 pURL->SetTargetFrame(aStrVal);
     734             :         }
     735             :         else
     736           0 :             throw beans::UnknownPropertyException();
     737             : 
     738          12 :         pEditEngine->QuickInsertField( SvxFieldItem(*pField, EE_FEATURE_FIELD), aSelection );
     739          12 :         mpEditSource->UpdateData();
     740          12 :         return;
     741             :     }
     742             : 
     743             :     // Edit engine instance not yet present.  Store the item data for later use.
     744           4 :     SvxFieldData* pData = getData();
     745           4 :     if (!pData)
     746           0 :         throw uno::RuntimeException();
     747             : 
     748           4 :     SvxURLField* p = static_cast<SvxURLField*>(pData);
     749           4 :     if (rName == SC_UNONAME_URL)
     750             :     {
     751           2 :         if (rVal >>= aStrVal)
     752           2 :             p->SetURL(aStrVal);
     753             :     }
     754           2 :     else if (rName == SC_UNONAME_REPR)
     755             :     {
     756           2 :         if (rVal >>= aStrVal)
     757           2 :             p->SetRepresentation(aStrVal);
     758             :     }
     759           0 :     else if (rName == SC_UNONAME_TARGET)
     760             :     {
     761           0 :         if (rVal >>= aStrVal)
     762           0 :             p->SetTargetFrame(aStrVal);
     763             :     }
     764             :     else
     765           0 :         throw beans::UnknownPropertyException();
     766             : }
     767             : 
     768          27 : uno::Any ScEditFieldObj::getPropertyValueURL(const OUString& rName)
     769             : {
     770          27 :     uno::Any aRet;
     771             : 
     772             :     // anchor type is always "as character", text wrap always "none"
     773             : 
     774          27 :     if (mpEditSource)
     775             :     {
     776             :         //! Feld-Funktionen muessen an den Forwarder !!!
     777          27 :         ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
     778          27 :         ScUnoEditEngine aTempEngine(pEditEngine);
     779             : 
     780             :         //  Typ egal (in Zellen gibts nur URLs)
     781             :         const SvxFieldData* pField = aTempEngine.FindByPos(
     782          27 :             aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::UNSPECIFIED);
     783             :         OSL_ENSURE(pField,"getPropertyValue: Feld nicht gefunden");
     784          27 :         if (!pField)
     785           0 :             throw uno::RuntimeException();
     786             : 
     787          27 :         if (pField->GetClassId() != text::textfield::Type::URL)
     788           0 :             throw uno::RuntimeException();
     789             : 
     790          27 :         const SvxURLField* pURL = static_cast<const SvxURLField*>(pField);
     791             : 
     792          27 :         if (rName == SC_UNONAME_URL)
     793           9 :             aRet <<= pURL->GetURL();
     794          18 :         else if (rName == SC_UNONAME_REPR)
     795           9 :             aRet <<= pURL->GetRepresentation();
     796           9 :         else if (rName == SC_UNONAME_TARGET)
     797           9 :             aRet <<= pURL->GetTargetFrame();
     798             :         else
     799           0 :             throw beans::UnknownPropertyException();
     800             :     }
     801             :     else        // noch nicht eingefuegt
     802             :     {
     803           0 :         const SvxFieldData* pField = getData();
     804           0 :         if (!pField)
     805           0 :             return aRet;
     806             : 
     807           0 :         const SvxURLField* pURL = static_cast<const SvxURLField*>(pField);
     808           0 :         if (rName == SC_UNONAME_URL)
     809           0 :             aRet <<= pURL->GetURL();
     810           0 :         else if (rName == SC_UNONAME_REPR)
     811           0 :             aRet <<= pURL->GetRepresentation();
     812           0 :         else if (rName == SC_UNONAME_TARGET)
     813           0 :             aRet <<= pURL->GetTargetFrame();
     814             :         else
     815           0 :             throw beans::UnknownPropertyException();
     816             :     }
     817          27 :     return aRet;
     818             : }
     819             : 
     820           0 : void ScEditFieldObj::setPropertyValueFile(const OUString& rName, const uno::Any& rVal)
     821             : {
     822           0 :     if (rName == SC_UNONAME_FILEFORM)
     823             :     {
     824           0 :         sal_Int16 nIntVal = 0;
     825           0 :         if (rVal >>= nIntVal)
     826             :         {
     827           0 :             SvxFileFormat eFormat = lcl_UnoToSvxFileFormat(nIntVal);
     828           0 :             if (mpEditSource)
     829             :             {
     830           0 :                 ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
     831           0 :                 ScUnoEditEngine aTempEngine(pEditEngine);
     832             :                 SvxFieldData* pField = aTempEngine.FindByPos(
     833           0 :                         aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::EXTENDED_FILE);
     834             :                 OSL_ENSURE(pField, "setPropertyValueFile: Field not found");
     835           0 :                 if (pField)
     836             :                 {
     837           0 :                     SvxExtFileField* pExtFile = static_cast<SvxExtFileField*>(pField);   // local to the ScUnoEditEngine
     838           0 :                     pExtFile->SetFormat(eFormat);
     839           0 :                     pEditEngine->QuickInsertField(SvxFieldItem(*pField, EE_FEATURE_FIELD), aSelection);
     840           0 :                     mpEditSource->UpdateData();
     841           0 :                 }
     842             :             }
     843             :             else
     844             :             {
     845           0 :                 SvxFieldData* pField = getData();
     846           0 :                 SvxExtFileField* pExtFile = static_cast<SvxExtFileField*>(pField);
     847           0 :                 pExtFile->SetFormat(eFormat);
     848             :             }
     849             :         }
     850             :     }
     851             :     else
     852           0 :         throw beans::UnknownPropertyException();
     853           0 : }
     854             : 
     855           0 : uno::Any ScEditFieldObj::getPropertyValueFile(const OUString& rName)
     856             : {
     857           0 :     uno::Any aRet;
     858           0 :     if (rName == SC_UNONAME_FILEFORM)
     859             :     {
     860           0 :         SvxFileFormat eFormat = SVXFILEFORMAT_NAME_EXT;
     861           0 :         const SvxFieldData* pField = NULL;
     862           0 :         if (mpEditSource)
     863             :         {
     864           0 :             ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
     865           0 :             ScUnoEditEngine aTempEngine(pEditEngine);
     866             :             pField = aTempEngine.FindByPos(
     867           0 :                 aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::EXTENDED_FILE);
     868             :         }
     869             :         else
     870           0 :             pField = getData();
     871             : 
     872             :         OSL_ENSURE(pField, "setPropertyValueFile: Field not found");
     873           0 :         if (!pField)
     874           0 :             throw uno::RuntimeException();
     875             : 
     876           0 :         const SvxExtFileField* pExtFile = static_cast<const SvxExtFileField*>(pField);
     877           0 :         eFormat = pExtFile->GetFormat();
     878           0 :         sal_Int16 nIntVal = lcl_SvxToUnoFileFormat(eFormat);
     879           0 :         aRet <<= nIntVal;
     880             :     }
     881             :     else
     882           0 :         throw beans::UnknownPropertyException();
     883             : 
     884           0 :     return aRet;
     885             : }
     886             : 
     887         448 : void ScEditFieldObj::setPropertyValueDateTime(const OUString& rName, const uno::Any& rVal)
     888             : {
     889         448 :     if (mpEditSource)
     890             :     {
     891             :         // Field already inserted.
     892          12 :         ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
     893          12 :         ScUnoEditEngine aTempEngine(pEditEngine);
     894          12 :         SvxFieldData* pField = aTempEngine.FindByPos(aSelection.nStartPara, aSelection.nStartPos, meType);
     895          12 :         if (!pField)
     896         448 :             return;
     897             : 
     898          12 :         switch (meType)
     899             :         {
     900             :             case text::textfield::Type::DATE:
     901             :             {
     902           0 :                 SvxDateField* p = static_cast<SvxDateField*>(pField);
     903           0 :                 if (rName == SC_UNONAME_ISDATE)
     904             :                 {
     905             :                     // Do nothing for now.
     906             :                 }
     907           0 :                 else if (rName == SC_UNONAME_ISFIXED)
     908             :                 {
     909           0 :                     SvxDateType eType = rVal.get<sal_Bool>() ? SVXDATETYPE_FIX : SVXDATETYPE_VAR;
     910           0 :                     p->SetType(eType);
     911             :                 }
     912           0 :                 else if (rName == SC_UNONAME_DATETIME)
     913             :                 {
     914           0 :                     maDateTime = rVal.get<util::DateTime>();
     915           0 :                     Date aDate(maDateTime.Day, maDateTime.Month, maDateTime.Year);
     916           0 :                     p->SetFixDate(aDate);
     917             :                 }
     918           0 :                 else if (rName == SC_UNONAME_NUMFMT)
     919             :                 {
     920           0 :                     mnNumFormat = rVal.get<sal_Int32>();
     921           0 :                     p->SetFormat(static_cast<SvxDateFormat>(mnNumFormat));
     922             :                 }
     923             :                 else
     924           0 :                     throw beans::UnknownPropertyException();
     925             :             }
     926           0 :             break;
     927             :             case text::textfield::Type::TIME:
     928             :             {
     929             :                 // SvxTimeField doesn't have any attributes.
     930          39 :                 if (rName != SC_UNONAME_ISDATE && rName != SC_UNONAME_ISFIXED &&
     931          21 :                     rName != SC_UNONAME_DATETIME && rName != SC_UNONAME_NUMFMT)
     932           0 :                     throw beans::UnknownPropertyException();
     933             :             }
     934          12 :             break;
     935             :             case text::textfield::Type::EXTENDED_TIME:
     936             :             {
     937           0 :                 SvxExtTimeField* p = static_cast<SvxExtTimeField*>(pField);
     938           0 :                 if (rName == SC_UNONAME_ISDATE)
     939             :                 {
     940             :                     // Do nothing for now.
     941             :                 }
     942           0 :                 else if (rName == SC_UNONAME_ISFIXED)
     943             :                 {
     944           0 :                     SvxTimeType eType = rVal.get<sal_Bool>() ? SVXTIMETYPE_FIX : SVXTIMETYPE_VAR;
     945           0 :                     p->SetType(eType);
     946             :                 }
     947           0 :                 else if (rName == SC_UNONAME_DATETIME)
     948             :                 {
     949           0 :                     maDateTime = rVal.get<util::DateTime>();
     950           0 :                     Time aTime(maDateTime.Hours, maDateTime.Minutes, maDateTime.Seconds, maDateTime.NanoSeconds);
     951           0 :                     p->SetFixTime(aTime);
     952             :                 }
     953           0 :                 else if (rName == SC_UNONAME_NUMFMT)
     954             :                 {
     955           0 :                     mnNumFormat = rVal.get<sal_Int32>();
     956           0 :                     p->SetFormat(static_cast<SvxTimeFormat>(mnNumFormat));
     957             :                 }
     958             :                 else
     959           0 :                     throw beans::UnknownPropertyException();
     960             :             }
     961           0 :             break;
     962             :             default:
     963           0 :                 throw beans::UnknownPropertyException();
     964          12 :         }
     965             :     }
     966             :     else
     967             :     {
     968         436 :         if (rName == SC_UNONAME_ISDATE)
     969         218 :             mbIsDate = rVal.get<sal_Bool>();
     970         218 :         else if (rName == SC_UNONAME_ISFIXED)
     971         218 :             mbIsFixed = rVal.get<sal_Bool>();
     972           0 :         else if (rName == SC_UNONAME_DATETIME)
     973           0 :             maDateTime = rVal.get<util::DateTime>();
     974           0 :         else if (rName == SC_UNONAME_NUMFMT)
     975           0 :             mnNumFormat = rVal.get<sal_Int32>();
     976             :         else
     977           0 :             throw beans::UnknownPropertyException();
     978             :     }
     979             : }
     980             : 
     981          24 : uno::Any ScEditFieldObj::getPropertyValueDateTime(const OUString& rName)
     982             : {
     983          24 :     if (mpEditSource)
     984             :     {
     985             :         // Field already inserted.
     986          24 :         ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
     987          24 :         ScUnoEditEngine aTempEngine(pEditEngine);
     988          24 :         SvxFieldData* pField = aTempEngine.FindByPos(aSelection.nStartPara, aSelection.nStartPos, meType);
     989          24 :         if (!pField)
     990           0 :             throw uno::RuntimeException();
     991             : 
     992          24 :         switch (meType)
     993             :         {
     994             :             case text::textfield::Type::DATE:
     995             :             {
     996           0 :                 SvxDateField* p = static_cast<SvxDateField*>(pField);
     997           0 :                 if (rName == SC_UNONAME_ISDATE)
     998           0 :                     return uno::makeAny(sal_True);
     999             : 
    1000           0 :                 if (rName == SC_UNONAME_ISFIXED)
    1001           0 :                     return uno::makeAny<sal_Bool>(p->GetType() == SVXDATETYPE_FIX);
    1002             : 
    1003           0 :                 if (rName == SC_UNONAME_DATETIME)
    1004             :                 {
    1005           0 :                     Date aD(p->GetFixDate());
    1006           0 :                     maDateTime.Year = aD.GetYear();
    1007           0 :                     maDateTime.Month = aD.GetMonth();
    1008           0 :                     maDateTime.Day = aD.GetDay();
    1009           0 :                     maDateTime.Hours = 0;
    1010           0 :                     maDateTime.Minutes = 0;
    1011           0 :                     maDateTime.Seconds = 0;
    1012           0 :                     maDateTime.NanoSeconds = 0;
    1013           0 :                     return uno::makeAny(maDateTime);
    1014             :                 }
    1015             : 
    1016           0 :                 if (rName == SC_UNONAME_NUMFMT)
    1017           0 :                     return uno::makeAny<sal_Int32>(p->GetFormat());
    1018             :             }
    1019           0 :             break;
    1020             :             case text::textfield::Type::TIME:
    1021             :             {
    1022             :                 // SvxTimeField doesn't have any attributes.
    1023          24 :                 if (rName == SC_UNONAME_ISDATE)
    1024           6 :                     return uno::makeAny(sal_False);
    1025             : 
    1026          18 :                 if (rName == SC_UNONAME_ISFIXED)
    1027           6 :                     return uno::makeAny(sal_False);
    1028             : 
    1029          12 :                 if (rName == SC_UNONAME_DATETIME)
    1030             :                     // This is the best we can do.
    1031           6 :                     return uno::makeAny(maDateTime);
    1032             : 
    1033           6 :                 if (rName == SC_UNONAME_NUMFMT)
    1034             :                     // Same as above.
    1035           6 :                     return uno::makeAny<sal_Int32>(0);
    1036             :             }
    1037           0 :             break;
    1038             :             case text::textfield::Type::EXTENDED_TIME:
    1039             :             {
    1040           0 :                 SvxExtTimeField* p = static_cast<SvxExtTimeField*>(pField);
    1041           0 :                 if (rName == SC_UNONAME_ISDATE)
    1042           0 :                     return uno::makeAny(sal_False);
    1043             : 
    1044           0 :                 if (rName == SC_UNONAME_ISFIXED)
    1045           0 :                     return uno::makeAny<sal_Bool>(p->GetType() == SVXTIMETYPE_FIX);
    1046             : 
    1047           0 :                 if (rName == SC_UNONAME_DATETIME)
    1048             :                 {
    1049           0 :                     Time aT(p->GetFixTime());
    1050           0 :                     maDateTime.Year = 0;
    1051           0 :                     maDateTime.Month = 0;
    1052           0 :                     maDateTime.Day = 0;
    1053           0 :                     maDateTime.Hours = aT.GetHour();
    1054           0 :                     maDateTime.Minutes = aT.GetMin();
    1055           0 :                     maDateTime.Seconds = aT.GetSec();
    1056           0 :                     maDateTime.NanoSeconds = aT.GetNanoSec();
    1057           0 :                     return uno::makeAny(maDateTime);
    1058             :                 }
    1059             : 
    1060           0 :                 if (rName == SC_UNONAME_NUMFMT)
    1061           0 :                     return uno::makeAny<sal_Int32>(p->GetFormat());
    1062             :             }
    1063           0 :             break;
    1064             :             default:
    1065             :                 ;
    1066           0 :         }
    1067             :     }
    1068             :     else
    1069             :     {
    1070           0 :         if (rName == SC_UNONAME_ISDATE)
    1071           0 :             return uno::makeAny<sal_Bool>(mbIsDate);
    1072             : 
    1073           0 :         if (rName == SC_UNONAME_ISFIXED)
    1074           0 :             return uno::makeAny<sal_Bool>(mbIsFixed);
    1075             : 
    1076           0 :         if (rName == SC_UNONAME_DATETIME)
    1077           0 :             return uno::makeAny(maDateTime);
    1078             : 
    1079           0 :         if (rName == SC_UNONAME_NUMFMT)
    1080           0 :             return uno::makeAny(mnNumFormat);
    1081             :     }
    1082             : 
    1083           0 :     throw beans::UnknownPropertyException();
    1084             : }
    1085             : 
    1086           0 : void ScEditFieldObj::setPropertyValueSheet(const OUString& rName, const uno::Any& rVal)
    1087             : {
    1088           0 :     if (mpEditSource)
    1089             :     {
    1090             :         // Edit engine instance already exists for this field item.  Use it.
    1091           0 :         ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
    1092           0 :         ScUnoEditEngine aTempEngine(pEditEngine);
    1093             : 
    1094             :         //  Typ egal (in Zellen gibts nur URLs)
    1095             :         SvxFieldData* pField = aTempEngine.FindByPos(
    1096           0 :             aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::UNSPECIFIED);
    1097             :         OSL_ENSURE(pField,"setPropertyValue: Feld nicht gefunden");
    1098           0 :         if (!pField)
    1099           0 :             return;
    1100             : 
    1101           0 :         if (pField->GetClassId() != text::textfield::Type::TABLE)
    1102             :             // Make sure this is indeed a URL field.
    1103           0 :             return;
    1104             : 
    1105           0 :         SvxTableField* p = static_cast<SvxTableField*>(pField);
    1106             : 
    1107           0 :         if (rName == SC_UNONAME_TABLEPOS)
    1108             :         {
    1109           0 :             sal_Int32 nTab = rVal.get<sal_Int32>();
    1110           0 :             p->SetTab(nTab);
    1111             :         }
    1112             :         else
    1113           0 :             throw beans::UnknownPropertyException();
    1114             : 
    1115           0 :         pEditEngine->QuickInsertField(SvxFieldItem(*pField, EE_FEATURE_FIELD), aSelection);
    1116           0 :         mpEditSource->UpdateData();
    1117           0 :         return;
    1118             :     }
    1119             : 
    1120             :     // Edit engine instance not yet present.  Store the item data for later use.
    1121           0 :     SvxFieldData* pData = getData();
    1122           0 :     if (!pData)
    1123           0 :         throw uno::RuntimeException();
    1124             : 
    1125           0 :     SvxTableField* p = static_cast<SvxTableField*>(pData);
    1126           0 :     if (rName == SC_UNONAME_TABLEPOS)
    1127             :     {
    1128           0 :         sal_Int32 nTab = rVal.get<sal_Int32>();
    1129           0 :         p->SetTab(nTab);
    1130             :     }
    1131             :     else
    1132           0 :         throw beans::UnknownPropertyException();
    1133             : 
    1134             : }
    1135             : 
    1136         981 : ScEditFieldObj::ScEditFieldObj(
    1137             :     const uno::Reference<text::XTextRange>& rContent,
    1138             :     ScEditSource* pEditSrc, sal_Int32 eType, const ESelection& rSel) :
    1139         981 :     OComponentHelper(getMutex()),
    1140             :     pPropSet(NULL),
    1141             :     mpEditSource(pEditSrc),
    1142             :     aSelection(rSel),
    1143        1962 :     meType(eType), mpData(NULL), mpContent(rContent), mnNumFormat(0), mbIsDate(false), mbIsFixed(false)
    1144             : {
    1145         981 :     switch (meType)
    1146             :     {
    1147             :         case text::textfield::Type::DOCINFO_TITLE:
    1148         110 :             pPropSet = getEmptyPropertySet();
    1149         110 :         break;
    1150             :         case text::textfield::Type::EXTENDED_FILE:
    1151           2 :             pPropSet = lcl_GetFileFieldPropertySet();
    1152           2 :         break;
    1153             :         case text::textfield::Type::URL:
    1154          16 :             pPropSet = lcl_GetURLPropertySet();
    1155          16 :         break;
    1156             :         case text::textfield::Type::DATE:
    1157             :         case text::textfield::Type::TIME:
    1158             :         case text::textfield::Type::EXTENDED_TIME:
    1159         230 :             pPropSet = getDateTimePropertySet();
    1160         230 :         break;
    1161             :         default:
    1162         623 :             pPropSet = lcl_GetHeaderFieldPropertySet();
    1163             :     }
    1164             : 
    1165         981 :     if (meType == text::textfield::Type::DATE)
    1166           3 :         mbIsDate = true;
    1167         981 : }
    1168             : 
    1169         951 : void ScEditFieldObj::InitDoc(
    1170             :     const uno::Reference<text::XTextRange>& rContent, ScEditSource* pEditSrc, const ESelection& rSel)
    1171             : {
    1172         951 :     if (!mpEditSource)
    1173             :     {
    1174         951 :         mpContent = rContent;
    1175         951 :         mpData.reset();
    1176             : 
    1177         951 :         aSelection = rSel;
    1178         951 :         mpEditSource = pEditSrc;
    1179             :     }
    1180         951 : }
    1181             : 
    1182        2943 : ScEditFieldObj::~ScEditFieldObj()
    1183             : {
    1184         981 :     delete mpEditSource;
    1185        1962 : }
    1186             : 
    1187         951 : SvxFieldItem ScEditFieldObj::CreateFieldItem()
    1188             : {
    1189             :     OSL_ENSURE( !mpEditSource, "CreateFieldItem mit eingefuegtem Feld" );
    1190         951 :     return SvxFieldItem(*getData(), EE_FEATURE_FIELD);
    1191             : }
    1192             : 
    1193           6 : sal_Int32 ScEditFieldObj::GetFieldType() const
    1194             : {
    1195           6 :     return meType;
    1196             : }
    1197             : 
    1198           2 : void ScEditFieldObj::DeleteField()
    1199             : {
    1200           2 :     if (mpEditSource)
    1201             :     {
    1202           2 :         SvxTextForwarder* pForwarder = mpEditSource->GetTextForwarder();
    1203           2 :         pForwarder->QuickInsertText( OUString(), aSelection );
    1204           2 :         mpEditSource->UpdateData();
    1205             : 
    1206           2 :         aSelection.nEndPara = aSelection.nStartPara;
    1207           2 :         aSelection.nEndPos  = aSelection.nStartPos;
    1208             : 
    1209             :         //! Broadcast, um Selektion in anderen Objekten anzupassen
    1210             :         //! (auch bei anderen Aktionen)
    1211             :     }
    1212           2 : }
    1213             : 
    1214         953 : bool ScEditFieldObj::IsInserted() const
    1215             : {
    1216         953 :     return mpEditSource != NULL;
    1217             : }
    1218             : 
    1219             : // XTextField
    1220             : 
    1221           2 : OUString SAL_CALL ScEditFieldObj::getPresentation( sal_Bool bShowCommand )
    1222             :                                                     throw(uno::RuntimeException, std::exception)
    1223             : {
    1224           2 :     SolarMutexGuard aGuard;
    1225             : 
    1226           2 :     if (!mpEditSource)
    1227           0 :         return OUString();
    1228             : 
    1229             :     //! Feld-Funktionen muessen an den Forwarder !!!
    1230           2 :     ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
    1231           4 :     ScUnoEditEngine aTempEngine(pEditEngine);
    1232             : 
    1233             :     //  Typ egal (in Zellen gibts nur URLs)
    1234             :     const SvxFieldData* pField = aTempEngine.FindByPos(
    1235           2 :         aSelection.nStartPara, aSelection.nStartPos, text::textfield::Type::UNSPECIFIED);
    1236             :     OSL_ENSURE(pField,"getPresentation: Feld nicht gefunden");
    1237           2 :     if (!pField)
    1238           0 :         return OUString();
    1239             : 
    1240           2 :     switch (meType)
    1241             :     {
    1242             :         case text::textfield::Type::URL:
    1243             :         {
    1244           2 :             if (pField->GetClassId() != text::textfield::Type::URL)
    1245             :                 // Not an URL field, but URL is expected.
    1246           0 :                 throw uno::RuntimeException();
    1247             : 
    1248           2 :             const SvxURLField* pURL = static_cast<const SvxURLField*>(pField);
    1249           2 :             return bShowCommand ? pURL->GetURL() : pURL->GetRepresentation();
    1250             :         }
    1251             :         break;
    1252             :         default:
    1253             :             ;
    1254             :     }
    1255           2 :     return OUString();
    1256             : }
    1257             : 
    1258             : // XTextContent
    1259             : 
    1260           2 : void SAL_CALL ScEditFieldObj::attach( const uno::Reference<text::XTextRange>& xTextRange )
    1261             :                                 throw(lang::IllegalArgumentException, uno::RuntimeException, std::exception)
    1262             : {
    1263           2 :     SolarMutexGuard aGuard;
    1264           2 :     if (xTextRange.is())
    1265             :     {
    1266           2 :         uno::Reference<text::XText> xText(xTextRange->getText());
    1267           2 :         if (xText.is())
    1268             :         {
    1269           3 :             xText->insertTextContent( xTextRange, this, sal_True );
    1270           2 :         }
    1271           2 :     }
    1272           1 : }
    1273             : 
    1274           4 : uno::Reference<text::XTextRange> SAL_CALL ScEditFieldObj::getAnchor() throw(uno::RuntimeException, std::exception)
    1275             : {
    1276           4 :     SolarMutexGuard aGuard;
    1277           4 :     return mpContent;
    1278             : }
    1279             : 
    1280             : // XComponent
    1281             : 
    1282           0 : void SAL_CALL ScEditFieldObj::dispose() throw(uno::RuntimeException, std::exception)
    1283             : {
    1284           0 :     OComponentHelper::dispose();
    1285           0 : }
    1286             : 
    1287           0 : void SAL_CALL ScEditFieldObj::addEventListener(
    1288             :                         const uno::Reference<lang::XEventListener>& xListener )
    1289             :                                                     throw(uno::RuntimeException, std::exception)
    1290             : {
    1291           0 :     OComponentHelper::addEventListener( xListener );
    1292           0 : }
    1293             : 
    1294           0 : void SAL_CALL ScEditFieldObj::removeEventListener(
    1295             :                         const uno::Reference<lang::XEventListener>& xListener )
    1296             :                                                     throw(uno::RuntimeException, std::exception)
    1297             : {
    1298           0 :     OComponentHelper::removeEventListener( xListener );
    1299           0 : }
    1300             : 
    1301             : // XPropertySet
    1302             : 
    1303         664 : uno::Reference<beans::XPropertySetInfo> SAL_CALL ScEditFieldObj::getPropertySetInfo()
    1304             :                                                         throw(uno::RuntimeException, std::exception)
    1305             : {
    1306         664 :     SolarMutexGuard aGuard;
    1307         664 :     uno::Reference<beans::XPropertySetInfo> aRef = pPropSet->getPropertySetInfo();
    1308         664 :     return aRef;
    1309             : }
    1310             : 
    1311         464 : void SAL_CALL ScEditFieldObj::setPropertyValue(
    1312             :                         const OUString& aPropertyName, const uno::Any& aValue )
    1313             :                 throw (beans::UnknownPropertyException, beans::PropertyVetoException,
    1314             :                        lang::IllegalArgumentException, lang::WrappedTargetException,
    1315             :                        uno::RuntimeException, std::exception)
    1316             : {
    1317         464 :     SolarMutexGuard aGuard;
    1318         464 :     if (aPropertyName == SC_UNONAME_ANCHOR)
    1319             :     {
    1320           0 :         aValue >>= mpContent;
    1321         464 :         return;
    1322             :     }
    1323             : 
    1324         464 :     switch (meType)
    1325             :     {
    1326             :         case text::textfield::Type::URL:
    1327          16 :             setPropertyValueURL(aPropertyName, aValue);
    1328          16 :         break;
    1329             :         case text::textfield::Type::EXTENDED_FILE:
    1330           0 :             setPropertyValueFile(aPropertyName, aValue);
    1331           0 :         break;
    1332             :         case text::textfield::Type::DATE:
    1333             :         case text::textfield::Type::TIME:
    1334             :         case text::textfield::Type::EXTENDED_TIME:
    1335         448 :             setPropertyValueDateTime(aPropertyName, aValue);
    1336         448 :         break;
    1337             :         case text::textfield::Type::TABLE:
    1338           0 :             setPropertyValueSheet(aPropertyName, aValue);
    1339           0 :         break;
    1340             :         case text::textfield::Type::DOCINFO_TITLE:
    1341             :         default:
    1342           0 :             throw beans::UnknownPropertyException();
    1343         464 :     }
    1344             : }
    1345             : 
    1346          54 : uno::Any SAL_CALL ScEditFieldObj::getPropertyValue( const OUString& aPropertyName )
    1347             :                 throw(beans::UnknownPropertyException, lang::WrappedTargetException,
    1348             :                         uno::RuntimeException, std::exception)
    1349             : {
    1350          54 :     SolarMutexGuard aGuard;
    1351          54 :     if (aPropertyName.equals(SC_UNONAME_TEXTFIELD_TYPE))
    1352           0 :         return uno::makeAny(meType);
    1353             : 
    1354          54 :     if (aPropertyName == SC_UNONAME_ANCHOR)
    1355           0 :         return uno::makeAny(mpContent);
    1356             : 
    1357          54 :     if (aPropertyName == SC_UNONAME_ANCTYPE)
    1358             :     {
    1359           1 :         uno::Any aRet;
    1360           1 :         aRet <<= text::TextContentAnchorType_AS_CHARACTER;
    1361           1 :         return aRet;
    1362             :     }
    1363          53 :     if (aPropertyName == SC_UNONAME_ANCTYPES)
    1364             :     {
    1365           1 :         uno::Any aRet;
    1366           2 :         uno::Sequence<text::TextContentAnchorType> aSeq(1);
    1367           1 :         aSeq[0] = text::TextContentAnchorType_AS_CHARACTER;
    1368           1 :         aRet <<= aSeq;
    1369           2 :         return aRet;
    1370             :     }
    1371          52 :     if (aPropertyName == SC_UNONAME_TEXTWRAP)
    1372             :     {
    1373           1 :         uno::Any aRet;
    1374           1 :         aRet <<= text::WrapTextMode_NONE;
    1375           1 :         return aRet;
    1376             :     }
    1377             : 
    1378          51 :     switch (meType)
    1379             :     {
    1380             :         case text::textfield::Type::URL:
    1381          27 :             return getPropertyValueURL(aPropertyName);
    1382             :         case text::textfield::Type::EXTENDED_FILE:
    1383           0 :             return getPropertyValueFile(aPropertyName);
    1384             :         case text::textfield::Type::DATE:
    1385             :         case text::textfield::Type::TIME:
    1386             :         case text::textfield::Type::EXTENDED_TIME:
    1387          24 :             return getPropertyValueDateTime(aPropertyName);
    1388             :         case text::textfield::Type::DOCINFO_TITLE:
    1389             :         default:
    1390           0 :             throw beans::UnknownPropertyException();
    1391          54 :     }
    1392             : }
    1393             : 
    1394           0 : SC_IMPL_DUMMY_PROPERTY_LISTENER( ScEditFieldObj )
    1395             : 
    1396             : // XUnoTunnel
    1397             : 
    1398         953 : sal_Int64 SAL_CALL ScEditFieldObj::getSomething(
    1399             :                 const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException, std::exception)
    1400             : {
    1401        1906 :     if ( rId.getLength() == 16 &&
    1402         953 :           0 == memcmp( getUnoTunnelId().getConstArray(),
    1403        1906 :                                     rId.getConstArray(), 16 ) )
    1404             :     {
    1405         953 :         return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
    1406             :     }
    1407           0 :     return 0;
    1408             : }
    1409             : 
    1410             : namespace
    1411             : {
    1412             :     class theScEditFieldObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScEditFieldObjUnoTunnelId> {};
    1413             : }
    1414             : 
    1415        1906 : const uno::Sequence<sal_Int8>& ScEditFieldObj::getUnoTunnelId()
    1416             : {
    1417        1906 :     return theScEditFieldObjUnoTunnelId::get().getSeq();
    1418             : }
    1419             : 
    1420         953 : ScEditFieldObj* ScEditFieldObj::getImplementation(const uno::Reference<text::XTextContent>& xObj)
    1421             : {
    1422         953 :     ScEditFieldObj* pRet = NULL;
    1423         953 :     uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
    1424         953 :     if (xUT.is())
    1425         953 :         pRet = reinterpret_cast<ScEditFieldObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
    1426         953 :     return pRet;
    1427             : }
    1428             : 
    1429             : // XServiceInfo
    1430             : 
    1431           0 : OUString SAL_CALL ScEditFieldObj::getImplementationName() throw(uno::RuntimeException, std::exception)
    1432             : {
    1433           0 :     return OUString("ScEditFieldObj");
    1434             : }
    1435             : 
    1436           0 : sal_Bool SAL_CALL ScEditFieldObj::supportsService( const OUString& rServiceName )
    1437             :                                                     throw(uno::RuntimeException, std::exception)
    1438             : {
    1439           0 :     return cppu::supportsService(this, rServiceName);
    1440             : }
    1441             : 
    1442           0 : uno::Sequence<OUString> SAL_CALL ScEditFieldObj::getSupportedServiceNames()
    1443             :                                                     throw(uno::RuntimeException, std::exception)
    1444             : {
    1445           0 :     uno::Sequence<OUString> aRet(2);
    1446           0 :     OUString* pArray = aRet.getArray();
    1447           0 :     pArray[0] = "com.sun.star.text.TextField";
    1448           0 :     pArray[1] = "com.sun.star.text.TextContent";
    1449           0 :     return aRet;
    1450             : }
    1451             : 
    1452           0 : uno::Sequence<uno::Type> SAL_CALL ScEditFieldObj::getTypes() throw(uno::RuntimeException, std::exception)
    1453             : {
    1454           0 :     static uno::Sequence<uno::Type> aTypes;
    1455           0 :     if ( aTypes.getLength() == 0 )
    1456             :     {
    1457           0 :         uno::Sequence<uno::Type> aParentTypes(OComponentHelper::getTypes());
    1458           0 :         long nParentLen = aParentTypes.getLength();
    1459           0 :         const uno::Type* pParentPtr = aParentTypes.getConstArray();
    1460             : 
    1461           0 :         aTypes.realloc( nParentLen + 4 );
    1462           0 :         uno::Type* pPtr = aTypes.getArray();
    1463           0 :         pPtr[nParentLen + 0] = getCppuType((const uno::Reference<text::XTextField>*)0);
    1464           0 :         pPtr[nParentLen + 1] = getCppuType((const uno::Reference<beans::XPropertySet>*)0);
    1465           0 :         pPtr[nParentLen + 2] = getCppuType((const uno::Reference<lang::XUnoTunnel>*)0);
    1466           0 :         pPtr[nParentLen + 3] = getCppuType((const uno::Reference<lang::XServiceInfo>*)0);
    1467             : 
    1468           0 :         for (long i=0; i<nParentLen; i++)
    1469           0 :             pPtr[i] = pParentPtr[i];                // parent types first
    1470             :     }
    1471           0 :     return aTypes;
    1472             : }
    1473             : 
    1474           0 : uno::Sequence<sal_Int8> SAL_CALL ScEditFieldObj::getImplementationId()
    1475             :                                                     throw(uno::RuntimeException, std::exception)
    1476             : {
    1477           0 :     return css::uno::Sequence<sal_Int8>();
    1478             : }
    1479             : 
    1480             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10