Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <sfx2/dispatch.hxx>
21 : #include <svl/intitem.hxx>
22 : #include <svl/eitem.hxx>
23 : #include "dialmgr.hxx"
24 : #include "splitcelldlg.hxx"
25 : #include "cuires.hrc"
26 :
27 0 : SvxSplitTableDlg::SvxSplitTableDlg( Window *pParent, bool bIsTableVertical,
28 : long nMaxVertical, long nMaxHorizontal )
29 : : SvxStandardDialog(pParent, "SplitCellsDialog", "cui/ui/splitcellsdialog.ui")
30 : , mnMaxVertical(nMaxVertical)
31 0 : , mnMaxHorizontal(nMaxHorizontal)
32 : {
33 0 : get(m_pCountEdit, "countnf");
34 0 : get(m_pHorzBox, "hori");
35 0 : get(m_pVertBox, "vert");
36 0 : get(m_pPropCB, "prop");
37 0 : m_pHorzBox->SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
38 0 : m_pPropCB->SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
39 0 : m_pVertBox->SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
40 :
41 0 : if( mnMaxVertical < 2 )
42 0 : m_pVertBox->Enable(false);
43 :
44 : //exchange the meaning of horizontal and vertical for vertical text
45 0 : if(bIsTableVertical)
46 : {
47 0 : Image aTmpImg(m_pHorzBox->GetModeRadioImage());
48 0 : OUString sTmp(m_pHorzBox->GetText());
49 0 : m_pHorzBox->SetText(m_pVertBox->GetText());
50 0 : m_pHorzBox->SetModeRadioImage(m_pVertBox->GetModeRadioImage());
51 0 : m_pVertBox->SetText(sTmp);
52 0 : m_pVertBox->SetModeRadioImage(aTmpImg);
53 : }
54 0 : }
55 :
56 0 : SvxSplitTableDlg::~SvxSplitTableDlg()
57 : {
58 0 : }
59 :
60 0 : IMPL_LINK( SvxSplitTableDlg, ClickHdl, Button *, pButton )
61 : {
62 0 : const bool bIsVert = pButton == m_pVertBox ;
63 0 : long nMax = bIsVert ? mnMaxVertical : mnMaxHorizontal;
64 0 : m_pPropCB->Enable(!bIsVert);
65 0 : m_pCountEdit->SetMax( nMax );
66 0 : return 0;
67 : }
68 :
69 0 : bool SvxSplitTableDlg::IsHorizontal() const
70 : {
71 0 : return m_pHorzBox->IsChecked();
72 : }
73 :
74 0 : bool SvxSplitTableDlg::IsProportional() const
75 : {
76 0 : return m_pPropCB->IsChecked() && m_pHorzBox->IsChecked();
77 : }
78 :
79 0 : long SvxSplitTableDlg::GetCount() const
80 : {
81 0 : return sal::static_int_cast<long>( m_pCountEdit->GetValue() );
82 : }
83 :
84 0 : short SvxSplitTableDlg::Execute()
85 : {
86 0 : return SvxStandardDialog::Execute();
87 : }
88 :
89 0 : void SvxSplitTableDlg::Apply()
90 : {
91 0 : }
92 :
93 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|