[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sc/inc sc/source

2019-11-15 Thread Noel Grandin (via logerrit)
 sc/inc/document.hxx  |2 +-
 sc/inc/table.hxx |2 +-
 sc/source/core/data/document.cxx |4 ++--
 sc/source/core/data/table2.cxx   |   28 
 sc/source/ui/view/viewdata.cxx   |   29 +++--
 5 files changed, 39 insertions(+), 26 deletions(-)

New commits:
commit 4f1fe43b077c8bbbd6ceca7cf564c0168039f9fa
Author: Noel Grandin 
AuthorDate: Tue Nov 12 16:00:55 2019 +0200
Commit: Noel Grandin 
CommitDate: Fri Nov 15 09:07:51 2019 +0100

reduce iteration in ScViewData::GetScrPos

we already have a ScTable::GetRowHeightScaled method that uses spans, so use
that.

Reviewed-on: https://gerrit.libreoffice.org/82520
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit feec8e3c34e08b621098a17f1011dccd0b4f7f4c)

Change-Id: I126292b4a8b37ebf2d4f737dcbfdadc31226531e
Reviewed-on: https://gerrit.libreoffice.org/82747
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 3fbe9cd899d5..1e33e444c849 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1820,7 +1820,7 @@ public:
  * specified height.
  */
 SCROW   GetRowForHeight( SCTAB nTab, sal_uLong nHeight 
) const;
-sal_uLong   GetScaledRowHeight( SCROW nStartRow, SCROW 
nEndRow, SCTAB nTab, double fScale ) const;
+sal_uLong   GetScaledRowHeight( SCROW nStartRow, SCROW 
nEndRow, SCTAB nTab, double fScale, const sal_uLong* pnMaxHeight = nullptr ) 
const;
 SC_DLLPUBLIC sal_uLong  GetColOffset( SCCOL nCol, SCTAB nTab, bool 
bHiddenAsZero = true ) const;
 SC_DLLPUBLIC sal_uLong  GetRowOffset( SCROW nRow, SCTAB nTab, bool 
bHiddenAsZero = true ) const;
 
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index e804a1ca9cc2..353a5a1b1978 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -809,7 +809,7 @@ public:
 sal_uLong GetColWidth( SCCOL nStartCol, SCCOL nEndCol ) const;
 SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCROW* pStartRow, SCROW* 
pEndRow, bool bHiddenAsZero = true ) const;
 sal_uLong   GetRowHeight( SCROW nStartRow, SCROW nEndRow, bool 
bHiddenAsZero = true ) const;
-sal_uLong   GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double 
fScale ) const;
+sal_uLong   GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double 
fScale, const sal_uLong* pnMaxHeight = nullptr ) const;
 sal_uLong   GetColOffset( SCCOL nCol, bool bHiddenAsZero = true ) 
const;
 sal_uLong   GetRowOffset( SCROW nRow, bool bHiddenAsZero = true ) 
const;
 
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 2d36b6e46f36..ed10538b00ac 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -4197,7 +4197,7 @@ SCROW ScDocument::GetRowForHeight( SCTAB nTab, sal_uLong 
nHeight ) const
 }
 
 sal_uLong ScDocument::GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow,
