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: splitcelldlg.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
38 #include <sfx2/dispatch.hxx>
40 #include <svtools/intitem.hxx>
41 #include <svtools/eitem.hxx>
43 #include "svx/dialmgr.hxx"
44 #include "splitcelldlg.hxx"
45 #include "svx/dialogs.hrc"
46 #include "splitcelldlg.hrc"
48 SvxSplitTableDlg::SvxSplitTableDlg( Window
*pParent
, bool bIsTableVertical
, long nMaxVertical
, long nMaxHorizontal
)
49 : SvxStandardDialog(pParent
, SVX_RES(RID_SVX_SPLITCELLDLG
))
50 , maCountLbl(this, SVX_RES(FT_COUNT
))
51 , maCountEdit(this, SVX_RES(ED_COUNT
))
52 , maCountFL(this, SVX_RES(FL_COUNT
))
53 , maHorzBox(this, SVX_RES(RB_HORZ
))
54 , maVertBox(this, SVX_RES(RB_VERT
))
55 , maPropCB(this, SVX_RES(CB_PROP
))
56 , maDirFL(this, SVX_RES(FL_DIR
))
57 , maOKBtn(this, SVX_RES(BT_OK
))
58 , maCancelBtn(this, SVX_RES(BT_CANCEL
))
59 , maHelpBtn( this, SVX_RES( BT_HELP
) )
60 , mnMaxVertical( nMaxVertical
)
61 , mnMaxHorizontal( nMaxHorizontal
)
63 maVertBox
.SetModeRadioImage(Image(SVX_RES(BMP_SPLIT_VERT
)), BMP_COLOR_HIGHCONTRAST
);
64 maHorzBox
.SetModeRadioImage(Image(SVX_RES(BMP_SPLIT_HORZ
)), BMP_COLOR_HIGHCONTRAST
);
66 maHorzBox
.SetClickHdl( LINK( this, SvxSplitTableDlg
, ClickHdl
));
67 maPropCB
.SetClickHdl( LINK( this, SvxSplitTableDlg
, ClickHdl
));
68 maVertBox
.SetClickHdl( LINK( this, SvxSplitTableDlg
, ClickHdl
));
70 if( mnMaxVertical
< 2 )
71 maVertBox
.Enable(FALSE
);
73 //exchange the meaning of horizontal and vertical for vertical text
76 Image
aTmpImg(maHorzBox
.GetModeRadioImage());
77 String
sTmp(maHorzBox
.GetText());
78 maHorzBox
.SetText(maVertBox
.GetText());
79 maHorzBox
.SetModeRadioImage(maVertBox
.GetModeRadioImage());
80 maVertBox
.SetText(sTmp
);
81 maVertBox
.SetModeRadioImage(aTmpImg
);
85 SvxSplitTableDlg::~SvxSplitTableDlg()
89 IMPL_LINK( SvxSplitTableDlg
, ClickHdl
, Button
*, pButton
)
91 const bool bIsVert
= pButton
== &maVertBox
;
92 long nMax
= bIsVert
? mnMaxVertical
: mnMaxHorizontal
;
93 maPropCB
.Enable(!bIsVert
);
94 maCountEdit
.SetMax( nMax
);
98 bool SvxSplitTableDlg::IsHorizontal() const
100 return maHorzBox
.IsChecked();
103 bool SvxSplitTableDlg::IsProportional() const
105 return maPropCB
.IsChecked() && maHorzBox
.IsChecked();
108 long SvxSplitTableDlg::GetCount() const
110 return sal::static_int_cast
<long>( maCountEdit
.GetValue() );
113 short SvxSplitTableDlg::Execute()
115 return SvxStandardDialog::Execute();
118 void SvxSplitTableDlg::Apply()