LCOV - code coverage report
Current view: top level - cui/source/options - optctl.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 73 0.0 %
Date: 2014-04-14 Functions: 0 10 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 "optctl.hxx"
      21             : #include <dialmgr.hxx>
      22             : #include <cuires.hrc>
      23             : #include <svl/ctloptions.hxx>
      24             : 
      25             : // class SvxCTLOptionsPage -----------------------------------------------------
      26             : 
      27           0 : IMPL_LINK_NOARG(SvxCTLOptionsPage, SequenceCheckingCB_Hdl)
      28             : {
      29           0 :     sal_Bool bIsSequenceChecking = m_pSequenceCheckingCB->IsChecked();
      30           0 :     m_pRestrictedCB->Enable( bIsSequenceChecking );
      31           0 :     m_pTypeReplaceCB->Enable( bIsSequenceChecking );
      32             :     // #i48117#: by default restricted and type&replace have to be switched on
      33           0 :     if(bIsSequenceChecking)
      34             :     {
      35           0 :         m_pTypeReplaceCB->Check( true );
      36           0 :         m_pRestrictedCB->Check( true );
      37             :     }
      38           0 :     return 0;
      39             : }
      40             : 
      41           0 : SvxCTLOptionsPage::SvxCTLOptionsPage( Window* pParent, const SfxItemSet& rSet ) :
      42             : 
      43           0 :     SfxTabPage( pParent, "OptCTLPage", "cui/ui/optctlpage.ui", rSet  )
      44             : 
      45             : {
      46           0 :     get( m_pSequenceCheckingCB, "sequencechecking");
      47           0 :     get( m_pRestrictedCB, "restricted");
      48           0 :     get( m_pTypeReplaceCB, "typeandreplace");
      49             : 
      50           0 :     get( m_pMovementLogicalRB, "movementlogical");
      51           0 :     get( m_pMovementVisualRB, "movementvisual");
      52             : 
      53           0 :     get( m_pNumeralsLB, "numerals");
      54             : 
      55           0 :     m_pSequenceCheckingCB->SetClickHdl( LINK( this, SvxCTLOptionsPage, SequenceCheckingCB_Hdl ) );
      56             : 
      57           0 :     m_pNumeralsLB->SetDropDownLineCount( m_pNumeralsLB->GetEntryCount() );
      58           0 : }
      59             : 
      60           0 : SvxCTLOptionsPage::~SvxCTLOptionsPage()
      61             : {
      62           0 : }
      63             : 
      64           0 : SfxTabPage* SvxCTLOptionsPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
      65             : {
      66           0 :     return new SvxCTLOptionsPage( pParent, rAttrSet );
      67             : }
      68             : 
      69           0 : bool SvxCTLOptionsPage::FillItemSet( SfxItemSet& )
      70             : {
      71           0 :     bool bModified = false;
      72           0 :     SvtCTLOptions aCTLOptions;
      73             : 
      74             :     // Sequence checking
      75           0 :     sal_Bool bChecked = m_pSequenceCheckingCB->IsChecked();
      76           0 :     if ( bChecked != m_pSequenceCheckingCB->GetSavedValue() )
      77             :     {
      78           0 :         aCTLOptions.SetCTLSequenceChecking( bChecked );
      79           0 :         bModified = true;
      80             :     }
      81             : 
      82           0 :     bChecked = m_pRestrictedCB->IsChecked();
      83           0 :     if( bChecked != m_pRestrictedCB->GetSavedValue() )
      84             :     {
      85           0 :         aCTLOptions.SetCTLSequenceCheckingRestricted( bChecked );
      86           0 :         bModified = true;
      87             :     }
      88           0 :     bChecked = m_pTypeReplaceCB->IsChecked();
      89           0 :     if( bChecked != m_pTypeReplaceCB->GetSavedValue())
      90             :     {
      91           0 :         aCTLOptions.SetCTLSequenceCheckingTypeAndReplace(bChecked);
      92           0 :         bModified = true;
      93             :     }
      94             : 
      95           0 :     bool bLogicalChecked = m_pMovementLogicalRB->IsChecked();
      96           0 :     bool bVisualChecked = m_pMovementVisualRB->IsChecked();
      97           0 :     if ( bLogicalChecked != m_pMovementLogicalRB->GetSavedValue() ||
      98           0 :          bVisualChecked != m_pMovementVisualRB->GetSavedValue() )
      99             :     {
     100             :         SvtCTLOptions::CursorMovement eMovement =
     101           0 :             bLogicalChecked ? SvtCTLOptions::MOVEMENT_LOGICAL : SvtCTLOptions::MOVEMENT_VISUAL;
     102           0 :         aCTLOptions.SetCTLCursorMovement( eMovement );
     103           0 :         bModified = true;
     104             :     }
     105             : 
     106           0 :     sal_uInt16 nPos = m_pNumeralsLB->GetSelectEntryPos();
     107           0 :     if ( nPos != m_pNumeralsLB->GetSavedValue() )
     108             :     {
     109           0 :         aCTLOptions.SetCTLTextNumerals( (SvtCTLOptions::TextNumerals)nPos );
     110           0 :         bModified = true;
     111             :     }
     112             : 
     113           0 :     return bModified;
     114             : }
     115             : 
     116           0 : void SvxCTLOptionsPage::Reset( const SfxItemSet& )
     117             : {
     118           0 :     SvtCTLOptions aCTLOptions;
     119             : 
     120           0 :     m_pSequenceCheckingCB->Check( aCTLOptions.IsCTLSequenceChecking() );
     121           0 :     m_pRestrictedCB->Check( aCTLOptions.IsCTLSequenceCheckingRestricted() );
     122           0 :     m_pTypeReplaceCB->Check( aCTLOptions.IsCTLSequenceCheckingTypeAndReplace() );
     123             : 
     124           0 :     SvtCTLOptions::CursorMovement eMovement = aCTLOptions.GetCTLCursorMovement();
     125           0 :     switch ( eMovement )
     126             :     {
     127             :         case SvtCTLOptions::MOVEMENT_LOGICAL :
     128           0 :             m_pMovementLogicalRB->Check();
     129           0 :             break;
     130             : 
     131             :         case SvtCTLOptions::MOVEMENT_VISUAL :
     132           0 :             m_pMovementVisualRB->Check();
     133           0 :             break;
     134             : 
     135             :         default:
     136             :             SAL_WARN( "cui.options", "SvxCTLOptionsPage::Reset(): invalid movement enum" );
     137             :     }
     138             : 
     139           0 :     sal_uInt16 nPos = (sal_uInt16)aCTLOptions.GetCTLTextNumerals();
     140             :     DBG_ASSERT( nPos < m_pNumeralsLB->GetEntryCount(), "SvxCTLOptionsPage::Reset(): invalid numerals enum" );
     141           0 :     m_pNumeralsLB->SelectEntryPos( nPos );
     142             : 
     143           0 :     m_pSequenceCheckingCB->SaveValue();
     144           0 :     m_pRestrictedCB->SaveValue();
     145           0 :     m_pTypeReplaceCB->SaveValue();
     146           0 :     m_pMovementLogicalRB->SaveValue();
     147           0 :     m_pMovementVisualRB->SaveValue();
     148           0 :     m_pNumeralsLB->SaveValue();
     149             : 
     150           0 :     sal_Bool bIsSequenceChecking = m_pSequenceCheckingCB->IsChecked();
     151           0 :     m_pRestrictedCB->Enable( bIsSequenceChecking );
     152           0 :     m_pTypeReplaceCB->Enable( bIsSequenceChecking );
     153           0 : }
     154             : 
     155             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10