-SCTAB nTab, double fScale ) const
+SCTAB nTab, double fScale, const sal_uLong* pnMaxHeight ) const
 {
 // faster for a single row
 if (nStartRow == nEndRow)
@@ -4208,7 +4208,7 @@ sal_uLong ScDocument::GetScaledRowHeight( SCROW 
nStartRow, SCROW nEndRow,
 return 0;
 
 if ( ValidTab(nTab) && nTab < static_cast(maTabs.size()) && 
maTabs[nTab] )
-return maTabs[nTab]->GetScaledRowHeight( nStartRow, nEndRow, fScale);
+return maTabs[nTab]->GetScaledRowHeight( nStartRow, nEndRow, fScale, 
pnMaxHeight );
 
 OSL_FAIL("wrong sheet number");
 return 0;
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 524dfe220190..e86f3d215778 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -3151,7 +3151,7 @@ sal_uLong ScTable::GetRowHeight( SCROW nStartRow, SCROW 
nEndRow, bool bHiddenAsZ
 return (nEndRow - nStartRow + 1) * 
static_cast(ScGlobal::nStdRowHeight);
 }
 
-sal_uLong ScTable::GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double 
fScale ) const
+sal_uLong ScTable::GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double 
fScale, const sal_uLong* pnMaxHeight ) const
 {
 OSL_ENSURE(ValidRow(nStartRow) && ValidRow(nEndRow),"wrong row number");
 
@@ -3177,8 +3177,18 @@ sal_uLong ScTable::GetScaledRowHeight( SCROW nStartRow, 
SCROW nEndRow, double fS
 SCROW nSegmentEnd = std::min( nLastRow, aData.mnRow2 );
 
 // round-down a single height value, multiply resulting 
(pixel) values
-sal_uLong nOneHeight = static_cast( 
aData.mnValue * fScale );
-nHeight += nOneHeight * ( nSegmentEnd + 1 - nRow );
+const sal_uLong nOneHeight = static_cast( 
aData.mnValue * fScale );
+SCROW nRowsInSegment = nSegmentEnd + 1 - nRow;
+if 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sc/inc sc/source

2019-06-17 Thread Muhammet Kara (via logerrit)
 sc/inc/unonames.hxx|2 ++
 sc/source/ui/unoobj/docuno.cxx |   13 -
 2 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 1cbbc4159032eb71304f3b8705cd64f111653a8e
Author: Muhammet Kara 
AuthorDate: Thu Jan 17 17:26:15 2019 +0300
Commit: Muhammet Kara 
CommitDate: Mon Jun 17 17:31:53 2019 +0200

Add aCalcPageSize and aCalcPagePos properties to ScModelObj::getRenderer

So that we can adjust page offset when outputting to GDIMetaFiles

Change-Id: I1c28440a1ff62a879b6341748a6d3092f2bfda96
Reviewed-on: https://gerrit.libreoffice.org/66526
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit ec4a282657d84e9e745b68fa8299c8ecc4c7ea7a)
Reviewed-on: https://gerrit.libreoffice.org/74171
Reviewed-by: Muhammet Kara 
Tested-by: Muhammet Kara 

diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index d90c4a510a3a..79f2189e1835 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -646,6 +646,8 @@
 #define SC_UNONAME_RENDERDEV"RenderDevice"
 #define SC_UNONAME_SOURCERANGE  "SourceRange"
 #define SC_UNONAME_INC_NP_AREA  "PageIncludesNonprintableArea"
+#define SC_UNONAME_CALCPAGESIZE "CalcPageContentSize"
+#define SC_UNONAME_CALCPAGEPOS  "CalcPagePos"
 
 // CellValueBinding
 #define SC_UNONAME_BOUNDCELL"BoundCell"
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 6f60c4895741..56b01d0d95d0 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1868,7 +1868,7 @@ uno::Sequence SAL_CALL 
ScModelObj::getRenderer( sal_Int32
 aPageSize.Height = TwipsToHMM( aTwips.Height());
 }
 
-long nPropCount = bWasCellRange ? 3 : 2;
+long nPropCount = bWasCellRange ? 5 : 4;
 uno::Sequence aSequence(nPropCount);
 beans::PropertyValue* pArray = aSequence.getArray();
 pArray[0].Name = SC_UNONAME_PAGESIZE;
@@ -1881,8 +1881,19 @@ uno::Sequence SAL_CALL 
ScModelObj::getRenderer( sal_Int32
 table::CellRangeAddress aRangeAddress( nTab,
 aCellRange.aStart.Col(), aCellRange.aStart.Row(),
 aCellRange.aEnd.Col(), aCellRange.aEnd.Row() );
+tools::Rectangle aMMRect( pDocShell->GetDocument().GetMMRect(
+aCellRange.aStart.Col(), aCellRange.aStart.Row(),
+aCellRange.aEnd.Col(), aCellRange.aEnd.Row(), 
aCellRange.aStart.Tab()));
+
+awt::Size aCalcPageSize ( aMMRect.GetSize().Width(),  
aMMRect.GetSize().Height() );
+awt::Point aCalcPagePos( aMMRect.getX(), aMMRect.getY() );
+
 pArray[2].Name = SC_UNONAME_SOURCERANGE;
 pArray[2].Value <<= aRangeAddress;
+pArray[3].Name = SC_UNONAME_CALCPAGESIZE;
+pArray[3].Value <<= aCalcPageSize;
+pArray[4].Name = SC_UNONAME_CALCPAGEPOS;
+pArray[4].Value <<= aCalcPagePos;
 }
 
 if( ! pPrinterOptions )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits