Date: prev next · Thread: first prev next last
2010 Archives by date, by thread · List index


Hi Kohei,

Thanks for your review. Hereby an additional patch with changes on 4
comment-items. 2 items are not done.
MPL 1.1 / GPLv3+ / LGPLv3+

About UI

* Let's remove the 'New Name' string as I feel this is redundant.  And
 let' place the rename box either to the immediate right of 'Rename'
 check box, or immediately below it.  I prefer it being to the right
 of the check box since we have a plenty of space there.

Done.

* Instead of hiding the rename box, it's better to disable it when the
 Rename check box is not checked.  We generally don't show or hide
 controls but enable or disable it.

Done.

* Let's disable the Rename check box as well as the rename input box
 when multiple sheets are selected.  We don't know what we should do
 for multiple sheet copy/move & rename yet, so I would be more
 comfortable disabling it in such cases (at least for now).

Done.

* I think it would be more user-friendly if the Rename input box
 showed the default sheet name.  When moving a sheet, this would be
 the original sheet name, while when copying a sheet it would be the
 original name followed by '_' + <num> (e.g.  Sheet1 -> Sheet1_1).

An empty imput box is logical to me, because the Rename dialog shows
also an empty in input box.
But if you want, I can try to impement it.
It is not in this patch, because it more difficult than it sounds.
The default name depends on the document where the copy is going to,
if it is the same document or another document.

Others

* Move & rename sheet and undo afterward doesn't undo the renaming.
But this is less critical, and I could look into it if you don't
want to.

Skipped.
If you do undo (Ctrl-Z) twice, then the renaming will also be undone.

Code:

* Regarding the additional parameter in ScViewFunc::MoveTable(), I
 prefer using a pointer to String with a default value of NULL, since
 it's an optional parameter conceptually.

Done.

Joost


2010/12/11 Kohei Yoshida <kyoshida@novell.com>

On Fri, 2010-12-10 at 20:31 -0500, Kohei Yoshida wrote:
I'll CC Christoph in case he has some comments on this feature as well
as on my comments above.  Christoph, please feel free to add your
comments as well if you have any. :-)

And these are the screenshots of the new dialog.

Rename unchecked
http://people.freedesktop.org/~kohei/sheet-rename-unchecked.png<http://people.freedesktop.org/%7Ekohei/sheet-rename-unchecked.png>

Rename checked
http://people.freedesktop.org/~kohei/sheet-rename-checked.png<http://people.freedesktop.org/%7Ekohei/sheet-rename-checked.png>

--
Kohei Yoshida, LibreOffice hacker, Calc
<kyoshida@novell.com>


From 5ba6fe63e561625a1cbf109f98f32397ca6ec5b6 Mon Sep 17 00:00:00 2001
From: Joost Wezenbeek <joost.eekhoorn@gmail.com>
Date: Sat, 11 Dec 2010 21:52:42 +0100
Subject: [PATCH] Change Sheet copy process

Easy Hacks 3.27
Added rename in Move/Copy Sheet in calc
---
 sc/inc/scabstdlg.hxx               |    2 ++
 sc/source/ui/attrdlg/scdlgfact.cxx |    9 +++++++++
 sc/source/ui/attrdlg/scdlgfact.hxx |    2 ++
 sc/source/ui/inc/mvtabdlg.hxx      |    5 +++--
 sc/source/ui/inc/viewfunc.hxx      |    2 +-
 sc/source/ui/miscdlgs/mvtabdlg.cxx |   28 +++++++++++++++++-----------
 sc/source/ui/src/miscdlgs.src      |   16 +++++-----------
 sc/source/ui/view/tabcont.cxx      |    2 +-
 sc/source/ui/view/tabvwshf.cxx     |    6 +++++-
 sc/source/ui/view/viewfun2.cxx     |   10 +++++-----
 10 files changed, 50 insertions(+), 32 deletions(-)

diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index dc20e8f..102ea20 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -217,6 +217,8 @@ public:
     virtual void    GetTabNameString( String& rString ) const = 0;
     virtual void       SetCopyTable                    (BOOL bFlag=TRUE) = 0;
     virtual void       EnableCopyTable                 (BOOL bFlag=TRUE) = 0;
+    virtual void       SetRenameTable                  (BOOL bFlag=TRUE) = 0;
+    virtual void       EnableRenameTable               (BOOL bFlag=TRUE) = 0;
 };
 
 class AbstractScNameCreateDlg : public VclAbstractDialog  //add for ScNameCreateDlg
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 5a78eae..10f0065 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -518,6 +518,15 @@ void       AbstractScMoveTableDlg_Impl::EnableCopyTable(BOOL bFlag)
 {
     return pDlg->EnableCopyTable( bFlag);
 }
+void   AbstractScMoveTableDlg_Impl::SetRenameTable(BOOL bFla)
+{
+    return pDlg->SetRenameTable( bFla );
+}
+void   AbstractScMoveTableDlg_Impl::EnableRenameTable(BOOL bFlag)
+{
+    return pDlg->EnableRenameTable( bFlag);
+}
+
 //add for AbstractScMoveTableDlg_Impl end
 
 //add for AbstractScNameCreateDlg_Impl begin
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index dc583a6..f4a8286 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -267,6 +267,8 @@ class AbstractScMoveTableDlg_Impl : public AbstractScMoveTableDlg  //add for ScM
     virtual void    GetTabNameString( String& rString ) const;
     virtual void       SetCopyTable                    (BOOL bFlag=TRUE);
     virtual void       EnableCopyTable                 (BOOL bFlag=TRUE);
+    virtual void       SetRenameTable                  (BOOL bFlag=TRUE);
+    virtual void       EnableRenameTable               (BOOL bFlag=TRUE);
 };
 
 class AbstractScNameCreateDlg_Impl : public AbstractScNameCreateDlg  //add for ScNameCreateDlg
diff --git a/sc/source/ui/inc/mvtabdlg.hxx b/sc/source/ui/inc/mvtabdlg.hxx
index 543fa01..1ffdc28 100644
--- a/sc/source/ui/inc/mvtabdlg.hxx
+++ b/sc/source/ui/inc/mvtabdlg.hxx
@@ -56,7 +56,8 @@ public:
     void       SetCopyTable                    (BOOL bFlag=TRUE);
     void       EnableCopyTable                 (BOOL bFlag=TRUE);
     void       SetRenameTable                  (BOOL bFlag=TRUE);
-    void       SetTabNameVisible               (BOOL bFlag=TRUE);
+    void       EnableRenameTable               (BOOL bFlag=TRUE);
+    void       EnableTabName                   (BOOL bFlag=TRUE);
 
 private:
     FixedText          aFtDoc;
@@ -65,7 +66,6 @@ private:
     ListBox                    aLbTable;
     CheckBox           aBtnCopy;
     CheckBox           aBtnRename;
-    FixedText          aFtTabName;
     Edit               aEdTabName;
     OKButton           aBtnOk;
     CancelButton       aBtnCancel;
@@ -77,6 +77,7 @@ private:
     BOOL                       bRenameTable;
     //--------------------------------------
     void       Init                    ();
+    void    InitBtnRename      ();
     void       InitDocListBox  ();
     DECL_LINK( OkHdl, void * );
     DECL_LINK( SelHdl, ListBox * );
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index e8ed808..95158e9 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -272,7 +272,7 @@ public:
     BOOL                       DeleteTables(const SvShorts &TheTabs, BOOL bRecord = TRUE );
 
     BOOL                       RenameTable( const String& rName, SCTAB nTabNr );
-    void                       MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy, const 
String& rName );
+    void                       MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy, const 
String* pName = NULL );
     void                       ImportTables( ScDocShell* pSrcShell,
                                     SCTAB nCount, const SCTAB* pSrcTabs,
                                     BOOL bLink,SCTAB nTab);
diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx
index 6de8234..1a911ad 100644
--- a/sc/source/ui/miscdlgs/mvtabdlg.cxx
+++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx
@@ -66,7 +66,6 @@ ScMoveTableDlg::ScMoveTableDlg( Window* pParent )
         aLbTable    ( this, ScResId( LB_INSERT ) ),
         aBtnCopy    ( this, ScResId( BTN_COPY ) ),
         aBtnRename  ( this, ScResId( BTN_RENAME ) ),
-        aFtTabName  ( this, ScResId( FT_LABEL ) ),
         aEdTabName     ( this, ScResId( ED_INPUT ) ),
         aBtnOk      ( this, ScResId( BTN_OK ) ),
         aBtnCancel  ( this, ScResId( BTN_CANCEL ) ),
@@ -110,6 +109,7 @@ void ScMoveTableDlg::SetCopyTable(BOOL bFlag)
 {
     aBtnCopy.Check(bFlag);
 }
+
 void ScMoveTableDlg::EnableCopyTable(BOOL bFlag)
 {
     if(bFlag)
@@ -121,19 +121,26 @@ void ScMoveTableDlg::EnableCopyTable(BOOL bFlag)
 void ScMoveTableDlg::SetRenameTable(BOOL bFlag)
 {
     aBtnRename.Check(bFlag);
-    SetTabNameVisible(bFlag);
+    EnableTabName(bFlag);
+}
+
+void ScMoveTableDlg::EnableRenameTable(BOOL bFlag)
+{    if( bFlag )
+        aBtnRename.Enable();
+    else
+        aBtnRename.Disable();
 }
 
-void ScMoveTableDlg::SetTabNameVisible(BOOL bFlag)
+void ScMoveTableDlg::EnableTabName(BOOL bFlag)
 {
     if(bFlag)
     {
-        aFtTabName.Show();
-        aEdTabName.Show();
-    } else
+        aEdTabName.Enable();
+    }
+    else
     {
-        aFtTabName.Hide();
-        aEdTabName.Hide();
+        aEdTabName.Disable();
+        aEdTabName.SetText( String() );
     }
 }
 
@@ -146,7 +153,7 @@ void __EXPORT ScMoveTableDlg::Init()
     aBtnRename.SetToggleHdl( LINK( this, ScMoveTableDlg, RenameHdl ) );
     aBtnCopy.Check( FALSE );
     aBtnRename.Check( FALSE );
-    SetTabNameVisible( FALSE );
+    EnableTabName( FALSE );
     InitDocListBox();
     SelHdl( &aLbDoc );
 }
@@ -185,13 +192,12 @@ void ScMoveTableDlg::InitDocListBox()
     aLbDoc.SelectEntryPos( nSelPos );
 }
 
-
 //------------------------------------------------------------------------
 // Handler:
 
 IMPL_LINK( ScMoveTableDlg, RenameHdl, void *, EMPTYARG )
 {
-    SetTabNameVisible( aBtnRename.IsChecked() );
+    EnableTabName( aBtnRename.IsChecked() );
 
     return 0;
 }
diff --git a/sc/source/ui/src/miscdlgs.src b/sc/source/ui/src/miscdlgs.src
index 49bda22..cd7b2c6 100644
--- a/sc/source/ui/src/miscdlgs.src
+++ b/sc/source/ui/src/miscdlgs.src
@@ -439,7 +439,7 @@ ModalDialog RID_SCDLG_MOVETAB
     OutputSize = TRUE ;
     HelpId = FID_TAB_MOVE ;
     SVLook = TRUE ;
-    Size = MAP_APPFONT ( 168 , 180 ) ;
+    Size = MAP_APPFONT ( 168 , 154 ) ;
     Text [ en-US ] = "Move/Copy Sheet" ;
     Moveable = TRUE ;
     Closeable = FALSE ;
@@ -498,22 +498,16 @@ ModalDialog RID_SCDLG_MOVETAB
     };
     CheckBox BTN_RENAME
     {
-        Pos = MAP_APPFONT ( 6 , 124 ) ;
-        Size = MAP_APPFONT ( 100 , 10 ) ;
+        Pos = MAP_APPFONT ( 6 , 128 ) ;
+        Size = MAP_APPFONT (  52 , 10 ) ;
         Text [ en-US ] = "~Rename" ;
         TabStop = TRUE ;
     };
-    FixedText FT_LABEL
-    {
-        Pos = MAP_APPFONT ( 6 , 137 ) ;
-        Size = MAP_APPFONT ( 100 , 8 ) ;
-        Text [ en-US ] = "New ~name" ;
-    };
     Edit ED_INPUT
     {
         Border = TRUE ;
-        Pos = MAP_APPFONT ( 6 , 149 ) ;
-        Size = MAP_APPFONT ( 110 , 12 ) ;
+        Pos = MAP_APPFONT ( 58 , 127 ) ;
+        Size = MAP_APPFONT ( 104 , 12 ) ;
         TabStop = TRUE ;
     };
     String STR_NEWDOC
diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index b56fc42..14d0a33 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -552,7 +552,7 @@ sal_Int8 ScTabControl::ExecuteDrop( const ExecuteDropEvent& rEvt )
             if ( !pDoc->GetChangeTrack() && pDoc->IsDocEditable() )
             {
                 //! use table selection from the tab control where dragging was started?
-                pViewData->GetView()->MoveTable( lcl_DocShellNr(pDoc), nPos, rEvt.mnAction != 
DND_ACTION_MOVE, String() );
+                pViewData->GetView()->MoveTable( lcl_DocShellNr(pDoc), nPos, rEvt.mnAction != 
DND_ACTION_MOVE );
 
                 rData.pCellTransfer->SetDragWasInternal();          // don't delete
                 return TRUE;
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index 2fe2758..b22c1ca 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -560,6 +560,10 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
                         pDlg->SetCopyTable();
                         pDlg->EnableCopyTable(FALSE);
                     }
+                    if(nTabSelCount != 1)
+                    {
+                        pDlg->EnableRenameTable(FALSE);
+                    }
                     if ( pDlg->Execute() == RET_OK )
                     {
                         nDoc = pDlg->GetSelectedDocument();
@@ -600,7 +604,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
                 {
                     rReq.Done();               // aufzeichnen, solange das Dokument noch aktiv ist
 
-                    MoveTable( nDoc, nTab, bCpy, aTabName );
+                    MoveTable( nDoc, nTab, bCpy, &aTabName );
                 }
             }
             break;
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 95bbe70..74467c5 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -2547,7 +2547,7 @@ void ScViewFunc::ImportTables( ScDocShell* pSrcShell,
 //----------------------------------------------------------------------------
 //     Tabelle in anderes Dokument verschieben / kopieren
 
-void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy, const String& rName )
+void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy, const String* pName )
 {
     ScDocument* pDoc      = GetViewData()->GetDocument();
     ScDocShell* pDocShell  = GetViewData()->GetDocShell();
@@ -2649,8 +2649,8 @@ void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy, 
const
         for( USHORT j=0; j<TheTabs.Count(); j++, nDestTab1++ )
         {      // #63304# insert sheets first and update all references
             String aName;
-            if( rName.Len() )
-                aName = rName;
+            if( pName->Len() )
+                aName = *pName;
             else
                 pDoc->GetName( TheTabs[j], aName );
 
@@ -2834,12 +2834,12 @@ void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy, 
const
         }
 
         // Rename must be done after that all sheets have been moved.
-        if( rName.Len() )
+        if( pName->Len() )
         {
             for(int j=0;j<TheDestTabs.Count();j++)
             {
                 SCTAB nRenameTab = static_cast<SCTAB>(TheDestTabs[j]);
-                String aTabName( rName);
+                String aTabName( *pName);
                 pDoc->CreateValidTabName( aTabName );
                 pDocShell->GetDocFunc().RenameTable( nRenameTab, aTabName, TRUE, FALSE );
             }
-- 
1.7.1


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.