View | Details | Raw Unified | Return to issue 120730
Collapse All | Expand All

(-)sd/source/filter/eppt/eppt.hxx (-1 / +1 lines)
Lines 820-826 Link Here
820
													PageType ePageType,
820
													PageType ePageType,
821
														sal_Bool bMaster,
821
														sal_Bool bMaster,
822
															int nPageNumber = 0 );
822
															int nPageNumber = 0 );
823
		void				ImplCreateCellBorder( const CellBorder* pCellBorder, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2 );
823
		sal_Bool			ImplCreateCellBorder( const CellBorder* pCellBorder, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2 );
824
		void				ImplCreateTable( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rXShape, EscherSolverContainer& aSolverContainer,
824
		void				ImplCreateTable( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rXShape, EscherSolverContainer& aSolverContainer,
825
								EscherPropertyContainer& aPropOpt );
825
								EscherPropertyContainer& aPropOpt );
826
		::com::sun::star::awt::Point		ImplMapPoint( const ::com::sun::star::awt::Point& );
826
		::com::sun::star::awt::Point		ImplMapPoint( const ::com::sun::star::awt::Point& );
(-)sd/source/filter/eppt/epptso.cxx (-94 / +121 lines)
Lines 5635-5645 Link Here
5635
	CellBorder() : mnPos ( 0 ), mnLength( 0 ){};
5635
	CellBorder() : mnPos ( 0 ), mnLength( 0 ){};
5636
};
5636
};
5637
5637
5638
void PPTWriter::ImplCreateCellBorder( const CellBorder* pCellBorder, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2 )
5638
sal_Bool PPTWriter::ImplCreateCellBorder( const CellBorder* pCellBorder, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2)
5639
{
5639
{
5640
	sal_Int32 nLineWidth = pCellBorder->maCellBorder.OuterLineWidth + pCellBorder->maCellBorder.InnerLineWidth;
5640
	sal_Int32 nLineWidth = pCellBorder->maCellBorder.OuterLineWidth + pCellBorder->maCellBorder.InnerLineWidth;
5641
	if ( nLineWidth )
5641
	if ( nLineWidth )
5642
	{
5642
	{
5643
		nLineWidth *= 2;
5643
		mnAngle = 0;
5644
		mnAngle = 0;
5644
		mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
5645
		mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
5645
		EscherPropertyContainer aPropOptSp;
5646
		EscherPropertyContainer aPropOptSp;
Lines 5664-5672 Link Here
5664
					<< nX2
5665
					<< nX2
5665
					<< nY2;
5666
					<< nY2;
5666
		mpPptEscherEx->CloseContainer();
5667
		mpPptEscherEx->CloseContainer();
5668
		return sal_True;
5667
	}
5669
	}
5670
	return sal_False;
5668
}
5671
}
5669
5672
5673
//get merged cell's width
5674
sal_Int32 GetCellRight( sal_Int32 nColumn,  
5675
	Rectangle& rect,
5676
	std::vector< std::pair< sal_Int32, sal_Int32 > >& aColumns,
5677
	uno::Reference< table::XMergeableCell >& xCell )
5678
{
5679
	sal_Int32 nRight = aColumns[ nColumn ].first + aColumns[ nColumn ].second;
5680
	for ( sal_Int32 nColumnSpan = 1; nColumnSpan < xCell->getColumnSpan(); nColumnSpan++ )
5681
	{
5682
		sal_uInt32 nC = nColumnSpan + nColumn;
5683
		if ( nC < aColumns.size() )
5684
			nRight += aColumns[ nC ].second;
5685
		else
5686
			nRight = rect.Right();
5687
	}
5688
	return nRight;
5689
}
5690
//get merged cell's height
5691
sal_Int32 GetCellBottom( sal_Int32 nRow, 
5692
	Rectangle& rect,
5693
	std::vector< std::pair< sal_Int32, sal_Int32 > >& aRows,
5694
	uno::Reference< table::XMergeableCell >& xCell )
