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

Generated by: LCOV version 1.10