diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-09-17 12:23:57 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-09-28 08:48:46 +0100 |
commit | 3edc54658d0e33c354ba6fd6791769ba31cd553a (patch) | |
tree | 4ebebbd0865a16e5a322788953a471fbb9e1e834 /sw/source | |
parent | 472f558a845949b570f4d01bc0401e1132d1da49 (diff) |
convert code to use new table width dialog
Change-Id: I50ac81a34945760ccb053ae1c8e328bbdff1a944
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.cxx | 18 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.hxx | 2 | ||||
-rw-r--r-- | sw/source/ui/inc/table.hrc | 4 | ||||
-rw-r--r-- | sw/source/ui/table/colwd.cxx | 46 | ||||
-rw-r--r-- | sw/source/ui/table/colwd.hrc | 27 | ||||
-rw-r--r-- | sw/source/ui/table/colwd.src | 102 | ||||
-rw-r--r-- | sw/source/ui/table/tablemgr.cxx | 2 |
7 files changed, 26 insertions, 175 deletions
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index a8618cc3b4bd..0404a3012aae 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -1040,22 +1040,10 @@ SfxAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwWrapDlg ( Window* pPare return 0; } -VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwTableWidthDlg ( Window *pParent, SwTableFUNC &rFnc , int nResId ) +VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwTableWidthDlg(Window *pParent, SwTableFUNC &rFnc) { - Dialog* pDlg=NULL; - switch ( nResId ) - { - case DLG_COL_WIDTH : - pDlg = new SwTableWidthDlg( pParent, rFnc); - break; - - default: - break; - } - - if ( pDlg ) - return new VclAbstractDialog_Impl( pDlg ); - return 0; + Dialog* pDlg = new SwTableWidthDlg(pParent, rFnc); + return new VclAbstractDialog_Impl( pDlg ); } SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwTableTabDlg( Window* pParent, SfxItemPool& Pool, diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index a005c59b1715..97108acb48a6 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -485,7 +485,7 @@ public: virtual SfxAbstractDialog * CreateSwBorderDlg (Window* pParent, SfxItemSet& rSet, sal_uInt16 nType,int nResId );//add for SwBorderDlg virtual SfxAbstractDialog * CreateSwWrapDlg ( Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, sal_Bool bDrawMode, int nResId ); //add for SwWrapDlg - virtual VclAbstractDialog * CreateSwTableWidthDlg ( Window *pParent, SwTableFUNC &rFnc , int nResId ); //add for SwTableWidthDlg + virtual VclAbstractDialog * CreateSwTableWidthDlg(Window *pParent, SwTableFUNC &rFnc); virtual SfxAbstractTabDialog* CreateSwTableTabDlg( Window* pParent, SfxItemPool& Pool, const SfxItemSet* pItemSet, SwWrtShell* pSh,int nResId ); //add for SwTableTabDlg virtual AbstractSwFldDlg * CreateSwFldDlg ( SfxBindings* pB, SwChildWinWrapper* pCW, Window *pParent, int nResId ); //add for SwFldDlg diff --git a/sw/source/ui/inc/table.hrc b/sw/source/ui/inc/table.hrc index a3d6d2485cd9..dfdf13fccb9a 100644 --- a/sw/source/ui/inc/table.hrc +++ b/sw/source/ui/inc/table.hrc @@ -21,8 +21,10 @@ #define DLG_FORMAT_TABLE (RC_TABLE_BEGIN + 1) #define DLG_CONV_TEXT_TABLE (RC_TABLE_BEGIN + 2) #define DLG_ROW_HEIGHT (RC_TABLE_BEGIN + 4) -#define DLG_COL_WIDTH (RC_TABLE_BEGIN + 6) + + #define MSG_ERR_TABLE_MERGE (RC_TABLE_BEGIN + 7) + #define DLG_AUTOFMT_TABLE (RC_TABLE_BEGIN + 9) #define DLG_SWDLG_STRINPUT (RC_TABLE_BEGIN + 10) #define TP_TABLE_COLUMN (RC_TABLE_BEGIN + 11) diff --git a/sw/source/ui/table/colwd.cxx b/sw/source/ui/table/colwd.cxx index 2649e7c7a1e5..f141bd595ff0 100644 --- a/sw/source/ui/table/colwd.cxx +++ b/sw/source/ui/table/colwd.cxx @@ -38,54 +38,44 @@ #include <usrpref.hxx> #include <cmdid.h> -#include <colwd.hrc> #include <table.hrc> IMPL_LINK_NOARG_INLINE_START(SwTableWidthDlg, LoseFocusHdl) { - sal_uInt16 nId = (sal_uInt16)aColEdit.GetValue()-1; + sal_uInt16 nId = (sal_uInt16)m_pColNF->GetValue()-1; const SwTwips lWidth = rFnc.GetColWidth(nId); - aWidthEdit.SetValue(aWidthEdit.Normalize(lWidth), FUNIT_TWIP); - aWidthEdit.SetMax(aWidthEdit.Normalize(rFnc.GetMaxColWidth(nId)), FUNIT_TWIP); + m_pWidthMF->SetMax(m_pWidthMF->Normalize(rFnc.GetMaxColWidth(nId)), FUNIT_TWIP); + m_pWidthMF->SetValue(m_pWidthMF->Normalize(lWidth), FUNIT_TWIP); return 0; } IMPL_LINK_NOARG_INLINE_END(SwTableWidthDlg, LoseFocusHdl) -SwTableWidthDlg::SwTableWidthDlg(Window *pParent, SwTableFUNC &rTableFnc ) : - - SvxStandardDialog( pParent, SW_RES(DLG_COL_WIDTH) ), - aWidthFL(this, SW_RES(FL_WIDTH)), - - aColFT(this, SW_RES(FT_COL)), - aColEdit(this, SW_RES(ED_COL)), - aWidthFT(this, SW_RES(FT_WIDTH)), - aWidthEdit(this, SW_RES(ED_WIDTH)), - aOKBtn(this, SW_RES(BT_OK)), - aCancelBtn(this, SW_RES(BT_CANCEL)), - aHelpBtn(this, SW_RES(BT_HELP)), - rFnc(rTableFnc) +SwTableWidthDlg::SwTableWidthDlg(Window *pParent, SwTableFUNC &rTableFnc ) + : SvxStandardDialog( pParent, "ColumnWidthDialog", "modules/swriter/ui/columnwidth.ui" ) + , rFnc(rTableFnc) { - FreeResource(); + get(m_pColNF, "column"); + get(m_pWidthMF, "width"); sal_Bool bIsWeb = rTableFnc.GetShell() ? static_cast< sal_Bool >(0 != PTR_CAST( SwWebDocShell, rTableFnc.GetShell()->GetView().GetDocShell()) ) : sal_False; FieldUnit eFieldUnit = SW_MOD()->GetUsrPref( bIsWeb )->GetMetric(); - ::SetFieldUnit(aWidthEdit, eFieldUnit ); + ::SetFieldUnit(*m_pWidthMF, eFieldUnit); - aColEdit.SetValue( rFnc.GetCurColNum() +1 ); - aWidthEdit.SetMin(aWidthEdit.Normalize(MINLAY), FUNIT_TWIP); - if(!aWidthEdit.GetMin()) - aWidthEdit.SetMin(1); + m_pColNF->SetValue( rFnc.GetCurColNum() +1 ); + m_pWidthMF->SetMin(m_pWidthMF->Normalize(MINLAY), FUNIT_TWIP); + if(!m_pWidthMF->GetMin()) + m_pWidthMF->SetMin(1); if(rFnc.GetColCount() == 0) - aWidthEdit.SetMin(aWidthEdit.Normalize(rFnc.GetColWidth(0)), FUNIT_TWIP); - aColEdit.SetMax(rFnc.GetColCount() +1 ); - aColEdit.SetModifyHdl(LINK(this,SwTableWidthDlg, LoseFocusHdl)); + m_pWidthMF->SetMin(m_pWidthMF->Normalize(rFnc.GetColWidth(0)), FUNIT_TWIP); + m_pColNF->SetMax(rFnc.GetColCount() +1 ); + m_pColNF->SetModifyHdl(LINK(this,SwTableWidthDlg, LoseFocusHdl)); LoseFocusHdl(); } @@ -95,8 +85,8 @@ void SwTableWidthDlg::Apply() { rFnc.InitTabCols(); rFnc.SetColWidth( - static_cast< sal_uInt16 >(aColEdit.GetValue() - 1), - static_cast< sal_uInt16 >(aWidthEdit.Denormalize(aWidthEdit.GetValue(FUNIT_TWIP)))); + static_cast< sal_uInt16 >(m_pColNF->GetValue() - 1), + static_cast< sal_uInt16 >(m_pWidthMF->Denormalize(m_pWidthMF->GetValue(FUNIT_TWIP)))); } diff --git a/sw/source/ui/table/colwd.hrc b/sw/source/ui/table/colwd.hrc deleted file mode 100644 index 6a6a5d768246..000000000000 --- a/sw/source/ui/table/colwd.hrc +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * 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 . - */ -#define FT_COL 1 -#define ED_COL 2 -#define FT_WIDTH 3 -#define ED_WIDTH 4 -#define FL_WIDTH 5 - -#define BT_OK 100 -#define BT_CANCEL 101 -#define BT_HELP 102 - diff --git a/sw/source/ui/table/colwd.src b/sw/source/ui/table/colwd.src deleted file mode 100644 index 78290db9f250..000000000000 --- a/sw/source/ui/table/colwd.src +++ /dev/null @@ -1,102 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * 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 . - */ - -#include "table.hrc" -#include "colwd.hrc" -#include "cmdid.h" -#include "helpid.h" -ModalDialog DLG_COL_WIDTH -{ - HelpID = CMD_FN_TABLE_SET_COL_WIDTH ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 159 , 60 ) ; - Text [ en-US ] = "Column Width" ; - Moveable = TRUE ; - OKButton BT_OK - { - Pos = MAP_APPFONT ( 104 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 104 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BT_HELP - { - Pos = MAP_APPFONT ( 104 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedText FT_WIDTH - { - Pos = MAP_APPFONT ( 12 , 31 ) ; - Size = MAP_APPFONT ( 35 , 8 ) ; - Text [ en-US ] = "~Width" ; - Left = TRUE ; - }; - MetricField ED_WIDTH - { - HelpID = "sw:MetricField:DLG_COL_WIDTH:ED_WIDTH"; - Border = TRUE ; - Pos = MAP_APPFONT ( 51 , 30 ) ; - Size = MAP_APPFONT ( 38 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 50 ; - Maximum = 9999 ; - DecimalDigits = 2 ; - SpinSize = 10 ; - Value = 10 ; - Unit = FUNIT_CM ; - First = 100 ; - Last = 9999 ; - }; - FixedLine FL_WIDTH - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 91 , 8 ) ; - Text [ en-US ] = "Width" ; - }; - FixedText FT_COL - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 35 , 8 ) ; - Text [ en-US ] = "~Column" ; - Left = TRUE ; - }; - NumericField ED_COL - { - HelpID = "sw:NumericField:DLG_COL_WIDTH:ED_COL"; - Border = TRUE ; - Pos = MAP_APPFONT ( 51 , 14 ) ; - Size = MAP_APPFONT ( 38 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 99 ; - Repeat = TRUE ; - }; -}; diff --git a/sw/source/ui/table/tablemgr.cxx b/sw/source/ui/table/tablemgr.cxx index 9a2b71e83407..5af560c9e2de 100644 --- a/sw/source/ui/table/tablemgr.cxx +++ b/sw/source/ui/table/tablemgr.cxx @@ -66,7 +66,7 @@ void SwTableFUNC::ColWidthDlg( Window *pParent ) SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - VclAbstractDialog* pDlg = pFact->CreateSwTableWidthDlg( pParent, *this ,DLG_COL_WIDTH ); + VclAbstractDialog* pDlg = pFact->CreateSwTableWidthDlg(pParent, *this); OSL_ENSURE(pDlg, "Dialogdiet fail!"); pDlg->Execute(); delete pDlg; |