5695
{
5696
	sal_Int32 nBottom = aRows[nRow].first + aRows[nRow].second;
5697
	for ( sal_Int32 nRowSpan = 1; nRowSpan < xCell->getRowSpan(); nRowSpan++ )
5698
	{
5699
		sal_uInt32 nR = nRowSpan + nRow;
5700
		if ( nR < aRows.size() )
5701
			nBottom += aRows[ nR ].second;
5702
		else
5703
			nBottom = rect.Bottom();
5704
	}
5705
	return nBottom;
5706
}
5707
5670
void PPTWriter::WriteCString( SvStream& rSt, const String& rString, sal_uInt32 nInstance )
5708
void PPTWriter::WriteCString( SvStream& rSt, const String& rString, sal_uInt32 nInstance )
5671
{
5709
{
5672
    sal_uInt32 i, nLen = rString.Len();
5710
    sal_uInt32 i, nLen = rString.Len();
Lines 5770-5795 Link Here
5770
						{
5808
						{
5771
							sal_Int32 nLeft   = aColumns[ nColumn ].first;
5809
							sal_Int32 nLeft   = aColumns[ nColumn ].first;
5772
							sal_Int32 nTop    = aRows[ nRow ].first;
5810
							sal_Int32 nTop    = aRows[ nRow ].first;
5773
							sal_Int32 nRight  = nLeft + aColumns[ nColumn ].second;
5811
							sal_Int32 nRight  = GetCellRight( nColumn, maRect,aColumns,xCell );
5774
							sal_Int32 nBottom = nTop + aRows[ nRow ].second;
5812
							sal_Int32 nBottom = GetCellBottom( nRow,  maRect,aRows,xCell );
5775
5813
							
5776
							for ( sal_Int32 nColumnSpan = 1; nColumnSpan < xCell->getColumnSpan(); nColumnSpan++ )
5777
							{
5778
								sal_uInt32 nC = nColumnSpan + nColumn;
5779
								if ( nC < aColumns.size() )
5780
									nRight += aColumns[ nC ].second;
5781
								else
5782
									nRight = maRect.Right();
5783
							}
5784
							for ( sal_Int32 nRowSpan = 1; nRowSpan < xCell->getRowSpan(); nRowSpan++ )
5785
							{
5786
								sal_uInt32 nR = nRowSpan + nRow;
5787
								if ( nR < aColumns.size() )
5788
									nBottom += aRows[ nR ].second;
5789
								else
5790
									nBottom = maRect.Bottom();
5791
							}
5792
5793
							mbFontIndependentLineSpacing = sal_False;
5814
							mbFontIndependentLineSpacing = sal_False;
5794
							mXPropSet = uno::Reference< beans::XPropertySet >( xCell, uno::UNO_QUERY_THROW );
5815
							mXPropSet = uno::Reference< beans::XPropertySet >( xCell, uno::UNO_QUERY_THROW );
5795
							mXText = uno::Reference< text::XSimpleText >( xCell, uno::UNO_QUERY_THROW );
5816
							mXText = uno::Reference< text::XSimpleText >( xCell, uno::UNO_QUERY_THROW );
Lines 5848-5954 Link Here
5848
				static const rtl::OUString	sDiagonalBLTR( RTL_CONSTASCII_USTRINGPARAM ( "DiagonalBLTR" ) );
5869
				static const rtl::OUString	sDiagonalBLTR( RTL_CONSTASCII_USTRINGPARAM ( "DiagonalBLTR" ) );
5849
5870
5850
				// creating horz lines
5871
				// creating horz lines
5851
				sal_Int32 nYPos = ImplMapPoint( rXShape->getPosition() ).Y;
5852
				for( sal_Int32 nLine = 0; nLine < ( xRows->getCount() + 1 ); nLine++ )
5872
				for( sal_Int32 nLine = 0; nLine < ( xRows->getCount() + 1 ); nLine++ )
5853
				{
5873
				{
5854
					sal_Int32 nXPos = ImplMapPoint( rXShape->getPosition() ).X;
5855
					std::vector< CellBorder > vCellBorders;
5856
					for( sal_Int32 nColumn = 0; nColumn < xColumns->getCount(); nColumn++ )
5874
					for( sal_Int32 nColumn = 0; nColumn < xColumns->getCount(); nColumn++ )
5857
					{
5875
					{
5858
						uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( nColumn ), uno::UNO_QUERY_THROW );
5859
						awt::Size aS( 0, 0 );
5860
						xPropSet->getPropertyValue( sWidth ) >>= aS.Width;
5861
						awt::Size aM( ImplMapSize( aS ) );
5862
5863
						CellBorder aCellBorder;
5876
						CellBorder aCellBorder;
5864
						aCellBorder.mnPos = nXPos;
5877
						aCellBorder.mnPos = aColumns[ nColumn ].first;
5865
						aCellBorder.mnLength = aM.Width;
5878
						aCellBorder.mnLength = aColumns[ nColumn ].second;
5879
						sal_Bool bTop = sal_False;
5880
						//write nLine*nColumn cell's top border
5866
						if ( nLine < xRows->getCount() )
5881
						if ( nLine < xRows->getCount() )
5867
						{	// top border
5882
						{	// top border
5868
							uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nLine ), uno::UNO_QUERY_THROW );
5883
							uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nLine ), uno::UNO_QUERY_THROW );
5869
							uno::Reference< beans::XPropertySet > xPropSet2( xCell, uno::UNO_QUERY_THROW );
5884
							if ( !xCell->isMerged()  )
5870
							table::BorderLine aBorderLine;
5885
							{
5871
							if ( xPropSet2->getPropertyValue( sTopBorder ) >>= aBorderLine )
5886
								uno::Reference< beans::XPropertySet > xPropSet2( xCell, uno::UNO_QUERY_THROW );
5872
								aCellBorder.maCellBorder = aBorderLine;
5887
								table::BorderLine aBorderLine;
5888
								if ( xPropSet2->getPropertyValue( sTopBorder ) >>= aBorderLine )
5889
									aCellBorder.maCellBorder = aBorderLine;
5890
								sal_Int32 nRight  = GetCellRight( nColumn, maRect,aColumns,xCell );
5891
								bTop = ImplCreateCellBorder( &aCellBorder, aCellBorder.mnPos,
5892
									aRows[ nLine ].first, nRight,  aRows[ nLine ].first );
5893
							}
5873
						}
5894
						}
5874
						if ( nLine )
5895
5896
						//if nLine*nColumn cell's top border is empty, check (nLine-1)*nColumn cell's bottom border
5897
						//and write the last row's bottom border
5898
						if (( nLine && !bTop ) || (nLine == xRows->getCount()))
5875
						{	// bottom border
5899
						{	// bottom border
5876
							uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nLine - 1 ), uno::UNO_QUERY_THROW );
5900
							sal_Int32 nRow =  nLine;
5877
							uno::Reference< beans::XPropertySet > xPropSet2( xCell, uno::UNO_QUERY_THROW );
5901
							
5878
							table::BorderLine aBorderLine;
5902
							while( nRow )
5879
							if ( xPropSet2->getPropertyValue( sBottomBorder ) >>= aBorderLine )
5903
							{   //find last no merged cell
5880
								aCellBorder.maCellBorder = aBorderLine;
5904
								uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nRow - 1 ), uno::UNO_QUERY_THROW );
5905
								if ( !xCell->isMerged()  )
5906
								{
5907
									sal_Int32 nRight  = GetCellRight( nColumn,  maRect,aColumns,xCell );
5908
									sal_Int32 nBottom = GetCellBottom( nRow - 1, maRect,aRows,xCell );
5909
									if ( nBottom == ( aRows[ nLine-1 ].first + aRows[ nLine-1 ].second ) )
5910
									{
5911
										uno::Reference< table::XMergeableCell > xCellOwn( xCellRange->getCellByPosition( nColumn, nRow - 1 ), uno::UNO_QUERY_THROW );
5912
										uno::Reference< beans::XPropertySet > xPropSet2( xCellOwn, uno::UNO_QUERY_THROW );
5913
										table::BorderLine aBorderLine;
5914
										if ( xPropSet2->getPropertyValue( sBottomBorder ) >>= aBorderLine )
5915
											aCellBorder.maCellBorder = aBorderLine;
5916
										ImplCreateCellBorder( &aCellBorder, aCellBorder.mnPos,
5917
											nBottom, nRight, nBottom);
5918
									}
5919
									nRow=0;
5920
								}
5921
								else
5922
									nRow--;
5923
							}
5881
						}
