LCOV - code coverage report
Current view: top level - editeng/source/outliner - outleeng.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 57 81 70.4 %
Date: 2015-06-13 12:38:46 Functions: 14 20 70.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #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       30948 : OutlinerEditEng::OutlinerEditEng( Outliner* pEngOwner, SfxItemPool* pPool )
      38       30948 :  : EditEngine( pPool )
      39             : {
      40       30948 :     pOwner = pEngOwner;
      41       30948 : }
      42             : 
      43       61372 : OutlinerEditEng::~OutlinerEditEng()
      44             : {
      45       61372 : }
      46             : 
      47       20095 : void OutlinerEditEng::PaintingFirstLine( sal_Int32 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev )
      48             : {
      49       20095 :     if( GetControlWord() & EEControlBits::OUTLINER )
      50             :     {
      51           0 :         PaintFirstLineInfo aInfo( nPara, rStartPos, nBaseLineY, rOrigin, nOrientation, pOutDev );
      52           0 :         pOwner->maPaintFirstLineHdl.Call( &aInfo );
      53             :     }
      54             : 
      55       20095 :     pOwner->PaintBullet( nPara, rStartPos, rOrigin, nOrientation, pOutDev );
      56       20095 : }
      57             : 
      58      462893 : const SvxNumberFormat* OutlinerEditEng::GetNumberFormat( sal_Int32 nPara ) const
      59             : {
      60      462893 :     const SvxNumberFormat* pFmt = NULL;
      61      462893 :     if (pOwner)
      62      462893 :         pFmt = pOwner->GetNumberFormat( nPara );
      63      462893 :     return pFmt;
      64             : }
      65             : 
      66             : 
      67      363814 : Rectangle OutlinerEditEng::GetBulletArea( sal_Int32 nPara )
      68             : {
      69      363814 :     Rectangle aBulletArea = Rectangle( Point(), Point() );
      70      363814 :     if ( nPara < pOwner->pParaList->GetParagraphCount() )
      71             :     {
      72      363814 :         if ( pOwner->ImplHasNumberFormat( nPara ) )
      73        3442 :             aBulletArea = pOwner->ImpCalcBulletArea( nPara, false, false );
      74             :     }
      75      363814 :     return aBulletArea;
      76             : }
      77             : 
      78      437412 : void OutlinerEditEng::ParagraphInserted( sal_Int32 nNewParagraph )
      79             : {
      80      437412 :     pOwner->ParagraphInserted( nNewParagraph );
      81             : 
      82      437412 :     EditEngine::ParagraphInserted( nNewParagraph );
      83      437412 : }
      84             : 
      85      421303 : void OutlinerEditEng::ParagraphDeleted( sal_Int32 nDeletedParagraph )
      86             : {
      87      421303 :     pOwner->ParagraphDeleted( nDeletedParagraph );
      88             : 
      89      421303 :     EditEngine::ParagraphDeleted( nDeletedParagraph );
      90      421303 : }
      91             : 
      92        1520 : void OutlinerEditEng::ParagraphConnected( sal_Int32 /*nLeftParagraph*/, sal_Int32 nRightParagraph )
      93             : {
      94        1520 :     if( pOwner && pOwner->IsUndoEnabled() && !const_cast<EditEngine&>(pOwner->GetEditEngine()).IsInUndo() )
      95             :     {
      96         291 :         Paragraph* pPara = pOwner->GetParagraph( nRightParagraph );
      97         291 :         if( pPara && Outliner::HasParaFlag( pPara, ParaFlag::ISPAGE ) )
      98             :         {
      99           0 :             pOwner->InsertUndo( new OutlinerUndoChangeParaFlags( pOwner, nRightParagraph, ParaFlag::ISPAGE, ParaFlag::NONE ) );
     100             :         }
     101             :     }
     102        1520 : }
     103             : 
     104             : 
     105           0 : void OutlinerEditEng::StyleSheetChanged( SfxStyleSheet* pStyle )
     106             : {
     107           0 :     pOwner->StyleSheetChanged( pStyle );
     108           0 : }
     109             : 
     110      596050 : void OutlinerEditEng::ParaAttribsChanged( sal_Int32 nPara )
     111             : {
     112      596050 :     pOwner->ParaAttribsChanged( nPara );
     113      596050 : }
     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      254243 : OUString OutlinerEditEng::GetUndoComment( sal_uInt16 nUndoId ) const
     126             : {
     127      254243 :     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      101483 :             return EE_RESSTR(RID_OUTLUNDO_ATTR);
     140             : 
     141             :         case OLUNDO_INSERT:
     142           0 :             return EE_RESSTR(RID_OUTLUNDO_INSERT);
     143             : 
     144             :         default:
     145      152760 :             return EditEngine::GetUndoComment( nUndoId );
     146             :     }
     147             : }
     148             : 
     149       22848 : 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       22848 :         pWrongSpellVector, pFieldData, bEndOfLine, bEndOfParagraph, bEndOfBullet, pLocale, rOverlineColor, rTextLineColor);
     162       22848 : }
     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        8845 : OUString OutlinerEditEng::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rpTxtColor, Color*& rpFldColor )
     185             : {
     186        8845 :     return pOwner->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
     187             : }
     188             : 
     189      818774 : void OutlinerEditEng::SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet )
     190             : {
     191      818774 :     Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
     192      818774 :     if( pPara )
     193             :     {
     194      818774 :         if ( !IsInUndo() && IsUndoEnabled() )
     195      101315 :             pOwner->UndoActionStart( OLUNDO_ATTR );
     196             : 
     197      818774 :         EditEngine::SetParaAttribs( nPara, rSet );
     198             : 
     199      818774 :         pOwner->ImplCheckNumBulletItem( nPara );
     200             :         // #i100014#
     201             :         // It is not a good idea to subtract 1 from a count and cast the result
     202             :         // to sal_uInt16 without check, if the count is 0.
     203      818774 :         pOwner->ImplCheckParagraphs( nPara, pOwner->pParaList->GetParagraphCount() );
     204             : 
     205      818774 :         if ( !IsInUndo() && IsUndoEnabled() )
     206      101315 :             pOwner->UndoActionEnd( OLUNDO_ATTR );
     207             :     }
     208      818774 : }
     209             : 
     210             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11