diff options
-rw-r--r-- | sc/Library_sc.mk | 2 | ||||
-rw-r--r-- | sc/Library_scui.mk | 3 | ||||
-rw-r--r-- | sc/inc/scabstdlg.hxx | 11 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.cxx | 26 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.hxx | 11 | ||||
-rw-r--r-- | sc/source/ui/inc/namedefdlg.hxx | 7 | ||||
-rw-r--r-- | sc/source/ui/inc/namedlg.hxx | 31 | ||||
-rw-r--r-- | sc/source/ui/inc/namemgrtable.hxx | 59 | ||||
-rw-r--r-- | sc/source/ui/inc/namepast.hxx | 5 | ||||
-rw-r--r-- | sc/source/ui/namedlg/namedefdlg.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/namedlg/namedlg.cxx | 95 | ||||
-rw-r--r-- | sc/source/ui/namedlg/namemgrtable.cxx | 138 | ||||
-rw-r--r-- | sc/source/ui/namedlg/namepast.cxx (renamed from sc/source/ui/miscdlgs/namepast.cxx) | 11 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 19 | ||||
-rw-r--r-- | sc/source/ui/view/editsh.cxx | 22 |
15 files changed, 241 insertions, 205 deletions
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index afa9835c35aa..ce7e0c7485e7 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -402,7 +402,9 @@ $(eval $(call gb_Library_add_exception_objects,sc,\ sc/source/ui/miscdlgs/solvrdlg \ sc/source/ui/miscdlgs/tabopdlg \ sc/source/ui/miscdlgs/warnbox \ + sc/source/ui/namedlg/namedefdlg \ sc/source/ui/namedlg/namedlg \ + sc/source/ui/namedlg/namemgrtable \ sc/source/ui/navipi/content \ sc/source/ui/navipi/navcitem \ sc/source/ui/navipi/navipi \ diff --git a/sc/Library_scui.mk b/sc/Library_scui.mk index bd98b22fff13..ff791769ef52 100644 --- a/sc/Library_scui.mk +++ b/sc/Library_scui.mk @@ -94,13 +94,12 @@ $(eval $(call gb_Library_add_exception_objects,scui,\ sc/source/ui/miscdlgs/mtrindlg \ sc/source/ui/miscdlgs/mvtabdlg \ sc/source/ui/miscdlgs/namecrea \ - sc/source/ui/miscdlgs/namepast \ sc/source/ui/miscdlgs/scuiautofmt \ sc/source/ui/miscdlgs/shtabdlg \ sc/source/ui/miscdlgs/strindlg \ sc/source/ui/miscdlgs/tabbgcolordlg \ sc/source/ui/miscdlgs/textdlgs \ - sc/source/ui/namedlg/namedefdlg \ + sc/source/ui/namedlg/namepast \ sc/source/ui/optdlg/opredlin \ sc/source/ui/optdlg/tpcalc \ sc/source/ui/optdlg/tpcompatibility \ diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index ecb6fe610915..43e674e42eb2 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -230,12 +230,8 @@ public: class AbstractScNamePasteDlg : public VclAbstractDialog //add for ScNamePasteDlg { public: - virtual String GetSelectedName() const = 0; -}; - -class AbstractScNameAddDlg : public VclAbstractDialog // Define Name Dialog -{ -public: + virtual std::vector<rtl::OUString> GetSelectedNames() const = 0; + virtual bool IsAllSelected() const = 0; }; class AbstractScPivotFilterDlg : public VclAbstractDialog //add for ScPivotFilterDlg @@ -424,9 +420,6 @@ public: virtual AbstractScNamePasteDlg * CreateScNamePasteDlg ( Window * pParent, const ScRangeName* pList, //add for ScNamePasteDlg const ScRangeName* pLocalList, int nId , bool bInsList=true ) = 0; - virtual AbstractScNameAddDlg* CreateScNameAddDlg ( Window* pParent, ScDocument* pDoc, std::map<rtl::OUString, ScRangeName*> aRangeMap, - const ScAddress& aCursorPos, const bool bUndo, int nId) = 0; - virtual AbstractScPivotFilterDlg * CreateScPivotFilterDlg ( Window* pParent, //add for ScPivotFilterDlg const SfxItemSet& rArgSet, sal_uInt16 nSourceTab , int nId ) = 0; diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index bcfee55a5416..11ba37318e0b 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -107,7 +107,6 @@ IMPL_ABSTDLG_BASE(AbstractScMetricInputDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScMoveTableDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScNameCreateDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScNamePasteDlg_Impl); -IMPL_ABSTDLG_BASE(AbstractScNameAddDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScPivotFilterDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScDPFunctionDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScDPSubtotalDlg_Impl); @@ -508,12 +507,16 @@ sal_uInt16 AbstractScNameCreateDlg_Impl::GetFlags() const -String AbstractScNamePasteDlg_Impl::GetSelectedName() const +std::vector<rtl::OUString> AbstractScNamePasteDlg_Impl::GetSelectedNames() const { - return pDlg->GetSelectedName(); + return pDlg->GetSelectedNames(); } +bool AbstractScNamePasteDlg_Impl::IsAllSelected() const +{ + return pDlg->IsAllSelected(); +} const ScQueryItem& AbstractScPivotFilterDlg_Impl::GetOutputItem() @@ -1152,23 +1155,6 @@ AbstractScNamePasteDlg * ScAbstractDialogFactory_Impl::CreateScNamePasteDlg ( Wi } -AbstractScNameAddDlg* ScAbstractDialogFactory_Impl::CreateScNameAddDlg( Window* pParent, ScDocument* pDoc, std::map<rtl::OUString, ScRangeName*> aRangeMap, const ScAddress& aCursorPos, const bool bUndo, int nId) -{ - ScNameDefDlg* pDlg = NULL; - switch ( nId ) - { - case RID_SCDLG_NAMES_DEFINE : - pDlg = new ScNameDefDlg( pParent, pDoc, aRangeMap, aCursorPos, bUndo ); - break; - default: - break; - } - if ( pDlg ) - return new AbstractScNameAddDlg_Impl( pDlg ); - return 0; -} - - AbstractScPivotFilterDlg * ScAbstractDialogFactory_Impl::CreateScPivotFilterDlg ( Window* pParent, const SfxItemSet& rArgSet, sal_uInt16 nSourceTab , int nId ) { diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index 59ef68e08a31..33a6a569785e 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -283,12 +283,8 @@ class AbstractScNameCreateDlg_Impl : public AbstractScNameCreateDlg //add for S class AbstractScNamePasteDlg_Impl : public AbstractScNamePasteDlg //add for ScNamePasteDlg { DECL_ABSTDLG_BASE( AbstractScNamePasteDlg_Impl, ScNamePasteDlg ) - virtual String GetSelectedName() const; -}; - -class AbstractScNameAddDlg_Impl : public AbstractScNameAddDlg // Define Name -{ - DECL_ABSTDLG_BASE( AbstractScNameAddDlg_Impl, ScNameDefDlg ) + virtual std::vector<rtl::OUString> GetSelectedNames() const; + virtual bool IsAllSelected() const; }; class AbstractScPivotFilterDlg_Impl : public AbstractScPivotFilterDlg //add for ScPivotFilterDlg @@ -492,9 +488,6 @@ public: virtual AbstractScNamePasteDlg * CreateScNamePasteDlg ( Window * pParent, const ScRangeName* pList, //add for ScNamePasteDlg const ScRangeName* pLocalList, int nId , bool bInsList=true ); - virtual AbstractScNameAddDlg* CreateScNameAddDlg ( Window* pParent, ScDocument* pDoc, std::map<rtl::OUString, ScRangeName*> aRangeMap, - const ScAddress& aCursorPos, const bool bUndo, int nId); - virtual AbstractScPivotFilterDlg * CreateScPivotFilterDlg ( Window* pParent, //add for ScPivotFilterDlg const SfxItemSet& rArgSet, sal_uInt16 nSourceTab , int nId ); diff --git a/sc/source/ui/inc/namedefdlg.hxx b/sc/source/ui/inc/namedefdlg.hxx index 2ab03b18997b..33a1ae2cacbf 100644 --- a/sc/source/ui/inc/namedefdlg.hxx +++ b/sc/source/ui/inc/namedefdlg.hxx @@ -38,7 +38,7 @@ class ScRangeName; class ScDocument; -class ScNameDefDlg : public ModalDialog +class ScNameDefDlg : public ScAnyRefDlg { private: PushButton maBtnAdd; @@ -77,9 +77,10 @@ private: DECL_LINK( AddBtnHdl, void* ); DECL_LINK( NameModifyHdl, void* ); public: - ScNameDefDlg(Window* pParent, ScDocument* pDoc, std::map<rtl::OUString, ScRangeName*> aRangeMap, const ScAddress& aCursorPos, const bool bUndo); + ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, + ScDocument* pDoc, std::map<rtl::OUString, ScRangeName*> aRangeMap, + const ScAddress& aCursorPos, const bool bUndo); }; - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/namedlg.hxx b/sc/source/ui/inc/namedlg.hxx index 1f087d13fa6b..7dc6a0d9f009 100644 --- a/sc/source/ui/inc/namedlg.hxx +++ b/sc/source/ui/inc/namedlg.hxx @@ -35,10 +35,10 @@ #include <vcl/fixed.hxx> #include <vcl/lstbox.hxx> #include <vcl/ctrl.hxx> -#include <svtools/headbar.hxx> -#include <svtools/svtabbx.hxx> + #include "rangenam.hxx" #include "anyrefdg.hxx" +#include "namemgrtable.hxx" #include <boost/ptr_container/ptr_map.hpp> #include <boost/ptr_container/ptr_set.hpp> @@ -48,35 +48,8 @@ class ScViewData; class ScDocument; -struct ScNameDlgImpl; -struct ScRangeNameLine -{ - rtl::OUString aName; - rtl::OUString aExpression; - rtl::OUString aScope; -}; -//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 -//Need some sort of a filter to handle several range names -class ScRangeManagerTable : public SvTabListBox -{ -private: - HeaderBar maHeaderBar; - ScRangeName* mpGlobalRangeName; - std::map<rtl::OUString, ScRangeName*> maTabRangeNames; - rtl::OUString maGlobalString; -public: - ScRangeManagerTable( Window* pParent, ScRangeName* pGlobalRangeName, std::map<rtl::OUString, ScRangeName*> aTabRangeNames ); - ~ScRangeManagerTable() {}; - - void addEntry( const ScRangeNameLine& rLine ); - - void GetCurrentLine(ScRangeNameLine& rLine); - void UpdateEntries(); -}; class ScRangeManagerCtrl : public Control { diff --git a/sc/source/ui/inc/namemgrtable.hxx b/sc/source/ui/inc/namemgrtable.hxx new file mode 100644 index 000000000000..52d864f235e2 --- /dev/null +++ b/sc/source/ui/inc/namemgrtable.hxx @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * Copyright (C) 2011 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer) + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ +#include <svtools/headbar.hxx> +#include <svtools/svtabbx.hxx> + +struct ScRangeNameLine +{ + rtl::OUString aName; + rtl::OUString aExpression; + rtl::OUString aScope; +}; + +//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 +//Need some sort of a filter to handle several range names +SC_DLLPUBLIC class ScRangeManagerTable : public SvTabListBox +{ +private: + HeaderBar maHeaderBar; + ScRangeName* mpGlobalRangeName; + std::map<rtl::OUString, ScRangeName*> maTabRangeNames; + rtl::OUString maGlobalString; +public: + ScRangeManagerTable( Window* pParent, ScRangeName* pGlobalRangeName, std::map<rtl::OUString, ScRangeName*> aTabRangeNames ); + ~ScRangeManagerTable() {}; + + void addEntry( const ScRangeNameLine& rLine ); + + void GetCurrentLine(ScRangeNameLine& rLine); + void UpdateEntries(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/namepast.hxx b/sc/source/ui/inc/namepast.hxx index a5d7e8127ab7..618201aead6c 100644 --- a/sc/source/ui/inc/namepast.hxx +++ b/sc/source/ui/inc/namepast.hxx @@ -34,6 +34,8 @@ #include <vcl/fixed.hxx> #include <vcl/lstbox.hxx> +#include <vector> + #include "scui_def.hxx" class ScRangeName; @@ -53,7 +55,8 @@ protected: public: ScNamePasteDlg( Window * pParent, const ScRangeName* pList, const ScRangeName* pLocalList, bool bInsList=true ); - String GetSelectedName() const; + std::vector<rtl::OUString> GetSelectedNames() const; + bool IsAllSelected() const; }; diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx index bc7d9fac087b..3c26e5311762 100644 --- a/sc/source/ui/namedlg/namedefdlg.cxx +++ b/sc/source/ui/namedlg/namedefdlg.cxx @@ -9,8 +9,10 @@ -ScNameDefDlg::ScNameDefDlg( Window* pParent, ScDocument* pDoc, std::map<rtl::OUString, ScRangeName*> aRangeMap, const ScAddress& aCursorPos, const bool bUndo ) : - ModalDialog( pParent, ScResId( RID_SCDLG_NAMES_DEFINE) ), +ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, + ScDocument* pDoc, std::map<rtl::OUString, ScRangeName*> aRangeMap, + const ScAddress& aCursorPos, const bool bUndo ) : + ScAnyRefDlg( pB, pCW, pParent, RID_SCDLG_NAMES_DEFINE ), maBtnAdd( this, ScResId( BTN_ADD ) ), maBtnCancel( this, ScResId( BTN_CANCEL ) ), maFtInfo( this, ScResId( FT_INFO ) ), diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx index 873875ecb151..576cc417ca42 100644 --- a/sc/source/ui/namedlg/namedlg.cxx +++ b/sc/source/ui/namedlg/namedlg.cxx @@ -63,11 +63,7 @@ using ::std::auto_ptr; #define ABS_SREF3D ABS_SREF | SCA_TAB_3D #define ABS_DREF3D ABS_DREF | SCA_TAB_3D -//ScRangeManagerTable - -#define ITEMID_NAME 1 -#define ITEMID_RANGE 2 -#define ITEMID_SCOPE 3 +//helper namespace { @@ -88,95 +84,6 @@ ScRangeName* GetRangeName(const rtl::OUString& rTableName, ScDocument* pDoc) } -String createEntryString(const ScRangeNameLine& rLine) -{ - String aRet(rLine.aName); - aRet += '\t'; - aRet += String(rLine.aExpression); - aRet += '\t'; - aRet += String(rLine.aScope); - return aRet; -} - -ScRangeManagerTable::ScRangeManagerTable( Window* pWindow, ScRangeName* pGlobalRangeName, std::map<rtl::OUString, ScRangeName*> aTabRangeNames ): - SvTabListBox( pWindow, WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ), - maHeaderBar( pWindow, WB_BUTTONSTYLE | WB_BOTTOMBORDER ), - mpGlobalRangeName( pGlobalRangeName ), - maTabRangeNames( aTabRangeNames ), - maGlobalString( ResId::toString(ScResId(STR_GLOBAL_SCOPE))) -{ - Size aBoxSize( pWindow->GetOutputSizePixel() ); - - maHeaderBar.SetPosSizePixel( Point(0, 0), Size( aBoxSize.Width(), 16 ) ); - - String aNameStr(ScResId(STR_HEADER_NAME)); - String aRangeStr(ScResId(STR_HEADER_RANGE)); - String aScopeStr(ScResId(STR_HEADER_SCOPE)); - - long nTabSize = aBoxSize.Width()/3; - maHeaderBar.InsertItem( ITEMID_NAME, aNameStr, nTabSize, HIB_LEFT| HIB_VCENTER ); - maHeaderBar.InsertItem( ITEMID_RANGE, aRangeStr, nTabSize, HIB_LEFT| HIB_VCENTER ); - maHeaderBar.InsertItem( ITEMID_SCOPE, aScopeStr, nTabSize, HIB_LEFT| HIB_VCENTER ); - - static long nTabs[] = {3, 0, nTabSize, 2*nTabSize }; - Size aHeadSize( maHeaderBar.GetSizePixel() ); - - //pParent->SetFocusControl( this ); - SetPosSizePixel( Point( 0, aHeadSize.Height() ), Size( aBoxSize.Width(), aBoxSize.Height() - aHeadSize.Height() ) ); - SetTabs( &nTabs[0], MAP_PIXEL ); - - Show(); - maHeaderBar.Show(); -} - -void ScRangeManagerTable::addEntry(const ScRangeNameLine& rLine) -{ - SvLBoxEntry* pEntry = InsertEntryToColumn( createEntryString(rLine), LIST_APPEND, 0xffff); - SetCurEntry(pEntry); -} - -void ScRangeManagerTable::GetCurrentLine(ScRangeNameLine& rLine) -{ - SvLBoxEntry* pCurrentEntry = GetCurEntry(); - rLine.aName = GetEntryText( pCurrentEntry, 0); - rLine.aExpression = GetEntryText(pCurrentEntry, 1); - rLine.aScope = GetEntryText(pCurrentEntry, 2); -} - -void ScRangeManagerTable::UpdateEntries() -{ - Clear(); - for (ScRangeName::iterator itr = mpGlobalRangeName->begin(); - itr != mpGlobalRangeName->end(); ++itr) - { - if (!itr->HasType(RT_DATABASE) && !itr->HasType(RT_SHARED)) - { - ScRangeNameLine aLine; - aLine.aName = itr->GetName(); - aLine.aScope = maGlobalString; - itr->GetSymbol(aLine.aExpression); - addEntry(aLine); - } - } - for (std::map<rtl::OUString, ScRangeName*>::iterator itr = maTabRangeNames.begin(); - itr != maTabRangeNames.end(); ++itr) - { - ScRangeName* pLocalRangeName = itr->second; - ScRangeNameLine aLine; - aLine.aScope = itr->first; - for (ScRangeName::iterator it = pLocalRangeName->begin(); - it != pLocalRangeName->end(); ++it) - { - if (!it->HasType(RT_DATABASE) && !it->HasType(RT_SHARED)) - { - aLine.aName = it->GetName(); - it->GetSymbol(aLine.aExpression); - addEntry(aLine); - } - } - } -} - //logic #define ERRORBOX(s) ErrorBox(this,WinBits(WB_OK|WB_DEF_OK),s).Execute(); diff --git a/sc/source/ui/namedlg/namemgrtable.cxx b/sc/source/ui/namedlg/namemgrtable.cxx new file mode 100644 index 000000000000..40309d8f4ed7 --- /dev/null +++ b/sc/source/ui/namedlg/namemgrtable.cxx @@ -0,0 +1,138 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * Copyright (C) 2011 Markus Mohrhard <markus.mohrhard@googlemail.com> (initial developer) + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ +//ScRangeManagerTable +#include "global.hxx" +#include "reffact.hxx" +#include "document.hxx" +#include "docfunc.hxx" +#include "scresid.hxx" +#include "globstr.hrc" +#include "namedlg.hrc" +#include "namedlg.hxx" +#include "viewdata.hxx" + +#include "sfx2/app.hxx" + +#define ITEMID_NAME 1 +#define ITEMID_RANGE 2 +#define ITEMID_SCOPE 3 + + + +String createEntryString(const ScRangeNameLine& rLine) +{ + String aRet(rLine.aName); + aRet += '\t'; + aRet += String(rLine.aExpression); + aRet += '\t'; + aRet += String(rLine.aScope); + return aRet; +} + +ScRangeManagerTable::ScRangeManagerTable( Window* pWindow, ScRangeName* pGlobalRangeName, std::map<rtl::OUString, ScRangeName*> aTabRangeNames ): + SvTabListBox( pWindow, WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ), + maHeaderBar( pWindow, WB_BUTTONSTYLE | WB_BOTTOMBORDER ), + mpGlobalRangeName( pGlobalRangeName ), + maTabRangeNames( aTabRangeNames ), + maGlobalString( ResId::toString(ScResId(STR_GLOBAL_SCOPE))) +{ + Size aBoxSize( pWindow->GetOutputSizePixel() ); + + maHeaderBar.SetPosSizePixel( Point(0, 0), Size( aBoxSize.Width(), 16 ) ); + + String aNameStr(ScResId(STR_HEADER_NAME)); + String aRangeStr(ScResId(STR_HEADER_RANGE)); + String aScopeStr(ScResId(STR_HEADER_SCOPE)); + + long nTabSize = aBoxSize.Width()/3; + maHeaderBar.InsertItem( ITEMID_NAME, aNameStr, nTabSize, HIB_LEFT| HIB_VCENTER ); + maHeaderBar.InsertItem( ITEMID_RANGE, aRangeStr, nTabSize, HIB_LEFT| HIB_VCENTER ); + maHeaderBar.InsertItem( ITEMID_SCOPE, aScopeStr, nTabSize, HIB_LEFT| HIB_VCENTER ); + + static long nTabs[] = {3, 0, nTabSize, 2*nTabSize }; + Size aHeadSize( maHeaderBar.GetSizePixel() ); + + //pParent->SetFocusControl( this ); + SetPosSizePixel( Point( 0, aHeadSize.Height() ), Size( aBoxSize.Width(), aBoxSize.Height() - aHeadSize.Height() ) ); + SetTabs( &nTabs[0], MAP_PIXEL ); + + Show(); + maHeaderBar.Show(); +} + +void ScRangeManagerTable::addEntry(const ScRangeNameLine& rLine) +{ + SvLBoxEntry* pEntry = InsertEntryToColumn( createEntryString(rLine), LIST_APPEND, 0xffff); + SetCurEntry(pEntry); +} + +void ScRangeManagerTable::GetCurrentLine(ScRangeNameLine& rLine) +{ + SvLBoxEntry* pCurrentEntry = GetCurEntry(); + rLine.aName = GetEntryText( pCurrentEntry, 0); + rLine.aExpression = GetEntryText(pCurrentEntry, 1); + rLine.aScope = GetEntryText(pCurrentEntry, 2); +} + +void ScRangeManagerTable::UpdateEntries() +{ + Clear(); + for (ScRangeName::iterator itr = mpGlobalRangeName->begin(); + itr != mpGlobalRangeName->end(); ++itr) + { + if (!itr->HasType(RT_DATABASE) && !itr->HasType(RT_SHARED)) + { + ScRangeNameLine aLine; + aLine.aName = itr->GetName(); + aLine.aScope = maGlobalString; + itr->GetSymbol(aLine.aExpression); + addEntry(aLine); + } + } + for (std::map<rtl::OUString, ScRangeName*>::iterator itr = maTabRangeNames.begin(); + itr != maTabRangeNames.end(); ++itr) + { + ScRangeName* pLocalRangeName = itr->second; + ScRangeNameLine aLine; + aLine.aScope = itr->first; + for (ScRangeName::iterator it = pLocalRangeName->begin(); + it != pLocalRangeName->end(); ++it) + { + if (!it->HasType(RT_DATABASE) && !it->HasType(RT_SHARED)) + { + aLine.aName = it->GetName(); + it->GetSymbol(aLine.aExpression); + addEntry(aLine); + } + } + } +} + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/miscdlgs/namepast.cxx b/sc/source/ui/namedlg/namepast.cxx index 7c469c23b559..0480f01944b3 100644 --- a/sc/source/ui/miscdlgs/namepast.cxx +++ b/sc/source/ui/namedlg/namepast.cxx @@ -122,9 +122,16 @@ IMPL_LINK_INLINE_END( ScNamePasteDlg, ListDblClickHdl, ListBox *, pListBox ) //------------------------------------------------------------------ -String ScNamePasteDlg::GetSelectedName() const +std::vector<rtl::OUString> ScNamePasteDlg::GetSelectedNames() const { - return aNameList.GetSelectEntry(); + std::vector<rtl::OUString> aSelectedNames; + aSelectedNames.push_back(aNameList.GetSelectEntry()); + return aSelectedNames; +} + +bool ScNamePasteDlg::IsAllSelected() const +{ + return false; } diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index c5939759d069..ea4be5ef9659 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -1828,8 +1828,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) // "=" in KeyEvent, switches to input-mode pScMod->InputKeyEvent( KeyEvent('=',KeyCode()) ); - String aName = pDlg->GetSelectedName(); - pHdl->InsertFunction( aName, false ); // without "()" + std::vector<rtl::OUString> aNames = pDlg->GetSelectedNames(); + pHdl->InsertFunction( aNames.at(0), false ); // without "()" } } break; @@ -1838,21 +1838,6 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } break; - case FID_ADD_NAME: - { - ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - - std::cout << "Create Dialog in cellsh1.cxx" << std::endl; - ScDocument* pDoc = GetViewData()->GetDocument(); - std::map<rtl::OUString, ScRangeName*> aRangeMap; - pDoc->GetRangeNameMap(aRangeMap); - ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); - AbstractScNameAddDlg* pDlg = pFact->CreateScNameAddDlg( pTabViewShell->GetDialogParent(), pDoc, aRangeMap, aPos, true, RID_SCDLG_NAMES_DEFINE ); - pDlg->Execute(); - delete pDlg; - } - break; - case SID_RANGE_NOTETEXT: if (pReqArgs) { diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 61a36a71e70b..c6fd63c63f9b 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -94,6 +94,8 @@ #include "scui_def.hxx" #include "scabstdlg.hxx" +#include <iostream> + using namespace ::com::sun::star; @@ -439,10 +441,10 @@ void ScEditShell::Execute( SfxRequest& rReq ) if ( nRet == BTN_PASTE_NAME ) { - String aName = pDlg->GetSelectedName(); - pTableView->InsertText(aName); + std::vector<rtl::OUString> aNames = pDlg->GetSelectedNames(); + pTableView->InsertText(aNames.at(0)); if (pTopView) - pTopView->InsertText(aName); + pTopView->InsertText(aNames.at(0)); } delete pDlg; @@ -451,20 +453,6 @@ void ScEditShell::Execute( SfxRequest& rReq ) } break; - case FID_ADD_NAME: - { - ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - - ScDocument* pDoc = pViewData->GetDocument(); - std::map<rtl::OUString, ScRangeName*> aRangeMap; - pDoc->GetRangeNameMap(aRangeMap); - ScAddress aPos( pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo() ); - AbstractScNameAddDlg* pDlg = pFact->CreateScNameAddDlg( pViewData->GetDialogParent(), pDoc, aRangeMap, aPos, true, RID_SCDLG_NAMES_DEFINE ); - pDlg->Execute(); - delete pDlg; - } - break; - case SID_CHAR_DLG: { SfxItemSet aAttrs( pTableView->GetAttribs() ); |