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 .
20 #include "internationaloptions.hxx"
21 #include "internationaloptions.hrc"
22 #include <svl/eitem.hxx>
25 #include <dialmgr.hxx>
26 #include <svx/dialogs.hrc>
31 struct InternationalOptionsPage::IMPL
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
;
40 sal_Bool m_bEnable_SheetView_Opt
: 1;
42 inline IMPL( Window
* _pParent
);
44 inline void EnableOption_SheetView( sal_Bool _bEnable
= sal_True
);
45 void ShowOption_SheetView( sal_Bool _bShow
= sal_True
);
47 sal_Bool
FillItemSet( SfxItemSet
& _rSet
);
48 void Reset( const SfxItemSet
& _rSet
);
51 inline InternationalOptionsPage::IMPL::IMPL( Window
* _pParent
) :
52 m_aFL_DefaultTextDirection ( _pParent
, CUI_RES( FL_DEFTXTDIRECTION
) )
53 ,m_aRB_TxtDirLeft2Right ( _pParent
, CUI_RES( RB_TXTDIR_LEFT2RIGHT
) )
54 ,m_aRB_TxtDirRight2Left ( _pParent
, CUI_RES( RB_TXTDIR_RIGHT2LEFT
) )
55 ,m_aFL_SheetView ( _pParent
, CUI_RES( FL_SHEETVIEW
) )
56 ,m_aCB_ShtVwRight2Left ( _pParent
, CUI_RES( CB_SHTVW_RIGHT2LEFT
) )
57 ,m_aCB_ShtVwCurrentDocOnly ( _pParent
, CUI_RES( CB_SHTVW_CURRENTDOCONLY
) )
59 ,m_bEnable_SheetView_Opt ( sal_False
)
61 ShowOption_SheetView( m_bEnable_SheetView_Opt
);
64 inline void InternationalOptionsPage::IMPL::EnableOption_SheetView( sal_Bool _bEnable
)
66 if( m_bEnable_SheetView_Opt
!= _bEnable
)
68 ShowOption_SheetView( _bEnable
);
70 m_bEnable_SheetView_Opt
= _bEnable
;
74 void InternationalOptionsPage::IMPL::ShowOption_SheetView( sal_Bool _bShow
)
76 m_aFL_SheetView
.Show( _bShow
);
77 m_aCB_ShtVwRight2Left
.Show( _bShow
);
78 m_aCB_ShtVwCurrentDocOnly
.Show( _bShow
);
81 sal_Bool
InternationalOptionsPage::IMPL::FillItemSet( SfxItemSet
& _rSet
)
83 DBG_ASSERT( _rSet
.GetPool(), "-InternationalOptionsPage::FillItemSet(): no pool gives rums!" );
85 // handling of DefaultTextDirection stuff
86 _rSet
.Put( SfxBoolItem( _rSet
.GetPool()->GetWhich( SID_ATTR_PARA_LEFT_TO_RIGHT
),
87 m_aRB_TxtDirLeft2Right
.IsChecked() ),
88 SID_ATTR_PARA_LEFT_TO_RIGHT
);
93 void InternationalOptionsPage::IMPL::Reset( const SfxItemSet
& _rSet
)
95 // handling of DefaultTextDirection stuff
96 const SfxBoolItem
* pLeft2RightItem
= static_cast< const SfxBoolItem
* >( GetItem( _rSet
, SID_ATTR_PARA_LEFT_TO_RIGHT
) );
98 DBG_ASSERT( pLeft2RightItem
, "+InternationalOptionsPage::Reset(): SID_ATTR_PARA_LEFT_TO_RIGHT not set!" );
100 sal_Bool bLeft2Right
= pLeft2RightItem
? pLeft2RightItem
->GetValue() : sal_True
;
101 m_aRB_TxtDirLeft2Right
.Check( bLeft2Right
);
105 InternationalOptionsPage::InternationalOptionsPage( Window
* _pParent
, const SfxItemSet
& _rAttrSet
) :
106 SfxTabPage ( _pParent
, CUI_RES( RID_OFA_TP_INTERNATIONAL
), _rAttrSet
)
108 ,m_pImpl ( new IMPL( this ) )
113 SfxTabPage
* InternationalOptionsPage::CreateSd( Window
* _pParent
, const SfxItemSet
& _rAttrSet
)
115 return new InternationalOptionsPage( _pParent
, _rAttrSet
);
118 SfxTabPage
* InternationalOptionsPage::CreateSc( Window
* _pParent
, const SfxItemSet
& _rAttrSet
)
120 InternationalOptionsPage
* p
= new InternationalOptionsPage( _pParent
, _rAttrSet
);
124 InternationalOptionsPage::~InternationalOptionsPage()
129 sal_Bool
InternationalOptionsPage::FillItemSet( SfxItemSet
& _rSet
)
131 return m_pImpl
->FillItemSet( _rSet
);
134 void InternationalOptionsPage::Reset( const SfxItemSet
& _rSet
)
136 m_pImpl
->Reset( _rSet
);
139 } // namespace offapp
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */