Kaydet (Commit) 098f7a4a authored tarafından Justin Luth's avatar Justin Luth Kaydeden (comit) Thorsten Behrens

tdf#34467 - FitToFrame: stretch text to fill drawing obj

Help for Fit To Frame says "Resizes the text to fit the entire area
of the drawing or text object".

reverts commit b7628798
and partially addresses the problem of "Shrink font automatically
when text overflows" by treating text as "Autofit" while it is being
edited.
It's not WYSIWYG, but good enough, and maybe better.

Since that part of the change prevents any way of setting ::Autofit,
I also changed the default setting to Autofit instead of NONE, since there
is no good reason why text should be allowed to spill outside of a textbox.
For those who REALLY want that odd behaviour, they can use
.uno:TextFitToSize (Ctrl-Shift-F8) to toggle between "stretch" and "none".

Change-Id: I8313a82cbea82f11fad0f50d966fc77874977da9
Reviewed-on: https://gerrit.libreoffice.org/30727Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 645583df
...@@ -312,7 +312,11 @@ void SvxTextAttrPage::Reset( const SfxItemSet* rAttrs ) ...@@ -312,7 +312,11 @@ void SvxTextAttrPage::Reset( const SfxItemSet* rAttrs )
{ {
SdrFitToSizeType eFTS = (SdrFitToSizeType) SdrFitToSizeType eFTS = (SdrFitToSizeType)
static_cast<const SdrTextFitToSizeTypeItem&>( rAttrs->Get( SDRATTR_TEXT_FITTOSIZE ) ).GetValue(); static_cast<const SdrTextFitToSizeTypeItem&>( rAttrs->Get( SDRATTR_TEXT_FITTOSIZE ) ).GetValue();
m_pTsbFitToSize->SetState( eFTS == SdrFitToSizeType::NONE ? TRISTATE_FALSE : TRISTATE_TRUE ); if( eFTS == SdrFitToSizeType::Autofit || eFTS == SdrFitToSizeType::NONE )
m_pTsbFitToSize->SetState( TRISTATE_FALSE );
else
m_pTsbFitToSize->SetState( TRISTATE_TRUE );
m_pTsbFitToSize->EnableTriState( false ); m_pTsbFitToSize->EnableTriState( false );
} }
else else
...@@ -410,8 +414,8 @@ bool SvxTextAttrPage::FillItemSet( SfxItemSet* rAttrs) ...@@ -410,8 +414,8 @@ bool SvxTextAttrPage::FillItemSet( SfxItemSet* rAttrs)
default: ; //prevent warning default: ; //prevent warning
OSL_FAIL( "svx::SvxTextAttrPage::FillItemSet(), unhandled state!" ); OSL_FAIL( "svx::SvxTextAttrPage::FillItemSet(), unhandled state!" );
SAL_FALLTHROUGH; SAL_FALLTHROUGH;
case TRISTATE_FALSE: eFTS = SdrFitToSizeType::NONE; break; case TRISTATE_FALSE: eFTS = SdrFitToSizeType::Autofit; break;
case TRISTATE_TRUE: eFTS = SdrFitToSizeType::Autofit; break; case TRISTATE_TRUE: eFTS = SdrFitToSizeType::Proportional; break;
} }
rAttrs->Put( SdrTextFitToSizeTypeItem( eFTS ) ); rAttrs->Put( SdrTextFitToSizeTypeItem( eFTS ) );
} }
......
...@@ -1936,7 +1936,7 @@ void SdrTextObj::onEditOutlinerStatusEvent( EditStatus* pEditStatus ) ...@@ -1936,7 +1936,7 @@ void SdrTextObj::onEditOutlinerStatusEvent( EditStatus* pEditStatus )
{ {
AdjustTextFrameWidthAndHeight(); AdjustTextFrameWidthAndHeight();
} }
else if (IsAutoFit() && !mbInDownScale) else if ( (IsAutoFit() || IsFitToSize()) && !mbInDownScale)
{ {
assert(pEdtOutl); assert(pEdtOutl);
mbInDownScale = true; mbInDownScale = true;
......
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