LCOV - code coverage report
Current view: top level - sc/source/ui/styleui - styledlg.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 57 0.0 %
Date: 2014-04-14 Functions: 0 5 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             : #include "scitems.hxx"
      26             : #include <svx/numinf.hxx>
      27             : #include <sfx2/objsh.hxx>
      28             : #include <svl/style.hxx>
      29             : #include <svl/cjkoptions.hxx>
      30             : 
      31             : #include "styledlg.hxx"
      32             : #include "tabpages.hxx"
      33             : #include "tphf.hxx"
      34             : #include "tptable.hxx"
      35             : #include "scresid.hxx"
      36             : #include "sc.hrc"
      37             : #include <svx/svxdlg.hxx>
      38             : #include <svx/svxids.hrc>
      39             : #include <svx/dialogs.hrc>
      40             : #include <svl/intitem.hxx>
      41             : #include <editeng/flstitem.hxx>
      42             : #include <svl/aeitem.hxx>
      43             : #include <svx/flagsdef.hxx>
      44             : 
      45             : 
      46           0 : ScStyleDlg::ScStyleDlg( Window*             pParent,
      47             :                         SfxStyleSheetBase&  rStyleBase,
      48             :                         sal_uInt16              nRscId )
      49             : 
      50             :     : SfxStyleDialog  ( pParent,
      51             :                         nRscId == RID_SCDLG_STYLES_PAR ?
      52             :                           OString("ParaTemplateDialog") :
      53             :                           OString("PageTemplateDialog"),
      54             :                         nRscId == RID_SCDLG_STYLES_PAR ?
      55             :                           OUString("modules/scalc/ui/paratemplatedialog.ui") :
      56             :                           OUString("modules/scalc/ui/pagetemplatedialog.ui"),
      57             :                         rStyleBase )
      58             :     , nDlgRsc         ( nRscId )
      59             :     , m_nNumberId(0)
      60             :     , m_nFontId(0)
      61             :     , m_nFontEffectId(0)
      62             :     , m_nAlignmentId(0)
      63             :     , m_nAsianId(0)
      64             :     , m_nBorderId(0)
      65             :     , m_nBackgroundId(0)
      66             :     , m_nProtectId(0)
      67             :     , m_nPageId(0)
      68             :     , m_nHeaderId(0)
      69             :     , m_nFooterId(0)
      70           0 :     , m_nSheetId(0)
      71             : {
      72           0 :     SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
      73             :     OSL_ENSURE(pFact, "Dialogdiet fail!");
      74           0 :     switch ( nRscId )
      75             :     {
      76             :         case RID_SCDLG_STYLES_PAR:  // Zellformatvorlagen
      77             :             {
      78           0 :                 SvtCJKOptions aCJKOptions;
      79             :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), "GetTabPageCreatorFunc fail!");
      80             :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_NUMBERFORMAT ), "GetTabPageRangesFunc fail!");
      81           0 :                 m_nNumberId = AddTabPage("numbers", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_NUMBERFORMAT ));
      82             :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");
      83             :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageRangesFunc fail!");
      84           0 :                 m_nFontId = AddTabPage("font", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ));
      85             :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");
      86             :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageRangesFunc fail!");
      87           0 :                 m_nFontEffectId = AddTabPage("fonteffects", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ));
      88             :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), "GetTabPageCreatorFunc fail!");
      89             :                 OSL_ENSURE( pFact->GetTabPageRangesFunc( RID_SVXPAGE_ALIGNMENT ), "GetTabPageRangesFunc fail!");
      90           0 :                 m_nAlignmentId = AddTabPage("alignment", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_ALIGNMENT ));
      91           0 :                 if ( aCJKOptions.IsAsianTypographyEnabled() )
      92             :                 {
      93             :                     OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");
      94             :                     OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageRangesFunc fail!");
      95           0 :                     m_nAsianId = AddTabPage("asiantypo", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN),       pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN));
      96             :                 }
      97             :                 else
      98           0 :                     RemoveTabPage("asiantypo");
      99             :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
     100             :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
     101           0 :                 m_nBorderId = AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ));
     102             :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
     103             :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
     104           0 :                 m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ));
     105           0 :                 m_nProtectId = AddTabPage("protection", &ScTabPageProtection::Create,    &ScTabPageProtection::GetRanges);
     106             :             }
     107           0 :             break;
     108             : 
     109             :         case RID_SCDLG_STYLES_PAGE: // Seitenvorlagen
     110             :             {
     111             :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), "GetTabPageCreatorFunc fail!");
     112             :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ), "GetTabPageRangesFunc fail!");
     113           0 :                 m_nPageId = AddTabPage("page", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ) );
     114             :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
     115             :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
     116           0 :                 m_nBorderId = AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
     117             :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
     118             :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
     119           0 :                 m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
     120           0 :                 m_nHeaderId = AddTabPage("header", &ScHeaderPage::Create,      &ScHeaderPage::GetRanges );
     121           0 :                 m_nFooterId = AddTabPage("footer", &ScFooterPage::Create,      &ScFooterPage::GetRanges );
     122           0 :                 m_nSheetId = AddTabPage("sheet", &ScTablePage::Create,     &ScTablePage::GetRanges );
     123             :             }
     124           0 :             break;
     125             : 
     126             :         default:
     127             :             OSL_FAIL( "Family not supported" );
     128             :     }
     129           0 : }
     130             : 
     131           0 : void ScStyleDlg::PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage )
     132             : {
     133           0 :     if ( nDlgRsc == RID_SCDLG_STYLES_PAR )
     134             :     {
     135           0 :         SfxObjectShell* pDocSh = SfxObjectShell::Current();
     136           0 :         SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
     137           0 :         if (nPageId == m_nNumberId)
     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 :         else if (nPageId == m_nFontId)
     148             :         {
     149             :             const SfxPoolItem* pInfoItem
     150           0 :                 = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
     151             : 
     152             :             OSL_ENSURE( pInfoItem, "FontListItem nicht gefunden!" );
     153             : 
     154           0 :             aSet.Put (SvxFontListItem(((const SvxFontListItem&)*pInfoItem).GetFontList(), SID_ATTR_CHAR_FONTLIST));
     155           0 :             rTabPage.PageCreated(aSet);
     156           0 :         }
     157             :     }
     158           0 :     else if ( nDlgRsc == RID_SCDLG_STYLES_PAGE )
     159             :     {
     160           0 :         SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
     161           0 :         if (nPageId == m_nPageId)
     162             :         {
     163           0 :             aSet.Put (SfxAllEnumItem((const sal_uInt16)SID_ENUM_PAGE_MODE, SVX_PAGE_MODE_CENTER));
     164           0 :             rTabPage.PageCreated(aSet);
     165             :         }
     166           0 :         else if (nPageId == m_nHeaderId || nPageId == m_nFooterId)
     167             :         {
     168           0 :             ((ScHFPage&)rTabPage).SetStyleDlg( this );
     169           0 :             ((ScHFPage&)rTabPage).SetPageStyle( GetStyleSheet().GetName() );
     170           0 :             ((ScHFPage&)rTabPage).DisableDeleteQueryBox();
     171             :         }
     172           0 :         else if (nPageId == m_nBackgroundId)
     173             :         {
     174           0 :             aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_SHOW_SELECTOR));
     175           0 :             rTabPage.PageCreated(aSet);
     176           0 :         }
     177             :     }
     178           0 : }
     179             : 
     180             : 
     181           0 : const SfxItemSet* ScStyleDlg::GetRefreshedSet()
     182             : {
     183           0 :     SfxItemSet* pItemSet = GetInputSetImpl();
     184           0 :     pItemSet->ClearItem();
     185           0 :     pItemSet->SetParent( GetStyleSheet().GetItemSet().GetParent() );
     186           0 :     return pItemSet;
     187           0 : }
     188             : 
     189             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10