diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-06-16 21:41:31 +0000 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-06-21 16:47:47 +0200 |
commit | 6540912ae1a570fd8c2318f77b757e07b87c0707 (patch) | |
tree | f2da76bb78e4d785915be2ceb282d519600f49f2 /include | |
parent | d25e5069176ab53cdc917e3501a81e9546ec46f7 (diff) |
VCL merge most of NotebookbarTabControlBase
NotebookbarTabControlBase (NBBTCB) tried to be clever and save
a bool per TabControl page, by not adding a mbVisible to the
ImplTabItem and misuse mbEnabled.
The result is not only a bug with tab highlighting in notebook
bars, but also a lot of duplicate code and additional virtual
functions. Normal TabControls highlight correct.
I'm not 100% sure about the dropped Resize()s, but the code in
ImplPaint() and calculateRequisition() differs by three lines;
which can be merged by adding the TabControl feature to hide
tabs and not just disable them. I first tried to additionally
merge ImplPlaceTabs() too, but the NBBTCB version differs much
more and I didn't want to touch larger parts of TabControl.
Change-Id: Ie6e18fb03b76b46e3627923eb1ac0f674c3eb7e8
Reviewed-on: https://gerrit.libreoffice.org/74126
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/tabctrl.hxx | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/include/vcl/tabctrl.hxx b/include/vcl/tabctrl.hxx index cf64e66efc64..956c5ece7a6b 100644 --- a/include/vcl/tabctrl.hxx +++ b/include/vcl/tabctrl.hxx @@ -64,8 +64,10 @@ protected: using Control::ImplInitSettings; SAL_DLLPRIVATE void ImplInitSettings( bool bBackground ); SAL_DLLPRIVATE ImplTabItem* ImplGetItem( sal_uInt16 nId ) const; + SAL_DLLPRIVATE ImplTabItem* ImplGetItem(const Point& rPt) const; SAL_DLLPRIVATE Size ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth ); SAL_DLLPRIVATE tools::Rectangle ImplGetTabRect( sal_uInt16 nPos, long nWidth = -1, long nHeight = -1 ); + SAL_DLLPRIVATE tools::Rectangle ImplGetTabRect(const ImplTabItem*, long nWidth = -1, long nHeight = -1); SAL_DLLPRIVATE void ImplChangeTabPage( sal_uInt16 nId, sal_uInt16 nOldId ); SAL_DLLPRIVATE bool ImplPosCurTabPage(); virtual void ImplActivateTabPage( bool bNext ); @@ -85,9 +87,8 @@ protected: virtual void FillLayoutData() const override; virtual const vcl::Font& GetCanonicalFont( const StyleSettings& _rStyle ) const override; virtual const Color& GetCanonicalTextColor( const StyleSettings& _rStyle ) const override; - SAL_DLLPRIVATE tools::Rectangle* ImplFindPartRect( const Point& rPt ); virtual bool ImplPlaceTabs( long nWidth ); - virtual void ImplPaint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect); + SAL_DLLPRIVATE Size ImplCalculateRequisition(sal_uInt16& nHeaderHeight) const; public: TabControl( vcl::Window* pParent, @@ -124,21 +125,23 @@ public: sal_uInt16 nPos = TAB_APPEND ); void RemovePage( sal_uInt16 nPageId ); void Clear(); - void EnablePage( sal_uInt16 nPageId, bool bEnable = true ); + + void SetPageEnabled(sal_uInt16 nPageId, bool bEnable = true); + void SetPageVisible(sal_uInt16 nPageId, bool bVisible = true); sal_uInt16 GetPagePos( sal_uInt16 nPageId ) const; sal_uInt16 GetPageCount() const; sal_uInt16 GetPageId( sal_uInt16 nPos ) const; - virtual sal_uInt16 GetPageId( const Point& rPos ) const; + sal_uInt16 GetPageId(const Point& rPos) const; sal_uInt16 GetPageId( const TabPage& rPage ) const; sal_uInt16 GetPageId( const OString& rName ) const; - virtual void SetCurPageId( sal_uInt16 nPageId ); + void SetCurPageId(sal_uInt16 nPageId); sal_uInt16 GetCurPageId() const; - virtual void SelectTabPage( sal_uInt16 nPageId ); + void SelectTabPage( sal_uInt16 nPageId ); - void SetTabPage( sal_uInt16 nPageId, TabPage* pPage ); + void SetTabPage(sal_uInt16 nPageId, TabPage* pPage); TabPage* GetTabPage( sal_uInt16 nPageId ) const; void SetPageText( sal_uInt16 nPageId, const OUString& rText ); @@ -203,15 +206,11 @@ public: ToolBox* GetToolBox() { return m_pShortcuts; } PushButton* GetOpenMenu() { return m_pOpenMenu; } - virtual sal_uInt16 GetPageId( const Point& rPos ) const override; - virtual void SelectTabPage( sal_uInt16 nPageId ) override; - virtual void SetCurPageId( sal_uInt16 nPageId ) override; virtual Size calculateRequisition() const override; static sal_uInt16 GetHeaderHeight(); protected: virtual bool ImplPlaceTabs( long nWidth ) override; - virtual void ImplPaint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; virtual void ImplActivateTabPage( bool bNext ) override; private: |