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

Generated by: LCOV version 1.10