LCOV - code coverage report
Current view: top level - sc/source/ui/styleui - styledlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 64 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                 :            : #undef SC_DLLIMPLEMENTATION
      31                 :            : 
      32                 :            : 
      33                 :            : 
      34                 :            : //------------------------------------------------------------------
      35                 :            : 
      36                 :            : #include "scitems.hxx"
      37                 :            : #include <svx/numinf.hxx>
      38                 :            : #include <sfx2/objsh.hxx>
      39                 :            : #include <svl/style.hxx>
      40                 :            : #include <svl/cjkoptions.hxx>
      41                 :            : 
      42                 :            : #include "styledlg.hxx"
      43                 :            : #include "tabpages.hxx"     // Zellvorlagen
      44                 :            : #include "tphf.hxx"         // Seitenvorlage: Kopf-/Fusszeilen
      45                 :            : #include "tptable.hxx"      // Seitenvorlage: Tabelle
      46                 :            : #include "scresid.hxx"
      47                 :            : #include "sc.hrc"
      48                 :            : #include "styledlg.hrc"
      49                 :            : #include <svx/svxdlg.hxx>
      50                 :            : #include <svx/svxids.hrc>
      51                 :            : #include <svx/dialogs.hrc>
      52                 :            : #include <svl/intitem.hxx>
      53                 :            : #include <editeng/flstitem.hxx>
      54                 :            : #include <svl/aeitem.hxx>
      55                 :            : #include <svx/flagsdef.hxx>
      56                 :            : //==================================================================
      57                 :            : 
      58                 :          0 : ScStyleDlg::ScStyleDlg( Window*             pParent,
      59                 :            :                         SfxStyleSheetBase&  rStyleBase,
      60                 :            :                         sal_uInt16              nRscId )
      61                 :            : 
      62                 :            :     :   SfxStyleDialog  ( pParent,
      63                 :            :                           ScResId( nRscId ),
      64                 :            :                           rStyleBase,
      65                 :            :                           false ),
      66                 :          0 :         nDlgRsc         ( nRscId )
      67                 :            : {
      68                 :          0 :     SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
      69                 :            :     OSL_ENSURE(pFact, "Dialogdiet fail!");
      70                 :          0 :     switch ( nRscId )
      71                 :            :     {
      72                 :            :         case RID_SCDLG_STYLES_PAR:  // Zellformatvorlagen
      73                 :            :             {
      74                 :          0 :                 SvtCJKOptions aCJKOptions;
      75                 :            :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), "GetTabPageCreatorFunc fail!");
      76                 :            :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_NUMBERFORMAT ), "GetTabPageRangesFunc fail!");
      77                 :          0 :                 AddTabPage( TP_NUMBER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_NUMBERFORMAT ) );
      78                 :            :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");
      79                 :            :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageRangesFunc fail!");
      80                 :          0 :                 AddTabPage( TP_FONT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ) );
      81                 :            :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");
      82                 :            :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageRangesFunc fail!");
      83                 :          0 :                 AddTabPage( TP_FONTEFF, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ) );
      84                 :            :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), "GetTabPageCreatorFunc fail!");
      85                 :            :                 OSL_ENSURE( pFact->GetTabPageRangesFunc( RID_SVXPAGE_ALIGNMENT ), "GetTabPageRangesFunc fail!");
      86                 :          0 :                 AddTabPage( TP_ALIGNMENT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_ALIGNMENT ) );
      87                 :          0 :                 if ( aCJKOptions.IsAsianTypographyEnabled() )
      88                 :            :                 {
      89                 :            :                     OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");
      90                 :            :                     OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageRangesFunc fail!");
      91                 :          0 :                     AddTabPage( TP_ASIAN,   pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN),       pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN) );
      92                 :            :                 }
      93                 :            :                 else
      94                 :          0 :                     RemoveTabPage( TP_ASIAN );
      95                 :            :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
      96                 :            :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
      97                 :          0 :                 AddTabPage( TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
      98                 :            :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
      99                 :            :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
     100                 :          0 :                 AddTabPage( TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
     101                 :          0 :                 AddTabPage( TP_PROTECTION, &ScTabPageProtection::Create,    &ScTabPageProtection::GetRanges );
     102                 :            :             }
     103                 :          0 :             break;
     104                 :            : 
     105                 :            :         case RID_SCDLG_STYLES_PAGE: // Seitenvorlagen
     106                 :            :             {
     107                 :            :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), "GetTabPageCreatorFunc fail!");
     108                 :            :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ), "GetTabPageRangesFunc fail!");
     109                 :          0 :                 AddTabPage( TP_PAGE_STD, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ) );
     110                 :            :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
     111                 :            :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
     112                 :          0 :                 AddTabPage( TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
     113                 :            :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
     114                 :            :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
     115                 :          0 :                 AddTabPage( TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
     116                 :          0 :                 AddTabPage( TP_PAGE_HEADER, &ScHeaderPage::Create,      &ScHeaderPage::GetRanges );
     117                 :          0 :                 AddTabPage( TP_PAGE_FOOTER, &ScFooterPage::Create,      &ScFooterPage::GetRanges );
     118                 :          0 :                 AddTabPage( TP_TABLE, &ScTablePage::Create,     &ScTablePage::GetRanges );
     119                 :            :             }
     120                 :          0 :             break;
     121                 :            : 
     122                 :            :         default:
     123                 :            :             OSL_FAIL( "Family not supported" );
     124                 :            :     }
     125                 :            : 
     126                 :            :     //--------------------------------------------------------------------
     127                 :          0 :     FreeResource();
     128                 :          0 : }
     129                 :            : 
     130                 :            : // -----------------------------------------------------------------------
     131                 :            : 
     132                 :          0 : ScStyleDlg::~ScStyleDlg()
     133                 :            : {
     134                 :          0 : }
     135                 :            : 
     136                 :            : // -----------------------------------------------------------------------
     137                 :            : 
     138                 :          0 : void ScStyleDlg::PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage )
     139                 :            : {
     140                 :          0 :     if ( nDlgRsc == RID_SCDLG_STYLES_PAR )
     141                 :            :     {
     142                 :          0 :         SfxObjectShell* pDocSh = SfxObjectShell::Current();
     143                 :          0 :         SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
     144                 :          0 :         switch ( nPageId )
     145                 :            :         {
     146                 :            :             case TP_NUMBER:
     147                 :            :                 {
     148                 :            :                     const SfxPoolItem* pInfoItem
     149                 :          0 :                         = pDocSh->GetItem( SID_ATTR_NUMBERFORMAT_INFO );
     150                 :            : 
     151                 :            :                     OSL_ENSURE( pInfoItem, "NumberInfoItem nicht gefunden!" );
     152                 :            : 
     153                 :          0 :                     aSet.Put (SvxNumberInfoItem( (const SvxNumberInfoItem&)*pInfoItem ) );
     154                 :          0 :                     rTabPage.PageCreated(aSet);
     155                 :            :                 }
     156                 :          0 :                 break;
     157                 :            : 
     158                 :            :             case TP_FONT:
     159                 :            :                 {
     160                 :            :                     const SfxPoolItem* pInfoItem
     161                 :          0 :                         = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
     162                 :            : 
     163                 :            :                     OSL_ENSURE( pInfoItem, "FontListItem nicht gefunden!" );
     164                 :            : 
     165                 :          0 :                     aSet.Put (SvxFontListItem(((const SvxFontListItem&)*pInfoItem).GetFontList(), SID_ATTR_CHAR_FONTLIST));
     166                 :          0 :                     rTabPage.PageCreated(aSet);
     167                 :            :                 }
     168                 :          0 :                 break;
     169                 :            : 
     170                 :            :             default:
     171                 :          0 :             break;
     172                 :          0 :         }
     173                 :            :     }
     174                 :          0 :     else if ( nDlgRsc == RID_SCDLG_STYLES_PAGE )
     175                 :            :     {
     176                 :          0 :         SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
     177                 :          0 :         switch ( nPageId )
     178                 :            :         {
     179                 :            :             case TP_PAGE_STD:
     180                 :          0 :                 aSet.Put (SfxAllEnumItem((const sal_uInt16)SID_ENUM_PAGE_MODE, SVX_PAGE_MODE_CENTER));
     181                 :          0 :                 rTabPage.PageCreated(aSet);
     182                 :          0 :                 break;
     183                 :            : 
     184                 :            :             case TP_PAGE_HEADER:
     185                 :            :             case TP_PAGE_FOOTER:
     186                 :          0 :                 ((ScHFPage&)rTabPage).SetStyleDlg( this );
     187                 :          0 :                 ((ScHFPage&)rTabPage).SetPageStyle( GetStyleSheet().GetName() );
     188                 :          0 :                 ((ScHFPage&)rTabPage).DisableDeleteQueryBox();
     189                 :          0 :                 break;
     190                 :            :             case TP_BACKGROUND:
     191                 :          0 :                     if( nDlgRsc == RID_SCDLG_STYLES_PAGE)
     192                 :            :                     {
     193                 :          0 :                         aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_SHOW_SELECTOR));
     194                 :          0 :                         rTabPage.PageCreated(aSet);
     195                 :            :                     }
     196                 :          0 :                 break;
     197                 :            : 
     198                 :            :             default:
     199                 :          0 :                 break;
     200                 :          0 :         }
     201                 :            :     }
     202                 :          0 : }
     203                 :            : 
     204                 :            : 
     205                 :            : // -----------------------------------------------------------------------
     206                 :            : 
     207                 :          0 : const SfxItemSet* ScStyleDlg::GetRefreshedSet()
     208                 :            : {
     209                 :          0 :     SfxItemSet* pItemSet = GetInputSetImpl();
     210                 :          0 :     pItemSet->ClearItem();
     211                 :          0 :     pItemSet->SetParent( GetStyleSheet().GetItemSet().GetParent() );
     212                 :          0 :     return pItemSet;
     213                 :            : }
     214                 :            : 
     215                 :            : 
     216                 :            : 
     217                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10