1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_cui.hxx"
26 
27 #include "internationaloptions.hxx"
28 #include "internationaloptions.hrc"
29 #include <svl/eitem.hxx>
30 #include <cuires.hrc>
31 #include "helpid.hrc"
32 #include <dialmgr.hxx>
33 #include <svx/dialogs.hrc>
34 
35 namespace offapp
36 {
37 
38 	struct InternationalOptionsPage::IMPL
39 	{
40 		FixedLine			m_aFL_DefaultTextDirection;
41 		RadioButton			m_aRB_TxtDirLeft2Right;
42 		RadioButton			m_aRB_TxtDirRight2Left;
43 		FixedLine			m_aFL_SheetView;
44 		CheckBox			m_aCB_ShtVwRight2Left;
45 		CheckBox			m_aCB_ShtVwCurrentDocOnly;
46 
47 		sal_Bool				m_bEnable_SheetView_Opt : 1;
48 
49 		inline				IMPL( Window* _pParent );
50 
51 		inline void			EnableOption_SheetView( sal_Bool _bEnable = sal_True );
52 		void				ShowOption_SheetView( sal_Bool _bShow = sal_True );
53 
54 		sal_Bool				FillItemSet( SfxItemSet& _rSet );
55 		void				Reset( const SfxItemSet& _rSet );
56 	};
57 
IMPL(Window * _pParent)58 	inline InternationalOptionsPage::IMPL::IMPL( Window* _pParent ) :
59 		m_aFL_DefaultTextDirection	( _pParent,	CUI_RES( FL_DEFTXTDIRECTION ) )
60 		,m_aRB_TxtDirLeft2Right		( _pParent,	CUI_RES( RB_TXTDIR_LEFT2RIGHT ) )
61 		,m_aRB_TxtDirRight2Left		( _pParent, CUI_RES( RB_TXTDIR_RIGHT2LEFT ) )
62 		,m_aFL_SheetView			( _pParent, CUI_RES( FL_SHEETVIEW ) )
63 		,m_aCB_ShtVwRight2Left		( _pParent, CUI_RES( CB_SHTVW_RIGHT2LEFT ) )
64 		,m_aCB_ShtVwCurrentDocOnly	( _pParent, CUI_RES( CB_SHTVW_CURRENTDOCONLY ) )
65 
66 		,m_bEnable_SheetView_Opt	( sal_False )
67 	{
68 		ShowOption_SheetView( m_bEnable_SheetView_Opt );
69 	}
70 
EnableOption_SheetView(sal_Bool _bEnable)71 	inline void InternationalOptionsPage::IMPL::EnableOption_SheetView( sal_Bool _bEnable )
72 	{
73 		if( m_bEnable_SheetView_Opt != _bEnable )
74 		{
75 			ShowOption_SheetView( _bEnable );
76 
77 			m_bEnable_SheetView_Opt = _bEnable;
78 		}
79 	}
80 
ShowOption_SheetView(sal_Bool _bShow)81 	void InternationalOptionsPage::IMPL::ShowOption_SheetView( sal_Bool _bShow )
82 	{
83 		m_aFL_SheetView.Show( _bShow );
84 		m_aCB_ShtVwRight2Left.Show( _bShow );
85 		m_aCB_ShtVwCurrentDocOnly.Show( _bShow );
86 	}
87 
FillItemSet(SfxItemSet & _rSet)88 	sal_Bool InternationalOptionsPage::IMPL::FillItemSet( SfxItemSet& _rSet )
89 	{
90 		DBG_ASSERT( _rSet.GetPool(), "-InternationalOptionsPage::FillItemSet(): no pool gives rums!" );
91 
92 		// handling of DefaultTextDirection stuff
93 		_rSet.Put(	SfxBoolItem(	_rSet.GetPool()->GetWhich( SID_ATTR_PARA_LEFT_TO_RIGHT ),
94 									m_aRB_TxtDirLeft2Right.IsChecked() ),
95 					SID_ATTR_PARA_LEFT_TO_RIGHT );
96 
97 		// handling of SheetView stuff
98 //		if( m_bEnable_SheetView_Opt )
99 //		{
100 //		}
101 
102 		return sal_True;
103 	}
104 
Reset(const SfxItemSet & _rSet)105 	void InternationalOptionsPage::IMPL::Reset( const SfxItemSet& _rSet )
106 	{
107 		// handling of DefaultTextDirection stuff
108 		const SfxBoolItem*	pLeft2RightItem = static_cast< const SfxBoolItem* >( GetItem( _rSet, SID_ATTR_PARA_LEFT_TO_RIGHT ) );
109 
110 		DBG_ASSERT( pLeft2RightItem, "+InternationalOptionsPage::Reset(): SID_ATTR_PARA_LEFT_TO_RIGHT not set!" );
111 
112 		sal_Bool				bLeft2Right = pLeft2RightItem? pLeft2RightItem->GetValue() : sal_True;
113 		m_aRB_TxtDirLeft2Right.Check( bLeft2Right );
114 
115 		// handling of SheetView stuff
116 //		if( m_bEnable_SheetView_Opt )
117 //		{
118 //			m_aCB_ShtVwRight2Left.Check( sal_False );
119 //
120 //			m_aCB_ShtVwCurrentDocOnly.Check( sal_False );
121 //		}
122 	}
123 
InternationalOptionsPage(Window * _pParent,const SfxItemSet & _rAttrSet)124 	InternationalOptionsPage::InternationalOptionsPage( Window* _pParent, const SfxItemSet& _rAttrSet ) :
125 		SfxTabPage	( _pParent, CUI_RES( RID_OFA_TP_INTERNATIONAL ), _rAttrSet )
126 
127 		,m_pImpl	( new IMPL( this ) )
128 	{
129 		FreeResource();
130 	}
131 
CreateSd(Window * _pParent,const SfxItemSet & _rAttrSet)132 	SfxTabPage* InternationalOptionsPage::CreateSd( Window* _pParent, const SfxItemSet& _rAttrSet )
133 	{
134 		return new InternationalOptionsPage( _pParent, _rAttrSet );
135 	}
136 
CreateSc(Window * _pParent,const SfxItemSet & _rAttrSet)137 	SfxTabPage* InternationalOptionsPage::CreateSc( Window* _pParent, const SfxItemSet& _rAttrSet )
138 	{
139 		InternationalOptionsPage*	p = new InternationalOptionsPage( _pParent, _rAttrSet );
140 //		p->m_pImpl->EnableOption_SheetView();
141 		return p;
142 	}
143 
~InternationalOptionsPage()144 	InternationalOptionsPage::~InternationalOptionsPage()
145 	{
146 		DELETEZ( m_pImpl );
147 	}
148 
FillItemSet(SfxItemSet & _rSet)149 	sal_Bool InternationalOptionsPage::FillItemSet( SfxItemSet& _rSet )
150 	{
151 		return m_pImpl->FillItemSet( _rSet );
152 	}
153 
Reset(const SfxItemSet & _rSet)154 	void InternationalOptionsPage::Reset( const SfxItemSet& _rSet )
155 	{
156 		m_pImpl->Reset( _rSet );
157 	}
158 
159 }	// /namespace offapp
160 
161