diff options
-rw-r--r-- | extras/source/glade/libreoffice-catalog.xml.in | 7 | ||||
-rw-r--r-- | sc/UIConfig_scalc.mk | 1 | ||||
-rw-r--r-- | sc/inc/helpids.h | 21 | ||||
-rw-r--r-- | sc/inc/sc.hrc | 1 | ||||
-rw-r--r-- | sc/source/ui/inc/content.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/inc/navipi.hxx | 149 | ||||
-rw-r--r-- | sc/source/ui/navipi/content.cxx | 26 | ||||
-rw-r--r-- | sc/source/ui/navipi/navipi.cxx | 693 | ||||
-rw-r--r-- | sc/source/ui/navipi/navipi.hrc | 41 | ||||
-rw-r--r-- | sc/source/ui/navipi/navipi.src | 143 | ||||
-rw-r--r-- | sc/source/ui/navipi/scenwnd.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/sidebar/ScPanelFactory.cxx | 2 | ||||
-rw-r--r-- | sc/uiconfig/scalc/ui/navigatorpanel.ui | 241 |
13 files changed, 533 insertions, 808 deletions
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index 3f78445d0b20..ecb5b943fc52 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -605,6 +605,13 @@ generic-name="Relative Numeric Field" parent="GtkSpinButton" icon-name="widget-gtk-spinbutton"/> + <glade-widget-class title="Calc Row SpinButton" name="sclo-RowEdit" + generic-name="Calc Row SpinButton" parent="GtkSpinButton" + icon-name="widget-gtk-spinbutton"/> + <glade-widget-class title="Calc Column SpinButton" name="sclo-ColumnEdit" + generic-name="Calc Column SpinButton" parent="GtkSpinButton" + icon-name="widget-gtk-spinbutton"/> + <glade-widget-class title="SvtURLBox" name="svtlo-SvtURLBox" generic-name="URLBox" parent="VclComboBoxText" icon-name="widget-gtk-comboboxtext"/> diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk index b8e8c9c5ffa7..9ec5dac1396a 100644 --- a/sc/UIConfig_scalc.mk +++ b/sc/UIConfig_scalc.mk @@ -149,6 +149,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\ sc/uiconfig/scalc/ui/movecopysheet \ sc/uiconfig/scalc/ui/movingaveragedialog \ sc/uiconfig/scalc/ui/multipleoperationsdialog \ + sc/uiconfig/scalc/ui/navigatorpanel \ sc/uiconfig/scalc/ui/nosolutiondialog \ sc/uiconfig/scalc/ui/optcalculatepage \ sc/uiconfig/scalc/ui/optchangespage \ diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h index 6c62861599b2..7dfa4a6a8f67 100644 --- a/sc/inc/helpids.h +++ b/sc/inc/helpids.h @@ -32,27 +32,6 @@ #define HID_SC_WIN_GRIDWIN "SC_HID_SC_WIN_GRIDWIN" #define HID_SC_WIN_PREVIEW "SC_HID_SC_WIN_PREVIEW" -// Hilfe IDs fuer einzelne Controls (max.30) --------------------------------- -// Eintraege im Navigator -#define HID_SC_NAVIPI_ENTRIES "SC_HID_SC_NAVIPI_ENTRIES" -#define HID_SC_NAVIPI_ROW "SC_HID_SC_NAVIPI_ROW" -#define HID_SC_NAVIPI_COL "SC_HID_SC_NAVIPI_COL" -#define HID_SC_NAVIPI_DOC "SC_HID_SC_NAVIPI_DOC" -#define HID_SC_NAVIPI_DATA "SC_HID_SC_NAVIPI_DATA" -#define HID_SC_NAVIPI_UP "SC_HID_SC_NAVIPI_UP" -#define HID_SC_NAVIPI_DOWN "SC_HID_SC_NAVIPI_DOWN" -#define HID_SC_NAVIPI_ZOOM "SC_HID_SC_NAVIPI_ZOOM" -#define HID_SC_NAVIPI_ROOT "SC_HID_SC_NAVIPI_ROOT" -#define HID_SC_NAVIPI_SCEN "SC_HID_SC_NAVIPI_SCEN" -#define HID_SC_NAVIPI_DROP "SC_HID_SC_NAVIPI_DROP" - -#define HID_SC_NAVIPI_TOOLBOX "SC_HID_SC_NAVIPI_TOOLBOX" -// Bereich ist voll! - -// Hilfe IDs fuer Dialoge / Pages (max.70) ----------------------------------- -#define HID_SC_NAVIGATOR "SC_HID_SC_NAVIGATOR" - - #define HID_SC_HEADER_EDIT "SC_HID_SC_HEADER_EDIT" #define HID_SC_FOOTER_EDIT "SC_HID_SC_FOOTER_EDIT" diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index 49f3dcf878d0..31bd7d6fc7cd 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -1051,7 +1051,6 @@ #define RID_SCDLG_HFED_FOOTER (SC_DIALOGS_START + 53) #define RID_SCPAGE_CALC (SC_DIALOGS_START + 56) -#define RID_SCDLG_NAVIGATOR (SC_DIALOGS_START + 57) #define RID_SCDLG_HFEDIT_SHDR (SC_DIALOGS_START + 62) #define RID_SCDLG_HFEDIT_SFTR (SC_DIALOGS_START + 63) diff --git a/sc/source/ui/inc/content.hxx b/sc/source/ui/inc/content.hxx index 8e839c1ace8c..4c60d15b2712 100644 --- a/sc/source/ui/inc/content.hxx +++ b/sc/source/ui/inc/content.hxx @@ -117,8 +117,8 @@ protected: virtual void InitEntry(SvTreeListEntry*,const OUString&,const Image&,const Image&, SvLBoxButtonKind) override; public: - ScContentTree( vcl::Window* pParent, const ResId& rResId ); - virtual ~ScContentTree() override; + ScContentTree(vcl::Window* pParent, ScNavigatorDlg* pNavigatorDlg); + virtual ~ScContentTree() override; virtual void dispose() override; OUString getAltLongDescText(SvTreeListEntry* pEntry, bool isAltText) const; diff --git a/sc/source/ui/inc/navipi.hxx b/sc/source/ui/inc/navipi.hxx index a7d6833c76a2..1c8493432592 100644 --- a/sc/source/ui/inc/navipi.hxx +++ b/sc/source/ui/inc/navipi.hxx @@ -28,6 +28,7 @@ #include <svl/poolitem.hxx> #include <svl/lstner.hxx> #include <sfx2/childwin.hxx> +#include <svx/sidebar/PanelLayout.hxx> #include "content.hxx" #include <svtools/svmedit.hxx> @@ -46,12 +47,8 @@ class ScNavigatorSettings; enum NavListMode { NAV_LMODE_NONE = 0x4000, NAV_LMODE_AREAS = 0x2000, - NAV_LMODE_DBAREAS = 0x1000, - NAV_LMODE_DOCS = 0x800, NAV_LMODE_SCENARIOS = 0x400 }; -// class ScScenarioListBox ----------------------------------------------- - class ScScenarioListBox : public ListBox { public: @@ -89,38 +86,35 @@ private: ScenarioList maEntries; }; -// class ScScenarioWindow ------------------------------------------------ - class ScScenarioWindow : public vcl::Window { public: - ScScenarioWindow( vcl::Window* pParent, const OUString& aQH_List, const OUString& aQH_Comment); - virtual ~ScScenarioWindow() override; + ScScenarioWindow(vcl::Window* pParent, const OUString& rQH_List, const OUString& rQH_Comment); + virtual ~ScScenarioWindow() override; virtual void dispose() override; - - void NotifyState( const SfxPoolItem* pState ); - void SetComment( const OUString& rComment ) - { aEdComment->SetText( rComment ); } - - void SetSizePixel( const Size& rNewSize ) override; + void NotifyState(const SfxPoolItem* pState); + void SetComment(const OUString& rComment) + { + aEdComment->SetText(rComment); + } protected: - virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) override; + virtual void Resize() override; private: VclPtr<ScScenarioListBox> aLbScenario; VclPtr<MultiLineEdit> aEdComment; }; -// class ColumnEdit - class ColumnEdit : public SpinField { public: - ColumnEdit( ScNavigatorDlg* pParent, const ResId& rResId ); - virtual ~ColumnEdit() override; - + ColumnEdit(Window* pParent, WinBits nWinBits); + void SetNavigatorDlg(ScNavigatorDlg *pNaviDlg) + { + xDlg = pNaviDlg; + } SCCOL GetCol() { return nCol; } void SetCol( SCCOL nColNo ); @@ -131,87 +125,63 @@ protected: virtual void Down() override; virtual void First() override; virtual void Last() override; + virtual void dispose() override; private: - ScNavigatorDlg& rDlg; + VclPtr<ScNavigatorDlg> xDlg; SCCOL nCol; - void EvalText (); - void ExecuteCol (); + void EvalText(); + void ExecuteCol(); static SCCOL AlphaToNum ( OUString& rStr ); static SCCOL NumStrToAlpha ( OUString& rStr ); static SCCOL NumToAlpha ( SCCOL nColNo, OUString& rStr ); }; -// class RowEdit - class RowEdit : public NumericField { public: - RowEdit( ScNavigatorDlg* pParent, const ResId& rResId ); - virtual ~RowEdit() override; - - SCROW GetRow() { return (SCROW)GetValue(); } - void SetRow( SCROW nRow ){ SetValue( nRow ); } + RowEdit(Window* pParent, WinBits nWinBits); + void SetNavigatorDlg(ScNavigatorDlg *pNaviDlg) + { + xDlg = pNaviDlg; + } + SCROW GetRow() { return (SCROW)GetValue(); } + void SetRow(SCROW nRow) { SetValue(nRow); } protected: virtual bool Notify( NotifyEvent& rNEvt ) override; + virtual Size GetOptimalSize() const override; virtual void LoseFocus() override; + virtual void dispose() override; private: - ScNavigatorDlg& rDlg; + VclPtr<ScNavigatorDlg> xDlg; void ExecuteRow(); }; -// class CommandToolBox - -class CommandToolBox : public ToolBox -{ -public: - CommandToolBox( ScNavigatorDlg* pParent, const ResId& rResId ); - virtual ~CommandToolBox() override; - - void Select( sal_uInt16 nId ); - void UpdateButtons(); - void InitImageList(); - - virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; - - DECL_LINK( ToolBoxDropdownClickHdl, ToolBox*, void ); - -protected: - virtual void Select() override; - virtual void Click() override; - -private: - ScNavigatorDlg& rDlg; -}; - -// class ScNavigatorDlg - -class ScNavigatorDlg : public vcl::Window, public SfxListener +class ScNavigatorDlg : public PanelLayout, public SfxListener { friend class ScNavigatorControllerItem; friend class ScNavigatorDialogWrapper; friend class ColumnEdit; friend class RowEdit; -friend class CommandToolBox; friend class ScContentTree; private: SfxBindings& rBindings; // must be first member - ImageList aCmdImageList; // must be before aTbxCmd - VclPtr<FixedText> aFtCol; - VclPtr<ColumnEdit> aEdCol; - VclPtr<FixedText> aFtRow; - VclPtr<RowEdit> aEdRow; - VclPtr<CommandToolBox> aTbxCmd; - VclPtr<ScContentTree> aLbEntries; + VclPtr<ColumnEdit> aEdCol; + VclPtr<RowEdit> aEdRow; + VclPtr<ToolBox> aTbxCmd; + VclPtr<VclContainer> aContentBox; + VclPtr<ScContentTree> aLbEntries; + VclPtr<VclContainer> aScenarioBox; VclPtr<ScScenarioWindow> aWndScenarios; - VclPtr<ListBox> aLbDocuments; + VclPtr<ListBox> aLbDocuments; + Size aExpandedSize; Idle aContentIdle; OUString aTitleBase; @@ -222,29 +192,32 @@ private: OUString aStrHidden; OUString aStrActiveWin; - SfxChildWindowContext* pContextWin; - Size aInitSize; - ScArea* pMarkArea; - ScViewData* pViewData; + bool bInSidebar; + sal_uInt16 nZoomId; + sal_uInt16 nChangeRootId; + sal_uInt16 nDragModeId; + sal_uInt16 nScenarioId; + sal_uInt16 nDownId; + sal_uInt16 nUpId; + sal_uInt16 nDataId; + sal_uInt16 nAreaId; + ScArea* pMarkArea; + ScViewData* pViewData; - long nBorderOffset; - long nListModeHeight; - long nInitListHeight; NavListMode eListMode; sal_uInt16 nDropMode; SCCOL nCurCol; SCROW nCurRow; SCTAB nCurTab; - bool bFirstBig; - bool mbUseStyleSettingsBackground; ScNavigatorControllerItem** ppBoundItems; DECL_LINK(TimeHdl, Idle*, void); DECL_LINK(DocumentSelectHdl, ListBox&, void); + DECL_LINK(ToolBoxSelectHdl, ToolBox*, void); + DECL_LINK(ToolBoxDropdownClickHdl, ToolBox*, void); - void DoResize(); - + void UpdateButtons(); void SetCurrentCell( SCCOL nCol, SCROW Row ); void SetCurrentCellStr( const OUString& rName ); void SetCurrentTable( SCTAB nTab ); @@ -263,9 +236,9 @@ private: void GetDocNames(const OUString* pSelEntry); - void SetListMode ( NavListMode eMode, bool bSetSize ); - void ShowList ( bool bShow, bool bSetSize ); - void ShowScenarios ( bool bSetSize ); + void SetListMode(NavListMode eMode); + void ShowList(bool bShow); + void ShowScenarios(); void SetDropMode(sal_uInt16 nNew); sal_uInt16 GetDropMode() const { return nDropMode; } @@ -281,21 +254,13 @@ private: static void ReleaseFocus(); -protected: - virtual void Resize() override; - virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) override; - void Resizing( Size& rSize ); - public: - ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, vcl::Window* pParent, - const bool bUseStyleSettingsBackground); - virtual ~ScNavigatorDlg() override; + ScNavigatorDlg(SfxBindings* pB, bool bSidebar, vcl::Window* pParent); + virtual ~ScNavigatorDlg() override; virtual void dispose() override; using Window::Notify; virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; - - virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; }; class ScNavigatorDialogWrapper: public SfxChildWindowContext @@ -308,8 +273,6 @@ public: SFX_DECL_CHILDWINDOWCONTEXT(ScNavigatorDialogWrapper) - virtual void Resizing( Size& rSize ) override; - private: VclPtr<ScNavigatorDlg> pNavigator; }; diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index dfc5e1026e47..b309d592a017 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -49,9 +49,9 @@ #include "lnktrans.hxx" #include "formulacell.hxx" #include "dociter.hxx" +#include "sc.hrc" #include "scresid.hxx" #include "globstr.hrc" -#include "navipi.hrc" #include "arealink.hxx" #include "navicfg.hxx" #include "navsett.hxx" @@ -111,22 +111,20 @@ ScDocShell* ScContentTree::GetManualOrCurrent() // ScContentTree -ScContentTree::ScContentTree( vcl::Window* pParent, const ResId& rResId ) : - SvTreeListBox ( pParent, rResId ), - aEntryImages ( ScResId( RID_IMAGELIST_NAVCONT ) ), - nRootType ( ScContentId::ROOT ), - bHiddenDoc ( false ), - pHiddenDocument ( nullptr ), - bisInNavigatoeDlg ( false ) +ScContentTree::ScContentTree(vcl::Window* pParent, ScNavigatorDlg* pNavigatorDlg) + : SvTreeListBox(pParent, WB_BORDER | WB_QUICK_SEARCH) + , pParentWindow(pNavigatorDlg) + , aEntryImages(ScResId(RID_IMAGELIST_NAVCONT)) + , nRootType(ScContentId::ROOT) + , bHiddenDoc(false) + , pHiddenDocument(nullptr) + , bisInNavigatoeDlg(false) { - sal_uInt16 i; - for (i=0; i<=(int)ScContentId::LAST; i++) + for (sal_uInt16 i = 0; i <= (int)ScContentId::LAST; ++i) pPosList[pTypeList[i]] = i; // invers zum suchen - pParentWindow = static_cast<ScNavigatorDlg*>(pParent); - pRootNodes[ScContentId::ROOT] = nullptr; - for (i=1; i<(int)ScContentId::LAST; i++) + for (sal_uInt16 i = 1; i < (int)ScContentId::LAST; ++i) InitRoot((ScContentId)i); SetNodeDefaultImages(); @@ -134,8 +132,6 @@ ScContentTree::ScContentTree( vcl::Window* pParent, const ResId& rResId ) : SetDoubleClickHdl( LINK( this, ScContentTree, ContentDoubleClickHdl ) ); pTmpEntry= nullptr; - - SetStyle( GetStyle() | WB_QUICK_SEARCH ); } ScContentTree::~ScContentTree() diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 828885f385ad..e01d9e2db59a 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -26,6 +26,7 @@ #include <sfx2/navigat.hxx> #include <svl/stritem.hxx> #include <svl/urlbmk.hxx> +#include <vcl/builderfactory.hxx> #include <vcl/settings.hxx> #include <unotools/charclass.hxx> #include <stdlib.h> @@ -38,20 +39,17 @@ #include "rangenam.hxx" #include "rangeutl.hxx" #include "popmenu.hxx" +#include "sc.hrc" #include "scresid.hxx" #include "scmod.hxx" #include "navicfg.hxx" #include "navcitem.hxx" -#include "navipi.hrc" #include "navipi.hxx" #include "navsett.hxx" #include "markdata.hxx" #include <algorithm> -// tolerance, how much spac above the folded size is still small -#define SCNAV_MINTOL 5 - // maximum values for UI #define SCNAV_MAXCOL (MAXCOLCOUNT) // macro is sufficient since only used in ctor @@ -73,18 +71,17 @@ void ScNavigatorDlg::ReleaseFocus() } } -// class ColumnEdit - -ColumnEdit::ColumnEdit( ScNavigatorDlg* pParent, const ResId& rResId ) - : SpinField ( pParent, rResId ), - rDlg ( *pParent ), - nCol ( 0 ) +ColumnEdit::ColumnEdit(Window* pParent, WinBits nWinBits) + : SpinField(pParent, nWinBits) + , nCol(0) { - SetMaxTextLen( SCNAV_COLDIGITS ); // 1...256...18278 or A...IV...ZZZ + SetMaxTextLen(SCNAV_COLDIGITS); // 1...256...18278 or A...IV...ZZZ } -ColumnEdit::~ColumnEdit() +VCL_BUILDER_DECL_FACTORY(ColumnEdit) { + (void)rMap; + rRet = VclPtr<ColumnEdit>::Create(pParent, WB_BORDER | WB_SPIN | WB_REPEAT | WB_RIGHT); } bool ColumnEdit::Notify( NotifyEvent& rNEvt ) @@ -122,6 +119,12 @@ void ColumnEdit::LoseFocus() EvalText(); } +void ColumnEdit::dispose() +{ + xDlg.clear(); + SpinField::dispose(); +} + void ColumnEdit::Up() { nCol++; @@ -172,12 +175,12 @@ void ColumnEdit::EvalText() void ColumnEdit::ExecuteCol() { - SCROW nRow = rDlg.aEdRow->GetRow(); + SCROW nRow = xDlg->aEdRow->GetRow(); EvalText(); // setzt nCol if ( (nCol > 0) && (nRow > 0) ) - rDlg.SetCurrentCell( nCol-1, nRow-1 ); + xDlg->SetCurrentCell(nCol - 1, nRow - 1); } void ColumnEdit::SetCol( SCCOL nColNo ) @@ -244,18 +247,17 @@ SCCOL ColumnEdit::NumToAlpha( SCCOL nColNo, OUString& rStr ) return nColNo; } -// class RowEdit - -RowEdit::RowEdit( ScNavigatorDlg* pParent, const ResId& rResId ) - : NumericField( pParent, rResId ), - rDlg ( *pParent ) +RowEdit::RowEdit(Window* pParent, WinBits nWinBits) + : NumericField(pParent, nWinBits) { - SetMax( SCNAV_MAXROW); - SetLast( SCNAV_MAXROW); + SetMax(SCNAV_MAXROW); + SetLast(SCNAV_MAXROW); } -RowEdit::~RowEdit() +VCL_BUILDER_DECL_FACTORY(RowEdit) { + (void)rMap; + rRet = VclPtr<RowEdit>::Create(pParent, WB_BORDER | WB_SPIN | WB_REPEAT | WB_RIGHT); } bool RowEdit::Notify( NotifyEvent& rNEvt ) @@ -281,13 +283,25 @@ void RowEdit::LoseFocus() { } +void RowEdit::dispose() +{ + xDlg.clear(); + NumericField::dispose(); +} + +Size RowEdit::GetOptimalSize() const +{ + //max rows is 1,000,000, which is too long for typical use + return CalcMinimumSizeForText("1,000"); +} + void RowEdit::ExecuteRow() { - SCCOL nCol = rDlg.aEdCol->GetCol(); + SCCOL nCol = xDlg->aEdCol->GetCol(); SCROW nRow = (SCROW)GetValue(); if ( (nCol > 0) && (nRow > 0) ) - rDlg.SetCurrentCell( nCol-1, nRow-1 ); + xDlg->SetCurrentCell(nCol - 1, nRow - 1); } IMPL_LINK(ScNavigatorDlg, DocumentSelectHdl, ListBox&, rListBox, void) @@ -298,306 +312,180 @@ IMPL_LINK(ScNavigatorDlg, DocumentSelectHdl, ListBox&, rListBox, void) aLbEntries->SelectDoc(aDocName); } -// class CommandToolBox - -CommandToolBox::CommandToolBox( ScNavigatorDlg* pParent, const ResId& rResId ) - : ToolBox ( pParent, rResId ), - rDlg ( *pParent ) -{ - InitImageList(); // ImageList members of ScNavigatorDlg must be initialized before! - - SetSizePixel( CalcWindowSizePixel() ); - SetDropdownClickHdl( LINK(this, CommandToolBox, ToolBoxDropdownClickHdl) ); - SetItemBits( IID_DROPMODE, GetItemBits( IID_DROPMODE ) | ToolBoxItemBits::DROPDOWNONLY ); -} - -CommandToolBox::~CommandToolBox() -{ -} - -void CommandToolBox::Select( sal_uInt16 nSelId ) +IMPL_LINK(ScNavigatorDlg, ToolBoxSelectHdl, ToolBox*, pToolBox, void) { + sal_uInt16 nSelId = pToolBox->GetCurItemId(); // Modus umschalten ? - - if ( nSelId == IID_ZOOMOUT || nSelId == IID_SCENARIOS ) + if (nSelId == nZoomId || nSelId == nScenarioId) { - NavListMode eOldMode = rDlg.eListMode; + NavListMode eOldMode = eListMode; NavListMode eNewMode; - if ( nSelId == IID_SCENARIOS ) + if (nSelId == nScenarioId) { - if ( eOldMode == NAV_LMODE_SCENARIOS ) + if (eOldMode == NAV_LMODE_SCENARIOS) eNewMode = NAV_LMODE_AREAS; else eNewMode = NAV_LMODE_SCENARIOS; } else // on/off { - if ( eOldMode == NAV_LMODE_NONE ) + if (eOldMode == NAV_LMODE_NONE) eNewMode = NAV_LMODE_AREAS; else eNewMode = NAV_LMODE_NONE; } - rDlg.SetListMode( eNewMode, true ); + SetListMode(eNewMode); UpdateButtons(); } else - switch ( nSelId ) + { + if (nSelId == nDataId) + MarkDataArea(); + else if (nSelId == nUpId) + StartOfDataArea(); + else if (nSelId == nDownId) + EndOfDataArea(); + else if (nSelId == nChangeRootId) { - case IID_DATA: - rDlg.MarkDataArea(); - break; - case IID_UP: - rDlg.StartOfDataArea(); - break; - case IID_DOWN: - rDlg.EndOfDataArea(); - break; - case IID_CHANGEROOT: - rDlg.aLbEntries->ToggleRoot(); - UpdateButtons(); - break; + aLbEntries->ToggleRoot(); + UpdateButtons(); } + } } -void CommandToolBox::Select() -{ - Select( GetCurItemId() ); -} - -void CommandToolBox::Click() -{ -} - -IMPL_LINK_NOARG(CommandToolBox, ToolBoxDropdownClickHdl, ToolBox *, void) +IMPL_LINK(ScNavigatorDlg, ToolBoxDropdownClickHdl, ToolBox *, pToolBox, void) { // the popup menue of the drop modus has to be called in the // click (button down) and not in the select (button up) - - if ( GetCurItemId() == IID_DROPMODE ) + if (pToolBox->GetCurItemId() == nDragModeId) { - ScopedVclPtrInstance<ScPopupMenu> aPop( ScResId( RID_POPUP_DROPMODE ) ); - aPop->CheckItem( RID_DROPMODE_URL + rDlg.GetDropMode() ); - aPop->Execute( this, GetItemRect(IID_DROPMODE), PopupMenuFlags::ExecuteDown ); + ScopedVclPtrInstance<ScPopupMenu> aPop(ScResId(RID_POPUP_DROPMODE)); + aPop->CheckItem(RID_DROPMODE_URL + GetDropMode()); + aPop->Execute(pToolBox, pToolBox->GetItemRect(nDragModeId), PopupMenuFlags::ExecuteDown); sal_uInt16 nId = aPop->GetSelected(); - EndSelection(); // bevore SetDropMode (SetDropMode calls SetItemImage) - - if ( nId >= RID_DROPMODE_URL && nId <= RID_DROPMODE_COPY ) - rDlg.SetDropMode( nId - RID_DROPMODE_URL ); + pToolBox->EndSelection(); // before SetDropMode (SetDropMode calls SetItemImage) - // reset the highlighted button - Point aPoint; - MouseEvent aLeave( aPoint, 0, MouseEventModifiers::LEAVEWINDOW | MouseEventModifiers::SYNTHETIC ); - MouseMove( aLeave ); + if (nId >= RID_DROPMODE_URL && nId <= RID_DROPMODE_COPY) + SetDropMode(nId - RID_DROPMODE_URL); } } -void CommandToolBox::UpdateButtons() +void ScNavigatorDlg::UpdateButtons() { - NavListMode eMode = rDlg.eListMode; - CheckItem( IID_SCENARIOS, eMode == NAV_LMODE_SCENARIOS ); - CheckItem( IID_ZOOMOUT, eMode != NAV_LMODE_NONE ); + NavListMode eMode = eListMode; + aTbxCmd->CheckItem(nScenarioId, eMode == NAV_LMODE_SCENARIOS); + aTbxCmd->CheckItem(nZoomId, eMode != NAV_LMODE_NONE); // Umschalten-Button: - if ( eMode == NAV_LMODE_SCENARIOS || eMode == NAV_LMODE_NONE ) + if (eMode == NAV_LMODE_SCENARIOS || eMode == NAV_LMODE_NONE) { - EnableItem( IID_CHANGEROOT, false ); - CheckItem( IID_CHANGEROOT, false ); + aTbxCmd->EnableItem(nChangeRootId, false); + aTbxCmd->CheckItem(nChangeRootId, false); } else { - EnableItem( IID_CHANGEROOT ); - bool bRootSet = rDlg.aLbEntries->GetRootType() != ScContentId::ROOT; - CheckItem( IID_CHANGEROOT, bRootSet ); + aTbxCmd->EnableItem(nChangeRootId); + bool bRootSet = aLbEntries->GetRootType() != ScContentId::ROOT; + aTbxCmd->CheckItem(nChangeRootId, bRootSet); } sal_uInt16 nImageId = 0; - switch ( rDlg.nDropMode ) - { - case SC_DROPMODE_URL: nImageId = RID_IMG_DROP_URL; break; - case SC_DROPMODE_LINK: nImageId = RID_IMG_DROP_LINK; break; - case SC_DROPMODE_COPY: nImageId = RID_IMG_DROP_COPY; break; - } - SetItemImage( IID_DROPMODE, Image(ScResId(nImageId)) ); -} - -void CommandToolBox::InitImageList() -{ - ImageList& rImgLst = rDlg.aCmdImageList; - - sal_uInt16 nCount = GetItemCount(); - for (sal_uInt16 i = 0; i < nCount; i++) + switch (nDropMode) { - sal_uInt16 nId = GetItemId(i); - SetItemImage( nId, rImgLst.GetImage( nId ) ); - } -} - -void CommandToolBox::DataChanged( const DataChangedEvent& rDCEvt ) -{ - if ( rDCEvt.GetType() == DataChangedEventType::SETTINGS && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) - { - // update item images - - InitImageList(); - UpdateButtons(); // drop mode + case SC_DROPMODE_URL: + nImageId = RID_IMG_DROP_URL; + break; + case SC_DROPMODE_LINK: + nImageId = RID_IMG_DROP_LINK; + break; + case SC_DROPMODE_COPY: + nImageId = RID_IMG_DROP_COPY; + break; } - - ToolBox::DataChanged( rDCEvt ); + aTbxCmd->SetItemImage(nDragModeId, Image(ScResId(nImageId))); } -// class ScNavigatorSettings - ScNavigatorSettings::ScNavigatorSettings() : mnRootSelected( ScContentId::ROOT ), mnChildSelected( SC_CONTENT_NOCHILD ) { } -// class ScNavigatorDlgWrapper - SFX_IMPL_CHILDWINDOWCONTEXT( ScNavigatorDialogWrapper, SID_NAVIGATOR ) -ScNavigatorDialogWrapper::ScNavigatorDialogWrapper( - vcl::Window* pParent, - sal_uInt16 nId, - SfxBindings* pBind, - SfxChildWinInfo* /* pInfo */ ) : - SfxChildWindowContext( nId ) +ScNavigatorDialogWrapper::ScNavigatorDialogWrapper(vcl::Window* pParent, + sal_uInt16 nId, + SfxBindings* pBind, + SfxChildWinInfo* /* pInfo */) + : SfxChildWindowContext(nId) { - pNavigator = VclPtr<ScNavigatorDlg>::Create( pBind, this, pParent, true ); - SetWindow( pNavigator ); - - // handle configurations elsewhere, - // only size of pInfo matters now - - Size aInfoSize = pParent->GetOutputSizePixel(); // outside defined size - Size aNavSize = pNavigator->GetOutputSizePixel(); // Default-Size - - aNavSize.Width() = std::max( aInfoSize.Width(), aNavSize.Width() ); - aNavSize.Height() = std::max( aInfoSize.Height(), aNavSize.Height() ); - pNavigator->nListModeHeight = std::max( aNavSize.Height(), pNavigator->nListModeHeight ); - - // The size could be changed in another module, - // therefore we have to or have not to display the content - // in dependence of the current size - - bool bSmall = ( aInfoSize.Height() <= pNavigator->aInitSize.Height() + SCNAV_MINTOL ); - NavListMode eNavMode = NAV_LMODE_NONE; - if (!bSmall) - { - // if scenario was active, switch on - - ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg(); - NavListMode eLastMode = (NavListMode) rCfg.GetListMode(); - if ( eLastMode == NAV_LMODE_SCENARIOS ) - eNavMode = NAV_LMODE_SCENARIOS; - else - eNavMode = NAV_LMODE_AREAS; - } - - // Do not set the size of the float again (sal_False at SetListMode), so that the - // navigator is not expanded, if it was minimized (#38872#). - - pNavigator->SetListMode( eNavMode, false ); // FALSE: do not set the Float size - - sal_uInt16 nCmdId; - switch (eNavMode) - { - case NAV_LMODE_SCENARIOS: nCmdId = IID_SCENARIOS; break; - case NAV_LMODE_AREAS: nCmdId = IID_AREAS; break; -// The following case can never be reach due to how eNavMode is set-up -// case NAV_LMODE_DOCS: nCmdId = IID_DOCS; break; -// case NAV_LMODE_DBAREAS: nCmdId = IID_DBAREAS; break; - default: nCmdId = 0; - } - if (nCmdId) - { - pNavigator->aTbxCmd->CheckItem( nCmdId ); - pNavigator->DoResize(); - } - - pNavigator->bFirstBig = ( nCmdId == 0 ); // later -} - -void ScNavigatorDialogWrapper::Resizing( Size& rSize ) -{ - static_cast<ScNavigatorDlg*>(GetWindow())->Resizing(rSize); + pNavigator = VclPtr<ScNavigatorDlg>::Create(pBind, false, pParent); + if (SfxNavigator* pNav = dynamic_cast<SfxNavigator*>(pParent)) + pNav->SetMinOutputSizePixel(pNavigator->GetOptimalSize()); + SetWindow(pNavigator); } -// class ScNavigatorPI - #define CTRL_ITEMS 4 #define REGISTER_SLOT(i,id) \ ppBoundItems[i]=new ScNavigatorControllerItem(id,*this,rBindings); -ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, vcl::Window* pParent, - const bool bUseStyleSettingsBackground) : - Window( pParent, ScResId(RID_SCDLG_NAVIGATOR) ), - rBindings ( *pB ), // is used in CommandToolBox ctor - aCmdImageList( ScResId( IL_CMD ) ), - aFtCol ( VclPtr<FixedText>::Create( this, ScResId( FT_COL ) ) ), - aEdCol ( VclPtr<ColumnEdit>::Create( this, ScResId( ED_COL ) ) ), - aFtRow ( VclPtr<FixedText>::Create( this, ScResId( FT_ROW ) ) ), - aEdRow ( VclPtr<RowEdit>::Create( this, ScResId( ED_ROW ) ) ), - aTbxCmd ( VclPtr<CommandToolBox>::Create( this, ScResId( TBX_CMD ) ) ), - aLbEntries ( VclPtr<ScContentTree>::Create( this, ScResId( LB_ENTRIES ) ) ), - aWndScenarios( VclPtr<ScScenarioWindow>::Create( this,ScResId( SCSTR_QHLP_SCEN_LISTBOX), ScResId(SCSTR_QHLP_SCEN_COMMENT)) ), - aLbDocuments( VclPtr<ListBox>::Create( this, ScResId( LB_DOCUMENTS ) ) ), - aStrDragMode ( ScResId( SCSTR_DRAGMODE ) ), - aStrDisplay ( ScResId( SCSTR_DISPLAY ) ), - aStrActiveWin( ScResId( SCSTR_ACTIVEWIN ) ), - pContextWin ( pCW ), - pMarkArea ( nullptr ), - pViewData ( nullptr ), - nListModeHeight( 0 ), - nInitListHeight( 0 ), - eListMode ( NAV_LMODE_NONE ), - nDropMode ( SC_DROPMODE_URL ), - nCurCol ( 0 ), - nCurRow ( 0 ), - nCurTab ( 0 ), - bFirstBig ( false ), - mbUseStyleSettingsBackground(bUseStyleSettingsBackground) -{ +ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, bool bSidebar, vcl::Window* pParent) + : PanelLayout(pParent, "NavigatorPanel", "modules/scalc/ui/navigatorpanel.ui", nullptr) + , rBindings(*pB) + , aStrDragMode(ScResId(SCSTR_DRAGMODE)) + , aStrDisplay(ScResId(SCSTR_DISPLAY)) + , aStrActiveWin(ScResId(SCSTR_ACTIVEWIN)) + , bInSidebar(bSidebar) + , pMarkArea(nullptr) + , pViewData(nullptr ) + , eListMode(NAV_LMODE_NONE) + , nDropMode(SC_DROPMODE_URL) + , nCurCol(0) + , nCurRow(0) + , nCurTab(0) +{ + get(aLbDocuments, "documents"); + get(aEdCol, "column"); + get(aEdRow, "row"); + get(aTbxCmd, "toolbox"); + aTbxCmd->SetSelectHdl(LINK(this, ScNavigatorDlg, ToolBoxSelectHdl)); + aTbxCmd->SetDropdownClickHdl(LINK(this, ScNavigatorDlg, ToolBoxDropdownClickHdl)); + nZoomId = aTbxCmd->GetItemId("contents"); + nChangeRootId = aTbxCmd->GetItemId("toggle"); + nDragModeId = aTbxCmd->GetItemId("dragmode"); + aTbxCmd->SetItemBits(nDragModeId, aTbxCmd->GetItemBits(nDragModeId) | ToolBoxItemBits::DROPDOWNONLY); + nScenarioId = aTbxCmd->GetItemId("scenarios"); + nDownId = aTbxCmd->GetItemId("end"); + nUpId = aTbxCmd->GetItemId("start"); + nAreaId = aTbxCmd->GetItemId("datarange"); + get(aContentBox, "contentbox"); + aLbEntries = VclPtr<ScContentTree>::Create(aContentBox, this); + aLbEntries->set_hexpand(true); + aLbEntries->set_vexpand(true); + aLbEntries->Show(); + get(aScenarioBox, "scenariobox"); + aWndScenarios = VclPtr<ScScenarioWindow>::Create(aScenarioBox, + ScResId(SCSTR_QHLP_SCEN_LISTBOX), ScResId(SCSTR_QHLP_SCEN_COMMENT)); + aWndScenarios->set_hexpand(true); + aWndScenarios->set_vexpand(true); + aWndScenarios->Show(); + ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg(); nDropMode = rCfg.GetDragMode(); - // eListMode is set from outside, Root further below + aTbxCmd->InsertBreak(3); + aTbxCmd->SetLineCount(2); aLbDocuments->SetDropDownLineCount(9); aLbDocuments->SetSelectHdl(LINK(this, ScNavigatorDlg, DocumentSelectHdl)); - aStrActive = " (" - + OUString( ScResId( SCSTR_ACTIVE ) ) - + ")"; // " (active)" - aStrNotActive = " (" - + OUString( ScResId( SCSTR_NOTACTIVE ) ) - + ")"; // " (not active)" - aStrHidden = " (" - + OUString( ScResId( SCSTR_HIDDEN ) ) - + ")"; // " (hidden)" + aStrActive = " (" + OUString(ScResId(SCSTR_ACTIVE)) + ")"; // " (active)" + aStrNotActive = " (" + OUString(ScResId(SCSTR_NOTACTIVE)) + ")"; // " (not active)" + aStrHidden = " (" + OUString(ScResId(SCSTR_HIDDEN)) + ")"; // " (hidden)" aTitleBase = GetText(); - const long nListboxYPos = - ::std::max( - (aTbxCmd->GetPosPixel().Y() + aTbxCmd->GetSizePixel().Height()), - (aEdRow->GetPosPixel().Y() + aEdRow->GetSizePixel().Height()) ) - + 4; - aLbEntries->setPosSizePixel( 0, nListboxYPos, 0, 0, PosSizeFlags::Y); - - nBorderOffset = aLbEntries->GetPosPixel().X(); - - aInitSize.Width() = aTbxCmd->GetPosPixel().X() - + aTbxCmd->GetSizePixel().Width() - + nBorderOffset; - aInitSize.Height() = aLbEntries->GetPosPixel().Y(); - - nInitListHeight = aLbEntries->GetSizePixel().Height(); - nListModeHeight = aInitSize.Height() - + nInitListHeight; - ppBoundItems = new ScNavigatorControllerItem* [CTRL_ITEMS]; rBindings.ENTERREGISTRATIONS(); @@ -612,8 +500,6 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, vcl StartListening( *(SfxGetpApp()) ); StartListening( rBindings ); - aLbDocuments->Hide(); // does not exist at NAV_LMODE_NONE - aLbEntries->InitWindowBits(true); aLbEntries->SetSpaceBetweenEntries(0); @@ -630,34 +516,35 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, vcl aLbEntries->Refresh(); GetDocNames(nullptr); - aTbxCmd->UpdateButtons(); + UpdateButtons(); UpdateColumn(); UpdateRow(); UpdateTable(nullptr); - aLbEntries->Hide(); - aWndScenarios->Hide(); - aWndScenarios->SetPosPixel( aLbEntries->GetPosPixel() ); + aContentBox->Hide(); + aScenarioBox->Hide(); aContentIdle.SetIdleHdl( LINK( this, ScNavigatorDlg, TimeHdl ) ); aContentIdle.SetPriority( SchedulerPriority::LOWEST ); - FreeResource(); - - aLbEntries->SetAccessibleRelationLabeledBy(aLbEntries.get()); - aTbxCmd->SetAccessibleRelationLabeledBy(aTbxCmd.get()); - aLbDocuments->SetAccessibleName(aStrActiveWin); - - if (pContextWin == nullptr) + if (bInSidebar) { - // When the context window is missing then the navigator is - // displayed in the sidebar and has the whole deck to fill. - // Therefore hide the button that hides all controls below the - // top two rows of buttons. - aTbxCmd->Select(IID_ZOOMOUT); - aTbxCmd->RemoveItem(aTbxCmd->GetItemPos(IID_ZOOMOUT)); + // When the navigator is displayed in the sidebar it has the whole deck + // to fill. Therefore hide the button that hides all controls below + // the top two rows of buttons. + aTbxCmd->RemoveItem(aTbxCmd->GetItemPos(nZoomId)); } aLbEntries->SetNavigatorDlgFlag(true); + + // if scenario was active, switch on + NavListMode eNavMode = (NavListMode) rCfg.GetListMode(); + if (eNavMode == NAV_LMODE_SCENARIOS) + aTbxCmd->CheckItem(nScenarioId); + else + eNavMode = NAV_LMODE_AREAS; + SetListMode(eNavMode); + + aExpandedSize = GetOptimalSize(); } ScNavigatorDlg::~ScNavigatorDlg() @@ -669,8 +556,7 @@ void ScNavigatorDlg::dispose() { aContentIdle.Stop(); - sal_uInt16 i; - for ( i=0; i<CTRL_ITEMS; i++ ) + for (sal_uInt16 i = 0; i < CTRL_ITEMS; ++i) delete ppBoundItems[i]; delete [] ppBoundItems; @@ -679,137 +565,23 @@ void ScNavigatorDlg::dispose() EndListening( *(SfxGetpApp()) ); EndListening( rBindings ); - aFtCol.disposeAndClear(); - aEdCol.disposeAndClear(); - aFtRow.disposeAndClear(); - aEdRow.disposeAndClear(); - aTbxCmd.disposeAndClear(); + aEdCol.clear(); + aEdRow.clear(); + aTbxCmd.clear(); aLbEntries.disposeAndClear(); + aContentBox.clear(); aWndScenarios.disposeAndClear(); - aLbDocuments.disposeAndClear(); - vcl::Window::dispose(); -} - -void ScNavigatorDlg::Resizing( Size& rNewSize ) // Size = Outputsize? -{ - FloatingWindow* pFloat = pContextWin!=nullptr ? pContextWin->GetFloatingWindow() : nullptr; - if ( pFloat ) - { - Size aMinOut = pFloat->GetMinOutputSizePixel(); - - if ( rNewSize.Width() < aMinOut.Width() ) - rNewSize.Width() = aMinOut.Width(); - - if ( eListMode == NAV_LMODE_NONE ) - rNewSize.Height() = aInitSize.Height(); - else - { - if ( rNewSize.Height() < aMinOut.Height() ) - rNewSize.Height() = aMinOut.Height(); - } - } -} - -void ScNavigatorDlg::Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) -{ - if (mbUseStyleSettingsBackground) - { - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - Color aBgColor = rStyleSettings.GetFaceColor(); - Wallpaper aBack( aBgColor ); - - SetBackground( aBack ); - aFtCol->SetBackground( aBack ); - aFtRow->SetBackground( aBack ); - } - else - { - aFtCol->SetBackground(Wallpaper()); - aFtRow->SetBackground(Wallpaper()); - } - - Window::Paint(rRenderContext, rRect); -} - -void ScNavigatorDlg::DataChanged( const DataChangedEvent& rDCEvt ) -{ - if ( rDCEvt.GetType() == DataChangedEventType::SETTINGS && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) - { - // toolbox images are exchanged in CommandToolBox::DataChanged - Invalidate(); - } - - Window::DataChanged( rDCEvt ); -} - -void ScNavigatorDlg::Resize() -{ - DoResize(); -} - -void ScNavigatorDlg::DoResize() -{ - Size aNewSize = GetOutputSizePixel(); - long nTotalHeight = aNewSize.Height(); - - // if the navigator is docked, the window is probably at first small generated, - // then there is a resize to the actual size -> switch on content - - bool bSmall = ( nTotalHeight <= aInitSize.Height() + SCNAV_MINTOL ); - if ( !bSmall && bFirstBig ) - { - // Switch on content again as described in the config - - bFirstBig = false; - NavListMode eNavMode = NAV_LMODE_AREAS; - ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg(); - NavListMode eLastMode = (NavListMode) rCfg.GetListMode(); - if ( eLastMode == NAV_LMODE_SCENARIOS ) - eNavMode = NAV_LMODE_SCENARIOS; - SetListMode( eNavMode, false ); // FALSE: do not set the Float size - } - - // even if the content is not visible, adapt the size, - // so the width fit - - Point aEntryPos = aLbEntries->GetPosPixel(); - Point aListPos = aLbDocuments->GetPosPixel(); - aNewSize.Width() -= 2*nBorderOffset; - Size aDocSize = aLbDocuments->GetSizePixel(); - aDocSize.Width() = aNewSize.Width(); - - if(!bSmall) - { - - long nListHeight = aLbDocuments->GetSizePixel().Height(); - aNewSize.Height() -= ( aEntryPos.Y() + nListHeight + 2*nBorderOffset ); - if(aNewSize.Height()<0) aNewSize.Height()=0; - - aListPos.Y() = aEntryPos.Y() + aNewSize.Height() + nBorderOffset; - - if(aListPos.Y() > aLbEntries->GetPosPixel().Y()) - aLbDocuments->SetPosPixel( aListPos ); - - } - aLbEntries->SetSizePixel( aNewSize ); - aWndScenarios->SetSizePixel( aNewSize ); - aLbDocuments->SetSizePixel( aDocSize ); - - bool bListMode = (eListMode != NAV_LMODE_NONE); - if (pContextWin != nullptr) - { - FloatingWindow* pFloat = pContextWin->GetFloatingWindow(); - if ( pFloat && bListMode ) - nListModeHeight = nTotalHeight; - } + aScenarioBox.clear(); + aLbDocuments.clear(); + PanelLayout::dispose(); } void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - if ( dynamic_cast<const SfxEventHint*>(&rHint) ) + if (const SfxEventHint* pHint = dynamic_cast<const SfxEventHint*>(&rHint)) { - sal_uLong nEventId = static_cast<const SfxEventHint&>(rHint).GetEventId(); - if ( nEventId == SFX_EVENT_ACTIVATEDOC ) + sal_uLong nEventId = pHint->GetEventId(); + if (nEventId == SFX_EVENT_ACTIVATEDOC) { aLbEntries->ActiveDocChanged(); UpdateAll(); @@ -819,11 +591,11 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint ) { const sal_uInt32 nHintId = rHint.GetId(); - if ( nHintId == SC_HINT_DOCNAME_CHANGED ) + if (nHintId == SC_HINT_DOCNAME_CHANGED) { aLbEntries->ActiveDocChanged(); } - else if ( NAV_LMODE_NONE == eListMode ) + else if (NAV_LMODE_NONE == eListMode) { // Table not any more } @@ -886,8 +658,7 @@ IMPL_LINK( ScNavigatorDlg, TimeHdl, Idle*, pIdle, void ) void ScNavigatorDlg::SetDropMode(sal_uInt16 nNew) { nDropMode = nNew; - aTbxCmd->UpdateButtons(); - + UpdateButtons(); ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg(); rCfg.SetDragMode(nDropMode); } @@ -1047,18 +818,14 @@ void ScNavigatorDlg::UpdateTable( const SCTAB* pTab ) void ScNavigatorDlg::UpdateAll() { - switch ( eListMode ) + switch (eListMode) { - case NAV_LMODE_DOCS: - case NAV_LMODE_DBAREAS: case NAV_LMODE_AREAS: aLbEntries->Refresh(); break; - case NAV_LMODE_NONE: //! ??? break; - default: break; } @@ -1066,122 +833,76 @@ void ScNavigatorDlg::UpdateAll() aContentIdle.Stop(); // not again } -void ScNavigatorDlg::SetListMode( NavListMode eMode, bool bSetSize ) +void ScNavigatorDlg::SetListMode(NavListMode eMode) { - if ( eMode != eListMode ) + if (eMode != eListMode) { - if ( eMode != NAV_LMODE_NONE ) - bFirstBig = false; // do not switch automatically any more + bool bForceParentResize = (eMode == NAV_LMODE_NONE || eListMode == NAV_LMODE_NONE); + SfxNavigator* pNav = bForceParentResize ? dynamic_cast<SfxNavigator*>(GetParent()) : nullptr; + if (pNav && eMode == NAV_LMODE_NONE) //save last normal size on minimizing + aExpandedSize = GetSizePixel(); eListMode = eMode; - switch ( eMode ) + switch (eMode) { case NAV_LMODE_NONE: - ShowList( false, bSetSize ); + ShowList(false); break; - case NAV_LMODE_AREAS: - case NAV_LMODE_DBAREAS: - case NAV_LMODE_DOCS: aLbEntries->Refresh(); - ShowList( true, bSetSize ); + ShowList(true); break; - case NAV_LMODE_SCENARIOS: - ShowScenarios( bSetSize ); + ShowScenarios(); break; } - aTbxCmd->UpdateButtons(); + UpdateButtons(); - if ( eMode != NAV_LMODE_NONE ) + if (eMode != NAV_LMODE_NONE) { ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg(); rCfg.SetListMode( (sal_uInt16) eMode ); } + + if (pNav) + { + Size aOptimalSize(GetOptimalSize()); + Size aNewSize(pNav->GetOutputSizePixel()); + aNewSize.Height() = eMode == NAV_LMODE_NONE ? aOptimalSize.Height() : aExpandedSize.Height(); + pNav->SetMinOutputSizePixel(aOptimalSize); + pNav->SetOutputSizePixel(aNewSize); + } } - if ( pMarkArea ) + if (pMarkArea) UnmarkDataArea(); } -void ScNavigatorDlg::ShowList( bool bShow, bool bSetSize ) +void ScNavigatorDlg::ShowList(bool bShow) { - FloatingWindow* pFloat = pContextWin!=nullptr ? pContextWin->GetFloatingWindow() : nullptr; - Size aSize = GetParent()->GetOutputSizePixel(); - - if ( bShow ) + if (bShow) { - Size aMinSize = aInitSize; - - aMinSize.Height() += nInitListHeight; - if ( pFloat ) - pFloat->SetMinOutputSizePixel( aMinSize ); - aSize.Height() = nListModeHeight; - aLbEntries->Show(); + aContentBox->Show(); aLbDocuments->Show(); } else { - if ( pFloat ) - { - pFloat->SetMinOutputSizePixel( aInitSize ); - nListModeHeight = aSize.Height(); - } - aSize.Height() = aInitSize.Height(); - aLbEntries->Hide(); + aContentBox->Hide(); aLbDocuments->Hide(); } - aWndScenarios->Hide(); - - if ( pFloat ) - { - if ( bSetSize ) - pFloat->SetOutputSizePixel( aSize ); - } - else - { - SfxNavigator* pNav = dynamic_cast<SfxNavigator*>(GetParent()); - if (pNav != nullptr) - { - Size aFloating = pNav->GetFloatingSize(); - aFloating.Height() = aSize.Height(); - pNav->SetFloatingSize( aFloating ); - } - } + aScenarioBox->Hide(); } -void ScNavigatorDlg::ShowScenarios( bool bSetSize ) +void ScNavigatorDlg::ShowScenarios() { - FloatingWindow* pFloat = pContextWin!=nullptr ? pContextWin->GetFloatingWindow() : nullptr; - Size aSize = GetParent()->GetOutputSizePixel(); - - Size aMinSize = aInitSize; - aMinSize.Height() += nInitListHeight; - if ( pFloat ) - pFloat->SetMinOutputSizePixel( aMinSize ); - aSize.Height() = nListModeHeight; - rBindings.Invalidate( SID_SELECT_SCENARIO ); rBindings.Update( SID_SELECT_SCENARIO ); - aWndScenarios->Show(); + aScenarioBox->Show(); aLbDocuments->Show(); - aLbEntries->Hide(); - - if ( pFloat ) - { - if ( bSetSize ) - pFloat->SetOutputSizePixel( aSize ); - } - else - { - SfxNavigator* pNav = static_cast<SfxNavigator*>(GetParent()); - Size aFloating = pNav->GetFloatingSize(); - aFloating.Height() = aSize.Height(); - pNav->SetFloatingSize( aFloating ); - } + aContentBox->Hide(); } // documents for Dropdown-Listbox @@ -1266,7 +987,7 @@ void ScNavigatorDlg::UnmarkDataArea() void ScNavigatorDlg::CheckDataArea() { - if ( aTbxCmd->IsItemChecked( IID_DATA ) && pMarkArea ) + if (aTbxCmd->IsItemChecked(nDataId) && pMarkArea) { if ( nCurTab != pMarkArea->nTab || nCurCol < pMarkArea->nColStart+1 @@ -1274,8 +995,8 @@ void ScNavigatorDlg::CheckDataArea() || nCurRow < pMarkArea->nRowStart+1 || nCurRow > pMarkArea->nRowEnd+1 ) { - aTbxCmd->SetItemState( IID_DATA, TriState(TRISTATE_TRUE) ); - aTbxCmd->Select( IID_DATA ); + aTbxCmd->SetItemState(nDataId, TriState(TRISTATE_TRUE)); + aTbxCmd->TriggerItem(nDataId); } } } diff --git a/sc/source/ui/navipi/navipi.hrc b/sc/source/ui/navipi/navipi.hrc deleted file mode 100644 index 76e1eb60ce9a..000000000000 --- a/sc/source/ui/navipi/navipi.hrc +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include "sc.hrc" - -#define FT_ROW 1 -#define ED_ROW 2 -#define FT_COL 3 -#define ED_COL 4 -#define LB_DOCUMENTS 5 -#define LB_ENTRIES 6 -#define TBX_CMD 7 -#define IL_CMD 8 - -#define IID_AREAS 1 -#define IID_DBAREAS 2 -#define IID_DATA 3 -#define IID_DOCS 4 -#define IID_UP 5 -#define IID_DOWN 6 -#define IID_SCENARIOS 7 -#define IID_DROPMODE 9 -#define IID_CHANGEROOT 10 -#define IID_ZOOMOUT 11 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/navipi/navipi.src b/sc/source/ui/navipi/navipi.src index b7f1ddc7deeb..90e73f9ce094 100644 --- a/sc/source/ui/navipi/navipi.src +++ b/sc/source/ui/navipi/navipi.src @@ -17,148 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "navipi.hrc" - -Window RID_SCDLG_NAVIGATOR -{ - SVLook = TRUE ; - HelpId = HID_SC_NAVIGATOR ; - Size = MAP_APPFONT ( 115 , 116 ) ; - OutputSize = TRUE ; - DialogControl = TRUE ; - Hide = TRUE ; - Text [ en-US ] = "Navigator" ; - FixedText FT_ROW - { - Pos = MAP_APPFONT ( 2 , 19 ) ; - // an kleinere Toolbox-Bitmaps angepasst - Size = MAP_APPFONT ( 19 , 10 ) ; - Text [ en-US ] = "Row" ; - }; - NumericField ED_ROW - { - HelpId = HID_SC_NAVIPI_ROW ; - Border = TRUE ; - Pos = MAP_APPFONT ( 31 , 18 ) ; - // an kleinere Toolbox-Bitmaps angepasst - Size = MAP_APPFONT ( 30 , 12 ) ; - Right = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - SpinSize = 1 ; - Minimum = 1 ; - First = 1 ; - QuickHelpText [ en-US ] = "Row" ; - }; - FixedText FT_COL - { - Pos = MAP_APPFONT ( 2 , 5 ) ; - Size = MAP_APPFONT ( 23 , 10 ) ; - Text [ en-US ] = "Column" ; - }; - SpinField ED_COL - { - HelpId = HID_SC_NAVIPI_COL ; - Border = TRUE ; - Pos = MAP_APPFONT ( 31 , 4 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - Right = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - QuickHelpText [ en-US ] = "Column" ; - }; - Control LB_ENTRIES - { - // "Control" braucht immer eigene HelpId - HelpId = HID_SC_NAVIPI_ENTRIES ; - Border = TRUE ; - Pos = MAP_APPFONT ( 2 , 35 ) ; - Size = MAP_APPFONT ( 110 , 100 ) ; - TabStop = TRUE ; - }; - ListBox LB_DOCUMENTS - { - HelpId = HID_SC_NAVIPI_DOC ; - Border = TRUE ; - Pos = MAP_APPFONT ( 2 , 89 ) ; - Size = MAP_APPFONT ( 82 , 50 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - QuickHelpText [ en-US ] = "Document" ; - }; - ImageList IL_CMD - { - Prefix = "na"; - IdList = - { - IID_DATA ; - IID_UP ; - IID_DOWN ; - IID_SCENARIOS ; - IID_DROPMODE ; - IID_CHANGEROOT ; - IID_ZOOMOUT ; - }; - IdCount = { 8 ; }; - }; - ToolBox TBX_CMD - { - Pos = MAP_APPFONT ( 66 , 3 ) ; - HelpId = HID_SC_NAVIPI_TOOLBOX ; - SVLook = TRUE ; - Border = FALSE ; - LineCount = 2 ; - ItemList = - { - ToolBoxItem - { - Identifier = IID_DATA ; - HelpId = HID_SC_NAVIPI_DATA ; - Text [ en-US ] = "Data Range" ; - }; - ToolBoxItem - { - Identifier = IID_UP ; - HelpId = HID_SC_NAVIPI_UP ; - Text [ en-US ] = "Start" ; - }; - ToolBoxItem - { - Identifier = IID_DOWN ; - HelpId = HID_SC_NAVIPI_DOWN ; - Text [ en-US ] = "End" ; - }; - - ToolBoxItem { Type = TOOLBOXITEM_BREAK ; }; - - ToolBoxItem - { - Identifier = IID_ZOOMOUT ; - HelpId = HID_SC_NAVIPI_ZOOM ; - Text [ en-US ] = "Contents" ; - }; - ToolBoxItem - { - Identifier = IID_CHANGEROOT ; - HelpId = HID_SC_NAVIPI_ROOT ; - Text [ en-US ] = "Toggle" ; - }; - ToolBoxItem - { - Identifier = IID_SCENARIOS ; - HelpId = HID_SC_NAVIPI_SCEN ; - Text [ en-US ] = "Scenarios" ; - }; - ToolBoxItem - { - Identifier = IID_DROPMODE ; - HelpId = HID_SC_NAVIPI_DROP ; - DropDown = TRUE ; - Text [ en-US ] = "Drag Mode" ; - }; - }; - }; -}; +#include "sc.hrc" ImageList RID_IMAGELIST_NAVCONT { diff --git a/sc/source/ui/navipi/scenwnd.cxx b/sc/source/ui/navipi/scenwnd.cxx index c5976d9c443f..9c6884b05c6c 100644 --- a/sc/source/ui/navipi/scenwnd.cxx +++ b/sc/source/ui/navipi/scenwnd.cxx @@ -274,18 +274,18 @@ void ScScenarioWindow::NotifyState( const SfxPoolItem* pState ) } } -void ScScenarioWindow::SetSizePixel( const Size& rNewSize ) +void ScScenarioWindow::Resize() { - Size aSize( rNewSize ); - long nHeight = aSize.Height() / 2; + Window::Resize(); - Window::SetSizePixel( aSize ); + Size aSize(GetSizePixel()); + long nHeight = aSize.Height() / 2; aSize.Height() = nHeight; - aLbScenario->SetSizePixel( aSize ); + aLbScenario->SetSizePixel(aSize); aSize.Height() -= 4; - aEdComment->SetPosSizePixel( Point( 0, nHeight+4 ), aSize ); + aEdComment->SetPosSizePixel(Point(0, nHeight + 4), aSize); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/sidebar/ScPanelFactory.cxx b/sc/source/ui/sidebar/ScPanelFactory.cxx index 9e584d896602..b526c3521be3 100644 --- a/sc/source/ui/sidebar/ScPanelFactory.cxx +++ b/sc/source/ui/sidebar/ScPanelFactory.cxx @@ -93,7 +93,7 @@ Reference<ui::XUIElement> SAL_CALL ScPanelFactory::createUIElement ( pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings ); else if (rsResourceURL.endsWith("/NavigatorPanel")) { - pPanel = VclPtr<ScNavigatorDlg>::Create(pBindings, nullptr, pParentWindow, false); + pPanel = VclPtr<ScNavigatorDlg>::Create(pBindings, true, pParentWindow); nMinimumSize = 0; } else if (rsResourceURL.endsWith("/FunctionsPanel")) diff --git a/sc/uiconfig/scalc/ui/navigatorpanel.ui b/sc/uiconfig/scalc/ui/navigatorpanel.ui new file mode 100644 index 000000000000..b56069a5566d --- /dev/null +++ b/sc/uiconfig/scalc/ui/navigatorpanel.ui @@ -0,0 +1,241 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.20.0 --> +<interface> + <requires lib="gtk+" version="3.0"/> + <object class="GtkGrid" id="NavigatorPanel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <child> + <object class="GtkGrid"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="border_width">6</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkGrid"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <property name="hexpand">True</property> + <child> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="label" translatable="yes">Column:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">column</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="label" translatable="yes">Row:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">row</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="sclo-ColumnEdit" id="column"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="tooltip_text" translatable="yes">Column</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="sclo-RowEdit" id="row"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="tooltip_text" translatable="yes">Row</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkToolbar" id="toolbox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="toolbar_style">icons</property> + <child> + <object class="GtkToolButton" id="datarange"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_text" translatable="yes">Data Range</property> + <property name="action_name">datarange</property> + <property name="icon_name">sc/imglst/na03.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="start"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_text" translatable="yes">Start</property> + <property name="action_name">start</property> + <property name="icon_name">sc/imglst/na05.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="end"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_text" translatable="yes">End</property> + <property name="action_name">end</property> + <property name="icon_name">sc/imglst/na06.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="contents"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_text" translatable="yes">Contents</property> + <property name="action_name">contents</property> + <property name="icon_name">sc/imglst/na011.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="toggle"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_text" translatable="yes">Toggle</property> + <property name="action_name">toggle</property> + <property name="icon_name">sc/imglst/na010.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="scenarios"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_text" translatable="yes">Scenarios</property> + <property name="action_name">scenarios</property> + <property name="icon_name">sc/imglst/na07.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkMenuToolButton" id="dragmode"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_text" translatable="yes">Drag Mode</property> + <property name="action_name">dragmode</property> + <property name="icon_name">sc/imglst/na09.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">0</property> + <property name="height">2</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="documents"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_text" translatable="yes">Document</property> + <child internal-child="accessible"> + <object class="AtkObject" id="documents-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">Active Window</property> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + </packing> + </child> + <child> + <object class="GtkBox" id="contentbox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="scenariobox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + </object> +</interface> |