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

Generated by: LCOV version 1.10