LCOV - code coverage report
Current view: top level - sc/source/filter/excel - xlroot.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 116 161 72.0 %
Date: 2012-08-25 Functions: 25 36 69.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 143 368 38.9 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include "xlroot.hxx"
      30                 :            : #include <rtl/strbuf.hxx>
      31                 :            : #include <com/sun/star/awt/XDevice.hpp>
      32                 :            : #include <com/sun/star/frame/XFrame.hpp>
      33                 :            : #include <com/sun/star/frame/XFramesSupplier.hpp>
      34                 :            : #include <com/sun/star/i18n/ScriptType.hpp>
      35                 :            : #include <comphelper/processfactory.hxx>
      36                 :            : #include <vcl/svapp.hxx>
      37                 :            : #include <svl/stritem.hxx>
      38                 :            : #include <svl/languageoptions.hxx>
      39                 :            : #include <sfx2/objsh.hxx>
      40                 :            : #include <sfx2/printer.hxx>
      41                 :            : #include <sfx2/docfile.hxx>
      42                 :            : #include <vcl/font.hxx>
      43                 :            : #include <editeng/editstat.hxx>
      44                 :            : #include "scitems.hxx"
      45                 :            : #include <editeng/eeitem.hxx>
      46                 :            : #include "document.hxx"
      47                 :            : #include "docpool.hxx"
      48                 :            : #include "docuno.hxx"
      49                 :            : #include "editutil.hxx"
      50                 :            : #include "drwlayer.hxx"
      51                 :            : #include "scextopt.hxx"
      52                 :            : #include "patattr.hxx"
      53                 :            : #include "fapihelper.hxx"
      54                 :            : #include "xlconst.hxx"
      55                 :            : #include "xlstyle.hxx"
      56                 :            : #include "xlchart.hxx"
      57                 :            : #include "xltracer.hxx"
      58                 :            : #include <unotools/useroptions.hxx>
      59                 :            : #include "root.hxx"
      60                 :            : 
      61                 :            : namespace ApiScriptType = ::com::sun::star::i18n::ScriptType;
      62                 :            : 
      63                 :            : using ::rtl::OUString;
      64                 :            : using ::com::sun::star::uno::Exception;
      65                 :            : using ::com::sun::star::uno::Reference;
      66                 :            : using ::com::sun::star::uno::UNO_QUERY_THROW;
      67                 :            : using ::com::sun::star::uno::UNO_SET_THROW;
      68                 :            : using ::com::sun::star::awt::XDevice;
      69                 :            : using ::com::sun::star::awt::DeviceInfo;
      70                 :            : using ::com::sun::star::frame::XFrame;
      71                 :            : using ::com::sun::star::frame::XFramesSupplier;
      72                 :            : using ::com::sun::star::lang::XMultiServiceFactory;
      73                 :            : 
      74                 :            : using namespace ::com::sun::star;
      75                 :            : 
      76                 :            : // Global data ================================================================
      77                 :            : 
      78                 :            : #ifdef DBG_UTIL
      79                 :            : XclDebugObjCounter::~XclDebugObjCounter()
      80                 :            : {
      81                 :            :     OSL_ENSURE( mnObjCnt == 0, "XclDebugObjCounter::~XclDebugObjCounter - wrong root object count" );
      82                 :            : }
      83                 :            : #endif
      84                 :            : 
      85                 :            : // ----------------------------------------------------------------------------
      86                 :            : 
      87                 :         55 : XclRootData::XclRootData( XclBiff eBiff, SfxMedium& rMedium,
      88                 :            :         SotStorageRef xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc, bool bExport ) :
      89                 :            :     meBiff( eBiff ),
      90                 :            :     meOutput( EXC_OUTPUT_BINARY ),
      91                 :            :     mrMedium( rMedium ),
      92                 :            :     mxRootStrg( xRootStrg ),
      93                 :            :     mrDoc( rDoc ),
      94                 :            :     maDefPassword( CREATE_STRING( "VelvetSweatshop" ) ),
      95                 :            :     meTextEnc( eTextEnc ),
      96 [ +  - ][ +  - ]:         55 :     meSysLang( Application::GetSettings().GetLanguage() ),
      97 [ +  - ][ +  - ]:         55 :     meDocLang( Application::GetSettings().GetLanguage() ),
      98 [ +  - ][ +  - ]:         55 :     meUILang( Application::GetSettings().GetUILanguage() ),
      99                 :            :     mnDefApiScript( ApiScriptType::LATIN ),
     100                 :            :     maScMaxPos( MAXCOL, MAXROW, MAXTAB ),
     101                 :            :     maXclMaxPos( EXC_MAXCOL2, EXC_MAXROW2, EXC_MAXTAB2 ),
     102                 :            :     maMaxPos( EXC_MAXCOL2, EXC_MAXROW2, EXC_MAXTAB2 ),
     103         [ +  - ]:         55 :     mxFontPropSetHlp( new XclFontPropSetHelper ),
     104         [ +  - ]:         55 :     mxChPropSetHlp( new XclChPropSetHelper ),
     105         [ +  - ]:         55 :     mxRD( new RootData ),//!
     106                 :            :     mfScreenPixelX( 50.0 ),
     107                 :            :     mfScreenPixelY( 50.0 ),
     108                 :            :     mnCharWidth( 110 ),
     109                 :            :     mnScTab( 0 ),
     110 [ +  - ][ +  - ]:        275 :     mbExport( bExport )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     111                 :            : {
     112 [ +  - ][ +  - ]:         55 :  maUserName = SvtUserOptions().GetLastName();
         [ +  - ][ +  - ]
     113         [ +  - ]:         55 :     if( maUserName.Len() == 0 )
     114 [ +  - ][ +  - ]:         55 :         maUserName = CREATE_STRING( "Calc" );
                 [ +  - ]
     115                 :            : 
     116         [ +  - ]:         55 :     switch( ScGlobal::GetDefaultScriptType() )
           [ +  -  -  - ]
     117                 :            :     {
     118                 :         55 :         case SCRIPTTYPE_LATIN:      mnDefApiScript = ApiScriptType::LATIN;      break;
     119                 :          0 :         case SCRIPTTYPE_ASIAN:      mnDefApiScript = ApiScriptType::ASIAN;      break;
     120                 :          0 :         case SCRIPTTYPE_COMPLEX:    mnDefApiScript = ApiScriptType::COMPLEX;    break;
     121                 :            :         default:    OSL_FAIL( "XclRootData::XclRootData - unknown script type" );
     122                 :            :     }
     123                 :            : 
     124                 :            :     // maximum cell position
     125   [ -  -  -  -  :         55 :     switch( meBiff )
                   +  - ]
     126                 :            :     {
     127                 :          0 :         case EXC_BIFF2: maXclMaxPos.Set( EXC_MAXCOL2, EXC_MAXROW2, EXC_MAXTAB2 );   break;
     128                 :          0 :         case EXC_BIFF3: maXclMaxPos.Set( EXC_MAXCOL3, EXC_MAXROW3, EXC_MAXTAB3 );   break;
     129                 :          0 :         case EXC_BIFF4: maXclMaxPos.Set( EXC_MAXCOL4, EXC_MAXROW4, EXC_MAXTAB4 );   break;
     130                 :          0 :         case EXC_BIFF5: maXclMaxPos.Set( EXC_MAXCOL5, EXC_MAXROW5, EXC_MAXTAB5 );   break;
     131                 :         55 :         case EXC_BIFF8: maXclMaxPos.Set( EXC_MAXCOL8, EXC_MAXROW8, EXC_MAXTAB8 );   break;
     132                 :            :         default:        DBG_ERROR_BIFF();
     133                 :            :     }
     134         [ +  - ]:         55 :     maMaxPos.SetCol( ::std::min( maScMaxPos.Col(), maXclMaxPos.Col() ) );
     135         [ +  - ]:         55 :     maMaxPos.SetRow( ::std::min( maScMaxPos.Row(), maXclMaxPos.Row() ) );
     136         [ +  - ]:         55 :     maMaxPos.SetTab( ::std::min( maScMaxPos.Tab(), maXclMaxPos.Tab() ) );
     137                 :            : 
     138                 :            :     // document URL and path
     139 [ +  - ][ +  - ]:         55 :     if( const SfxItemSet* pItemSet = mrMedium.GetItemSet() )
     140 [ +  - ][ +  - ]:         55 :         if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_FILE_NAME ) ) )
     141         [ +  - ]:         55 :             maDocUrl = pItem->GetValue();
     142 [ +  - ][ +  - ]:         55 :     maBasePath = maDocUrl.Copy( 0, maDocUrl.SearchBackward( '/' ) + 1 );
         [ +  - ][ +  - ]
     143                 :            : 
     144                 :            :     // extended document options - always own object, try to copy existing data from document
     145         [ -  + ]:         55 :     if( const ScExtDocOptions* pOldDocOpt = mrDoc.GetExtDocOptions() )
     146 [ #  # ][ #  # ]:          0 :         mxExtDocOpt.reset( new ScExtDocOptions( *pOldDocOpt ) );
                 [ #  # ]
     147                 :            :     else
     148 [ +  - ][ +  - ]:         55 :         mxExtDocOpt.reset( new ScExtDocOptions );
                 [ +  - ]
     149                 :            : 
     150                 :            :     // screen pixel size
     151                 :            :     try
     152                 :            :     {
     153 [ +  - ][ +  - ]:         55 :         Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_SET_THROW );
     154 [ +  - ][ +  - ]:         55 :         Reference< XFramesSupplier > xFramesSupp( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.frame.Desktop" ) ), UNO_QUERY_THROW );
         [ +  - ][ +  - ]
     155 [ +  - ][ -  + ]:         55 :         Reference< XFrame > xFrame( xFramesSupp->getActiveFrame(), UNO_SET_THROW );
                 [ +  - ]
     156 [ #  # ][ #  # ]:          0 :         Reference< XDevice > xDevice( xFrame->getContainerWindow(), UNO_QUERY_THROW );
                 [ #  # ]
     157 [ #  # ][ #  # ]:          0 :         DeviceInfo aDeviceInfo = xDevice->getInfo();
     158         [ #  # ]:          0 :         mfScreenPixelX = (aDeviceInfo.PixelPerMeterX > 0) ? (100000.0 / aDeviceInfo.PixelPerMeterX) : 50.0;
     159 [ #  # ][ -  + ]:         55 :         mfScreenPixelY = (aDeviceInfo.PixelPerMeterY > 0) ? (100000.0 / aDeviceInfo.PixelPerMeterY) : 50.0;
     160                 :            :     }
     161         [ +  - ]:         55 :     catch( const Exception& e)
     162                 :            :     {
     163                 :            : #if OSL_DEBUG_LEVEL > 0
     164                 :            :         OSL_FAIL( rtl::OStringBuffer("XclRootData::XclRootData - cannot get output device info: ").append(rtl::OUStringToOString(e.Message,osl_getThreadTextEncoding())).getStr() );
     165                 :            : #else
     166                 :            :         (void)e;
     167                 :            : #endif
     168                 :            :     }
     169                 :         55 : }
     170                 :            : 
     171 [ +  - ][ +  - ]:         55 : XclRootData::~XclRootData()
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     172                 :            : {
     173         [ -  + ]:         55 : }
     174                 :            : 
     175                 :            : // ----------------------------------------------------------------------------
     176                 :            : 
     177                 :         55 : XclRoot::XclRoot( XclRootData& rRootData ) :
     178                 :         55 :     mrData( rRootData )
     179                 :            : {
     180                 :            : #if defined(DBG_UTIL) && OSL_DEBUG_LEVEL > 0
     181                 :            :     ++mrData.mnObjCnt;
     182                 :            : #endif
     183                 :            : 
     184                 :            :     // filter tracer
     185                 :            :     // do not use CREATE_OUSTRING for conditional expression
     186         [ +  - ]:         55 :     mrData.mxTracer.reset( new XclTracer( GetDocUrl() ) );
     187                 :         55 : }
     188                 :            : 
     189                 :       6111 : XclRoot::XclRoot( const XclRoot& rRoot ) :
     190                 :       6111 :     mrData( rRoot.mrData )
     191                 :            : {
     192                 :            : #if defined(DBG_UTIL) && OSL_DEBUG_LEVEL > 0
     193                 :            :     ++mrData.mnObjCnt;
     194                 :            : #endif
     195                 :       6111 : }
     196                 :            : 
     197                 :       6166 : XclRoot::~XclRoot()
     198                 :            : {
     199                 :            : #if defined(DBG_UTIL) && OSL_DEBUG_LEVEL > 0
     200                 :            :     --mrData.mnObjCnt;
     201                 :            : #endif
     202         [ -  + ]:       6166 : }
     203                 :            : 
     204                 :          0 : XclRoot& XclRoot::operator=( const XclRoot& rRoot )
     205                 :            : {
     206                 :            :     (void)rRoot;    // avoid compiler warning
     207                 :            :     // allowed for assignment in derived classes - but test if the same root data is used
     208                 :            :     OSL_ENSURE( &mrData == &rRoot.mrData, "XclRoot::operator= - incompatible root data" );
     209                 :          0 :     return *this;
     210                 :            : }
     211                 :            : 
     212                 :         49 : void XclRoot::SetTextEncoding( rtl_TextEncoding eTextEnc )
     213                 :            : {
     214         [ +  + ]:         49 :     if( eTextEnc != RTL_TEXTENCODING_DONTKNOW )
     215                 :          3 :         mrData.meTextEnc = eTextEnc;
     216                 :         49 : }
     217                 :            : 
     218                 :        104 : void XclRoot::SetCharWidth( const XclFontData& rFontData )
     219                 :            : {
     220                 :        104 :     mrData.mnCharWidth = 0;
     221         [ +  - ]:        104 :     if( OutputDevice* pPrinter = GetPrinter() )
     222                 :            :     {
     223         [ +  - ]:        104 :         Font aFont( rFontData.maName, Size( 0, rFontData.mnHeight ) );
     224 [ +  - ][ +  - ]:        104 :         aFont.SetFamily( rFontData.GetScFamily( GetTextEncoding() ) );
     225 [ +  - ][ +  - ]:        104 :         aFont.SetCharSet( rFontData.GetFontEncoding() );
     226 [ +  - ][ +  - ]:        104 :         aFont.SetWeight( rFontData.GetScWeight() );
     227         [ +  - ]:        104 :         pPrinter->SetFont( aFont );
     228 [ +  - ][ +  - ]:        104 :         mrData.mnCharWidth = pPrinter->GetTextWidth( rtl::OUString('0') );
         [ +  - ][ +  - ]
     229                 :            :     }
     230         [ -  + ]:        104 :     if( mrData.mnCharWidth <= 0 )
     231                 :            :     {
     232                 :            :         // #i48717# Win98 with HP LaserJet returns 0
     233                 :            :         OSL_FAIL( "XclRoot::SetCharWidth - invalid character width (no printer?)" );
     234                 :          0 :         mrData.mnCharWidth = 11 * rFontData.mnHeight / 20;
     235                 :            :     }
     236                 :        104 : }
     237                 :            : 
     238                 :          6 : sal_Int32 XclRoot::GetHmmFromPixelX( double fPixelX ) const
     239                 :            : {
     240                 :          6 :     return static_cast< sal_Int32 >( fPixelX * mrData.mfScreenPixelX + 0.5 );
     241                 :            : }
     242                 :            : 
     243                 :          6 : sal_Int32 XclRoot::GetHmmFromPixelY( double fPixelY ) const
     244                 :            : {
     245                 :          6 :     return static_cast< sal_Int32 >( fPixelY * mrData.mfScreenPixelY + 0.5 );
     246                 :            : }
     247                 :            : 
     248                 :          0 : uno::Sequence< beans::NamedValue > XclRoot::RequestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier ) const
     249                 :            : {
     250         [ #  # ]:          0 :     ::std::vector< OUString > aDefaultPasswords;
     251 [ #  # ][ #  # ]:          0 :     aDefaultPasswords.push_back( mrData.maDefPassword );
     252         [ #  # ]:          0 :     return ScfApiHelper::QueryEncryptionDataForMedium( mrData.mrMedium, rVerifier, &aDefaultPasswords );
     253                 :            : }
     254                 :            : 
     255                 :          0 : bool XclRoot::HasVbaStorage() const
     256                 :            : {
     257         [ #  # ]:          0 :     SotStorageRef xRootStrg = GetRootStorage();
     258 [ #  # ][ #  # ]:          0 :     return xRootStrg.Is() && xRootStrg->IsContained( EXC_STORAGE_VBA_PROJECT );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     259                 :            : }
     260                 :            : 
     261                 :          3 : SotStorageRef XclRoot::OpenStorage( SotStorageRef xStrg, const String& rStrgName ) const
     262                 :            : {
     263                 :            :     return mrData.mbExport ?
     264                 :            :         ScfTools::OpenStorageWrite( xStrg, rStrgName ) :
     265 [ -  + ][ #  # ]:          3 :         ScfTools::OpenStorageRead( xStrg, rStrgName );
         [ +  - ][ +  - ]
         [ +  - ][ -  + ]
           [ #  #  #  # ]
     266                 :            : }
     267                 :            : 
     268                 :          3 : SotStorageRef XclRoot::OpenStorage( const String& rStrgName ) const
     269                 :            : {
     270         [ +  - ]:          3 :     return OpenStorage( GetRootStorage(), rStrgName );
     271                 :            : }
     272                 :            : 
     273                 :         75 : SotStorageStreamRef XclRoot::OpenStream( SotStorageRef xStrg, const String& rStrmName ) const
     274                 :            : {
     275                 :            :     return mrData.mbExport ?
     276                 :            :         ScfTools::OpenStorageStreamWrite( xStrg, rStrmName ) :
     277 [ -  + ][ #  # ]:         75 :         ScfTools::OpenStorageStreamRead( xStrg, rStrmName );
         [ +  - ][ +  - ]
         [ +  - ][ -  + ]
           [ #  #  #  # ]
     278                 :            : }
     279                 :            : 
     280                 :         72 : SotStorageStreamRef XclRoot::OpenStream( const String& rStrmName ) const
     281                 :            : {
     282         [ +  - ]:         72 :     return OpenStream( GetRootStorage(), rStrmName );
     283                 :            : }
     284                 :            : 
     285                 :        440 : SfxObjectShell* XclRoot::GetDocShell() const
     286                 :            : {
     287                 :        440 :     return GetDoc().GetDocumentShell();
     288                 :            : }
     289                 :            : 
     290                 :         55 : ScModelObj* XclRoot::GetDocModelObj() const
     291                 :            : {
     292                 :         55 :     SfxObjectShell* pDocShell = GetDocShell();
     293 [ +  - ][ +  - ]:         55 :     return pDocShell ? ScModelObj::getImplementation( pDocShell->GetModel() ) : 0;
         [ +  - ][ +  - ]
           [ #  #  #  # ]
                 [ +  - ]
     294                 :            : }
     295                 :            : 
     296                 :       1007 : OutputDevice* XclRoot::GetPrinter() const
     297                 :            : {
     298                 :       1007 :     return GetDoc().GetRefDevice();
     299                 :            : }
     300                 :            : 
     301                 :        739 : ScStyleSheetPool& XclRoot::GetStyleSheetPool() const
     302                 :            : {
     303                 :        739 :     return *GetDoc().GetStyleSheetPool();
     304                 :            : }
     305                 :            : 
     306                 :          0 : ScRangeName& XclRoot::GetNamedRanges() const
     307                 :            : {
     308                 :          0 :     return *GetDoc().GetRangeName();
     309                 :            : }
     310                 :            : 
     311                 :         62 : SdrPage* XclRoot::GetSdrPage( SCTAB nScTab ) const
     312                 :            : {
     313                 :         62 :     return ((nScTab >= 0) && GetDoc().GetDrawLayer()) ?
     314   [ +  -  +  - ]:        124 :         GetDoc().GetDrawLayer()->GetPage( static_cast< sal_uInt16 >( nScTab ) ) : 0;
     315                 :            : }
     316                 :            : 
     317                 :        209 : SvNumberFormatter& XclRoot::GetFormatter() const
     318                 :            : {
     319                 :        209 :     return *GetDoc().GetFormatTable();
     320                 :            : }
     321                 :            : 
     322                 :          0 : DateTime XclRoot::GetNullDate() const
     323                 :            : {
     324                 :          0 :     return *GetFormatter().GetNullDate();
     325                 :            : }
     326                 :            : 
     327                 :          0 : sal_uInt16 XclRoot::GetBaseYear() const
     328                 :            : {
     329                 :            :     // return 1904 for 1904-01-01, and 1900 for 1899-12-30
     330         [ #  # ]:          0 :     return (GetNullDate().GetYear() == 1904) ? 1904 : 1900;
     331                 :            : }
     332                 :            : 
     333                 :          0 : double XclRoot::GetDoubleFromDateTime( const DateTime& rDateTime ) const
     334                 :            : {
     335         [ #  # ]:          0 :     double fValue = rDateTime - GetNullDate();
     336                 :            :     // adjust dates before 1900-03-01 to get correct time values in the range [0.0,1.0)
     337 [ #  # ][ #  # ]:          0 :     if( rDateTime < DateTime( Date( 1, 3, 1900 ) ) )
     338                 :          0 :         fValue -= 1.0;
     339                 :          0 :     return fValue;
     340                 :            : }
     341                 :            : 
     342                 :          0 : DateTime XclRoot::GetDateTimeFromDouble( double fValue ) const
     343                 :            : {
     344         [ #  # ]:          0 :     DateTime aDateTime = GetNullDate() + fValue;
     345                 :            :     // adjust dates before 1900-03-01 to get correct time values
     346 [ #  # ][ #  # ]:          0 :     if( aDateTime < DateTime( Date( 1, 3, 1900 ) ) )
     347                 :          0 :         aDateTime += 1L;
     348                 :          0 :     return aDateTime;
     349                 :            : }
     350                 :            : 
     351                 :        273 : ScEditEngineDefaulter& XclRoot::GetEditEngine() const
     352                 :            : {
     353         [ +  + ]:        273 :     if( !mrData.mxEditEngine.get() )
     354                 :            :     {
     355         [ +  - ]:         12 :         mrData.mxEditEngine.reset( new ScEditEngineDefaulter( GetDoc().GetEnginePool() ) );
     356                 :         12 :         ScEditEngineDefaulter& rEE = *mrData.mxEditEngine;
     357         [ +  - ]:         12 :         rEE.SetRefMapMode( MAP_100TH_MM );
     358                 :         12 :         rEE.SetEditTextObjectPool( GetDoc().GetEditPool() );
     359                 :         12 :         rEE.SetUpdateMode( false );
     360                 :         12 :         rEE.EnableUndo( false );
     361                 :         12 :         rEE.SetControlWord( rEE.GetControlWord() & ~EE_CNTRL_ALLOWBIGOBJS );
     362                 :            :     }
     363                 :        273 :     return *mrData.mxEditEngine;
     364                 :            : }
     365                 :            : 
     366                 :        165 : ScHeaderEditEngine& XclRoot::GetHFEditEngine() const
     367                 :            : {
     368         [ +  + ]:        165 :     if( !mrData.mxHFEditEngine.get() )
     369                 :            :     {
     370 [ +  - ][ +  - ]:         49 :         mrData.mxHFEditEngine.reset( new ScHeaderEditEngine( EditEngine::CreatePool(), sal_True ) );
         [ +  - ][ +  - ]
     371                 :         49 :         ScHeaderEditEngine& rEE = *mrData.mxHFEditEngine;
     372 [ +  - ][ +  - ]:         49 :         rEE.SetRefMapMode( MAP_TWIP );  // headers/footers use twips as default metric
                 [ +  - ]
     373         [ +  - ]:         49 :         rEE.SetUpdateMode( false );
     374         [ +  - ]:         49 :         rEE.EnableUndo( false );
     375 [ +  - ][ +  - ]:         49 :         rEE.SetControlWord( rEE.GetControlWord() & ~EE_CNTRL_ALLOWBIGOBJS );
     376                 :            : 
     377                 :            :         // set Calc header/footer defaults
     378 [ +  - ][ +  - ]:         49 :         SfxItemSet* pEditSet = new SfxItemSet( rEE.GetEmptyItemSet() );
                 [ +  - ]
     379 [ +  - ][ +  - ]:         49 :         SfxItemSet aItemSet( *GetDoc().GetPool(), ATTR_PATTERN_START, ATTR_PATTERN_END );
     380         [ +  - ]:         49 :         ScPatternAttr::FillToEditItemSet( *pEditSet, aItemSet );
     381                 :            :         // FillToEditItemSet() adjusts font height to 1/100th mm, we need twips
     382 [ +  - ][ +  - ]:         49 :         pEditSet->Put( aItemSet.Get( ATTR_FONT_HEIGHT ), EE_CHAR_FONTHEIGHT );
     383 [ +  - ][ +  - ]:         49 :         pEditSet->Put( aItemSet.Get( ATTR_CJK_FONT_HEIGHT ), EE_CHAR_FONTHEIGHT_CJK );
     384 [ +  - ][ +  - ]:         49 :         pEditSet->Put( aItemSet.Get( ATTR_CTL_FONT_HEIGHT ), EE_CHAR_FONTHEIGHT_CTL );
     385 [ +  - ][ +  - ]:         49 :         rEE.SetDefaults( pEditSet );    // takes ownership
     386                 :            :    }
     387                 :        165 :     return *mrData.mxHFEditEngine;
     388                 :            : }
     389                 :            : 
     390                 :          0 : EditEngine& XclRoot::GetDrawEditEngine() const
     391                 :            : {
     392         [ #  # ]:          0 :     if( !mrData.mxDrawEditEng.get() )
     393                 :            :     {
     394         [ #  # ]:          0 :         mrData.mxDrawEditEng.reset( new EditEngine( &GetDoc().GetDrawLayer()->GetItemPool() ) );
     395                 :          0 :         EditEngine& rEE = *mrData.mxDrawEditEng;
     396         [ #  # ]:          0 :         rEE.SetRefMapMode( MAP_100TH_MM );
     397                 :          0 :         rEE.SetUpdateMode( false );
     398                 :          0 :         rEE.EnableUndo( false );
     399                 :          0 :         rEE.SetControlWord( rEE.GetControlWord() & ~EE_CNTRL_ALLOWBIGOBJS );
     400                 :            :     }
     401                 :          0 :     return *mrData.mxDrawEditEng;
     402                 :            : }
     403                 :            : 
     404                 :         39 : XclFontPropSetHelper& XclRoot::GetFontPropSetHelper() const
     405                 :            : {
     406                 :         39 :     return *mrData.mxFontPropSetHlp;
     407                 :            : }
     408                 :            : 
     409                 :         84 : XclChPropSetHelper& XclRoot::GetChartPropSetHelper() const
     410                 :            : {
     411                 :         84 :     return *mrData.mxChPropSetHlp;
     412                 :            : }
     413                 :            : 
     414                 :        739 : ScExtDocOptions& XclRoot::GetExtDocOptions() const
     415                 :            : {
     416                 :        739 :     return *mrData.mxExtDocOpt;
     417                 :            : }
     418                 :            : 
     419                 :        835 : XclTracer& XclRoot::GetTracer() const
     420                 :            : {
     421                 :        835 :     return *mrData.mxTracer;
     422                 :            : }
     423                 :            : 
     424                 :            : // ============================================================================
     425                 :            : 
     426                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10