LCOV - code coverage report
Current view: top level - sw/source/core/edit - edfcol.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 49 0.0 %
Date: 2014-04-14 Functions: 0 6 0.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 <hintids.hxx>
      21             : #include <editeng/formatbreakitem.hxx>
      22             : #include <editsh.hxx>
      23             : #include <doc.hxx>
      24             : #include <IDocumentUndoRedo.hxx>
      25             : #include <edimp.hxx>
      26             : #include <ndtxt.hxx>
      27             : #include <paratr.hxx>
      28             : #include <fmtpdsc.hxx>
      29             : #include <viewopt.hxx>
      30             : #include <SwRewriter.hxx>
      31             : #include <numrule.hxx>
      32             : #include <swundo.hxx>
      33             : #include <docary.hxx>
      34             : 
      35           0 : SwTxtFmtColl& SwEditShell::GetDfltTxtFmtColl() const
      36             : {
      37           0 :     return *((SwTxtFmtColl*) (GetDoc()->GetDfltTxtFmtColl()));
      38             : }
      39             : 
      40           0 : sal_uInt16 SwEditShell::GetTxtFmtCollCount() const
      41             : {
      42           0 :     return GetDoc()->GetTxtFmtColls()->size();
      43             : }
      44             : 
      45           0 : SwTxtFmtColl& SwEditShell::GetTxtFmtColl( sal_uInt16 nFmtColl) const
      46             : {
      47           0 :     return *((*(GetDoc()->GetTxtFmtColls()))[nFmtColl]);
      48             : }
      49             : 
      50             : // #i62675#
      51           0 : void SwEditShell::SetTxtFmtColl( SwTxtFmtColl *pFmt,
      52             :                                  bool bResetListAttrs )
      53             : {
      54           0 :     SwTxtFmtColl *pLocal = pFmt? pFmt: (*GetDoc()->GetTxtFmtColls())[0];
      55           0 :     StartAllAction();
      56             : 
      57           0 :     SwRewriter aRewriter;
      58           0 :     aRewriter.AddRule(UndoArg1, pLocal->GetName());
      59             : 
      60           0 :     GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_SETFMTCOLL, &aRewriter);
      61           0 :     FOREACHPAM_START(GetCrsr())
      62             : 
      63           0 :         if ( !PCURCRSR->HasReadonlySel( GetViewOptions()->IsFormView() ) )
      64             :         {
      65           0 :             GetDoc()->SetTxtFmtColl( *PCURCRSR, pLocal, true, bResetListAttrs );
      66             :         }
      67             : 
      68           0 :     FOREACHPAM_END()
      69           0 :     GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_SETFMTCOLL, &aRewriter);
      70           0 :     EndAllAction();
      71           0 : }
      72             : 
      73           0 : SwTxtFmtColl* SwEditShell::MakeTxtFmtColl(const OUString& rFmtCollName,
      74             :         SwTxtFmtColl* pParent)
      75             : {
      76             :     SwTxtFmtColl *pColl;
      77           0 :     if ( pParent == 0 )
      78           0 :         pParent = &GetTxtFmtColl(0);
      79           0 :     if (  (pColl=GetDoc()->MakeTxtFmtColl(rFmtCollName, pParent)) == 0 )
      80             :     {
      81             :         OSL_FAIL( "MakeTxtFmtColl failed" );
      82             :     }
      83           0 :     return pColl;
      84             : 
      85             : }
      86             : 
      87           0 : void SwEditShell::FillByEx(SwTxtFmtColl* pColl, sal_Bool bReset)
      88             : {
      89           0 :     if( bReset )
      90             :     {
      91           0 :         pColl->ResetAllFmtAttr();
      92             :     }
      93             : 
      94           0 :     SwPaM * pCrsr = GetCrsr();
      95           0 :     SwCntntNode * pCnt = pCrsr->GetCntntNode();
      96           0 :     const SfxItemSet* pSet = pCnt->GetpSwAttrSet();
      97           0 :     if( pSet )
      98             :     {
      99             :         // JP 05.10.98: Special treatment if one of the attribues Break/PageDesc/NumRule(auto) is
     100             :         //      in the ItemSet. Otherwise there will be too much or wrong processing (NumRules!)
     101             :         //      Bug 57568
     102             : 
     103             :         // Do NOT copy AutoNumRules into the template
     104             :         const SfxPoolItem* pItem;
     105           0 :         const SwNumRule* pRule = 0;
     106           0 :         if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, false ) ||
     107           0 :             SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC,false ) ||
     108             :             ( SFX_ITEM_SET == pSet->GetItemState( RES_PARATR_NUMRULE,
     109           0 :                 false, &pItem ) && 0 != (pRule = GetDoc()->FindNumRulePtr(
     110           0 :                 ((SwNumRuleItem*)pItem)->GetValue() )) &&
     111           0 :                 pRule && pRule->IsAutoRule() )
     112             :             )
     113             :         {
     114           0 :             SfxItemSet aSet( *pSet );
     115           0 :             aSet.ClearItem( RES_BREAK );
     116           0 :             aSet.ClearItem( RES_PAGEDESC );
     117             : 
     118           0 :             if( pRule || (SFX_ITEM_SET == pSet->GetItemState( RES_PARATR_NUMRULE,
     119           0 :                 false, &pItem ) && 0 != (pRule = GetDoc()->FindNumRulePtr(
     120           0 :                 ((SwNumRuleItem*)pItem)->GetValue() )) &&
     121           0 :                 pRule && pRule->IsAutoRule() ))
     122           0 :                 aSet.ClearItem( RES_PARATR_NUMRULE );
     123             : 
     124           0 :             if( aSet.Count() )
     125           0 :                 GetDoc()->ChgFmt(*pColl, aSet );
     126             :         }
     127             :         else
     128           0 :             GetDoc()->ChgFmt(*pColl, *pSet );
     129             :     }
     130           0 : }
     131             : 
     132             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10