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

Generated by: LCOV version 1.10