LCOV - code coverage report
Current view: top level - sw/source/ui/chrdlg - pardlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 88 0.0 %
Date: 2012-08-25 Functions: 0 4 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include "hintids.hxx"
      30                 :            : #include <svx/htmlmode.hxx>
      31                 :            : #include <svl/style.hxx>
      32                 :            : #include <svtools/htmlcfg.hxx>
      33                 :            : #include <svl/cjkoptions.hxx>
      34                 :            : #include "docsh.hxx"
      35                 :            : #include "wrtsh.hxx"
      36                 :            : #include "frmatr.hxx"
      37                 :            : #include "view.hxx"
      38                 :            : #include "globals.hrc"
      39                 :            : #include "swuipardlg.hxx"
      40                 :            : #include "pagedesc.hxx"
      41                 :            : #include "paratr.hxx"
      42                 :            : #include "drpcps.hxx"
      43                 :            : #include "uitool.hxx"
      44                 :            : #include "viewopt.hxx"
      45                 :            : #include <numpara.hxx>
      46                 :            : #include "chrdlg.hrc"
      47                 :            : #include "poolfmt.hrc"
      48                 :            : #include <svx/svxids.hrc>
      49                 :            : #include <svl/eitem.hxx>
      50                 :            : #include <svl/intitem.hxx>
      51                 :            : #include <svx/svxdlg.hxx>
      52                 :            : #include <svx/dialogs.hrc>
      53                 :            : #include <svx/flagsdef.hxx>
      54                 :            : 
      55                 :          0 : SwParaDlg::SwParaDlg(Window *pParent,
      56                 :            :                     SwView& rVw,
      57                 :            :                     const SfxItemSet& rCoreSet,
      58                 :            :                     sal_uInt8 nDialogMode,
      59                 :            :                     const String *pTitle,
      60                 :            :                     sal_Bool bDraw,
      61                 :            :                     sal_uInt16 nDefPage):
      62                 :            : 
      63                 :            :     SfxTabDialog(pParent, bDraw ? SW_RES(DLG_DRAWPARA) : SW_RES(DLG_PARA),
      64                 :            :                     &rCoreSet,  0 != pTitle),
      65                 :            : 
      66                 :            :     rView(rVw),
      67                 :            :     nDlgMode(nDialogMode),
      68                 :          0 :     bDrawParaDlg(bDraw)
      69                 :            : 
      70                 :            : {
      71                 :          0 :     FreeResource();
      72                 :            : 
      73                 :          0 :     nHtmlMode = ::GetHtmlMode(rVw.GetDocShell());
      74                 :          0 :     sal_Bool bHtmlMode = static_cast< sal_Bool >(nHtmlMode & HTMLMODE_ON);
      75                 :          0 :     if(pTitle)
      76                 :            :     {
      77                 :            :         // Update title
      78                 :          0 :         String aTmp( GetText() );
      79                 :          0 :         aTmp += SW_RESSTR(STR_TEXTCOLL_HEADER);
      80                 :          0 :         aTmp += *pTitle;
      81                 :          0 :         aTmp += ')';
      82                 :          0 :         SetText(aTmp);
      83                 :            :     }
      84                 :          0 :     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
      85                 :            : 
      86                 :            :     OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageCreatorFunc fail!");
      87                 :            :     OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageRangesFunc fail!");
      88                 :          0 :     AddTabPage( TP_PARA_STD,    pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH),        pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH) );
      89                 :            : 
      90                 :            :     OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageCreatorFunc fail!");
      91                 :            :     OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageRangesFunc fail!");
      92                 :          0 :     AddTabPage( TP_PARA_ALIGN,  pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH),      pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH) );
      93                 :            : 
      94                 :          0 :     SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
      95                 :          0 :     if (!bDrawParaDlg && (!bHtmlMode || rHtmlOpt.IsPrintLayoutExtension()))
      96                 :            :     {
      97                 :            :         OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageCreatorFunc fail!");
      98                 :            :         OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageRangesFunc fail!");
      99                 :          0 :         AddTabPage( TP_PARA_EXT,    pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH),        pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH) );
     100                 :            : 
     101                 :            :     }
     102                 :            :     else
     103                 :          0 :         RemoveTabPage(TP_PARA_EXT);
     104                 :            : 
     105                 :          0 :     SvtCJKOptions aCJKOptions;
     106                 :          0 :     if(!bHtmlMode && aCJKOptions.IsAsianTypographyEnabled())
     107                 :            :     {
     108                 :            :         OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");
     109                 :            :         OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageRangesFunc fail!");
     110                 :          0 :         AddTabPage( TP_PARA_ASIAN,  pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN),       pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN) );
     111                 :            :     }
     112                 :            :     else
     113                 :          0 :         RemoveTabPage(TP_PARA_ASIAN);
     114                 :            : 
     115                 :          0 :     sal_uInt16 nWhich(rCoreSet.GetPool()->GetWhich(SID_ATTR_LRSPACE));
     116                 :          0 :     sal_Bool bLRValid = SFX_ITEM_AVAILABLE <= rCoreSet.GetItemState(nWhich);
     117                 :          0 :     if(bHtmlMode || !bLRValid)
     118                 :          0 :         RemoveTabPage(TP_TABULATOR);
     119                 :            :     else
     120                 :            :     {
     121                 :            :         OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR), "GetTabPageCreatorFunc fail!");
     122                 :            :         OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR), "GetTabPageRangesFunc fail!");
     123                 :          0 :         AddTabPage( TP_TABULATOR,   pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR),        pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR) );
     124                 :            : 
     125                 :            :     }
     126                 :          0 :     if (!bDrawParaDlg)
     127                 :            :     {
     128                 :          0 :         if(!(nDlgMode & DLG_ENVELOP))
     129                 :          0 :             AddTabPage(TP_NUMPARA,   SwParagraphNumTabPage::Create,SwParagraphNumTabPage::GetRanges);
     130                 :            :         else
     131                 :          0 :             RemoveTabPage(TP_NUMPARA);
     132                 :          0 :         if(!bHtmlMode || (nHtmlMode & HTMLMODE_FULL_STYLES))
     133                 :            :         {
     134                 :          0 :             AddTabPage(TP_DROPCAPS,  SwDropCapsPage::Create,        SwDropCapsPage::GetRanges);
     135                 :            :         }
     136                 :            :         else
     137                 :            :         {
     138                 :          0 :             RemoveTabPage(TP_DROPCAPS);
     139                 :            :         }
     140                 :          0 :         if(!bHtmlMode || (nHtmlMode & (HTMLMODE_SOME_STYLES|HTMLMODE_FULL_STYLES)))
     141                 :            :         {
     142                 :            :             OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
     143                 :            :             OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
     144                 :          0 :             AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
     145                 :            :         }
     146                 :            :         else
     147                 :            :         {
     148                 :          0 :             RemoveTabPage(TP_BACKGROUND);
     149                 :            :         }
     150                 :            : 
     151                 :            :         OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
     152                 :            :         OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
     153                 :          0 :         AddTabPage(TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
     154                 :            :     }
     155                 :            : 
     156                 :          0 :     if (nDefPage)
     157                 :          0 :         SetCurPageId(nDefPage);
     158                 :          0 : }
     159                 :            : 
     160                 :            : 
     161                 :          0 : SwParaDlg::~SwParaDlg()
     162                 :            : {
     163                 :          0 : }
     164                 :            : 
     165                 :            : 
     166                 :          0 : void SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage)
     167                 :            : {
     168                 :          0 :     SwWrtShell& rSh = rView.GetWrtShell();
     169                 :          0 :     SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
     170                 :            : 
     171                 :            :     // Table borders cannot get any shade in Writer
     172                 :          0 :     if (nId == TP_BORDER)
     173                 :            :     {
     174                 :          0 :         aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_PARA));
     175                 :          0 :         rPage.PageCreated(aSet);
     176                 :            :     }
     177                 :          0 :     else if( nId == TP_PARA_STD )
     178                 :            :     {
     179                 :            :         aSet.Put(SfxUInt16Item(SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH,
     180                 :          0 :                             static_cast< sal_uInt16 >(rSh.GetAnyCurRect(RECT_PAGE_PRT).Width()) ));
     181                 :            : 
     182                 :          0 :         if (!bDrawParaDlg)
     183                 :            :         {
     184                 :            :             // See SvxStdParagraphTabPage::PageCreated: enable RegisterMode, AutoFirstLine, NegativeMode, ContextualMode
     185                 :          0 :             aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x0002|0x0004|0x0008|0x0010));
     186                 :          0 :             aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST, MM50/10));
     187                 :            : 
     188                 :            :         }
     189                 :          0 :         rPage.PageCreated(aSet);
     190                 :            :     }
     191                 :          0 :     else if( TP_PARA_ALIGN == nId)
     192                 :            :     {
     193                 :          0 :         if (!bDrawParaDlg)
     194                 :            :         {
     195                 :          0 :             aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,sal_True));
     196                 :          0 :             rPage.PageCreated(aSet);
     197                 :            :         }
     198                 :            :     }
     199                 :          0 :     else if( TP_PARA_EXT == nId )
     200                 :            :     {
     201                 :            :         // pagebreak only when the cursor is in the body-area and not in a table
     202                 :          0 :         const sal_uInt16 eType = rSh.GetFrmType(0,sal_True);
     203                 :          0 :         if( !(FRMTYPE_BODY & eType) ||
     204                 :          0 :             rSh.GetSelectionType() & nsSelectionType::SEL_TBL )
     205                 :            :         {
     206                 :          0 :             aSet.Put(SfxBoolItem(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,sal_True));
     207                 :          0 :             rPage.PageCreated(aSet);
     208                 :            :         }
     209                 :            :     }
     210                 :          0 :     else if( TP_DROPCAPS == nId )
     211                 :            :     {
     212                 :          0 :         ((SwDropCapsPage&)rPage).SetFormat(sal_False);
     213                 :            :     }
     214                 :          0 :     else if( TP_BACKGROUND == nId )
     215                 :            :     {
     216                 :          0 :       if(!( nHtmlMode & HTMLMODE_ON ) ||
     217                 :            :         nHtmlMode & HTMLMODE_SOME_STYLES)
     218                 :            :         {
     219                 :          0 :             aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_SHOW_SELECTOR));
     220                 :          0 :             rPage.PageCreated(aSet);
     221                 :            :         }
     222                 :            :     }
     223                 :          0 :     else if( TP_NUMPARA == nId)
     224                 :            :     {
     225                 :          0 :         SwTxtFmtColl* pTmpColl = rSh.GetCurTxtFmtColl();
     226                 :          0 :         if( pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle() )
     227                 :            :         {
     228                 :          0 :             ((SwParagraphNumTabPage&)rPage).DisableOutline() ;
     229                 :            :         }
     230                 :            : 
     231                 :          0 :         ((SwParagraphNumTabPage&)rPage).EnableNewStart();
     232                 :          0 :         ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox();
     233                 :          0 :         SfxStyleSheetBasePool* pPool = rView.GetDocShell()->GetStyleSheetPool();
     234                 :          0 :         pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
     235                 :          0 :         const SfxStyleSheetBase* pBase = pPool->First();
     236                 :          0 :         std::set<String> aNames;
     237                 :          0 :         while(pBase)
     238                 :            :         {
     239                 :          0 :             aNames.insert(pBase->GetName());
     240                 :          0 :             pBase = pPool->Next();
     241                 :            :         }
     242                 :          0 :         for(std::set<String>::const_iterator it = aNames.begin(); it != aNames.end(); ++it)
     243                 :          0 :             rBox.InsertEntry(*it);
     244                 :          0 :     }
     245                 :            : 
     246                 :          0 : }
     247                 :            : 
     248                 :            : 
     249                 :            : 
     250                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10