27#include <svx/svxids.hrc>
33#include <osl/diagnose.h>
39 SDRATTR_MISC_FIRST ,SDRATTR_TEXT_HORZADJUST,
40 SDRATTR_TEXT_WORDWRAP, SDRATTR_TEXT_WORDWRAP
49 :
SvxTabPage(pPage, pController,
"cui/ui/textattrtabpage.ui",
"TextAttributesPage", rInAttrs)
52 , bAutoGrowSizeEnabled(false)
53 , bContourEnabled(false)
54 , bAutoGrowWidthEnabled(false)
55 , bAutoGrowHeightEnabled(false)
56 , bWordWrapTextEnabled(false)
57 , bFitToSizeEnabled(false)
58 , m_aCtlPosition(this)
59 , m_xDrawingText(m_xBuilder->weld_widget(
"drawingtext"))
60 , m_xCustomShapeText(m_xBuilder->weld_widget(
"customshapetext"))
61 , m_xTsbAutoGrowWidth(m_xBuilder->weld_check_button(
"TSB_AUTOGROW_WIDTH"))
62 , m_xTsbAutoGrowHeight(m_xBuilder->weld_check_button(
"TSB_AUTOGROW_HEIGHT"))
63 , m_xTsbFitToSize(m_xBuilder->weld_check_button(
"TSB_FIT_TO_SIZE"))
64 , m_xTsbContour(m_xBuilder->weld_check_button(
"TSB_CONTOUR"))
65 , m_xTsbWordWrapText(m_xBuilder->weld_check_button(
"TSB_WORDWRAP_TEXT"))
66 , m_xTsbAutoGrowSize(m_xBuilder->weld_check_button(
"TSB_AUTOGROW_SIZE"))
67 , m_xFlDistance(m_xBuilder->weld_frame(
"FL_DISTANCE"))
68 , m_xMtrFldLeft(m_xBuilder->weld_metric_spin_button(
"MTR_FLD_LEFT",
FieldUnit::
CM))
69 , m_xMtrFldRight(m_xBuilder->weld_metric_spin_button(
"MTR_FLD_RIGHT",
FieldUnit::
CM))
70 , m_xMtrFldTop(m_xBuilder->weld_metric_spin_button(
"MTR_FLD_TOP",
FieldUnit::
CM))
71 , m_xMtrFldBottom(m_xBuilder->weld_metric_spin_button(
"MTR_FLD_BOTTOM",
FieldUnit::
CM))
72 , m_xFlPosition(m_xBuilder->weld_frame(
"FL_POSITION"))
73 , m_xCtlPosition(new
weld::CustomWeld(*m_xBuilder,
"CTL_POSITION", m_aCtlPosition))
74 , m_xTsbFullWidth(m_xBuilder->weld_check_button(
"TSB_FULL_WIDTH"))
181 if(SfxItemState::DONTCARE != eVState && SfxItemState::DONTCARE != eHState)
259 drawing::TextFitToSizeType
const eFTS =
261 if (eFTS == drawing::TextFitToSizeType_AUTOFIT || eFTS == drawing::TextFitToSizeType_NONE)
354 drawing::TextFitToSizeType eFTS;
358 OSL_FAIL(
"svx::SvxTextAttrPage::FillItemSet(), unhandled state!" );
360 case TRISTATE_FALSE: eFTS = drawing::TextFitToSizeType_AUTOFIT;
break;
361 case TRISTATE_TRUE: eFTS = drawing::TextFitToSizeType_PROPORTIONAL;
break;
411 if( eOldTVA != eTVA )
420 if( eOldTHA != eTHA )
433 case SdrObjKind::NONE:
440 case SdrObjKind::Text:
441 case SdrObjKind::TitleText:
442 case SdrObjKind::OutlineText:
443 case SdrObjKind::Caption:
452 case SdrObjKind::CustomShape:
476 return std::make_unique<SvxTextAttrPage>(pPage, pController, *rAttrs);
532 if (IsTextDirectionLeftToRight())
535 switch( m_aCtlPosition.GetActualRP() )
539 m_aCtlPosition.SetActualRP( RectPoint::MT );
544 m_aCtlPosition.SetActualRP( RectPoint::MM );
549 m_aCtlPosition.SetActualRP( RectPoint::MB );
557 switch( m_aCtlPosition.GetActualRP() )
561 m_aCtlPosition.SetActualRP( RectPoint::LM );
566 m_aCtlPosition.SetActualRP( RectPoint::MM );
571 m_aCtlPosition.SetActualRP( RectPoint::RM );
586 if (&rButton == m_xTsbAutoGrowSize.get())
588 m_xTsbAutoGrowHeight->set_state(m_xTsbAutoGrowSize->get_state());
595 else if (&rButton == m_xTsbAutoGrowHeight.get())
596 m_xTsbAutoGrowSize->set_state(m_xTsbAutoGrowHeight->get_state());
598 bool bAutoGrowWidth = m_xTsbAutoGrowWidth->get_state() ==
TRISTATE_TRUE;
599 bool bAutoGrowHeight = m_xTsbAutoGrowHeight->get_state() ==
TRISTATE_TRUE;
600 bool bFitToSize = m_xTsbFitToSize->get_state() ==
TRISTATE_TRUE;
603 m_xTsbContour->set_sensitive( !bFitToSize &&
604 !( ( bAutoGrowWidth && bAutoGrowWidthEnabled ) || ( bAutoGrowHeight && bAutoGrowHeightEnabled ) ) &&
607 m_xTsbAutoGrowWidth->set_sensitive( !bFitToSize &&
608 !( bContour && bContourEnabled ) &&
609 bAutoGrowWidthEnabled );
611 m_xTsbAutoGrowHeight->set_sensitive( !bFitToSize &&
612 !( bContour && bContourEnabled ) &&
613 bAutoGrowHeightEnabled );
615 m_xTsbFitToSize->set_sensitive( !( ( bAutoGrowWidth && bAutoGrowWidthEnabled ) || ( bAutoGrowHeight && bAutoGrowHeightEnabled ) ) &&
616 !( bContour && bContourEnabled ) &&
620 m_xFlDistance->set_sensitive(!bContour);
622 if( bContour && bContourEnabled )
624 m_xMtrFldLeft->set_value(0, FieldUnit::NONE);
625 m_xMtrFldRight->set_value(0, FieldUnit::NONE);
626 m_xMtrFldTop->set_value(0, FieldUnit::NONE);
627 m_xMtrFldBottom->set_value(0, FieldUnit::NONE);
633 bool bHorAndVer(SfxItemState::DONTCARE == eVState || SfxItemState::DONTCARE == eHState);
636 m_xFlPosition->set_sensitive(!bContour && !bHorAndVer);
643 bool bLeftToRightDirection =
true;
646 if(SfxItemState::DONTCARE != eState)
649 if (rItem.
GetValue() == css::text::WritingMode_TB_RL)
650 bLeftToRightDirection =
false;
652 return bLeftToRightDirection;
sal_uInt16 GetValue() const
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
SfxItemPool * GetPool() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void SetState(CTL_STATE nState)
void SetControlSettings(RectPoint eRpt, sal_uInt16 nBorder)
void DoCompletelyDisable(bool bNew)
void SetActualRP(RectPoint eNewRP)
bool IsCompletelyDisabled() const
RectPoint GetActualRP() const
bool bWordWrapTextEnabled
SvxTextAttrPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rInAttrs)
const SfxItemSet & rOutAttrs
bool bAutoGrowHeightEnabled
static const WhichRangesContainer pRanges
virtual ~SvxTextAttrPage() override
bool bAutoGrowSizeEnabled
virtual void Reset(const SfxItemSet *) override
std::unique_ptr< weld::MetricSpinButton > m_xMtrFldBottom
std::unique_ptr< weld::CheckButton > m_xTsbAutoGrowSize
std::unique_ptr< weld::CheckButton > m_xTsbWordWrapText
std::unique_ptr< weld::MetricSpinButton > m_xMtrFldRight
std::unique_ptr< weld::Widget > m_xDrawingText
virtual void PageCreated(const SfxAllItemSet &aSet) override
std::unique_ptr< weld::CheckButton > m_xTsbContour
bool bAutoGrowWidthEnabled
bool IsTextDirectionLeftToRight() const
Return whether the text direction is from left to right (</sal_True>) or top to bottom (</sal_False>)...
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *)
virtual void PointChanged(weld::DrawingArea *pWindow, RectPoint eRP) override
Check whether we have to uncheck the "Full width" check box.
std::unique_ptr< weld::Frame > m_xFlPosition
void SetObjKind(SdrObjKind eObjKind)
std::unique_ptr< weld::CheckButton > m_xTsbFitToSize
std::unique_ptr< weld::Widget > m_xCustomShapeText
std::unique_ptr< weld::CheckButton > m_xTsbAutoGrowHeight
virtual bool FillItemSet(SfxItemSet *) override
SvxRectCtl m_aCtlPosition
std::unique_ptr< weld::CheckButton > m_xTsbAutoGrowWidth
std::unique_ptr< weld::MetricSpinButton > m_xMtrFldLeft
std::unique_ptr< weld::MetricSpinButton > m_xMtrFldTop
std::unique_ptr< weld::CheckButton > m_xTsbFullWidth
css::text::WritingMode GetValue() const
#define DBG_ASSERT(sCon, aError)
virtual tools::Long GetValue() const override
SVXCORE_DLLPUBLIC FieldUnit GetModuleFieldUnit(const SfxItemSet &)
#define LINK(Instance, Class, Member)
static constexpr auto Items
SdrOnOffItem makeSdrTextWordWrapItem(bool bAuto)
SdrOnOffItem makeSdrTextAutoGrowHeightItem(bool bAuto)
SdrOnOffItem makeSdrTextAutoGrowWidthItem(bool bAuto)
SdrOnOffItem makeSdrTextContourFrameItem(bool bOn)
SdrMetricItem makeSdrTextUpperDistItem(tools::Long mnHeight)
SdrMetricItem makeSdrTextRightDistItem(tools::Long mnHeight)
SdrMetricItem makeSdrTextLowerDistItem(tools::Long mnHeight)
SdrMetricItem makeSdrTextLeftDistItem(tools::Long mnHeight)
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_TEXT_AUTOGROWWIDTH(SDRATTR_MISC_FIRST+12)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_LEFTDIST(SDRATTR_MISC_FIRST+4)
constexpr TypedWhichId< SdrTextFitToSizeTypeItem > SDRATTR_TEXT_FITTOSIZE(SDRATTR_MISC_FIRST+3)
constexpr TypedWhichId< SdrTextHorzAdjustItem > SDRATTR_TEXT_HORZADJUST(SDRATTR_MISC_FIRST+13)
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_TEXT_AUTOGROWHEIGHT(SDRATTR_MISC_FIRST+2)
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_TEXT_WORDWRAP(SDRATTR_MISC_FIRST+24)
constexpr TypedWhichId< SdrTextVertAdjustItem > SDRATTR_TEXT_VERTADJUST(SDRATTR_MISC_FIRST+8)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_RIGHTDIST(SDRATTR_MISC_FIRST+5)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_LOWERDIST(SDRATTR_MISC_FIRST+7)
constexpr TypedWhichId< SvxWritingModeItem > SDRATTR_TEXTDIRECTION(SDRATTR_NOTPERSIST_FIRST+34)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_UPPERDIST(SDRATTR_MISC_FIRST+6)
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_TEXT_CONTOURFRAME(SDRATTR_MISC_FIRST+21)
IMPL_LINK(SvxTextAttrPage, ClickHdl_Impl, weld::Toggleable &, rButton, void)
IMPL_LINK_NOARG(SvxTextAttrPage, ClickFullWidthHdl_Impl, weld::Toggleable &, void)
When switching the "full width" check button on the text anchor may have to be moved to a valid and a...
SVT_DLLPUBLIC sal_Int64 GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
SVT_DLLPUBLIC void SetMetricValue(weld::MetricSpinButton &rField, sal_Int64 nCoreValue, MapUnit eUnit)
SVT_DLLPUBLIC void SetFieldUnit(weld::MetricSpinButton &rCtrl, FieldUnit eUnit, bool bAll=false)