LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/func - fuparagr.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 53 1.9 %
Date: 2012-12-27 Functions: 2 12 16.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 "fuparagr.hxx"
      21             : #include <editeng/eeitem.hxx>
      22             : #include <vcl/msgbox.hxx>
      23             : #include <sfx2/bindings.hxx>
      24             : #include <sfx2/request.hxx>
      25             : #include <sfx2/viewfrm.hxx>
      26             : #include <svx/svxids.hrc>
      27             : #include <editeng/editdata.hxx>
      28             : #include <editeng/lrspitem.hxx>
      29             : #include <svx/svdoutl.hxx>
      30             : 
      31             : #include "app.hrc"
      32             : #include "View.hxx"
      33             : #include "ViewShell.hxx"
      34             : #include "drawdoc.hxx"
      35             : #include "sdabstdlg.hxx"
      36             : #include "paragr.hrc"
      37             : #include "sdattr.hrc"
      38             : 
      39             : namespace sd {
      40             : 
      41           0 : TYPEINIT1( FuParagraph, FuPoor );
      42             : 
      43             : /*************************************************************************
      44             : |*
      45             : |* Konstruktor
      46             : |*
      47             : \************************************************************************/
      48             : 
      49           0 : FuParagraph::FuParagraph (
      50             :     ViewShell* pViewSh,
      51             :     ::sd::Window* pWin,
      52             :     ::sd::View* pView,
      53             :     SdDrawDocument* pDoc,
      54             :     SfxRequest& rReq)
      55           0 :     : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
      56             : {
      57           0 : }
      58             : 
      59           0 : FunctionReference FuParagraph::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
      60             : {
      61           0 :     FunctionReference xFunc( new FuParagraph( pViewSh, pWin, pView, pDoc, rReq ) );
      62           0 :     xFunc->DoExecute(rReq);
      63           0 :     return xFunc;
      64             : }
      65             : 
      66           0 : void FuParagraph::DoExecute( SfxRequest& rReq )
      67             : {
      68           0 :     const SfxItemSet* pArgs = rReq.GetArgs();
      69             : 
      70           0 :     OutlinerView* pOutlView = mpView->GetTextEditOutlinerView();
      71           0 :     ::Outliner* pOutliner = mpView->GetTextEditOutliner();
      72             : 
      73           0 :     if( !pArgs )
      74             :     {
      75           0 :         SfxItemSet aEditAttr( mpDoc->GetPool() );
      76           0 :         mpView->GetAttributes( aEditAttr );
      77           0 :         SfxItemPool *pPool =  aEditAttr.GetPool();
      78             :         SfxItemSet aNewAttr( *pPool,
      79             :                              EE_ITEMS_START, EE_ITEMS_END,
      80             :                              SID_ATTR_TABSTOP_OFFSET, SID_ATTR_TABSTOP_OFFSET,
      81             :                              ATTR_PARANUMBERING_START, ATTR_PARANUMBERING_END,
      82           0 :                              0 );
      83             : 
      84           0 :         aNewAttr.Put( aEditAttr );
      85             : 
      86             :         // linker Rand als Offset
      87           0 :         const long nOff = ( (SvxLRSpaceItem&)aNewAttr.Get( EE_PARA_LRSPACE ) ).GetTxtLeft();
      88             :         // Umrechnung, da TabulatorTabPage immer von Twips ausgeht !
      89           0 :         SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff );
      90           0 :         aNewAttr.Put( aOff );
      91             : 
      92           0 :         if( pOutlView && pOutliner )
      93             :         {
      94           0 :             ESelection eSelection = pOutlView->GetSelection();
      95           0 :             aNewAttr.Put( SfxInt16Item( ATTR_NUMBER_NEWSTART_AT, pOutliner->GetNumberingStartValue( eSelection.nStartPara ) ) );
      96           0 :             aNewAttr.Put( SfxBoolItem( ATTR_NUMBER_NEWSTART, pOutliner->IsParaIsNumberingRestart( eSelection.nStartPara ) ) );
      97             :         }
      98             : 
      99           0 :         SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
     100           0 :         SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdParagraphTabDlg(NULL, &aNewAttr ) : 0;
     101           0 :         if( pDlg )
     102             :         {
     103           0 :             sal_uInt16 nResult = pDlg->Execute();
     104             : 
     105           0 :             switch( nResult )
     106             :             {
     107             :                 case RET_OK:
     108             :                 {
     109           0 :                     rReq.Done( *( pDlg->GetOutputItemSet() ) );
     110             : 
     111           0 :                     pArgs = rReq.GetArgs();
     112             :                 }
     113           0 :                 break;
     114             : 
     115             :                 default:
     116             :                 {
     117           0 :                     delete pDlg;
     118             :                 }
     119           0 :                 return; // Abbruch
     120             :             }
     121           0 :             delete( pDlg );
     122           0 :         }
     123             :     }
     124           0 :     mpView->SetAttributes( *pArgs );
     125             : 
     126           0 :     if( pOutlView && pOutliner )
     127             :     {
     128           0 :         ESelection eSelection = pOutlView->GetSelection();
     129             : 
     130           0 :         const SfxPoolItem *pItem = 0;
     131           0 :         if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_NUMBER_NEWSTART, sal_False, &pItem ) )
     132             :         {
     133           0 :             const sal_Bool bNewStart = ((SfxBoolItem*)pItem)->GetValue() ? sal_True : sal_False;
     134           0 :             pOutliner->SetParaIsNumberingRestart( eSelection.nStartPara, bNewStart );
     135             :         }
     136             : 
     137           0 :         if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_NUMBER_NEWSTART_AT, sal_False, &pItem ) )
     138             :         {
     139           0 :             const sal_Int16 nStartAt = ((SfxInt16Item*)pItem)->GetValue();
     140           0 :             pOutliner->SetNumberingStartValue( eSelection.nStartPara, nStartAt );
     141             :         }
     142             :     }
     143             : 
     144             :     // invalidieren der Slots
     145             :     static sal_uInt16 SidArray[] = {
     146             :         SID_ATTR_TABSTOP,
     147             :         SID_ATTR_PARA_ADJUST_LEFT,
     148             :         SID_ATTR_PARA_ADJUST_RIGHT,
     149             :         SID_ATTR_PARA_ADJUST_CENTER,
     150             :         SID_ATTR_PARA_ADJUST_BLOCK,
     151             :         SID_ATTR_PARA_LINESPACE_10,
     152             :         SID_ATTR_PARA_LINESPACE_15,
     153             :         SID_ATTR_PARA_LINESPACE_20,
     154             :         SID_ATTR_PARA_LRSPACE,
     155             :         SID_ATTR_PARA_LEFT_TO_RIGHT,
     156             :         SID_ATTR_PARA_RIGHT_TO_LEFT,
     157             :         SID_RULER_TEXT_RIGHT_TO_LEFT,
     158             :         SID_PARASPACE_INCREASE,
     159             :         SID_PARASPACE_DECREASE,
     160             :         0 };
     161             : 
     162           0 :     mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
     163             : }
     164             : 
     165           0 : void FuParagraph::Activate()
     166             : {
     167           0 : }
     168             : 
     169           0 : void FuParagraph::Deactivate()
     170             : {
     171           0 : }
     172             : 
     173           9 : } // end of namespace sd
     174             : 
     175             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10