LCOV - code coverage report
Current view: top level - sd/source/ui/dlg - paragr.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 75 0.0 %
Date: 2012-08-25 Functions: 0 11 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                 :            : 
      30                 :            : #ifdef SD_DLLIMPLEMENTATION
      31                 :            : #undef SD_DLLIMPLEMENTATION
      32                 :            : #endif
      33                 :            : 
      34                 :            : #include <vcl/field.hxx>
      35                 :            : 
      36                 :            : #include <svl/cjkoptions.hxx>
      37                 :            : #include <svl/eitem.hxx>
      38                 :            : #include <svl/intitem.hxx>
      39                 :            : 
      40                 :            : #include <editeng/editdata.hxx>
      41                 :            : #include <svx/dialogs.hrc>
      42                 :            : #include <editeng/eeitem.hxx>
      43                 :            : #include <svx/flagsdef.hxx>
      44                 :            : 
      45                 :            : #include "eetext.hxx"
      46                 :            : #include "paragr.hxx"
      47                 :            : #include "sdresid.hxx"
      48                 :            : #include "glob.hrc"
      49                 :            : #include "sdattr.hrc"
      50                 :            : 
      51                 :            : class SdParagraphNumTabPage : public SfxTabPage
      52                 :            : {
      53                 :            : public:
      54                 :            :     SdParagraphNumTabPage(Window* pParent, const SfxItemSet& rSet );
      55                 :            :     ~SdParagraphNumTabPage();
      56                 :            : 
      57                 :            :     static SfxTabPage*  Create( Window* pParent, const SfxItemSet& rSet );
      58                 :            :     static sal_uInt16*      GetRanges();
      59                 :            : 
      60                 :            :     virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
      61                 :            :     virtual void        Reset( const SfxItemSet& rSet );
      62                 :            : 
      63                 :            : private:
      64                 :            :     TriStateBox     maNewStartCB;
      65                 :            :     TriStateBox     maNewStartNumberCB;
      66                 :            :     NumericField    maNewStartNF;
      67                 :            :     bool            mbModified;
      68                 :            : 
      69                 :            :     DECL_LINK( ImplNewStartHdl, void* );
      70                 :            : };
      71                 :            : 
      72                 :          0 : SdParagraphNumTabPage::SdParagraphNumTabPage(Window* pParent, const SfxItemSet& rAttr )
      73                 :            : : SfxTabPage(pParent, SdResId(RID_TABPAGE_PARA_NUMBERING), rAttr)
      74                 :            : , maNewStartCB( this, SdResId( CB_NEW_START ) )
      75                 :            : , maNewStartNumberCB( this, SdResId( CB_NUMBER_NEW_START ) )
      76                 :            : , maNewStartNF( this, SdResId( NF_NEW_START ) )
      77                 :          0 : , mbModified(false)
      78                 :            : {
      79                 :          0 :     FreeResource();
      80                 :            : 
      81                 :          0 :     maNewStartCB.SetClickHdl(LINK(this, SdParagraphNumTabPage, ImplNewStartHdl));
      82                 :          0 :     maNewStartNumberCB.SetClickHdl(LINK(this, SdParagraphNumTabPage, ImplNewStartHdl));
      83                 :          0 : }
      84                 :            : 
      85                 :          0 : SdParagraphNumTabPage::~SdParagraphNumTabPage()
      86                 :            : {
      87                 :          0 : }
      88                 :            : 
      89                 :          0 : SfxTabPage* SdParagraphNumTabPage::Create(Window *pParent, const SfxItemSet & rAttrSet)
      90                 :            : {
      91                 :          0 :     return new SdParagraphNumTabPage( pParent, rAttrSet );
      92                 :            : }
      93                 :            : 
      94                 :          0 : sal_uInt16* SdParagraphNumTabPage::GetRanges()
      95                 :            : {
      96                 :            :     static sal_uInt16 aRange[] =
      97                 :            :     {
      98                 :            :         ATTR_PARANUMBERING_START, ATTR_PARANUMBERING_END,
      99                 :            :         0
     100                 :            :     };
     101                 :            : 
     102                 :          0 :     return aRange;
     103                 :            : }
     104                 :            : 
     105                 :          0 : sal_Bool SdParagraphNumTabPage::FillItemSet( SfxItemSet& rSet )
     106                 :            : {
     107                 :          0 :     if(maNewStartCB.GetState() != maNewStartCB.GetSavedValue() ||
     108                 :          0 :         maNewStartNumberCB.GetState() != maNewStartNumberCB.GetSavedValue()||
     109                 :          0 :         maNewStartNF.GetText() != maNewStartNF.GetSavedValue())
     110                 :            :     {
     111                 :          0 :         mbModified = true;
     112                 :          0 :         sal_Bool bNewStartChecked = STATE_CHECK == maNewStartCB.GetState();
     113                 :          0 :         sal_Bool bNumberNewStartChecked = STATE_CHECK == maNewStartNumberCB.GetState();
     114                 :          0 :         rSet.Put(SfxBoolItem(ATTR_NUMBER_NEWSTART, bNewStartChecked));
     115                 :            : 
     116                 :          0 :         const sal_Int16 nStartAt = (sal_Int16)maNewStartNF.GetValue();
     117                 :          0 :         rSet.Put(SfxInt16Item(ATTR_NUMBER_NEWSTART_AT, bNumberNewStartChecked && bNewStartChecked ? nStartAt : -1));
     118                 :            :     }
     119                 :            : 
     120                 :          0 :     return mbModified;
     121                 :            : }
     122                 :            : 
     123                 :          0 : void SdParagraphNumTabPage::Reset( const SfxItemSet& rSet )
     124                 :            : {
     125                 :          0 :     SfxItemState eItemState = rSet.GetItemState( ATTR_NUMBER_NEWSTART );
     126                 :          0 :     if(eItemState > SFX_ITEM_AVAILABLE )
     127                 :            :     {
     128                 :          0 :         const SfxBoolItem& rStart = (const SfxBoolItem&)rSet.Get(ATTR_NUMBER_NEWSTART);
     129                 :          0 :         maNewStartCB.SetState( rStart.GetValue() ? STATE_CHECK : STATE_NOCHECK );
     130                 :          0 :         maNewStartCB.EnableTriState(sal_False);
     131                 :            :     }
     132                 :            :     else
     133                 :            :     {
     134                 :          0 :         maNewStartCB.SetState(STATE_DONTKNOW);
     135                 :          0 :         maNewStartCB.Disable();
     136                 :            :     }
     137                 :          0 :     maNewStartCB.SaveValue();
     138                 :            : 
     139                 :          0 :     eItemState = rSet.GetItemState( ATTR_NUMBER_NEWSTART_AT);
     140                 :          0 :     if( eItemState > SFX_ITEM_AVAILABLE )
     141                 :            :     {
     142                 :          0 :         sal_Int16 nNewStart = ((const SfxInt16Item&)rSet.Get(ATTR_NUMBER_NEWSTART_AT)).GetValue();
     143                 :          0 :         maNewStartNumberCB.Check(-1 != nNewStart);
     144                 :          0 :         if(-1 == nNewStart)
     145                 :          0 :             nNewStart = 1;
     146                 :            : 
     147                 :          0 :         maNewStartNF.SetValue(nNewStart);
     148                 :          0 :         maNewStartNumberCB.EnableTriState(sal_False);
     149                 :            :     }
     150                 :            :     else
     151                 :            :     {
     152                 :          0 :         maNewStartCB.SetState(STATE_DONTKNOW);
     153                 :            :     }
     154                 :          0 :     ImplNewStartHdl(&maNewStartCB);
     155                 :          0 :     maNewStartNF.SaveValue();
     156                 :          0 :     maNewStartNumberCB.SaveValue();
     157                 :          0 :     mbModified = sal_False;
     158                 :          0 : }
     159                 :            : 
     160                 :          0 : IMPL_LINK_NOARG(SdParagraphNumTabPage, ImplNewStartHdl)
     161                 :            : {
     162                 :          0 :     sal_Bool bEnable = maNewStartCB.IsChecked();
     163                 :          0 :     maNewStartNumberCB.Enable(bEnable);
     164                 :          0 :     maNewStartNF.Enable(bEnable && maNewStartNumberCB.IsChecked());
     165                 :          0 :     return 0;
     166                 :            : }
     167                 :            : 
     168                 :          0 : SdParagraphDlg::SdParagraphDlg( Window* pParent, const SfxItemSet* pAttr )
     169                 :            : : SfxTabDialog( pParent, SdResId( TAB_PARAGRAPH ), pAttr )
     170                 :          0 : , rOutAttrs( *pAttr )
     171                 :            : {
     172                 :          0 :     FreeResource();
     173                 :            : 
     174                 :          0 :     AddTabPage( RID_SVXPAGE_STD_PARAGRAPH );
     175                 :            : 
     176                 :          0 :     SvtCJKOptions aCJKOptions;
     177                 :          0 :     if( aCJKOptions.IsAsianTypographyEnabled() )
     178                 :          0 :         AddTabPage( RID_SVXPAGE_PARA_ASIAN);
     179                 :            :     else
     180                 :          0 :         RemoveTabPage( RID_SVXPAGE_PARA_ASIAN );
     181                 :            : 
     182                 :          0 :     AddTabPage( RID_SVXPAGE_ALIGN_PARAGRAPH );
     183                 :            : 
     184                 :          0 :     static const sal_Bool bShowParaNumbering = ( getenv( "SD_SHOW_NUMBERING_PAGE" ) != NULL );
     185                 :          0 :     if( bShowParaNumbering )
     186                 :          0 :         AddTabPage( RID_TABPAGE_PARA_NUMBERING, SdParagraphNumTabPage::Create, SdParagraphNumTabPage::GetRanges );
     187                 :            :     else
     188                 :          0 :         RemoveTabPage( RID_TABPAGE_PARA_NUMBERING );
     189                 :            : 
     190                 :          0 :        AddTabPage( RID_SVXPAGE_TABULATOR );
     191                 :          0 : }
     192                 :            : 
     193                 :          0 : void SdParagraphDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
     194                 :            : {
     195                 :          0 :     SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
     196                 :          0 :     switch( nId )
     197                 :            :     {
     198                 :            :     case RID_SVXPAGE_STD_PARAGRAPH:
     199                 :          0 :         aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST, MM50/2));
     200                 :          0 :         rPage.PageCreated(aSet);
     201                 :          0 :         break;
     202                 :            :     default:
     203                 :          0 :         break;
     204                 :          0 :     }
     205                 :          0 : }
     206                 :            : 
     207                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10