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

Generated by: LCOV version 1.10