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 <sfx2/dispatch.hxx>
28 #include <svl/intitem.hxx>
29 #include <svl/eitem.hxx>
30 #include "dialmgr.hxx"
31 #include "splitcelldlg.hxx"
32 #include "cuires.hrc"
33 #include "splitcelldlg.hrc"
34
SvxSplitTableDlg(Window * pParent,bool bIsTableVertical,long nMaxVertical,long nMaxHorizontal)35 SvxSplitTableDlg::SvxSplitTableDlg( Window *pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal )
36 : SvxStandardDialog(pParent, CUI_RES(RID_SVX_SPLITCELLDLG))
37 , maCountFL(this, CUI_RES(FL_COUNT))
38 , maCountLbl(this, CUI_RES(FT_COUNT))
39 , maCountEdit(this, CUI_RES(ED_COUNT))
40 , maDirFL(this, CUI_RES(FL_DIR))
41 , maHorzBox(this, CUI_RES(RB_HORZ))
42 , maVertBox(this, CUI_RES(RB_VERT))
43 , maPropCB(this, CUI_RES(CB_PROP))
44 , maOKBtn(this, CUI_RES(BT_OK))
45 , maCancelBtn(this, CUI_RES(BT_CANCEL))
46 , maHelpBtn( this, CUI_RES( BT_HELP ) )
47 , mnMaxVertical( nMaxVertical )
48 , mnMaxHorizontal( nMaxHorizontal )
49 {
50 maVertBox.SetModeRadioImage(Image(CUI_RES(BMP_SPLIT_VERT)), BMP_COLOR_HIGHCONTRAST);
51 maHorzBox.SetModeRadioImage(Image(CUI_RES(BMP_SPLIT_HORZ)), BMP_COLOR_HIGHCONTRAST);
52 FreeResource();
53 maHorzBox.SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
54 maPropCB.SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
55 maVertBox.SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
56
57 if( mnMaxVertical < 2 )
58 maVertBox.Enable(sal_False);
59
60 //exchange the meaning of horizontal and vertical for vertical text
61 if(bIsTableVertical)
62 {
63 Image aTmpImg(maHorzBox.GetModeRadioImage());
64 String sTmp(maHorzBox.GetText());
65 maHorzBox.SetText(maVertBox.GetText());
66 maHorzBox.SetModeRadioImage(maVertBox.GetModeRadioImage());
67 maVertBox.SetText(sTmp);
68 maVertBox.SetModeRadioImage(aTmpImg);
69 }
70 }
71
~SvxSplitTableDlg()72 SvxSplitTableDlg::~SvxSplitTableDlg()
73 {
74 }
75
IMPL_LINK(SvxSplitTableDlg,ClickHdl,Button *,pButton)76 IMPL_LINK( SvxSplitTableDlg, ClickHdl, Button *, pButton )
77 {
78 const bool bIsVert = pButton == &maVertBox ;
79 long nMax = bIsVert ? mnMaxVertical : mnMaxHorizontal;
80 maPropCB.Enable(!bIsVert);
81 maCountEdit.SetMax( nMax );
82 return 0;
83 }
84
IsHorizontal() const85 bool SvxSplitTableDlg::IsHorizontal() const
86 {
87 return maHorzBox.IsChecked();
88 }
89
IsProportional() const90 bool SvxSplitTableDlg::IsProportional() const
91 {
92 return maPropCB.IsChecked() && maHorzBox.IsChecked();
93 }
94
GetCount() const95 long SvxSplitTableDlg::GetCount() const
96 {
97 return sal::static_int_cast<long>( maCountEdit.GetValue() );
98 }
99
Execute()100 short SvxSplitTableDlg::Execute()
101 {
102 return SvxStandardDialog::Execute();
103 }
104
Apply()105 void SvxSplitTableDlg::Apply()
106 {
107 }
108