diff options
author | Daniel Rentz <dr@openoffice.org> | 2002-05-22 06:23:28 +0000 |
---|---|---|
committer | Daniel Rentz <dr@openoffice.org> | 2002-05-22 06:23:28 +0000 |
commit | 604d08a00095e5cf81515b9a527bb0a29649bbeb (patch) | |
tree | d683cd94ad163a7e20f5f95721f1f06de6114410 /sc | |
parent | 7f86daa43d46c658f8cd2f21ea7debbedaea8a81 (diff) |
#99369# New dialog 'Select Sheets'
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/inc/shtabdlg.hxx | 18 | ||||
-rw-r--r-- | sc/source/ui/inc/submenu.hrc | 7 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/shtabdlg.cxx | 40 | ||||
-rw-r--r-- | sc/source/ui/src/scstring.src | 38 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwsh3.cxx | 64 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwshf.cxx | 22 | ||||
-rw-r--r-- | sc/util/hidother.src | 5 |
7 files changed, 132 insertions, 62 deletions
diff --git a/sc/source/ui/inc/shtabdlg.hxx b/sc/source/ui/inc/shtabdlg.hxx index c88c1a98d35d..cd0f267bc147 100644 --- a/sc/source/ui/inc/shtabdlg.hxx +++ b/sc/source/ui/inc/shtabdlg.hxx @@ -2,9 +2,9 @@ * * $RCSfile: shtabdlg.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:45:00 $ + * last change: $Author: dr $ $Date: 2002-05-22 07:19:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,9 +62,6 @@ #ifndef SC_SHTABDLG_HXX #define SC_SHTABDLG_HXX -#ifndef _LIST_HXX //autogen -#include <tools/list.hxx> -#endif #ifndef _FIXED_HXX //autogen #include <vcl/fixed.hxx> #endif @@ -92,11 +89,20 @@ private: DECL_LINK( DblClkHdl, void * ); public: - ScShowTabDlg( Window* pParent, List& aEntryList ); + ScShowTabDlg( Window* pParent ); ~ScShowTabDlg(); + /** Sets dialog title, fixed text for listbox and help IDs. */ + void SetDescription( + const String& rTitle, const String& rFixedText, + ULONG nDlgHelpId, ULONG nLbHelpId ); + + /** Inserts a string into the ListBox. */ + void Insert( const String& rString, BOOL bSelected ); + USHORT GetSelectEntryCount() const; String GetSelectEntry(USHORT nPos) const; + USHORT GetSelectEntryPos(USHORT nPos) const; }; diff --git a/sc/source/ui/inc/submenu.hrc b/sc/source/ui/inc/submenu.hrc index 0f1b3acd2c5e..c857312e33cc 100644 --- a/sc/source/ui/inc/submenu.hrc +++ b/sc/source/ui/inc/submenu.hrc @@ -2,9 +2,9 @@ * * $RCSfile: submenu.hrc,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:45:01 $ + * last change: $Author: dr $ $Date: 2002-05-22 07:19:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -98,4 +98,5 @@ #define SUBMENU_OBJANCHOR 35 #define SUBMENU_SENDTO 36 #define SUBMENU_CHANGES 37 -#define MN_TEMPLATES 38 +#define SUBMENU_EDIT_TABLE 38 +#define MN_TEMPLATES 39 diff --git a/sc/source/ui/miscdlgs/shtabdlg.cxx b/sc/source/ui/miscdlgs/shtabdlg.cxx index a8687a838e1a..560ae1d35a00 100644 --- a/sc/source/ui/miscdlgs/shtabdlg.cxx +++ b/sc/source/ui/miscdlgs/shtabdlg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: shtabdlg.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:45:03 $ + * last change: $Author: dr $ $Date: 2002-05-22 07:20:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,7 +76,7 @@ //================================================================== -ScShowTabDlg::ScShowTabDlg( Window* pParent, List& aEntryList ) : +ScShowTabDlg::ScShowTabDlg( Window* pParent ) : ModalDialog ( pParent, ScResId( RID_SCDLG_SHOW_TAB ) ), aLb ( this, ScResId( LB_ENTRYLIST ) ), aBtnOk ( this, ScResId( BTN_OK ) ), @@ -87,22 +87,31 @@ ScShowTabDlg::ScShowTabDlg( Window* pParent, List& aEntryList ) : aLb.Clear(); aLb.SetDoubleClickHdl( LINK( this, ScShowTabDlg, DblClkHdl ) ); - void* pListEntry = aEntryList.First(); - while ( pListEntry ) - { - aLb.InsertEntry( *((String*)pListEntry ) ); - pListEntry = aEntryList.Next(); - } - - if ( aLb.GetEntryCount() > 0 ) - aLb.SelectEntryPos( 0 ); - //------------- FreeResource(); } //------------------------------------------------------------------------ +void ScShowTabDlg::SetDescription( + const String& rTitle, const String& rFixedText, + ULONG nDlgHelpId, ULONG nLbHelpId ) +{ + SetText( rTitle ); + aFtLbTitle.SetText( rFixedText ); + SetHelpId( nDlgHelpId ); + aLb.SetHelpId( nLbHelpId ); +} + +void ScShowTabDlg::Insert( const String& rString, BOOL bSelected ) +{ + aLb.InsertEntry( rString ); + if( bSelected ) + aLb.SelectEntryPos( aLb.GetEntryCount() - 1 ); +} + +//------------------------------------------------------------------------ + USHORT ScShowTabDlg::GetSelectEntryCount() const { return aLb.GetSelectEntryCount(); @@ -113,6 +122,11 @@ String ScShowTabDlg::GetSelectEntry(USHORT nPos) const return aLb.GetSelectEntry(nPos); } +USHORT ScShowTabDlg::GetSelectEntryPos(USHORT nPos) const +{ + return aLb.GetSelectEntryPos(nPos); +} + //------------------------------------------------------------------------ IMPL_LINK_INLINE_START( ScShowTabDlg, DblClkHdl, void *, EMPTYARG ) diff --git a/sc/source/ui/src/scstring.src b/sc/source/ui/src/scstring.src index f6be3684b3db..7a9e6605827c 100644 --- a/sc/source/ui/src/scstring.src +++ b/sc/source/ui/src/scstring.src @@ -2,9 +2,9 @@ * * $RCSfile: scstring.src,v $ * - * $Revision: 1.51 $ + * $Revision: 1.52 $ * - * last change: $Author: kz $ $Date: 2002-05-16 15:09:30 $ + * last change: $Author: dr $ $Date: 2002-05-22 07:21:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -3174,24 +3174,18 @@ String STR_CAPTION_DEFAULT_TEXT Text[ thai ] = "ข้อความ"; }; +// Select tables dialog title +String STR_DLG_SELECTTABLES_TITLE +{ + Text = "Tabellen selektieren"; + Text[ ENGLISH ] = "Select Sheets"; + Text[ english_us ] = "Select Sheets"; +}; - - - - - - - - - - - - - - - - - - - - +// Select tables dialog listbox +String STR_DLG_SELECTTABLES_LBNAME +{ + Text = "~Selektierte Tabellen"; + Text[ ENGLISH ] = "~Selected sheets"; + Text[ english_us ] = "~Selected sheets"; +}; diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index 7db0c6608223..c33416ff5719 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -2,9 +2,9 @@ * * $RCSfile: tabvwsh3.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: nn $ $Date: 2002-03-04 19:28:30 $ + * last change: $Author: dr $ $Date: 2002-05-22 07:22:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -105,6 +105,7 @@ #include "autoform.hxx" #include "autofmt.hxx" #include "dwfunctr.hxx" +#include "shtabdlg.hxx" #define IS_EDITMODE() GetViewData()->HasEditView( GetViewData()->GetActivePart() ) #define IS_AVAILABLE(WhichId,ppItem) \ @@ -707,6 +708,65 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) rReq.Done(); break; + case SID_SELECT_TABLES: + { + ScViewData& rViewData = *GetViewData(); + ScDocument& rDoc = *rViewData.GetDocument(); + ScMarkData& rMark = rViewData.GetMarkData(); + sal_uInt16 nTabCount = rDoc.GetTableCount(); + sal_uInt16 nTab; + + ScShowTabDlg* pDlg = new ScShowTabDlg( GetDialogParent() ); + pDlg->SetDescription( + String( ScResId( STR_DLG_SELECTTABLES_TITLE ) ), + String( ScResId( STR_DLG_SELECTTABLES_LBNAME ) ), + SID_SELECT_TABLES, HID_SELECTTABLES ); + + // fill all table names with selection state + String aTabName; + for( nTab = 0; nTab < nTabCount; ++nTab ) + { + rDoc.GetName( nTab, aTabName ); + pDlg->Insert( aTabName, rMark.GetTableSelect( nTab ) ); + } + + if( pDlg->Execute() == RET_OK ) + { + sal_uInt16 nSelCount = pDlg->GetSelectEntryCount(); + sal_uInt16 nSelIx; + sal_uInt16 nSelTab = nSelCount ? pDlg->GetSelectEntryPos( 0 ) : 0; + sal_uInt16 nFirstVisTab = 0; + + // special case: only hidden tables selected -> do nothing + sal_Bool bVisSelected = sal_False; + for( nSelIx = 0; !bVisSelected && (nSelIx < nSelCount); ++nSelIx ) + bVisSelected = rDoc.IsVisible( nFirstVisTab = pDlg->GetSelectEntryPos( nSelIx ) ); + if( !bVisSelected ) + nSelCount = 0; + + // select the tables + if( nSelCount ) + { + for( nTab = 0; nTab < nTabCount; ++nTab ) + rMark.SelectTable( nTab, sal_False ); + + for( nSelIx = 0; nSelIx < nSelCount; ++nSelIx ) + rMark.SelectTable( pDlg->GetSelectEntryPos( nSelIx ), sal_True ); + + // activate another table, if current is deselected + if( !rMark.GetTableSelect( rViewData.GetTabNo() ) ) + { + rMark.SelectTable( nFirstVisTab, sal_True ); + SetTabNo( nFirstVisTab ); + } + + rViewData.GetDocShell()->PostPaintExtras(); + rViewData.GetBindings().Invalidate( FID_FILL_TAB ); + } + } + delete pDlg; + } + break; case SID_OUTLINE_DELETEALL: diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index c587e40ec467..61e1c9df5452 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -2,9 +2,9 @@ * * $RCSfile: tabvwshf.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:45:10 $ + * last change: $Author: dr $ $Date: 2002-05-22 07:22:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -195,19 +195,20 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) } else { - List aList; + ScShowTabDlg* pDlg = new ScShowTabDlg( GetDialogParent() ); + String aTabName; + BOOL bFirst = TRUE; for ( USHORT i=0; i != nTabCount; i++ ) { if (!pDoc->IsVisible(i)) { - String* pNewEntry = new String; - pDoc->GetName( i, *pNewEntry ); - aList.Insert( pNewEntry ); + pDoc->GetName( i, aTabName ); + pDlg->Insert( aTabName, bFirst ); + bFirst = FALSE; } } - ScShowTabDlg* pDlg = new ScShowTabDlg( GetDialogParent(), aList ); if ( pDlg->Execute() == RET_OK ) { USHORT nCount = pDlg->GetSelectEntryCount(); @@ -220,13 +221,6 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) rReq.Done(); } delete pDlg; - - void* pEntry = aList.First(); - while ( pEntry ) - { - delete (String*) aList.Remove( pEntry ); - pEntry = aList.Next(); - } } } break; diff --git a/sc/util/hidother.src b/sc/util/hidother.src index 04feda0b40fd..0b19a8c45130 100644 --- a/sc/util/hidother.src +++ b/sc/util/hidother.src @@ -2,9 +2,9 @@ * * $RCSfile: hidother.src,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: dr $ $Date: 2002-05-15 08:30:00 $ + * last change: $Author: dr $ $Date: 2002-05-22 07:23:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -121,6 +121,7 @@ hidspecial HID_PASSWD_DOC { HelpID = HID_PASSWD_DOC; }; hidspecial HID_CHG_PROTECT { HelpID = HID_CHG_PROTECT; }; hidspecial HID_SCDLG_LINKAREAURL { HelpID = HID_SCDLG_LINKAREAURL; }; hidspecial HID_SC_RENAME_OBJECT { HelpID = HID_SC_RENAME_OBJECT; }; +hidspecial HID_SELECTTABLES { HelpId = HID_SELECTTABLES; }; // 2. Seite Funktionsautopilot: nur als Unique-IDs |