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