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 : : #include "optctl.hxx"
30 : : #include <dialmgr.hxx>
31 : : #include "optctl.hrc"
32 : : #include <cuires.hrc>
33 : : #include <svl/ctloptions.hxx>
34 : :
35 : : // class SvxCTLOptionsPage -----------------------------------------------------
36 : :
37 : 0 : IMPL_LINK_NOARG(SvxCTLOptionsPage, SequenceCheckingCB_Hdl)
38 : : {
39 : 0 : sal_Bool bIsSequenceChecking = m_aSequenceCheckingCB.IsChecked();
40 : 0 : m_aRestrictedCB.Enable( bIsSequenceChecking );
41 : 0 : m_aTypeReplaceCB.Enable( bIsSequenceChecking );
42 : : // #i48117#: by default restricted and type&replace have to be switched on
43 [ # # ]: 0 : if(bIsSequenceChecking)
44 : : {
45 : 0 : m_aTypeReplaceCB.Check( sal_True );
46 : 0 : m_aRestrictedCB.Check( sal_True );
47 : : }
48 : 0 : return 0;
49 : : }
50 : :
51 : 0 : SvxCTLOptionsPage::SvxCTLOptionsPage( Window* pParent, const SfxItemSet& rSet ) :
52 : :
53 : 0 : SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_OPTIONS_CTL ), rSet ),
54 : :
55 [ # # ]: 0 : m_aSequenceCheckingFL ( this, CUI_RES( FL_SEQUENCECHECKING ) ),
56 [ # # ]: 0 : m_aSequenceCheckingCB ( this, CUI_RES( CB_SEQUENCECHECKING ) ),
57 [ # # ]: 0 : m_aRestrictedCB ( this, CUI_RES( CB_RESTRICTED ) ),
58 [ # # ]: 0 : m_aTypeReplaceCB ( this, CUI_RES( CB_TYPE_REPLACE ) ),
59 [ # # ]: 0 : m_aCursorControlFL ( this, CUI_RES( FL_CURSORCONTROL ) ),
60 [ # # ]: 0 : m_aMovementFT ( this, CUI_RES( FT_MOVEMENT ) ),
61 [ # # ]: 0 : m_aMovementLogicalRB ( this, CUI_RES( RB_MOVEMENT_LOGICAL ) ),
62 [ # # ]: 0 : m_aMovementVisualRB ( this, CUI_RES( RB_MOVEMENT_VISUAL ) ),
63 [ # # ]: 0 : m_aGeneralFL ( this, CUI_RES( FL_GENERAL ) ),
64 [ # # ]: 0 : m_aNumeralsFT ( this, CUI_RES( FT_NUMERALS ) ),
65 [ # # ][ # # ]: 0 : m_aNumeralsLB ( this, CUI_RES( LB_NUMERALS ) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
66 : :
67 : : {
68 [ # # ]: 0 : FreeResource();
69 : :
70 [ # # ]: 0 : m_aSequenceCheckingCB.SetClickHdl( LINK( this, SvxCTLOptionsPage, SequenceCheckingCB_Hdl ) );
71 : :
72 [ # # ][ # # ]: 0 : m_aNumeralsLB.SetDropDownLineCount( m_aNumeralsLB.GetEntryCount() );
73 : 0 : }
74 : : // -----------------------------------------------------------------------------
75 [ # # ][ # # ]: 0 : SvxCTLOptionsPage::~SvxCTLOptionsPage()
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
76 : : {
77 [ # # ]: 0 : }
78 : : // -----------------------------------------------------------------------------
79 : 0 : SfxTabPage* SvxCTLOptionsPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
80 : : {
81 [ # # ]: 0 : return new SvxCTLOptionsPage( pParent, rAttrSet );
82 : : }
83 : : // -----------------------------------------------------------------------------
84 : 0 : sal_Bool SvxCTLOptionsPage::FillItemSet( SfxItemSet& )
85 : : {
86 : 0 : sal_Bool bModified = sal_False;
87 [ # # ]: 0 : SvtCTLOptions aCTLOptions;
88 : :
89 : : // Sequence checking
90 [ # # ]: 0 : sal_Bool bChecked = m_aSequenceCheckingCB.IsChecked();
91 [ # # ]: 0 : if ( bChecked != m_aSequenceCheckingCB.GetSavedValue() )
92 : : {
93 [ # # ]: 0 : aCTLOptions.SetCTLSequenceChecking( bChecked );
94 : 0 : bModified = sal_True;
95 : : }
96 : :
97 [ # # ]: 0 : bChecked = m_aRestrictedCB.IsChecked();
98 [ # # ]: 0 : if( bChecked != m_aRestrictedCB.GetSavedValue() )
99 : : {
100 [ # # ]: 0 : aCTLOptions.SetCTLSequenceCheckingRestricted( bChecked );
101 : 0 : bModified = sal_True;
102 : : }
103 [ # # ]: 0 : bChecked = m_aTypeReplaceCB.IsChecked();
104 [ # # ]: 0 : if( bChecked != m_aTypeReplaceCB.GetSavedValue())
105 : : {
106 [ # # ]: 0 : aCTLOptions.SetCTLSequenceCheckingTypeAndReplace(bChecked);
107 : 0 : bModified = sal_True;
108 : : }
109 : :
110 : 0 : sal_Bool bLogicalChecked = m_aMovementLogicalRB.IsChecked();
111 : 0 : sal_Bool bVisualChecked = m_aMovementVisualRB.IsChecked();
112 [ # # ]: 0 : if ( bLogicalChecked != m_aMovementLogicalRB.GetSavedValue() ||
[ # # # # ]
113 : 0 : bVisualChecked != m_aMovementVisualRB.GetSavedValue() )
114 : : {
115 : : SvtCTLOptions::CursorMovement eMovement =
116 : 0 : bLogicalChecked ? SvtCTLOptions::MOVEMENT_LOGICAL : SvtCTLOptions::MOVEMENT_VISUAL;
117 [ # # ]: 0 : aCTLOptions.SetCTLCursorMovement( eMovement );
118 : 0 : bModified = sal_True;
119 : : }
120 : :
121 [ # # ]: 0 : sal_uInt16 nPos = m_aNumeralsLB.GetSelectEntryPos();
122 [ # # ]: 0 : if ( nPos != m_aNumeralsLB.GetSavedValue() )
123 : : {
124 [ # # ]: 0 : aCTLOptions.SetCTLTextNumerals( (SvtCTLOptions::TextNumerals)nPos );
125 : 0 : bModified = sal_True;
126 : : }
127 : :
128 [ # # ]: 0 : return bModified;
129 : : }
130 : : // -----------------------------------------------------------------------------
131 : 0 : void SvxCTLOptionsPage::Reset( const SfxItemSet& )
132 : : {
133 [ # # ]: 0 : SvtCTLOptions aCTLOptions;
134 : :
135 [ # # ][ # # ]: 0 : m_aSequenceCheckingCB.Check( aCTLOptions.IsCTLSequenceChecking() );
136 [ # # ][ # # ]: 0 : m_aRestrictedCB.Check( aCTLOptions.IsCTLSequenceCheckingRestricted() );
137 [ # # ][ # # ]: 0 : m_aTypeReplaceCB.Check( aCTLOptions.IsCTLSequenceCheckingTypeAndReplace() );
138 : :
139 [ # # ]: 0 : SvtCTLOptions::CursorMovement eMovement = aCTLOptions.GetCTLCursorMovement();
140 [ # # # ]: 0 : switch ( eMovement )
141 : : {
142 : : case SvtCTLOptions::MOVEMENT_LOGICAL :
143 [ # # ]: 0 : m_aMovementLogicalRB.Check();
144 : 0 : break;
145 : :
146 : : case SvtCTLOptions::MOVEMENT_VISUAL :
147 [ # # ]: 0 : m_aMovementVisualRB.Check();
148 : 0 : break;
149 : :
150 : : default:
151 : : SAL_WARN( "cui.options", "SvxCTLOptionsPage::Reset(): invalid movement enum" );
152 : : }
153 : :
154 [ # # ]: 0 : sal_uInt16 nPos = (sal_uInt16)aCTLOptions.GetCTLTextNumerals();
155 : : DBG_ASSERT( nPos < m_aNumeralsLB.GetEntryCount(), "SvxCTLOptionsPage::Reset(): invalid numerals enum" );
156 [ # # ]: 0 : m_aNumeralsLB.SelectEntryPos( nPos );
157 : :
158 : 0 : m_aSequenceCheckingCB.SaveValue();
159 : 0 : m_aRestrictedCB.SaveValue();
160 : 0 : m_aTypeReplaceCB.SaveValue();
161 : 0 : m_aMovementLogicalRB.SaveValue();
162 : 0 : m_aMovementVisualRB.SaveValue();
163 [ # # ]: 0 : m_aNumeralsLB.SaveValue();
164 : :
165 [ # # ]: 0 : sal_Bool bIsSequenceChecking = m_aSequenceCheckingCB.IsChecked();
166 [ # # ]: 0 : m_aRestrictedCB.Enable( bIsSequenceChecking );
167 [ # # ][ # # ]: 0 : m_aTypeReplaceCB.Enable( bIsSequenceChecking );
168 : 0 : }
169 : :
170 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|