LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sd/source/ui/dlg - dlgolbul.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 79 0.0 %
Date: 2013-07-09 Functions: 0 7 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 "OutlineBulletDlg.hxx"
      21             : 
      22             : #include <svx/svxids.hrc>
      23             : #include <sfx2/objsh.hxx>
      24             : #include <svx/drawitem.hxx>
      25             : #include <editeng/bulletitem.hxx>
      26             : #include <editeng/eeitem.hxx>
      27             : 
      28             : #include <editeng/numitem.hxx>
      29             : 
      30             : #include <svx/dialogs.hrc>
      31             : #include <svl/intitem.hxx>
      32             : #include <svx/svdmark.hxx>
      33             : #include "View.hxx"
      34             : #include <svx/svdobj.hxx>
      35             : #include <svl/style.hxx>
      36             : #include <drawdoc.hxx>
      37             : 
      38             : #include "sdresid.hxx"
      39             : 
      40             : #include "glob.hrc"
      41             : #include "dlgolbul.hrc"
      42             : #include "bulmaper.hxx"
      43             : #include "DrawDocShell.hxx"
      44             : #include <svl/aeitem.hxx>
      45             : 
      46             : namespace sd {
      47             : 
      48             : /**
      49             :  * Constructor of tab dialog: append pages to the dialog
      50             :  */
      51           0 : OutlineBulletDlg::OutlineBulletDlg(
      52             :     ::Window* pParent,
      53             :     const SfxItemSet* pAttr,
      54             :     ::sd::View* pView )
      55             :     : SfxTabDialog  ( pParent, SdResId(TAB_OUTLINEBULLET) ),
      56             :       aInputSet     ( *pAttr ),
      57             :       bTitle            ( sal_False ),
      58           0 :       pSdView           ( pView )
      59             : {
      60           0 :     FreeResource();
      61             : 
      62           0 :     aInputSet.MergeRange( SID_PARAM_NUM_PRESET, SID_PARAM_CUR_NUM_LEVEL );
      63           0 :     aInputSet.Put( *pAttr );
      64             : 
      65           0 :     pOutputSet = new SfxItemSet( *pAttr );
      66           0 :     pOutputSet->ClearItem();
      67             : 
      68           0 :     sal_Bool bOutliner = sal_False;
      69             : 
      70             :     // special treatment if a title object is selected
      71           0 :     if( pView )
      72             :     {
      73           0 :         const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
      74           0 :         const sal_uLong nCount = rMarkList.GetMarkCount();
      75           0 :         for(sal_uLong nNum = 0; nNum < nCount; nNum++)
      76             :         {
      77           0 :             SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj();
      78           0 :             if( pObj->GetObjInventor() == SdrInventor )
      79             :             {
      80             : 
      81           0 :                 switch(pObj->GetObjIdentifier())
      82             :                 {
      83             :                 case OBJ_TITLETEXT:
      84           0 :                     bTitle = sal_True;
      85           0 :                     break;
      86             :                 case OBJ_OUTLINETEXT:
      87           0 :                     bOutliner = sal_True;
      88           0 :                     break;
      89             :                 }
      90             :             }
      91             :         }
      92             :     }
      93             : 
      94           0 :     if( SFX_ITEM_SET != aInputSet.GetItemState(EE_PARA_NUMBULLET))
      95             :     {
      96           0 :         const SvxNumBulletItem *pItem = NULL;
      97           0 :         if(bOutliner)
      98             :         {
      99           0 :             SfxStyleSheetBasePool* pSSPool = pView->GetDocSh()->GetStyleSheetPool();
     100           0 :             String aStyleName((SdResId(STR_LAYOUT_OUTLINE)));
     101           0 :             aStyleName.AppendAscii( " 1" );
     102           0 :             SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO);
     103           0 :             if( pFirstStyleSheet )
     104           0 :                 pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, sal_False, (const SfxPoolItem**)&pItem);
     105             :         }
     106             : 
     107           0 :         if( pItem == NULL )
     108           0 :             pItem = (SvxNumBulletItem*) aInputSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET);
     109             : 
     110             :         DBG_ASSERT( pItem, "No EE_PARA_NUMBULLET in Pool! [CL]" );
     111             : 
     112           0 :         aInputSet.Put(*pItem, EE_PARA_NUMBULLET);
     113             :     }
     114             : 
     115           0 :     if(bTitle && aInputSet.GetItemState(EE_PARA_NUMBULLET,sal_True) == SFX_ITEM_ON )
     116             :     {
     117           0 :         SvxNumBulletItem* pItem = (SvxNumBulletItem*)aInputSet.GetItem(EE_PARA_NUMBULLET,sal_True);
     118           0 :         SvxNumRule* pRule = pItem->GetNumRule();
     119           0 :         if(pRule)
     120             :         {
     121           0 :             SvxNumRule aNewRule( *pRule );
     122           0 :             aNewRule.SetFeatureFlag( NUM_NO_NUMBERS, sal_True );
     123             : 
     124           0 :             SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET );
     125           0 :             aInputSet.Put(aNewItem);
     126             :         }
     127             :     }
     128             : 
     129           0 :     SetInputSet( &aInputSet );
     130             : 
     131           0 :     if(!bTitle)
     132           0 :         AddTabPage(RID_SVXPAGE_PICK_SINGLE_NUM);
     133             :     else
     134           0 :         RemoveTabPage( RID_SVXPAGE_PICK_SINGLE_NUM );
     135             : 
     136           0 :     AddTabPage( RID_SVXPAGE_PICK_BULLET  );
     137           0 :     AddTabPage( RID_SVXPAGE_PICK_BMP   );
     138           0 :     AddTabPage(RID_SVXPAGE_NUM_OPTIONS  );
     139           0 :     AddTabPage(RID_SVXPAGE_NUM_POSITION );
     140             : 
     141           0 : }
     142             : 
     143           0 : OutlineBulletDlg::~OutlineBulletDlg()
     144             : {
     145           0 :     delete pOutputSet;
     146           0 : }
     147             : 
     148           0 : void OutlineBulletDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
     149             : {
     150           0 :     switch ( nId )
     151             :     {
     152             :         case RID_SVXPAGE_NUM_OPTIONS:
     153             :         {
     154           0 :             if( pSdView )
     155             :             {
     156           0 :                 FieldUnit eMetric = pSdView->GetDoc().GetUIUnit();
     157           0 :                 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
     158           0 :                 aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM,(sal_uInt16)eMetric));
     159           0 :                 rPage.PageCreated(aSet);
     160             :             }
     161             :         }
     162           0 :         break;
     163             :         case RID_SVXPAGE_NUM_POSITION:
     164             :         {
     165           0 :             if( pSdView )
     166             :             {
     167           0 :                 FieldUnit eMetric = pSdView->GetDoc().GetUIUnit();
     168           0 :                 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
     169           0 :                 aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM,(sal_uInt16)eMetric));
     170           0 :                 rPage.PageCreated(aSet);
     171             :             }
     172             :         }
     173           0 :         break;
     174             :     }
     175           0 : }
     176             : 
     177           0 : const SfxItemSet* OutlineBulletDlg::GetOutputItemSet() const
     178             : {
     179           0 :     SfxItemSet aSet( *SfxTabDialog::GetOutputItemSet() );
     180           0 :     pOutputSet->Put( aSet );
     181             : 
     182           0 :     const SfxPoolItem *pItem = NULL;
     183           0 :     if( SFX_ITEM_SET == pOutputSet->GetItemState(pOutputSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE), sal_False, &pItem ))
     184             :     {
     185           0 :         SdBulletMapper::MapFontsInNumRule( *((SvxNumBulletItem*)pItem)->GetNumRule(), *pOutputSet );
     186             : 
     187             : // #i35937 - removed EE_PARA_BULLETSTATE setting
     188             :     }
     189             : 
     190             : 
     191           0 :     if(bTitle && pOutputSet->GetItemState(EE_PARA_NUMBULLET,sal_True) == SFX_ITEM_ON )
     192             :     {
     193           0 :         SvxNumBulletItem* pBulletItem = (SvxNumBulletItem*)pOutputSet->GetItem(EE_PARA_NUMBULLET,sal_True);
     194           0 :         SvxNumRule* pRule = pBulletItem->GetNumRule();
     195           0 :         if(pRule)
     196           0 :             pRule->SetFeatureFlag( NUM_NO_NUMBERS, sal_False );
     197             :     }
     198             : 
     199           0 :     return pOutputSet;
     200             : }
     201             : 
     202           0 : } // end of namespace sd
     203             : 
     204             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10