Kaydet (Commit) 5744597e authored tarafından Caolán McNamara's avatar Caolán McNamara

weld SvxCharEffectsPage

Change-Id: I067b7a8c93e997fd554558f334a2968bf27965c6
Reviewed-on: https://gerrit.libreoffice.org/60147
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 2a73c9e0
...@@ -200,7 +200,7 @@ public: ...@@ -200,7 +200,7 @@ public:
// class SvxCharEffectsPage ---------------------------------------------- // class SvxCharEffectsPage ----------------------------------------------
class SvxCharEffectsPage : public SvxCharBasePage class SvxCharEffectsPage : public CharBasePage
{ {
friend class VclPtr<SvxCharEffectsPage>; friend class VclPtr<SvxCharEffectsPage>;
...@@ -210,43 +210,34 @@ private: ...@@ -210,43 +210,34 @@ private:
bool m_bNewFontColor; bool m_bNewFontColor;
bool m_bEnableNoneFontColor; bool m_bEnableNoneFontColor;
Color m_aOrigFontColor; Color m_aOrigFontColor;
VclPtr<FixedText> m_pFontColorFT; sal_uInt16 m_nHtmlMode;
VclPtr<SvxColorListBox> m_pFontColorLB; bool m_bUnderlineColorDisabled;
VclPtr<FixedText> m_pEffectsFT; std::unique_ptr<weld::Label> m_xFontColorFT;
VclPtr<ListBox> m_pEffectsLB; std::unique_ptr<ColorListBox> m_xFontColorLB;
std::unique_ptr<weld::Label> m_xEffectsFT;
VclPtr<FixedText> m_pReliefFT; std::unique_ptr<weld::ComboBoxText> m_xEffectsLB;
VclPtr<ListBox> m_pReliefLB; std::unique_ptr<weld::Label> m_xReliefFT;
std::unique_ptr<weld::ComboBoxText> m_xReliefLB;
VclPtr<TriStateBox> m_pOutlineBtn; std::unique_ptr<weld::CheckButton> m_xOutlineBtn;
VclPtr<TriStateBox> m_pShadowBtn; std::unique_ptr<weld::CheckButton> m_xShadowBtn;
VclPtr<TriStateBox> m_pBlinkingBtn; std::unique_ptr<weld::CheckButton> m_xBlinkingBtn;
VclPtr<TriStateBox> m_pHiddenBtn; std::unique_ptr<weld::CheckButton> m_xHiddenBtn;
std::unique_ptr<weld::ComboBoxText> m_xOverlineLB;
VclPtr<ListBox> m_pOverlineLB; std::unique_ptr<weld::Label> m_xOverlineColorFT;
VclPtr<FixedText> m_pOverlineColorFT; std::unique_ptr<ColorListBox> m_xOverlineColorLB;
VclPtr<SvxColorListBox> m_pOverlineColorLB; std::unique_ptr<weld::ComboBoxText> m_xStrikeoutLB;
std::unique_ptr<weld::ComboBoxText> m_xUnderlineLB;
VclPtr<ListBox> m_pStrikeoutLB; std::unique_ptr<weld::Label> m_xUnderlineColorFT;
std::unique_ptr<ColorListBox> m_xUnderlineColorLB;
VclPtr<ListBox> m_pUnderlineLB; std::unique_ptr<weld::CheckButton> m_xIndividualWordsBtn;
VclPtr<FixedText> m_pUnderlineColorFT; std::unique_ptr<weld::Label> m_xEmphasisFT;
VclPtr<SvxColorListBox> m_pUnderlineColorLB; std::unique_ptr<weld::ComboBoxText> m_xEmphasisLB;
std::unique_ptr<weld::Label> m_xPositionFT;
VclPtr<CheckBox> m_pIndividualWordsBtn; std::unique_ptr<weld::ComboBoxText> m_xPositionLB;
std::unique_ptr<weld::Label> m_xA11yWarningFT;
VclPtr<FixedText> m_pEmphasisFT;
VclPtr<ListBox> m_pEmphasisLB; SvxCharEffectsPage(TabPageParent pParent, const SfxItemSet& rSet);
VclPtr<FixedText> m_pPositionFT;
VclPtr<ListBox> m_pPositionLB;
VclPtr<FixedText> m_pA11yWarningFT;
sal_uInt16 m_nHtmlMode;
SvxCharEffectsPage( vcl::Window* pParent, const SfxItemSet& rSet );
void Initialize(); void Initialize();
void UpdatePreview_Impl(); void UpdatePreview_Impl();
...@@ -256,12 +247,12 @@ private: ...@@ -256,12 +247,12 @@ private:
Color GetPreviewFontColor(const Color& rColor) const; Color GetPreviewFontColor(const Color& rColor) const;
void EnableNoneFontColor(); void EnableNoneFontColor();
void SelectHdl_Impl(ListBox*); void SelectHdl_Impl(weld::ComboBoxText*);
DECL_LINK(SelectListBoxHdl_Impl, ListBox&, void); DECL_LINK(SelectListBoxHdl_Impl, weld::ComboBoxText&, void);
DECL_LINK(CbClickHdl_Impl, Button*, void); DECL_LINK(CbClickHdl_Impl, weld::ToggleButton&, void);
DECL_LINK(TristClickHdl_Impl, Button*, void); DECL_LINK(TristClickHdl_Impl, weld::ToggleButton&, void);
DECL_LINK(UpdatePreview_Impl, ListBox&, void); DECL_LINK(UpdatePreview_Impl, weld::ComboBoxText&, void);
DECL_LINK(ColorBoxSelectHdl_Impl, SvxColorListBox&, void); DECL_LINK(ColorBoxSelectHdl_Impl, ColorListBox&, void);
public: public:
virtual ~SvxCharEffectsPage() override; virtual ~SvxCharEffectsPage() override;
......
This diff is collapsed.
This diff is collapsed.
...@@ -101,6 +101,8 @@ private: ...@@ -101,6 +101,8 @@ private:
Color m_aAutoDisplayColor; Color m_aAutoDisplayColor;
Color m_aSaveColor; Color m_aSaveColor;
NamedColor m_aSelectedColor; NamedColor m_aSelectedColor;
sal_uInt16 m_nSlotId;
bool m_bShowNoneButton;
bool m_bInterimBuilder; bool m_bInterimBuilder;
std::shared_ptr<PaletteManager> m_xPaletteManager; std::shared_ptr<PaletteManager> m_xPaletteManager;
BorderColorStatus m_aBorderColorStatus; BorderColorStatus m_aBorderColorStatus;
...@@ -118,6 +120,8 @@ public: ...@@ -118,6 +120,8 @@ public:
m_aSelectedLink = rLink; m_aSelectedLink = rLink;
} }
void SetSlotId(sal_uInt16 nSlotId, bool bShowNoneButton = false);
Color const & GetSelectEntryColor() const { return m_aSelectedColor.first; } Color const & GetSelectEntryColor() const { return m_aSelectedColor.first; }
NamedColor const & GetSelectedEntry() const { return m_aSelectedColor; } NamedColor const & GetSelectedEntry() const { return m_aSelectedColor; }
...@@ -133,6 +137,7 @@ public: ...@@ -133,6 +137,7 @@ public:
bool IsValueChangedFromSaved() const { return m_aSaveColor != GetSelectEntryColor(); } bool IsValueChangedFromSaved() const { return m_aSaveColor != GetSelectEntryColor(); }
void set_sensitive(bool sensitive) { m_xButton->set_sensitive(sensitive); } void set_sensitive(bool sensitive) { m_xButton->set_sensitive(sensitive); }
void hide() { m_xButton->hide(); }
}; };
/** A wrapper for SvxColorListBox. */ /** A wrapper for SvxColorListBox. */
......
...@@ -152,6 +152,7 @@ public: ...@@ -152,6 +152,7 @@ public:
ColorSelectFunction const& rColorSelectFunction); ColorSelectFunction const& rColorSelectFunction);
weld::Container* GetWidget() { return mxTopLevel.get(); } weld::Container* GetWidget() { return mxTopLevel.get(); }
virtual ~ColorWindow() override; virtual ~ColorWindow() override;
void ShowNoneButton();
void SetNoSelection(); void SetNoSelection();
bool IsNoSelection() const; bool IsNoSelection() const;
void SelectEntry(const NamedColor& rColor); void SelectEntry(const NamedColor& rColor);
......
...@@ -105,12 +105,13 @@ public: ...@@ -105,12 +105,13 @@ public:
virtual void StyleUpdated() override; virtual void StyleUpdated() override;
// for reasons of efficiency not const
SvxFont& GetFont(); SvxFont& GetFont();
const SvxFont& GetFont() const; const SvxFont& GetFont() const;
SvxFont& GetCJKFont(); SvxFont& GetCJKFont();
SvxFont& GetCTLFont(); SvxFont& GetCTLFont();
void SetBackColor( const Color& rColor ); void SetBackColor( const Color& rColor );
void SetTextLineColor(const Color& rColor);
void SetOverlineColor(const Color& rColor);
void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override; void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override;
bool IsTwoLines() const; bool IsTwoLines() const;
......
...@@ -158,6 +158,8 @@ class FontPrevWin_Impl ...@@ -158,6 +158,8 @@ class FontPrevWin_Impl
OUString maScriptText; OUString maScriptText;
std::unique_ptr<Color> mpColor; std::unique_ptr<Color> mpColor;
std::unique_ptr<Color> mpBackColor; std::unique_ptr<Color> mpBackColor;
std::unique_ptr<Color> mpTextLineColor;
std::unique_ptr<Color> mpOverlineColor;
long mnAscent; long mnAscent;
sal_Unicode mcStartBracket; sal_Unicode mcStartBracket;
sal_Unicode mcEndBracket; sal_Unicode mcEndBracket;
...@@ -1545,9 +1547,21 @@ void FontPrevWindow::SetBackColor(const Color &rColor) ...@@ -1545,9 +1547,21 @@ void FontPrevWindow::SetBackColor(const Color &rColor)
Invalidate(); Invalidate();
} }
void FontPrevWindow::SetTextLineColor(const Color &rColor)
{
pImpl->mpTextLineColor.reset(new Color(rColor));
Invalidate();
}
void FontPrevWindow::SetOverlineColor(const Color &rColor)
{
pImpl->mpOverlineColor.reset(new Color(rColor));
Invalidate();
}
void FontPrevWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) void FontPrevWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
{ {
rRenderContext.Push(PushFlags::MAPMODE); rRenderContext.Push(PushFlags::ALL);
rRenderContext.SetMapMode(MapMode(MapUnit::MapTwip)); rRenderContext.SetMapMode(MapMode(MapUnit::MapTwip));
ApplySettings(rRenderContext); ApplySettings(rRenderContext);
...@@ -1668,6 +1682,16 @@ void FontPrevWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rect ...@@ -1668,6 +1682,16 @@ void FontPrevWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rect
rRenderContext.SetFillColor(aFillCol); rRenderContext.SetFillColor(aFillCol);
} }
if (pImpl->mpTextLineColor)
{
rRenderContext.SetTextLineColor(*pImpl->mpTextLineColor);
}
if (pImpl->mpOverlineColor)
{
rRenderContext.SetOverlineColor(*pImpl->mpOverlineColor);
}
long nStdAscent = pImpl->mnAscent; long nStdAscent = pImpl->mnAscent;
nY += nStdAscent; nY += nStdAscent;
......
...@@ -1477,6 +1477,11 @@ void SvxColorWindow::ShowNoneButton() ...@@ -1477,6 +1477,11 @@ void SvxColorWindow::ShowNoneButton()
mpButtonNoneColor->Show(); mpButtonNoneColor->Show();
} }
void ColorWindow::ShowNoneButton()
{
mxButtonNoneColor->show();
}
SvxColorWindow::~SvxColorWindow() SvxColorWindow::~SvxColorWindow()
{ {
disposeOnce(); disposeOnce();
...@@ -3601,6 +3606,16 @@ void SvxColorListBox::SetSlotId(sal_uInt16 nSlotId, bool bShowNoneButton) ...@@ -3601,6 +3606,16 @@ void SvxColorListBox::SetSlotId(sal_uInt16 nSlotId, bool bShowNoneButton)
createColorWindow(); createColorWindow();
} }
void ColorListBox::SetSlotId(sal_uInt16 nSlotId, bool bShowNoneButton)
{
m_nSlotId = nSlotId;
m_bShowNoneButton = bShowNoneButton;
m_xColorWindow.reset();
m_aSelectedColor = bShowNoneButton ? GetNoneColor() : GetAutoColor(m_nSlotId);
ShowPreview(m_aSelectedColor);
createColorWindow();
}
//to avoid the box resizing every time the color is changed to //to avoid the box resizing every time the color is changed to
//the optimal size of the individual color, get the longest //the optimal size of the individual color, get the longest
//standard color and stick with that as the size for all //standard color and stick with that as the size for all
...@@ -3754,9 +3769,11 @@ ColorListBox::ColorListBox(std::unique_ptr<weld::MenuButton> pControl, weld::Win ...@@ -3754,9 +3769,11 @@ ColorListBox::ColorListBox(std::unique_ptr<weld::MenuButton> pControl, weld::Win
, m_pTopLevel(pTopLevel) , m_pTopLevel(pTopLevel)
, m_aColorWrapper(this) , m_aColorWrapper(this)
, m_aAutoDisplayColor(Application::GetSettings().GetStyleSettings().GetDialogColor()) , m_aAutoDisplayColor(Application::GetSettings().GetStyleSettings().GetDialogColor())
, m_nSlotId(0)
, m_bShowNoneButton(false)
, m_bInterimBuilder(bInterimBuilder) , m_bInterimBuilder(bInterimBuilder)
{ {
m_aSelectedColor = GetAutoColor(0); m_aSelectedColor = GetAutoColor(m_nSlotId);
LockWidthRequest(); LockWidthRequest();
ShowPreview(m_aSelectedColor); ShowPreview(m_aSelectedColor);
} }
...@@ -3783,7 +3800,7 @@ void ColorListBox::createColorWindow() ...@@ -3783,7 +3800,7 @@ void ColorListBox::createColorWindow()
m_xColorWindow.reset(new ColorWindow( m_xColorWindow.reset(new ColorWindow(
m_xPaletteManager, m_xPaletteManager,
m_aBorderColorStatus, m_aBorderColorStatus,
0, // slotID m_nSlotId,
xFrame, xFrame,
m_pTopLevel, m_pTopLevel,
m_xButton.get(), m_xButton.get(),
...@@ -3792,6 +3809,8 @@ void ColorListBox::createColorWindow() ...@@ -3792,6 +3809,8 @@ void ColorListBox::createColorWindow()
SetNoSelection(); SetNoSelection();
m_xButton->set_popover(m_xColorWindow->GetWidget()); m_xButton->set_popover(m_xColorWindow->GetWidget());
if (m_bShowNoneButton)
m_xColorWindow->ShowNoneButton();
m_xColorWindow->SelectEntry(m_aSelectedColor); m_xColorWindow->SelectEntry(m_aSelectedColor);
} }
...@@ -3841,10 +3860,20 @@ void ColorListBox::ShowPreview(const NamedColor &rColor) ...@@ -3841,10 +3860,20 @@ void ColorListBox::ShowPreview(const NamedColor &rColor)
ScopedVclPtrInstance<VirtualDevice> xDevice; ScopedVclPtrInstance<VirtualDevice> xDevice;
xDevice->SetOutputSize(aImageSize); xDevice->SetOutputSize(aImageSize);
const tools::Rectangle aRect(Point(0, 0), aImageSize); const tools::Rectangle aRect(Point(0, 0), aImageSize);
if (rColor.first == COL_AUTO) if (m_bShowNoneButton && rColor.first == COL_NONE_COLOR)
xDevice->SetFillColor(m_aAutoDisplayColor); {
const Color aW(COL_WHITE);
const Color aG(0xef, 0xef, 0xef);
xDevice->DrawCheckered(aRect.TopLeft(), aRect.GetSize(), 8, aW, aG);
xDevice->SetFillColor();
}
else else
xDevice->SetFillColor(rColor.first); {
if (rColor.first == COL_AUTO)
xDevice->SetFillColor(m_aAutoDisplayColor);
else
xDevice->SetFillColor(rColor.first);
}
xDevice->SetLineColor(rStyleSettings.GetDisableColor()); xDevice->SetLineColor(rStyleSettings.GetDisableColor());
xDevice->DrawRect(aRect); xDevice->DrawRect(aRect);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment