Blob Blame History Raw
From 3a5ce16bc2a0f766a442cebc49d4c361f95cf91b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Thu, 9 Jun 2016 09:08:08 +0100
Subject: [PATCH] Resolves: tdf#93135 can't resize shape with "resize shape to
 fit text"

These are regressions from...

commit 4a847bb4a2002d7f8f5854b7276ac67d369bdd3b
Date:   Sun Aug 2 21:20:48 2015 +0200

    tdf#93079:  "resize shape to fit text" state can't be disabled

    Wrong copy-paste

and

commit b2bae9b940fc34d2eecd7839e3cba1f41d111e87
Date:   Thu Apr 9 23:38:47 2015 +0200

    Related tdf#34467: Fit to Frame for text boxes is broken

    Wrong Copy-paste

Its turns out that there is *no* SDRATTR_TEXT_AUTOGROWSIZE property.
Only a SDRATTR_TEXT_AUTOGROWHEIGHT property

e.g. see CustomShapeProperties::UpdateTextFrameStatus of
svx/source/sdr/properties/customshapeproperties.cxx

"change TextFrame flag when bResizeShapeToFitText changes (which is mapped on
the item SDRATTR_TEXT_AUTOGROWHEIGHT for custom shapes, argh)"

So the inconsistency between

getting the itemstate of SDRATTR_TEXT_AUTOGROWSIZE
and then
setting/getting SDRATTR_TEXT_AUTOGROWHEIGHT
is better resolved by getting the itemstate of SDRATTR_TEXT_AUTOGROWHEIGHT

will have a follow up patch to remove SDRATTR_TEXT_AUTOGROWSIZE to show
its not used by anything

Change-Id: I8b8abde17c15761c621815ed2be62d6a8a5cd69a
(cherry picked from commit d1df071c3fc452817746a8daa13000d2df667aba)
(cherry picked from commit 65d1e5294c9f0d9300dbb92f6670cdcafa8a1ac2)
Reviewed-on: https://gerrit.libreoffice.org/26089
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
---
 cui/source/tabpages/textattr.cxx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cui/source/tabpages/textattr.cxx b/cui/source/tabpages/textattr.cxx
index 50cbcb5..a0ba1bb 100644
--- a/cui/source/tabpages/textattr.cxx
+++ b/cui/source/tabpages/textattr.cxx
@@ -204,9 +204,9 @@ void SvxTextAttrPage::Reset( const SfxItemSet* rAttrs )
     m_pTsbAutoGrowWidth->SaveValue();
 
     // autogrowsize
-    if ( rAttrs->GetItemState( SDRATTR_TEXT_AUTOGROWSIZE ) != SfxItemState::DONTCARE )
+    if ( rAttrs->GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) != SfxItemState::DONTCARE )
     {
-        m_pTsbAutoGrowSize->SetState( static_cast<const SdrOnOffItem&>( rAttrs->Get( SDRATTR_TEXT_AUTOGROWSIZE ) ).
+        m_pTsbAutoGrowSize->SetState( static_cast<const SdrOnOffItem&>( rAttrs->Get( SDRATTR_TEXT_AUTOGROWHEIGHT ) ).
                         GetValue() ? TRISTATE_TRUE : TRISTATE_FALSE );
         m_pTsbAutoGrowSize->EnableTriState( false );
     }
@@ -384,7 +384,7 @@ bool SvxTextAttrPage::FillItemSet( SfxItemSet* rAttrs)
     eState = m_pTsbAutoGrowSize->GetState();
     if( m_pTsbAutoGrowSize->IsValueChangedFromSaved() )
     {
-        rAttrs->Put( makeSdrTextAutoGrowSizeItem ( TRISTATE_TRUE == eState ) );
+        rAttrs->Put( makeSdrTextAutoGrowHeightItem( TRISTATE_TRUE == eState ) );
     }
 
     eState = m_pTsbWordWrapText->GetState();
-- 
2.7.4