LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/fmtui - tmpdlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 242 0.0 %
Date: 2012-12-27 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             : #include <hintids.hxx>
      21             : 
      22             : #include <vcl/msgbox.hxx>
      23             : #include <sfx2/viewfrm.hxx>
      24             : #include <svx/hdft.hxx>
      25             : #include <editeng/flstitem.hxx>
      26             : #include <svx/htmlmode.hxx>
      27             : #include <svtools/htmlcfg.hxx>
      28             : #include <svl/cjkoptions.hxx>
      29             : #include <numpara.hxx>
      30             : #include <fmtclds.hxx>
      31             : #include <swtypes.hxx>
      32             : #include <swmodule.hxx>
      33             : #include <wrtsh.hxx>
      34             : #include <view.hxx>
      35             : #include <wdocsh.hxx>
      36             : #include <viewopt.hxx>
      37             : #include <pgfnote.hxx>
      38             : #include <pggrid.hxx>
      39             : #include <tmpdlg.hxx>       // the dialog
      40             : #include <column.hxx>       // columns
      41             : #include <drpcps.hxx>       // initials
      42             : #include <frmpage.hxx>      // frames
      43             : #include <wrap.hxx>         // frames
      44             : #include <frmmgr.hxx>       // frames
      45             : #include <ccoll.hxx>        // CondColl
      46             : #include <swuiccoll.hxx>
      47             : #include <docstyle.hxx>     //
      48             : #include <fmtcol.hxx>       //
      49             : #include <macassgn.hxx>     //
      50             : #include <poolfmt.hxx>
      51             : #include <uitool.hxx>
      52             : #include <shellres.hxx>
      53             : #include <swabstdlg.hxx>
      54             : 
      55             : #include <cmdid.h>
      56             : #include <helpid.h>
      57             : #include <globals.hrc>
      58             : #include <fmtui.hrc>
      59             : #include <SwStyleNameMapper.hxx>
      60             : #include <svx/svxids.hrc>
      61             : #include <svl/stritem.hxx>
      62             : #include <svl/aeitem.hxx>
      63             : #include <svl/slstitm.hxx>
      64             : #include <svl/eitem.hxx>
      65             : #include <svl/intitem.hxx>
      66             : #include <svx/svxdlg.hxx>
      67             : #include <svx/dialogs.hrc>
      68             : #include <svx/flagsdef.hxx>
      69             : 
      70             : extern SW_DLLPUBLIC SwWrtShell* GetActiveWrtShell();
      71             : 
      72             : /*--------------------------------------------------------------------
      73             :     Description:    the dialog's carrier
      74             :  --------------------------------------------------------------------*/
      75             : 
      76           0 : SwTemplateDlg::SwTemplateDlg(Window*            pParent,
      77             :                              SfxStyleSheetBase& rBase,
      78             :                              sal_uInt16             nRegion,
      79             :                              sal_uInt16             nPageId,
      80             :                              SwWrtShell*        pActShell,
      81             :                              sal_Bool               bNew ) :
      82             :     SfxStyleDialog( pParent,
      83             :                     SW_RES(DLG_TEMPLATE_BASE + nRegion),
      84             :                     rBase,
      85             :                     sal_False,
      86             :                     0 ),
      87             :     nType( nRegion ),
      88             :     pWrtShell(pActShell),
      89           0 :     bNewStyle(bNew)
      90             : {
      91           0 :     FreeResource();
      92             : 
      93           0 :     nHtmlMode = ::GetHtmlMode(pWrtShell->GetView().GetDocShell());
      94           0 :     SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
      95             :     OSL_ENSURE(pFact, "Dialogdiet fail!");
      96             :     // tinker TabPages together
      97           0 :     switch( nRegion )
      98             :     {
      99             :         // character styles
     100             :         case SFX_STYLE_FAMILY_CHAR:
     101             :         {
     102             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");
     103             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ) , "GetTabPageRangesFunc fail!");
     104           0 :             AddTabPage(TP_CHAR_STD, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ) );
     105             : 
     106             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");
     107             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ) , "GetTabPageRangesFunc fail!");
     108           0 :             AddTabPage(TP_CHAR_EXT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ) );
     109             : 
     110             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), "GetTabPageCreatorFunc fail!");
     111             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) , "GetTabPageRangesFunc fail!");
     112           0 :             AddTabPage(TP_CHAR_POS, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) );
     113             : 
     114             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), "GetTabPageCreatorFunc fail!");
     115             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) , "GetTabPageRangesFunc fail!");
     116           0 :             AddTabPage(TP_CHAR_TWOLN, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) );
     117             : 
     118             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
     119             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) , "GetTabPageRangesFunc fail!");
     120           0 :             AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
     121             : 
     122           0 :             SvtCJKOptions aCJKOptions;
     123           0 :             if(nHtmlMode & HTMLMODE_ON || !aCJKOptions.IsDoubleLinesEnabled())
     124           0 :                 RemoveTabPage(TP_CHAR_TWOLN);
     125             :         }
     126           0 :         break;
     127             :         // paragraph styles
     128             :         case SFX_STYLE_FAMILY_PARA:
     129             :         {
     130             :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageCreatorFunc fail!");
     131             :                 OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageRangesFunc fail!");
     132           0 :                 AddTabPage( TP_PARA_STD,    pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH),        pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH) );
     133             : 
     134             :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageCreatorFunc fail!");
     135             :                 OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageRangesFunc fail!");
     136           0 :                 AddTabPage( TP_PARA_ALIGN,  pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH),      pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH) );
     137             : 
     138             :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageCreatorFunc fail!");
     139             :                 OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageRangesFunc fail!");
     140           0 :                 AddTabPage( TP_PARA_EXT,    pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH),        pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH) );
     141             : 
     142             :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");
     143             :                 OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageRangesFunc fail!");
     144           0 :                 AddTabPage( TP_PARA_ASIAN,  pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN),       pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN) );
     145             : 
     146             :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");
     147             :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageRangesFunc fail!");
     148           0 :                 AddTabPage(TP_CHAR_STD, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ) );
     149             : 
     150             :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");
     151             :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageRangesFunc fail!");
     152           0 :                 AddTabPage(TP_CHAR_EXT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ) );
     153             : 
     154             :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), "GetTabPageCreatorFunc fail!");
     155             :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) , "GetTabPageRangesFunc fail!");
     156           0 :                 AddTabPage(TP_CHAR_POS, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) );
     157             : 
     158             :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), "GetTabPageCreatorFunc fail!");
     159             :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) , "GetTabPageRangesFunc fail!");
     160           0 :                 AddTabPage(TP_CHAR_TWOLN, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) );
     161             : 
     162             : 
     163             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR), "GetTabPageCreatorFunc fail!");
     164             :             OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR), "GetTabPageRangesFunc fail!");
     165           0 :             AddTabPage( TP_TABULATOR,   pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR),        pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR) );
     166             : 
     167             : 
     168             :             AddTabPage(TP_NUMPARA,   SwParagraphNumTabPage::Create,
     169           0 :                                     SwParagraphNumTabPage::GetRanges);
     170             :             AddTabPage(TP_DROPCAPS,     SwDropCapsPage::Create,
     171           0 :                                         SwDropCapsPage::GetRanges );
     172             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
     173             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
     174           0 :             AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
     175             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
     176             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
     177           0 :             AddTabPage(TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
     178             : 
     179             :             AddTabPage( TP_CONDCOLL,    SwCondCollPage::Create,
     180           0 :                                         SwCondCollPage::GetRanges );
     181           0 :             if( (!bNewStyle && RES_CONDTXTFMTCOLL != ((SwDocStyleSheet&)rBase).GetCollection()->Which())
     182             :             || nHtmlMode & HTMLMODE_ON )
     183           0 :                 RemoveTabPage(TP_CONDCOLL);
     184             : 
     185           0 :             SvtCJKOptions aCJKOptions;
     186           0 :             if(nHtmlMode & HTMLMODE_ON)
     187             :             {
     188           0 :                 SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
     189           0 :                 if (!rHtmlOpt.IsPrintLayoutExtension())
     190           0 :                     RemoveTabPage(TP_PARA_EXT);
     191           0 :                 RemoveTabPage(TP_PARA_ASIAN);
     192           0 :                 RemoveTabPage(TP_TABULATOR);
     193           0 :                 RemoveTabPage(TP_NUMPARA);
     194           0 :                 RemoveTabPage(TP_CHAR_TWOLN);
     195           0 :                 if(!(nHtmlMode & HTMLMODE_FULL_STYLES))
     196             :                 {
     197           0 :                     RemoveTabPage(TP_BACKGROUND);
     198           0 :                     RemoveTabPage(TP_DROPCAPS);
     199             :                 }
     200             :             }
     201             :             else
     202             :             {
     203           0 :                 if(!aCJKOptions.IsAsianTypographyEnabled())
     204           0 :                     RemoveTabPage(TP_PARA_ASIAN);
     205           0 :                 if(!aCJKOptions.IsDoubleLinesEnabled())
     206           0 :                     RemoveTabPage(TP_CHAR_TWOLN);
     207           0 :             }
     208             :         }
     209           0 :         break;
     210             :         // frame styles
     211             :         case SFX_STYLE_FAMILY_FRAME:
     212             :         {
     213             :             AddTabPage(TP_FRM_STD,      SwFrmPage::Create,
     214           0 :                                         SwFrmPage::GetRanges );
     215             :             AddTabPage(TP_FRM_ADD,      SwFrmAddPage::Create,
     216           0 :                                         SwFrmAddPage::GetRanges );
     217             :             AddTabPage(TP_FRM_WRAP,     SwWrapTabPage::Create,
     218           0 :                                         SwWrapTabPage::GetRanges );
     219             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
     220             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
     221           0 :             AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
     222             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
     223             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
     224           0 :             AddTabPage(TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
     225             : 
     226             :             AddTabPage(TP_COLUMN,       SwColumnPage::Create,
     227           0 :                                         SwColumnPage::GetRanges );
     228             : 
     229           0 :             AddTabPage( TP_MACRO_ASSIGN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), 0);
     230             : 
     231           0 :         break;
     232             :         }
     233             :         // page styles
     234             :         case SFX_STYLE_FAMILY_PAGE:
     235             :         {
     236             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
     237             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
     238           0 :             AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
     239             :             AddTabPage(TP_HEADER_PAGE,      String(SW_RES(STR_PAGE_HEADER)),
     240             :                                             SvxHeaderPage::Create,
     241           0 :                                             SvxHeaderPage::GetRanges );
     242             :             AddTabPage(TP_FOOTER_PAGE,      String(SW_RES(STR_PAGE_FOOTER)),
     243             :                                             SvxFooterPage::Create,
     244           0 :                                             SvxFooterPage::GetRanges );
     245           0 :             if(nPageId)
     246           0 :                 SetCurPageId(nPageId);
     247             : 
     248             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), "GetTabPageCreatorFunc fail!");
     249             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ), "GetTabPageRangesFunc fail!");
     250             :             AddTabPage(TP_PAGE_STD,         String(SW_RES(STR_PAGE_STD)),
     251           0 :                                             pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ),
     252           0 :                                             pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ),
     253             :                                             sal_False,
     254           0 :                                             1 ); // after the manage-page
     255           0 :             if(!pActShell || 0 == ::GetHtmlMode(pWrtShell->GetView().GetDocShell()))
     256             :             {
     257             :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
     258             :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
     259             :                 AddTabPage(TP_BORDER,           String(SW_RES(STR_PAGE_BORDER)),
     260           0 :                                 pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
     261             :                 AddTabPage(TP_COLUMN,           String(SW_RES(STR_PAGE_COLUMN)),
     262             :                                                 SwColumnPage::Create,
     263           0 :                                                 SwColumnPage::GetRanges );
     264             :                 AddTabPage(TP_FOOTNOTE_PAGE,    String(SW_RES(STR_PAGE_FOOTNOTE)),
     265             :                                                 SwFootNotePage::Create,
     266           0 :                                                 SwFootNotePage::GetRanges );
     267             :                 AddTabPage(TP_TEXTGRID_PAGE,    String(SW_RES(STR_PAGE_TEXTGRID)),
     268             :                                                 SwTextGridPage::Create,
     269           0 :                                                 SwTextGridPage::GetRanges );
     270           0 :                 SvtCJKOptions aCJKOptions;
     271           0 :                 if(!aCJKOptions.IsAsianTypographyEnabled())
     272           0 :                     RemoveTabPage(TP_TEXTGRID_PAGE);
     273             :             }
     274             : 
     275             : 
     276             :         }
     277           0 :         break;
     278             :         // numbering styles
     279             :         case SFX_STYLE_FAMILY_PSEUDO:
     280             :         {
     281           0 :             AddTabPage( RID_SVXPAGE_PICK_SINGLE_NUM );
     282           0 :             AddTabPage( RID_SVXPAGE_PICK_BULLET );
     283           0 :             AddTabPage( RID_SVXPAGE_PICK_NUM );
     284           0 :             AddTabPage( RID_SVXPAGE_PICK_BMP);
     285           0 :             AddTabPage( RID_SVXPAGE_NUM_OPTIONS );
     286           0 :             AddTabPage( RID_SVXPAGE_NUM_POSITION );
     287             : 
     288             :         }
     289           0 :         break;
     290             : 
     291             :         default:
     292             :             OSL_ENSURE(!this, "wrong family");
     293             : 
     294             :     }
     295           0 :     EnableApplyButton( true );
     296           0 : }
     297             : 
     298           0 : SwTemplateDlg::~SwTemplateDlg()
     299             : {
     300           0 : }
     301             : 
     302           0 : short SwTemplateDlg::Ok()
     303             : {
     304           0 :     short nRet = SfxTabDialog::Ok();
     305           0 :     if( RET_OK == nRet )
     306             :     {
     307             :         const SfxPoolItem *pOutItem, *pExItem;
     308           0 :         if( SFX_ITEM_SET == pExampleSet->GetItemState(
     309           0 :             SID_ATTR_NUMBERING_RULE, sal_False, &pExItem ) &&
     310           0 :             ( !GetOutputItemSet() ||
     311             :             SFX_ITEM_SET != GetOutputItemSet()->GetItemState(
     312           0 :             SID_ATTR_NUMBERING_RULE, sal_False, &pOutItem ) ||
     313           0 :             *pExItem != *pOutItem ))
     314             :         {
     315           0 :             if( GetOutputItemSet() )
     316           0 :                 ((SfxItemSet*)GetOutputItemSet())->Put( *pExItem );
     317             :             else
     318           0 :                 nRet = RET_CANCEL;
     319             :         }
     320             :     }
     321             :     else
     322             :         //JP 09.01.98 Bug #46446#:
     323             :         // that's the Ok-Handler, so OK has to be default!
     324           0 :         nRet = RET_OK;
     325           0 :     return nRet;
     326             : }
     327             : 
     328           0 : const SfxItemSet* SwTemplateDlg::GetRefreshedSet()
     329             : {
     330           0 :     SfxItemSet* pInSet = GetInputSetImpl();
     331           0 :     pInSet->ClearItem();
     332           0 :     pInSet->SetParent( &GetStyleSheet().GetItemSet() );
     333           0 :     return pInSet;
     334             : }
     335             : 
     336           0 : void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
     337             : {
     338             :     // set style's and metric's names
     339           0 :     String sNumCharFmt, sBulletCharFmt;
     340           0 :     SwStyleNameMapper::FillUIName( RES_POOLCHR_NUM_LEVEL, sNumCharFmt);
     341           0 :     SwStyleNameMapper::FillUIName( RES_POOLCHR_BUL_LEVEL, sBulletCharFmt);
     342           0 :     SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
     343             : 
     344           0 :     switch( nId )
     345             :     {
     346             :         case TP_CHAR_STD:
     347             :             {
     348             :                 OSL_ENSURE(::GetActiveView(), "no active view");
     349             : 
     350             :                 SvxFontListItem aFontListItem( *( (SvxFontListItem*)::GetActiveView()->
     351           0 :                     GetDocShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) ) );
     352             : 
     353           0 :                 aSet.Put (SvxFontListItem( aFontListItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
     354           0 :                 sal_uInt32 nFlags = 0;
     355           0 :                 if(rPage.GetItemSet().GetParent() && 0 == (nHtmlMode & HTMLMODE_ON ))
     356           0 :                     nFlags = SVX_RELATIVE_MODE;
     357           0 :                 if( SFX_STYLE_FAMILY_CHAR == nType )
     358           0 :                     nFlags = nFlags|SVX_PREVIEW_CHARACTER;
     359           0 :                 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlags));
     360           0 :                 rPage.PageCreated(aSet);
     361             :             }
     362           0 :             break;
     363             : 
     364             :         case TP_CHAR_EXT:
     365             :             {
     366           0 :             sal_uInt32 nFlags = SVX_ENABLE_FLASH;
     367           0 :             if( SFX_STYLE_FAMILY_CHAR == nType )
     368           0 :                 nFlags = nFlags|SVX_PREVIEW_CHARACTER;
     369           0 :             aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlags));
     370           0 :             rPage.PageCreated(aSet);
     371             :             }
     372           0 :             break;
     373             : 
     374             :         case TP_CHAR_POS:
     375           0 :             if( SFX_STYLE_FAMILY_CHAR == nType )
     376             :             {
     377           0 :                 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
     378           0 :                 rPage.PageCreated(aSet);
     379             :             }
     380           0 :         break;
     381             : 
     382             :         case TP_CHAR_TWOLN:
     383           0 :             if( SFX_STYLE_FAMILY_CHAR == nType )
     384             :             {
     385           0 :                 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
     386           0 :                 rPage.PageCreated(aSet);
     387             :             }
     388           0 :         break;
     389             : 
     390             :         case TP_PARA_STD:
     391             :             {
     392           0 :                 if( rPage.GetItemSet().GetParent() )
     393             :                 {
     394           0 :                     aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST,MM50/10));
     395           0 :                     aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x000F));
     396           0 :                     rPage.PageCreated(aSet);
     397             :                 }
     398             : 
     399             :             }
     400           0 :             break;
     401             :         case TP_NUMPARA:
     402             :             {
     403             :                 //-->#outlinelevel added by zhaojianwei
     404             :                 //  handle if the current paragraph style is assigned to a list level of outline style,
     405           0 :                 SwTxtFmtColl* pTmpColl = pWrtShell->FindTxtFmtCollByName( GetStyleSheet().GetName() );
     406           0 :                 if( pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle() )
     407             :                 {
     408           0 :                     ((SwParagraphNumTabPage&)rPage).DisableOutline() ;
     409           0 :                     ((SwParagraphNumTabPage&)rPage).DisableNumbering();
     410             :                 }//<-end
     411           0 :                 ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox();
     412           0 :                 SfxStyleSheetBasePool* pPool = pWrtShell->GetView().GetDocShell()->GetStyleSheetPool();
     413           0 :                 pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
     414           0 :                 const SfxStyleSheetBase* pBase = pPool->First();
     415           0 :                 std::set<String> aNames;
     416           0 :                 while(pBase)
     417             :                 {
     418           0 :                     aNames.insert(pBase->GetName());
     419           0 :                     pBase = pPool->Next();
     420             :                 }
     421           0 :                 for(std::set<String>::const_iterator it = aNames.begin(); it != aNames.end(); ++it)
     422           0 :                     rBox.InsertEntry(*it);
     423             :         }
     424           0 :         break;
     425             :         case TP_PARA_ALIGN:
     426             :             {
     427           0 :                 aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,sal_True));
     428           0 :                 rPage.PageCreated(aSet);
     429             :             }
     430           0 :             break;
     431             : 
     432             :         case TP_FRM_STD:
     433           0 :             ((SwFrmPage&)rPage).SetNewFrame( sal_True );
     434           0 :             ((SwFrmPage&)rPage).SetFormatUsed( sal_True );
     435           0 :             break;
     436             : 
     437             :         case TP_FRM_ADD:
     438           0 :             ((SwFrmAddPage&)rPage).SetFormatUsed(sal_True);
     439           0 :             ((SwFrmAddPage&)rPage).SetNewFrame(sal_True);
     440           0 :             break;
     441             : 
     442             :         case TP_FRM_WRAP:
     443           0 :             ((SwWrapTabPage&)rPage).SetFormatUsed( sal_True, sal_False );
     444           0 :             break;
     445             : 
     446             :         case TP_COLUMN:
     447           0 :             if( nType == SFX_STYLE_FAMILY_FRAME )
     448           0 :                 ((SwColumnPage&)rPage).SetFrmMode(sal_True);
     449           0 :             ((SwColumnPage&)rPage).SetFormatUsed( sal_True );
     450           0 :             break;
     451             : 
     452             :         case TP_BACKGROUND:
     453             :         {
     454           0 :             sal_Int32 nFlagType = 0;
     455           0 :             if( SFX_STYLE_FAMILY_PARA == nType )
     456           0 :                 nFlagType |= SVX_SHOW_PARACTL;
     457           0 :             if( SFX_STYLE_FAMILY_CHAR != nType )
     458           0 :                 nFlagType |= SVX_SHOW_SELECTOR;
     459           0 :             if( SFX_STYLE_FAMILY_FRAME == nType )
     460           0 :                 nFlagType |= SVX_ENABLE_TRANSPARENCY;
     461           0 :             aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlagType));
     462           0 :             rPage.PageCreated(aSet);
     463             :         }
     464           0 :         break;
     465             :         case TP_CONDCOLL:
     466             :             ((SwCondCollPage&)rPage).SetCollection(
     467           0 :                 ((SwDocStyleSheet&)GetStyleSheet()).GetCollection(), bNewStyle );
     468           0 :             break;
     469             : 
     470             :         case TP_PAGE_STD:
     471           0 :             if(0 == (nHtmlMode & HTMLMODE_ON ))
     472             :             {
     473           0 :                 std::vector<String> aList;
     474           0 :                 String aNew;
     475           0 :                 SwStyleNameMapper::FillUIName( RES_POOLCOLL_TEXT, aNew );
     476           0 :                 aList.push_back( aNew );
     477           0 :                 if( pWrtShell )
     478             :                 {
     479             :                     SfxStyleSheetBasePool* pStyleSheetPool = pWrtShell->
     480           0 :                                 GetView().GetDocShell()->GetStyleSheetPool();
     481           0 :                     pStyleSheetPool->SetSearchMask(SFX_STYLE_FAMILY_PARA);
     482           0 :                     SfxStyleSheetBase *pFirstStyle = pStyleSheetPool->First();
     483           0 :                     while(pFirstStyle)
     484             :                     {
     485           0 :                         aList.push_back( pFirstStyle->GetName() );
     486           0 :                         pFirstStyle = pStyleSheetPool->Next();
     487             :                     }
     488             :                 }
     489           0 :                 aSet.Put (SfxStringListItem(SID_COLLECT_LIST, &aList));
     490           0 :                 rPage.PageCreated(aSet);
     491             :             }
     492           0 :             break;
     493             : 
     494             :         case TP_MACRO_ASSIGN:
     495             :         {
     496           0 :             SfxAllItemSet aNewSet(*aSet.GetPool());
     497           0 :             aNewSet.Put( SwMacroAssignDlg::AddEvents(MACASSGN_ALLFRM) );
     498           0 :             if ( pWrtShell )
     499           0 :                 rPage.SetFrame( pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() );
     500           0 :             rPage.PageCreated(aNewSet);
     501           0 :             break;
     502             :         }
     503             : 
     504             :         case RID_SVXPAGE_PICK_NUM:
     505             :             {
     506           0 :                 aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
     507           0 :                 aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
     508           0 :                 rPage.PageCreated(aSet);
     509             :             }
     510           0 :         break;
     511             :         case RID_SVXPAGE_NUM_OPTIONS:
     512             :         {
     513             : 
     514           0 :             aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
     515           0 :             aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
     516             :             // collect character styles
     517           0 :             ListBox rCharFmtLB(this);
     518           0 :             rCharFmtLB.Clear();
     519           0 :             rCharFmtLB.InsertEntry( ViewShell::GetShellRes()->aStrNone );
     520           0 :             SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
     521           0 :             ::FillCharStyleListBox(rCharFmtLB,  pDocShell);
     522             : 
     523           0 :             std::vector<String> aList;
     524           0 :             for(sal_uInt16 j = 0; j < rCharFmtLB.GetEntryCount(); j++)
     525           0 :                  aList.push_back( rCharFmtLB.GetEntry(j) );
     526             : 
     527           0 :             aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
     528           0 :             FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
     529           0 :             aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
     530           0 :             rPage.PageCreated(aSet);
     531             :         }
     532           0 :         break;
     533             :         case RID_SVXPAGE_NUM_POSITION:
     534             :         {
     535           0 :             SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
     536           0 :             FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
     537             : 
     538           0 :             aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
     539           0 :             rPage.PageCreated(aSet);
     540             :         }
     541           0 :         break;
     542             :         case  RID_SVXPAGE_PICK_BULLET :
     543             :             {
     544           0 :                 aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
     545           0 :                 rPage.PageCreated(aSet);
     546             :             }
     547           0 :         break;
     548             :         case  TP_HEADER_PAGE:
     549           0 :             if(0 == (nHtmlMode & HTMLMODE_ON ))
     550           0 :                 ((SvxHeaderPage&)rPage).EnableDynamicSpacing();
     551           0 :         break;
     552             :         case  TP_FOOTER_PAGE:
     553           0 :             if(0 == (nHtmlMode & HTMLMODE_ON ))
     554           0 :                 ((SvxFooterPage&)rPage).EnableDynamicSpacing();
     555           0 :         break;
     556             :         case TP_BORDER :
     557           0 :             if( SFX_STYLE_FAMILY_PARA == nType )
     558             :             {
     559           0 :                 aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_PARA));
     560             :             }
     561           0 :             else if( SFX_STYLE_FAMILY_FRAME == nType )
     562             :             {
     563           0 :                 aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_FRAME));
     564             :             }
     565           0 :             rPage.PageCreated(aSet);
     566             : 
     567           0 :         break;
     568           0 :     }
     569           0 : }
     570             : 
     571             : 
     572             : 
     573             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10