Files
libreoffice/sw/source/ui/table/rowht.cxx

83 lines
2.5 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
2000-09-18 16:15:01 +00:00
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
2000-09-18 16:15:01 +00:00
*
* This file incorporates work covered by the following license notice:
2000-09-18 16:15:01 +00:00
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
2000-09-18 16:15:01 +00:00
#include <svl/intitem.hxx>
#include <svl/eitem.hxx>
2000-09-18 16:15:01 +00:00
#include <sfx2/dispatch.hxx>
#include <svx/dlgutil.hxx>
#include <fmtfsize.hxx>
2000-10-06 12:41:54 +00:00
#include <swtypes.hxx>
#include <rowht.hxx>
#include <wrtsh.hxx>
#include <frmatr.hxx>
#include <wdocsh.hxx>
#include <view.hxx>
#include <swmodule.hxx>
2000-10-09 15:54:59 +00:00
#include <usrpref.hxx>
2000-09-18 16:15:01 +00:00
2000-10-06 12:41:54 +00:00
#include <cmdid.h>
#include <table.hrc>
2000-09-18 16:15:01 +00:00
void SwTableHeightDlg::Apply()
{
SwTwips nHeight = static_cast< SwTwips >(m_pHeightEdit->Denormalize(m_pHeightEdit->GetValue(FUNIT_TWIP)));
2000-09-18 16:15:01 +00:00
SwFmtFrmSize aSz(ATT_FIX_SIZE, 0, nHeight);
SwFrmSize eFrmSize = (SwFrmSize) m_pAutoHeightCB->IsChecked() ?
2000-09-18 16:15:01 +00:00
ATT_MIN_SIZE : ATT_FIX_SIZE;
if(eFrmSize != aSz.GetHeightSizeType())
2000-09-18 16:15:01 +00:00
{
aSz.SetHeightSizeType(eFrmSize);
2000-09-18 16:15:01 +00:00
}
rSh.SetRowHeight( aSz );
}
SwTableHeightDlg::SwTableHeightDlg(Window *pParent, SwWrtShell &rS)
: SvxStandardDialog(pParent, "RowHeightDialog", "modules/swriter/ui/rowheight.ui")
, rSh( rS )
2000-09-18 16:15:01 +00:00
{
get(m_pHeightEdit, "heightmf");
get(m_pAutoHeightCB, "fit");
2000-10-06 12:41:54 +00:00
2000-10-09 15:54:59 +00:00
FieldUnit eFieldUnit = SW_MOD()->GetUsrPref( 0 != PTR_CAST( SwWebDocShell,
rSh.GetView().GetDocShell() ) )->GetMetric();
::SetFieldUnit(*m_pHeightEdit, eFieldUnit);
2000-10-06 12:41:54 +00:00
m_pHeightEdit->SetMin(MINLAY, FUNIT_TWIP);
if(!m_pHeightEdit->GetMin())
m_pHeightEdit->SetMin(1);
2000-09-18 16:15:01 +00:00
SwFmtFrmSize *pSz;
rSh.GetRowHeight( pSz );
if ( pSz )
{
long nHeight = pSz->GetHeight();
m_pAutoHeightCB->Check(pSz->GetHeightSizeType() != ATT_FIX_SIZE);
m_pHeightEdit->SetValue(m_pHeightEdit->Normalize(nHeight), FUNIT_TWIP);
2000-09-18 16:15:01 +00:00
delete pSz;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */