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