LCOV - code coverage report
Current view: top level - sw/source/ui/chrdlg - pardlg.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 103 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             : #include <sfx2/htmlmode.hxx>
      22             : #include <sfx2/tabdlg.hxx>
      23             : #include <svl/style.hxx>
      24             : #include <svtools/htmlcfg.hxx>
      25             : #include <svl/cjkoptions.hxx>
      26             : #include "docsh.hxx"
      27             : #include "wrtsh.hxx"
      28             : #include "frmatr.hxx"
      29             : #include "view.hxx"
      30             : #include "globals.hrc"
      31             : #include "swuipardlg.hxx"
      32             : #include "pagedesc.hxx"
      33             : #include "paratr.hxx"
      34             : #include "drpcps.hxx"
      35             : #include "uitool.hxx"
      36             : #include "viewopt.hxx"
      37             : #include <numpara.hxx>
      38             : #include "chrdlg.hrc"
      39             : #include "poolfmt.hrc"
      40             : #include <svx/svxids.hrc>
      41             : #include <svl/eitem.hxx>
      42             : #include <svl/intitem.hxx>
      43             : #include <svx/svxdlg.hxx>
      44             : #include <svx/dialogs.hrc>
      45             : #include <svx/flagsdef.hxx>
      46             : 
      47           0 : SwParaDlg::SwParaDlg(vcl::Window *pParent,
      48             :                     SwView& rVw,
      49             :                     const SfxItemSet& rCoreSet,
      50             :                     sal_uInt8 nDialogMode,
      51             :                     const OUString *pTitle,
      52             :                     bool bDraw,
      53             :                     const OString& sDefPage)
      54             :     : SfxTabDialog(pParent,
      55             :                  "ParagraphPropertiesDialog",
      56             :                  "modules/swriter/ui/paradialog.ui",
      57             :                  &rCoreSet,  0 != pTitle)
      58             :     , rView(rVw)
      59             :     , nDlgMode(nDialogMode)
      60             :     , bDrawParaDlg(bDraw)
      61             :     , m_nParaStd(0)
      62             :     , m_nParaAlign(0)
      63             :     , m_nParaExt(0)
      64             :     , m_nParaNumPara(0)
      65             :     , m_nParaDrpCps(0)
      66             :     , m_nParaBckGrnd(0)
      67             :     , m_nParaBorder(0)
      68             :     , m_nAreaId(0)
      69           0 :     , m_nTransparenceId(0)
      70             : {
      71           0 :     nHtmlMode = ::GetHtmlMode(rVw.GetDocShell());
      72           0 :     bool bHtmlMode = (nHtmlMode & HTMLMODE_ON) == HTMLMODE_ON;
      73           0 :     if(pTitle)
      74             :     {
      75             :         // Update title
      76           0 :         SetText(GetText() + SW_RESSTR(STR_TEXTCOLL_HEADER) + *pTitle + ")");
      77             :     }
      78             :     // tabs common to paragraph and draw paragraphs (paragraphs inside a text box)
      79           0 :     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
      80             : 
      81             :     OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageCreatorFunc fail!");
      82             :     OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageRangesFunc fail!");
      83           0 :     m_nParaStd = AddTabPage("labelTP_PARA_STD", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH),
      84           0 :                             pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH) );
      85             : 
      86             :     OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageCreatorFunc fail!");
      87             :     OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageRangesFunc fail!");
      88           0 :     m_nParaAlign = AddTabPage( "labelTP_PARA_ALIGN", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH),
      89           0 :                                pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH) );
      90             : 
      91           0 :     SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
      92           0 :     if (!bDrawParaDlg && (!bHtmlMode || rHtmlOpt.IsPrintLayoutExtension()))
      93             :     {
      94             :         OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageCreatorFunc fail!");
      95             :         OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageRangesFunc fail!");
      96           0 :         m_nParaExt = AddTabPage( "labelTP_PARA_EXT", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH),
      97           0 :                                  pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH) );
      98             : 
      99             :     }
     100             :     else
     101           0 :         RemoveTabPage("labelTP_PARA_EXT");
     102             : 
     103           0 :     SvtCJKOptions aCJKOptions;
     104           0 :     if(!bHtmlMode && aCJKOptions.IsAsianTypographyEnabled())
     105             :     {
     106             :         OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");
     107             :         OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageRangesFunc fail!");
     108           0 :         AddTabPage( "labelTP_PARA_ASIAN",  pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN),
     109           0 :                                    pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN) );
     110             :     }
     111             :     else
     112           0 :         RemoveTabPage("labelTP_PARA_ASIAN");
     113             : 
     114           0 :     const sal_uInt16 nWhich(rCoreSet.GetPool()->GetWhich(SID_ATTR_LRSPACE));
     115           0 :     bool bLRValid = SfxItemState::DEFAULT <= rCoreSet.GetItemState(nWhich);
     116           0 :     if(bHtmlMode || !bLRValid)
     117           0 :         RemoveTabPage("labelTP_TABULATOR");
     118             :     else
     119             :     {
     120             :         OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR), "GetTabPageCreatorFunc fail!");
     121             :         OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR), "GetTabPageRangesFunc fail!");
     122           0 :         AddTabPage( "labelTP_TABULATOR", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR), pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR) );
     123             :     }
     124             : 
     125             :     // remove unwanted tabs for draw text box paragraph properties
     126           0 :     if (bDrawParaDlg)
     127             :     {
     128           0 :         RemoveTabPage("labelTP_NUMPARA");
     129           0 :         RemoveTabPage("labelTP_DROPCAPS");
     130           0 :         RemoveTabPage("labelTP_BACKGROUND");
     131           0 :         RemoveTabPage("labelTP_BORDER");
     132             :     }
     133             :     else
     134             :     {
     135           0 :         if(!(nDlgMode & DLG_ENVELOP))
     136           0 :             m_nParaNumPara = AddTabPage("labelTP_NUMPARA", SwParagraphNumTabPage::Create, SwParagraphNumTabPage::GetRanges);
     137             :         else
     138           0 :             RemoveTabPage("labelTP_NUMPARA");
     139             : 
     140           0 :         m_nParaDrpCps = AddTabPage("labelTP_DROPCAPS",  SwDropCapsPage::Create, SwDropCapsPage::GetRanges);
     141             : 
     142           0 :         if(!bHtmlMode || (nHtmlMode & (HTMLMODE_SOME_STYLES|HTMLMODE_FULL_STYLES)))
     143             :         {
     144             :             //UUUU remove?
     145             :             //OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
     146             :             //OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
     147             :             //m_nParaBckGrnd = AddTabPage("labelTP_BACKGROUND", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
     148             :             //
     149             :             //UUUU add Area and Transparence TabPages
     150           0 :             m_nAreaId = AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
     151           0 :             m_nTransparenceId = AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
     152             :         }
     153             :         else
     154             :         {
     155             :             //UUUU RemoveTabPage("labelTP_BACKGROUND");
     156           0 :             RemoveTabPage("area");
     157           0 :             RemoveTabPage("transparence");
     158             :         }
     159             : 
     160             :         OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
     161             :         OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
     162           0 :         m_nParaBorder = AddTabPage("labelTP_BORDER", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
     163             :     }
     164             : 
     165           0 :     if (!sDefPage.isEmpty())
     166           0 :         SetCurPageId(sDefPage);
     167           0 : }
     168             : 
     169           0 : SwParaDlg::~SwParaDlg()
     170             : {
     171           0 : }
     172             : 
     173           0 : void SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage)
     174             : {
     175           0 :     SwWrtShell& rSh = rView.GetWrtShell();
     176           0 :     SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
     177             : 
     178             :     // Table borders cannot get any shade in Writer
     179           0 :     if (nId == m_nParaBorder)
     180             :     {
     181           0 :         aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_PARA));
     182           0 :         rPage.PageCreated(aSet);
     183             :     }
     184           0 :     else if( nId == m_nParaStd )
     185             :     {
     186             :         aSet.Put(SfxUInt16Item(SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH,
     187           0 :                             static_cast< sal_uInt16 >(rSh.GetAnyCurRect(RECT_PAGE_PRT).Width()) ));
     188             : 
     189           0 :         if (!bDrawParaDlg)
     190             :         {
     191             :             // See SvxStdParagraphTabPage::PageCreated: enable RegisterMode, AutoFirstLine, NegativeMode, ContextualMode
     192           0 :             aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x0002|0x0004|0x0008|0x0010));
     193           0 :             aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST, MM50/10));
     194             : 
     195             :         }
     196           0 :         rPage.PageCreated(aSet);
     197             :     }
     198           0 :     else if( m_nParaAlign == nId)
     199             :     {
     200           0 :         if (!bDrawParaDlg)
     201             :         {
     202           0 :             aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,true));
     203           0 :             rPage.PageCreated(aSet);
     204             :         }
     205             :     }
     206           0 :     else if( m_nParaExt == nId )
     207             :     {
     208             :         // pagebreak only when the cursor is in the body-area and not in a table
     209           0 :         const sal_uInt16 eType = rSh.GetFrmType(0,true);
     210           0 :         if( !(FRMTYPE_BODY & eType) ||
     211           0 :             rSh.GetSelectionType() & nsSelectionType::SEL_TBL )
     212             :         {
     213           0 :             aSet.Put(SfxBoolItem(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,true));
     214           0 :             rPage.PageCreated(aSet);
     215             :         }
     216             :     }
     217           0 :     else if( m_nParaDrpCps == nId )
     218             :     {
     219           0 :         ((SwDropCapsPage&)rPage).SetFormat(false);
     220             :     }
     221           0 :     else if( m_nParaBckGrnd == nId )
     222             :     {
     223           0 :       if(!( nHtmlMode & HTMLMODE_ON ) ||
     224           0 :         nHtmlMode & HTMLMODE_SOME_STYLES)
     225             :         {
     226             :             // Seitenumbruch nur, wenn der Cursor im Body-Bereich und nicht in
     227             :             // einer Tabelle steht
     228           0 :             const sal_uInt16 eType = rSh.GetFrmType(0,true);
     229           0 :             if(!(FRMTYPE_BODY & eType) ||
     230           0 :                 rSh.GetSelectionType() & nsSelectionType::SEL_TBL)
     231             :             {
     232           0 :                 aSet.Put(SfxBoolItem(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,true));
     233           0 :                 rPage.PageCreated(aSet);
     234             :             }
     235             :         }
     236             :     }
     237           0 :     else if( m_nParaNumPara == nId)
     238             :     {
     239           0 :         SwTxtFmtColl* pTmpColl = rSh.GetCurTxtFmtColl();
     240           0 :         if( pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle() )
     241             :         {
     242           0 :             ((SwParagraphNumTabPage&)rPage).DisableOutline() ;
     243             :         }
     244             : 
     245           0 :         ((SwParagraphNumTabPage&)rPage).EnableNewStart();
     246           0 :         ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox();
     247           0 :         SfxStyleSheetBasePool* pPool = rView.GetDocShell()->GetStyleSheetPool();
     248           0 :         pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
     249           0 :         const SfxStyleSheetBase* pBase = pPool->First();
     250           0 :         std::set<OUString> aNames;
     251           0 :         while(pBase)
     252             :         {
     253           0 :             aNames.insert(pBase->GetName());
     254           0 :             pBase = pPool->Next();
     255             :         }
     256           0 :         for(std::set<OUString>::const_iterator it = aNames.begin(); it != aNames.end(); ++it)
     257           0 :             rBox.InsertEntry(*it);
     258             :     }
     259             :     //UUUU inits for Area and Transparency TabPages
     260             :     // The selection attribute lists (XPropertyList derivates, e.g. XColorList for
     261             :     // the color table) need to be added as items (e.g. SvxColorTableItem) to make
     262             :     // these pages find the needed attributes for fill style suggestions.
     263             :     // These are added in SwDocStyleSheet::GetItemSet() for the SFX_STYLE_FAMILY_PARA on
     264             :     // demand, but could also be directly added from the DrawModel.
     265           0 :     else if (m_nAreaId == nId)
     266             :     {
     267           0 :         SfxItemSet aNew(*aSet.GetPool(),
     268             :             SID_COLOR_TABLE, SID_BITMAP_LIST,
     269           0 :             SID_OFFER_IMPORT, SID_OFFER_IMPORT, 0, 0);
     270             : 
     271           0 :         aNew.Put(*GetInputSetImpl());
     272             : 
     273             :         // add flag for direct graphic content selection
     274           0 :         aNew.Put(SfxBoolItem(SID_OFFER_IMPORT, true));
     275             : 
     276           0 :         rPage.PageCreated(aNew);
     277             :     }
     278           0 :     else if (m_nTransparenceId == nId)
     279             :     {
     280           0 :         rPage.PageCreated(*GetInputSetImpl());
     281           0 :     }
     282           0 : }
     283             : 
     284             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10