--- ori/sc/inc/document.hxx 2006-09-30 11:16:10.000000000 +0800 +++ ori/sc/inc/document.hxx 2007-02-19 01:40:22.187500000 +0800 @@ -704,7 +704,10 @@ void PutCell(SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell, ULONG nFormatIndex, BOOL bForceTab = FALSE); // return TRUE = Zahlformat gesetzt - BOOL SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString ); + //BOOL SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString ); + //for dataform + SC_DLLPUBLIC BOOL SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString ); + //end void SetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rVal ); void SetNote( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPostIt& rNote ); void SetError( SCCOL nCol, SCROW nRow, SCTAB nTab, const USHORT nError); @@ -862,8 +865,10 @@ SCCOL nEndCol, SCTAB nEndTab, SCROW nStartRow, SCSIZE nSize, ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL ); - void DeleteRow( const ScRange& rRange, + //for dataform + SC_DLLPUBLIC void DeleteRow( const ScRange& rRange, ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL ); + BOOL InsertCol( SCROW nStartRow, SCTAB nStartTab, SCROW nEndRow, SCTAB nEndTab, SCCOL nStartCol, SCSIZE nSize, ScDocument* pRefUndoDoc = NULL ); @@ -1149,7 +1154,9 @@ USHORT nNewHeight ); void SetManualHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, BOOL bManual ); - USHORT GetColWidth( SCCOL nCol, SCTAB nTab ) const; + //for dataform + SC_DLLPUBLIC USHORT GetColWidth( SCCOL nCol, SCTAB nTab ) const; + USHORT GetRowHeight( SCROW nRow, SCTAB nTab ) const; ULONG GetRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab ) const; ULONG GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, double fScale ) const; --- ori/sc/inc/sc.hrc 2006-09-30 10:51:52.000000000 +0800 +++ ori/sc/inc/sc.hrc 2007-03-01 15:48:49.078125000 +0800 @@ -792,9 +792,10 @@ #define SID_SORT_DESCENDING (DATA_MENU_START + 23) #define SID_SORT_ASCENDING (DATA_MENU_START + 24) +#define SID_DATA_FORM (DATA_MENU_START + 25) // // -#define DATA_MENU_END (DATA_MENU_START + 25) +#define DATA_MENU_END (DATA_MENU_START + 26) #define TAB_POPUP_START (DATA_MENU_END) #define RID_POPUP_TAB (TAB_POPUP_START) @@ -1587,7 +1588,11 @@ #define RID_SCDLG_DPDATEGROUP (SC_DIALOGS_START + 136) #define RID_SCDLG_DPSHOWDETAIL (SC_DIALOGS_START + 137) +#define RID_SCDLG_DATAFORM (SC_DIALOGS_START + 138) + + #define SID_PIVOT_AFMT (SC_DIALOGS_START + 133) + #define SC_DIALOGS_END (SC_DIALOGS_START + 150) #ifndef STD_MASKCOLOR --- ori/sc/inc/scabstdlg.hxx 2005-09-09 01:52:40.000000000 +0800 +++ ori/sc/inc/scabstdlg.hxx 2007-02-19 01:48:08.546875000 +0800 @@ -52,6 +52,8 @@ #include "global.hxx" #include "pivot.hxx" +#include + class ScAsciiOptions; class ScAutoFormat; class ScAutoFormatData; @@ -120,6 +122,12 @@ virtual DelCellCmd GetDelCellCmd() const = 0; }; +//for dataform +class AbstractScDataFormDlg : public VclAbstractDialog //add for ScDeleteCellDlg +{ + +}; + class AbstractScDeleteContentsDlg: public VclAbstractDialog //add for ScDeleteContentsDlg { public: @@ -333,6 +341,8 @@ const ResId& rResId ) = 0; virtual AbstractScDeleteCellDlg * CreateScDeleteCellDlg( Window* pParent, const ResId& rResId, BOOL bDisallowCellMove = FALSE ) = 0 ; //add for ScDeleteCellDlg + //for dataform + virtual AbstractScDataFormDlg * CreateScDataFormDlg( Window* pParent, const ResId& rResId, ScTabViewShell* pTabViewShell ) = 0 ; //add for ScDataFormDlg virtual AbstractScDeleteContentsDlg * CreateScDeleteContentsDlg(Window* pParent,const ResId& rResId, //add for ScDeleteContentsDlg USHORT nCheckDefaults = 0 ) = 0; --- ori/sc/sdi/cellsh.sdi 2006-05-02 23:42:10.000000000 +0800 +++ ori/sc/sdi/cellsh.sdi 2007-03-01 16:04:35.546875000 +0800 @@ -65,6 +65,7 @@ SID_SBA_BRW_INSERT [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ] SID_SELECT_DB [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ] SID_SORT [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ] + SID_DATA_FORM [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ] FID_FILTER_OK [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ] SID_AUTO_FILTER [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ] SID_AUTOFILTER_HIDE [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ] --- ori/sc/sdi/scalc.sdi 2006-09-30 10:51:52.000000000 +0800 +++ ori/sc/sdi/scalc.sdi 2007-03-01 15:50:48.906250000 +0800 @@ -1606,6 +1606,31 @@ ] //-------------------------------------------------------------------------- +SfxVoidItem DataForm SID_DATA_FORM +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = TRUE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_DATA; +] + +//-------------------------------------------------------------------------- SfxVoidItem DataSubTotals SID_SUBTOTALS () [ --- ori/sc/source/ui/attrdlg/scdlgfact.cxx 2006-07-21 21:15:24.000000000 +0800 +++ ori/sc/source/ui/attrdlg/scdlgfact.cxx 2007-03-02 17:07:44.015625000 +0800 @@ -81,6 +81,8 @@ #include "tpstat.hxx" //add for ScDocStatPage #include "tpusrlst.hxx" //add for ScTpUserLists #include "tpview.hxx" //add for ScTpContentOptions +//for dataform +#include "datafdlg.hxx" //add for ScDataFormDlg // ause #include "editutil.hxx" @@ -93,6 +95,8 @@ IMPL_ABSTDLG_BASE(AbstractScDataPilotSourceTypeDlg_Impl); //add for ScDataPilotSourceTypeDlg IMPL_ABSTDLG_BASE(AbstractScDataPilotServiceDlg_Impl); //add for ScDataPilotServiceDlg IMPL_ABSTDLG_BASE(AbstractScDeleteCellDlg_Impl); //add for ScDeleteCellDlg +//for dataform +IMPL_ABSTDLG_BASE(AbstractScDataFormDlg_Impl); //add for ScDataFormDlg IMPL_ABSTDLG_BASE(AbstractScDeleteContentsDlg_Impl); //add for ScDeleteContentsDlg IMPL_ABSTDLG_BASE(AbstractScFillSeriesDlg_Impl); //add for ScFillSeriesDlg IMPL_ABSTDLG_BASE(AbstractScGroupDlg_Impl); //add for ScGroupDlg @@ -761,6 +765,26 @@ //add for ScDeleteCellDlg end +//add for ScDataFormDlg begin +AbstractScDataFormDlg* ScAbstractDialogFactory_Impl::CreateScDataFormDlg( Window* pParent, const ResId& rResId, ScTabViewShell* pTabViewShell ) +{ + ScDataFormDlg * pDlg=NULL; + switch ( rResId.GetId() ) + { + case RID_SCDLG_DATAFORM : + pDlg = new ScDataFormDlg( pParent, pTabViewShell); + break; + default: + break; + } + + if ( pDlg ) + return new AbstractScDataFormDlg_Impl( pDlg ); + return 0; +} + +//add for ScDataFormDlg end + //add for ScDeleteContentsDlg begin AbstractScDeleteContentsDlg* ScAbstractDialogFactory_Impl::CreateScDeleteContentsDlg(Window* pParent,const ResId& rResId, //add for ScDeleteContentsDlg USHORT nCheckDefaults ) --- ori/sc/source/ui/attrdlg/scdlgfact.hxx 2005-09-09 04:27:56.000000000 +0800 +++ ori/sc/source/ui/attrdlg/scdlgfact.hxx 2007-02-19 01:53:49.859375000 +0800 @@ -45,6 +45,7 @@ class ScDataPilotSourceTypeDlg; class ScDataPilotServiceDlg; class ScDeleteCellDlg; +class ScDataFormDlg; class ScDeleteContentsDlg; class ScFillSeriesDlg; class ScGroupDlg; @@ -144,6 +145,12 @@ virtual DelCellCmd GetDelCellCmd() const; }; +//for dataform +class AbstractScDataFormDlg_Impl : public AbstractScDataFormDlg //add for ScDataFormDlg +{ + DECL_ABSTDLG_BASE(AbstractScDataFormDlg_Impl,ScDataFormDlg); +}; + class AbstractScDeleteContentsDlg_Impl : public AbstractScDeleteContentsDlg //add for ScDeleteContentsDlg { DECL_ABSTDLG_BASE( AbstractScDeleteContentsDlg_Impl,ScDeleteContentsDlg); @@ -371,6 +378,9 @@ virtual AbstractScDeleteCellDlg * CreateScDeleteCellDlg( Window* pParent, const ResId& rResId, BOOL bDisallowCellMove = FALSE ); //add for ScDeleteCellDlg + //for dataform + virtual AbstractScDataFormDlg * CreateScDataFormDlg( Window* pParent, const ResId& rResId, ScTabViewShell* pTabViewShell); //add for ScDeleteCellDlg + virtual AbstractScDeleteContentsDlg * CreateScDeleteContentsDlg(Window* pParent,const ResId& rResId, //add for ScDeleteContentsDlg USHORT nCheckDefaults = 0 ); --- ori/sc/source/ui/inc/datafdlg.hrc 1970-01-01 08:00:00.000000000 +0800 +++ ori/sc/source/ui/inc/datafdlg.hrc 2007-02-19 00:59:34.984375000 +0800 @@ -0,0 +1,49 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: datafdlg.hrc,v $ + * + * $Revision: 1.00 $ + * + * last change: $Author: rt $ $Date: 2005/09/08 21:37:12 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include "sc.hrc" // -> RID_SCDLG_DATAFORM + +//dataform +#define BTN_DATAFORM_NEW 1001 +#define BTN_DATAFORM_DELETE 1002 +#define BTN_DATAFORM_RESTORE 1003 +#define BTN_DATAFORM_LAST 1004 +#define BTN_DATAFORM_NEXT 1005 +#define BTN_DATAFORM_CLOSE 1007 +#define WND_DATAFORM_SCROLLBAR 1008 +#define LAB_DATAFORM_RECORDNO 1009 + +#define FT_DATAFORM_FIXEDTEXT1 2001 +#define ED_DATAFORM_EDIT1 2002 --- ori/sc/source/ui/inc/datafdlg.hxx 1970-01-01 08:00:00.000000000 +0800 +++ ori/sc/source/ui/inc/datafdlg.hxx 2007-02-19 01:04:06.359375000 +0800 @@ -0,0 +1,117 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: datafdlg.hxx,v $ + * + * $Revision: 1.00 $ + * + * last change: $Author: rt $ $Date: 2005/09/08 21:20:35 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef SC_DATAFDLG_HXX +#define SC_DATAFDLG_HXX + + +#ifndef _SV_DIALOG_HXX //autogen +#include +#endif + +#ifndef _SV_BUTTON_HXX //autogen +#include +#endif + +#ifndef _SV_FIXED_HXX //autogen +#include +#endif + + + +#include "global.hxx" + +#include + +#define MAX_DATAFORM_COLS 256 +#define MAX_DATAFORM_ROWS 32000 +#define CTRL_HEIGHT 22 +#define FIXED_WIDTH 60 +#define EDIT_WIDTH 140 +#define FIXED_LEFT 12 +#define EDIT_LEFT 78 +#define LINE_HEIGHT 30 + +//zhangyun +class ScDataFormDlg : public ModalDialog +{ +private: + + PushButton aBtnNew; + PushButton aBtnDelete; + PushButton aBtnRestore; + PushButton aBtnLast; + PushButton aBtnNext; + PushButton aBtnClose; + ScrollBar aSlider; + FixedText aFixedText; + //FixedText aFixedText1; + //Edit aEdit1; + + ScTabViewShell* pTabViewShell; + ScDocument* pDoc; + sal_uInt16 aColLength; + SCROW aCurrentRow; + SCCOL nStartCol; + SCCOL nEndCol; + SCROW nStartRow; + SCROW nEndRow; + SCTAB nTab; + BOOL bNoSelection; + + FixedText** pFixedTexts; + Edit** pEdits; + +public: + ScDataFormDlg( Window* pParent, ScTabViewShell* pTabViewShell); + ~ScDataFormDlg(); + + void FillCtrls(SCROW nCurrentRow); +private: + + // Handler: + DECL_LINK( Impl_NewHdl, PushButton* ); + DECL_LINK( Impl_LastHdl, PushButton* ); + DECL_LINK( Impl_NextHdl, PushButton* ); + + DECL_LINK( Impl_RestoreHdl, PushButton* ); + DECL_LINK( Impl_DeleteHdl, PushButton* ); + DECL_LINK( Impl_CloseHdl, PushButton* ); + + DECL_LINK( Impl_ScrollHdl, ScrollBar* ); +}; +#endif // SC_DATAFDLG_HXX + + --- ori/sc/source/ui/miscdlgs/datafdlg.cxx 1970-01-01 08:00:00.000000000 +0800 +++ ori/sc/source/ui/miscdlgs/datafdlg.cxx 2007-02-19 01:23:49.546875000 +0800 @@ -0,0 +1,392 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: datafdlg.cxx,v $ + * + * $Revision: 1.00 $ + * + * last change: $Author: kz $ $Date: 2006/07/21 14:04:33 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sc.hxx" + +#undef SC_DLLIMPLEMENTATION + +//------------------------------------------------------------------ + +#include "datafdlg.hxx" +#include "scresid.hxx" +#include "datafdlg.hrc" +#include "viewdata.hxx" +#include "document.hxx" +#include "docsh.hxx" + +static BYTE nDelItemChecked=0; +#define HDL(hdl) LINK( this, ScDataFormDlg, hdl ) + +//zhangyun +ScDataFormDlg::ScDataFormDlg( Window* pParent, ScTabViewShell* pTabViewShellOri) : + ModalDialog ( pParent, ScResId( RID_SCDLG_DATAFORM ) ), + // + aFixedText ( this, ScResId( LAB_DATAFORM_RECORDNO ) ), + aBtnNew ( this, ScResId( BTN_DATAFORM_NEW ) ), + aBtnDelete ( this, ScResId( BTN_DATAFORM_DELETE ) ), + aBtnRestore ( this, ScResId( BTN_DATAFORM_RESTORE ) ), + aBtnLast ( this, ScResId( BTN_DATAFORM_LAST ) ), + aBtnNext ( this, ScResId( BTN_DATAFORM_NEXT ) ), + aBtnClose ( this, ScResId( BTN_DATAFORM_CLOSE ) ), + aSlider ( this, ScResId( WND_DATAFORM_SCROLLBAR ) ) + //aSlider ( this, ScResId( WND_DATAFORM_SCROLLBAR ) ), + //aFixedText1 ( this, ScResId( FT_DATAFORM_FIXEDTEXT1 ) ), + //aEdit1 ( this, ScResId( ED_DATAFORM_EDIT1 ) ) +{ + pTabViewShell = pTabViewShellOri; + FreeResource(); + //read header form current document, and add new controls + DBG_ASSERT( pTabViewShell, "pTabViewShell is NULL! :-/" ); + ScViewData* pViewData = pTabViewShell->GetViewData(); + + //int aColLength=20; + //FixedText** pFixedTexts; + //Edit** pEdits; + //pFixedTexts = new FixedText*[aColLength]; + //pEdits = new Edit*[aColLength]; + + pDoc = pViewData->GetDocument(); + if (pDoc) + { + ScRange aRange; + pViewData->GetSimpleArea( aRange ); + ScAddress aStart = aRange.aStart; + ScAddress aEnd = aRange.aEnd; + + nStartCol = aStart.Col(); + nEndCol = aEnd.Col(); + nStartRow = aStart.Row(); + nEndRow = aEnd.Row(); + + nTab = pViewData->GetTabNo(); + //if there is no selection + if ((nStartCol == nEndCol) && (nStartRow == nEndRow)) + bNoSelection = TRUE; + + if (bNoSelection) + { + //find last not blank cell in row + for (int i=1;i<=MAX_DATAFORM_COLS;i++) + { + String aColName; + nEndCol++; + pDoc->GetString( nEndCol, nStartRow, nTab, aColName ); + int nColWidth = pDoc->GetColWidth( nEndCol, nTab ); + if ( aColName.Len() == 0 && nColWidth) + { + nEndCol--; + break; + } + } + + //find first not blank cell in row + for (int i=1;i<=MAX_DATAFORM_COLS;i++) + { + String aColName; + if (nStartCol <= 0) + break; + nStartCol--; + + pDoc->GetString( nStartCol, nStartRow, nTab, aColName ); + int nColWidth = pDoc->GetColWidth( nEndCol, nTab ); + if ( aColName.Len() == 0 && nColWidth) + { + nStartCol++; + break; + } + } + + //skip leading hide column + for (int i=1;i<=MAX_DATAFORM_COLS;i++) + { + String aColName; + int nColWidth = pDoc->GetColWidth( nStartCol, nTab ); + if (nColWidth) + break; + nStartCol++; + } + + if (nEndCol < nStartCol) + nEndCol = nStartCol; + + //find last not blank cell in row + for (int i=1;i<=MAX_DATAFORM_ROWS;i++) + { + String aColName; + nEndRow++; + pDoc->GetString( nStartCol, nEndRow, nTab, aColName ); + if ( aColName.Len() == 0 ) + { + nEndRow--; + break; + } + } + + //find first not blank cell in row + for (int i=1;i<=MAX_DATAFORM_ROWS;i++) + { + String aColName; + if (nStartRow <= 0) + break; + nStartRow--; + + pDoc->GetString( nStartCol, nStartRow, nTab, aColName ); + if ( aColName.Len() == 0 ) + { + nStartRow++; + break; + } + } + + if (nEndRow < nStartRow) + nEndRow = nStartRow; + } + + aCurrentRow = nStartRow + 1; + + SCCOL col; + String aFieldName; + + int nTop = 12; + + Size nFixedSize(FIXED_WIDTH, CTRL_HEIGHT ); + Size nEditSize(EDIT_WIDTH, CTRL_HEIGHT ); + + //pFtArray = new FixedText(this); + aColLength = nEndCol - nStartCol + 1; + + //new the controls + pFixedTexts = new FixedText*[aColLength]; + pEdits = new Edit*[aColLength]; + + for(sal_uInt16 nIndex = 0; nIndex < aColLength; nIndex++) + { + pDoc->GetString( nIndex + nStartCol, nStartRow, nTab, aFieldName ); + int nColWidth = pDoc->GetColWidth( nIndex + nStartCol, nTab ); + if (nColWidth) + { + pFixedTexts[nIndex] = new FixedText(this); + pEdits[nIndex] = new Edit(this, WB_BORDER); + + pFixedTexts[nIndex]->SetSizePixel(nFixedSize); + pEdits[nIndex]->SetSizePixel(nEditSize); + pFixedTexts[nIndex]->SetPosPixel(Point(FIXED_LEFT, nTop)); + pEdits[nIndex]->SetPosPixel(Point(EDIT_LEFT, nTop)); + //pFixedTexts[nIndex]->SetText(String::CreateFromAscii("W4W-Filter Nr. ")); + pFixedTexts[nIndex]->SetText(aFieldName); + pFixedTexts[nIndex]->Show(); + pEdits[nIndex]->Show(); + + nTop += LINE_HEIGHT; + } + else + { + pFixedTexts[nIndex] = NULL; + pEdits[nIndex] = NULL; + } + } + + 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(aCurrentRow); + + aSlider.SetPageSize( 10 ); + aSlider.SetVisibleSize( 1 ); + aSlider.SetLineSize( 1 ); + aSlider.SetRange( Range( 0, nEndRow - nStartRow + 1) ); + aSlider.Show(); + + aBtnNew.SetClickHdl ( HDL(Impl_NewHdl) ); + aBtnLast.SetClickHdl ( HDL(Impl_LastHdl) ); + aBtnNext.SetClickHdl ( HDL(Impl_NextHdl) ); + + aBtnRestore.SetClickHdl ( HDL(Impl_RestoreHdl) ); + aBtnDelete.SetClickHdl ( HDL(Impl_DeleteHdl) ); + aBtnClose.SetClickHdl ( HDL(Impl_CloseHdl) ); + + aSlider.SetEndScrollHdl( HDL( Impl_ScrollHdl ) ); + + //end + //FreeResource(); +} + +__EXPORT ScDataFormDlg::~ScDataFormDlg() +{ + for(sal_uInt16 i = 0; i < aColLength; i++) + { + if (pEdits[i]) + delete pEdits[i]; + if (pFixedTexts[i]) + delete pFixedTexts[i]; + } + if (pEdits) + delete pEdits; + if (pFixedTexts) + delete pFixedTexts; +} + +void ScDataFormDlg::FillCtrls(SCROW nCurrentRow) +{ + //ScViewData* pViewData = pTabViewShell->GetViewData(); + + //pDoc = pViewData->GetDocument(); + String aFieldName; + int nRecordNum = nEndRow - nStartRow; + for(sal_uInt16 i = 0; i < aColLength; i++) + { + if (pEdits[i]) + { + if (aCurrentRow<=nEndRow) + { + pDoc->GetString( i + nStartCol, aCurrentRow, nTab, aFieldName ); + pEdits[i]->SetText(aFieldName); + } + else + pEdits[i]->SetText(String()); + } + } + char sRecordStr[256]; + sprintf(sRecordStr, "%i / %i", aCurrentRow-nStartRow, nRecordNum); + if (aCurrentRow<=nEndRow) + aFixedText.SetText(String::CreateFromAscii(sRecordStr)); + else + aFixedText.SetText(String::CreateFromAscii("New Record")); + + aSlider.SetThumbPos(aCurrentRow-nStartRow-1); +} + +IMPL_LINK( ScDataFormDlg, Impl_NewHdl, PushButton*, pBtn) +{ + ScViewData* pViewData = pTabViewShell->GetViewData(); + ScDocShell* pDocSh = pViewData->GetDocShell(); + if (pDoc) + { + for(sal_uInt16 i = 0; i < aColLength; i++) + { + if (pEdits[i]) + { + String aFieldName=pEdits[i]->GetText(); + pDoc->SetString( nStartCol + i, aCurrentRow, nTab, aFieldName ); + } + } + //String aFieldName=pEdArray->GetText(); + + //pDoc->SetString( nStartCol, nLastRow, nTab, aFieldName ); + aCurrentRow++; + if (aCurrentRow >= nEndRow + 2) + { + nEndRow ++ ; + aSlider.SetRange( Range( 0, nEndRow - nStartRow + 1) ); + } + FillCtrls(aCurrentRow); + pDocSh->SetDocumentModified(); + pDocSh->PostPaintGridAll(); + + } + return 0; +} + +IMPL_LINK( ScDataFormDlg, Impl_LastHdl, PushButton*, pBtn) +{ + if (pDoc) + { + if ( aCurrentRow > nStartRow +1 ) + aCurrentRow--; + + FillCtrls(aCurrentRow); + } + return 0; +} + +IMPL_LINK( ScDataFormDlg, Impl_NextHdl, PushButton*, pBtn) +{ + if (pDoc) + { + if ( aCurrentRow <= nEndRow) + aCurrentRow++; + + FillCtrls(aCurrentRow); + } + return 0; +} + +IMPL_LINK( ScDataFormDlg, Impl_RestoreHdl, PushButton*, pBtn) +{ + if (pDoc) + { + FillCtrls(aCurrentRow); + } + return 0; +} + +IMPL_LINK( ScDataFormDlg, Impl_DeleteHdl, PushButton*, pBtn) +{ + ScViewData* pViewData = pTabViewShell->GetViewData(); + ScDocShell* pDocSh = pViewData->GetDocShell(); + if (pDoc) + { + ScRange aRange(nStartCol, aCurrentRow, nTab, nEndCol, aCurrentRow, nTab); + pDoc->DeleteRow(aRange); + + FillCtrls(aCurrentRow); + pDocSh->SetDocumentModified(); + pDocSh->PostPaintGridAll(); + } + return 0; +} + +IMPL_LINK( ScDataFormDlg, Impl_CloseHdl, PushButton*, pBtn) +{ + EndDialog( ); + return 0; +} + +IMPL_LINK( ScDataFormDlg, Impl_ScrollHdl, ScrollBar*, EMPTYARG) +{ + long nOffset = aSlider.GetThumbPos(); + aCurrentRow = nStartRow + nOffset + 1; + FillCtrls(aCurrentRow); + return 0; +} --- ori/sc/source/ui/miscdlgs/makefile.mk 2007-02-19 01:35:35.109375000 +0800 +++ ori/sc/source/ui/miscdlgs/makefile.mk 2007-03-02 17:00:59.578125000 +0800 @@ -54,6 +54,7 @@ # --- Files -------------------------------------------------------- SLOFILES = \ + $(SLO)$/datafdlg.obj \ $(SLO)$/delcldlg.obj \ $(SLO)$/inscldlg.obj \ $(SLO)$/delcodlg.obj \ --- ori/sc/source/ui/src/datafdlg.src 1970-01-01 08:00:00.000000000 +0800 +++ ori/sc/source/ui/src/datafdlg.src 2007-02-19 01:00:25.578125000 +0800 @@ -0,0 +1,108 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: datafdlg.src,v $ + * + * $Revision: 1.00 $ + * + * last change: $Author: hr $ $Date: 2005/09/23 15:07:30 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include "datafdlg.hrc" + +//zhangyun, dataform +ModalDialog RID_SCDLG_DATAFORM +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 191 , 180 ) ; + Text [ en-US ] = "Data Form" ; + Moveable = TRUE ; + Closeable = TRUE ; + FixedText LAB_DATAFORM_RECORDNO + { + Pos = MAP_APPFONT ( 136 , 6 ) ; + Size = MAP_APPFONT ( 50 , 12 ) ; + Text [ en-US ] = "/" ; + }; + PushButton BTN_DATAFORM_NEW + { + Pos = MAP_APPFONT ( 135 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + Text [ en-US ] = "New" ; + }; + PushButton BTN_DATAFORM_DELETE + { + Pos = MAP_APPFONT ( 135 , 40 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Delete" ; + }; + PushButton BTN_DATAFORM_RESTORE + { + Pos = MAP_APPFONT ( 135 , 57 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Restore" ; + }; + PushButton BTN_DATAFORM_LAST + { + Pos = MAP_APPFONT ( 135 , 82 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Last Record" ; + }; + PushButton BTN_DATAFORM_NEXT + { + Pos = MAP_APPFONT ( 135 , 99 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Next Record" ; + }; + PushButton BTN_DATAFORM_CLOSE + { + Pos = MAP_APPFONT ( 135 , 116 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Close" ; + }; + ScrollBar WND_DATAFORM_SCROLLBAR + { + Pos = MAP_APPFONT ( 124 , 6 ) ; + Size = MAP_APPFONT ( 8 , 135 ) ; + HScroll = FALSE ; + TabStop = FALSE ; + }; +}; +//end + + + + --- ori/sc/source/ui/src/makefile.mk 2006-07-11 02:54:14.000000000 +0800 +++ ori/sc/source/ui/src/makefile.mk 2007-02-19 01:09:26.875000000 +0800 @@ -61,6 +61,7 @@ dbnamdlg.src \ subtdlg.src \ miscdlgs.src \ + datafdlg.src \ autofmt.src \ solvrdlg.src \ tabopdlg.src \ --- ori/sc/source/ui/view/cellsh2.cxx 2006-09-30 10:51:34.000000000 +0800 +++ ori/sc/source/ui/view/cellsh2.cxx 2007-03-01 16:21:04.328125000 +0800 @@ -229,6 +229,20 @@ } break; + case SID_DATA_FORM: + { + ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 + + AbstractScDataFormDlg* pDlg = pFact->CreateScDataFormDlg( pTabViewShell->GetDialogParent(),ResId(RID_SCDLG_DATAFORM), pTabViewShell); + DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 + + pDlg->Execute(); + + rReq.Done(); + } + break; + case SID_SUBTOTALS: { const SfxItemSet* pArgs = rReq.GetArgs(); --- ori/sc/util/makefile.mk 2006-09-30 11:16:16.000000000 +0800 +++ ori/sc/util/makefile.mk 2007-03-02 17:01:08.078125000 +0800 @@ -288,6 +288,7 @@ $(SLO)$/filldlg.obj \ $(SLO)$/delcodlg.obj \ $(SLO)$/delcldlg.obj \ + $(SLO)$/datafdlg.obj \ $(SLO)$/dapitype.obj \ $(SLO)$/dapidata.obj \ $(SLO)$/crdlg.obj \