LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/chrdlg - pardlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 88 0.0 %
Date: 2012-12-27 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             : #include <svx/htmlmode.hxx>
      22             : #include <svl/style.hxx>
      23             : #include <svtools/htmlcfg.hxx>
      24             : #include <svl/cjkoptions.hxx>
      25             : #include "docsh.hxx"
      26             : #include "wrtsh.hxx"
      27             : #include "frmatr.hxx"
      28             : #include "view.hxx"
      29             : #include "globals.hrc"
      30             : #include "swuipardlg.hxx"
      31             : #include "pagedesc.hxx"
      32             : #include "paratr.hxx"
      33             : #include "drpcps.hxx"
      34             : #include "uitool.hxx"
      35             : #include "viewopt.hxx"
      36             : #include <numpara.hxx>
      37             : #include "chrdlg.hrc"
      38             : #include "poolfmt.hrc"
      39             : #include <svx/svxids.hrc>
      40             : #include <svl/eitem.hxx>
      41             : #include <svl/intitem.hxx>
      42             : #include <svx/svxdlg.hxx>
      43             : #include <svx/dialogs.hrc>
      44             : #include <svx/flagsdef.hxx>
      45             : 
      46           0 : SwParaDlg::SwParaDlg(Window *pParent,
      47             :                     SwView& rVw,
      48             :                     const SfxItemSet& rCoreSet,
      49             :                     sal_uInt8 nDialogMode,
      50             :                     const String *pTitle,
      51             :                     sal_Bool bDraw,
      52             :                     sal_uInt16 nDefPage):
      53             : 
      54             :     SfxTabDialog(pParent, bDraw ? SW_RES(DLG_DRAWPARA) : SW_RES(DLG_PARA),
      55             :                     &rCoreSet,  0 != pTitle),
      56             : 
      57             :     rView(rVw),
      58             :     nDlgMode(nDialogMode),
      59           0 :     bDrawParaDlg(bDraw)
      60             : 
      61             : {
      62           0 :     FreeResource();
      63             : 
      64           0 :     nHtmlMode = ::GetHtmlMode(rVw.GetDocShell());
      65           0 :     sal_Bool bHtmlMode = static_cast< sal_Bool >(nHtmlMode & HTMLMODE_ON);
      66           0 :     if(pTitle)
      67             :     {
      68             :         // Update title
      69           0 :         String aTmp( GetText() );
      70           0 :         aTmp += SW_RESSTR(STR_TEXTCOLL_HEADER);
      71           0 :         aTmp += *pTitle;
      72           0 :         aTmp += ')';
      73           0 :         SetText(aTmp);
      74             :     }
      75           0 :     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
      76             : 
      77             :     OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageCreatorFunc fail!");
      78             :     OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageRangesFunc fail!");
      79           0 :     AddTabPage( TP_PARA_STD,    pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH),        pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH) );
      80             : 
      81             :     OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageCreatorFunc fail!");
      82             :     OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageRangesFunc fail!");
      83           0 :     AddTabPage( TP_PARA_ALIGN,  pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH),      pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH) );
      84             : 
      85           0 :     SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
      86           0 :     if (!bDrawParaDlg && (!bHtmlMode || rHtmlOpt.IsPrintLayoutExtension()))
      87             :     {
      88             :         OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageCreatorFunc fail!");
      89             :         OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageRangesFunc fail!");
      90           0 :         AddTabPage( TP_PARA_EXT,    pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH),        pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH) );
      91             : 
      92             :     }
      93             :     else
      94           0 :         RemoveTabPage(TP_PARA_EXT);
      95             : 
      96           0 :     SvtCJKOptions aCJKOptions;
      97           0 :     if(!bHtmlMode && aCJKOptions.IsAsianTypographyEnabled())
      98             :     {
      99             :         OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");
     100             :         OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageRangesFunc fail!");
     101           0 :         AddTabPage( TP_PARA_ASIAN,  pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN),       pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN) );
     102             :     }
     103             :     else
     104           0 :         RemoveTabPage(TP_PARA_ASIAN);
     105             : 
     106           0 :     sal_uInt16 nWhich(rCoreSet.GetPool()->GetWhich(SID_ATTR_LRSPACE));
     107           0 :     sal_Bool bLRValid = SFX_ITEM_AVAILABLE <= rCoreSet.GetItemState(nWhich);
     108           0 :     if(bHtmlMode || !bLRValid)
     109           0 :         RemoveTabPage(TP_TABULATOR);
     110             :     else
     111             :     {
     112             :         OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR), "GetTabPageCreatorFunc fail!");
     113             :         OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR), "GetTabPageRangesFunc fail!");
     114           0 :         AddTabPage( TP_TABULATOR,   pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR),        pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR) );
     115             : 
     116             :     }
     117           0 :     if (!bDrawParaDlg)
     118             :     {
     119           0 :         if(!(nDlgMode & DLG_ENVELOP))
     120           0 :             AddTabPage(TP_NUMPARA,   SwParagraphNumTabPage::Create,SwParagraphNumTabPage::GetRanges);
     121             :         else
     122           0 :             RemoveTabPage(TP_NUMPARA);
     123           0 :         if(!bHtmlMode || (nHtmlMode & HTMLMODE_FULL_STYLES))
     124             :         {
     125           0 :             AddTabPage(TP_DROPCAPS,  SwDropCapsPage::Create,        SwDropCapsPage::GetRanges);
     126             :         }
     127             :         else
     128             :         {
     129           0 :             RemoveTabPage(TP_DROPCAPS);
     130             :         }
     131           0 :         if(!bHtmlMode || (nHtmlMode & (HTMLMODE_SOME_STYLES|HTMLMODE_FULL_STYLES)))
     132             :         {
     133             :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
     134             :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
     135           0 :             AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
     136             :         }
     137             :         else
     138             :         {
     139           0 :             RemoveTabPage(TP_BACKGROUND);
     140             :         }
     141             : 
     142             :         OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
     143             :         OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
     144           0 :         AddTabPage(TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
     145             :     }
     146             : 
     147           0 :     if (nDefPage)
     148           0 :         SetCurPageId(nDefPage);
     149           0 : }
     150             : 
     151             : 
     152           0 : SwParaDlg::~SwParaDlg()
     153             : {
     154           0 : }
     155             : 
     156             : 
     157           0 : void SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage)
     158             : {
     159           0 :     SwWrtShell& rSh = rView.GetWrtShell();
     160           0 :     SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
     161             : 
     162             :     // Table borders cannot get any shade in Writer
     163           0 :     if (nId == TP_BORDER)
     164             :     {
     165           0 :         aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_PARA));
     166           0 :         rPage.PageCreated(aSet);
     167             :     }
     168           0 :     else if( nId == TP_PARA_STD )
     169             :     {
     170             :         aSet.Put(SfxUInt16Item(SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH,
     171           0 :                             static_cast< sal_uInt16 >(rSh.GetAnyCurRect(RECT_PAGE_PRT).Width()) ));
     172             : 
     173           0 :         if (!bDrawParaDlg)
     174             :         {
     175             :             // See SvxStdParagraphTabPage::PageCreated: enable RegisterMode, AutoFirstLine, NegativeMode, ContextualMode
     176           0 :             aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x0002|0x0004|0x0008|0x0010));
     177           0 :             aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST, MM50/10));
     178             : 
     179             :         }
     180           0 :         rPage.PageCreated(aSet);
     181             :     }
     182           0 :     else if( TP_PARA_ALIGN == nId)
     183             :     {
     184           0 :         if (!bDrawParaDlg)
     185             :         {
     186           0 :             aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,sal_True));
     187           0 :             rPage.PageCreated(aSet);
     188             :         }
     189             :     }
     190           0 :     else if( TP_PARA_EXT == nId )
     191             :     {
     192             :         // pagebreak only when the cursor is in the body-area and not in a table
     193           0 :         const sal_uInt16 eType = rSh.GetFrmType(0,sal_True);
     194           0 :         if( !(FRMTYPE_BODY & eType) ||
     195           0 :             rSh.GetSelectionType() & nsSelectionType::SEL_TBL )
     196             :         {
     197           0 :             aSet.Put(SfxBoolItem(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,sal_True));
     198           0 :             rPage.PageCreated(aSet);
     199             :         }
     200             :     }
     201           0 :     else if( TP_DROPCAPS == nId )
     202             :     {
     203           0 :         ((SwDropCapsPage&)rPage).SetFormat(sal_False);
     204             :     }
     205           0 :     else if( TP_BACKGROUND == nId )
     206             :     {
     207           0 :       if(!( nHtmlMode & HTMLMODE_ON ) ||
     208             :         nHtmlMode & HTMLMODE_SOME_STYLES)
     209             :         {
     210           0 :             aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_SHOW_SELECTOR));
     211           0 :             rPage.PageCreated(aSet);
     212             :         }
     213             :     }
     214           0 :     else if( TP_NUMPARA == nId)
     215             :     {
     216           0 :         SwTxtFmtColl* pTmpColl = rSh.GetCurTxtFmtColl();
     217           0 :         if( pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle() )
     218             :         {
     219           0 :             ((SwParagraphNumTabPage&)rPage).DisableOutline() ;
     220             :         }
     221             : 
     222           0 :         ((SwParagraphNumTabPage&)rPage).EnableNewStart();
     223           0 :         ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox();
     224           0 :         SfxStyleSheetBasePool* pPool = rView.GetDocShell()->GetStyleSheetPool();
     225           0 :         pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
     226           0 :         const SfxStyleSheetBase* pBase = pPool->First();
     227           0 :         std::set<String> aNames;
     228           0 :         while(pBase)
     229             :         {
     230           0 :             aNames.insert(pBase->GetName());
     231           0 :             pBase = pPool->Next();
     232             :         }
     233           0 :         for(std::set<String>::const_iterator it = aNames.begin(); it != aNames.end(); ++it)
     234           0 :             rBox.InsertEntry(*it);
     235           0 :     }
     236             : 
     237           0 : }
     238             : 
     239             : 
     240             : 
     241             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10