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

Generated by: LCOV version 1.10