1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: internationaloptions.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #ifdef SVX_DLLIMPLEMENTATION
35 #undef SVX_DLLIMPLEMENTATION
37 #include "internationaloptions.hxx"
38 #ifndef _OFFAPP_INTERNATIONALOPTIONS_HRC_
39 #include "internationaloptions.hrc"
41 #include <svtools/eitem.hxx>
43 #include <svx/dialogs.hrc>
45 #include <svx/dialmgr.hxx>
50 struct InternationalOptionsPage::IMPL
52 FixedLine m_aFL_DefaultTextDirection
;
53 RadioButton m_aRB_TxtDirLeft2Right
;
54 RadioButton m_aRB_TxtDirRight2Left
;
55 FixedLine m_aFL_SheetView
;
56 CheckBox m_aCB_ShtVwRight2Left
;
57 CheckBox m_aCB_ShtVwCurrentDocOnly
;
59 BOOL m_bEnable_SheetView_Opt
: 1;
61 inline IMPL( Window
* _pParent
);
63 inline void EnableOption_SheetView( BOOL _bEnable
= TRUE
);
64 void ShowOption_SheetView( BOOL _bShow
= TRUE
);
66 BOOL
FillItemSet( SfxItemSet
& _rSet
);
67 void Reset( const SfxItemSet
& _rSet
);
70 inline InternationalOptionsPage::IMPL::IMPL( Window
* _pParent
) :
71 m_aFL_DefaultTextDirection ( _pParent
, SVX_RES( FL_DEFTXTDIRECTION
) )
72 ,m_aRB_TxtDirLeft2Right ( _pParent
, SVX_RES( RB_TXTDIR_LEFT2RIGHT
) )
73 ,m_aRB_TxtDirRight2Left ( _pParent
, SVX_RES( RB_TXTDIR_RIGHT2LEFT
) )
74 ,m_aFL_SheetView ( _pParent
, SVX_RES( FL_SHEETVIEW
) )
75 ,m_aCB_ShtVwRight2Left ( _pParent
, SVX_RES( CB_SHTVW_RIGHT2LEFT
) )
76 ,m_aCB_ShtVwCurrentDocOnly ( _pParent
, SVX_RES( CB_SHTVW_CURRENTDOCONLY
) )
78 ,m_bEnable_SheetView_Opt ( FALSE
)
80 ShowOption_SheetView( m_bEnable_SheetView_Opt
);
83 inline void InternationalOptionsPage::IMPL::EnableOption_SheetView( BOOL _bEnable
)
85 if( m_bEnable_SheetView_Opt
!= _bEnable
)
87 ShowOption_SheetView( _bEnable
);
89 m_bEnable_SheetView_Opt
= _bEnable
;
93 void InternationalOptionsPage::IMPL::ShowOption_SheetView( BOOL _bShow
)
95 m_aFL_SheetView
.Show( _bShow
);
96 m_aCB_ShtVwRight2Left
.Show( _bShow
);
97 m_aCB_ShtVwCurrentDocOnly
.Show( _bShow
);
100 BOOL
InternationalOptionsPage::IMPL::FillItemSet( SfxItemSet
& _rSet
)
102 DBG_ASSERT( _rSet
.GetPool(), "-InternationalOptionsPage::FillItemSet(): no pool gives rums!" );
104 // handling of DefaultTextDirection stuff
105 _rSet
.Put( SfxBoolItem( _rSet
.GetPool()->GetWhich( SID_ATTR_PARA_LEFT_TO_RIGHT
),
106 m_aRB_TxtDirLeft2Right
.IsChecked() ),
107 SID_ATTR_PARA_LEFT_TO_RIGHT
);
109 // handling of SheetView stuff
110 // if( m_bEnable_SheetView_Opt )
117 void InternationalOptionsPage::IMPL::Reset( const SfxItemSet
& _rSet
)
119 // handling of DefaultTextDirection stuff
120 const SfxBoolItem
* pLeft2RightItem
= static_cast< const SfxBoolItem
* >( GetItem( _rSet
, SID_ATTR_PARA_LEFT_TO_RIGHT
) );
122 DBG_ASSERT( pLeft2RightItem
, "+InternationalOptionsPage::Reset(): SID_ATTR_PARA_LEFT_TO_RIGHT not set!" );
124 BOOL bLeft2Right
= pLeft2RightItem
? pLeft2RightItem
->GetValue() : TRUE
;
125 m_aRB_TxtDirLeft2Right
.Check( bLeft2Right
);
127 // handling of SheetView stuff
128 // if( m_bEnable_SheetView_Opt )
130 // m_aCB_ShtVwRight2Left.Check( FALSE );
132 // m_aCB_ShtVwCurrentDocOnly.Check( FALSE );
136 InternationalOptionsPage::InternationalOptionsPage( Window
* _pParent
, const SfxItemSet
& _rAttrSet
) :
137 SfxTabPage ( _pParent
, SVX_RES( RID_OFA_TP_INTERNATIONAL
), _rAttrSet
)
139 ,m_pImpl ( new IMPL( this ) )
144 SfxTabPage
* InternationalOptionsPage::CreateSd( Window
* _pParent
, const SfxItemSet
& _rAttrSet
)
146 return new InternationalOptionsPage( _pParent
, _rAttrSet
);
149 SfxTabPage
* InternationalOptionsPage::CreateSc( Window
* _pParent
, const SfxItemSet
& _rAttrSet
)
151 InternationalOptionsPage
* p
= new InternationalOptionsPage( _pParent
, _rAttrSet
);
152 // p->m_pImpl->EnableOption_SheetView();
156 InternationalOptionsPage::~InternationalOptionsPage()
161 BOOL
InternationalOptionsPage::FillItemSet( SfxItemSet
& _rSet
)
163 return m_pImpl
->FillItemSet( _rSet
);
166 void InternationalOptionsPage::Reset( const SfxItemSet
& _rSet
)
168 m_pImpl
->Reset( _rSet
);
171 } // /namespace offapp