LCOV - code coverage report
Current view: top level - editeng/source/outliner - outleeng.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 57 81 70.4 %
Date: 2014-11-03 Functions: 16 22 72.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 <svl/intitem.hxx>
      21             : #include <editeng/editeng.hxx>
      22             : #include <editeng/editview.hxx>
      23             : #include <editeng/editdata.hxx>
      24             : #include <editeng/eerdll.hxx>
      25             : #include <editeng/lrspitem.hxx>
      26             : #include <editeng/fhgtitem.hxx>
      27             : 
      28             : #include <editeng/outliner.hxx>
      29             : #include <outleeng.hxx>
      30             : #include <paralist.hxx>
      31             : #include <editeng/editrids.hrc>
      32             : #include <svl/itemset.hxx>
      33             : #include <editeng/eeitem.hxx>
      34             : #include <editeng/editstat.hxx>
      35             : #include "outlundo.hxx"
      36             : 
      37       34284 : OutlinerEditEng::OutlinerEditEng( Outliner* pEngOwner, SfxItemPool* pPool )
      38       34284 :  : EditEngine( pPool )
      39             : {
      40       34284 :     pOwner = pEngOwner;
      41       34284 : }
      42             : 
      43       67832 : OutlinerEditEng::~OutlinerEditEng()
      44             : {
      45       67832 : }
      46             : 
      47       16595 : void OutlinerEditEng::PaintingFirstLine( sal_Int32 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev )
      48             : {
      49       16595 :     if( GetControlWord() & EE_CNTRL_OUTLINER )
      50             :     {
      51           0 :         PaintFirstLineInfo aInfo( nPara, rStartPos, nBaseLineY, rOrigin, nOrientation, pOutDev );
      52           0 :         pOwner->maPaintFirstLineHdl.Call( &aInfo );
      53             :     }
      54             : 
      55       16595 :     pOwner->PaintBullet( nPara, rStartPos, rOrigin, nOrientation, pOutDev );
      56       16595 : }
      57             : 
      58      369200 : const SvxNumberFormat* OutlinerEditEng::GetNumberFormat( sal_Int32 nPara ) const
      59             : {
      60      369200 :     const SvxNumberFormat* pFmt = NULL;
      61      369200 :     if (pOwner)
      62      369200 :         pFmt = pOwner->GetNumberFormat( nPara );
      63      369200 :     return pFmt;
      64             : }
      65             : 
      66             : 
      67      299439 : Rectangle OutlinerEditEng::GetBulletArea( sal_Int32 nPara )
      68             : {
      69      299439 :     Rectangle aBulletArea = Rectangle( Point(), Point() );
      70      299439 :     if ( nPara < pOwner->pParaList->GetParagraphCount() )
      71             :     {
      72      299439 :         if ( pOwner->ImplHasNumberFormat( nPara ) )
      73        4855 :             aBulletArea = pOwner->ImpCalcBulletArea( nPara, false, false );
      74             :     }
      75      299439 :     return aBulletArea;
      76             : }
      77             : 
      78      360874 : void OutlinerEditEng::ParagraphInserted( sal_Int32 nNewParagraph )
      79             : {
      80      360874 :     pOwner->ParagraphInserted( nNewParagraph );
      81             : 
      82      360874 :     EditEngine::ParagraphInserted( nNewParagraph );
      83      360874 : }
      84             : 
      85      342237 : void OutlinerEditEng::ParagraphDeleted( sal_Int32 nDeletedParagraph )
      86             : {
      87      342237 :     pOwner->ParagraphDeleted( nDeletedParagraph );
      88             : 
      89      342237 :     EditEngine::ParagraphDeleted( nDeletedParagraph );
      90      342237 : }
      91             : 
      92        2080 : void OutlinerEditEng::ParagraphConnected( sal_Int32 /*nLeftParagraph*/, sal_Int32 nRightParagraph )
      93             : {
      94        2080 :     if( pOwner && pOwner->IsUndoEnabled() && !const_cast<EditEngine&>(pOwner->GetEditEngine()).IsInUndo() )
      95             :     {
      96         508 :         Paragraph* pPara = pOwner->GetParagraph( nRightParagraph );
      97         508 :         if( pPara && pOwner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) )
      98             :         {
      99           0 :             pOwner->InsertUndo( new OutlinerUndoChangeParaFlags( pOwner, nRightParagraph, PARAFLAG_ISPAGE, 0 ) );
     100             :         }
     101             :     }
     102        2080 : }
     103             : 
     104             : 
     105           0 : void OutlinerEditEng::StyleSheetChanged( SfxStyleSheet* pStyle )
     106             : {
     107           0 :     pOwner->StyleSheetChanged( pStyle );
     108           0 : }
     109             : 
     110      531969 : void OutlinerEditEng::ParaAttribsChanged( sal_Int32 nPara )
     111             : {
     112      531969 :     pOwner->ParaAttribsChanged( nPara );
     113      531969 : }
     114             : 
     115           0 : bool OutlinerEditEng::SpellNextDocument()
     116             : {
     117           0 :     return pOwner->SpellNextDocument();
     118             : }
     119             : 
     120           0 : bool OutlinerEditEng::ConvertNextDocument()
     121             : {
     122           0 :     return pOwner->ConvertNextDocument();
     123             : }
     124             : 
     125      211261 : OUString OutlinerEditEng::GetUndoComment( sal_uInt16 nUndoId ) const
     126             : {
     127      211261 :     switch( nUndoId )
     128             :     {
     129             :         case OLUNDO_DEPTH:
     130           0 :             return EE_RESSTR(RID_OUTLUNDO_DEPTH);
     131             : 
     132             :         case OLUNDO_EXPAND:
     133           0 :             return EE_RESSTR(RID_OUTLUNDO_EXPAND);
     134             : 
     135             :         case OLUNDO_COLLAPSE:
     136           0 :             return EE_RESSTR(RID_OUTLUNDO_COLLAPSE);
     137             : 
     138             :         case OLUNDO_ATTR:
     139       83015 :             return EE_RESSTR(RID_OUTLUNDO_ATTR);
     140             : 
     141             :         case OLUNDO_INSERT:
     142           0 :             return EE_RESSTR(RID_OUTLUNDO_INSERT);
     143             : 
     144             :         default:
     145      128246 :             return EditEngine::GetUndoComment( nUndoId );
     146             :     }
     147             : }
     148             : 
     149       20601 : void OutlinerEditEng::DrawingText( const Point& rStartPos, const OUString& rText, sal_Int32 nTextStart, sal_Int32 nTextLen,
     150             :                                    const long* pDXArray, const SvxFont& rFont, sal_Int32 nPara, sal_Int32 nIndex, sal_uInt8 nRightToLeft,
     151             :                                    const EEngineData::WrongSpellVector* pWrongSpellVector,
     152             :                                    const SvxFieldData* pFieldData,
     153             :                                    bool bEndOfLine,
     154             :                                    bool bEndOfParagraph,
     155             :                                    bool bEndOfBullet,
     156             :                                    const ::com::sun::star::lang::Locale* pLocale,
     157             :                                    const Color& rOverlineColor,
     158             :                                    const Color& rTextLineColor)
     159             : {
     160             :     pOwner->DrawingText(rStartPos,rText,nTextStart,nTextLen,pDXArray,rFont,nPara,nIndex,nRightToLeft,
     161       20601 :         pWrongSpellVector, pFieldData, bEndOfLine, bEndOfParagraph, bEndOfBullet, pLocale, rOverlineColor, rTextLineColor);
     162       20601 : }
     163             : 
     164           0 : void OutlinerEditEng::DrawingTab( const Point& rStartPos, long nWidth, const OUString& rChar,
     165             :     const SvxFont& rFont, sal_Int32 nPara, sal_Int32 nIndex, sal_uInt8 nRightToLeft,
     166             :     bool bEndOfLine, bool bEndOfParagraph,
     167             :     const Color& rOverlineColor, const Color& rTextLineColor)
     168             : {
     169             :     pOwner->DrawingTab(rStartPos, nWidth, rChar, rFont, nPara, nIndex, nRightToLeft,
     170           0 :             bEndOfLine, bEndOfParagraph, rOverlineColor, rTextLineColor );
     171           0 : }
     172             : 
     173           0 : void OutlinerEditEng::FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos )
     174             : {
     175           0 :     EditEngine::FieldClicked( rField, nPara, nPos );    // If URL
     176           0 :     pOwner->FieldClicked( rField, nPara, nPos );
     177           0 : }
     178             : 
     179           0 : void OutlinerEditEng::FieldSelected( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos )
     180             : {
     181           0 :     pOwner->FieldSelected( rField, nPara, nPos );
     182           0 : }
     183             : 
     184        9239 : OUString OutlinerEditEng::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rpTxtColor, Color*& rpFldColor )
     185             : {
     186        9239 :     return pOwner->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
     187             : }
     188             : 
     189      662997 : void OutlinerEditEng::SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet )
     190             : {
     191      662997 :     Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
     192      662997 :     if( pPara )
     193             :     {
     194      662997 :         if ( !IsInUndo() && IsUndoEnabled() )
     195       82755 :             pOwner->UndoActionStart( OLUNDO_ATTR );
     196             : 
     197      662997 :         EditEngine::SetParaAttribs( nPara, rSet );
     198             : 
     199      662997 :         pOwner->ImplCheckNumBulletItem( nPara );
     200             :         // #i100014#
     201             :         // It is not a good idea to substract 1 from a count and cast the result
     202             :         // to sal_uInt16 without check, if the count is 0.
     203      662997 :         pOwner->ImplCheckParagraphs( nPara, pOwner->pParaList->GetParagraphCount() );
     204             : 
     205      662997 :         if ( !IsInUndo() && IsUndoEnabled() )
     206       82755 :             pOwner->UndoActionEnd( OLUNDO_ATTR );
     207             :     }
     208      663666 : }
     209             : 
     210             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10