weld FontFeaturesDialog
Change-Id: I67ab7388593aceb00b660e4d40904a4eef247620 Reviewed-on: https://gerrit.libreoffice.org/60148 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
parent
97b6fd8e9e
commit
842c71a1fa
11 changed files with 202 additions and 129 deletions
|
@ -53,6 +53,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
|
|||
cui/uiconfig/ui/embossdialog \
|
||||
cui/uiconfig/ui/eventassigndialog \
|
||||
cui/uiconfig/ui/eventassignpage \
|
||||
cui/uiconfig/ui/fontfragment \
|
||||
cui/uiconfig/ui/formatnumberdialog \
|
||||
cui/uiconfig/ui/fmsearchdialog \
|
||||
cui/uiconfig/ui/gradientpage \
|
||||
|
|
|
@ -16,28 +16,23 @@ using namespace css;
|
|||
|
||||
namespace cui
|
||||
{
|
||||
FontFeaturesDialog::FontFeaturesDialog(vcl::Window* pParent, OUString const& rFontName)
|
||||
: ModalDialog(pParent, "FontFeaturesDialog", "cui/ui/fontfeaturesdialog.ui")
|
||||
FontFeaturesDialog::FontFeaturesDialog(weld::Window* pParent, OUString const& rFontName)
|
||||
: GenericDialogController(pParent, "cui/ui/fontfeaturesdialog.ui", "FontFeaturesDialog")
|
||||
, m_sFontName(rFontName)
|
||||
, m_xContentWindow(m_xBuilder->weld_scrolled_window("contentWindow"))
|
||||
, m_xContentGrid(m_xBuilder->weld_container("contentGrid"))
|
||||
, m_xPreviewWindow(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreviewWindow))
|
||||
{
|
||||
get(m_pContentGrid, "contentGrid");
|
||||
get(m_pPreviewWindow, "preview");
|
||||
initialize();
|
||||
}
|
||||
|
||||
FontFeaturesDialog::~FontFeaturesDialog() { disposeOnce(); }
|
||||
FontFeaturesDialog::~FontFeaturesDialog() {}
|
||||
|
||||
VclPtr<ComboBox> makeEnumComboBox(vcl::Window* pParent,
|
||||
vcl::font::FeatureDefinition const& rFeatureDefinition)
|
||||
void makeEnumComboBox(weld::ComboBoxText& rNameBox,
|
||||
vcl::font::FeatureDefinition const& rFeatureDefinition)
|
||||
{
|
||||
VclPtr<ComboBox> aNameBox(
|
||||
VclPtr<ComboBox>::Create(pParent, WB_TABSTOP | WB_DROPDOWN | WB_AUTOHSCROLL));
|
||||
for (vcl::font::FeatureParameter const& rParameter : rFeatureDefinition.getEnumParameters())
|
||||
{
|
||||
aNameBox->InsertEntry(rParameter.getDescription());
|
||||
}
|
||||
aNameBox->EnableAutoSize(true);
|
||||
return aNameBox;
|
||||
rNameBox.append_text(rParameter.getDescription());
|
||||
}
|
||||
|
||||
void FontFeaturesDialog::initialize()
|
||||
|
@ -88,7 +83,7 @@ void FontFeaturesDialog::fillGrid(std::vector<vcl::font::Feature> const& rFontFe
|
|||
if (!aDefinition)
|
||||
aDefinition = { nFontFeatureCode, nullptr };
|
||||
|
||||
m_aFeatureItems.emplace_back();
|
||||
m_aFeatureItems.emplace_back(m_xContentGrid.get());
|
||||
|
||||
sal_uInt32 nValue = 0;
|
||||
if (aExistingFeatures.find(nFontFeatureCode) != aExistingFeatures.end())
|
||||
|
@ -99,63 +94,47 @@ void FontFeaturesDialog::fillGrid(std::vector<vcl::font::Feature> const& rFontFe
|
|||
|
||||
sal_Int32 nGridPositionX = (i % 2) * 2;
|
||||
sal_Int32 nGridPositionY = i / 2;
|
||||
aCurrentItem.m_xContainer->set_grid_left_attach(nGridPositionX);
|
||||
aCurrentItem.m_xContainer->set_grid_top_attach(nGridPositionY);
|
||||
|
||||
Link<ComboBox&, void> aComboBoxSelectHandler
|
||||
Link<weld::ComboBoxText&, void> aComboBoxSelectHandler
|
||||
= LINK(this, FontFeaturesDialog, ComboBoxSelectedHdl);
|
||||
Link<CheckBox&, void> aCheckBoxToggleHandler
|
||||
Link<weld::ToggleButton&, void> aCheckBoxToggleHandler
|
||||
= LINK(this, FontFeaturesDialog, CheckBoxToggledHdl);
|
||||
|
||||
if (aDefinition.getType() == vcl::font::FeatureParameterType::ENUM)
|
||||
{
|
||||
aCurrentItem.m_pText
|
||||
= VclPtr<FixedText>::Create(m_pContentGrid, WB_LEFT | WB_VCENTER | WB_3DLOOK);
|
||||
aCurrentItem.m_pText->set_grid_left_attach(nGridPositionX);
|
||||
aCurrentItem.m_pText->set_grid_top_attach(nGridPositionY);
|
||||
aCurrentItem.m_pText->set_margin_left(6);
|
||||
aCurrentItem.m_pText->set_margin_right(6);
|
||||
aCurrentItem.m_pText->set_margin_top(3);
|
||||
aCurrentItem.m_pText->set_margin_bottom(3);
|
||||
aCurrentItem.m_pText->SetText(aDefinition.getDescription());
|
||||
aCurrentItem.m_pText->Show();
|
||||
aCurrentItem.m_xText->set_label(aDefinition.getDescription());
|
||||
aCurrentItem.m_xText->show();
|
||||
|
||||
aCurrentItem.m_pCombo = makeEnumComboBox(m_pContentGrid, aDefinition);
|
||||
makeEnumComboBox(*aCurrentItem.m_xCombo, aDefinition);
|
||||
|
||||
aCurrentItem.m_pCombo->SelectEntryPos(nValue);
|
||||
aCurrentItem.m_pCombo->set_grid_left_attach(nGridPositionX + 1);
|
||||
aCurrentItem.m_pCombo->set_grid_top_attach(nGridPositionY);
|
||||
aCurrentItem.m_pCombo->set_margin_left(6);
|
||||
aCurrentItem.m_pCombo->set_margin_right(6);
|
||||
aCurrentItem.m_pCombo->set_margin_top(3);
|
||||
aCurrentItem.m_pCombo->set_margin_bottom(3);
|
||||
aCurrentItem.m_pCombo->SetSelectHdl(aComboBoxSelectHandler);
|
||||
aCurrentItem.m_pCombo->Show();
|
||||
aCurrentItem.m_xCombo->set_active(nValue);
|
||||
aCurrentItem.m_xCombo->connect_changed(aComboBoxSelectHandler);
|
||||
aCurrentItem.m_xCombo->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
aCurrentItem.m_pCheck = VclPtr<CheckBox>::Create(
|
||||
m_pContentGrid, WB_CLIPCHILDREN | WB_LEFT | WB_VCENTER | WB_3DLOOK);
|
||||
aCurrentItem.m_pCheck->set_grid_left_attach(nGridPositionX);
|
||||
aCurrentItem.m_pCheck->set_grid_top_attach(nGridPositionY);
|
||||
aCurrentItem.m_pCheck->set_grid_width(2);
|
||||
aCurrentItem.m_pCheck->set_margin_left(6);
|
||||
aCurrentItem.m_pCheck->set_margin_right(6);
|
||||
aCurrentItem.m_pCheck->set_margin_top(3);
|
||||
aCurrentItem.m_pCheck->set_margin_bottom(3);
|
||||
aCurrentItem.m_pCheck->Check(nValue > 0);
|
||||
aCurrentItem.m_pCheck->SetText(aDefinition.getDescription());
|
||||
aCurrentItem.m_pCheck->SetToggleHdl(aCheckBoxToggleHandler);
|
||||
aCurrentItem.m_pCheck->Show();
|
||||
aCurrentItem.m_xCheck->set_active(nValue > 0);
|
||||
aCurrentItem.m_xCheck->set_label(aDefinition.getDescription());
|
||||
aCurrentItem.m_xCheck->connect_toggled(aCheckBoxToggleHandler);
|
||||
aCurrentItem.m_xCheck->show();
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
Size aSize(m_xContentWindow->get_preferred_size());
|
||||
Size aMaxSize(std::min<int>(aSize.Width(), m_xContentGrid->get_approximate_digit_width() * 100),
|
||||
std::min<int>(aSize.Height(), m_xContentGrid->get_text_height() * 20));
|
||||
m_xContentWindow->set_size_request(aMaxSize.Width(), aMaxSize.Height());
|
||||
}
|
||||
|
||||
void FontFeaturesDialog::updateFontPreview()
|
||||
{
|
||||
vcl::Font rPreviewFont = m_pPreviewWindow->GetFont();
|
||||
vcl::Font rPreviewFontCJK = m_pPreviewWindow->GetCJKFont();
|
||||
vcl::Font rPreviewFontCTL = m_pPreviewWindow->GetCTLFont();
|
||||
vcl::Font rPreviewFont = m_aPreviewWindow.GetFont();
|
||||
vcl::Font rPreviewFontCJK = m_aPreviewWindow.GetCJKFont();
|
||||
vcl::Font rPreviewFontCTL = m_aPreviewWindow.GetCTLFont();
|
||||
|
||||
OUString sNewFontName = createFontNameWithFeatures();
|
||||
|
||||
|
@ -163,25 +142,18 @@ void FontFeaturesDialog::updateFontPreview()
|
|||
rPreviewFontCJK.SetFamilyName(sNewFontName);
|
||||
rPreviewFontCTL.SetFamilyName(sNewFontName);
|
||||
|
||||
m_pPreviewWindow->SetFont(rPreviewFont, rPreviewFontCJK, rPreviewFontCTL);
|
||||
m_aPreviewWindow.SetFont(rPreviewFont, rPreviewFontCJK, rPreviewFontCTL);
|
||||
}
|
||||
|
||||
void FontFeaturesDialog::dispose()
|
||||
IMPL_LINK_NOARG(FontFeaturesDialog, CheckBoxToggledHdl, weld::ToggleButton&, void)
|
||||
{
|
||||
m_pContentGrid.clear();
|
||||
m_pPreviewWindow.clear();
|
||||
for (FontFeatureItem& rItem : m_aFeatureItems)
|
||||
{
|
||||
rItem.m_pText.disposeAndClear();
|
||||
rItem.m_pCombo.disposeAndClear();
|
||||
rItem.m_pCheck.disposeAndClear();
|
||||
}
|
||||
ModalDialog::dispose();
|
||||
updateFontPreview();
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(FontFeaturesDialog, CheckBoxToggledHdl, CheckBox&, void) { updateFontPreview(); }
|
||||
|
||||
IMPL_LINK_NOARG(FontFeaturesDialog, ComboBoxSelectedHdl, ComboBox&, void) { updateFontPreview(); }
|
||||
IMPL_LINK_NOARG(FontFeaturesDialog, ComboBoxSelectedHdl, weld::ComboBoxText&, void)
|
||||
{
|
||||
updateFontPreview();
|
||||
}
|
||||
|
||||
OUString FontFeaturesDialog::createFontNameWithFeatures()
|
||||
{
|
||||
|
@ -191,9 +163,9 @@ OUString FontFeaturesDialog::createFontNameWithFeatures()
|
|||
|
||||
for (FontFeatureItem& rItem : m_aFeatureItems)
|
||||
{
|
||||
if (rItem.m_pCheck)
|
||||
if (rItem.m_xCheck->get_visible())
|
||||
{
|
||||
if (rItem.m_pCheck->IsChecked())
|
||||
if (rItem.m_xCheck->get_active())
|
||||
{
|
||||
if (!bFirst)
|
||||
sNameSuffix.append(OUString(vcl::font::FeatureSeparator));
|
||||
|
@ -203,9 +175,9 @@ OUString FontFeaturesDialog::createFontNameWithFeatures()
|
|||
sNameSuffix.append(vcl::font::featureCodeAsString(rItem.m_aFeatureCode));
|
||||
}
|
||||
}
|
||||
else if (rItem.m_pCombo && rItem.m_pText)
|
||||
else if (rItem.m_xCombo->get_visible() && rItem.m_xText->get_visible())
|
||||
{
|
||||
sal_uInt32 nSelection = rItem.m_pCombo->GetSelectedEntryPos();
|
||||
int nSelection = rItem.m_xCombo->get_active();
|
||||
if (nSelection > 0)
|
||||
{
|
||||
if (!bFirst)
|
||||
|
@ -225,9 +197,9 @@ OUString FontFeaturesDialog::createFontNameWithFeatures()
|
|||
return sResultFontName;
|
||||
}
|
||||
|
||||
short FontFeaturesDialog::Execute()
|
||||
short FontFeaturesDialog::execute()
|
||||
{
|
||||
short nResult = ModalDialog::Execute();
|
||||
short nResult = m_xDialog->run();
|
||||
if (nResult == RET_OK)
|
||||
{
|
||||
m_sResultFontName = createFontNameWithFeatures();
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#ifndef INCLUDED_CUI_SOURCE_INC_FONTFEATURESDIALOG_HXX
|
||||
#define INCLUDED_CUI_SOURCE_INC_FONTFEATURESDIALOG_HXX
|
||||
|
||||
#include <vcl/layout.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/weld.hxx>
|
||||
#include <vcl/font/Feature.hxx>
|
||||
#include <svx/fntctrl.hxx>
|
||||
#include "chardlg.hxx"
|
||||
|
@ -21,40 +22,48 @@ namespace cui
|
|||
{
|
||||
struct FontFeatureItem
|
||||
{
|
||||
FontFeatureItem()
|
||||
FontFeatureItem(weld::Widget* pParent)
|
||||
: m_aFeatureCode(0)
|
||||
, m_xBuilder(Application::CreateBuilder(pParent, "cui/ui/fontfragment.ui"))
|
||||
, m_xContainer(m_xBuilder->weld_widget("fontentry"))
|
||||
, m_xText(m_xBuilder->weld_label("label"))
|
||||
, m_xCombo(m_xBuilder->weld_combo_box_text("combo"))
|
||||
, m_xCheck(m_xBuilder->weld_check_button("check"))
|
||||
{
|
||||
}
|
||||
|
||||
sal_uInt32 m_aFeatureCode;
|
||||
VclPtr<Control> m_pText;
|
||||
VclPtr<ComboBox> m_pCombo;
|
||||
VclPtr<CheckBox> m_pCheck;
|
||||
std::unique_ptr<weld::Builder> m_xBuilder;
|
||||
std::unique_ptr<weld::Widget> m_xContainer;
|
||||
std::unique_ptr<weld::Label> m_xText;
|
||||
std::unique_ptr<weld::ComboBoxText> m_xCombo;
|
||||
std::unique_ptr<weld::CheckButton> m_xCheck;
|
||||
};
|
||||
|
||||
class FontFeaturesDialog : public ModalDialog
|
||||
class FontFeaturesDialog : public weld::GenericDialogController
|
||||
{
|
||||
private:
|
||||
VclPtr<VclGrid> m_pContentGrid;
|
||||
VclPtr<SvxFontPrevWindow> m_pPreviewWindow;
|
||||
|
||||
std::vector<FontFeatureItem> m_aFeatureItems;
|
||||
OUString m_sFontName;
|
||||
OUString m_sResultFontName;
|
||||
|
||||
FontPrevWindow m_aPreviewWindow;
|
||||
std::unique_ptr<weld::ScrolledWindow> m_xContentWindow;
|
||||
std::unique_ptr<weld::Container> m_xContentGrid;
|
||||
std::unique_ptr<weld::CustomWeld> m_xPreviewWindow;
|
||||
|
||||
void initialize();
|
||||
OUString createFontNameWithFeatures();
|
||||
|
||||
void fillGrid(std::vector<vcl::font::Feature> const& rFontFeatures);
|
||||
|
||||
DECL_LINK(ComboBoxSelectedHdl, ComboBox&, void);
|
||||
DECL_LINK(CheckBoxToggledHdl, CheckBox&, void);
|
||||
DECL_LINK(ComboBoxSelectedHdl, weld::ComboBoxText&, void);
|
||||
DECL_LINK(CheckBoxToggledHdl, weld::ToggleButton&, void);
|
||||
|
||||
public:
|
||||
FontFeaturesDialog(vcl::Window* pParent, OUString const& rFontName);
|
||||
FontFeaturesDialog(weld::Window* pParent, OUString const& rFontName);
|
||||
~FontFeaturesDialog() override;
|
||||
void dispose() override;
|
||||
short Execute() override;
|
||||
short execute();
|
||||
|
||||
OUString const& getResultFontName() { return m_sResultFontName; }
|
||||
|
||||
|
|
|
@ -1226,10 +1226,10 @@ IMPL_LINK(SvxCharNamePage, FontFeatureButtonClicked, Button*, pButton, void )
|
|||
|
||||
if (!sFontName.isEmpty() && pNameBox)
|
||||
{
|
||||
ScopedVclPtrInstance<cui::FontFeaturesDialog> pDialog(this, sFontName);
|
||||
if (pDialog->Execute() == RET_OK)
|
||||
cui::FontFeaturesDialog aDialog(GetDialogFrameWeld(), sFontName);
|
||||
if (aDialog.execute() == RET_OK)
|
||||
{
|
||||
pNameBox->SetText(pDialog->getResultFontName());
|
||||
pNameBox->SetText(aDialog.getResultFontName());
|
||||
UpdatePreview_Impl();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
<!-- Generated with glade 3.22.1 -->
|
||||
<interface domain="cui">
|
||||
<requires lib="gtk+" version="3.18"/>
|
||||
<requires lib="LibreOffice" version="1.0"/>
|
||||
<object class="GtkDialog" id="FontFeaturesDialog">
|
||||
<property name="width_request">-1</property>
|
||||
<property name="height_request">-1</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">6</property>
|
||||
<property name="title" translatable="yes" context="fontfeaturesdialog|FontFeaturesDialog">Font Features</property>
|
||||
|
@ -82,10 +83,12 @@
|
|||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<object class="GtkScrolledWindow" id="contentWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<property name="propagate_natural_width">True</property>
|
||||
<property name="propagate_natural_height">True</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<property name="visible">True</property>
|
||||
|
@ -94,6 +97,9 @@
|
|||
<object class="GtkGrid" id="contentGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
@ -141,12 +147,27 @@
|
|||
<property name="left_padding">12</property>
|
||||
<property name="right_padding">12</property>
|
||||
<child>
|
||||
<object class="svxlo-SvxFontPrevWindow" id="preview:border">
|
||||
<object class="GtkScrolledWindow" id="previewwin">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="preview:border-atkobject">
|
||||
<property name="AtkObject::accessible-name" translatable="yes" context="fontfeaturesdialog|preview-atkobject">Preview</property>
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
<property name="vscrollbar_policy">never</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkDrawingArea" id="preview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="preview-atkobject">
|
||||
<property name="AtkObject::accessible-name" translatable="yes" context="fontfeaturesdialog|preview-atkobject">Preview</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
50
cui/uiconfig/ui/fontfragment.ui
Normal file
50
cui/uiconfig/ui/fontfragment.ui
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.22.1 -->
|
||||
<interface domain="sw">
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkGrid" id="fontentry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="column_spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">combo</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="check">
|
||||
<property name="label">placeholder</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="combo">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
|
@ -90,10 +90,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC FontPrevWindow : public weld::CustomWidgetCo
|
|||
{
|
||||
private:
|
||||
std::unique_ptr<FontPrevWin_Impl> pImpl;
|
||||
bool mbResetForeground : 1;
|
||||
bool mbResetBackground : 1;
|
||||
|
||||
SVX_DLLPRIVATE void ResetSettings();
|
||||
SVX_DLLPRIVATE void ApplySettings(vcl::RenderContext& rRenderContext);
|
||||
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
|
||||
SVX_DLLPRIVATE static void SetFontSize(const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont);
|
||||
|
@ -103,10 +100,9 @@ public:
|
|||
FontPrevWindow();
|
||||
virtual ~FontPrevWindow() override;
|
||||
|
||||
virtual void StyleUpdated() override;
|
||||
|
||||
SvxFont& GetFont();
|
||||
const SvxFont& GetFont() const;
|
||||
void SetFont( const SvxFont& rNormalFont, const SvxFont& rCJKFont, const SvxFont& rCTLFont );
|
||||
SvxFont& GetCJKFont();
|
||||
SvxFont& GetCTLFont();
|
||||
void SetBackColor( const Color& rColor );
|
||||
|
|
|
@ -138,6 +138,8 @@ public:
|
|||
virtual void vadjustment_set_value(int value) = 0;
|
||||
virtual int vadjustment_get_upper() const = 0;
|
||||
virtual void vadjustment_set_upper(int upper) = 0;
|
||||
virtual void set_hpolicy(VclPolicyType eHPolicy) = 0;
|
||||
virtual VclPolicyType get_hpolicy() const = 0;
|
||||
virtual void set_vpolicy(VclPolicyType eVPolicy) = 0;
|
||||
virtual VclPolicyType get_vpolicy() const = 0;
|
||||
void connect_vadjustment_changed(const Link<ScrolledWindow&, void>& rLink)
|
||||
|
|
|
@ -1443,30 +1443,15 @@ Size SvxFontPrevWindow::GetOptimalSize() const
|
|||
return getPreviewStripSize(*this);
|
||||
}
|
||||
|
||||
void FontPrevWindow::ResetSettings()
|
||||
{
|
||||
mbResetForeground = true;
|
||||
mbResetBackground = true;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
void FontPrevWindow::ApplySettings(vcl::RenderContext& rRenderContext)
|
||||
{
|
||||
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
|
||||
|
||||
if (mbResetForeground)
|
||||
{
|
||||
svtools::ColorConfig aColorConfig;
|
||||
Color aTextColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
|
||||
rRenderContext.SetTextColor(aTextColor);
|
||||
mbResetForeground = false;
|
||||
}
|
||||
svtools::ColorConfig aColorConfig;
|
||||
Color aTextColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
|
||||
rRenderContext.SetTextColor(aTextColor);
|
||||
|
||||
if (mbResetBackground)
|
||||
{
|
||||
rRenderContext.SetBackground(rStyleSettings.GetWindowColor());
|
||||
mbResetBackground = false;
|
||||
}
|
||||
rRenderContext.SetBackground(rStyleSettings.GetWindowColor());
|
||||
}
|
||||
|
||||
void FontPrevWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea)
|
||||
|
@ -1490,12 +1475,10 @@ void FontPrevWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea)
|
|||
initFont(pImpl->maCJKFont);
|
||||
initFont(pImpl->maCTLFont);
|
||||
|
||||
ResetSettings();
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
FontPrevWindow::FontPrevWindow()
|
||||
: mbResetForeground(true)
|
||||
, mbResetBackground(true)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1513,12 +1496,6 @@ SvxFont& FontPrevWindow::GetCJKFont()
|
|||
return pImpl->maCJKFont;
|
||||
}
|
||||
|
||||
void FontPrevWindow::StyleUpdated()
|
||||
{
|
||||
ResetSettings();
|
||||
CustomWidgetController::StyleUpdated();
|
||||
}
|
||||
|
||||
SvxFont& FontPrevWindow::GetFont()
|
||||
{
|
||||
pImpl->Invalidate100PercentFontWidth(); // because the user might change the size
|
||||
|
@ -1541,6 +1518,16 @@ void FontPrevWindow::SetFontNameAsPreviewText()
|
|||
pImpl->mbUseFontNameAsText = true;
|
||||
}
|
||||
|
||||
void FontPrevWindow::SetFont( const SvxFont& rNormalOutFont, const SvxFont& rCJKOutFont, const SvxFont& rCTLFont )
|
||||
{
|
||||
setFont(rNormalOutFont, pImpl->maFont);
|
||||
setFont(rCJKOutFont, pImpl->maCJKFont);
|
||||
setFont(rCTLFont, pImpl->maCTLFont);
|
||||
|
||||
pImpl->Invalidate100PercentFontWidth();
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
void FontPrevWindow::SetBackColor(const Color &rColor)
|
||||
{
|
||||
pImpl->mpBackColor.reset(new Color(rColor));
|
||||
|
|
|
@ -841,6 +841,27 @@ public:
|
|||
rVertScrollBar.SetRangeMax(upper);
|
||||
}
|
||||
|
||||
virtual void set_hpolicy(VclPolicyType eHPolicy) override
|
||||
{
|
||||
WinBits nWinBits = m_xScrolledWindow->GetStyle() & ~(WB_AUTOHSCROLL|WB_HSCROLL);
|
||||
if (eHPolicy == VclPolicyType::ALWAYS)
|
||||
nWinBits |= WB_HSCROLL;
|
||||
else if (eHPolicy == VclPolicyType::AUTOMATIC)
|
||||
nWinBits |= WB_AUTOHSCROLL;
|
||||
m_xScrolledWindow->SetStyle(nWinBits);
|
||||
m_xScrolledWindow->queue_resize();
|
||||
}
|
||||
|
||||
virtual VclPolicyType get_hpolicy() const override
|
||||
{
|
||||
WinBits nWinBits = m_xScrolledWindow->GetStyle();
|
||||
if (nWinBits & WB_AUTOHSCROLL)
|
||||
return VclPolicyType::AUTOMATIC;
|
||||
else if (nWinBits & WB_HSCROLL)
|
||||
return VclPolicyType::ALWAYS;
|
||||
return VclPolicyType::NEVER;
|
||||
}
|
||||
|
||||
virtual void set_vpolicy(VclPolicyType eVPolicy) override
|
||||
{
|
||||
WinBits nWinBits = m_xScrolledWindow->GetStyle() & ~(WB_AUTOVSCROLL|WB_VSCROLL);
|
||||
|
|
|
@ -2545,6 +2545,20 @@ public:
|
|||
enable_notify_events();
|
||||
}
|
||||
|
||||
virtual void set_hpolicy(VclPolicyType eHPolicy) override
|
||||
{
|
||||
GtkPolicyType eGtkVPolicy;
|
||||
gtk_scrolled_window_get_policy(m_pScrolledWindow, nullptr, &eGtkVPolicy);
|
||||
gtk_scrolled_window_set_policy(m_pScrolledWindow, eGtkVPolicy, VclToGtk(eHPolicy));
|
||||
}
|
||||
|
||||
virtual VclPolicyType get_hpolicy() const override
|
||||
{
|
||||
GtkPolicyType eGtkHPolicy;
|
||||
gtk_scrolled_window_get_policy(m_pScrolledWindow, &eGtkHPolicy, nullptr);
|
||||
return GtkToVcl(eGtkHPolicy);
|
||||
}
|
||||
|
||||
virtual void set_vpolicy(VclPolicyType eVPolicy) override
|
||||
{
|
||||
GtkPolicyType eGtkHPolicy;
|
||||
|
|
Loading…
Reference in a new issue