summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2011-11-22 05:03:51 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2011-11-23 06:25:34 +0100
commit1d2142fb962e7ff0b3f638fb90c1ea63372fe13c (patch)
tree7179fc68e068b6c5164ddd437174246c1beacd31 /sc/source
parent7acefae208e815f4abcb19fdd034e52f6f4da9b8 (diff)
ManageNames: add table to "Paste Names" dialog
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.cxx5
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.hxx3
-rw-r--r--sc/source/ui/inc/miscdlgs.hrc2
-rw-r--r--sc/source/ui/inc/namedlg.hxx9
-rw-r--r--sc/source/ui/inc/namemgrtable.hxx16
-rw-r--r--sc/source/ui/inc/namepast.hxx15
-rw-r--r--sc/source/ui/namedlg/namepast.cxx34
-rw-r--r--sc/source/ui/src/miscdlgs.src23
-rw-r--r--sc/source/ui/view/cellsh1.cxx4
-rw-r--r--sc/source/ui/view/editsh.cxx4
10 files changed, 83 insertions, 32 deletions
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 11ba37318e0b..66e773dfe48a 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -1136,14 +1136,13 @@ AbstractScNameCreateDlg * ScAbstractDialogFactory_Impl::CreateScNameCreateDlg (
-AbstractScNamePasteDlg * ScAbstractDialogFactory_Impl::CreateScNamePasteDlg ( Window * pParent, const ScRangeName* pList,
- const ScRangeName* pLocalList, int nId , bool bInsList )
+AbstractScNamePasteDlg * ScAbstractDialogFactory_Impl::CreateScNamePasteDlg ( Window * pParent, ScDocShell* pShell, int nId , bool bInsList )
{
ScNamePasteDlg * pDlg=NULL;
switch ( nId )
{
case RID_SCDLG_NAMES_PASTE :
- pDlg = new ScNamePasteDlg( pParent, pList, pLocalList, bInsList );
+ pDlg = new ScNamePasteDlg( pParent, pShell, bInsList );
break;
default:
break;
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 33a6a569785e..f8648400963c 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -485,8 +485,7 @@ public:
virtual AbstractScNameCreateDlg * CreateScNameCreateDlg ( Window * pParent, sal_uInt16 nFlags, int nId ); //add for ScNameCreateDlg
- virtual AbstractScNamePasteDlg * CreateScNamePasteDlg ( Window * pParent, const ScRangeName* pList, //add for ScNamePasteDlg
- const ScRangeName* pLocalList, int nId , bool bInsList=true );
+ virtual AbstractScNamePasteDlg * CreateScNamePasteDlg ( Window * pParent, ScDocShell* pShell, int nId , bool bInsList=true ); //add for ScNamePasteDlg
virtual AbstractScPivotFilterDlg * CreateScPivotFilterDlg ( Window* pParent, //add for ScPivotFilterDlg
const SfxItemSet& rArgSet, sal_uInt16 nSourceTab , int nId );
diff --git a/sc/source/ui/inc/miscdlgs.hrc b/sc/source/ui/inc/miscdlgs.hrc
index a281ae91847e..420e0fad9d67 100644
--- a/sc/source/ui/inc/miscdlgs.hrc
+++ b/sc/source/ui/inc/miscdlgs.hrc
@@ -94,6 +94,8 @@
#define BTN_CLOSE 60
#define BTN_PASTE 61
#define BTN_PASTE_ALL 62
+#define CTRL_TABLE 63
+#define FL_DIV 64
// Tabelle einfuegen/loeschen
#define FT_DEST 1
diff --git a/sc/source/ui/inc/namedlg.hxx b/sc/source/ui/inc/namedlg.hxx
index c672068114fa..1751dfbff5ce 100644
--- a/sc/source/ui/inc/namedlg.hxx
+++ b/sc/source/ui/inc/namedlg.hxx
@@ -34,7 +34,6 @@
#include <vcl/group.hxx>
#include <vcl/fixed.hxx>
#include <vcl/lstbox.hxx>
-#include <vcl/ctrl.hxx>
#include "rangenam.hxx"
#include "anyrefdg.hxx"
@@ -50,14 +49,6 @@ class ScViewData;
class ScDocument;
-
-class ScRangeManagerCtrl : public Control
-{
-public:
- ScRangeManagerCtrl(Window* pParent, const ScResId& rResId):
- Control( pParent, rResId) {}
-};
-
//==================================================================
//logic behind the manage names dialog
diff --git a/sc/source/ui/inc/namemgrtable.hxx b/sc/source/ui/inc/namemgrtable.hxx
index a7beab040791..036627c90924 100644
--- a/sc/source/ui/inc/namemgrtable.hxx
+++ b/sc/source/ui/inc/namemgrtable.hxx
@@ -27,8 +27,14 @@
*/
#include <svtools/headbar.hxx>
#include <svtools/svtabbx.hxx>
+#include <vcl/ctrl.hxx>
+
+#include "scresid.hxx"
#include <vector>
+#include <boost/ptr_container/ptr_map.hpp>
+
+class ScRangeName;
struct ScRangeNameLine
{
@@ -37,6 +43,16 @@ struct ScRangeNameLine
rtl::OUString aScope;
};
+/** Implements the Control behind the table
+ * It controls the size of the table
+ */
+class ScRangeManagerCtrl : public Control
+{
+public:
+ ScRangeManagerCtrl(Window* pParent, const ScResId& rResId):
+ Control( pParent, rResId) {}
+};
+
//Implements the table for the manage names dialog
//TODO: cache the lines for performance improvements
//otherwise handling of a large set of range names might get extremely slow
diff --git a/sc/source/ui/inc/namepast.hxx b/sc/source/ui/inc/namepast.hxx
index c94e3dc0cf52..1da07901b588 100644
--- a/sc/source/ui/inc/namepast.hxx
+++ b/sc/source/ui/inc/namepast.hxx
@@ -33,23 +33,34 @@
#include <vcl/button.hxx>
#include <vcl/fixed.hxx>
#include <vcl/lstbox.hxx>
+#include "namemgrtable.hxx"
#include <vector>
#include "scui_def.hxx"
class ScRangeName;
+class ScDocShell;
class ScNamePasteDlg : public ModalDialog
{
DECL_LINK( ButtonHdl, Button * );
-protected:
+private:
HelpButton maHelpButton;
PushButton maBtnClose;
PushButton maBtnPaste;
PushButton maBtnPasteAll;
+ FixedLine maFlDiv;
+
+ ScRangeManagerCtrl maCtrl;
+
+ ScRangeManagerTable* mpTable;
+
+ std::vector<rtl::OUString> maSelectedNames;
public:
- ScNamePasteDlg( Window * pParent, const ScRangeName* pList, const ScRangeName* pLocalList, bool bInsList=true );
+ ScNamePasteDlg( Window * pParent, ScDocShell* pShell, bool bInsList=true );
+
+ virtual ~ScNamePasteDlg();
std::vector<rtl::OUString> GetSelectedNames() const;
bool IsAllSelected() const;
diff --git a/sc/source/ui/namedlg/namepast.cxx b/sc/source/ui/namedlg/namepast.cxx
index d0e1b3eba128..7db6abfc1dff 100644
--- a/sc/source/ui/namedlg/namepast.cxx
+++ b/sc/source/ui/namedlg/namepast.cxx
@@ -37,19 +37,34 @@
#include "namepast.hxx"
#include "scresid.hxx"
+#include "docsh.hxx"
#include "miscdlgs.hrc"
#include "rangenam.hxx"
//==================================================================
-ScNamePasteDlg::ScNamePasteDlg( Window * pParent, const ScRangeName* pList, const ScRangeName* pLocalList, bool bInsList )
+ScNamePasteDlg::ScNamePasteDlg( Window * pParent, ScDocShell* pShell, bool bInsList )
: ModalDialog( pParent, ScResId( RID_SCDLG_NAMES_PASTE ) ),
maHelpButton ( this, ScResId( BTN_HELP ) ),
maBtnClose ( this, ScResId( BTN_CLOSE ) ),
maBtnPaste ( this, ScResId( BTN_PASTE ) ),
- maBtnPasteAll ( this, ScResId( BTN_PASTE_ALL ) )
+ maBtnPasteAll ( this, ScResId( BTN_PASTE_ALL ) ),
+ maFlDiv ( this, ScResId( FL_DIV ) ),
+ maCtrl ( this, ScResId( CTRL_TABLE ) )
{
+ ScDocument* pDoc = pShell->GetDocument();
+ std::map<rtl::OUString, ScRangeName*> aCopyMap;
+ boost::ptr_map<rtl::OUString, ScRangeName> aRangeMap;
+ pDoc->GetRangeNameMap(aCopyMap);
+ std::map<rtl::OUString, ScRangeName*>::iterator itr = aCopyMap.begin(), itrEnd = aCopyMap.end();
+ for (; itr != itrEnd; ++itr)
+ {
+ rtl::OUString aTemp(itr->first);
+ aRangeMap.insert(aTemp, new ScRangeName(*itr->second));
+ }
+
+ mpTable = new ScRangeManagerTable(&maCtrl, aRangeMap);
maBtnPaste.SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl) );
maBtnPasteAll.SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl));
@@ -58,6 +73,11 @@ ScNamePasteDlg::ScNamePasteDlg( Window * pParent, const ScRangeName* pList, cons
FreeResource();
}
+ScNamePasteDlg::~ScNamePasteDlg()
+{
+ delete mpTable;
+}
+
//------------------------------------------------------------------
IMPL_LINK( ScNamePasteDlg, ButtonHdl, Button *, pButton )
@@ -68,6 +88,12 @@ IMPL_LINK( ScNamePasteDlg, ButtonHdl, Button *, pButton )
}
else if( pButton == &maBtnPaste )
{
+ std::vector<ScRangeNameLine> aSelectedLines = mpTable->GetSelectedEntries();
+ for (std::vector<ScRangeNameLine>::const_iterator itr = aSelectedLines.begin();
+ itr != aSelectedLines.end(); ++itr)
+ {
+ maSelectedNames.push_back(itr->aName);
+ }
EndDialog( BTN_PASTE_NAME );
}
else if( pButton == &maBtnClose )
@@ -81,9 +107,7 @@ IMPL_LINK( ScNamePasteDlg, ButtonHdl, Button *, pButton )
std::vector<rtl::OUString> ScNamePasteDlg::GetSelectedNames() const
{
- std::vector<rtl::OUString> aSelectedNames;
- //aSelectedNames.push_back(aNameList.GetSelectEntry());
- return aSelectedNames;
+ return maSelectedNames;
}
bool ScNamePasteDlg::IsAllSelected() const
diff --git a/sc/source/ui/src/miscdlgs.src b/sc/source/ui/src/miscdlgs.src
index 16e0a4703040..722d3098b8e9 100644
--- a/sc/source/ui/src/miscdlgs.src
+++ b/sc/source/ui/src/miscdlgs.src
@@ -1413,35 +1413,48 @@ ModalDialog RID_SCDLG_NAMES_PASTE
OutputSize = TRUE ;
HelpId = CMD_FID_INSERT_NAME ;
SVLook = TRUE ;
- Size = MAP_APPFONT ( 228 , 140 ) ;
+ Size = MAP_APPFONT ( 228 , 160 ) ;
Moveable = TRUE ;
+ Closeable = TRUE;
HelpButton BTN_HELP
{
- Pos = MAP_APPFONT ( 6, 120 ) ;
+ Pos = MAP_APPFONT ( 6, 140 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
};
PushButton BTN_PASTE
{
- Pos = MAP_APPFONT ( 172 , 90 ) ;
+ Pos = MAP_APPFONT ( 172 , 110 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
Text [en-US] = "Paste";
};
PushButton BTN_PASTE_ALL
{
- Pos = MAP_APPFONT ( 6 , 90 ) ;
+ Pos = MAP_APPFONT ( 6 , 110 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
Text [en-US] = "Paste All";
};
PushButton BTN_CLOSE
{
- Pos = MAP_APPFONT ( 172 , 120 ) ;
+ Pos = MAP_APPFONT ( 172 , 140 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
Text [en-US] = "Close";
};
+ Control CTRL_TABLE
+ {
+ Pos = MAP_APPFONT( 6, 6 );
+ Size = MAP_APPFONT( 210, 100 );
+ Border = TRUE;
+ DialogControl = TRUE;
+ };
+ FixedLine FL_DIV
+ {
+ Pos = MAP_APPFONT( 0, 132 );
+ Size = MAP_APPFONT( 228, 132 );
+ };
Text [ en-US ] = "Paste Names" ;
};
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index a9ca03b794b7..a8f5cba3dcc4 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -1819,12 +1819,10 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
case FID_INSERT_NAME:
{
- ScDocument* pDoc = GetViewData()->GetDocument();
- SCTAB nTab = GetViewData()->GetTabNo();
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
- AbstractScNamePasteDlg* pDlg = pFact->CreateScNamePasteDlg( pTabViewShell->GetDialogParent(), pDoc->GetRangeName(), pDoc->GetRangeName(nTab), RID_SCDLG_NAMES_PASTE );
+ AbstractScNamePasteDlg* pDlg = pFact->CreateScNamePasteDlg( pTabViewShell->GetDialogParent(), GetViewData()->GetDocShell(), RID_SCDLG_NAMES_PASTE );
OSL_ENSURE(pDlg, "Dialog create fail!");
switch( pDlg->Execute() )
{
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index c6fd63c63f9b..15bc31eb8bac 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -421,12 +421,10 @@ void ScEditShell::Execute( SfxRequest& rReq )
case FID_INSERT_NAME:
{
- ScDocument* pDoc = pViewData->GetDocument();
- SCTAB nTab = pViewData->GetTabNo();
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
- AbstractScNamePasteDlg* pDlg = pFact->CreateScNamePasteDlg( pViewData->GetDialogParent(), pDoc->GetRangeName(), pDoc->GetRangeName(nTab), RID_SCDLG_NAMES_PASTE, false );
+ AbstractScNamePasteDlg* pDlg = pFact->CreateScNamePasteDlg( pViewData->GetDialogParent(), pViewData->GetDocShell(), RID_SCDLG_NAMES_PASTE, false );
OSL_ENSURE(pDlg, "Dialog create fail!");
short nRet = pDlg->Execute();
// pDlg is needed below