summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2012-04-17 20:57:34 +0200
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-04-17 15:50:08 -0400
commit05579aa8b26f593af650d8434ff1c25c0a2702a6 (patch)
tree35b61f498694ae10bda70307a433cbc9b8436bb6
parent5920b681eaf2f1203efd5af581827db2e1a81bc8 (diff)
resolved rhbz#813280 the current document is not always the first in list
i.e. if more than one document open and dialog invoked on any but the first document. Signed-off-by: Kohei Yoshida <kohei.yoshida@gmail.com>
-rw-r--r--sc/source/ui/inc/mvtabdlg.hxx2
-rw-r--r--sc/source/ui/miscdlgs/mvtabdlg.cxx27
2 files changed, 19 insertions, 10 deletions
diff --git a/sc/source/ui/inc/mvtabdlg.hxx b/sc/source/ui/inc/mvtabdlg.hxx
index c53a59fe7314..f9c63a334520 100644
--- a/sc/source/ui/inc/mvtabdlg.hxx
+++ b/sc/source/ui/inc/mvtabdlg.hxx
@@ -60,2 +60,3 @@ private:
ScDocument* GetSelectedDoc();
+ bool IsCurrentDocSelected() const;
@@ -84,2 +85,3 @@ private:
+ sal_uInt16 mnCurrentDocPos;
sal_uInt16 nDocument;
diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx
index 831905d1ea55..ffe96af26663 100644
--- a/sc/source/ui/miscdlgs/mvtabdlg.cxx
+++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx
@@ -72,2 +72,3 @@ ScMoveTableDlg::ScMoveTableDlg(Window* pParent, const rtl::OUString& rDefault)
maDefaultName( rDefault ),
+ mnCurrentDocPos( 0 ),
nDocument ( 0 ),
@@ -129,4 +130,9 @@ void ScMoveTableDlg::ResetRenameInput()
if (mbEverEdited)
+ {
// Don't reset the name when the sheet name has ever been edited.
+ // But check the name, as this is also called for change of copy/move
+ // buttons and document listbox selection.
+ CheckNewTabName();
return;
+ }
@@ -180,5 +186,6 @@ void ScMoveTableDlg::CheckNewTabName()
- bool bFound = false;
+ bool bMoveInCurrentDoc = (aBtnMove.IsChecked() && IsCurrentDocSelected());
+ bool bFound = false;
sal_uInt16 nLast = aLbTable.GetEntryCount() - 1;
- for ( sal_uInt16 i=0; i<=nLast; ++i )
+ for ( sal_uInt16 i=0; i<=nLast && !bFound; ++i )
{
@@ -186,9 +193,4 @@ void ScMoveTableDlg::CheckNewTabName()
{
- if (aBtnMove.IsChecked() &&
- aLbDoc.GetSelectEntryPos() == 0 &&
- maDefaultName.equals(aEdTabName.GetText()))
-
- // Move inside same document, thus same name is allowed.
- bFound = false;
- else
+ // Only for move within same document the same name is allowed.
+ if (!bMoveInCurrentDoc || !maDefaultName.equals( aEdTabName.GetText()))
bFound = true;
@@ -216,2 +218,7 @@ ScDocument* ScMoveTableDlg::GetSelectedDoc()
+bool ScMoveTableDlg::IsCurrentDocSelected() const
+{
+ return aLbDoc.GetSelectEntryPos() == mnCurrentDocPos;
+}
+
//------------------------------------------------------------------------
@@ -256,3 +263,3 @@ void ScMoveTableDlg::InitDocListBox()
{
- nSelPos = i;
+ mnCurrentDocPos = nSelPos = i;
aEntryName += sal_Unicode( ' ' );