1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <dialmgr.hxx>
23 #include <svl/ctloptions.hxx>
25 // class SvxCTLOptionsPage -----------------------------------------------------
27 IMPL_LINK_NOARG(SvxCTLOptionsPage
, SequenceCheckingCB_Hdl
)
29 bool bIsSequenceChecking
= m_pSequenceCheckingCB
->IsChecked();
30 m_pRestrictedCB
->Enable( bIsSequenceChecking
);
31 m_pTypeReplaceCB
->Enable( bIsSequenceChecking
);
32 // #i48117#: by default restricted and type&replace have to be switched on
33 if(bIsSequenceChecking
)
35 m_pTypeReplaceCB
->Check( true );
36 m_pRestrictedCB
->Check( true );
41 SvxCTLOptionsPage::SvxCTLOptionsPage( Window
* pParent
, const SfxItemSet
& rSet
) :
43 SfxTabPage( pParent
, "OptCTLPage", "cui/ui/optctlpage.ui", rSet
)
46 get( m_pSequenceCheckingCB
, "sequencechecking");
47 get( m_pRestrictedCB
, "restricted");
48 get( m_pTypeReplaceCB
, "typeandreplace");
50 get( m_pMovementLogicalRB
, "movementlogical");
51 get( m_pMovementVisualRB
, "movementvisual");
53 get( m_pNumeralsLB
, "numerals");
55 m_pSequenceCheckingCB
->SetClickHdl( LINK( this, SvxCTLOptionsPage
, SequenceCheckingCB_Hdl
) );
57 m_pNumeralsLB
->SetDropDownLineCount( m_pNumeralsLB
->GetEntryCount() );
60 SvxCTLOptionsPage::~SvxCTLOptionsPage()
64 SfxTabPage
* SvxCTLOptionsPage::Create( Window
* pParent
, const SfxItemSet
& rAttrSet
)
66 return new SvxCTLOptionsPage( pParent
, rAttrSet
);
69 bool SvxCTLOptionsPage::FillItemSet( SfxItemSet
& )
71 bool bModified
= false;
72 SvtCTLOptions aCTLOptions
;
75 bool bChecked
= m_pSequenceCheckingCB
->IsChecked();
76 if ( m_pSequenceCheckingCB
->IsValueChangedFromSaved() )
78 aCTLOptions
.SetCTLSequenceChecking( bChecked
);
82 bChecked
= m_pRestrictedCB
->IsChecked();
83 if( m_pRestrictedCB
->IsValueChangedFromSaved() )
85 aCTLOptions
.SetCTLSequenceCheckingRestricted( bChecked
);
88 bChecked
= m_pTypeReplaceCB
->IsChecked();
89 if( m_pTypeReplaceCB
->IsValueChangedFromSaved())
91 aCTLOptions
.SetCTLSequenceCheckingTypeAndReplace(bChecked
);
95 bool bLogicalChecked
= m_pMovementLogicalRB
->IsChecked();
96 if ( m_pMovementLogicalRB
->IsValueChangedFromSaved() ||
97 m_pMovementVisualRB
->IsValueChangedFromSaved() )
99 SvtCTLOptions::CursorMovement eMovement
=
100 bLogicalChecked
? SvtCTLOptions::MOVEMENT_LOGICAL
: SvtCTLOptions::MOVEMENT_VISUAL
;
101 aCTLOptions
.SetCTLCursorMovement( eMovement
);
105 if ( m_pNumeralsLB
->IsValueChangedFromSaved() )
107 sal_uInt16 nPos
= m_pNumeralsLB
->GetSelectEntryPos();
108 aCTLOptions
.SetCTLTextNumerals( (SvtCTLOptions::TextNumerals
)nPos
);
115 void SvxCTLOptionsPage::Reset( const SfxItemSet
& )
117 SvtCTLOptions aCTLOptions
;
119 m_pSequenceCheckingCB
->Check( aCTLOptions
.IsCTLSequenceChecking() );
120 m_pRestrictedCB
->Check( aCTLOptions
.IsCTLSequenceCheckingRestricted() );
121 m_pTypeReplaceCB
->Check( aCTLOptions
.IsCTLSequenceCheckingTypeAndReplace() );
123 SvtCTLOptions::CursorMovement eMovement
= aCTLOptions
.GetCTLCursorMovement();
126 case SvtCTLOptions::MOVEMENT_LOGICAL
:
127 m_pMovementLogicalRB
->Check();
130 case SvtCTLOptions::MOVEMENT_VISUAL
:
131 m_pMovementVisualRB
->Check();
135 SAL_WARN( "cui.options", "SvxCTLOptionsPage::Reset(): invalid movement enum" );
138 sal_uInt16 nPos
= (sal_uInt16
)aCTLOptions
.GetCTLTextNumerals();
139 DBG_ASSERT( nPos
< m_pNumeralsLB
->GetEntryCount(), "SvxCTLOptionsPage::Reset(): invalid numerals enum" );
140 m_pNumeralsLB
->SelectEntryPos( nPos
);
142 m_pSequenceCheckingCB
->SaveValue();
143 m_pRestrictedCB
->SaveValue();
144 m_pTypeReplaceCB
->SaveValue();
145 m_pMovementLogicalRB
->SaveValue();
146 m_pMovementVisualRB
->SaveValue();
147 m_pNumeralsLB
->SaveValue();
149 bool bIsSequenceChecking
= m_pSequenceCheckingCB
->IsChecked();
150 m_pRestrictedCB
->Enable( bIsSequenceChecking
);
151 m_pTypeReplaceCB
->Enable( bIsSequenceChecking
);
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */