LCOV - code coverage report
Current view: top level - cui/source/options - optctl.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 72 0.0 %
Date: 2014-11-03 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 :     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( vcl::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( vcl::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 :     bool bChecked = m_pSequenceCheckingCB->IsChecked();
      76           0 :     if ( m_pSequenceCheckingCB->IsValueChangedFromSaved() )
      77             :     {
      78           0 :         aCTLOptions.SetCTLSequenceChecking( bChecked );
      79           0 :         bModified = true;
      80             :     }
      81             : 
      82           0 :     bChecked = m_pRestrictedCB->IsChecked();
      83           0 :     if( m_pRestrictedCB->IsValueChangedFromSaved() )
      84             :     {
      85           0 :         aCTLOptions.SetCTLSequenceCheckingRestricted( bChecked );
      86           0 :         bModified = true;
      87             :     }
      88           0 :     bChecked = m_pTypeReplaceCB->IsChecked();
      89           0 :     if( m_pTypeReplaceCB->IsValueChangedFromSaved())
      90             :     {
      91           0 :         aCTLOptions.SetCTLSequenceCheckingTypeAndReplace(bChecked);
      92           0 :         bModified = true;
      93             :     }
      94             : 
      95           0 :     bool bLogicalChecked = m_pMovementLogicalRB->IsChecked();
      96           0 :     if ( m_pMovementLogicalRB->IsValueChangedFromSaved() ||
      97           0 :          m_pMovementVisualRB->IsValueChangedFromSaved() )
      98             :     {
      99             :         SvtCTLOptions::CursorMovement eMovement =
     100           0 :             bLogicalChecked ? SvtCTLOptions::MOVEMENT_LOGICAL : SvtCTLOptions::MOVEMENT_VISUAL;
     101           0 :         aCTLOptions.SetCTLCursorMovement( eMovement );
     102           0 :         bModified = true;
     103             :     }
     104             : 
     105           0 :     if ( m_pNumeralsLB->IsValueChangedFromSaved() )
     106             :     {
     107           0 :         sal_uInt16 nPos = m_pNumeralsLB->GetSelectEntryPos();
     108           0 :         aCTLOptions.SetCTLTextNumerals( (SvtCTLOptions::TextNumerals)nPos );
     109           0 :         bModified = true;
     110             :     }
     111             : 
     112           0 :     return bModified;
     113             : }
     114             : 
     115           0 : void SvxCTLOptionsPage::Reset( const SfxItemSet* )
     116             : {
     117           0 :     SvtCTLOptions aCTLOptions;
     118             : 
     119           0 :     m_pSequenceCheckingCB->Check( aCTLOptions.IsCTLSequenceChecking() );
     120           0 :     m_pRestrictedCB->Check( aCTLOptions.IsCTLSequenceCheckingRestricted() );
     121           0 :     m_pTypeReplaceCB->Check( aCTLOptions.IsCTLSequenceCheckingTypeAndReplace() );
     122             : 
     123           0 :     SvtCTLOptions::CursorMovement eMovement = aCTLOptions.GetCTLCursorMovement();
     124           0 :     switch ( eMovement )
     125             :     {
     126             :         case SvtCTLOptions::MOVEMENT_LOGICAL :
     127           0 :             m_pMovementLogicalRB->Check();
     128           0 :             break;
     129             : 
     130             :         case SvtCTLOptions::MOVEMENT_VISUAL :
     131           0 :             m_pMovementVisualRB->Check();
     132           0 :             break;
     133             : 
     134             :         default:
     135             :             SAL_WARN( "cui.options", "SvxCTLOptionsPage::Reset(): invalid movement enum" );
     136             :     }
     137             : 
     138           0 :     sal_uInt16 nPos = (sal_uInt16)aCTLOptions.GetCTLTextNumerals();
     139             :     DBG_ASSERT( nPos < m_pNumeralsLB->GetEntryCount(), "SvxCTLOptionsPage::Reset(): invalid numerals enum" );
     140           0 :     m_pNumeralsLB->SelectEntryPos( nPos );
     141             : 
     142           0 :     m_pSequenceCheckingCB->SaveValue();
     143           0 :     m_pRestrictedCB->SaveValue();
     144           0 :     m_pTypeReplaceCB->SaveValue();
     145           0 :     m_pMovementLogicalRB->SaveValue();
     146           0 :     m_pMovementVisualRB->SaveValue();
     147           0 :     m_pNumeralsLB->SaveValue();
     148             : 
     149           0 :     bool bIsSequenceChecking = m_pSequenceCheckingCB->IsChecked();
     150           0 :     m_pRestrictedCB->Enable( bIsSequenceChecking );
     151           0 :     m_pTypeReplaceCB->Enable( bIsSequenceChecking );
     152           0 : }
     153             : 
     154             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10