summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-09-03 16:06:49 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-09-05 13:36:35 +0200
commit229483707c3ccb48d008d37f856bbeb6df199a90 (patch)
treec202bfb4777a66e6095fc971e317794f92399b4a /include
parent59b9fc4776940863d905de14e25d74421f7de603 (diff)
weld SvxBorderTabPage
Change-Id: I33f12f160ac5fea14c9a53c3846c6d31c7fd0084 Reviewed-on: https://gerrit.libreoffice.org/59954 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/svtools/ctrlbox.hxx87
-rw-r--r--include/svtools/valueset.hxx14
-rw-r--r--include/svx/colorbox.hxx1
-rw-r--r--include/svx/colorwindow.hxx1
-rw-r--r--include/svx/frmsel.hxx24
-rw-r--r--include/vcl/outdev.hxx3
-rw-r--r--include/vcl/weld.hxx3
7 files changed, 122 insertions, 11 deletions
diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx
index 97db99c3e07c..8df5dfdadc2b 100644
--- a/include/svtools/ctrlbox.hxx
+++ b/include/svtools/ctrlbox.hxx
@@ -22,12 +22,14 @@
#include <svtools/svtdllapi.h>
+#include <vcl/customweld.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/combobox.hxx>
#include <vcl/image.hxx>
#include <vcl/virdev.hxx>
#include <vcl/metric.hxx>
#include <vcl/field.hxx>
+#include <vcl/weld.hxx>
#include <com/sun/star/table/BorderLineStyle.hpp>
#include <o3tl/typed_flags_set.hxx>
@@ -280,6 +282,91 @@ inline void LineListBox::SetNone( const OUString& sNone )
m_sNone = sNone;
}
+class SvtValueSet;
+
+class SVT_DLLPUBLIC SvtLineListBox
+{
+public:
+ typedef Color (*ColorFunc)(Color);
+ typedef Color (*ColorDistFunc)(Color, Color);
+
+ SvtLineListBox(std::unique_ptr<weld::MenuButton> pControl);
+ ~SvtLineListBox();
+
+ /** Set the width in Twips */
+ void SetWidth( long nWidth )
+ {
+ m_nWidth = nWidth;
+ UpdateEntries();
+ UpdatePreview();
+ }
+
+ /** Insert a listbox entry with all widths in Twips. */
+ void InsertEntry(const BorderWidthImpl& rWidthImpl,
+ SvxBorderLineStyle nStyle, long nMinWidth = 0,
+ ColorFunc pColor1Fn = &sameColor,
+ ColorFunc pColor2Fn = &sameColor,
+ ColorDistFunc pColorDistFn = &sameDistColor);
+
+ void SelectEntry( SvxBorderLineStyle nStyle );
+ SvxBorderLineStyle GetSelectEntryStyle() const;
+
+ void SetSourceUnit( FieldUnit eNewUnit ) { eSourceUnit = eNewUnit; }
+
+ void SetColor( const Color& rColor )
+ {
+ aColor = rColor;
+ UpdateEntries();
+ }
+
+ const Color& GetColor() const { return aColor; }
+
+ void SetSelectHdl(const Link<SvtLineListBox&,void>& rLink) { maSelectHdl = rLink; }
+
+private:
+
+ SVT_DLLPRIVATE void ImpGetLine( long nLine1, long nLine2, long nDistance,
+ Color nColor1, Color nColor2, Color nColorDist,
+ SvxBorderLineStyle nStyle, BitmapEx& rBmp );
+
+ void UpdatePaintLineColor(); // returns sal_True if maPaintCol has changed
+ DECL_LINK(StyleUpdated, weld::Widget&, void);
+ DECL_LINK(ValueSelectHdl, SvtValueSet*, void);
+ DECL_LINK(FocusHdl, weld::Widget&, void);
+ DECL_LINK(NoneHdl, weld::Button&, void);
+
+ void UpdateEntries();
+ sal_Int32 GetStylePos(sal_Int32 nListPos);
+
+ const Color& GetPaintColor() const
+ {
+ return maPaintCol;
+ }
+ Color GetColorLine1( sal_Int32 nPos );
+ Color GetColorLine2( sal_Int32 nPos );
+ Color GetColorDist( sal_Int32 nPos );
+
+ void UpdatePreview();
+
+ SvtLineListBox( const SvtLineListBox& ) = delete;
+ SvtLineListBox& operator =( const SvtLineListBox& ) = delete;
+
+ std::unique_ptr<weld::MenuButton> m_xControl;
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Widget> m_xTopLevel;
+ std::unique_ptr<weld::Button> m_xNoneButton;
+ std::unique_ptr<SvtValueSet> m_xLineSet;
+ std::unique_ptr<weld::CustomWeld> m_xLineSetWin;
+
+ std::vector<std::unique_ptr<ImpLineListData>> m_vLineList;
+ long m_nWidth;
+ ScopedVclPtr<VirtualDevice> aVirDev;
+ Color aColor;
+ Color maPaintCol;
+ FieldUnit eSourceUnit;
+ Link<SvtLineListBox&,void> maSelectHdl;
+};
+
class SVT_DLLPUBLIC FontNameBox : public ComboBox
{
private:
diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx
index 9acfd7712ca8..fa4b3994de86 100644
--- a/include/svtools/valueset.hxx
+++ b/include/svtools/valueset.hxx
@@ -427,6 +427,7 @@ private:
long mnUserItemWidth;
long mnUserItemHeight;
sal_uInt16 mnSelItemId;
+ sal_uInt16 mnHighItemId;
sal_uInt16 mnCols;
sal_uInt16 mnCurCol;
sal_uInt16 mnUserCols;
@@ -441,7 +442,9 @@ private:
Link<SvtValueSet*,void> maSelectHdl;
bool mbFormat : 1;
+ bool mbHighlight : 1;
bool mbNoSelection : 1;
+ bool mbDrawSelection : 1;
bool mbBlackSel : 1;
bool mbDoubleSel : 1;
bool mbScroll : 1;
@@ -457,6 +460,7 @@ private:
SVT_DLLPRIVATE void ImplDrawItemText(vcl::RenderContext& rRenderContext, const OUString& rStr);
SVT_DLLPRIVATE void ImplDrawSelect(vcl::RenderContext& rRenderContext, sal_uInt16 nItemId, const bool bFocus, const bool bDrawSel);
SVT_DLLPRIVATE void ImplDrawSelect(vcl::RenderContext& rRenderContext);
+ SVT_DLLPRIVATE void ImplHighlightItem(sal_uInt16 nItemId, bool bIsSelection = true);
SVT_DLLPRIVATE void ImplDraw(vcl::RenderContext& rRenderContext);
SVT_DLLPRIVATE size_t ImplGetItem( const Point& rPoint ) const;
SVT_DLLPRIVATE SvtValueSetItem* ImplGetItem( size_t nPos );
@@ -466,8 +470,11 @@ private:
SVT_DLLPRIVATE tools::Rectangle ImplGetItemRect( size_t nPos ) const;
SVT_DLLPRIVATE void ImplFireAccessibleEvent( short nEventId, const css::uno::Any& rOldValue, const css::uno::Any& rNewValue );
SVT_DLLPRIVATE bool ImplHasAccessibleListeners();
+ SVT_DLLPRIVATE void ImplTracking(const Point& rPos);
DECL_DLLPRIVATE_LINK(ImplScrollHdl, weld::ScrolledWindow&, void);
+ Size GetLargestItemSize();
+
SvtValueSet (const SvtValueSet &) = delete;
SvtValueSet & operator= (const SvtValueSet &) = delete;
@@ -481,6 +488,7 @@ public:
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual void MouseMove( const MouseEvent& rMEvt ) override;
virtual bool KeyInput( const KeyEvent& rKEvt ) override;
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
virtual void GetFocus() override;
@@ -495,12 +503,16 @@ public:
void SetStyle(WinBits nStyle);
WinBits GetStyle() const { return mnStyle; }
+ void SetOptimalSize();
+
/// 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);
+ /// Insert an User Drawn item.
+ void InsertItem(sal_uInt16 nItemId, size_t nPos = VALUESET_APPEND);
void RemoveItem(sal_uInt16 nItemId);
void Clear();
@@ -535,6 +547,8 @@ public:
return mbNoSelection;
}
+ void SetItemImage( sal_uInt16 nItemId, const Image& rImage );
+ Image GetItemImage( sal_uInt16 nItemId ) const;
Color GetItemColor( sal_uInt16 nItemId ) const;
void SetItemText( sal_uInt16 nItemId, const OUString& rStr );
OUString GetItemText( sal_uInt16 nItemId ) const;
diff --git a/include/svx/colorbox.hxx b/include/svx/colorbox.hxx
index 6ce1d611486b..9f3648e4a472 100644
--- a/include/svx/colorbox.hxx
+++ b/include/svx/colorbox.hxx
@@ -124,6 +124,7 @@ public:
void SelectEntry(const Color& rColor);
void SetNoSelection() { getColorWindow()->SetNoSelection(); }
+ bool IsNoSelection() const { return getColorWindow()->IsNoSelection(); }
void ShowPreview(const NamedColor &rColor);
void EnsurePaletteManager();
diff --git a/include/svx/colorwindow.hxx b/include/svx/colorwindow.hxx
index ade14fbb1281..42493890db02 100644
--- a/include/svx/colorwindow.hxx
+++ b/include/svx/colorwindow.hxx
@@ -153,6 +153,7 @@ public:
weld::Container* GetWidget() { return mxTopLevel.get(); }
virtual ~ColorWindow() override;
void SetNoSelection();
+ bool IsNoSelection() const;
void SelectEntry(const NamedColor& rColor);
void SelectEntry(const Color& rColor);
NamedColor GetSelectEntryColor() const;
diff --git a/include/svx/frmsel.hxx b/include/svx/frmsel.hxx
index db2699edd543..db7fe5711765 100644
--- a/include/svx/frmsel.hxx
+++ b/include/svx/frmsel.hxx
@@ -22,6 +22,7 @@
#include <memory>
#include <vcl/ctrl.hxx>
+#include <vcl/customweld.hxx>
#include <vcl/bitmap.hxx>
#include <editeng/borderline.hxx>
#include <svx/framebordertype.hxx>
@@ -79,10 +80,16 @@ enum class FrameBorderState
};
-class SAL_WARN_UNUSED SVX_DLLPUBLIC FrameSelector : public Control
+namespace a11y
+{
+ class AccFrameSelector;
+}
+
+class SAL_WARN_UNUSED SVX_DLLPUBLIC FrameSelector : public weld::CustomWidgetController
{
public:
- FrameSelector(vcl::Window* pParent);
+ FrameSelector();
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
virtual ~FrameSelector() override;
/** Initializes the control, enables/disables frame borders according to flags. */
@@ -156,8 +163,9 @@ public:
// accessibility
- 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(); }
/** Returns the accessibility child object of the specified frame border (if enabled). */
css::uno::Reference< css::accessibility::XAccessible >
@@ -174,22 +182,20 @@ public:
/** Returns the bounding rectangle of the specified frame border (if enabled). */
tools::Rectangle GetClickBoundRect( FrameBorderType eBorder ) const;
-
protected:
virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
- virtual void KeyInput( const KeyEvent& rKEvt ) override;
+ virtual bool KeyInput( const KeyEvent& rKEvt ) override;
virtual void GetFocus() override;
virtual void LoseFocus() override;
- virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ virtual void StyleUpdated() override;
virtual void Resize() override;
- virtual Size GetOptimalSize() const override;
private:
+ rtl::Reference<a11y::AccFrameSelector> mxAccess; /// Pointer to accessibility object of the control.
std::unique_ptr< FrameSelectorImpl > mxImpl;
};
-
}
#endif
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 57bedf5b0635..693a905b342e 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -291,10 +291,11 @@ enum class InvertFlags
NONE = 0x0000,
Highlight = 0x0001,
N50 = 0x0002,
+ TrackFrame = 0x0004
};
namespace o3tl
{
- template<> struct typed_flags<InvertFlags> : is_typed_flags<InvertFlags, 0x0003> {};
+ template<> struct typed_flags<InvertFlags> : is_typed_flags<InvertFlags, 0x0007> {};
}
enum OutDevType { OUTDEV_DONTKNOW, OUTDEV_WINDOW, OUTDEV_PRINTER, OUTDEV_VIRDEV };
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 60923123c57a..89a4bed797de 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -366,7 +366,8 @@ protected:
public:
virtual void set_label(const OUString& rText) = 0;
- virtual void set_image(VirtualDevice& rDevice) = 0;
+ // pDevice, the image for the button, or nullptr to unset
+ virtual void set_image(VirtualDevice* pDevice) = 0;
virtual OUString get_label() const = 0;
void clicked() { signal_clicked(); }