LCOV - code coverage report
Current view: top level - sd/source/ui/dlg - paragr.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 81 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 14 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 <vcl/field.hxx>
      21             : 
      22             : #include <svl/cjkoptions.hxx>
      23             : #include <svl/eitem.hxx>
      24             : #include <svl/intitem.hxx>
      25             : 
      26             : #include <editeng/editdata.hxx>
      27             : #include <svx/dialogs.hrc>
      28             : #include <editeng/eeitem.hxx>
      29             : #include <svx/flagsdef.hxx>
      30             : 
      31             : #include <editeng/outliner.hxx>
      32             : #include "paragr.hxx"
      33             : #include "sdresid.hxx"
      34             : #include "glob.hrc"
      35             : #include "sdattr.hrc"
      36             : 
      37             : class SdParagraphNumTabPage : public SfxTabPage
      38             : {
      39             : public:
      40             :     SdParagraphNumTabPage(vcl::Window* pParent, const SfxItemSet& rSet );
      41             :     virtual ~SdParagraphNumTabPage();
      42             :     virtual void dispose() SAL_OVERRIDE;
      43             : 
      44             :     static VclPtr<SfxTabPage>  Create( vcl::Window* pParent, const SfxItemSet* rSet );
      45             :     static const sal_uInt16*  GetRanges();
      46             : 
      47             :     virtual bool        FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
      48             :     virtual void        Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
      49             : 
      50             : private:
      51             :     VclPtr<TriStateBox>     m_pNewStartCB;
      52             :     VclPtr<TriStateBox>     m_pNewStartNumberCB;
      53             :     VclPtr<NumericField>    m_pNewStartNF;
      54             :     bool             mbModified;
      55             : 
      56             :     DECL_LINK( ImplNewStartHdl, void* );
      57             : };
      58             : 
      59           0 : SdParagraphNumTabPage::SdParagraphNumTabPage(vcl::Window* pParent, const SfxItemSet& rAttr )
      60             :                       : SfxTabPage(pParent,
      61             :                                    "DrawParaNumbering",
      62             :                                    "modules/sdraw/ui/paranumberingtab.ui",
      63             :                                    &rAttr),
      64           0 :                         mbModified(false)
      65             : {
      66           0 :     get(m_pNewStartCB,"checkbuttonCB_NEW_START");
      67           0 :     get(m_pNewStartNumberCB,"checkbuttonCB_NUMBER_NEW_START");
      68           0 :     get(m_pNewStartNF,"spinbuttonNF_NEW_START");
      69             : 
      70           0 :     m_pNewStartCB->SetClickHdl(LINK(this, SdParagraphNumTabPage, ImplNewStartHdl));
      71           0 :     m_pNewStartNumberCB->SetClickHdl(LINK(this, SdParagraphNumTabPage, ImplNewStartHdl));
      72           0 : }
      73             : 
      74           0 : SdParagraphNumTabPage::~SdParagraphNumTabPage()
      75             : {
      76           0 :     disposeOnce();
      77           0 : }
      78             : 
      79           0 : void SdParagraphNumTabPage::dispose()
      80             : {
      81           0 :     m_pNewStartCB.clear();
      82           0 :     m_pNewStartNumberCB.clear();
      83           0 :     m_pNewStartNF.clear();
      84           0 :     SfxTabPage::dispose();
      85           0 : }
      86             : 
      87           0 : VclPtr<SfxTabPage> SdParagraphNumTabPage::Create(vcl::Window *pParent, const SfxItemSet * rAttrSet)
      88             : {
      89           0 :     return VclPtr<SdParagraphNumTabPage>::Create( pParent, *rAttrSet );
      90             : }
      91             : 
      92           0 : const sal_uInt16* SdParagraphNumTabPage::GetRanges()
      93             : {
      94             :     static const sal_uInt16 aRange[] =
      95             :     {
      96             :         ATTR_PARANUMBERING_START, ATTR_PARANUMBERING_END,
      97             :         0
      98             :     };
      99             : 
     100           0 :     return aRange;
     101             : }
     102             : 
     103           0 : bool SdParagraphNumTabPage::FillItemSet( SfxItemSet* rSet )
     104             : {
     105           0 :     if(m_pNewStartCB->IsValueChangedFromSaved() ||
     106           0 :        m_pNewStartNumberCB->IsValueChangedFromSaved()||
     107           0 :        m_pNewStartNF->IsValueChangedFromSaved())
     108             :     {
     109           0 :         mbModified = true;
     110           0 :         bool bNewStartChecked = TRISTATE_TRUE == m_pNewStartCB->GetState();
     111           0 :         bool bNumberNewStartChecked = TRISTATE_TRUE == m_pNewStartNumberCB->GetState();
     112           0 :         rSet->Put(SfxBoolItem(ATTR_NUMBER_NEWSTART, bNewStartChecked));
     113             : 
     114           0 :         const sal_Int16 nStartAt = (sal_Int16)m_pNewStartNF->GetValue();
     115           0 :         rSet->Put(SfxInt16Item(ATTR_NUMBER_NEWSTART_AT, bNumberNewStartChecked && bNewStartChecked ? nStartAt : -1));
     116             :     }
     117             : 
     118           0 :     return mbModified;
     119             : }
     120             : 
     121           0 : void SdParagraphNumTabPage::Reset( const SfxItemSet* rSet )
     122             : {
     123           0 :     SfxItemState eItemState = rSet->GetItemState( ATTR_NUMBER_NEWSTART );
     124           0 :     if(eItemState > SfxItemState::DEFAULT )
     125             :     {
     126           0 :         const SfxBoolItem& rStart = static_cast<const SfxBoolItem&>(rSet->Get(ATTR_NUMBER_NEWSTART));
     127           0 :         m_pNewStartCB->SetState( rStart.GetValue() ? TRISTATE_TRUE : TRISTATE_FALSE );
     128           0 :         m_pNewStartCB->EnableTriState(false);
     129             :     }
     130             :     else
     131             :     {
     132           0 :         m_pNewStartCB->SetState(TRISTATE_INDET);
     133           0 :         m_pNewStartCB->Disable();
     134             :     }
     135           0 :     m_pNewStartCB->SaveValue();
     136             : 
     137           0 :     eItemState = rSet->GetItemState( ATTR_NUMBER_NEWSTART_AT);
     138           0 :     if( eItemState > SfxItemState::DEFAULT )
     139             :     {
     140           0 :         sal_Int16 nNewStart = static_cast<const SfxInt16Item&>(rSet->Get(ATTR_NUMBER_NEWSTART_AT)).GetValue();
     141           0 :         m_pNewStartNumberCB->Check(-1 != nNewStart);
     142           0 :         if(-1 == nNewStart)
     143           0 :             nNewStart = 1;
     144             : 
     145           0 :         m_pNewStartNF->SetValue(nNewStart);
     146           0 :         m_pNewStartNumberCB->EnableTriState(false);
     147             :     }
     148             :     else
     149             :     {
     150           0 :         m_pNewStartCB->SetState(TRISTATE_INDET);
     151             :     }
     152           0 :     ImplNewStartHdl(m_pNewStartCB);
     153           0 :     m_pNewStartNF->SaveValue();
     154           0 :     m_pNewStartNumberCB->SaveValue();
     155           0 :     mbModified = false;
     156           0 : }
     157             : 
     158           0 : IMPL_LINK_NOARG(SdParagraphNumTabPage, ImplNewStartHdl)
     159             : {
     160           0 :     bool bEnable = m_pNewStartCB->IsChecked();
     161           0 :     m_pNewStartNumberCB->Enable(bEnable);
     162           0 :     m_pNewStartNF->Enable(bEnable && m_pNewStartNumberCB->IsChecked());
     163           0 :     return 0;
     164             : }
     165             : 
     166           0 : SdParagraphDlg::SdParagraphDlg( vcl::Window* pParent, const SfxItemSet* pAttr )
     167             :                : SfxTabDialog( pParent,
     168             :                                "DrawParagraphPropertiesDialog",
     169             :                                "modules/sdraw/ui/drawparadialog.ui",
     170           0 :                                pAttr )
     171             : {
     172           0 :     m_nParaStd = AddTabPage( "labelTP_PARA_STD", RID_SVXPAGE_STD_PARAGRAPH);
     173             : 
     174           0 :     SvtCJKOptions aCJKOptions;
     175           0 :     if( aCJKOptions.IsAsianTypographyEnabled() )
     176           0 :         AddTabPage( "labelTP_PARA_ASIAN", RID_SVXPAGE_PARA_ASIAN);
     177             :     else
     178           0 :         RemoveTabPage( "labelTP_PARA_ASIAN" );
     179             : 
     180           0 :     AddTabPage( "labelTP_PARA_ALIGN", RID_SVXPAGE_ALIGN_PARAGRAPH);
     181             : 
     182           0 :     static const bool bShowParaNumbering = ( getenv( "SD_SHOW_NUMBERING_PAGE" ) != NULL );
     183           0 :     if( bShowParaNumbering )
     184           0 :         AddTabPage( "labelNUMBERING", SdParagraphNumTabPage::Create, SdParagraphNumTabPage::GetRanges );
     185             :     else
     186           0 :         RemoveTabPage( "labelNUMBERING" );
     187             : 
     188           0 :       AddTabPage("labelTP_TABULATOR", RID_SVXPAGE_TABULATOR);
     189           0 : }
     190             : 
     191           0 : void SdParagraphDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
     192             : {
     193           0 :     SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
     194           0 :     if (m_nParaStd == nId)
     195             :     {
     196           0 :         aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST, MM50/2));
     197           0 :         rPage.PageCreated(aSet);
     198           0 :     }
     199           0 : }
     200             : 
     201             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11