LCOV - code coverage report
Current view: top level - sw/source/core/edit - edfcol.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 50 0.0 %
Date: 2012-08-25 Functions: 0 6 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 92 0.0 %

           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 <hintids.hxx>
      30                 :            : #include <editeng/brkitem.hxx>
      31                 :            : #include <editsh.hxx>
      32                 :            : #include <doc.hxx>      // fuer SwTxtFmtColls
      33                 :            : #include <IDocumentUndoRedo.hxx>
      34                 :            : #include <edimp.hxx>    // fuer MACROS
      35                 :            : #include <ndtxt.hxx>
      36                 :            : #include <paratr.hxx>
      37                 :            : #include <fmtpdsc.hxx>
      38                 :            : #include <viewopt.hxx>  // Formular view
      39                 :            : #include <SwRewriter.hxx>
      40                 :            : #include <numrule.hxx>
      41                 :            : #include <swundo.hxx>
      42                 :            : #include <docary.hxx>
      43                 :            : 
      44                 :            : /*************************************
      45                 :            :  * FormatColl
      46                 :            :  *************************************/
      47                 :            : // TXT
      48                 :            : 
      49                 :            : 
      50                 :          0 : SwTxtFmtColl& SwEditShell::GetDfltTxtFmtColl() const
      51                 :            : {
      52                 :          0 :     return *((SwTxtFmtColl*) (GetDoc()->GetDfltTxtFmtColl()));
      53                 :            : }
      54                 :            : 
      55                 :            : 
      56                 :          0 : sal_uInt16 SwEditShell::GetTxtFmtCollCount() const
      57                 :            : {
      58                 :          0 :     return GetDoc()->GetTxtFmtColls()->size();
      59                 :            : }
      60                 :            : 
      61                 :            : 
      62                 :          0 : SwTxtFmtColl& SwEditShell::GetTxtFmtColl( sal_uInt16 nFmtColl) const
      63                 :            : {
      64                 :          0 :     return *((*(GetDoc()->GetTxtFmtColls()))[nFmtColl]);
      65                 :            : }
      66                 :            : 
      67                 :            : // #i62675#
      68                 :          0 : void SwEditShell::SetTxtFmtColl( SwTxtFmtColl *pFmt,
      69                 :            :                                  bool bResetListAttrs )
      70                 :            : {
      71 [ #  # ][ #  # ]:          0 :     SwTxtFmtColl *pLocal = pFmt? pFmt: (*GetDoc()->GetTxtFmtColls())[0];
      72         [ #  # ]:          0 :     StartAllAction();
      73                 :            : 
      74         [ #  # ]:          0 :     SwRewriter aRewriter;
      75         [ #  # ]:          0 :     aRewriter.AddRule(UndoArg1, pLocal->GetName());
      76                 :            : 
      77 [ #  # ][ #  # ]:          0 :     GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_SETFMTCOLL, &aRewriter);
      78 [ #  # ][ #  # ]:          0 :     FOREACHPAM_START(this)
      79                 :            : 
      80         [ #  # ]:          0 :         if( !PCURCRSR->HasReadonlySel(
      81                 :            :                     // Formular view
      82         [ #  # ]:          0 :                     GetViewOptions()->IsFormView() ) )
      83         [ #  # ]:          0 :             GetDoc()->SetTxtFmtColl( *PCURCRSR, pLocal, true, bResetListAttrs );
      84                 :            : 
      85                 :          0 :     FOREACHPAM_END()
      86 [ #  # ][ #  # ]:          0 :     GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_SETFMTCOLL, &aRewriter);
      87 [ #  # ][ #  # ]:          0 :     EndAllAction();
      88                 :          0 : }
      89                 :            : 
      90                 :            : 
      91                 :          0 : SwTxtFmtColl* SwEditShell::MakeTxtFmtColl(const String& rFmtCollName,
      92                 :            :         SwTxtFmtColl* pParent)
      93                 :            : {
      94                 :            :     SwTxtFmtColl *pColl;
      95         [ #  # ]:          0 :     if ( pParent == 0 )
      96                 :          0 :         pParent = &GetTxtFmtColl(0);
      97                 :          0 :     if (  (pColl=GetDoc()->MakeTxtFmtColl(rFmtCollName, pParent)) == 0 )
      98                 :            :     {
      99                 :            :         OSL_FAIL( "MakeTxtFmtColl failed" );
     100                 :            :     }
     101                 :          0 :     return pColl;
     102                 :            : 
     103                 :            : }
     104                 :            : 
     105                 :            : 
     106                 :          0 : void SwEditShell::FillByEx(SwTxtFmtColl* pColl, sal_Bool bReset)
     107                 :            : {
     108         [ #  # ]:          0 :     if( bReset )
     109                 :            :     {
     110                 :            :         // #i73790# - method renamed
     111                 :          0 :         pColl->ResetAllFmtAttr();
     112                 :            :     }
     113                 :            : 
     114                 :          0 :     SwPaM * pCrsr = GetCrsr();
     115                 :          0 :     SwCntntNode * pCnt = pCrsr->GetCntntNode();
     116                 :          0 :     const SfxItemSet* pSet = pCnt->GetpSwAttrSet();
     117         [ #  # ]:          0 :     if( pSet )
     118                 :            :     {
     119                 :            :         // JP 05.10.98: falls eines der Attribute Break/PageDesc/NumRule(auto)
     120                 :            :         //      im ItemSet steht, so entferne die VORM setzen an der Collection.
     121                 :            :         //      Ansonst wird zu viel gemacht oder falsche gemacht (NumRules!)
     122                 :            :         //      Bug 57568
     123                 :            : 
     124                 :            :         // AutoNumRules NICHT in die Vorlagen uebernehmen
     125                 :            :         const SfxPoolItem* pItem;
     126                 :          0 :         const SwNumRule* pRule = 0;
     127 [ #  # ][ #  # ]:          0 :         if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, sal_False ) ||
                 [ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     128         [ #  # ]:          0 :             SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC,sal_False ) ||
     129                 :            :             ( SFX_ITEM_SET == pSet->GetItemState( RES_PARATR_NUMRULE,
     130         [ #  # ]:          0 :                 sal_False, &pItem ) && 0 != (pRule = GetDoc()->FindNumRulePtr(
     131                 :          0 :                 ((SwNumRuleItem*)pItem)->GetValue() )) &&
     132                 :          0 :                 pRule && pRule->IsAutoRule() )
     133                 :            :             )
     134                 :            :         {
     135         [ #  # ]:          0 :             SfxItemSet aSet( *pSet );
     136         [ #  # ]:          0 :             aSet.ClearItem( RES_BREAK );
     137         [ #  # ]:          0 :             aSet.ClearItem( RES_PAGEDESC );
     138                 :            : 
     139         [ #  # ]:          0 :             if( pRule || (SFX_ITEM_SET == pSet->GetItemState( RES_PARATR_NUMRULE,
           [ #  #  #  # ]
                 [ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     140         [ #  # ]:          0 :                 sal_False, &pItem ) && 0 != (pRule = GetDoc()->FindNumRulePtr(
     141                 :          0 :                 ((SwNumRuleItem*)pItem)->GetValue() )) &&
     142                 :          0 :                 pRule && pRule->IsAutoRule() ))
     143         [ #  # ]:          0 :                 aSet.ClearItem( RES_PARATR_NUMRULE );
     144                 :            : 
     145         [ #  # ]:          0 :             if( aSet.Count() )
     146 [ #  # ][ #  # ]:          0 :                 GetDoc()->ChgFmt(*pColl, aSet );
     147                 :            :         }
     148                 :            :         else
     149         [ #  # ]:          0 :             GetDoc()->ChgFmt(*pColl, *pSet );
     150                 :            :     }
     151                 :          0 : }
     152                 :            : 
     153                 :            : 
     154                 :            : 
     155                 :            : 
     156                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10