diff options
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.cxx | 21 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.hxx | 3 | ||||
-rw-r--r-- | sc/source/ui/inc/datafdlg.hrc | 43 | ||||
-rw-r--r-- | sc/source/ui/inc/datafdlg.hxx | 18 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/datafdlg.cxx | 126 | ||||
-rw-r--r-- | sc/source/ui/src/datafdlg.src | 100 | ||||
-rw-r--r-- | sc/source/ui/vba/vbaworksheet.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh2.cxx | 3 |
8 files changed, 73 insertions, 244 deletions
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 1283a3b0f290..0a24dd6fa88b 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -827,26 +827,13 @@ AbstractScDeleteCellDlg* ScAbstractDialogFactory_Impl::CreateScDeleteCellDlg(Win return new AbstractScDeleteCellDlg_Impl( pDlg ); } -AbstractScDataFormDlg* ScAbstractDialogFactory_Impl::CreateScDataFormDlg( Window* pParent, int nId, ScTabViewShell* pTabViewShell ) +AbstractScDataFormDlg* ScAbstractDialogFactory_Impl::CreateScDataFormDlg(Window* pParent, + ScTabViewShell* pTabViewShell) { - ScDataFormDlg * pDlg=NULL; - switch ( nId ) - { - case RID_SCDLG_DATAFORM : - pDlg = new ScDataFormDlg( pParent, pTabViewShell); - break; - default: - break; - } - - if ( pDlg ) - return new AbstractScDataFormDlg_Impl( pDlg ); - return 0; + ScDataFormDlg* pDlg = new ScDataFormDlg(pParent, pTabViewShell); + return new AbstractScDataFormDlg_Impl(pDlg); } - - - AbstractScDeleteContentsDlg* ScAbstractDialogFactory_Impl::CreateScDeleteContentsDlg(Window* pParent, sal_uInt16 nCheckDefaults) { diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index 14c263fe4f73..a86192bb02c6 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -434,7 +434,8 @@ public: virtual AbstractScDeleteCellDlg * CreateScDeleteCellDlg(Window* pParent, bool bDisallowCellMove = false ); //for dataform - virtual AbstractScDataFormDlg * CreateScDataFormDlg( Window* pParent, int nId, ScTabViewShell* pTabViewShell); //add for ScDeleteCellDlg + virtual AbstractScDataFormDlg* CreateScDataFormDlg(Window* pParent, + ScTabViewShell* pTabViewShell); virtual AbstractScDeleteContentsDlg * CreateScDeleteContentsDlg(Window* pParent, //add for ScDeleteContentsDlg sal_uInt16 nCheckDefaults = 0); diff --git a/sc/source/ui/inc/datafdlg.hrc b/sc/source/ui/inc/datafdlg.hrc deleted file mode 100644 index a0a2f043e235..000000000000 --- a/sc/source/ui/inc/datafdlg.hrc +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (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.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Initial Developer of the Original Code is - * Novell Inc. - * Portions created by the Initial Developer are Copyright (C) 2010 the - * Initial Developer. All Rights Reserved. - * - * Contributor(s): Amelia Wang <amwang@novell.com> - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ -#include "sc.hrc" // -> RID_SCDLG_DATAFORM - -//dataform -#define BTN_DATAFORM_NEW 1 -#define BTN_DATAFORM_DELETE 2 -#define BTN_DATAFORM_RESTORE 3 -#define BTN_DATAFORM_PREV 4 -#define BTN_DATAFORM_NEXT 5 -#define BTN_DATAFORM_CLOSE 6 -#define WND_DATAFORM_SCROLLBAR 7 -#define LAB_DATAFORM_RECORDNO 8 - - -#define STR_NEW_RECORD 11 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/datafdlg.hxx b/sc/source/ui/inc/datafdlg.hxx index 3e7d92e9e364..e96f91fc6ace 100644 --- a/sc/source/ui/inc/datafdlg.hxx +++ b/sc/source/ui/inc/datafdlg.hxx @@ -51,19 +51,19 @@ #define EDIT_LEFT 62 #define LINE_HEIGHT 16 -//zhangyun class ScDataFormDlg : public ModalDialog { private: - PushButton aBtnNew; - PushButton aBtnDelete; - PushButton aBtnRestore; - PushButton aBtnPrev; - PushButton aBtnNext; - PushButton aBtnClose; - ScrollBar aSlider; - FixedText aFixedText; + PushButton* m_pBtnNew; + PushButton* m_pBtnDelete; + PushButton* m_pBtnRestore; + PushButton* m_pBtnPrev; + PushButton* m_pBtnNext; + PushButton* m_pBtnClose; + ScrollBar* m_pSlider; + VclGrid* m_pGrid; + FixedText* m_pFixedText; OUString sNewRecord; ScTabViewShell* pTabViewShell; diff --git a/sc/source/ui/miscdlgs/datafdlg.cxx b/sc/source/ui/miscdlgs/datafdlg.cxx index c8810aca533e..23926913afd9 100644 --- a/sc/source/ui/miscdlgs/datafdlg.cxx +++ b/sc/source/ui/miscdlgs/datafdlg.cxx @@ -33,7 +33,6 @@ #include "datafdlg.hxx" #include "scresid.hxx" -#include "datafdlg.hrc" #include "viewdata.hxx" #include "docsh.hxx" #include "refundo.hxx" @@ -44,21 +43,21 @@ #define HDL(hdl) LINK( this, ScDataFormDlg, hdl ) -//zhangyun -ScDataFormDlg::ScDataFormDlg( Window* pParent, ScTabViewShell* pTabViewShellOri) : - ModalDialog ( pParent, ScResId( RID_SCDLG_DATAFORM ) ), - aBtnNew ( this, ScResId( BTN_DATAFORM_NEW ) ), - aBtnDelete ( this, ScResId( BTN_DATAFORM_DELETE ) ), - aBtnRestore ( this, ScResId( BTN_DATAFORM_RESTORE ) ), - aBtnPrev ( this, ScResId( BTN_DATAFORM_PREV ) ), - aBtnNext ( this, ScResId( BTN_DATAFORM_NEXT ) ), - aBtnClose ( this, ScResId( BTN_DATAFORM_CLOSE ) ), - aSlider ( this, ScResId( WND_DATAFORM_SCROLLBAR ) ), - aFixedText ( this, ScResId( LAB_DATAFORM_RECORDNO ) ), - sNewRecord(SC_RESSTR(STR_NEW_RECORD)) +ScDataFormDlg::ScDataFormDlg(Window* pParent, ScTabViewShell* pTabViewShellOri) + : ModalDialog(pParent, "DataFormDialog", "modules/scalc/ui/dataform.ui") + , pTabViewShell(pTabViewShellOri) { - pTabViewShell = pTabViewShellOri; - FreeResource(); + get(m_pBtnNew, "new"); + get(m_pBtnDelete, "delete"); + get(m_pBtnRestore, "restore"); + get(m_pBtnPrev, "prev"); + get(m_pBtnNext, "next"); + get(m_pBtnClose, "close"); + get(m_pFixedText, "label"); + sNewRecord = m_pFixedText->GetText(); + get(m_pSlider, "scrollbar"); + get(m_pGrid, "grid"); + //read header form current document, and add new controls OSL_ENSURE( pTabViewShell, "pTabViewShell is NULL! :-/" ); ScViewData* pViewData = pTabViewShell->GetViewData(); @@ -157,42 +156,35 @@ ScDataFormDlg::ScDataFormDlg( Window* pParent, ScTabViewShell* pTabViewShellOri nCurrentRow = nStartRow + 1; - String aFieldName; - - //align with LAB_DATAFORM_RECORDNO - int nTop = LogicToPixel( Size(1,6), MapMode(MAP_APPFONT) ).getHeight(); - const int nOne = LogicToPixel( Size(1,1), MapMode(MAP_APPFONT) ).getHeight(); - const int nLineHeight = LogicToPixel( Size(1, LINE_HEIGHT), MapMode(MAP_APPFONT) ).getHeight(); - const int nFixedLeft = LogicToPixel( Size(FIXED_LEFT, 1), MapMode(MAP_APPFONT) ).getWidth(); - const int nEditLeft = LogicToPixel( Size(EDIT_LEFT, 1), MapMode(MAP_APPFONT) ).getWidth(); - - Size nFixedSize(LogicToPixel( Size(FIXED_WIDTH, FIXED_HEIGHT), MapMode(MAP_APPFONT) )); - Size nEditSize(LogicToPixel( Size(EDIT_WIDTH, EDIT_HEIGHT), MapMode(MAP_APPFONT) )); - aColLength = nEndCol - nStartCol + 1; //new the controls maFixedTexts.reserve(aColLength); maEdits.reserve(aColLength); - for(sal_uInt16 nIndex = 0; nIndex < aColLength; nIndex++) + sal_Int32 nGridRow = 0; + for(sal_uInt16 nIndex = 0; nIndex < aColLength; ++nIndex) { - aFieldName = pDoc->GetString(nIndex + nStartCol, nStartRow, nTab); + OUString aFieldName = pDoc->GetString(nIndex + nStartCol, nStartRow, nTab); int nColWidth = pDoc->GetColWidth( nIndex + nStartCol, nTab ); if (nColWidth) { - maFixedTexts.push_back( new FixedText(this) ); - maEdits.push_back( new Edit(this, WB_BORDER) ); + maFixedTexts.push_back( new FixedText(m_pGrid) ); + maEdits.push_back( new Edit(m_pGrid, WB_BORDER) ); + + maFixedTexts[nIndex].set_grid_left_attach(0); + maEdits[nIndex].set_grid_left_attach(1); + maFixedTexts[nIndex].set_grid_top_attach(nGridRow); + maEdits[nIndex].set_grid_top_attach(nGridRow); + + maEdits[nIndex].SetWidthInChars(32); + maEdits[nIndex].set_hexpand(true); + + ++nGridRow; - maFixedTexts[nIndex].SetSizePixel(nFixedSize); - maEdits[nIndex].SetSizePixel(nEditSize); - maFixedTexts[nIndex].SetPosPixel(Point(nFixedLeft, nTop + nOne)); - maEdits[nIndex].SetPosPixel(Point(nEditLeft, nTop)); maFixedTexts[nIndex].SetText(aFieldName); maFixedTexts[nIndex].Show(); maEdits[nIndex].Show(); - - nTop += nLineHeight; } else { @@ -202,35 +194,25 @@ ScDataFormDlg::ScDataFormDlg( Window* pParent, ScTabViewShell* pTabViewShellOri if (!maEdits.is_null(nIndex)) maEdits[nIndex].SetModifyHdl( HDL(Impl_DataModifyHdl) ); } - - Size nDialogSize = this->GetSizePixel(); - if (nTop > nDialogSize.Height()) - { - nDialogSize.setHeight(nTop); - this->SetSizePixel(nDialogSize); - } - Size nScrollSize = aSlider.GetSizePixel(); - nScrollSize.setHeight(nDialogSize.Height()-20); - aSlider.SetSizePixel(nScrollSize); } FillCtrls(nCurrentRow); - aSlider.SetPageSize( 10 ); - aSlider.SetVisibleSize( 1 ); - aSlider.SetLineSize( 1 ); - aSlider.SetRange( Range( 0, nEndRow - nStartRow + 1) ); - aSlider.Show(); + m_pSlider->SetPageSize( 10 ); + m_pSlider->SetVisibleSize( 1 ); + m_pSlider->SetLineSize( 1 ); + m_pSlider->SetRange( Range( 0, nEndRow - nStartRow + 1) ); + m_pSlider->Show(); - aBtnNew.SetClickHdl ( HDL(Impl_NewHdl) ); - aBtnPrev.SetClickHdl ( HDL(Impl_PrevHdl) ); - aBtnNext.SetClickHdl ( HDL(Impl_NextHdl) ); + m_pBtnNew->SetClickHdl(HDL(Impl_NewHdl)); + m_pBtnPrev->SetClickHdl(HDL(Impl_PrevHdl)); + m_pBtnNext->SetClickHdl(HDL(Impl_NextHdl)); - aBtnRestore.SetClickHdl ( HDL(Impl_RestoreHdl) ); - aBtnDelete.SetClickHdl ( HDL(Impl_DeleteHdl) ); - aBtnClose.SetClickHdl ( HDL(Impl_CloseHdl) ); + m_pBtnRestore->SetClickHdl(HDL(Impl_RestoreHdl)); + m_pBtnDelete->SetClickHdl(HDL(Impl_DeleteHdl)); + m_pBtnClose->SetClickHdl(HDL(Impl_CloseHdl)); - aSlider.SetEndScrollHdl( HDL( Impl_ScrollHdl ) ); + m_pSlider->SetEndScrollHdl(HDL(Impl_ScrollHdl)); SetButtonState(); } @@ -263,18 +245,18 @@ void ScDataFormDlg::FillCtrls(SCROW /*nCurrentRow*/) aBuf.append(static_cast<sal_Int32>(nCurrentRow - nStartRow)); aBuf.appendAscii(" / "); aBuf.append(static_cast<sal_Int32>(nEndRow - nStartRow)); - aFixedText.SetText(aBuf.makeStringAndClear()); + m_pFixedText->SetText(aBuf.makeStringAndClear()); } else - aFixedText.SetText(sNewRecord); + m_pFixedText->SetText(sNewRecord); - aSlider.SetThumbPos(nCurrentRow-nStartRow-1); + m_pSlider->SetThumbPos(nCurrentRow-nStartRow-1); } IMPL_LINK( ScDataFormDlg, Impl_DataModifyHdl, Edit*, pEdit) { if ( pEdit->IsModified() ) - aBtnRestore.Enable( true ); + m_pBtnRestore->Enable( true ); return 0; } @@ -301,7 +283,7 @@ IMPL_LINK_NOARG(ScDataFormDlg, Impl_NewHdl) if (nCurrentRow >= nEndRow + 2) { nEndRow ++ ; - aSlider.SetRange( Range( 0, nEndRow - nStartRow + 1) ); + m_pSlider->SetRange( Range( 0, nEndRow - nStartRow + 1) ); } SetButtonState(); FillCtrls(nCurrentRow); @@ -375,7 +357,7 @@ IMPL_LINK_NOARG(ScDataFormDlg, Impl_CloseHdl) IMPL_LINK_NOARG(ScDataFormDlg, Impl_ScrollHdl) { - long nOffset = aSlider.GetThumbPos(); + long nOffset = m_pSlider->GetThumbPos(); nCurrentRow = nStartRow + nOffset + 1; SetButtonState(); FillCtrls(nCurrentRow); @@ -386,21 +368,21 @@ void ScDataFormDlg::SetButtonState() { if (nCurrentRow > nEndRow) { - aBtnDelete.Enable( false ); - aBtnNext.Enable( false ); + m_pBtnDelete->Enable( false ); + m_pBtnNext->Enable( false ); } else { - aBtnDelete.Enable( true ); - aBtnNext.Enable( true ); + m_pBtnDelete->Enable( true ); + m_pBtnNext->Enable( true ); } if (nCurrentRow == nStartRow + 1) - aBtnPrev.Enable( false ); + m_pBtnPrev->Enable( false ); else - aBtnPrev.Enable( true ); + m_pBtnPrev->Enable( true ); - aBtnRestore.Enable( false ); + m_pBtnRestore->Enable( false ); if ( maEdits.size()>=1 && !maEdits.is_null(0) ) maEdits[0].GrabFocus(); } diff --git a/sc/source/ui/src/datafdlg.src b/sc/source/ui/src/datafdlg.src deleted file mode 100644 index 525bc00e49ec..000000000000 --- a/sc/source/ui/src/datafdlg.src +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (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.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Initial Developer of the Original Code is - * Novell Inc. - * Portions created by the Initial Developer are Copyright (C) 2010 the - * Initial Developer. All Rights Reserved. - * - * Contributor(s): Amelia Wang <amwang@novell.com> - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ -#include "datafdlg.hrc" - -ModalDialog RID_SCDLG_DATAFORM -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 257 , 180 ) ; - Text [ en-US ] = "Data Form" ; - Moveable = TRUE ; - Closeable = TRUE ; - FixedText LAB_DATAFORM_RECORDNO - { - Pos = MAP_APPFONT ( 162 , 6 ) ; - Size = MAP_APPFONT ( 60 , 12 ) ; - Text = "/" ; //placeholder only - }; - PushButton BTN_DATAFORM_NEW - { - Pos = MAP_APPFONT ( 161 , 23 ) ; - Size = MAP_APPFONT ( 90 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - Text [ en-US ] = "New" ; - }; - PushButton BTN_DATAFORM_DELETE - { - Pos = MAP_APPFONT ( 161 , 40 ) ; - Size = MAP_APPFONT ( 90 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Delete" ; - }; - PushButton BTN_DATAFORM_RESTORE - { - Pos = MAP_APPFONT ( 161 , 57 ) ; - Size = MAP_APPFONT ( 90 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Restore" ; - }; - PushButton BTN_DATAFORM_PREV - { - Pos = MAP_APPFONT ( 161 , 82 ) ; - Size = MAP_APPFONT ( 90 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Previous Record" ; - }; - PushButton BTN_DATAFORM_NEXT - { - Pos = MAP_APPFONT ( 161 , 99 ) ; - Size = MAP_APPFONT ( 90 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Next Record" ; - }; - PushButton BTN_DATAFORM_CLOSE - { - Pos = MAP_APPFONT ( 161 , 116 ) ; - Size = MAP_APPFONT ( 90 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Close" ; - }; - ScrollBar WND_DATAFORM_SCROLLBAR - { - Pos = MAP_APPFONT ( 150 , 6 ) ; - Size = MAP_APPFONT ( 8 , 135 ) ; - HScroll = FALSE ; - TabStop = FALSE ; - }; - String STR_NEW_RECORD - { - Text [ en-US ] = "New Record" ; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx index d481cee78a90..4c9a1fa96bb7 100644 --- a/sc/source/ui/vba/vbaworksheet.cxx +++ b/sc/source/ui/vba/vbaworksheet.cxx @@ -906,7 +906,8 @@ ScVbaWorksheet::ShowDataForm( ) throw (uno::RuntimeException) ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); - AbstractScDataFormDlg* pDlg = pFact->CreateScDataFormDlg( pTabViewShell->GetDialogParent(),RID_SCDLG_DATAFORM, pTabViewShell); + AbstractScDataFormDlg* pDlg = pFact->CreateScDataFormDlg(pTabViewShell->GetDialogParent(), + pTabViewShell); OSL_ENSURE(pDlg, "Dialog create fail!"); pDlg->Execute(); diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index 39892616fe8b..5f16fb1f81bf 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -315,7 +315,8 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); - AbstractScDataFormDlg* pDlg = pFact->CreateScDataFormDlg( pTabViewShell->GetDialogParent(),RID_SCDLG_DATAFORM, pTabViewShell); + AbstractScDataFormDlg* pDlg = pFact->CreateScDataFormDlg( + pTabViewShell->GetDialogParent(), pTabViewShell); OSL_ENSURE(pDlg, "Dialog create fail!"); pDlg->Execute(); |