LCOV - code coverage report
Current view: top level - sw/source/ui/fmtui - tmpdlg.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 259 0.0 %
Date: 2014-11-03 Functions: 0 6 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 <sfx2/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>
      40             : #include <column.hxx>
      41             : #include <drpcps.hxx>
      42             : #include <frmpage.hxx>
      43             : #include <wrap.hxx>
      44             : #include <frmmgr.hxx>
      45             : #include <ccoll.hxx>
      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 <SwStyleNameMapper.hxx>
      59             : #include <svx/svxids.hrc>
      60             : #include <svl/stritem.hxx>
      61             : #include <svl/aeitem.hxx>
      62             : #include <svl/slstitm.hxx>
      63             : #include <svl/eitem.hxx>
      64             : #include <svl/intitem.hxx>
      65             : #include <svx/svxdlg.hxx>
      66             : #include <svx/dialogs.hrc>
      67             : #include <svx/flagsdef.hxx>
      68             : 
      69             : // the dialog's carrier
      70           0 : SwTemplateDlg::SwTemplateDlg(vcl::Window* pParent,
      71             :                              SfxStyleSheetBase& rBase,
      72             :                              sal_uInt16 nRegion,
      73             :                              const OString& sPage,
      74             :                              SwWrtShell* pActShell,
      75             :                              bool bNew)
      76             :     : SfxStyleDialog(pParent,
      77           0 :                     OString("TemplateDialog") + OString::number(nRegion),
      78           0 :                     OUString("modules/swriter/ui/templatedialog") +
      79           0 :                         OUString::number(nRegion) + ".ui",
      80             :                     rBase)
      81             :     , nType(nRegion)
      82             :     , pWrtShell(pActShell)
      83             :     , bNewStyle(bNew)
      84             :     , m_nIndentsId(0)
      85             :     , m_nAlignId(0)
      86             :     , m_nTextFlowId(0)
      87             :     , m_nAsianTypo(0)
      88             :     , m_nFontId(0)
      89             :     , m_nFontEffectId(0)
      90             :     , m_nPositionId(0)
      91             :     , m_nAsianLayoutId(0)
      92             :     , m_nTabId(0)
      93             :     , m_nOutlineId(0)
      94             :     , m_nDropCapsId(0)
      95             :     , m_nBackgroundId(0)
      96             :     , m_nAreaId(0)
      97             :     , m_nTransparenceId(0)
      98             :     , m_nBorderId(0)
      99             :     , m_nConditionId(0)
     100             :     , m_nTypeId(0)
     101             :     , m_nOptionsId(0)
     102             :     , m_nWrapId(0)
     103             :     , m_nColumnId(0)
     104             :     , m_nMacroId(0)
     105             :     , m_nHeaderId(0)
     106             :     , m_nFooterId(0)
     107             :     , m_nPageId(0)
     108             :     , m_nFootNoteId(0)
     109             :     , m_nTextGridId(0)
     110             :     , m_nSingleId(0)
     111             :     , m_nBulletId(0)
     112             :     , m_nNumId(0)
     113             :     , m_nBmpId(0)
     114             :     , m_nNumOptId(0)
     115           0 :     , m_nNumPosId(0)
     116             : {
     117           0 :     nHtmlMode = ::GetHtmlMode(pWrtShell->GetView().GetDocShell());
     118           0 :     SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
     119             :     OSL_ENSURE(pFact, "Dialog creation failed!");
     120             :     // tinker TabPages together
     121           0 :     switch( nRegion )
     122             :     {
     123             :         // character styles
     124             :         case SFX_STYLE_FAMILY_CHAR:
     125             :         {
     126             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");
     127             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ) , "GetTabPageRangesFunc fail!");
     128           0 :             m_nFontId = AddTabPage("font", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ));
     129             : 
     130             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");
     131             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ) , "GetTabPageRangesFunc fail!");
     132           0 :             m_nFontEffectId = AddTabPage("fonteffect", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ));
     133             : 
     134             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), "GetTabPageCreatorFunc fail!");
     135             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) , "GetTabPageRangesFunc fail!");
     136           0 :             m_nPositionId = AddTabPage("position", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ));
     137             : 
     138             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), "GetTabPageCreatorFunc fail!");
     139             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) , "GetTabPageRangesFunc fail!");
     140           0 :             m_nAsianLayoutId = AddTabPage("asianlayout", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ));
     141             : 
     142             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
     143             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) , "GetTabPageRangesFunc fail!");
     144           0 :             m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ));
     145             : 
     146             :             SAL_WARN_IF(!pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "sw.ui", "GetTabPageCreatorFunc fail!");
     147             :             SAL_WARN_IF(!pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "sw.ui", "GetTabPageRangesFunc fail!");
     148           0 :             m_nBorderId = AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ));
     149             : 
     150           0 :             SvtCJKOptions aCJKOptions;
     151           0 :             if(nHtmlMode & HTMLMODE_ON || !aCJKOptions.IsDoubleLinesEnabled())
     152           0 :                 RemoveTabPage("asianlayout");
     153             :         }
     154           0 :         break;
     155             :         // paragraph styles
     156             :         case SFX_STYLE_FAMILY_PARA:
     157             :         {
     158             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageCreatorFunc fail!");
     159             :             OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageRangesFunc fail!");
     160           0 :             m_nIndentsId = AddTabPage("indents", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH),        pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH) );
     161             : 
     162             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageCreatorFunc fail!");
     163             :             OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageRangesFunc fail!");
     164           0 :             m_nAlignId = AddTabPage("alignment", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH),      pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH) );
     165             : 
     166             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageCreatorFunc fail!");
     167             :             OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageRangesFunc fail!");
     168           0 :             m_nTextFlowId = AddTabPage("textflow", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH),        pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH) );
     169             : 
     170             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");
     171             :             OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageRangesFunc fail!");
     172           0 :             m_nAsianTypo = AddTabPage("asiantypo",  pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN),       pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN) );
     173             : 
     174             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");
     175             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageRangesFunc fail!");
     176           0 :             m_nFontId = AddTabPage("font", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ) );
     177             : 
     178             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");
     179             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageRangesFunc fail!");
     180           0 :             m_nFontEffectId = AddTabPage("fonteffect", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ) );
     181             : 
     182             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), "GetTabPageCreatorFunc fail!");
     183             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) , "GetTabPageRangesFunc fail!");
     184           0 :             m_nPositionId = AddTabPage("position", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) );
     185             : 
     186             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), "GetTabPageCreatorFunc fail!");
     187             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) , "GetTabPageRangesFunc fail!");
     188           0 :             m_nAsianLayoutId = AddTabPage("asianlayout", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) );
     189             : 
     190             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR), "GetTabPageCreatorFunc fail!");
     191             :             OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR), "GetTabPageRangesFunc fail!");
     192           0 :             m_nTabId = AddTabPage("tabs", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR),        pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR) );
     193             : 
     194             :             m_nOutlineId = AddTabPage("outline", SwParagraphNumTabPage::Create,
     195           0 :                                     SwParagraphNumTabPage::GetRanges);
     196             :             m_nDropCapsId = AddTabPage("dropcaps", SwDropCapsPage::Create,
     197           0 :                            SwDropCapsPage::GetRanges );
     198             : 
     199             :             //UUUU add Area and Transparence TabPages
     200           0 :             m_nAreaId = AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
     201           0 :             m_nTransparenceId = AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
     202             : 
     203             :             //UUUU remove?
     204             :             //OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
     205             :             //OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
     206             :             //m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
     207             : 
     208             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
     209             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
     210           0 :             m_nBorderId = AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
     211             : 
     212             :             m_nConditionId = AddTabPage("condition", SwCondCollPage::Create,
     213           0 :                                         SwCondCollPage::GetRanges );
     214           0 :             if( (!bNewStyle && RES_CONDTXTFMTCOLL != ((SwDocStyleSheet&)rBase).GetCollection()->Which())
     215           0 :             || nHtmlMode & HTMLMODE_ON )
     216           0 :                 RemoveTabPage("condition");
     217             : 
     218           0 :             SvtCJKOptions aCJKOptions;
     219           0 :             if(nHtmlMode & HTMLMODE_ON)
     220             :             {
     221           0 :                 SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
     222           0 :                 if (!rHtmlOpt.IsPrintLayoutExtension())
     223           0 :                     RemoveTabPage("textflow");
     224           0 :                 RemoveTabPage("asiantypo");
     225           0 :                 RemoveTabPage("tabs");
     226           0 :                 RemoveTabPage("outline");
     227           0 :                 RemoveTabPage("asianlayout");
     228           0 :                 if(!(nHtmlMode & HTMLMODE_FULL_STYLES))
     229             :                 {
     230           0 :                     RemoveTabPage("background");
     231           0 :                     RemoveTabPage("dropcaps");
     232             :                 }
     233             :             }
     234             :             else
     235             :             {
     236           0 :                 if(!aCJKOptions.IsAsianTypographyEnabled())
     237           0 :                     RemoveTabPage("asiantypo");
     238           0 :                 if(!aCJKOptions.IsDoubleLinesEnabled())
     239           0 :                     RemoveTabPage("asianlayout");
     240           0 :             }
     241             :         }
     242           0 :         break;
     243             :         // frame styles
     244             :         case SFX_STYLE_FAMILY_FRAME:
     245             :         {
     246             :             m_nTypeId = AddTabPage("type", SwFrmPage::Create,
     247           0 :                                         SwFrmPage::GetRanges);
     248             :             m_nOptionsId = AddTabPage("options", SwFrmAddPage::Create,
     249           0 :                                         SwFrmAddPage::GetRanges);
     250             :             m_nWrapId = AddTabPage("wrap", SwWrapTabPage::Create,
     251           0 :                                         SwWrapTabPage::GetRanges);
     252             :             //UUUU remove?
     253             :             //OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
     254             :             //OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
     255             : 
     256             :             //UUUU remove?
     257             :             //m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
     258             :             //OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
     259             :             //OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
     260             : 
     261             :             //UUUU add Area and Transparence TabPages
     262           0 :             m_nAreaId = AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
     263           0 :             m_nTransparenceId = AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
     264             : 
     265           0 :             m_nBorderId = AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
     266             : 
     267             :             m_nColumnId = AddTabPage("columns", SwColumnPage::Create,
     268           0 :                                         SwColumnPage::GetRanges );
     269             : 
     270           0 :             m_nMacroId = AddTabPage("macros", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), 0);
     271             : 
     272           0 :         break;
     273             :         }
     274             :         // page styles
     275             :         case SFX_STYLE_FAMILY_PAGE:
     276             :         {
     277             :             //UUUU remove?
     278             :             //OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
     279             :             //OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
     280             :             //m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
     281             : 
     282             :             //UUUU add Area and Transparence TabPages
     283           0 :             m_nAreaId = AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
     284           0 :             m_nTransparenceId = AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
     285             : 
     286           0 :             m_nHeaderId = AddTabPage("header",  SvxHeaderPage::Create, SvxHeaderPage::GetRanges);
     287           0 :             m_nFooterId = AddTabPage("footer", SvxFooterPage::Create, SvxFooterPage::GetRanges);
     288             : 
     289             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), "GetTabPageCreatorFunc fail!");
     290             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ), "GetTabPageRangesFunc fail!");
     291             :             m_nPageId = AddTabPage("page",
     292           0 :                                             pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ),
     293           0 :                                             pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ) );
     294           0 :             if (0 == ::GetHtmlMode(pWrtShell->GetView().GetDocShell()))
     295             :             {
     296             :                 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
     297             :                 OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
     298             :                 m_nBorderId = AddTabPage("borders",
     299           0 :                                 pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
     300           0 :                 m_nColumnId = AddTabPage("columns", SwColumnPage::Create, SwColumnPage::GetRanges );
     301             :                 m_nFootNoteId = AddTabPage("footnotes",
     302             :                                                 SwFootNotePage::Create,
     303           0 :                                                 SwFootNotePage::GetRanges );
     304             :                 m_nTextGridId = AddTabPage("textgrid",
     305             :                                                 SwTextGridPage::Create,
     306           0 :                                                 SwTextGridPage::GetRanges );
     307           0 :                 SvtCJKOptions aCJKOptions;
     308           0 :                 if(!aCJKOptions.IsAsianTypographyEnabled())
     309           0 :                     RemoveTabPage("textgrid");
     310             :             }
     311             :             else
     312             :             {
     313           0 :                 RemoveTabPage("borders");
     314           0 :                 RemoveTabPage("columns");
     315           0 :                 RemoveTabPage("footnotes");
     316           0 :                 RemoveTabPage("textgrid");
     317             :             }
     318             :         }
     319           0 :         break;
     320             :         // numbering styles
     321             :         case SFX_STYLE_FAMILY_PSEUDO:
     322             :         {
     323           0 :             m_nSingleId = AddTabPage("numbering", RID_SVXPAGE_PICK_SINGLE_NUM);
     324           0 :             m_nBulletId = AddTabPage("bullets", RID_SVXPAGE_PICK_BULLET);
     325           0 :             m_nNumId = AddTabPage("outline", RID_SVXPAGE_PICK_NUM);
     326           0 :             m_nBmpId = AddTabPage("graphics", RID_SVXPAGE_PICK_BMP);
     327           0 :             m_nNumOptId = AddTabPage("options", RID_SVXPAGE_NUM_OPTIONS );
     328           0 :             m_nNumPosId = AddTabPage("position", RID_SVXPAGE_NUM_POSITION );
     329             :         }
     330           0 :         break;
     331             : 
     332             :         default:
     333             :             OSL_ENSURE(false, "wrong family");
     334             :     }
     335             : 
     336           0 :     if (!sPage.isEmpty())
     337           0 :         SetCurPageId(sPage);
     338           0 : }
     339             : 
     340           0 : short SwTemplateDlg::Ok()
     341             : {
     342           0 :     short nRet = SfxTabDialog::Ok();
     343           0 :     if( RET_OK == nRet )
     344             :     {
     345             :         const SfxPoolItem *pOutItem, *pExItem;
     346           0 :         if( SfxItemState::SET == pExampleSet->GetItemState(
     347           0 :             SID_ATTR_NUMBERING_RULE, false, &pExItem ) &&
     348           0 :             ( !GetOutputItemSet() ||
     349             :             SfxItemState::SET != GetOutputItemSet()->GetItemState(
     350           0 :             SID_ATTR_NUMBERING_RULE, false, &pOutItem ) ||
     351           0 :             *pExItem != *pOutItem ))
     352             :         {
     353           0 :             if( GetOutputItemSet() )
     354           0 :                 ((SfxItemSet*)GetOutputItemSet())->Put( *pExItem );
     355             :             else
     356           0 :                 nRet = RET_CANCEL;
     357             :         }
     358             :     }
     359             :     else
     360             :         //JP 09.01.98 Bug #46446#:
     361             :         // that's the Ok-Handler, so OK has to be default!
     362           0 :         nRet = RET_OK;
     363           0 :     return nRet;
     364             : }
     365             : 
     366           0 : const SfxItemSet* SwTemplateDlg::GetRefreshedSet()
     367             : {
     368           0 :     SfxItemSet* pInSet = GetInputSetImpl();
     369           0 :     pInSet->ClearItem();
     370           0 :     pInSet->SetParent( &GetStyleSheet().GetItemSet() );
     371           0 :     return pInSet;
     372             : }
     373             : 
     374           0 : void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
     375             : {
     376             :     // set style's and metric's names
     377           0 :     OUString sNumCharFmt, sBulletCharFmt;
     378           0 :     SwStyleNameMapper::FillUIName( RES_POOLCHR_NUM_LEVEL, sNumCharFmt);
     379           0 :     SwStyleNameMapper::FillUIName( RES_POOLCHR_BUL_LEVEL, sBulletCharFmt);
     380           0 :     SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
     381             : 
     382           0 :     if (nId == m_nFontId)
     383             :     {
     384             :         OSL_ENSURE(::GetActiveView(), "no active view");
     385             : 
     386             :         SvxFontListItem aFontListItem( *( (SvxFontListItem*)::GetActiveView()->
     387           0 :             GetDocShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) ) );
     388             : 
     389           0 :         aSet.Put (SvxFontListItem( aFontListItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
     390           0 :         sal_uInt32 nFlags = 0;
     391           0 :         if(rPage.GetItemSet().GetParent() && 0 == (nHtmlMode & HTMLMODE_ON ))
     392           0 :             nFlags = SVX_RELATIVE_MODE;
     393           0 :         if( SFX_STYLE_FAMILY_CHAR == nType )
     394           0 :             nFlags = nFlags|SVX_PREVIEW_CHARACTER;
     395           0 :         aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlags));
     396           0 :         rPage.PageCreated(aSet);
     397             :     }
     398           0 :     else if (nId == m_nFontEffectId)
     399             :     {
     400           0 :         sal_uInt32 nFlags = SVX_ENABLE_FLASH;
     401           0 :         if( SFX_STYLE_FAMILY_CHAR == nType )
     402           0 :             nFlags = nFlags|SVX_PREVIEW_CHARACTER;
     403           0 :         aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlags));
     404           0 :         rPage.PageCreated(aSet);
     405             :     }
     406           0 :     else if (nId == m_nPositionId)
     407             :     {
     408           0 :         if( SFX_STYLE_FAMILY_CHAR == nType )
     409             :         {
     410           0 :             aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
     411           0 :             rPage.PageCreated(aSet);
     412             :         }
     413             :     }
     414           0 :     else if (nId == m_nAsianLayoutId)
     415             :     {
     416           0 :         if( SFX_STYLE_FAMILY_CHAR == nType )
     417             :         {
     418           0 :             aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
     419           0 :             rPage.PageCreated(aSet);
     420             :         }
     421             :     }
     422           0 :     else if (nId == m_nIndentsId)
     423             :     {
     424           0 :         if( rPage.GetItemSet().GetParent() )
     425             :         {
     426           0 :             aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST,MM50/10));
     427           0 :             aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x000F));
     428           0 :             rPage.PageCreated(aSet);
     429             :         }
     430             : 
     431             :     }
     432           0 :     else if (nId == m_nOutlineId)
     433             :     {
     434             :         //  handle if the current paragraph style is assigned to a list level of outline style,
     435           0 :         SwTxtFmtColl* pTmpColl = pWrtShell->FindTxtFmtCollByName( GetStyleSheet().GetName() );
     436           0 :         if( pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle() )
     437             :         {
     438           0 :             ((SwParagraphNumTabPage&)rPage).DisableOutline() ;
     439           0 :             ((SwParagraphNumTabPage&)rPage).DisableNumbering();
     440             :         }//<-end
     441           0 :         ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox();
     442           0 :         SfxStyleSheetBasePool* pPool = pWrtShell->GetView().GetDocShell()->GetStyleSheetPool();
     443           0 :         pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
     444           0 :         const SfxStyleSheetBase* pBase = pPool->First();
     445           0 :         std::set<OUString> aNames;
     446           0 :         while(pBase)
     447             :         {
     448           0 :             aNames.insert(pBase->GetName());
     449           0 :             pBase = pPool->Next();
     450             :         }
     451           0 :         for(std::set<OUString>::const_iterator it = aNames.begin(); it != aNames.end(); ++it)
     452           0 :             rBox.InsertEntry(*it);
     453             :     }
     454           0 :     else if (nId == m_nAlignId)
     455             :     {
     456           0 :         aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,true));
     457           0 :         rPage.PageCreated(aSet);
     458             :     }
     459           0 :     else if (nId == m_nTypeId)
     460             :     {
     461           0 :         ((SwFrmPage&)rPage).SetNewFrame( true );
     462           0 :         ((SwFrmPage&)rPage).SetFormatUsed( true );
     463             :     }
     464           0 :     else if (nId == m_nOptionsId)
     465             :     {
     466           0 :         ((SwFrmAddPage&)rPage).SetFormatUsed(true);
     467           0 :         ((SwFrmAddPage&)rPage).SetNewFrame(true);
     468             :     }
     469           0 :     else if (nId == m_nWrapId)
     470             :     {
     471           0 :         ((SwWrapTabPage&)rPage).SetFormatUsed( true, false );
     472             :     }
     473           0 :     else if (nId == m_nColumnId)
     474             :     {
     475           0 :         if( nType == SFX_STYLE_FAMILY_FRAME )
     476           0 :             ((SwColumnPage&)rPage).SetFrmMode(true);
     477           0 :         ((SwColumnPage&)rPage).SetFormatUsed( true );
     478             :     }
     479             :     //UUUU do not remove; many other style dialog combinations still use the SfxTabPage
     480             :     // for the SvxBrushItem (see RID_SVXPAGE_BACKGROUND)
     481           0 :     else if (nId == m_nBackgroundId)
     482             :     {
     483           0 :         sal_Int32 nFlagType = 0;
     484           0 :         if( SFX_STYLE_FAMILY_PARA == nType )
     485           0 :             nFlagType |= SVX_SHOW_PARACTL;
     486           0 :         if( SFX_STYLE_FAMILY_CHAR != nType )
     487           0 :             nFlagType |= SVX_SHOW_SELECTOR;
     488           0 :         if( SFX_STYLE_FAMILY_FRAME == nType )
     489           0 :             nFlagType |= SVX_ENABLE_TRANSPARENCY;
     490           0 :         aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlagType));
     491           0 :         rPage.PageCreated(aSet);
     492             :     }
     493           0 :     else if (nId == m_nConditionId)
     494             :     {
     495             :         ((SwCondCollPage&)rPage).SetCollection(
     496           0 :             ((SwDocStyleSheet&)GetStyleSheet()).GetCollection(), bNewStyle );
     497             :     }
     498           0 :     else if (nId == m_nPageId)
     499             :     {
     500           0 :         if(0 == (nHtmlMode & HTMLMODE_ON ))
     501             :         {
     502           0 :             std::vector<OUString> aList;
     503           0 :             OUString aNew;
     504           0 :             SwStyleNameMapper::FillUIName( RES_POOLCOLL_TEXT, aNew );
     505           0 :             aList.push_back( aNew );
     506           0 :             if( pWrtShell )
     507             :             {
     508             :                 SfxStyleSheetBasePool* pStyleSheetPool = pWrtShell->
     509           0 :                             GetView().GetDocShell()->GetStyleSheetPool();
     510           0 :                 pStyleSheetPool->SetSearchMask(SFX_STYLE_FAMILY_PARA);
     511           0 :                 SfxStyleSheetBase *pFirstStyle = pStyleSheetPool->First();
     512           0 :                 while(pFirstStyle)
     513             :                 {
     514           0 :                     aList.push_back( pFirstStyle->GetName() );
     515           0 :                     pFirstStyle = pStyleSheetPool->Next();
     516             :                 }
     517             :             }
     518             :             //UUUU set DrawingLayer FillStyles active
     519           0 :             aSet.Put(SfxBoolItem(SID_DRAWINGLAYER_FILLSTYLES, true));
     520           0 :             aSet.Put(SfxStringListItem(SID_COLLECT_LIST, &aList));
     521           0 :             rPage.PageCreated(aSet);
     522             :         }
     523             :     }
     524           0 :     else if (nId == m_nMacroId)
     525             :     {
     526           0 :         SfxAllItemSet aNewSet(*aSet.GetPool());
     527           0 :         aNewSet.Put( SwMacroAssignDlg::AddEvents(MACASSGN_ALLFRM) );
     528           0 :         if ( pWrtShell )
     529           0 :             rPage.SetFrame( pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() );
     530           0 :         rPage.PageCreated(aNewSet);
     531             :     }
     532           0 :     else if (nId == m_nNumId)
     533             :     {
     534           0 :         aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
     535           0 :         aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
     536           0 :         rPage.PageCreated(aSet);
     537             :     }
     538           0 :     else if (nId == m_nNumOptId)
     539             :     {
     540             : 
     541           0 :         aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
     542           0 :         aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
     543             :         // collect character styles
     544           0 :         ListBox rCharFmtLB(this);
     545           0 :         rCharFmtLB.Clear();
     546           0 :         rCharFmtLB.InsertEntry( SwViewShell::GetShellRes()->aStrNone );
     547           0 :         SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
     548           0 :         ::FillCharStyleListBox(rCharFmtLB,  pDocShell);
     549             : 
     550           0 :         std::vector<OUString> aList;
     551           0 :         for(sal_Int32 j = 0; j < rCharFmtLB.GetEntryCount(); j++)
     552           0 :              aList.push_back( rCharFmtLB.GetEntry(j) );
     553             : 
     554           0 :         aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
     555           0 :         FieldUnit eMetric = ::GetDfltMetric(pDocShell->ISA(SwWebDocShell));
     556           0 :         aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
     557           0 :         rPage.PageCreated(aSet);
     558             :     }
     559           0 :     else if (nId == m_nNumPosId)
     560             :     {
     561           0 :         SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
     562           0 :         FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
     563             : 
     564           0 :         aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
     565           0 :         rPage.PageCreated(aSet);
     566             :     }
     567           0 :     else if (nId == m_nBulletId)
     568             :     {
     569           0 :         aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
     570           0 :         rPage.PageCreated(aSet);
     571             :     }
     572           0 :     else if (nId == m_nHeaderId)
     573             :     {
     574           0 :         if(0 == (nHtmlMode & HTMLMODE_ON ))
     575             :         {
     576           0 :             ((SvxHeaderPage&)rPage).EnableDynamicSpacing();
     577             :         }
     578             : 
     579             :         //UUUU set DrawingLayer FillStyles active
     580           0 :         aSet.Put(SfxBoolItem(SID_DRAWINGLAYER_FILLSTYLES, true));
     581           0 :         rPage.PageCreated(aSet);
     582             :     }
     583           0 :     else if (nId == m_nFooterId)
     584             :     {
     585           0 :         if(0 == (nHtmlMode & HTMLMODE_ON ))
     586             :         {
     587           0 :             ((SvxFooterPage&)rPage).EnableDynamicSpacing();
     588             :         }
     589             : 
     590             :         //UUUU set DrawingLayer FillStyles active
     591           0 :         aSet.Put(SfxBoolItem(SID_DRAWINGLAYER_FILLSTYLES, true));
     592           0 :         rPage.PageCreated(aSet);
     593             :     }
     594           0 :     else if (nId == m_nBorderId)
     595             :     {
     596           0 :         if( SFX_STYLE_FAMILY_PARA == nType )
     597             :         {
     598           0 :             aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_PARA));
     599             :         }
     600           0 :         else if( SFX_STYLE_FAMILY_FRAME == nType )
     601             :         {
     602           0 :             aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_FRAME));
     603             :         }
     604           0 :         rPage.PageCreated(aSet);
     605             :     }
     606             :     //UUUU inits for Area and Transparency TabPages
     607             :     // The selection attribute lists (XPropertyList derivates, e.g. XColorList for
     608             :     // the color table) need to be added as items (e.g. SvxColorTableItem) to make
     609             :     // these pages find the needed attributes for fill style suggestions.
     610             :     // These are added in SwDocStyleSheet::GetItemSet() for the SFX_STYLE_FAMILY_PARA on
     611             :     // demand, but could also be directly added from the DrawModel.
     612           0 :     else if (nId == m_nAreaId)
     613             :     {
     614           0 :         aSet.Put(GetStyleSheet().GetItemSet());
     615             : 
     616             :         // add flag for direct graphic content selection
     617           0 :         aSet.Put(SfxBoolItem(SID_OFFER_IMPORT, true));
     618             : 
     619           0 :         rPage.PageCreated(aSet);
     620             :     }
     621           0 :     else if (nId == m_nTransparenceId)
     622             :     {
     623           0 :         rPage.PageCreated(GetStyleSheet().GetItemSet());
     624           0 :     }
     625           0 : }
     626             : 
     627             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10