[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sc/inc sc/source

2018-04-17 Thread Samuel Mehrbrodt
 sc/inc/document.hxx  |1 +
 sc/source/core/data/document.cxx |9 +
 2 files changed, 10 insertions(+)

New commits:
commit b672dda2d1a6f055a5e7ab60d37a3f100fc4e944
Author: Samuel Mehrbrodt 
Date:   Tue Apr 17 10:22:04 2018 +0200

Add missing method GetAllNoteEntries

Needed for f382fb59ab4065b38d0db5660940bd45e850bc5a

Manually cherry-picked from ec25d34fa3ac900950ff24fcb224f7e827352803

Change-Id: I3a2217accb9be93beccaf9bf2d938c7455b5fa2e

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index a0faa9aef87d..690bab10710d 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1109,6 +1109,7 @@ public:
 SCROW GetNotePosition( SCTAB nTab, SCCOL nCol, size_t nIndex ) const;
 
 SC_DLLPUBLIC void GetAllNoteEntries( std::vector& rNotes ) 
const;
+SC_DLLPUBLIC void GetAllNoteEntries( SCTAB nTab, 
std::vector& rNotes ) const;
 void GetNotesInRange( const ScRangeList& rRange, 
std::vector& rNotes ) const;
 bool ContainsNotesInRange( const ScRangeList& rRange ) const;
 
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index bed73d7c32e9..ec223b5c4e00 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -6541,6 +6541,15 @@ void ScDocument::GetAllNoteEntries( 
std::vector& rNotes ) const
 }
 }
 
+void ScDocument::GetAllNoteEntries( SCTAB nTab, std::vector& 
rNotes ) const
+{
+const ScTable* pTab = FetchTable(nTab);
+if (!pTab)
+return;
+
+return pTab->GetAllNoteEntries( rNotes );
+}
+
 void ScDocument::GetNotesInRange( const ScRangeList& rRange, 
std::vector& rNotes ) const
 {
 for( size_t i = 0; i < rRange.size(); ++i)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sc/inc sc/source

2017-12-22 Thread Samuel Mehrbrodt
 sc/inc/column.hxx|2 ++
 sc/inc/drwlayer.hxx  |4 +++-
 sc/source/core/data/column.cxx   |   35 +++
 sc/source/core/data/drwlayer.cxx |   24 +++-
 sc/source/core/data/table3.cxx   |   27 ++-
 5 files changed, 89 insertions(+), 3 deletions(-)

New commits:
commit efb190857650b2f2592be783a0e2997b8eeaf768
Author: Samuel Mehrbrodt 
Date:   Wed Dec 20 11:30:36 2017 +0100

tdf#98931 Consider cell-anchored images when sorting

(cherry picked from commit 06567dd9c92fc2d3971fc0ce893c74d019176c5e)

Change-Id: Id9a56a15f776d5adbe382a9bca167bff48b69a0c
Reviewed-on: https://gerrit.libreoffice.org/46982
Reviewed-by: Samuel Mehrbrodt 
Tested-by: Samuel Mehrbrodt 

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 939716443d20..2188c539bf41 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -29,6 +29,7 @@
 #include "mtvelements.hxx"
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -608,6 +609,7 @@ public:
 sc::ColumnBlockPosition& maDestBlockPos, bool 
bCloneCaption = true, SCROW nRowOffsetDest=0 ) const;
 
 void UpdateNoteCaptions( SCROW nRow1, SCROW nRow2 );
+void UpdateDrawObjects( std::vector> pObjects, 
SCROW nRowStart, SCROW nRowEnd );
 
 void InterpretDirtyCells( SCROW nRow1, SCROW nRow2 );
 
diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx
index 54951b506f36..64c8b1980c68 100644
--- a/sc/inc/drwlayer.hxx
+++ b/sc/inc/drwlayer.hxx
@@ -104,7 +104,6 @@ private:
 voidMoveCells( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL 
nCol2,SCROW nRow2,
 SCsCOL nDx,SCsROW nDy, bool 
bUpdateNoteCaptionPos );
 
-voidRecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool 
bNegativePage, bool bUpdateNoteCaptionPos );
 voidResizeLastRectFromAnchor( SdrObject* pObj, ScDrawObjData& 
rData, bool bUseLogicRect, bool bNegativePage, bool bCanResize, bool 
bHiddenAsZero = true );
 
 public:
@@ -142,6 +141,8 @@ public:
 voidMoveArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL 
nCol2,SCROW nRow2,
 SCsCOL nDx,SCsROW nDy, bool bInsDel, bool 
bUpdateNoteCaptionPos = true );
 
+voidRecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool 
bNegativePage, bool bUpdateNoteCaptionPos );
+
 boolHasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW 
nEndRow );
 
 voidDeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1,
@@ -182,6 +183,7 @@ public:
 static void SetCellAnchoredFromPosition( SdrObject , 
const ScDocument , SCTAB nTab );
 static void UpdateCellAnchorFromPositionEnd( SdrObject , 
ScDrawObjData , const ScDocument , SCTAB nTab, bool bUseLogicRect 
= true );
 static ScAnchorType GetAnchorType( const SdrObject& );
+std::vector GetObjectsAnchoredToCell(const ScAddress& rPos);
 
 // positions for detektive lines
 static ScDrawObjData* GetObjData( SdrObject* pObj, bool bCreate=false );
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index b70796390989..91b078e37d9b 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -45,6 +45,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -1896,6 +1898,39 @@ void ScColumn::UpdateNoteCaptions( SCROW nRow1, SCROW 
nRow2 )
 NoteCaptionUpdater aFunc(nCol, nTab);
 sc::ProcessNote(maCellNotes.begin(), maCellNotes, nRow1, nRow2, aFunc);
 }
