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


Hi Andy and Kohei,

Hereby additional patch with:

* Check on pName is NULL.

* Showing original sheet name in input box, when Rename option is checked.

Not  implemented: OrgName_#.

Joost

2010/12/12 Joost Eekhoorn <joost.eekhoorn@gmail.com>

Hi Andy,

Point made.
I will do the same as in the Rename dialog, thus if 'Sheet1' is selected,
the rename input box will show 'Sheet1', when Rename is checked.

I must also fix something in my last patch, now that MoveTable has a
pointer as last argument:
    if( rName.Len() )
is changed to:
    if( pName->Len() )
but must be:
    if( ( pName != NULL ) && ( pName->Len() ) )

Joost

2010/12/11 Andy Brown <andy@the-martin-byrd.net>

On Sat Dec 11 2010 13:54:38 GMT-0800 (PST)  Joost Eekhoorn wrote:

Hi Kohei,


 > * 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.


The default for RC1 is to use the default sheet name when selecting Rename
from the context menu, see attached.  Personally I would prefer to follow
this for the new setup.

Thanks again for taking this on.

Andy



From 003188d6ea1aebd0a07c7eba6198ac0b7605c2ae Mon Sep 17 00:00:00 2001
From: Joost Wezenbeek <joost.eekhoorn@gmail.com>
Date: Sun, 12 Dec 2010 12:04:34 +0100
Subject: [PATCH] Change Sheet copy process

Easy Hacks 3.27
Added rename in Move/Copy Sheet in calc
---
 sc/inc/scabstdlg.hxx               |    4 +++-
 sc/source/ui/attrdlg/scdlgfact.cxx |    6 ++++--
 sc/source/ui/attrdlg/scdlgfact.hxx |    5 ++++-
 sc/source/ui/inc/mvtabdlg.hxx      |    4 +++-
 sc/source/ui/miscdlgs/mvtabdlg.cxx |   10 +++++++++-
 sc/source/ui/view/tabvwshf.cxx     |    7 ++++++-
 sc/source/ui/view/viewfun2.cxx     |    4 ++--
 7 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 102ea20..93b291c 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -410,7 +410,9 @@ public:
                                                                 long                   nFirst    = 
1,
                                                                 long          nLast     = 100 ) = 
0;
 
-    virtual AbstractScMoveTableDlg * CreateScMoveTableDlg(  Window* pParent, int nId ) = 0; //add 
for ScMoveTableDlg
+    virtual AbstractScMoveTableDlg * CreateScMoveTableDlg(  Window* pParent,  //add for 
ScMoveTableDlg
+                                                            const String& rDefault,
+                                                            int nId ) = 0;
 
     virtual AbstractScNameCreateDlg * CreateScNameCreateDlg ( Window * pParent, USHORT nFlags, int 
nId ) = 0; //add for ScNameCreateDlg
 
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 10f0065..d31bd7e 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -1125,13 +1125,15 @@ AbstractScMetricInputDlg * 
ScAbstractDialogFactory_Impl::CreateScMetricInputDlg
 
 
 //add for  ScMoveTableDlg  begin
-AbstractScMoveTableDlg * ScAbstractDialogFactory_Impl::CreateScMoveTableDlg(  Window* pParent, int 
nId )
+AbstractScMoveTableDlg * ScAbstractDialogFactory_Impl::CreateScMoveTableDlg(  Window* pParent,
+                                                                              const String& 
rDefault,
+                                                                              int nId )
 {
     ScMoveTableDlg * pDlg=NULL;
     switch ( nId )
     {
         case RID_SCDLG_MOVETAB :
-            pDlg = new ScMoveTableDlg( pParent );
+            pDlg = new ScMoveTableDlg( pParent, rDefault );
             break;
         default:
             break;
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index f4a8286..0738e97 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -492,7 +492,10 @@ public:
                                                                 long                   nFirst    = 
1,
                                                                 long          nLast     = 100 );
 
-    virtual AbstractScMoveTableDlg * CreateScMoveTableDlg(  Window* pParent, int nId ); //add for 
ScMoveTableDlg
+    virtual AbstractScMoveTableDlg * CreateScMoveTableDlg(  Window* pParent,  //add for 
ScMoveTableDlg
+                                                            const String& rDefault,
+                                                            int nId );
+
     virtual AbstractScNameCreateDlg * CreateScNameCreateDlg ( Window * pParent, USHORT nFlags, int 
nId ); //add for ScNameCreateDlg
 
     virtual AbstractScNamePasteDlg * CreateScNamePasteDlg ( Window * pParent, const ScRangeName* 
pList, //add for ScNamePasteDlg
diff --git a/sc/source/ui/inc/mvtabdlg.hxx b/sc/source/ui/inc/mvtabdlg.hxx
index 1ffdc28..8724bc4 100644
--- a/sc/source/ui/inc/mvtabdlg.hxx
+++ b/sc/source/ui/inc/mvtabdlg.hxx
@@ -45,7 +45,7 @@
 class ScMoveTableDlg : public ModalDialog
 {
 public:
-                    ScMoveTableDlg( Window* pParent );
+                    ScMoveTableDlg( Window* pParent, const String& rDefault );
                     ~ScMoveTableDlg();
 
     USHORT     GetSelectedDocument             () const;
@@ -71,6 +71,8 @@ private:
     CancelButton       aBtnCancel;
     HelpButton         aBtnHelp;
 
+    const String&      mrDefaultName;
+
     USHORT                     nDocument;
     SCTAB                      nTable;
     BOOL                       bCopyTable;
diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx
index 1a911ad..b95bae3 100644
--- a/sc/source/ui/miscdlgs/mvtabdlg.cxx
+++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx
@@ -56,7 +56,8 @@
 
 //==================================================================
 
-ScMoveTableDlg::ScMoveTableDlg( Window* pParent )
+ScMoveTableDlg::ScMoveTableDlg( Window*       pParent,
+                                const String& rDefault )
 
     :  ModalDialog ( pParent, ScResId( RID_SCDLG_MOVETAB ) ),
         //
@@ -71,6 +72,7 @@ ScMoveTableDlg::ScMoveTableDlg( Window* pParent )
         aBtnCancel  ( this, ScResId( BTN_CANCEL ) ),
         aBtnHelp    ( this, ScResId( BTN_HELP ) ),
         //
+        mrDefaultName( rDefault ),
         nDocument   ( 0 ),
         nTable      ( 0 ),
         bCopyTable  ( FALSE ),
@@ -136,6 +138,7 @@ void ScMoveTableDlg::EnableTabName(BOOL bFlag)
     if(bFlag)
     {
         aEdTabName.Enable();
+        aEdTabName.SetText( mrDefaultName );
     }
     else
     {
@@ -213,6 +216,11 @@ IMPL_LINK( ScMoveTableDlg, OkHdl, void *, EMPTYARG )
     nTable      = (nTabSel != nTabLast) ? static_cast<SCTAB>(nTabSel) : SC_TAB_APPEND;
     bCopyTable  = aBtnCopy.IsChecked();
     bRenameTable= aBtnRename.IsChecked();
+
+    // Return an empty string, when the new name is the same as the original name.
+    if( mrDefaultName == aEdTabName.GetText() )
+        aEdTabName.SetText( String() );
+
     EndDialog( RET_OK );
 
     return 0;
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index b22c1ca..d46d7ec 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -544,10 +544,15 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
                 }
                 else
                 {
+                    String aDefaultName;
+                    pDoc->GetName( pViewData->GetTabNo(), aDefaultName );
+
                     ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
                     DBG_ASSERT(pFact, "ScAbstractFactory create fail!");
 
-                    AbstractScMoveTableDlg* pDlg = pFact->CreateScMoveTableDlg( GetDialogParent(), 
RID_SCDLG_MOVETAB );
+                    AbstractScMoveTableDlg* pDlg = pFact->CreateScMoveTableDlg( GetDialogParent(),
+                                                                                aDefaultName,
+                                                                                RID_SCDLG_MOVETAB 
);
                     DBG_ASSERT(pDlg, "Dialog create fail!");
 
                     SCTAB nTableCount = pDoc->GetTableCount();
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 74467c5..2dd802b 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -2649,7 +2649,7 @@ 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( pName->Len() )
+            if( (pName != NULL ) && ( pName->Len() ) )
                 aName = *pName;
             else
                 pDoc->GetName( TheTabs[j], aName );
@@ -2834,7 +2834,7 @@ void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy, 
const
         }
 
         // Rename must be done after that all sheets have been moved.
-        if( pName->Len() )
+        if( (pName != NULL) && ( pName->Len() ) )
         {
             for(int j=0;j<TheDestTabs.Count();j++)
             {
-- 
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.