LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sd/source/ui/dlg - prltempl.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 151 0.0 %
Date: 2013-07-09 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 <editeng/outliner.hxx>
      21             : 
      22             : #include <svx/dialogs.hrc>
      23             : #include <editeng/flstitem.hxx>
      24             : #include <svx/drawitem.hxx>
      25             : #include <svl/style.hxx>
      26             : #include <svx/tabline.hxx>
      27             : #include <editeng/bulletitem.hxx>
      28             : #include <editeng/eeitem.hxx>
      29             : #include <editeng/brushitem.hxx>
      30             : #include <vcl/graph.hxx>
      31             : #include <editeng/lrspitem.hxx>
      32             : #include <editeng/numitem.hxx>
      33             : #include <svl/cjkoptions.hxx>
      34             : 
      35             : #include "DrawDocShell.hxx"
      36             : #include "glob.hrc"
      37             : #include "sdresid.hxx"
      38             : #include "prltempl.hxx"
      39             : #include "prltempl.hrc"
      40             : #include "bulmaper.hxx"
      41             : #include <svl/intitem.hxx>
      42             : #include <svx/svxgrahicitem.hxx>
      43             : #include <svx/flagsdef.hxx>
      44             : #include "drawdoc.hxx"
      45             : #define IS_OUTLINE(x) (x >= PO_OUTLINE_1 && x <= PO_OUTLINE_9)
      46             : 
      47             : /**
      48             :  * Constructor of Tab dialog: appends pages to the dialog
      49             :  */
      50           0 : SdPresLayoutTemplateDlg::SdPresLayoutTemplateDlg( SfxObjectShell* pDocSh,
      51             :                                 Window* pParent,
      52             :                                 SdResId DlgId,
      53             :                                 SfxStyleSheetBase& rStyleBase,
      54             :                                 PresentationObjects _ePO,
      55             :                                 SfxStyleSheetBasePool* pSSPool ) :
      56             :         SfxTabDialog        ( pParent, DlgId ),
      57             :         mpDocShell          ( pDocSh ),
      58             :         ePO                 ( _ePO ),
      59           0 :         aInputSet           ( *rStyleBase.GetItemSet().GetPool(), SID_PARAM_NUM_PRESET, SID_PARAM_CUR_NUM_LEVEL ),
      60             :         pOutSet             ( NULL ),
      61           0 :         pOrgSet             ( &rStyleBase.GetItemSet() )
      62             : {
      63           0 :     if( IS_OUTLINE(ePO))
      64             :     {
      65             :         // Unfortunately, the Itemsets of our style sheets are not discreet..
      66           0 :         const sal_uInt16* pPtr = pOrgSet->GetRanges();
      67             :         sal_uInt16 p1, p2;
      68           0 :         while( *pPtr )
      69             :         {
      70           0 :             p1 = pPtr[0];
      71           0 :             p2 = pPtr[1];
      72             : 
      73             :             // first, we make it discreet
      74           0 :             while(pPtr[2] && (pPtr[2] - p2 == 1))
      75             :             {
      76           0 :                 p2 = pPtr[3];
      77           0 :                 pPtr += 2;
      78             :             }
      79           0 :             aInputSet.MergeRange( p1, p2 );
      80           0 :             pPtr += 2;
      81             :         }
      82             : 
      83           0 :         aInputSet.Put( rStyleBase.GetItemSet() );
      84             : 
      85             :         // need parent-relationship
      86           0 :         const SfxItemSet* pParentItemSet = rStyleBase.GetItemSet().GetParent();
      87           0 :         if( pParentItemSet )
      88           0 :             aInputSet.SetParent( pParentItemSet );
      89             : 
      90           0 :         pOutSet = new SfxItemSet( rStyleBase.GetItemSet() );
      91           0 :         pOutSet->ClearItem();
      92             : 
      93           0 :         const SfxPoolItem *pItem = NULL;
      94             : 
      95             :         // If there is no bullet item in this stylesheet, we get it
      96             :         // from 'Outline 1' style sheet.
      97           0 :         if( SFX_ITEM_SET != aInputSet.GetItemState(EE_PARA_NUMBULLET, sal_False, &pItem ))
      98             :         {
      99           0 :             String aStyleName((SdResId(STR_PSEUDOSHEET_OUTLINE)));
     100           0 :             aStyleName.AppendAscii( " 1" );
     101           0 :             SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO);
     102             : 
     103           0 :             if(pFirstStyleSheet)
     104           0 :                 if( SFX_ITEM_SET == pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, sal_False, &pItem) )
     105           0 :                     aInputSet.Put( *pItem );
     106             :         }
     107             : 
     108             :         // preselect selected layer in dialog
     109           0 :         aInputSet.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, 1<<GetOutlineLevel()));
     110             : 
     111           0 :         SetInputSet( &aInputSet );
     112             :     }
     113             :     else
     114           0 :         SetInputSet( pOrgSet );
     115             : 
     116           0 :     FreeResource();
     117             : 
     118             :     SvxColorListItem aColorListItem(*( (const SvxColorListItem*)
     119           0 :         ( mpDocShell->GetItem( SID_COLOR_TABLE ) ) ) );
     120             :     SvxGradientListItem aGradientListItem(*( (const SvxGradientListItem*)
     121           0 :         ( mpDocShell->GetItem( SID_GRADIENT_LIST ) ) ) );
     122             :     SvxBitmapListItem aBitmapListItem(*( (const SvxBitmapListItem*)
     123           0 :         ( mpDocShell->GetItem( SID_BITMAP_LIST ) ) ) );
     124             :     SvxHatchListItem aHatchListItem(*( (const SvxHatchListItem*)
     125           0 :         ( mpDocShell->GetItem( SID_HATCH_LIST ) ) ) );
     126             :     SvxDashListItem aDashListItem(*( (const SvxDashListItem*)
     127           0 :         ( mpDocShell->GetItem( SID_DASH_LIST ) ) ) );
     128             :     SvxLineEndListItem aLineEndListItem(*( (const SvxLineEndListItem*)
     129           0 :         ( mpDocShell->GetItem( SID_LINEEND_LIST ) ) ) );
     130             : 
     131           0 :     pColorTab = aColorListItem.GetColorList();
     132           0 :     pDashList = aDashListItem.GetDashList();
     133           0 :     pLineEndList = aLineEndListItem.GetLineEndList();
     134           0 :     pGradientList = aGradientListItem.GetGradientList();
     135           0 :     pHatchingList = aHatchListItem.GetHatchList();
     136           0 :     pBitmapList = aBitmapListItem.GetBitmapList();
     137             : 
     138           0 :     switch( DlgId.GetId() )
     139             :     {
     140             :         case TAB_PRES_LAYOUT_TEMPLATE:
     141             :         {
     142           0 :             AddTabPage( RID_SVXPAGE_LINE);
     143           0 :             AddTabPage( RID_SVXPAGE_AREA);
     144           0 :             AddTabPage( RID_SVXPAGE_SHADOW);
     145           0 :             AddTabPage( RID_SVXPAGE_TRANSPARENCE);
     146           0 :             AddTabPage( RID_SVXPAGE_CHAR_NAME );
     147           0 :             AddTabPage( RID_SVXPAGE_CHAR_EFFECTS );
     148           0 :             AddTabPage( RID_SVXPAGE_STD_PARAGRAPH );
     149           0 :             AddTabPage( RID_SVXPAGE_TEXTATTR );
     150           0 :             AddTabPage( RID_SVXPAGE_PICK_BULLET );
     151           0 :             AddTabPage( RID_SVXPAGE_PICK_SINGLE_NUM );
     152           0 :             AddTabPage( RID_SVXPAGE_PICK_BMP );
     153           0 :             AddTabPage( RID_SVXPAGE_NUM_OPTIONS );
     154           0 :             AddTabPage( RID_SVXPAGE_TABULATOR );
     155             :         }
     156           0 :         break;
     157             : 
     158             :         case TAB_PRES_LAYOUT_TEMPLATE_BACKGROUND:        // background
     159           0 :             AddTabPage( RID_SVXPAGE_AREA);
     160           0 :         break;
     161             :     }
     162             : 
     163             :     // the tabpages Alignment, Tabs and Asian Typography are very
     164             :     // useful, except for the background style
     165           0 :     if( DlgId.GetId() != TAB_PRES_LAYOUT_TEMPLATE_BACKGROUND )
     166             :     {
     167           0 :         SvtCJKOptions aCJKOptions;
     168           0 :         if( aCJKOptions.IsAsianTypographyEnabled() )
     169           0 :             AddTabPage( RID_SVXPAGE_PARA_ASIAN );
     170             :         else
     171           0 :             RemoveTabPage( RID_SVXPAGE_PARA_ASIAN );
     172             : 
     173           0 :         AddTabPage( RID_SVXPAGE_ALIGN_PARAGRAPH );
     174             :     }
     175             : 
     176             :     // set title and add corresponding pages to dialog
     177           0 :     OUString aTitle;
     178             : 
     179           0 :     switch( ePO )
     180             :     {
     181             :         case PO_TITLE:
     182           0 :             aTitle = OUString(SdResId( STR_PSEUDOSHEET_TITLE ));
     183           0 :         break;
     184             : 
     185             :         case PO_SUBTITLE:
     186           0 :             aTitle = OUString(SdResId( STR_PSEUDOSHEET_SUBTITLE ));
     187           0 :         break;
     188             : 
     189             :         case PO_BACKGROUND:
     190           0 :             aTitle = OUString(SdResId( STR_PSEUDOSHEET_BACKGROUND ));
     191           0 :         break;
     192             : 
     193             :         case PO_BACKGROUNDOBJECTS:
     194           0 :             aTitle = OUString(SdResId( STR_PSEUDOSHEET_BACKGROUNDOBJECTS ));
     195           0 :         break;
     196             : 
     197             :         case PO_OUTLINE_1:
     198             :         case PO_OUTLINE_2:
     199             :         case PO_OUTLINE_3:
     200             :         case PO_OUTLINE_4:
     201             :         case PO_OUTLINE_5:
     202             :         case PO_OUTLINE_6:
     203             :         case PO_OUTLINE_7:
     204             :         case PO_OUTLINE_8:
     205             :         case PO_OUTLINE_9:
     206           0 :             aTitle = OUString(SdResId( STR_PSEUDOSHEET_OUTLINE )) + " " +
     207           0 :                 OUString::valueOf( static_cast<sal_Int32>( ePO - PO_OUTLINE_1 + 1 ) );
     208           0 :         break;
     209             : 
     210             :         case PO_NOTES:
     211           0 :             aTitle = OUString(SdResId( STR_PSEUDOSHEET_NOTES ));
     212           0 :         break;
     213             :     }
     214           0 :     SetText( aTitle );
     215             : 
     216           0 :     nDlgType = 1; // template dialog
     217           0 :     nPageType = 0;
     218           0 :     nPos = 0;
     219             : 
     220           0 :     nColorTableState = CT_NONE;
     221           0 :     nBitmapListState = CT_NONE;
     222           0 :     nGradientListState = CT_NONE;
     223           0 :     nHatchingListState = CT_NONE;
     224           0 : }
     225             : 
     226             : // -----------------------------------------------------------------------
     227             : 
     228           0 : SdPresLayoutTemplateDlg::~SdPresLayoutTemplateDlg()
     229             : {
     230           0 :     delete pOutSet;
     231           0 : }
     232             : 
     233             : // -----------------------------------------------------------------------
     234             : 
     235           0 : void SdPresLayoutTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
     236           0 : {   SfxAllItemSet aSet(*(aInputSet.GetPool()));
     237           0 :     switch( nId )
     238             :     {
     239             :         case RID_SVXPAGE_LINE:
     240             :         {
     241           0 :             aSet.Put (SvxColorListItem(pColorTab,SID_COLOR_TABLE));
     242           0 :             aSet.Put (SvxDashListItem(pDashList,SID_DASH_LIST));
     243           0 :             aSet.Put (SvxLineEndListItem(pLineEndList,SID_LINEEND_LIST));
     244           0 :             aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
     245             : 
     246           0 :             rPage.PageCreated(aSet);
     247             :         }
     248           0 :         break;
     249             : 
     250             :         case RID_SVXPAGE_AREA:
     251             :         {
     252           0 :             aSet.Put (SvxColorListItem(pColorTab,SID_COLOR_TABLE));
     253           0 :             aSet.Put (SvxGradientListItem(pGradientList,SID_GRADIENT_LIST));
     254           0 :             aSet.Put (SvxHatchListItem(pHatchingList,SID_HATCH_LIST));
     255           0 :             aSet.Put (SvxBitmapListItem(pBitmapList,SID_BITMAP_LIST));
     256           0 :             aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
     257           0 :             aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
     258           0 :             aSet.Put (SfxUInt16Item(SID_TABPAGE_POS,nPos));
     259           0 :             rPage.PageCreated(aSet);
     260             : 
     261             :         }
     262           0 :         break;
     263             : 
     264             :         case RID_SVXPAGE_SHADOW:
     265           0 :                 aSet.Put (SvxColorListItem(pColorTab,SID_COLOR_TABLE));
     266           0 :                 aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
     267           0 :                 aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
     268           0 :                 rPage.PageCreated(aSet);
     269           0 :             break;
     270             : 
     271             :         case RID_SVXPAGE_TRANSPARENCE:
     272           0 :             aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
     273           0 :             aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
     274           0 :             rPage.PageCreated(aSet);
     275           0 :         break;
     276             : 
     277             :         case RID_SVXPAGE_CHAR_NAME:
     278             :         {
     279             :             SvxFontListItem aItem(*( (const SvxFontListItem*)
     280           0 :                 ( mpDocShell->GetItem( SID_ATTR_CHAR_FONTLIST) ) ) );
     281             : 
     282           0 :             aSet.Put (SvxFontListItem( aItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
     283           0 :             rPage.PageCreated(aSet);
     284             :         }
     285           0 :         break;
     286             : 
     287             :         case RID_SVXPAGE_CHAR_EFFECTS:
     288           0 :             aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP));
     289           0 :             rPage.PageCreated(aSet);
     290           0 :         break;
     291             : 
     292             :         case RID_SVXPAGE_STD_PARAGRAPH:
     293           0 :         break;
     294           0 :     }
     295           0 : }
     296             : 
     297           0 : const SfxItemSet* SdPresLayoutTemplateDlg::GetOutputItemSet() const
     298             : {
     299           0 :     if( pOutSet )
     300             :     {
     301           0 :         pOutSet->Put( *SfxTabDialog::GetOutputItemSet() );
     302             : 
     303           0 :         const SvxNumBulletItem *pSvxNumBulletItem = NULL;
     304           0 :         if( SFX_ITEM_SET == pOutSet->GetItemState(EE_PARA_NUMBULLET, sal_False, (const SfxPoolItem**)&pSvxNumBulletItem ))
     305           0 :             SdBulletMapper::MapFontsInNumRule( *pSvxNumBulletItem->GetNumRule(), *pOutSet );
     306           0 :         return pOutSet;
     307             :     }
     308             :     else
     309           0 :         return SfxTabDialog::GetOutputItemSet();
     310             : }
     311             : 
     312             : // ---------------------------------------------------------------------
     313             : // ---------------------------------------------------------------------
     314           0 : sal_uInt16 SdPresLayoutTemplateDlg::GetOutlineLevel() const
     315             : {
     316           0 :     switch( ePO )
     317             :     {
     318           0 :     case PO_OUTLINE_1: return 0;
     319           0 :     case PO_OUTLINE_2: return 1;
     320           0 :     case PO_OUTLINE_3: return 2;
     321           0 :     case PO_OUTLINE_4: return 3;
     322           0 :     case PO_OUTLINE_5: return 4;
     323           0 :     case PO_OUTLINE_6: return 5;
     324           0 :     case PO_OUTLINE_7: return 6;
     325           0 :     case PO_OUTLINE_8: return 7;
     326           0 :     case PO_OUTLINE_9: return 8;
     327             :     default:
     328             :         DBG_ASSERT( sal_False, "Wrong Po! [CL]");
     329             :     }
     330           0 :     return 0;
     331           0 : }
     332             : 
     333             : 
     334             : 
     335             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10