summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarper Akdemir <sarper.akdemir@collabora.com>2022-09-16 14:53:28 +0300
committerJustin Luth <jluth@mail.com>2022-09-16 18:29:32 +0200
commitb92c4de7da81318abefce4750e826ac59094b748 (patch)
tree0a3ccca708b806340a3223eb96a4941e7f3711b7
parent28a7615ccdd000270f71e2eb32efeec4c87780f1 (diff)
Related: tdf#144092 improve wording
Attempts to address concerns pointed out by Justin in: https://gerrit.libreoffice.org/c/core/+/138652/#message-6dd69691fbaabf26424b4c3fb85f42e550b53ee2 Change-Id: I1af4d316fae73626ce734ca60c6539502eb80f14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140067 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
-rw-r--r--include/svx/svdotable.hxx7
-rw-r--r--oox/source/drawingml/shape.cxx13
-rw-r--r--svx/source/table/svdotable.cxx8
3 files changed, 10 insertions, 18 deletions
diff --git a/include/svx/svdotable.hxx b/include/svx/svdotable.hxx
index bf0761248bd5..b837bc0e4608 100644
--- a/include/svx/svdotable.hxx
+++ b/include/svx/svdotable.hxx
@@ -258,12 +258,7 @@ public:
/// Next time layouting would be done, skip it (to layout at the end of multiple actions).
void SetSkipChangeLayout(bool bSkipChangeLayout);
- /** Tries to get table height if rows with sizes less than the minimum size were expanded
-
- (i.e. Table height layouted without fitting to an area)
- Helper for OOXML import
- */
- sal_Int32 getHeightWithoutFitting();
+ void LayoutTableHeight(tools::Rectangle& rArea, bool bFit);
virtual void onEditOutlinerStatusEvent( EditStatus* pEditStatus ) override;
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index cfe1ea29dc95..2a46f93a440e 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -835,8 +835,7 @@ Reference< XShape > const & Shape::createAndInsert(
maSize.Height = 0;
for (auto const& elem : mpTablePropertiesPtr->getTableRows())
{
- // WARN: When less than minimum sized rows exist, calculated height here
- // is corrected before layouting takes place
+ // WARN: If some rows can't fit the content, this is not the final height
maSize.Height = o3tl::saturating_add(maSize.Height, elem.getHeight());
}
}
@@ -1263,7 +1262,7 @@ Reference< XShape > const & Shape::createAndInsert(
mpTablePropertiesPtr->pushToPropSet( rFilterBase, xSet, mpMasterTextListStyle );
if ( auto* pTableShape = dynamic_cast<sdr::table::SdrTableObj*>(SdrObject::getSdrObjectFromXShape(mxShape)) )
{
- // Disable layouting until an attempt at correcting faulty table height is made
+ // Disable layouting until table height is expanded to fit the content
pTableShape->SetSkipChangeLayout(true);
}
}
@@ -1502,11 +1501,13 @@ Reference< XShape > const & Shape::createAndInsert(
if (mpTablePropertiesPtr && aServiceName == "com.sun.star.drawing.TableShape")
{
- // Powerpoint sometimes export row heights less than the minimum size,
- // which during import expanded to the minimum
+ // Powerpoint exports desired row heights (i.e. what user attempted to set it as, not how it appears visually)
+ // Expand table height if there are rows that can't fit the content
if (auto* pTableShape = dynamic_cast<sdr::table::SdrTableObj*>(SdrObject::getSdrObjectFromXShape(mxShape)))
{
- sal_Int32 nCorrectedHeight = pTableShape->getHeightWithoutFitting();
+ tools::Rectangle aArea{};
+ pTableShape->LayoutTableHeight(aArea, /*bFit=*/false);
+ sal_Int32 nCorrectedHeight = aArea.GetHeight();
const auto& aShapeSize = mxShape->getSize();
if( nCorrectedHeight > aShapeSize.Height )
mxShape->setSize( {aShapeSize.Width, nCorrectedHeight} );
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index 6d50267a1b4d..94006afdde43 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -2415,16 +2415,12 @@ void SdrTableObj::CropTableModelToSelection(const CellPos& rStart, const CellPos
mpImpl->CropTableModelToSelection(rStart, rEnd);
}
-sal_Int32 SdrTableObj::getHeightWithoutFitting()
+void SdrTableObj::LayoutTableHeight(tools::Rectangle& rArea, bool bFit)
{
- tools::Rectangle aRect{};
if( mpImpl.is() && mpImpl->mpLayouter)
{
- mpImpl->mpLayouter->LayoutTableHeight(aRect, /*bFit=*/false);
- return aRect.GetHeight();
+ mpImpl->mpLayouter->LayoutTableHeight(rArea, bFit);
}
- else
- return 0;
}
void SdrTableObj::DistributeColumns( sal_Int32 nFirstColumn, sal_Int32 nLastColumn, const bool bOptimize, const bool bMinimize )