summaryrefslogtreecommitdiff
path: root/svx/source/table/tablelayouter.cxx
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2009-06-17 10:58:14 +0000
committerIvo Hinkelmann <ihi@openoffice.org>2009-06-17 10:58:14 +0000
commit09616816855320394fe9d2bf4dc2a949296dc80f (patch)
treedce11dca85d86c03f0a64be0fcab3e1c5ee091ee /svx/source/table/tablelayouter.cxx
parentb49ac08f3b5f9474f606bb76f9256d2a9aa1a522 (diff)
CWS-TOOLING: integrate CWS impress171
2009-06-02 16:32:02 +0200 cl r272511 : fixed build error 2009-05-29 16:40:09 +0200 cl r272471 : CWS-TOOLING: rebase CWS impress171 to trunk@272291 (milestone: DEV300:m49) 2009-05-19 15:14:08 +0200 sj r272082 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:31 +0200 sj r272081 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:14 +0200 sj r272080 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-18 13:34:05 +0200 sj r272015 : #i47689# fixed rectangles toolbar 2009-05-13 14:59:08 +0200 sj r271862 : #i101563# fixed crash when loading pptx document 2009-05-12 19:31:58 +0200 sj r271835 : #101684# fixed rotation of customshapes 2009-05-08 16:37:01 +0200 sj r271724 : #i101683,i101584,i48160# added shearing of customshapes, fixed rotation problem 2009-04-28 17:32:14 +0200 sj r271335 : #i48160# fixed gluepoint rotation of customshapes 2009-04-27 16:31:54 +0200 cl r271291 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:30:52 +0200 cl r271290 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:28:55 +0200 cl r271289 : #i100138# applied patch for japanese reconversion feature 2009-04-23 14:22:59 +0200 cl r271170 : #i95342# #i96820# #i97298# multiple table handling fixes 2009-04-23 14:18:54 +0200 sj r271169 : #i60368# ignoring gamma values for toolbar/menu icons 2009-04-23 11:54:28 +0200 cl r271146 : #i97298# set style to text even during text edit 2009-04-23 11:46:38 +0200 cl r271145 : fixed compiler error with debug 2009-04-22 19:09:37 +0200 sj r271135 : #i101051# applied patch (proper import of notes page object) 2009-04-22 11:07:54 +0200 cl r271082 : #i96820# modify doc after merging cells 2009-04-22 10:57:35 +0200 cl r271081 : #i100307# applied patch from jlcheng to correctly set modfiy state 2009-04-22 10:31:11 +0200 cl r271079 : #i96736# copy merge information on clone 2009-04-21 08:27:22 +0200 cl r271016 : #i89541# use SfxErrorContext to make the ErrorHandler dialog modal 2009-04-20 17:52:56 +0200 cl r271003 : #i98480# removed 'EndPosition' and 'StartPosition' from styles 2009-04-20 16:41:55 +0200 cl r270994 : #i98403# fixed state handling for selected motion path 2009-04-17 11:35:25 +0200 cl r270931 : #i61274# export to pdf should behave like printing considering layer visibility 2009-04-17 10:00:17 +0200 cl r270924 : #i98967# set default style on any new shape except a page obj 2009-04-16 16:28:20 +0200 cl r270893 : #i98859# use percentage type for relative font height
Diffstat (limited to 'svx/source/table/tablelayouter.cxx')
-rw-r--r--svx/source/table/tablelayouter.cxx134
1 files changed, 98 insertions, 36 deletions
diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx
index 9c62d3ad4be9..5c1aca5a4542 100644
--- a/svx/source/table/tablelayouter.cxx
+++ b/svx/source/table/tablelayouter.cxx
@@ -102,6 +102,9 @@ basegfx::B2ITuple TableLayouter::getCellSize( const CellPos& rPos ) const
sal_Int32 nRowSpan = std::max( xCell->getRowSpan(), (sal_Int32)1 );
while( nRowSpan && (aPos.mnRow < nRowCount) )
{
+ if( ((sal_Int32)maRows.size()) <= aPos.mnRow )
+ break;
+
height += maRows[aPos.mnRow++].mnSize;
nRowSpan--;
}
@@ -110,6 +113,9 @@ basegfx::B2ITuple TableLayouter::getCellSize( const CellPos& rPos ) const
sal_Int32 nColSpan = std::max( xCell->getColumnSpan(), (sal_Int32)1 );
while( nColSpan && (aPos.mnCol < nColCount ) )
{
+ if( ((sal_Int32)maColumns.size()) <= aPos.mnCol )
+ break;
+
width += maColumns[aPos.mnCol++].mnSize;
nColSpan--;
}
@@ -133,11 +139,14 @@ bool TableLayouter::getCellArea( const CellPos& rPos, basegfx::B2IRectangle& rAr
{
const basegfx::B2ITuple aCellSize( getCellSize( rPos ) );
- const sal_Int32 x = maColumns[rPos.mnCol].mnPos;
- const sal_Int32 y = maRows[rPos.mnRow].mnPos;
+ if( (rPos.mnCol < ((sal_Int32)maColumns.size()) && (rPos.mnRow < ((sal_Int32)maRows.size()) ) ) )
+ {
+ const sal_Int32 x = maColumns[rPos.mnCol].mnPos;
+ const sal_Int32 y = maRows[rPos.mnRow].mnPos;
- rArea = basegfx::B2IRectangle( x, y, x + aCellSize.getX(), y + aCellSize.getY() );
- return true;
+ rArea = basegfx::B2IRectangle( x, y, x + aCellSize.getX(), y + aCellSize.getY() );
+ return true;
+ }
}
}
catch( Exception& )
@@ -321,6 +330,21 @@ sal_Int32 TableLayouter::getVerticalEdge( int nEdgeX, sal_Int32* pnMin /*= 0*/,
// -----------------------------------------------------------------------------
+static bool checkMergeOrigin( const TableModelRef& xTable, sal_Int32 nMergedX, sal_Int32 nMergedY, sal_Int32 nCellX, sal_Int32 nCellY, bool& bRunning )
+{
+ Reference< XMergeableCell > xCell( xTable->getCellByPosition( nCellX, nCellY ), UNO_QUERY );
+ if( xCell.is() && !xCell->isMerged() )
+ {
+ const sal_Int32 nRight = xCell->getColumnSpan() + nCellX;
+ const sal_Int32 nBottom = xCell->getRowSpan() + nCellY;
+ if( (nMergedX < nRight) && (nMergedY < nBottom) )
+ return true;
+
+ bRunning = false;
+ }
+ return false;
+}
+
/** returns true if the cell(nMergedX,nMergedY) is merged with other cells.
the returned cell( rOriginX, rOriginY ) is the origin( top left cell ) of the merge.
*/
@@ -336,49 +360,87 @@ bool findMergeOrigin( const TableModelRef& xTable, sal_Int32 nMergedX, sal_Int32
if( !xCell.is() || !xCell->isMerged() )
return true;
- // check horizontal
- sal_Int32 nCol = nMergedX-1;
- while( nCol >= 0 )
+ bool bCheckVert = true;
+ bool bCheckHorz = true;
+
+ sal_Int32 nMinCol = 0;
+ sal_Int32 nMinRow = 0;
+
+ sal_Int32 nStep = 1, i;
+
+ sal_Int32 nRow, nCol;
+ do
{
- xCell = xCell.query( xTable->getCellByPosition( nCol, nMergedY ) );
- if( xCell.is() && !xCell->isMerged() )
+ if( bCheckVert )
{
- if( xCell->getColumnSpan() > 1 )
+ nRow = nMergedY - nStep;
+ if( nRow >= nMinRow )
{
- // hit!
- rOriginX = nCol;
- rOriginY = nMergedY;
- return true;
+ nCol = nMergedX;
+ for( i = 0; (i <= nStep) && (nCol >= nMinCol); i++, nCol-- )
+ {
+ if( checkMergeOrigin( xTable, nMergedX, nMergedY, nCol, nRow, bCheckVert ) )
+ {
+ rOriginX = nCol; rOriginY = nRow;
+ return true;
+ }
+
+ if( !bCheckVert )
+ {
+ if( nCol == nMergedX )
+ {
+ nMinRow = nRow+1;
+ }
+ else
+ {
+ bCheckVert = true;
+ }
+ break;
+ }
+ }
+ }
+ else
+ {
+ bCheckVert = false;
}
- break;
}
- nCol--;
- }
- // check vertical
- sal_Int32 nRow = nMergedY-1;
- while( nRow >= 0 )
- {
- xCell = xCell.query( xTable->getCellByPosition( nMergedX, nRow ) );
- if( xCell.is() && !xCell->isMerged() )
+ if( bCheckHorz )
{
- if( xCell->getRowSpan() > 1 )
+ nCol = nMergedX - nStep;
+ if( nCol >= nMinCol )
+ {
+ nRow = nMergedY;
+ for( i = 0; (i < nStep) && (nRow >= nMinRow); i++, nRow-- )
+ {
+ if( checkMergeOrigin( xTable, nMergedX, nMergedY, nCol, nRow, bCheckHorz ) )
+ {
+ rOriginX = nCol; rOriginY = nRow;
+ return true;
+ }
+
+ if( !bCheckHorz )
+ {
+ if( nRow == nMergedY )
+ {
+ nMinCol = nCol+1;
+ }
+ else
+ {
+ bCheckHorz = true;
+ }
+ break;
+ }
+ }
+ }
+ else
{
- // hit!
- rOriginX = nMergedX;
- rOriginY = nRow;
- return true;
+ bCheckHorz = false;
}
- break;
}
- nRow--;
+ nStep++;
}
-
- // if origin is not at the edges, it must be the top left cell of the merged edges
- rOriginX = nCol+1;
- rOriginY = nRow+1;
- xCell = xCell.query( xTable->getCellByPosition( rOriginX, rOriginY ) );
- return xCell.is() && (xCell->getRowSpan() > 1) && (xCell->getColumnSpan() > 1);
+ while( bCheckVert || bCheckHorz );
}
catch( Exception& )
{