summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svx/sdr/table/tablecontroller.hxx2
-rw-r--r--include/svx/svdotable.hxx2
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu8
-rw-r--r--sd/sdi/sdraw.sdi17
-rw-r--r--sd/sdi/tables.sdi6
-rw-r--r--sd/uiconfig/sdraw/popupmenu/table.xml1
-rw-r--r--sd/uiconfig/sdraw/popupmenu/tabletext.xml1
-rw-r--r--sd/uiconfig/sdraw/toolbar/optimizetablebar.xml1
-rw-r--r--sd/uiconfig/simpress/popupmenu/table.xml1
-rw-r--r--sd/uiconfig/simpress/popupmenu/tabletext.xml1
-rw-r--r--sd/uiconfig/simpress/toolbar/optimizetablebar.xml1
-rw-r--r--svx/source/table/svdotable.cxx4
-rw-r--r--svx/source/table/tablecontroller.cxx13
-rw-r--r--svx/source/table/tablelayouter.cxx14
-rw-r--r--svx/source/table/tablelayouter.hxx2
15 files changed, 63 insertions, 11 deletions
diff --git a/include/svx/sdr/table/tablecontroller.hxx b/include/svx/sdr/table/tablecontroller.hxx
index 72cfac222818..22b010f1dae4 100644
--- a/include/svx/sdr/table/tablecontroller.hxx
+++ b/include/svx/sdr/table/tablecontroller.hxx
@@ -76,7 +76,7 @@ public:
SVX_DLLPRIVATE void MergeMarkedCells();
SVX_DLLPRIVATE void SplitMarkedCells();
SVX_DLLPRIVATE void DistributeColumns( const bool bOptimize );
- SVX_DLLPRIVATE void DistributeRows();
+ SVX_DLLPRIVATE void DistributeRows( const bool bOptimize );
SVX_DLLPRIVATE void SetVertical( sal_uInt16 nSId );
SVX_DLLPRIVATE static rtl::Reference< sdr::SelectionController > create(
diff --git a/include/svx/svdotable.hxx b/include/svx/svdotable.hxx
index a874c166a229..b6cf526970a7 100644
--- a/include/svx/svdotable.hxx
+++ b/include/svx/svdotable.hxx
@@ -114,7 +114,7 @@ public:
// Table stuff
void DistributeColumns( sal_Int32 nFirstColumn, sal_Int32 nLastColumn, const bool bOptimize );
- void DistributeRows( sal_Int32 nFirstRow, sal_Int32 nLastRow );
+ void DistributeRows( sal_Int32 nFirstRow, sal_Int32 nLastRow, const bool bOptimize );
css::uno::Reference< css::table::XTable > getTable() const;
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
index 5815e1b24095..ad9d3ab81cbf 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
@@ -1865,6 +1865,14 @@
<value>1</value>
</prop>
</node>
+ <node oor:name=".uno:SetOptimalRowHeight" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Optimal Row Height</value>
+ </prop>
+ <prop oor:name="Properties" oor:type="xs:int">
+ <value>1</value>
+ </prop>
+ </node>
<node oor:name=".uno:DistributeRows" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Distribute Rows Equally </value>
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index 234410d48937..eac465540ac0 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -4107,6 +4107,23 @@ SfxVoidItem DistributeColumns SID_TABLE_DISTRIBUTE_COLUMNS
GroupId = SfxGroupId::Table;
]
+SfxVoidItem SetOptimalRowHeight SID_TABLE_OPTIMAL_ROW_HEIGHT
+()
+[
+ AutoUpdate = FALSE,
+ FastCall = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = SfxGroupId::Table;
+]
+
SfxVoidItem DistributeRows SID_TABLE_DISTRIBUTE_ROWS
()
[
diff --git a/sd/sdi/tables.sdi b/sd/sdi/tables.sdi
index 2df3198ba75d..7450666134f5 100644
--- a/sd/sdi/tables.sdi
+++ b/sd/sdi/tables.sdi
@@ -156,6 +156,12 @@ shell TableObjectBar
StateMethod = GetState;
]
+ SID_TABLE_OPTIMAL_ROW_HEIGHT
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+
SID_TABLE_DISTRIBUTE_ROWS
[
ExecMethod = Execute;
diff --git a/sd/uiconfig/sdraw/popupmenu/table.xml b/sd/uiconfig/sdraw/popupmenu/table.xml
index aef1806c3be4..e3de5d204262 100644
--- a/sd/uiconfig/sdraw/popupmenu/table.xml
+++ b/sd/uiconfig/sdraw/popupmenu/table.xml
@@ -32,6 +32,7 @@
</menu:menu>
<menu:menu menu:id=".uno:RowMenu">
<menu:menupopup>
+ <menu:menuitem menu:id=".uno:SetOptimalRowHeight"/>
<menu:menuitem menu:id=".uno:DistributeRows"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:EntireRow"/>
diff --git a/sd/uiconfig/sdraw/popupmenu/tabletext.xml b/sd/uiconfig/sdraw/popupmenu/tabletext.xml
index 8533bc957a9a..9752fda0a40d 100644
--- a/sd/uiconfig/sdraw/popupmenu/tabletext.xml
+++ b/sd/uiconfig/sdraw/popupmenu/tabletext.xml
@@ -32,6 +32,7 @@
</menu:menu>
<menu:menu menu:id=".uno:RowMenu">
<menu:menupopup>
+ <menu:menuitem menu:id=".uno:SetOptimalRowHeight"/>
<menu:menuitem menu:id=".uno:DistributeRows"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:EntireRow"/>
diff --git a/sd/uiconfig/sdraw/toolbar/optimizetablebar.xml b/sd/uiconfig/sdraw/toolbar/optimizetablebar.xml
index 69aac8bdd769..62fa53214a7c 100644
--- a/sd/uiconfig/sdraw/toolbar/optimizetablebar.xml
+++ b/sd/uiconfig/sdraw/toolbar/optimizetablebar.xml
@@ -20,5 +20,6 @@
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
<toolbar:toolbaritem xlink:href=".uno:DistributeColumns"/>
<toolbar:toolbaritem xlink:href=".uno:DistributeRows"/>
+ <toolbar:toolbaritem xlink:href=".uno:SetOptimalRowHeight"/>
<toolbar:toolbaritem xlink:href=".uno:SetOptimalColumnWidth"/>
</toolbar:toolbar>
diff --git a/sd/uiconfig/simpress/popupmenu/table.xml b/sd/uiconfig/simpress/popupmenu/table.xml
index e22f2150c48e..8dcf5a4feb01 100644
--- a/sd/uiconfig/simpress/popupmenu/table.xml
+++ b/sd/uiconfig/simpress/popupmenu/table.xml
@@ -32,6 +32,7 @@
</menu:menu>
<menu:menu menu:id=".uno:RowMenu">
<menu:menupopup>
+ <menu:menuitem menu:id=".uno:SetOptimalRowHeight"/>
<menu:menuitem menu:id=".uno:DistributeRows"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:EntireRow"/>
diff --git a/sd/uiconfig/simpress/popupmenu/tabletext.xml b/sd/uiconfig/simpress/popupmenu/tabletext.xml
index 8533bc957a9a..9752fda0a40d 100644
--- a/sd/uiconfig/simpress/popupmenu/tabletext.xml
+++ b/sd/uiconfig/simpress/popupmenu/tabletext.xml
@@ -32,6 +32,7 @@
</menu:menu>
<menu:menu menu:id=".uno:RowMenu">
<menu:menupopup>
+ <menu:menuitem menu:id=".uno:SetOptimalRowHeight"/>
<menu:menuitem menu:id=".uno:DistributeRows"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:EntireRow"/>
diff --git a/sd/uiconfig/simpress/toolbar/optimizetablebar.xml b/sd/uiconfig/simpress/toolbar/optimizetablebar.xml
index 69aac8bdd769..62fa53214a7c 100644
--- a/sd/uiconfig/simpress/toolbar/optimizetablebar.xml
+++ b/sd/uiconfig/simpress/toolbar/optimizetablebar.xml
@@ -20,5 +20,6 @@
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
<toolbar:toolbaritem xlink:href=".uno:DistributeColumns"/>
<toolbar:toolbaritem xlink:href=".uno:DistributeRows"/>
+ <toolbar:toolbaritem xlink:href=".uno:SetOptimalRowHeight"/>
<toolbar:toolbaritem xlink:href=".uno:SetOptimalColumnWidth"/>
</toolbar:toolbar>
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index 5bfcb7de6c90..a77655f40166 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -2428,12 +2428,12 @@ void SdrTableObj::DistributeColumns( sal_Int32 nFirstColumn, sal_Int32 nLastColu
}
-void SdrTableObj::DistributeRows( sal_Int32 nFirstRow, sal_Int32 nLastRow )
+void SdrTableObj::DistributeRows( sal_Int32 nFirstRow, sal_Int32 nLastRow, const bool bOptimize )
{
if( mpImpl.is() && mpImpl->mpLayouter )
{
TableModelNotifyGuard aGuard( mpImpl->mxTable.get() );
- mpImpl->mpLayouter->DistributeRows( maRect, nFirstRow, nLastRow );
+ mpImpl->mpLayouter->DistributeRows( maRect, nFirstRow, nLastRow, bOptimize );
}
}
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index be901f99d8c2..f44b24daed84 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -492,7 +492,10 @@ void SvxTableController::GetState( SfxItemSet& rSet )
if( !bDistributeColumns )
rSet.DisableItem(SID_TABLE_DISTRIBUTE_COLUMNS);
if( !bDistributeRows )
+ {
+ rSet.DisableItem(SID_TABLE_OPTIMAL_ROW_HEIGHT);
rSet.DisableItem(SID_TABLE_DISTRIBUTE_ROWS);
+ }
break;
}
@@ -1007,8 +1010,12 @@ void SvxTableController::Execute( SfxRequest& rReq )
DistributeColumns(/*bOptimize=*/false);
break;
+ case SID_TABLE_OPTIMAL_ROW_HEIGHT:
+ DistributeRows(/*bOptimize=*/true);
+ break;
+
case SID_TABLE_DISTRIBUTE_ROWS:
- DistributeRows();
+ DistributeRows(/*bOptimize=*/false);
break;
case SID_TABLE_VERT_BOTTOM:
@@ -1316,7 +1323,7 @@ void SvxTableController::DistributeColumns(const bool bOptimize)
rModel.EndUndo();
}
-void SvxTableController::DistributeRows()
+void SvxTableController::DistributeRows(const bool bOptimize)
{
if(!checkTableObject())
return;
@@ -1333,7 +1340,7 @@ void SvxTableController::DistributeRows()
CellPos aStart, aEnd;
getSelectedCells( aStart, aEnd );
- rTableObj.DistributeRows( aStart.mnRow, aEnd.mnRow );
+ rTableObj.DistributeRows( aStart.mnRow, aEnd.mnRow, bOptimize );
if( bUndo )
rModel.EndUndo();
diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx
index e74374a9e1f4..c1189e2ebdb4 100644
--- a/svx/source/table/tablelayouter.cxx
+++ b/svx/source/table/tablelayouter.cxx
@@ -1152,7 +1152,10 @@ void TableLayouter::DistributeColumns( ::tools::Rectangle& rArea,
}
-void TableLayouter::DistributeRows( ::tools::Rectangle& rArea, sal_Int32 nFirstRow, sal_Int32 nLastRow )
+void TableLayouter::DistributeRows( ::tools::Rectangle& rArea,
+ sal_Int32 nFirstRow,
+ sal_Int32 nLastRow,
+ const bool bOptimize )
{
if( mxTable.is() ) try
{
@@ -1173,7 +1176,7 @@ void TableLayouter::DistributeRows( ::tools::Rectangle& rArea, sal_Int32 nFirstR
const sal_Int32 nRows = (nLastRow-nFirstRow+1);
sal_Int32 nHeight = nAllHeight / nRows;
- if( nHeight < nMinHeight )
+ if( nHeight < nMinHeight && !bOptimize )
{
sal_Int32 nNeededHeight = nRows * nMinHeight;
rArea.AdjustBottom(nNeededHeight - nAllHeight );
@@ -1184,7 +1187,9 @@ void TableLayouter::DistributeRows( ::tools::Rectangle& rArea, sal_Int32 nFirstR
Reference< XTableRows > xRows( mxTable->getRows(), UNO_QUERY_THROW );
for( sal_Int32 nRow = nFirstRow; nRow <= nLastRow; ++nRow )
{
- if( nRow == nLastRow )
+ if ( bOptimize )
+ nHeight = maRows[nRow].mnMinSize;
+ else if ( nRow == nLastRow )
nHeight = nAllHeight; // last row get round errors
Reference< XPropertySet > xRowSet( xRows->getByIndex( nRow ), UNO_QUERY_THROW );
@@ -1193,6 +1198,9 @@ void TableLayouter::DistributeRows( ::tools::Rectangle& rArea, sal_Int32 nFirstR
nAllHeight -= nHeight;
}
+ if ( bOptimize )
+ rArea.AdjustBottom( -nAllHeight );
+
LayoutTable( rArea, false, true );
}
catch( Exception& )
diff --git a/svx/source/table/tablelayouter.hxx b/svx/source/table/tablelayouter.hxx
index 960541219f9a..701a1eaf66ee 100644
--- a/svx/source/table/tablelayouter.hxx
+++ b/svx/source/table/tablelayouter.hxx
@@ -96,7 +96,7 @@ public:
sal_Int32 getVerticalEdge( int nEdgeX , sal_Int32* pnMin, sal_Int32* pnMax);
void DistributeColumns( ::tools::Rectangle& rArea, sal_Int32 nFirstCol, sal_Int32 nLastCol, const bool bOptimize );
- void DistributeRows( ::tools::Rectangle& rArea, sal_Int32 nFirstRow, sal_Int32 nLastRow );
+ void DistributeRows( ::tools::Rectangle& rArea, sal_Int32 nFirstRow, sal_Int32 nLastRow, const bool bOptimize );
void dumpAsXml(struct _xmlTextWriter* pWriter) const;
private: