mirror of
https://github.com/LibreOffice/core.git
synced 2025-07-26 15:45:26 +00:00
tdf#167536 Switch to IconView for presets and shadows in border page
- Replaces ValueSet with IconView widget in the border for presets and shadows. - Updates the borderpage UI file to support IconView. - Fix selection action for presets in format cell dialog test Change-Id: I4a6ef0de2056e21539462c69551293df9a44041b Signed-off-by: Parth Raiyani <parth.raiyani@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187987 Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Tested-by: Jenkins
This commit is contained in:

committed by
Szymon Kłos

parent
24f3c68d30
commit
4d6429c036
@ -21,7 +21,6 @@
|
|||||||
#include <editeng/shaditem.hxx>
|
#include <editeng/shaditem.hxx>
|
||||||
#include <svtools/ctrlbox.hxx>
|
#include <svtools/ctrlbox.hxx>
|
||||||
#include <vcl/weld.hxx>
|
#include <vcl/weld.hxx>
|
||||||
#include <svtools/valueset.hxx>
|
|
||||||
#include <sfx2/tabdlg.hxx>
|
#include <sfx2/tabdlg.hxx>
|
||||||
#include <svx/algitem.hxx>
|
#include <svx/algitem.hxx>
|
||||||
#include <svx/colorbox.hxx>
|
#include <svx/colorbox.hxx>
|
||||||
@ -41,7 +40,7 @@ namespace editeng
|
|||||||
class ShadowControlsWrapper
|
class ShadowControlsWrapper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit ShadowControlsWrapper(ValueSet& rVsPos, weld::MetricSpinButton& rMfSize, ColorListBox& rLbColor);
|
explicit ShadowControlsWrapper(weld::IconView& rIvPos, weld::MetricSpinButton& rMfSize, ColorListBox& rLbColor);
|
||||||
|
|
||||||
SvxShadowItem GetControlValue(const SvxShadowItem& rItem) const;
|
SvxShadowItem GetControlValue(const SvxShadowItem& rItem) const;
|
||||||
void SetControlValue(const SvxShadowItem& rItem);
|
void SetControlValue(const SvxShadowItem& rItem);
|
||||||
@ -50,9 +49,10 @@ public:
|
|||||||
bool get_value_changed_from_saved() const;
|
bool get_value_changed_from_saved() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ValueSet& mrVsPos;
|
weld::IconView& mrIvPos;
|
||||||
weld::MetricSpinButton& mrMfSize;
|
weld::MetricSpinButton& mrMfSize;
|
||||||
ColorListBox& mrLbColor;
|
ColorListBox& mrLbColor;
|
||||||
|
OUString msSavedShadowItemId;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MarginControlsWrapper
|
class MarginControlsWrapper
|
||||||
@ -121,8 +121,7 @@ private:
|
|||||||
|
|
||||||
// Controls
|
// Controls
|
||||||
svx::FrameSelector m_aFrameSel;
|
svx::FrameSelector m_aFrameSel;
|
||||||
std::unique_ptr<ValueSet> m_xWndPresets;
|
std::unique_ptr<weld::IconView> m_xWndPresets;
|
||||||
std::unique_ptr<weld::CustomWeld> m_xWndPresetsWin;
|
|
||||||
std::unique_ptr<weld::Label> m_xUserDefFT;
|
std::unique_ptr<weld::Label> m_xUserDefFT;
|
||||||
std::unique_ptr<weld::CustomWeld> m_xFrameSelWin;
|
std::unique_ptr<weld::CustomWeld> m_xFrameSelWin;
|
||||||
|
|
||||||
@ -143,8 +142,7 @@ private:
|
|||||||
std::unique_ptr<weld::CheckButton> m_xSynchronizeCB;
|
std::unique_ptr<weld::CheckButton> m_xSynchronizeCB;
|
||||||
|
|
||||||
std::unique_ptr<weld::Container> m_xShadowFrame;
|
std::unique_ptr<weld::Container> m_xShadowFrame;
|
||||||
std::unique_ptr<ValueSet> m_xWndShadows;
|
std::unique_ptr<weld::IconView> m_xWndShadows;
|
||||||
std::unique_ptr<weld::CustomWeld> m_xWndShadowsWin;
|
|
||||||
std::unique_ptr<weld::Label> m_xFtShadowSize;
|
std::unique_ptr<weld::Label> m_xFtShadowSize;
|
||||||
std::unique_ptr<weld::MetricSpinButton> m_xEdShadowSize;
|
std::unique_ptr<weld::MetricSpinButton> m_xEdShadowSize;
|
||||||
std::unique_ptr<weld::Label> m_xFtShadowColor;
|
std::unique_ptr<weld::Label> m_xFtShadowColor;
|
||||||
@ -162,21 +160,23 @@ private:
|
|||||||
// Handler
|
// Handler
|
||||||
DECL_LINK(SelStyleHdl_Impl, SvtLineListBox&, void);
|
DECL_LINK(SelStyleHdl_Impl, SvtLineListBox&, void);
|
||||||
DECL_LINK(SelColHdl_Impl, ColorListBox&, void);
|
DECL_LINK(SelColHdl_Impl, ColorListBox&, void);
|
||||||
DECL_LINK(SelPreHdl_Impl, ValueSet*, void);
|
DECL_LINK(SelPreHdl_Impl, weld::IconView&, void);
|
||||||
DECL_LINK(SelSdwHdl_Impl, ValueSet*, void);
|
DECL_LINK(SelSdwHdl_Impl, weld::IconView&, void);
|
||||||
DECL_LINK(LinesChanged_Impl, LinkParamNone*, void);
|
DECL_LINK(LinesChanged_Impl, LinkParamNone*, void);
|
||||||
DECL_LINK(ModifyDistanceHdl_Impl, weld::MetricSpinButton&, void);
|
DECL_LINK(ModifyDistanceHdl_Impl, weld::MetricSpinButton&, void);
|
||||||
DECL_LINK(ModifyWidthLBHdl_Impl, weld::ComboBox&, void);
|
DECL_LINK(ModifyWidthLBHdl_Impl, weld::ComboBox&, void);
|
||||||
DECL_LINK(ModifyWidthMFHdl_Impl, weld::MetricSpinButton&, void);
|
DECL_LINK(ModifyWidthMFHdl_Impl, weld::MetricSpinButton&, void);
|
||||||
DECL_LINK(SyncHdl_Impl, weld::Toggleable&, void);
|
DECL_LINK(SyncHdl_Impl, weld::Toggleable&, void);
|
||||||
DECL_LINK(RemoveAdjacentCellBorderHdl_Impl, weld::Toggleable&, void);
|
DECL_LINK(RemoveAdjacentCellBorderHdl_Impl, weld::Toggleable&, void);
|
||||||
|
DECL_LINK(QueryTooltipPreHdl, const weld::TreeIter&, OUString);
|
||||||
|
DECL_LINK(QueryTooltipSdwHdl, const weld::TreeIter&, OUString);
|
||||||
|
|
||||||
sal_uInt16 GetPresetImageId(sal_uInt16 nValueSetIdx) const;
|
sal_uInt16 GetPresetImageId(sal_uInt16 nIconViewIdx) const;
|
||||||
TranslateId GetPresetStringId(sal_uInt16 nValueSetIdx) const;
|
TranslateId GetPresetStringId(sal_uInt16 nIconViewIdx) const;
|
||||||
|
|
||||||
void FillPresetVS();
|
void FillPresetIV();
|
||||||
void FillShadowVS();
|
void FillShadowIV();
|
||||||
void FillValueSets();
|
void FillIconViews();
|
||||||
void SetLineWidth(sal_Int64 nWidth, sal_Int32 nRemovedType = 0);
|
void SetLineWidth(sal_Int64 nWidth, sal_Int32 nRemovedType = 0);
|
||||||
|
|
||||||
// Filler
|
// Filler
|
||||||
@ -189,6 +189,9 @@ private:
|
|||||||
|
|
||||||
bool IsBorderLineStyleAllowed( SvxBorderLineStyle nStyle ) const;
|
bool IsBorderLineStyleAllowed( SvxBorderLineStyle nStyle ) const;
|
||||||
void UpdateRemoveAdjCellBorderCB( sal_uInt16 nPreset );
|
void UpdateRemoveAdjCellBorderCB( sal_uInt16 nPreset );
|
||||||
|
|
||||||
|
static TranslateId GetShadowStringId(sal_uInt16 nIconViewIdx);
|
||||||
|
static BitmapEx GetPreviewAsBitmap(const Image& rImage);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||||
#include <comphelper/lok.hxx>
|
#include <comphelper/lok.hxx>
|
||||||
#include <svtools/unitconv.hxx>
|
#include <svtools/unitconv.hxx>
|
||||||
|
#include <vcl/virdev.hxx>
|
||||||
|
|
||||||
using namespace ::editeng;
|
using namespace ::editeng;
|
||||||
using ::com::sun::star::uno::Reference;
|
using ::com::sun::star::uno::Reference;
|
||||||
@ -141,8 +142,8 @@ const sal_uInt16 BORDER_PRESET_COUNT = 5;
|
|||||||
// number of shadow images to show
|
// number of shadow images to show
|
||||||
const sal_uInt16 BORDER_SHADOW_COUNT = 5;
|
const sal_uInt16 BORDER_SHADOW_COUNT = 5;
|
||||||
|
|
||||||
ShadowControlsWrapper::ShadowControlsWrapper(ValueSet& rVsPos, weld::MetricSpinButton& rMfSize, ColorListBox& rLbColor)
|
ShadowControlsWrapper::ShadowControlsWrapper(weld::IconView& rIvPos, weld::MetricSpinButton& rMfSize, ColorListBox& rLbColor)
|
||||||
: mrVsPos(rVsPos)
|
: mrIvPos(rIvPos)
|
||||||
, mrMfSize(rMfSize)
|
, mrMfSize(rMfSize)
|
||||||
, mrLbColor(rLbColor)
|
, mrLbColor(rLbColor)
|
||||||
{
|
{
|
||||||
@ -151,9 +152,11 @@ ShadowControlsWrapper::ShadowControlsWrapper(ValueSet& rVsPos, weld::MetricSpinB
|
|||||||
SvxShadowItem ShadowControlsWrapper::GetControlValue(const SvxShadowItem& rItem) const
|
SvxShadowItem ShadowControlsWrapper::GetControlValue(const SvxShadowItem& rItem) const
|
||||||
{
|
{
|
||||||
SvxShadowItem aItem(rItem);
|
SvxShadowItem aItem(rItem);
|
||||||
if (!mrVsPos.IsNoSelection())
|
OUString sSelectedId = mrIvPos.get_selected_id();
|
||||||
|
if (!sSelectedId.isEmpty())
|
||||||
{
|
{
|
||||||
switch (mrVsPos.GetSelectedItemId())
|
sal_Int32 nSelectedId = sSelectedId.toInt32();
|
||||||
|
switch (nSelectedId)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
aItem.SetLocation(SvxShadowLocation::NONE);
|
aItem.SetLocation(SvxShadowLocation::NONE);
|
||||||
@ -190,25 +193,25 @@ void ShadowControlsWrapper::SetControlValue(const SvxShadowItem& rItem)
|
|||||||
switch (rItem.GetLocation())
|
switch (rItem.GetLocation())
|
||||||
{
|
{
|
||||||
case SvxShadowLocation::NONE:
|
case SvxShadowLocation::NONE:
|
||||||
mrVsPos.SelectItem(1);
|
mrIvPos.select(0);
|
||||||
break;
|
break;
|
||||||
case SvxShadowLocation::BottomRight:
|
case SvxShadowLocation::BottomRight:
|
||||||
mrVsPos.SelectItem(2);
|
mrIvPos.select(1);
|
||||||
break;
|
break;
|
||||||
case SvxShadowLocation::TopRight:
|
case SvxShadowLocation::TopRight:
|
||||||
mrVsPos.SelectItem(3);
|
mrIvPos.select(2);
|
||||||
break;
|
break;
|
||||||
case SvxShadowLocation::BottomLeft:
|
case SvxShadowLocation::BottomLeft:
|
||||||
mrVsPos.SelectItem(4);
|
mrIvPos.select(3);
|
||||||
break;
|
break;
|
||||||
case SvxShadowLocation::TopLeft:
|
case SvxShadowLocation::TopLeft:
|
||||||
mrVsPos.SelectItem(5);
|
mrIvPos.select(4);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mrVsPos.SetNoSelection();
|
mrIvPos.unselect_all();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mrVsPos.SaveValue();
|
msSavedShadowItemId = mrIvPos.get_selected_id();
|
||||||
mrMfSize.set_value(mrMfSize.normalize(rItem.GetWidth()), FieldUnit::TWIP);
|
mrMfSize.set_value(mrMfSize.normalize(rItem.GetWidth()), FieldUnit::TWIP);
|
||||||
mrMfSize.save_value();
|
mrMfSize.save_value();
|
||||||
mrLbColor.SelectEntry(rItem.GetColor());
|
mrLbColor.SelectEntry(rItem.GetColor());
|
||||||
@ -217,14 +220,14 @@ void ShadowControlsWrapper::SetControlValue(const SvxShadowItem& rItem)
|
|||||||
|
|
||||||
bool ShadowControlsWrapper::get_value_changed_from_saved() const
|
bool ShadowControlsWrapper::get_value_changed_from_saved() const
|
||||||
{
|
{
|
||||||
return mrVsPos.IsValueChangedFromSaved() ||
|
return (mrIvPos.get_selected_id() != msSavedShadowItemId) ||
|
||||||
mrMfSize.get_value_changed_from_saved() ||
|
mrMfSize.get_value_changed_from_saved() ||
|
||||||
mrLbColor.IsValueChangedFromSaved();
|
mrLbColor.IsValueChangedFromSaved();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShadowControlsWrapper::SetControlDontKnow()
|
void ShadowControlsWrapper::SetControlDontKnow()
|
||||||
{
|
{
|
||||||
mrVsPos.SetNoSelection();
|
mrIvPos.unselect_all();
|
||||||
mrMfSize.set_text(u""_ustr);
|
mrMfSize.set_text(u""_ustr);
|
||||||
mrLbColor.SetNoSelection();
|
mrLbColor.SetNoSelection();
|
||||||
}
|
}
|
||||||
@ -299,8 +302,7 @@ SvxBorderTabPage::SvxBorderTabPage(weld::Container* pPage, weld::DialogControlle
|
|||||||
, mbSync(true)
|
, mbSync(true)
|
||||||
, mbRemoveAdjacentCellBorders(false)
|
, mbRemoveAdjacentCellBorders(false)
|
||||||
, bIsCalcDoc(false)
|
, bIsCalcDoc(false)
|
||||||
, m_xWndPresets(new ValueSet(nullptr))
|
, m_xWndPresets(m_xBuilder->weld_icon_view(u"presets"_ustr))
|
||||||
, m_xWndPresetsWin(new weld::CustomWeld(*m_xBuilder, u"presets"_ustr, *m_xWndPresets))
|
|
||||||
, m_xUserDefFT(m_xBuilder->weld_label(u"userdefft"_ustr))
|
, m_xUserDefFT(m_xBuilder->weld_label(u"userdefft"_ustr))
|
||||||
, m_xFrameSelWin(new weld::CustomWeld(*m_xBuilder, u"framesel"_ustr, m_aFrameSel))
|
, m_xFrameSelWin(new weld::CustomWeld(*m_xBuilder, u"framesel"_ustr, m_aFrameSel))
|
||||||
, m_xLbLineStyle(new SvtLineListBox(m_xBuilder->weld_menu_button(u"linestylelb"_ustr)))
|
, m_xLbLineStyle(new SvtLineListBox(m_xBuilder->weld_menu_button(u"linestylelb"_ustr)))
|
||||||
@ -319,8 +321,7 @@ SvxBorderTabPage::SvxBorderTabPage(weld::Container* pPage, weld::DialogControlle
|
|||||||
, m_xBottomMF(m_xBuilder->weld_metric_spin_button(u"bottommf"_ustr, FieldUnit::MM))
|
, m_xBottomMF(m_xBuilder->weld_metric_spin_button(u"bottommf"_ustr, FieldUnit::MM))
|
||||||
, m_xSynchronizeCB(m_xBuilder->weld_check_button(u"sync"_ustr))
|
, m_xSynchronizeCB(m_xBuilder->weld_check_button(u"sync"_ustr))
|
||||||
, m_xShadowFrame(m_xBuilder->weld_container(u"shadow"_ustr))
|
, m_xShadowFrame(m_xBuilder->weld_container(u"shadow"_ustr))
|
||||||
, m_xWndShadows(new ValueSet(nullptr))
|
, m_xWndShadows(m_xBuilder->weld_icon_view(u"shadows"_ustr))
|
||||||
, m_xWndShadowsWin(new weld::CustomWeld(*m_xBuilder, u"shadows"_ustr, *m_xWndShadows))
|
|
||||||
, m_xFtShadowSize(m_xBuilder->weld_label(u"distanceft"_ustr))
|
, m_xFtShadowSize(m_xBuilder->weld_label(u"distanceft"_ustr))
|
||||||
, m_xEdShadowSize(m_xBuilder->weld_metric_spin_button(u"distancemf"_ustr, FieldUnit::MM))
|
, m_xEdShadowSize(m_xBuilder->weld_metric_spin_button(u"distancemf"_ustr, FieldUnit::MM))
|
||||||
, m_xFtShadowColor(m_xBuilder->weld_label(u"shadowcolorft"_ustr))
|
, m_xFtShadowColor(m_xBuilder->weld_label(u"shadowcolorft"_ustr))
|
||||||
@ -530,10 +531,12 @@ SvxBorderTabPage::SvxBorderTabPage(weld::Container* pPage, weld::DialogControlle
|
|||||||
m_xLbLineColor->SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl ) );
|
m_xLbLineColor->SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl ) );
|
||||||
m_xLineWidthLB->connect_changed(LINK(this, SvxBorderTabPage, ModifyWidthLBHdl_Impl));
|
m_xLineWidthLB->connect_changed(LINK(this, SvxBorderTabPage, ModifyWidthLBHdl_Impl));
|
||||||
m_xLineWidthMF->connect_value_changed(LINK(this, SvxBorderTabPage, ModifyWidthMFHdl_Impl));
|
m_xLineWidthMF->connect_value_changed(LINK(this, SvxBorderTabPage, ModifyWidthMFHdl_Impl));
|
||||||
m_xWndPresets->SetSelectHdl( LINK( this, SvxBorderTabPage, SelPreHdl_Impl ) );
|
m_xWndPresets->connect_selection_changed( LINK( this, SvxBorderTabPage, SelPreHdl_Impl ) );
|
||||||
m_xWndShadows->SetSelectHdl( LINK( this, SvxBorderTabPage, SelSdwHdl_Impl ) );
|
m_xWndShadows->connect_selection_changed( LINK( this, SvxBorderTabPage, SelSdwHdl_Impl ) );
|
||||||
|
m_xWndPresets->connect_query_tooltip( LINK( this, SvxBorderTabPage, QueryTooltipPreHdl ) );
|
||||||
|
m_xWndShadows->connect_query_tooltip( LINK( this, SvxBorderTabPage, QueryTooltipSdwHdl ) );
|
||||||
|
|
||||||
FillValueSets();
|
FillIconViews();
|
||||||
FillLineListBox_Impl();
|
FillLineListBox_Impl();
|
||||||
|
|
||||||
// Reapply line width: probably one of predefined values should be selected
|
// Reapply line width: probably one of predefined values should be selected
|
||||||
@ -593,13 +596,9 @@ SvxBorderTabPage::SvxBorderTabPage(weld::Container* pPage, weld::DialogControlle
|
|||||||
SvxBorderTabPage::~SvxBorderTabPage()
|
SvxBorderTabPage::~SvxBorderTabPage()
|
||||||
{
|
{
|
||||||
m_xLbShadowColor.reset();
|
m_xLbShadowColor.reset();
|
||||||
m_xWndShadowsWin.reset();
|
|
||||||
m_xWndShadows.reset();
|
|
||||||
m_xLbLineColor.reset();
|
m_xLbLineColor.reset();
|
||||||
m_xLbLineStyle.reset();
|
m_xLbLineStyle.reset();
|
||||||
m_xFrameSelWin.reset();
|
m_xFrameSelWin.reset();
|
||||||
m_xWndPresetsWin.reset();
|
|
||||||
m_xWndPresets.reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SfxTabPage> SvxBorderTabPage::Create( weld::Container* pPage, weld::DialogController* pController,
|
std::unique_ptr<SfxTabPage> SvxBorderTabPage::Create( weld::Container* pPage, weld::DialogController* pController,
|
||||||
@ -823,13 +822,14 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet )
|
|||||||
SelColHdl_Impl(*m_xLbLineColor);
|
SelColHdl_Impl(*m_xLbLineColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bEnable = m_xWndShadows->GetSelectedItemId() > 1 ;
|
OUString sShadowSelectedId = m_xWndShadows->get_selected_id();
|
||||||
|
bool bEnable = !sShadowSelectedId.isEmpty() && sShadowSelectedId.toInt32() > 1 ;
|
||||||
m_xFtShadowSize->set_sensitive(bEnable);
|
m_xFtShadowSize->set_sensitive(bEnable);
|
||||||
m_xEdShadowSize->set_sensitive(bEnable);
|
m_xEdShadowSize->set_sensitive(bEnable);
|
||||||
m_xFtShadowColor->set_sensitive(bEnable);
|
m_xFtShadowColor->set_sensitive(bEnable);
|
||||||
m_xLbShadowColor->set_sensitive(bEnable);
|
m_xLbShadowColor->set_sensitive(bEnable);
|
||||||
|
|
||||||
m_xWndPresets->SetNoSelection();
|
m_xWndPresets->unselect_all();
|
||||||
|
|
||||||
// - no line - should not be selected
|
// - no line - should not be selected
|
||||||
|
|
||||||
@ -857,9 +857,13 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet )
|
|||||||
{
|
{
|
||||||
m_xUserDefFT->set_sensitive(false);
|
m_xUserDefFT->set_sensitive(false);
|
||||||
m_xFrameSelWin->set_sensitive(false);
|
m_xFrameSelWin->set_sensitive(false);
|
||||||
m_xWndPresets->RemoveItem(3);
|
|
||||||
m_xWndPresets->RemoveItem(4);
|
if( m_xWndPresets->n_children() > 4 )
|
||||||
m_xWndPresets->RemoveItem(5);
|
{
|
||||||
|
m_xWndPresets->remove(4);
|
||||||
|
m_xWndPresets->remove(3);
|
||||||
|
m_xWndPresets->remove(2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1150,7 +1154,7 @@ void SvxBorderTabPage::HideShadowControls()
|
|||||||
#define IID_PRE_TABLE_ALL 20
|
#define IID_PRE_TABLE_ALL 20
|
||||||
#define IID_PRE_TABLE_OUTER2 21
|
#define IID_PRE_TABLE_OUTER2 21
|
||||||
|
|
||||||
IMPL_LINK_NOARG(SvxBorderTabPage, SelPreHdl_Impl, ValueSet*, void)
|
IMPL_LINK_NOARG(SvxBorderTabPage, SelPreHdl_Impl, weld::IconView&, void)
|
||||||
{
|
{
|
||||||
const svx::FrameBorderState SHOW = svx::FrameBorderState::Show;
|
const svx::FrameBorderState SHOW = svx::FrameBorderState::Show;
|
||||||
const svx::FrameBorderState HIDE = svx::FrameBorderState::Hide;
|
const svx::FrameBorderState HIDE = svx::FrameBorderState::Hide;
|
||||||
@ -1187,7 +1191,8 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelPreHdl_Impl, ValueSet*, void)
|
|||||||
m_aFrameSel.DeselectAllBorders();
|
m_aFrameSel.DeselectAllBorders();
|
||||||
|
|
||||||
// Using image ID to find correct line in table above.
|
// Using image ID to find correct line in table above.
|
||||||
sal_uInt16 nLine = GetPresetImageId( m_xWndPresets->GetSelectedItemId() ) - 1;
|
sal_uInt16 nSelectedId = m_xWndPresets->get_selected_id().toUInt32();
|
||||||
|
sal_uInt16 nLine = GetPresetImageId(nSelectedId) - 1;
|
||||||
|
|
||||||
// Apply all styles from the table
|
// Apply all styles from the table
|
||||||
for( int nBorder = 0; nBorder < svx::FRAMEBORDERTYPE_COUNT; ++nBorder )
|
for( int nBorder = 0; nBorder < svx::FRAMEBORDERTYPE_COUNT; ++nBorder )
|
||||||
@ -1213,22 +1218,41 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelPreHdl_Impl, ValueSet*, void)
|
|||||||
SelColHdl_Impl(*m_xLbLineColor);
|
SelColHdl_Impl(*m_xLbLineColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Presets ValueSet does not show a selection (used as push buttons).
|
// Presets IconView does not show a selection (used as push buttons).
|
||||||
m_xWndPresets->SetNoSelection();
|
m_xWndPresets->unselect_all();
|
||||||
|
|
||||||
LinesChanged_Impl( nullptr );
|
LinesChanged_Impl( nullptr );
|
||||||
UpdateRemoveAdjCellBorderCB( nLine + 1 );
|
UpdateRemoveAdjCellBorderCB( nLine + 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
IMPL_LINK_NOARG(SvxBorderTabPage, SelSdwHdl_Impl, ValueSet*, void)
|
IMPL_LINK_NOARG(SvxBorderTabPage, SelSdwHdl_Impl, weld::IconView&, void)
|
||||||
{
|
{
|
||||||
bool bEnable = m_xWndShadows->GetSelectedItemId() > 1;
|
OUString sSelectedId = m_xWndShadows->get_selected_id();
|
||||||
|
bool bEnable = !sSelectedId.isEmpty() && sSelectedId.toInt32() > 1;
|
||||||
m_xFtShadowSize->set_sensitive(bEnable);
|
m_xFtShadowSize->set_sensitive(bEnable);
|
||||||
m_xEdShadowSize->set_sensitive(bEnable);
|
m_xEdShadowSize->set_sensitive(bEnable);
|
||||||
m_xFtShadowColor->set_sensitive(bEnable);
|
m_xFtShadowColor->set_sensitive(bEnable);
|
||||||
m_xLbShadowColor->set_sensitive(bEnable);
|
m_xLbShadowColor->set_sensitive(bEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IMPL_LINK(SvxBorderTabPage, QueryTooltipPreHdl, const weld::TreeIter&, iter, OUString)
|
||||||
|
{
|
||||||
|
const OUString sId = m_xWndPresets->get_id(iter);
|
||||||
|
if (!sId.isEmpty())
|
||||||
|
return SvxResId( GetPresetStringId( sId.toInt32() ) );
|
||||||
|
|
||||||
|
return OUString();
|
||||||
|
}
|
||||||
|
|
||||||
|
IMPL_LINK(SvxBorderTabPage, QueryTooltipSdwHdl, const weld::TreeIter&, iter, OUString)
|
||||||
|
{
|
||||||
|
const OUString sId = m_xWndShadows->get_id(iter);
|
||||||
|
if (!sId.isEmpty())
|
||||||
|
return CuiResId( GetShadowStringId( sId.toInt32() ) );
|
||||||
|
|
||||||
|
return OUString();
|
||||||
|
}
|
||||||
|
|
||||||
IMPL_LINK(SvxBorderTabPage, SelColHdl_Impl, ColorListBox&, rColorBox, void)
|
IMPL_LINK(SvxBorderTabPage, SelColHdl_Impl, ColorListBox&, rColorBox, void)
|
||||||
{
|
{
|
||||||
const NamedColor& aNamedColor = rColorBox.GetSelectedEntry();
|
const NamedColor& aNamedColor = rColorBox.GetSelectedEntry();
|
||||||
@ -1336,8 +1360,8 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelStyleHdl_Impl, SvtLineListBox&, void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ValueSet handling
|
// IconView handling
|
||||||
sal_uInt16 SvxBorderTabPage::GetPresetImageId( sal_uInt16 nValueSetIdx ) const
|
sal_uInt16 SvxBorderTabPage::GetPresetImageId( sal_uInt16 nIconViewIdx ) const
|
||||||
{
|
{
|
||||||
// table with all sets of predefined border styles
|
// table with all sets of predefined border styles
|
||||||
static const sal_uInt16 ppnImgIds[][ BORDER_PRESET_COUNT ] =
|
static const sal_uInt16 ppnImgIds[][ BORDER_PRESET_COUNT ] =
|
||||||
@ -1365,12 +1389,26 @@ sal_uInt16 SvxBorderTabPage::GetPresetImageId( sal_uInt16 nValueSetIdx ) const
|
|||||||
else
|
else
|
||||||
nLine = 4;
|
nLine = 4;
|
||||||
|
|
||||||
DBG_ASSERT( (1 <= nValueSetIdx) && (nValueSetIdx <= BORDER_PRESET_COUNT),
|
DBG_ASSERT( (1 <= nIconViewIdx) && (nIconViewIdx <= BORDER_PRESET_COUNT),
|
||||||
"SvxBorderTabPage::GetPresetImageId - wrong index" );
|
"SvxBorderTabPage::GetPresetImageId - wrong index" );
|
||||||
return ppnImgIds[ nLine ][ nValueSetIdx - 1 ];
|
return ppnImgIds[ nLine ][ nIconViewIdx - 1 ];
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslateId SvxBorderTabPage::GetPresetStringId( sal_uInt16 nValueSetIdx ) const
|
TranslateId SvxBorderTabPage::GetShadowStringId( sal_uInt16 nIconViewIdx )
|
||||||
|
{
|
||||||
|
static const TranslateId pnStrIds[ BORDER_SHADOW_COUNT ] =
|
||||||
|
{
|
||||||
|
RID_CUISTR_SHADOW_STYLE_NONE,
|
||||||
|
RID_CUISTR_SHADOW_STYLE_BOTTOMRIGHT,
|
||||||
|
RID_CUISTR_SHADOW_STYLE_TOPRIGHT,
|
||||||
|
RID_CUISTR_SHADOW_STYLE_BOTTOMLEFT,
|
||||||
|
RID_CUISTR_SHADOW_STYLE_TOPLEFT
|
||||||
|
};
|
||||||
|
|
||||||
|
return pnStrIds[ nIconViewIdx - 1 ];
|
||||||
|
}
|
||||||
|
|
||||||
|
TranslateId SvxBorderTabPage::GetPresetStringId( sal_uInt16 nIconViewIdx ) const
|
||||||
{
|
{
|
||||||
// string resource IDs for each image (in order of the IID_PRE_* image IDs)
|
// string resource IDs for each image (in order of the IID_PRE_* image IDs)
|
||||||
static const TranslateId pnStrIds[] =
|
static const TranslateId pnStrIds[] =
|
||||||
@ -1400,58 +1438,55 @@ TranslateId SvxBorderTabPage::GetPresetStringId( sal_uInt16 nValueSetIdx ) const
|
|||||||
RID_SVXSTR_TABLE_PRESET_OUTERALL,
|
RID_SVXSTR_TABLE_PRESET_OUTERALL,
|
||||||
RID_SVXSTR_TABLE_PRESET_OUTERINNER
|
RID_SVXSTR_TABLE_PRESET_OUTERINNER
|
||||||
};
|
};
|
||||||
return pnStrIds[ GetPresetImageId( nValueSetIdx ) - 1 ];
|
return pnStrIds[ GetPresetImageId( nIconViewIdx ) - 1 ];
|
||||||
}
|
}
|
||||||
|
|
||||||
void SvxBorderTabPage::FillPresetVS()
|
void SvxBorderTabPage::FillPresetIV()
|
||||||
{
|
{
|
||||||
// basic initialization of the ValueSet
|
m_xWndPresets->clear();
|
||||||
m_xWndPresets->SetStyle( m_xWndPresets->GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER );
|
|
||||||
m_xWndPresets->SetColCount( BORDER_PRESET_COUNT );
|
|
||||||
|
|
||||||
// insert images and help texts
|
for( sal_uInt16 nIdx = 1; nIdx <= BORDER_PRESET_COUNT; ++nIdx )
|
||||||
for( sal_uInt16 nVSIdx = 1; nVSIdx <= BORDER_PRESET_COUNT; ++nVSIdx )
|
|
||||||
{
|
{
|
||||||
m_xWndPresets->InsertItem( nVSIdx );
|
OUString sId = OUString::number(nIdx);
|
||||||
m_xWndPresets->SetItemImage(nVSIdx, m_aBorderImgVec[GetPresetImageId(nVSIdx) - 1]);
|
BitmapEx aPreviewBitmap = GetPreviewAsBitmap(m_aBorderImgVec[GetPresetImageId(nIdx) - 1]);
|
||||||
m_xWndPresets->SetItemText( nVSIdx, SvxResId( GetPresetStringId( nVSIdx ) ) );
|
m_xWndPresets->insert(-1, nullptr, &sId, &aPreviewBitmap, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// show the control
|
// show the control
|
||||||
m_xWndPresets->SetNoSelection();
|
m_xWndPresets->unselect_all();
|
||||||
m_xWndPresets->SetOptimalSize();
|
|
||||||
m_xWndPresets->Show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SvxBorderTabPage::FillShadowVS()
|
void SvxBorderTabPage::FillShadowIV()
|
||||||
{
|
{
|
||||||
// basic initialization of the ValueSet
|
// Clear any existing items
|
||||||
m_xWndShadows->SetStyle( m_xWndShadows->GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER );
|
m_xWndShadows->clear();
|
||||||
m_xWndShadows->SetColCount( BORDER_SHADOW_COUNT );
|
|
||||||
|
|
||||||
// string resource IDs for each image
|
|
||||||
static const TranslateId pnStrIds[ BORDER_SHADOW_COUNT ] =
|
|
||||||
{ RID_CUISTR_SHADOW_STYLE_NONE, RID_CUISTR_SHADOW_STYLE_BOTTOMRIGHT, RID_CUISTR_SHADOW_STYLE_TOPRIGHT, RID_CUISTR_SHADOW_STYLE_BOTTOMLEFT, RID_CUISTR_SHADOW_STYLE_TOPLEFT };
|
|
||||||
|
|
||||||
// insert images and help texts
|
// insert images and help texts
|
||||||
for( sal_uInt16 nVSIdx = 1; nVSIdx <= BORDER_SHADOW_COUNT; ++nVSIdx )
|
for( sal_uInt16 nIdx = 1; nIdx <= BORDER_SHADOW_COUNT; ++nIdx )
|
||||||
{
|
{
|
||||||
m_xWndShadows->InsertItem( nVSIdx );
|
OUString sId = OUString::number(nIdx);
|
||||||
m_xWndShadows->SetItemImage(nVSIdx, m_aShadowImgVec[nVSIdx-1]);
|
BitmapEx aPreviewBitmap = GetPreviewAsBitmap(m_aShadowImgVec[nIdx-1]);
|
||||||
m_xWndShadows->SetItemText( nVSIdx, CuiResId( pnStrIds[ nVSIdx - 1 ] ) );
|
m_xWndShadows->insert(-1, nullptr, &sId, &aPreviewBitmap, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// show the control
|
// show the control
|
||||||
m_xWndShadows->SelectItem( 1 );
|
m_xWndShadows->select(0);
|
||||||
m_xWndShadows->SetOptimalSize();
|
|
||||||
m_xWndShadows->Show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BitmapEx SvxBorderTabPage::GetPreviewAsBitmap(const Image& rImage)
|
||||||
void SvxBorderTabPage::FillValueSets()
|
|
||||||
{
|
{
|
||||||
FillPresetVS();
|
BitmapEx aPreviewBitmap = rImage.GetBitmapEx();
|
||||||
FillShadowVS();
|
ScopedVclPtr<VirtualDevice> pVDev = VclPtr<VirtualDevice>::Create();
|
||||||
|
if (pVDev->GetDPIScaleFactor() > 1)
|
||||||
|
aPreviewBitmap.Scale(pVDev->GetDPIScaleFactor(), pVDev->GetDPIScaleFactor());
|
||||||
|
|
||||||
|
return aPreviewBitmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SvxBorderTabPage::FillIconViews()
|
||||||
|
{
|
||||||
|
FillPresetIV();
|
||||||
|
FillShadowIV();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SvxBorderTabPage::SetLineWidth( sal_Int64 nWidth, sal_Int32 nRemovedType )
|
void SvxBorderTabPage::SetLineWidth( sal_Int64 nWidth, sal_Int32 nRemovedType )
|
||||||
|
@ -35,6 +35,22 @@
|
|||||||
<property name="step-increment">0.10</property>
|
<property name="step-increment">0.10</property>
|
||||||
<property name="page-increment">1</property>
|
<property name="page-increment">1</property>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="GtkTreeStore" id="presets_liststore">
|
||||||
|
<columns>
|
||||||
|
<!-- column-name pixbuf -->
|
||||||
|
<column type="GdkPixbuf"/>
|
||||||
|
<!-- column-name id -->
|
||||||
|
<column type="gchararray"/>
|
||||||
|
</columns>
|
||||||
|
</object>
|
||||||
|
<object class="GtkTreeStore" id="shadows_liststore">
|
||||||
|
<columns>
|
||||||
|
<!-- column-name pixbuf -->
|
||||||
|
<column type="GdkPixbuf"/>
|
||||||
|
<!-- column-name id -->
|
||||||
|
<column type="gchararray"/>
|
||||||
|
</columns>
|
||||||
|
</object>
|
||||||
<!-- n-columns=2 n-rows=3 -->
|
<!-- n-columns=2 n-rows=3 -->
|
||||||
<object class="GtkGrid" id="BorderPage">
|
<object class="GtkGrid" id="BorderPage">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@ -106,7 +122,7 @@
|
|||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="label" translatable="yes" context="borderpage|label14">Pr_esets:</property>
|
<property name="label" translatable="yes" context="borderpage|label14">Pr_esets:</property>
|
||||||
<property name="use-underline">True</property>
|
<property name="use-underline">True</property>
|
||||||
<property name="mnemonic-widget">presets</property>
|
<property name="mnemonic-widget">presets_scrolled_window</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@ -115,10 +131,22 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkDrawingArea" id="presets">
|
<object class="GtkScrolledWindow" id="presets_scrolled_window">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
|
<property name="hscrollbar-policy">never</property>
|
||||||
|
<property name="vscrollbar-policy">never</property>
|
||||||
|
<property name="shadow-type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkIconView" id="presets">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="model">presets_liststore</property>
|
||||||
|
<property name="pixbuf-column">0</property>
|
||||||
|
<property name="columns">5</property>
|
||||||
|
<property name="activate-on-single-click">True</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">1</property>
|
<property name="left-attach">1</property>
|
||||||
@ -520,10 +548,22 @@
|
|||||||
<property name="row-spacing">3</property>
|
<property name="row-spacing">3</property>
|
||||||
<property name="column-spacing">6</property>
|
<property name="column-spacing">6</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkDrawingArea" id="shadows">
|
<object class="GtkScrolledWindow" id="shadows_scrolled_window">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
|
<property name="hscrollbar-policy">never</property>
|
||||||
|
<property name="vscrollbar-policy">never</property>
|
||||||
|
<property name="shadow-type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkIconView" id="shadows">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="model">shadows_liststore</property>
|
||||||
|
<property name="pixbuf-column">0</property>
|
||||||
|
<property name="columns">5</property>
|
||||||
|
<property name="activate-on-single-click">True</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">1</property>
|
<property name="left-attach">1</property>
|
||||||
@ -536,7 +576,7 @@
|
|||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="label" translatable="yes" context="borderpage|label22">_Position:</property>
|
<property name="label" translatable="yes" context="borderpage|label22">_Position:</property>
|
||||||
<property name="use-underline">True</property>
|
<property name="use-underline">True</property>
|
||||||
<property name="mnemonic-widget">shadows</property>
|
<property name="mnemonic-widget">shadows_scrolled_window</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@ -724,13 +764,11 @@
|
|||||||
<widget name="label15"/>
|
<widget name="label15"/>
|
||||||
<widget name="linestylelb"/>
|
<widget name="linestylelb"/>
|
||||||
<widget name="label22"/>
|
<widget name="label22"/>
|
||||||
<widget name="shadows"/>
|
|
||||||
</widgets>
|
</widgets>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkSizeGroup" id="sizegroupWidgets">
|
<object class="GtkSizeGroup" id="sizegroupWidgets">
|
||||||
<property name="ignore-hidden">True</property>
|
<property name="ignore-hidden">True</property>
|
||||||
<widgets>
|
<widgets>
|
||||||
<widget name="presets"/>
|
|
||||||
<widget name="frameselwin"/>
|
<widget name="frameselwin"/>
|
||||||
<widget name="linestylelb"/>
|
<widget name="linestylelb"/>
|
||||||
<widget name="linecolorlb"/>
|
<widget name="linecolorlb"/>
|
||||||
|
@ -30,7 +30,8 @@ class tdf133629(UITestCase):
|
|||||||
select_pos(xTabs, "5")
|
select_pos(xTabs, "5")
|
||||||
|
|
||||||
xPresets = xDialog.getChild("presets")
|
xPresets = xDialog.getChild("presets")
|
||||||
xPresets.executeAction("CHOOSE", mkPropertyValues({"POS": "4"}))
|
element4 = xPresets.getChild("3")
|
||||||
|
element4.executeAction("SELECT", mkPropertyValues({}))
|
||||||
|
|
||||||
# Change width
|
# Change width
|
||||||
xLineWidth = xDialog.getChild("linewidthmf")
|
xLineWidth = xDialog.getChild("linewidthmf")
|
||||||
|
Reference in New Issue
Block a user