5924
						}
5882
						vCellBorders.push_back( aCellBorder );
5883
						nXPos += aM.Width;
5884
					}
5925
					}
5885
					std::vector< CellBorder >::const_iterator aCellBorderIter( vCellBorders.begin() );
5886
					while( aCellBorderIter != vCellBorders.end() )
5887
					{
5888
						ImplCreateCellBorder( &*aCellBorderIter, aCellBorderIter->mnPos, nYPos,
5889
							static_cast< sal_Int32 >( aCellBorderIter->mnPos + aCellBorderIter->mnLength ), nYPos );
5890
						aCellBorderIter++;
5891
					}
5892
					if ( nLine < xRows->getCount() )
5893
					{
5894
						uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( nLine ), uno::UNO_QUERY_THROW );
5895
						awt::Size aS( 0, 0 );
5896
						xPropSet->getPropertyValue( sHeight ) >>= aS.Height;
5897
						awt::Size aM( ImplMapSize( aS ) );
5898
						nYPos += aM.Height;
5899
					}
5900
				}
5926
				}
5901
5927
5902
				// creating vertical lines
5928
				// creating vertical lines
5903
				sal_Int32 nXPos = ImplMapPoint( rXShape->getPosition() ).X;
5904
				for( sal_Int32 nLine = 0; nLine < ( xColumns->getCount() + 1 ); nLine++ )
5929
				for( sal_Int32 nLine = 0; nLine < ( xColumns->getCount() + 1 ); nLine++ )
5905
				{
5930
				{
5906
					nYPos = ImplMapPoint( rXShape->getPosition() ).Y;
5907
					std::vector< CellBorder > vCellBorders;
5908
					for( sal_Int32 nRow = 0; nRow < xRows->getCount(); nRow++ )
5931
					for( sal_Int32 nRow = 0; nRow < xRows->getCount(); nRow++ )
5909
					{
5932
					{
5910
						uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( nRow ), uno::UNO_QUERY_THROW );
5911
						awt::Size aS( 0, 0 );
5912
						xPropSet->getPropertyValue( sHeight ) >>= aS.Height;
5913
						awt::Size aM( ImplMapSize( aS ) );
5914
5933
5915
						CellBorder aCellBorder;
5934
						CellBorder aCellBorder;
5916
						aCellBorder.mnPos = nYPos;
5935
						aCellBorder.mnPos = aRows[ nRow].first;
5917
						aCellBorder.mnLength = aM.Height;
5936
						aCellBorder.mnLength = aRows[ nRow].second;
5937
						sal_Bool bLeft = sal_False;
5918
						if ( nLine < xColumns->getCount() )
5938
						if ( nLine < xColumns->getCount() )
5919
						{	// left border
5939
						{	// left border
5920
							uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nLine, nRow ), uno::UNO_QUERY_THROW );
5940
							uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nLine, nRow ), uno::UNO_QUERY_THROW );
5921
							uno::Reference< beans::XPropertySet > xCellSet( xCell, uno::UNO_QUERY_THROW );
5941
							if (!xCell->isMerged() )
5922
							table::BorderLine aBorderLine;
5942
							{
5923
							if ( xCellSet->getPropertyValue( sLeftBorder ) >>= aBorderLine )
5943
								uno::Reference< beans::XPropertySet > xCellSet( xCell, uno::UNO_QUERY_THROW );
5924
								aCellBorder.maCellBorder = aBorderLine;
5944
								table::BorderLine aBorderLine;
5945
								if ( xCellSet->getPropertyValue( sLeftBorder ) >>= aBorderLine )
5946
									aCellBorder.maCellBorder = aBorderLine;
5947
								sal_Int32 nBottom = GetCellBottom( nRow, maRect, aRows,xCell );
5948
								bLeft = ImplCreateCellBorder( &aCellBorder, aColumns[nLine].first, aCellBorder.mnPos,
5949
									aColumns[nLine].first, nBottom );
5950
							}
5925
						}
