1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "dlgsize.hxx"
21 #include "dbu_dlg.hrc"
22 #include "moduledbu.hxx"
27 #define DEF_ROW_HEIGHT 45
28 #define DEF_COL_WIDTH 227
30 DlgSize::DlgSize( vcl::Window
* pParent
, sal_Int32 nVal
, bool bRow
, sal_Int32 _nAlternativeStandard
)
31 : ModalDialog(pParent
, bRow
? OUString("RowHeightDialog") : OUString("ColWidthDialog"),
32 bRow
? OUString("dbaccess/ui/rowheightdialog.ui") : OUString("dbaccess/ui/colwidthdialog.ui"))
34 , m_nStandard(bRow
? DEF_ROW_HEIGHT
: DEF_COL_WIDTH
)
36 get(m_pMF_VALUE
, "value");
37 get(m_pCB_STANDARD
, "automatic");
39 if ( _nAlternativeStandard
> 0 )
40 m_nStandard
= _nAlternativeStandard
;
41 m_pCB_STANDARD
->SetClickHdl(LINK(this,DlgSize
,CbClickHdl
));
43 m_pMF_VALUE
->EnableEmptyFieldValue(true);
44 bool bDefault
= -1 == nVal
;
45 m_pCB_STANDARD
->Check(bDefault
);
48 SetValue(m_nStandard
);
49 m_nPrevValue
= m_nStandard
;
51 LINK(this,DlgSize
,CbClickHdl
).Call(m_pCB_STANDARD
);
59 void DlgSize::dispose()
62 m_pCB_STANDARD
.clear();
63 ModalDialog::dispose();
67 void DlgSize::SetValue( sal_Int32 nVal
)
69 m_pMF_VALUE
->SetValue(nVal
, FUNIT_CM
);
72 sal_Int32
DlgSize::GetValue()
74 if (m_pCB_STANDARD
->IsChecked())
76 return (sal_Int32
)m_pMF_VALUE
->GetValue( FUNIT_CM
);
79 IMPL_LINK( DlgSize
, CbClickHdl
, Button
*, pButton
)
82 if( pButton
== m_pCB_STANDARD
)
84 m_pMF_VALUE
->Enable(!m_pCB_STANDARD
->IsChecked());
85 if (m_pCB_STANDARD
->IsChecked())
87 m_nPrevValue
= static_cast<sal_Int32
>(m_pMF_VALUE
->GetValue(FUNIT_CM
));
88 // don't use getValue as this will use m_pCB_STANDARD->to determine if we're standard
89 m_pMF_VALUE
->SetEmptyFieldValue();
93 SetValue( m_nPrevValue
);
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */