diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-06-19 15:02:49 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-09-03 18:25:52 +0200 |
commit | 79daf40ec696e0855d4a2894f048e44188cfbbb6 (patch) | |
tree | 96cb3ec48472c06961c1f4392ea6e1b560980555 /include | |
parent | b094921089beeecb2333075e174c8b1fa6d1b812 (diff) |
weld SvxAreaTabPage
which itself has 5 sub tab pages
Change-Id: If71e91248b5771af4845ad6dba997ac4c7841b5d
Reviewed-on: https://gerrit.libreoffice.org/56112
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/sfx2/tabdlg.hxx | 8 | ||||
-rw-r--r-- | include/svtools/valueset.hxx | 6 | ||||
-rw-r--r-- | include/svx/SvxPresetListBox.hxx | 39 | ||||
-rw-r--r-- | include/svx/colorbox.hxx | 3 | ||||
-rw-r--r-- | include/svx/dlgctrl.hxx | 31 | ||||
-rw-r--r-- | include/vcl/customweld.hxx | 6 | ||||
-rw-r--r-- | include/vcl/layout.hxx | 11 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 4 |
8 files changed, 101 insertions, 7 deletions
diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx index ebcaf8c17268..d0c28f1c30f9 100644 --- a/include/sfx2/tabdlg.hxx +++ b/include/sfx2/tabdlg.hxx @@ -352,7 +352,9 @@ protected: } SfxTabDialog* GetTabDialog() const; +public: void SetTabDialog(SfxTabDialog* pDialog); +protected: SfxTabDialogController* GetDialogController() const; void SetDialogController(SfxTabDialogController* pDialog); @@ -394,6 +396,12 @@ public: css::uno::Reference< css::frame::XFrame > GetFrame(); OString GetConfigId() const; + + //TODO rename to get_preferred_size when SfxTabPage doesn't inherit from anything + Size get_container_size() const + { + return m_xContainer->get_preferred_size(); + } }; #endif diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx index 1e2921ba7a5e..9acfd7712ca8 100644 --- a/include/svtools/valueset.hxx +++ b/include/svtools/valueset.hxx @@ -495,6 +495,9 @@ public: void SetStyle(WinBits nStyle); WinBits GetStyle() const { return mnStyle; } + /// Insert @rImage item with @rStr as either a legend or tooltip depending on @bShowLegend. + void InsertItem(sal_uInt16 nItemId, const Image& rImage, + const OUString& rStr, size_t nPos = VALUESET_APPEND, bool bShowLegend = false); /// Insert an @rColor item with @rStr tooltip. void InsertItem(sal_uInt16 nItemId, const Color& rColor, const OUString& rStr); @@ -533,12 +536,15 @@ public: } Color GetItemColor( sal_uInt16 nItemId ) const; + void SetItemText( sal_uInt16 nItemId, const OUString& rStr ); OUString GetItemText( sal_uInt16 nItemId ) const; bool IsColor() const { return maColor.GetTransparency() == 0; } + void SetExtraSpacing( sal_uInt16 nNewSpacing ); + void Format(vcl::RenderContext const & rRenderContext); Size CalcWindowSizePixel(const Size& rItemSize, diff --git a/include/svx/SvxPresetListBox.hxx b/include/svx/SvxPresetListBox.hxx index c9c75a5a8c7a..c886032f3b1e 100644 --- a/include/svx/SvxPresetListBox.hxx +++ b/include/svx/SvxPresetListBox.hxx @@ -65,6 +65,45 @@ public: }; +class SVX_DLLPUBLIC PresetListBox : public SvtValueSet +{ +private: + sal_uInt32 nColCount; + Size aIconSize; + Link<PresetListBox*,void> maRenameHdl; + Link<PresetListBox*,void> maDeleteHdl; + + void OnMenuItemSelected(const OString& rIdent); + + template< typename ListType, typename EntryType > + void FillPresetListBoxImpl(ListType& pList, sal_uInt32 nStartIndex); + +public: + PresetListBox(std::unique_ptr<weld::ScrolledWindow> pWindow); + + virtual void Resize() override; + virtual bool ContextMenu(const Point& rPos) override; + sal_uInt32 getColumnCount() const { return nColCount; } + Size const & GetIconSize() const { return aIconSize; } + + void SetRenameHdl( const Link<PresetListBox*,void>& rLink ) + { + maRenameHdl = rLink; + } + void SetDeleteHdl( const Link<PresetListBox*,void>& rLink ) + { + maDeleteHdl = rLink; + } + + void FillPresetListBox(XGradientList& pList, sal_uInt32 nStartIndex = 1); + void FillPresetListBox(XHatchList& pList, sal_uInt32 nStartIndex = 1); + void FillPresetListBox(XBitmapList& pList, sal_uInt32 nStartIndex = 1); + void FillPresetListBox(XPatternList& pList, sal_uInt32 nStartIndex = 1); + void DrawLayout(); + +}; + + #endif // INCLUDED_SVX_SVXPRESETLISTBOX_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/colorbox.hxx b/include/svx/colorbox.hxx index efa949db4081..6ce1d611486b 100644 --- a/include/svx/colorbox.hxx +++ b/include/svx/colorbox.hxx @@ -119,6 +119,7 @@ public: } Color const & GetSelectEntryColor() const { return m_aSelectedColor.first; } + NamedColor const & GetSelectedEntry() const { return m_aSelectedColor; } void SelectEntry(const Color& rColor); @@ -129,6 +130,8 @@ public: void SaveValue() { m_aSaveColor = GetSelectEntryColor(); } bool IsValueChangedFromSaved() const { return m_aSaveColor != GetSelectEntryColor(); } + + void set_sensitive(bool sensitive) { m_xButton->set_sensitive(sensitive); } }; /** A wrapper for SvxColorListBox. */ diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx index a355c50e2907..467dc8af4961 100644 --- a/include/svx/dlgctrl.hxx +++ b/include/svx/dlgctrl.hxx @@ -216,11 +216,14 @@ public: |* Control for editing bitmaps \************************************************************************/ -class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxPixelCtl final : public Control +class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxPixelCtl final : public weld::CustomWidgetController { private: static sal_uInt16 constexpr nLines = 8; static sal_uInt16 constexpr nSquares = nLines * nLines; + + VclPtr<SvxTabPage> m_pPage; + Color aPixelColor; Color aBackgroundColor; Size aRectSize; @@ -230,20 +233,24 @@ private: Point aFocusPosition; rtl::Reference<SvxPixelCtlAccessible> m_xAccess; - using OutputDevice::SetLineColor; - tools::Rectangle implCalFocusRect( const Point& aPosition ); void ChangePixel( sal_uInt16 nPixel ); + SvxPixelCtl(SvxPixelCtl const&) = delete; + SvxPixelCtl(SvxPixelCtl&&) = delete; + SvxPixelCtl& operator=(SvxPixelCtl const&) = delete; + SvxPixelCtl& operator=(SvxPixelCtl&&) = delete; + public: - SvxPixelCtl( vcl::Window* pParent ); + SvxPixelCtl(SvxTabPage* pPage); virtual ~SvxPixelCtl() override; + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; virtual void Resize() override; - virtual Size GetOptimalSize() const override; + virtual tools::Rectangle GetFocusRect() override; void SetXBitmap( const BitmapEx& rBitmapEx ); @@ -257,10 +264,15 @@ public: void SetPaintable( bool bTmp ) { bPaintable = bTmp; } void Reset(); - virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override; + + css::uno::Reference<css::accessibility::XAccessible> getAccessibleParent() { return GetDrawingArea()->get_accessible_parent(); } + virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; + a11yrelationset get_accessible_relation_set() { return GetDrawingArea()->get_accessible_relation_set(); } + static long GetSquares() { return nSquares ; } long GetWidth() const { return aRectSize.getWidth() ; } long GetHeight() const { return aRectSize.getHeight() ; } + SvxTabPage* GetTabPage() const { return m_pPage; } //Device Pixel . long ShowPosition( const Point &pt); @@ -269,7 +281,7 @@ public: Point IndexToPoint(long nIndex) const ; long GetFocusPosIndex() const ; //Keyboard function for key input and focus handling function - virtual void KeyInput( const KeyEvent& rKEvt ) override; + virtual bool KeyInput( const KeyEvent& rKEvt ) override; virtual void GetFocus() override; virtual void LoseFocus() override; }; @@ -406,6 +418,11 @@ public: // change support virtual void StyleUpdated() override; + void SetDrawMode(DrawModeFlags nDrawMode) + { + mpBufferDevice->SetDrawMode(nDrawMode); + } + // dada read access SdrModel& getModel() const { diff --git a/include/vcl/customweld.hxx b/include/vcl/customweld.hxx index f6770c8fe4a4..167b5b97b32e 100644 --- a/include/vcl/customweld.hxx +++ b/include/vcl/customweld.hxx @@ -33,6 +33,7 @@ public: virtual void GetFocus() {} virtual void LoseFocus() {} virtual void StyleUpdated() { Invalidate(); } + virtual bool ContextMenu(const Point&) { return false; } virtual bool KeyInput(const KeyEvent&) { return false; } virtual tools::Rectangle GetFocusRect() { return tools::Rectangle(); } virtual FactoryFunction GetUITestFactory() const { return nullptr; } @@ -57,6 +58,10 @@ public: bool IsEnabled() const { return m_pDrawingArea->get_sensitive(); } int GetTextHeight() const { return m_pDrawingArea->get_text_height(); } OUString GetAccessibleName() const { return m_pDrawingArea->get_accessible_name(); } + OUString GetAccessibleDescription() const + { + return m_pDrawingArea->get_accessible_description(); + } void CaptureMouse() { m_pDrawingArea->grab_add(); } bool IsMouseCaptured() const { return m_pDrawingArea->has_grab(); } void EnableRTL(bool bEnable) { m_pDrawingArea->set_direction(bEnable); } @@ -95,6 +100,7 @@ private: DECL_LINK(DoLoseFocus, weld::Widget&, void); DECL_LINK(DoKeyPress, const KeyEvent&, bool); DECL_LINK(DoFocusRect, weld::Widget&, tools::Rectangle); + DECL_LINK(DoPopupMenu, const Point&, bool); DECL_LINK(DoStyleUpdated, weld::Widget&, void); DECL_LINK(DoRequestHelp, tools::Rectangle&, OUString); diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index d33a942c8717..50fd57663542 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -620,6 +620,7 @@ private: Link<const KeyEvent&, bool> m_aKeyPressHdl; Link<const KeyEvent&, bool> m_aKeyReleaseHdl; Link<VclDrawingArea&, void> m_aStyleUpdatedHdl; + Link<const Point&, bool> m_aPopupMenuHdl; Link<tools::Rectangle&, OUString> m_aQueryTooltipHdl; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override @@ -671,6 +672,12 @@ private: Invalidate(); } } + virtual void Command(const CommandEvent& rEvent) override + { + if (rEvent.GetCommand() == CommandEventId::ContextMenu && m_aPopupMenuHdl.Call(rEvent.GetMousePosPixel())) + return; + Control::Command(rEvent); + } virtual void RequestHelp(const HelpEvent& rHelpEvent) override { if (rHelpEvent.GetMode() & (HelpEventMode::QUICK | HelpEventMode::BALLOON)) @@ -745,6 +752,10 @@ public: { m_aStyleUpdatedHdl = rLink; } + void SetPopupMenuHdl(const Link<const Point&, bool>& rLink) + { + m_aPopupMenuHdl = rLink; + } void SetQueryTooltipHdl(const Link<tools::Rectangle&, OUString>& rLink) { m_aQueryTooltipHdl = rLink; diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index cee22af8dc31..74ad3803bdc0 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -82,6 +82,8 @@ public: virtual void set_accessible_name(const OUString& rName) = 0; virtual OUString get_accessible_name() const = 0; + virtual OUString get_accessible_description() const = 0; + virtual void set_tooltip_text(const OUString& rTip) = 0; virtual void connect_focus_in(const Link<Widget&, void>& rLink) @@ -845,6 +847,7 @@ protected: Link<const KeyEvent&, bool> m_aKeyPressHdl; Link<const KeyEvent&, bool> m_aKeyReleaseHdl; Link<Widget&, void> m_aStyleUpdatedHdl; + Link<const Point&, bool> m_aPopupMenuHdl; Link<Widget&, tools::Rectangle> m_aGetFocusRectHdl; Link<tools::Rectangle&, OUString> m_aQueryTooltipHdl; @@ -871,6 +874,7 @@ public: void connect_key_press(const Link<const KeyEvent&, bool>& rLink) { m_aKeyPressHdl = rLink; } void connect_key_release(const Link<const KeyEvent&, bool>& rLink) { m_aKeyReleaseHdl = rLink; } void connect_style_updated(const Link<Widget&, void>& rLink) { m_aStyleUpdatedHdl = rLink; } + void connect_popup_menu(const Link<const Point&, bool>& rLink) { m_aPopupMenuHdl = rLink; } void connect_focus_rect(const Link<Widget&, tools::Rectangle>& rLink) { m_aGetFocusRectHdl = rLink; |