xref: /trunk/main/cui/source/options/internationaloptions.cxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_cui.hxx"
30 
31 #include "internationaloptions.hxx"
32 #include "internationaloptions.hrc"
33 #include <svl/eitem.hxx>
34 #include <cuires.hrc>
35 #include "helpid.hrc"
36 #include <dialmgr.hxx>
37 #include <svx/dialogs.hrc>
38 
39 namespace offapp
40 {
41 
42     struct InternationalOptionsPage::IMPL
43     {
44         FixedLine           m_aFL_DefaultTextDirection;
45         RadioButton         m_aRB_TxtDirLeft2Right;
46         RadioButton         m_aRB_TxtDirRight2Left;
47         FixedLine           m_aFL_SheetView;
48         CheckBox            m_aCB_ShtVwRight2Left;
49         CheckBox            m_aCB_ShtVwCurrentDocOnly;
50 
51         sal_Bool                m_bEnable_SheetView_Opt : 1;
52 
53         inline              IMPL( Window* _pParent );
54 
55         inline void         EnableOption_SheetView( sal_Bool _bEnable = sal_True );
56         void                ShowOption_SheetView( sal_Bool _bShow = sal_True );
57 
58         sal_Bool                FillItemSet( SfxItemSet& _rSet );
59         void                Reset( const SfxItemSet& _rSet );
60     };
61 
62     inline InternationalOptionsPage::IMPL::IMPL( Window* _pParent ) :
63         m_aFL_DefaultTextDirection  ( _pParent, CUI_RES( FL_DEFTXTDIRECTION ) )
64         ,m_aRB_TxtDirLeft2Right     ( _pParent, CUI_RES( RB_TXTDIR_LEFT2RIGHT ) )
65         ,m_aRB_TxtDirRight2Left     ( _pParent, CUI_RES( RB_TXTDIR_RIGHT2LEFT ) )
66         ,m_aFL_SheetView            ( _pParent, CUI_RES( FL_SHEETVIEW ) )
67         ,m_aCB_ShtVwRight2Left      ( _pParent, CUI_RES( CB_SHTVW_RIGHT2LEFT ) )
68         ,m_aCB_ShtVwCurrentDocOnly  ( _pParent, CUI_RES( CB_SHTVW_CURRENTDOCONLY ) )
69 
70         ,m_bEnable_SheetView_Opt    ( sal_False )
71     {
72         ShowOption_SheetView( m_bEnable_SheetView_Opt );
73     }
74 
75     inline void InternationalOptionsPage::IMPL::EnableOption_SheetView( sal_Bool _bEnable )
76     {
77         if( m_bEnable_SheetView_Opt != _bEnable )
78         {
79             ShowOption_SheetView( _bEnable );
80 
81             m_bEnable_SheetView_Opt = _bEnable;
82         }
83     }
84 
85     void InternationalOptionsPage::IMPL::ShowOption_SheetView( sal_Bool _bShow )
86     {
87         m_aFL_SheetView.Show( _bShow );
88         m_aCB_ShtVwRight2Left.Show( _bShow );
89         m_aCB_ShtVwCurrentDocOnly.Show( _bShow );
90     }
91 
92     sal_Bool InternationalOptionsPage::IMPL::FillItemSet( SfxItemSet& _rSet )
93     {
94         DBG_ASSERT( _rSet.GetPool(), "-InternationalOptionsPage::FillItemSet(): no pool gives rums!" );
95 
96         // handling of DefaultTextDirection stuff
97         _rSet.Put(  SfxBoolItem(    _rSet.GetPool()->GetWhich( SID_ATTR_PARA_LEFT_TO_RIGHT ),
98                                     m_aRB_TxtDirLeft2Right.IsChecked() ),
99                     SID_ATTR_PARA_LEFT_TO_RIGHT );
100 
101         // handling of SheetView stuff
102 //      if( m_bEnable_SheetView_Opt )
103 //      {
104 //      }
105 
106         return sal_True;
107     }
108 
109     void InternationalOptionsPage::IMPL::Reset( const SfxItemSet& _rSet )
110     {
111         // handling of DefaultTextDirection stuff
112         const SfxBoolItem*  pLeft2RightItem = static_cast< const SfxBoolItem* >( GetItem( _rSet, SID_ATTR_PARA_LEFT_TO_RIGHT ) );
113 
114         DBG_ASSERT( pLeft2RightItem, "+InternationalOptionsPage::Reset(): SID_ATTR_PARA_LEFT_TO_RIGHT not set!" );
115 
116         sal_Bool                bLeft2Right = pLeft2RightItem? pLeft2RightItem->GetValue() : sal_True;
117         m_aRB_TxtDirLeft2Right.Check( bLeft2Right );
118 
119         // handling of SheetView stuff
120 //      if( m_bEnable_SheetView_Opt )
121 //      {
122 //          m_aCB_ShtVwRight2Left.Check( sal_False );
123 //
124 //          m_aCB_ShtVwCurrentDocOnly.Check( sal_False );
125 //      }
126     }
127 
128     InternationalOptionsPage::InternationalOptionsPage( Window* _pParent, const SfxItemSet& _rAttrSet ) :
129         SfxTabPage  ( _pParent, CUI_RES( RID_OFA_TP_INTERNATIONAL ), _rAttrSet )
130 
131         ,m_pImpl    ( new IMPL( this ) )
132     {
133         FreeResource();
134     }
135 
136     SfxTabPage* InternationalOptionsPage::CreateSd( Window* _pParent, const SfxItemSet& _rAttrSet )
137     {
138         return new InternationalOptionsPage( _pParent, _rAttrSet );
139     }
140 
141     SfxTabPage* InternationalOptionsPage::CreateSc( Window* _pParent, const SfxItemSet& _rAttrSet )
142     {
143         InternationalOptionsPage*   p = new InternationalOptionsPage( _pParent, _rAttrSet );
144 //      p->m_pImpl->EnableOption_SheetView();
145         return p;
146     }
147 
148     InternationalOptionsPage::~InternationalOptionsPage()
149     {
150         DELETEZ( m_pImpl );
151     }
152 
153     sal_Bool InternationalOptionsPage::FillItemSet( SfxItemSet& _rSet )
154     {
155         return m_pImpl->FillItemSet( _rSet );
156     }
157 
158     void InternationalOptionsPage::Reset( const SfxItemSet& _rSet )
159     {
160         m_pImpl->Reset( _rSet );
161     }
162 
163 }   // /namespace offapp
164 
165