summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-09-09 16:54:30 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-09-19 19:14:21 +0000
commit19a9dda3ec36874d337de65364c265946c7004df (patch)
tree2c6e40c150ca17f519ac2dacf5dfa1026f787b7d
parent2da3517dd289e00b98f7f8616a4faa9b00fb8403 (diff)
Resolves: fdo#34987 skip autoheight reset if it will be set to the same value
Triggered by aa9af08b389a106fcfb53842ac7669b208a27205 which explicitly sets rSet.Put( SdrTextAutoGrowHeightItem(FALSE) ); so there is something set on the style which is being overwritten. The code here resets the style to the default of "true" before going on to set it to the explicit "false" again. In that window of time the master shapes listen to the property change, on being set to autoheight they resize and on being unset, they remain stuck on their autoheight calculated size. Reviewed-on: https://gerrit.libreoffice.org/5887 Reviewed-by: mhofmann <borim7@web.de> Reviewed-by: Thorsten Behrens <thb@documentfoundation.org> Tested-by: Thorsten Behrens <thb@documentfoundation.org> (cherry picked from commit 14e7a290dab7fead66ef6ff7f94c6a425d80ceb6) Conflicts: xmloff/source/draw/ximpstyl.cxx Change-Id: I567a791b2bbbcb3a1a111633fabf509142984645 Reviewed-on: https://gerrit.libreoffice.org/5929 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org> (cherry picked from commit 0964a73d03bf9f5b9f485ff39f97c7e7b54339b3) Reviewed-on: https://gerrit.libreoffice.org/5939 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--xmloff/source/draw/ximpstyl.cxx45
1 files changed, 43 insertions, 2 deletions
diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx
index 1a736dbedfc2..79a7fcd49a91 100644
--- a/xmloff/source/draw/ximpstyl.cxx
+++ b/xmloff/source/draw/ximpstyl.cxx
@@ -1314,6 +1314,43 @@ void SdXMLStylesContext::ImpSetCellStyles() const
}
}
+//Resolves: fdo#34987 if the style's auto height before and after is the same
+//then don't reset it back to the underlying default of true for the small
+//period before its going to be reset to false again. Doing this avoids the
+//master page shapes from resizing themselves due to autoheight becoming
+//enabled before having autoheight turned off again and getting stuck on that
+//autosized height
+static bool canSkipReset(const OUString &rName, const XMLPropStyleContext* pPropStyle,
+ const uno::Reference< beans::XPropertySet > &rPropSet, const UniReference < XMLPropertySetMapper >& rPrMap)
+{
+ bool bCanSkipReset = false;
+ if (pPropStyle && rName == "TextAutoGrowHeight")
+ {
+ sal_Bool bOldStyleTextAutoGrowHeight(sal_False);
+ rPropSet->getPropertyValue("TextAutoGrowHeight") >>= bOldStyleTextAutoGrowHeight;
+
+ sal_Int32 nIndexStyle = rPrMap->GetEntryIndex(XML_NAMESPACE_DRAW, "auto-grow-height", 0);
+ if (nIndexStyle != -1)
+ {
+ const ::std::vector< XMLPropertyState > &rProperties = pPropStyle->GetProperties();
+ ::std::vector< XMLPropertyState >::const_iterator property = rProperties.begin();
+ for(; property != rProperties.end(); ++property)
+ {
+ sal_Int32 nIdx = property->mnIndex;
+ if (nIdx == nIndexStyle)
+ {
+ sal_Bool bNewStyleTextAutoGrowHeight(sal_False);
+ property->maValue >>= bNewStyleTextAutoGrowHeight;
+ if (bNewStyleTextAutoGrowHeight == bOldStyleTextAutoGrowHeight)
+ bCanSkipReset = true;;
+ break;
+ }
+ }
+ }
+ }
+ return bCanSkipReset;
+}
+
//////////////////////////////////////////////////////////////////////////////
// help function used by ImpSetGraphicStyles() and ImpSetMasterPageStyles()
//
@@ -1343,6 +1380,7 @@ void SdXMLStylesContext::ImpSetGraphicStyles( uno::Reference< container::XNameAc
if(nFamily == pStyle->GetFamily() && !pStyle->IsDefaultStyle())
{
OUString aStyleName(pStyle->GetDisplayName());
+
if( nPrefLen )
{
sal_Int32 nStylePrefLen = aStyleName.lastIndexOf( sal_Unicode('-') ) + 1;
@@ -1352,6 +1390,8 @@ void SdXMLStylesContext::ImpSetGraphicStyles( uno::Reference< container::XNameAc
aStyleName = aStyleName.copy( nPrefLen );
}
+ XMLPropStyleContext* pPropStyle = dynamic_cast< XMLPropStyleContext* >(const_cast< SvXMLStyleContext* >( pStyle ) );
+
uno::Reference< style::XStyle > xStyle;
if(xPageStyles->hasByName(aStyleName))
{
@@ -1380,6 +1420,9 @@ void SdXMLStylesContext::ImpSetGraphicStyles( uno::Reference< container::XNameAc
const OUString& rName = xPrMap->GetEntryAPIName( i );
if( xPropSetInfo->hasPropertyByName( rName ) && beans::PropertyState_DIRECT_VALUE == xPropState->getPropertyState( rName ) )
{
+ bool bCanSkipReset = canSkipReset(rName, pPropStyle, xPropSet, xPrMap);
+ if (bCanSkipReset)
+ continue;
xPropState->setPropertyToDefault( rName );
}
}
@@ -1410,9 +1453,7 @@ void SdXMLStylesContext::ImpSetGraphicStyles( uno::Reference< container::XNameAc
if(xStyle.is())
{
// set properties at style
- XMLPropStyleContext* pPropStyle = dynamic_cast< XMLPropStyleContext* >( const_cast< SvXMLStyleContext* >( pStyle ) );
uno::Reference< beans::XPropertySet > xPropSet(xStyle, uno::UNO_QUERY);
-
if(xPropSet.is() && pPropStyle)
{
pPropStyle->FillPropertySet(xPropSet);