parent
14d5dbf469
commit
213c9297f0
@ -0,0 +1,111 @@
|
|||||||
|
From 05579aa8b26f593af650d8434ff1c25c0a2702a6 Mon Sep 17 00:00:00 2001
|
||||||
|
Message-Id: <05579aa8b26f593af650d8434ff1c25c0a2702a6.1334752453.git.erack@redhat.com>
|
||||||
|
From: Eike Rathke <erack@redhat.com>
|
||||||
|
Date: Tue, 17 Apr 2012 20:57:34 +0200
|
||||||
|
Subject: [PATCH] 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>
|
||||||
|
---
|
||||||
|
sc/source/ui/inc/mvtabdlg.hxx | 2 ++
|
||||||
|
sc/source/ui/miscdlgs/mvtabdlg.cxx | 27 +++++++++++++++++----------
|
||||||
|
2 files changed, 19 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/sc/source/ui/inc/mvtabdlg.hxx b/sc/source/ui/inc/mvtabdlg.hxx
|
||||||
|
index c53a59f..f9c63a3 100644
|
||||||
|
--- a/sc/source/ui/inc/mvtabdlg.hxx
|
||||||
|
+++ b/sc/source/ui/inc/mvtabdlg.hxx
|
||||||
|
@@ -58,6 +58,7 @@ private:
|
||||||
|
void ResetRenameInput();
|
||||||
|
void CheckNewTabName();
|
||||||
|
ScDocument* GetSelectedDoc();
|
||||||
|
+ bool IsCurrentDocSelected() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
FixedLine aFlAction;
|
||||||
|
@@ -82,6 +83,7 @@ private:
|
||||||
|
|
||||||
|
const rtl::OUString maDefaultName;
|
||||||
|
|
||||||
|
+ sal_uInt16 mnCurrentDocPos;
|
||||||
|
sal_uInt16 nDocument;
|
||||||
|
SCTAB nTable;
|
||||||
|
bool bCopyTable:1;
|
||||||
|
diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx
|
||||||
|
index 831905d..ffe96af 100644
|
||||||
|
--- a/sc/source/ui/miscdlgs/mvtabdlg.cxx
|
||||||
|
+++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx
|
||||||
|
@@ -70,6 +70,7 @@ ScMoveTableDlg::ScMoveTableDlg(Window* pParent, const rtl::OUString& rDefault)
|
||||||
|
maStrTabNameInvalid( ResId::toString(ScResId(STR_TABNAME_WARN_INVALID)) ),
|
||||||
|
//
|
||||||
|
maDefaultName( rDefault ),
|
||||||
|
+ mnCurrentDocPos( 0 ),
|
||||||
|
nDocument ( 0 ),
|
||||||
|
nTable ( 0 ),
|
||||||
|
bCopyTable ( false ),
|
||||||
|
@@ -127,8 +128,13 @@ void ScMoveTableDlg::EnableRenameTable(sal_Bool bFlag)
|
||||||
|
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;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (!aEdTabName.IsEnabled())
|
||||||
|
{
|
||||||
|
@@ -178,19 +184,15 @@ void ScMoveTableDlg::CheckNewTabName()
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
- 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 )
|
||||||
|
{
|
||||||
|
if ( aNewName.equals(aLbTable.GetEntry(i)) )
|
||||||
|
{
|
||||||
|
- 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -214,6 +216,11 @@ ScDocument* ScMoveTableDlg::GetSelectedDoc()
|
||||||
|
return static_cast<ScDocument*>(aLbDoc.GetEntryData(nPos));
|
||||||
|
}
|
||||||
|
|
||||||
|
+bool ScMoveTableDlg::IsCurrentDocSelected() const
|
||||||
|
+{
|
||||||
|
+ return aLbDoc.GetSelectEntryPos() == mnCurrentDocPos;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void ScMoveTableDlg::Init()
|
||||||
|
@@ -254,7 +261,7 @@ void ScMoveTableDlg::InitDocListBox()
|
||||||
|
|
||||||
|
if ( pScSh == SfxObjectShell::Current() )
|
||||||
|
{
|
||||||
|
- nSelPos = i;
|
||||||
|
+ mnCurrentDocPos = nSelPos = i;
|
||||||
|
aEntryName += sal_Unicode( ' ' );
|
||||||
|
aEntryName += String( ScResId( STR_CURRENTDOC ) );
|
||||||
|
}
|
||||||
|
--
|
||||||
|
1.7.7.6
|
||||||
|
|
Loading…
Reference in new issue