5951
						}
5926
						if ( nLine )
5952
						if ( ( nLine && !bLeft )||(nLine == xColumns->getCount()))
5927
						{	// right border
5953
						{	// right border
5928
							uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nLine - 1, nRow ), uno::UNO_QUERY_THROW );
5954
							sal_Int32 nColumn = nLine;
5929
							uno::Reference< beans::XPropertySet > xCellSet( xCell, uno::UNO_QUERY_THROW );
5955
							while ( nColumn )
5930
							table::BorderLine aBorderLine;
5956
							{
5931
							if ( xCellSet->getPropertyValue( sRightBorder ) >>= aBorderLine )
5957
								uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn - 1, nRow ), uno::UNO_QUERY_THROW );
5932
								aCellBorder.maCellBorder = aBorderLine;
5958
								if (!xCell->isMerged() )
5959
								{
5960
									sal_Int32 nRight  = GetCellRight( nColumn-1, maRect, aColumns,xCell );
5961
									sal_Int32 nBottom = GetCellBottom( nRow,   maRect, aRows, xCell );
5962
									if ( nRight == (aColumns[nLine-1].first + aColumns[nLine-1].second) )
5963
									{
5964
										uno::Reference< table::XMergeableCell > xCellOwn( xCellRange->getCellByPosition( nColumn - 1, nRow ), uno::UNO_QUERY_THROW );
5965
										uno::Reference< beans::XPropertySet > xCellSet( xCellOwn, uno::UNO_QUERY_THROW );
5966
										table::BorderLine aBorderLine;
5967
										if ( xCellSet->getPropertyValue( sRightBorder ) >>= aBorderLine )
5968
											aCellBorder.maCellBorder = aBorderLine;
5969
										ImplCreateCellBorder( &aCellBorder, nRight, aCellBorder.mnPos,
5970
											nRight,  nBottom );
5971
									}
5972
									nColumn = 0;
5973
								}
5974
								else 
5975
									nColumn --;
5976
							}
5933
						}
5977
						}
5934
						vCellBorders.push_back( aCellBorder );
5935
						nYPos += aM.Height;
5936
					}
5978
					}
5937
					std::vector< CellBorder >::const_iterator aCellBorderIter( vCellBorders.begin() );
5938
					while( aCellBorderIter != vCellBorders.end() )
5939
					{
5940
						ImplCreateCellBorder( &*aCellBorderIter, nXPos, aCellBorderIter->mnPos,
5941
							nXPos, static_cast< sal_Int32 >( aCellBorderIter->mnPos + aCellBorderIter->mnLength ) );
5942
						aCellBorderIter++;
5943
					}
5944
					if ( nLine < xColumns->getCount() )
5945
					{
5946
						uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( nLine ), uno::UNO_QUERY_THROW );
5947
						awt::Size aS( 0, 0 );
5948
						xPropSet->getPropertyValue( sWidth ) >>= aS.Width;
5949
						awt::Size aM( ImplMapSize( aS ) );
5950
						nXPos += aM.Width;
5951
					}
5952
				}
5979
				}
5953
			}
5980
			}
5954
		}
5981
		}

Return to issue 120730