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 "internationaloptions.hxx"
21 : #include "internationaloptions.hrc"
22 : #include <svl/eitem.hxx>
23 : #include <cuires.hrc>
24 : #include "helpid.hrc"
25 : #include <dialmgr.hxx>
26 : #include <svx/dialogs.hrc>
27 :
28 : namespace offapp
29 : {
30 :
31 0 : struct InternationalOptionsPage::IMPL
32 : {
33 : FixedLine m_aFL_DefaultTextDirection;
34 : RadioButton m_aRB_TxtDirLeft2Right;
35 : RadioButton m_aRB_TxtDirRight2Left;
36 : FixedLine m_aFL_SheetView;
37 : CheckBox m_aCB_ShtVwRight2Left;
38 : CheckBox m_aCB_ShtVwCurrentDocOnly;
39 :
40 : sal_Bool m_bEnable_SheetView_Opt : 1;
41 :
42 : inline IMPL( Window* _pParent );
43 :
44 : inline void EnableOption_SheetView( sal_Bool _bEnable = sal_True );
45 : void ShowOption_SheetView( sal_Bool _bShow = sal_True );
46 :
47 : sal_Bool FillItemSet( SfxItemSet& _rSet );
48 : void Reset( const SfxItemSet& _rSet );
49 : };
50 :
51 0 : inline InternationalOptionsPage::IMPL::IMPL( Window* _pParent ) :
52 0 : m_aFL_DefaultTextDirection ( _pParent, CUI_RES( FL_DEFTXTDIRECTION ) )
53 0 : ,m_aRB_TxtDirLeft2Right ( _pParent, CUI_RES( RB_TXTDIR_LEFT2RIGHT ) )
54 0 : ,m_aRB_TxtDirRight2Left ( _pParent, CUI_RES( RB_TXTDIR_RIGHT2LEFT ) )
55 0 : ,m_aFL_SheetView ( _pParent, CUI_RES( FL_SHEETVIEW ) )
56 0 : ,m_aCB_ShtVwRight2Left ( _pParent, CUI_RES( CB_SHTVW_RIGHT2LEFT ) )
57 0 : ,m_aCB_ShtVwCurrentDocOnly ( _pParent, CUI_RES( CB_SHTVW_CURRENTDOCONLY ) )
58 :
59 0 : ,m_bEnable_SheetView_Opt ( sal_False )
60 : {
61 0 : ShowOption_SheetView( m_bEnable_SheetView_Opt );
62 0 : }
63 :
64 : inline void InternationalOptionsPage::IMPL::EnableOption_SheetView( sal_Bool _bEnable )
65 : {
66 : if( m_bEnable_SheetView_Opt != _bEnable )
67 : {
68 : ShowOption_SheetView( _bEnable );
69 :
70 : m_bEnable_SheetView_Opt = _bEnable;
71 : }
72 : }
73 :
74 0 : void InternationalOptionsPage::IMPL::ShowOption_SheetView( sal_Bool _bShow )
75 : {
76 0 : m_aFL_SheetView.Show( _bShow );
77 0 : m_aCB_ShtVwRight2Left.Show( _bShow );
78 0 : m_aCB_ShtVwCurrentDocOnly.Show( _bShow );
79 0 : }
80 :
81 0 : sal_Bool InternationalOptionsPage::IMPL::FillItemSet( SfxItemSet& _rSet )
82 : {
83 : DBG_ASSERT( _rSet.GetPool(), "-InternationalOptionsPage::FillItemSet(): no pool gives rums!" );
84 :
85 : // handling of DefaultTextDirection stuff
86 0 : _rSet.Put( SfxBoolItem( _rSet.GetPool()->GetWhich( SID_ATTR_PARA_LEFT_TO_RIGHT ),
87 0 : m_aRB_TxtDirLeft2Right.IsChecked() ),
88 0 : SID_ATTR_PARA_LEFT_TO_RIGHT );
89 :
90 0 : return sal_True;
91 : }
92 :
93 0 : void InternationalOptionsPage::IMPL::Reset( const SfxItemSet& _rSet )
94 : {
95 : // handling of DefaultTextDirection stuff
96 0 : const SfxBoolItem* pLeft2RightItem = static_cast< const SfxBoolItem* >( GetItem( _rSet, SID_ATTR_PARA_LEFT_TO_RIGHT ) );
97 :
98 : DBG_ASSERT( pLeft2RightItem, "+InternationalOptionsPage::Reset(): SID_ATTR_PARA_LEFT_TO_RIGHT not set!" );
99 :
100 0 : sal_Bool bLeft2Right = pLeft2RightItem? pLeft2RightItem->GetValue() : sal_True;
101 0 : m_aRB_TxtDirLeft2Right.Check( bLeft2Right );
102 :
103 0 : }
104 :
105 0 : InternationalOptionsPage::InternationalOptionsPage( Window* _pParent, const SfxItemSet& _rAttrSet ) :
106 0 : SfxTabPage ( _pParent, CUI_RES( RID_OFA_TP_INTERNATIONAL ), _rAttrSet )
107 :
108 0 : ,m_pImpl ( new IMPL( this ) )
109 : {
110 0 : FreeResource();
111 0 : }
112 :
113 0 : SfxTabPage* InternationalOptionsPage::CreateSd( Window* _pParent, const SfxItemSet& _rAttrSet )
114 : {
115 0 : return new InternationalOptionsPage( _pParent, _rAttrSet );
116 : }
117 :
118 0 : SfxTabPage* InternationalOptionsPage::CreateSc( Window* _pParent, const SfxItemSet& _rAttrSet )
119 : {
120 0 : InternationalOptionsPage* p = new InternationalOptionsPage( _pParent, _rAttrSet );
121 0 : return p;
122 : }
123 :
124 0 : InternationalOptionsPage::~InternationalOptionsPage()
125 : {
126 0 : DELETEZ( m_pImpl );
127 0 : }
128 :
129 0 : sal_Bool InternationalOptionsPage::FillItemSet( SfxItemSet& _rSet )
130 : {
131 0 : return m_pImpl->FillItemSet( _rSet );
132 : }
133 :
134 0 : void InternationalOptionsPage::Reset( const SfxItemSet& _rSet )
135 : {
136 0 : m_pImpl->Reset( _rSet );
137 0 : }
138 :
139 3 : } // namespace offapp
140 :
141 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|