LCOV - code coverage report
Current view: top level - sd/source/ui/dlg - dlgolbul.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 80 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 8 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 "bulmaper.hxx"
      42             : #include "DrawDocShell.hxx"
      43             : #include <svl/aeitem.hxx>
      44             : 
      45             : namespace sd {
      46             : 
      47             : /**
      48             :  * Constructor of tab dialog: append pages to the dialog
      49             :  */
      50           0 : OutlineBulletDlg::OutlineBulletDlg(
      51             :     vcl::Window* pParent,
      52             :     const SfxItemSet* pAttr,
      53             :     ::sd::View* pView )
      54             :     : SfxTabDialog( pParent, "BulletsAndNumberingDialog",
      55             :         "modules/sdraw/ui/bulletsandnumbering.ui")
      56             :     , aInputSet( *pAttr )
      57             :     , bTitle(false)
      58           0 :     , pSdView(pView)
      59             : {
      60           0 :     aInputSet.MergeRange( SID_PARAM_NUM_PRESET, SID_PARAM_CUR_NUM_LEVEL );
      61           0 :     aInputSet.Put( *pAttr );
      62             : 
      63           0 :     pOutputSet = new SfxItemSet( *pAttr );
      64           0 :     pOutputSet->ClearItem();
      65             : 
      66           0 :     bool bOutliner = false;
      67             : 
      68             :     // special treatment if a title object is selected
      69           0 :     if( pView )
      70             :     {
      71           0 :         const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
      72           0 :         const size_t nCount = rMarkList.GetMarkCount();
      73           0 :         for(size_t nNum = 0; nNum < nCount; ++nNum)
      74             :         {
      75           0 :             SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj();
      76           0 :             if( pObj->GetObjInventor() == SdrInventor )
      77             :             {
      78             : 
      79           0 :                 switch(pObj->GetObjIdentifier())
      80             :                 {
      81             :                 case OBJ_TITLETEXT:
      82           0 :                     bTitle = true;
      83           0 :                     break;
      84             :                 case OBJ_OUTLINETEXT:
      85           0 :                     bOutliner = true;
      86           0 :                     break;
      87             :                 }
      88             :             }
      89             :         }
      90             :     }
      91             : 
      92           0 :     if( SfxItemState::SET != aInputSet.GetItemState(EE_PARA_NUMBULLET))
      93             :     {
      94           0 :         const SvxNumBulletItem *pItem = NULL;
      95           0 :         if(bOutliner)
      96             :         {
      97           0 :             SfxStyleSheetBasePool* pSSPool = pView->GetDocSh()->GetStyleSheetPool();
      98           0 :             OUString aStyleName(SD_RESSTR(STR_LAYOUT_OUTLINE) + " 1");
      99           0 :             SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO);
     100           0 :             if( pFirstStyleSheet )
     101           0 :                 pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, false, reinterpret_cast<const SfxPoolItem**>(&pItem));
     102             :         }
     103             : 
     104           0 :         if( pItem == NULL )
     105           0 :             pItem = static_cast<const SvxNumBulletItem*>( aInputSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET) );
     106             : 
     107             :         DBG_ASSERT( pItem, "No EE_PARA_NUMBULLET in Pool! [CL]" );
     108             : 
     109           0 :         aInputSet.Put(*pItem, EE_PARA_NUMBULLET);
     110             :     }
     111             : 
     112           0 :     if(bTitle && aInputSet.GetItemState(EE_PARA_NUMBULLET,true) == SfxItemState::SET )
     113             :     {
     114           0 :         const SvxNumBulletItem* pItem = static_cast<const SvxNumBulletItem*>( aInputSet.GetItem(EE_PARA_NUMBULLET,true) );
     115           0 :         SvxNumRule* pRule = pItem->GetNumRule();
     116           0 :         if(pRule)
     117             :         {
     118           0 :             SvxNumRule aNewRule( *pRule );
     119           0 :             aNewRule.SetFeatureFlag( SvxNumRuleFlags::NO_NUMBERS, true );
     120             : 
     121           0 :             SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET );
     122           0 :             aInputSet.Put(aNewItem);
     123             :         }
     124             :     }
     125             : 
     126           0 :     SetInputSet( &aInputSet );
     127             : 
     128           0 :     if(!bTitle)
     129           0 :         AddTabPage("singlenum", RID_SVXPAGE_PICK_SINGLE_NUM);
     130             :     else
     131           0 :         RemoveTabPage("singlenum");
     132             : 
     133           0 :     AddTabPage("bullets", RID_SVXPAGE_PICK_BULLET);
     134           0 :     AddTabPage("graphics", RID_SVXPAGE_PICK_BMP);
     135           0 :     m_nOptionsId = AddTabPage("customize", RID_SVXPAGE_NUM_OPTIONS);
     136           0 :     m_nPositionId = AddTabPage("position", RID_SVXPAGE_NUM_POSITION);
     137           0 : }
     138             : 
     139           0 : OutlineBulletDlg::~OutlineBulletDlg()
     140             : {
     141           0 :     disposeOnce();
     142           0 : }
     143             : 
     144           0 : void OutlineBulletDlg::dispose()
     145             : {
     146           0 :     delete pOutputSet;
     147           0 :     SfxTabDialog::dispose();
     148           0 : }
     149             : 
     150           0 : void OutlineBulletDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
     151             : {
     152           0 :     if (nId == m_nOptionsId)
     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 :     else if (nId == m_nPositionId)
     163             :     {
     164           0 :         if( pSdView )
     165             :         {
     166           0 :             FieldUnit eMetric = pSdView->GetDoc().GetUIUnit();
     167           0 :             SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
     168           0 :             aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM,(sal_uInt16)eMetric));
     169           0 :             rPage.PageCreated(aSet);
     170             :         }
     171             :     }
     172           0 : }
     173             : 
     174           0 : const SfxItemSet* OutlineBulletDlg::GetOutputItemSet() const
     175             : {
     176           0 :     SfxItemSet aSet( *SfxTabDialog::GetOutputItemSet() );
     177           0 :     pOutputSet->Put( aSet );
     178             : 
     179           0 :     const SfxPoolItem *pItem = NULL;
     180           0 :     if( SfxItemState::SET == pOutputSet->GetItemState(pOutputSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE), false, &pItem ))
     181             :     {
     182           0 :         SdBulletMapper::MapFontsInNumRule( *static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule(), *pOutputSet );
     183             : 
     184             : // #i35937 - removed EE_PARA_BULLETSTATE setting
     185             :     }
     186             : 
     187           0 :     if(bTitle && pOutputSet->GetItemState(EE_PARA_NUMBULLET,true) == SfxItemState::SET )
     188             :     {
     189           0 :         const SvxNumBulletItem* pBulletItem = static_cast<const SvxNumBulletItem*>(pOutputSet->GetItem(EE_PARA_NUMBULLET,true));
     190           0 :         SvxNumRule* pRule = pBulletItem->GetNumRule();
     191           0 :         if(pRule)
     192           0 :             pRule->SetFeatureFlag( SvxNumRuleFlags::NO_NUMBERS, false );
     193             :     }
     194             : 
     195           0 :     return pOutputSet;
     196             : }
     197             : 
     198           0 : } // end of namespace sd
     199             : 
     200             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11