+void ScColumn::UpdateDrawObjects(std::vector> 
pObjects, SCROW nRowStart, SCROW nRowEnd)
+{
+int nObj = 0;
+for (SCROW nCurrentRow = nRowStart; nCurrentRow <= nRowEnd; nCurrentRow++, 
nObj++)
+{
+if (pObjects[nObj].empty())
+continue; // No draw objects in this row
+
+for (auto  : pObjects[nObj])
+{
+// Get anchor data
+ScDrawObjData* pObjData = ScDrawLayer::GetObjData(pObject, false);
+const ScAddress aOldStart = pObjData->maStart;
+const ScAddress aOldEnd = pObjData->maEnd;
+
+// Set start address
+ScAddress aNewStart = ScAddress(nCol, nCurrentRow, nTab);
+pObjData->maStart = aNewStart;
+
+// Set end address
+const SCCOL nObjectColSpan = aOldEnd.Col() - aOldStart.Col();
+const SCROW nObjectRowSpan = aOldEnd.Row() - aOldStart.Row();
+ScAddress aNewEnd = aNewStart;
+aNewEnd.IncRow(nObjectRowSpan);
+aNewEnd.IncCol(nObjectColSpan);
+pObjData->maEnd = aNewEnd;
+
+// Update draw object according to new anchor
+ScDrawLayer* pDrawLayer = GetDoc().GetDrawLayer();
+

[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sc/inc sc/source

2017-12-13 Thread Tomaž Vajngerl
 sc/inc/docuno.hxx  |2 ++
 sc/source/ui/inc/printfun.hxx  |3 +++
 sc/source/ui/unoobj/docuno.cxx |   24 ++--
 sc/source/ui/view/printfun.cxx |   35 +++
 4 files changed, 58 insertions(+), 6 deletions(-)

New commits:
commit e9b6eecdb962a346ef65284b35b76259091746ad
Author: Tomaž Vajngerl 
Date:   Fri Dec 1 22:28:48 2017 +0900

Use print state when rendering a Calc document

When rendering a Calc document with UNO rendering API for printing,
PDF export, some data (like print X, Y sizes) can be passed from one
ScPrintFunc call to the other to save us from some unnecessay
recalculation and increase performance. This was used previously for
preview, but not when rendering.
This implements some missing functions in ScPrintFunc and implements
the use of print state when rendering with UNO rendering API.

Reviewed-on: https://gerrit.libreoffice.org/45687
Tested-by: Jenkins 
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit f1f1dd3885cdbf00032a362275f36e408ef5ac9f)

Change-Id: Ic69dee99223961befb9b5dddf8ec5c268630bf79
Reviewed-on: https://gerrit.libreoffice.org/46371
Reviewed-by: Thorsten Behrens 
Tested-by: Thorsten Behrens 

diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 80ab14d95950..b041c0e79487 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -59,6 +59,7 @@ class ScDocShell;
 class ScAnnotationObj;
 class ScMarkData;
 class ScPrintFuncCache;
+struct ScPrintState;
 class ScPrintSelectionStatus;
 class ScTableColumnObj;
 class ScTableRowObj;
@@ -91,6 +92,7 @@ private:
 ScDocShell* pDocShell;
 ScPrintFuncCache*   pPrintFuncCache;
 ScPrintUIOptions*   pPrinterOptions;
+std::unique_ptr m_pPrintState;
 css::uno::Reference xNumberAgg;
 css::uno::Reference xDrawGradTab;
 css::uno::Reference xDrawHatchTab;
diff --git a/sc/source/ui/inc/printfun.hxx b/sc/source/ui/inc/printfun.hxx
index 000d58917ee9..38e697c44b45 100644
--- a/sc/source/ui/inc/printfun.hxx
+++ b/sc/source/ui/inc/printfun.hxx
@@ -224,6 +224,9 @@ public:
  const ScPrintOptions* pOptions = nullptr,
  ScPageBreakData* pData = nullptr );
 
+ScPrintFunc( ScDocShell* pShell, SfxPrinter* pNewPrinter,
+const ScPrintState& rState, const 
ScPrintOptions* pOptions );
+
 // ctors for device other than printer - for preview and 
pdf:
 
 ScPrintFunc( OutputDevice* pOutDev, ScDocShell* pShell, 
SCTAB nTab,
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 064c8b699533..c4c28780d9ae 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -22,6 +22,7 @@
 #include "scitems.hxx"
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1555,9 +1556,14 @@ uno::Sequence SAL_CALL 
ScModelObj::getRenderer( sal_Int32
 aMark.GetMarkArea( aRange );
 pSelRange = 
 }
-ScPrintFunc aFunc( pDocShell, pDocShell->GetPrinter(), nTab,
-pPrintFuncCache->GetFirstAttr(nTab), nTotalPages, 
pSelRange, () );
-aFunc.SetRenderFlag( true );
+
+std::unique_ptr pPrintFunc;
+if (m_pPrintState)
+pPrintFunc.reset(new ScPrintFunc(pDocShell, pDocShell->GetPrinter(), 
*m_pPrintState, ()));
+else
+pPrintFunc.reset(new ScPrintFunc(pDocShell, pDocShell->GetPrinter(), 
nTab,
+ 
pPrintFuncCache->GetFirstAttr(nTab), nTotalPages, pSelRange, 
()));
+pPrintFunc->SetRenderFlag( true );
 
 Range aPageRange( nRenderer+1, nRenderer+1 );
 MultiSelection aPage( aPageRange );
@@ -1567,13 +1573,19 @@ uno::Sequence SAL_CALL 
ScModelObj::getRenderer( sal_Int32
 long nDisplayStart = pPrintFuncCache->GetDisplayStart( nTab );
 long nTabStart = pPrintFuncCache->GetTabStart( nTab );
 
-(void)aFunc.DoPrint( aPage, nTabStart, nDisplayStart, false, nullptr );
+(void)pPrintFunc->DoPrint( aPage, nTabStart, nDisplayStart, false, nullptr 
);
 
 ScRange aCellRange;
-bool bWasCellRange = aFunc.GetLastSourceRange( aCellRange );
-Size aTwips = aFunc.GetPageSize();
+bool bWasCellRange = pPrintFunc->GetLastSourceRange( aCellRange );
+Size aTwips = pPrintFunc->GetPageSize();
 awt::Size aPageSize( TwipsToHMM( aTwips.Width() ), TwipsToHMM( 
aTwips.Height() ) );
 
+if (!m_pPrintState)
+{
+m_pPrintState.reset(new ScPrintState());
+pPrintFunc->GetPrintState(*m_pPrintState);
+}
+
 long nPropCount = bWasCellRange ? 3 : 2;
 uno::Sequence aSequence(nPropCount);
 beans::PropertyValue* pArray = aSequence.getArray();
diff --git a/sc/source/ui/view/printfun.cxx 

[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sc/inc sc/source

2017-11-30 Thread Tor Lillqvist
 sc/inc/tokenarray.hxx|3 +++
 sc/source/core/data/conditio.cxx |   17 +
 sc/source/core/tool/token.cxx|   17 +
 3 files changed, 21 insertions(+), 16 deletions(-)

New commits:
commit f2d84e1f206bbd9fd749054edc851126bab71ecc
Author: Tor Lillqvist 
Date:   Tue Nov 28 12:38:03 2017 +0200

Do as the FIXME suggested

Not exactly, though. The FIXME said "Make this a comparison operator
at the TokenArray?" but I think that would be misleading as the code
in question specifically does not check the TokenArrays for being
completely identical; it intentionally ignores the RPN part. So make
it a member function 'EqualTokens' instead.

Change-Id: I15d840c422844fa144415a76c1f8fcbd6cae3c83
Reviewed-on: https://gerrit.libreoffice.org/45462
Reviewed-by: Thorsten Behrens 
Tested-by: Thorsten Behrens 

diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx
index b2b4edd896b3..e37d8e97cf1d 100644
--- a/sc/inc/tokenarray.hxx
+++ b/sc/inc/tokenarray.hxx
@@ -58,6 +58,9 @@ public:
 /// Assignment with references to FormulaToken entries (not copied!)
 ScTokenArray( const ScTokenArray& );
 virtual ~ScTokenArray();
+
+bool EqualTokens( const ScTokenArray* pArr2 ) const;
+
 void ClearScTokenArray();
 ScTokenArray* Clone() const;/// True copy!
 
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 7fd1ef53ac69..68fa98beb206 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -663,26 +663,11 @@ void ScConditionEntry::UpdateMoveTab( 
sc::RefUpdateMoveTabContext& rCxt )
 StartListening();
 }
 
-//FIXME: Make this a comparison operator at the TokenArray?
 static bool lcl_IsEqual( const ScTokenArray* pArr1, const ScTokenArray* pArr2 )
 {
 // We only compare the non-RPN array
 if ( pArr1 && pArr2 )
-{
-sal_uInt16 nLen = pArr1->GetLen();
-if ( pArr2->GetLen() != nLen )
-return false;
-
-FormulaToken** ppToken1 = pArr1->GetArray();
-FormulaToken** ppToken2 = pArr2->GetArray();
-for (sal_uInt16 i=0; iEqualTokens( pArr2 );
 else
 return !pArr1 && !pArr2; // Both 0? -> the same
 }
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 6671a5ab5dbc..ce2c7cd8b6cd 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1770,6 +1770,23 @@ ScTokenArray& ScTokenArray::operator=( const 
ScTokenArray& rArr )
 return *this;
 }
 
+bool ScTokenArray::EqualTokens( const ScTokenArray* pArr2) const
+{
+// We only compare the non-RPN array
+if ( pArr2->nLen != nLen )
+return false;
+
+FormulaToken** ppToken1 = GetArray();
+FormulaToken** ppToken2 = pArr2->GetArray();
+for (sal_uInt16 i=0; i