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