[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 4 commits - include/osl sc/CppunitTest_sc_tiledrendering.mk sc/inc sc/qa sc/source
Jan Holesovsky
kendy at collabora.com
Tue May 10 09:53:46 UTC 2016
include/osl/conditn.hxx | 4 +
sc/CppunitTest_sc_tiledrendering.mk | 1
sc/inc/document.hxx | 2
sc/qa/unit/tiledrendering/tiledrendering.cxx | 55 ++++++++++++++++++++++++---
sc/source/core/data/documen2.cxx | 34 ++++++++++++----
sc/source/ui/inc/viewdata.hxx | 8 +++
sc/source/ui/unoobj/docuno.cxx | 3 -
sc/source/ui/view/gridwin4.cxx | 2
sc/source/ui/view/tabview3.cxx | 18 ++++++++
sc/source/ui/view/viewdata.cxx | 2
10 files changed, 112 insertions(+), 17 deletions(-)
New commits:
commit b105b8c4c966f68bef93d72458edf64d6cb0cea2
Author: Jan Holesovsky <kendy at collabora.com>
Date: Tue May 10 11:49:41 2016 +0200
sc lok: Extend the spreadsheet area when we are "close enough" to the end.
We can tweak later what the "close enough" means - for the moment it is 10
columns and 25 rows.
Change-Id: I92127a71aa6683c03692e96b9e0da7827942c94b
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index d16efbc..2005d91 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -304,16 +304,17 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew )
if (comphelper::LibreOfficeKit::isActive())
{
- if ( nPosX > aViewData.GetMaxTiledCol() || nPosY > aViewData.GetMaxTiledRow() )
+ if (nPosX > aViewData.GetMaxTiledCol() - 10 || nPosY > aViewData.GetMaxTiledRow() - 25)
{
- aViewData.SetMaxTiledCol( std::max( nPosX, aViewData.GetMaxTiledCol() ) );
- aViewData.SetMaxTiledRow( std::max( nPosY, aViewData.GetMaxTiledRow() ) );
+ if (nPosX > aViewData.GetMaxTiledCol() - 10)
+ aViewData.SetMaxTiledCol(std::max(nPosX, aViewData.GetMaxTiledCol()) + 10);
+
+ if (nPosY > aViewData.GetMaxTiledRow() - 25)
+ aViewData.SetMaxTiledRow(std::max(nPosY, aViewData.GetMaxTiledRow()) + 25);
ScDocShell* pDocSh = aViewData.GetDocShell();
if (pDocSh)
- {
pDocSh->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, "");
- }
}
}
}
commit fd5ae1f201a894c5b15d52f3cab57ef15c9eb5b9
Author: Jan Holesovsky <kendy at collabora.com>
Date: Tue May 10 10:50:13 2016 +0200
sc lok: Move the handling of the area back to GetTiledRenderingArea().
Change-Id: I4dbfc090ab43065c719f83b5355cd9832ee4d1e3
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 272d2eb..f5bcd9a 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1159,7 +1159,7 @@ public:
void InvalidateTableArea();
/// Return the number of colums / rows that should be visible for the tiled rendering.
- SC_DLLPUBLIC bool GetTiledRenderingArea(SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow) const;
+ SC_DLLPUBLIC void GetTiledRenderingArea(SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow) const;
SC_DLLPUBLIC bool GetDataStart( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow ) const;
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index e0058ec..6940762c 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -84,6 +84,7 @@
#include "externalrefmgr.hxx"
#include "appoptio.hxx"
#include "scmod.hxx"
+#include "../../ui/inc/viewdata.hxx"
#include "../../ui/inc/viewutil.hxx"
#include "tabprotection.hxx"
#include "formulaparserpool.hxx"
@@ -706,9 +707,35 @@ bool ScDocument::GetDataStart( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow )
return false;
}
-bool ScDocument::GetTiledRenderingArea(SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow) const
+void ScDocument::GetTiledRenderingArea(SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow) const
{
- return GetPrintArea(nTab, rEndCol, rEndRow, false);
+ bool bHasPrintArea = GetPrintArea(nTab, rEndCol, rEndRow, false);
+
+ // we need some reasonable minimal document size
+ ScViewData* pViewData = ScDocShell::GetViewData();
+ if (!pViewData)
+ {
+ if (!bHasPrintArea)
+ {
+ rEndCol = 20;
+ rEndRow = 50;
+ }
+ else
+ {
+ rEndCol += 20;
+ rEndRow += 50;
+ }
+ }
+ else if (!bHasPrintArea)
+ {
+ rEndCol = pViewData->GetMaxTiledCol();
+ rEndRow = pViewData->GetMaxTiledRow();
+ }
+ else
+ {
+ rEndCol = std::max(rEndCol, pViewData->GetMaxTiledCol());
+ rEndRow = std::max(rEndRow, pViewData->GetMaxTiledRow());
+ }
}
bool ScDocument::MoveTab( SCTAB nOldPos, SCTAB nNewPos, ScProgress* pProgress )
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 0f919ea..67bdb09 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -543,11 +543,7 @@ Size ScModelObj::getDocumentSize()
SCROW nEndRow = 0;
const ScDocument& rDoc = pDocShell->GetDocument();
- if (!rDoc.GetTiledRenderingArea(nTab, nEndCol, nEndRow))
- return aSize;
-
- nEndCol = std::max(nEndCol, pViewData->GetMaxTiledCol());
- nEndRow = std::max(nEndRow, pViewData->GetMaxTiledRow());
+ rDoc.GetTiledRenderingArea(nTab, nEndCol, nEndRow);
// convert to twips
aSize.setWidth(rDoc.GetColWidth(0, nEndCol, nTab, true));
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 6185a88..c4d7da1 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1615,9 +1615,7 @@ void ScGridWindow::GetSelectionRects( ::std::vector< Rectangle >& rPixelRects )
{
SCCOL nMaxTiledCol;
SCROW nMaxTiledRow;
- pDoc->GetTiledRenderingArea( nTab, nMaxTiledCol, nMaxTiledRow );
- nMaxTiledCol = std::max(nMaxTiledCol, pViewData->GetMaxTiledCol());
- nMaxTiledRow = std::max(nMaxTiledRow, pViewData->GetMaxTiledRow());
+ pDoc->GetTiledRenderingArea(nTab, nMaxTiledCol, nMaxTiledRow);
if (nX2 > nMaxTiledCol)
nX2 = nMaxTiledCol;
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index ac1f571..c7cf4cb 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2318,8 +2318,6 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle)
SCCOL nEndCol = 0;
SCROW nEndRow = 0;
pDoc->GetTiledRenderingArea(aViewData.GetTabNo(), nEndCol, nEndRow);
- nEndCol = std::max(nEndCol, aViewData.GetMaxTiledCol());
- nEndRow = std::max(nEndRow, aViewData.GetMaxTiledRow());
boost::property_tree::ptree aRows;
long nTotal = 0;
commit eff0aa51c98a40163f2106f45a5627d038a10f6e
Author: Henry Castro <hcastro at collabora.com>
Date: Sun May 8 21:11:13 2016 -0400
sc lok: set a limit for tiled column and row
In the tiled rendering case, not all column and row are rendered,
so it was set a limit for tiled column and row.
However, when a client request to move the cursor beyond the limit,
the tiled column and row is updated and they are rendered later.
Change-Id: Id0de533ebf7b3c6e0343f9dc15336150729299fa
diff --git a/sc/CppunitTest_sc_tiledrendering.mk b/sc/CppunitTest_sc_tiledrendering.mk
index 995cdc8..d1200b1 100644
--- a/sc/CppunitTest_sc_tiledrendering.mk
+++ b/sc/CppunitTest_sc_tiledrendering.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_CppunitTest_use_externals,sc_tiledrendering,\
))
$(eval $(call gb_CppunitTest_set_include,sc_tiledrendering,\
+ -I$(SRCDIR)/sc/source/ui/inc \
-I$(SRCDIR)/sc/inc \
$$(INCLUDE) \
))
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 4f33ffb..82f126f 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -35,6 +35,8 @@
#include <comphelper/lok.hxx>
+#include <tabvwsh.hxx>
+#include <docsh.hxx>
#include <document.hxx>
#include <docuno.hxx>
@@ -55,6 +57,7 @@ public:
void testRowColumnSelections();
void testSortAscendingDescending();
void testPartHash();
+ void testDocumentSize();
#endif
CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
@@ -62,6 +65,7 @@ public:
CPPUNIT_TEST(testRowColumnSelections);
CPPUNIT_TEST(testSortAscendingDescending);
CPPUNIT_TEST(testPartHash);
+ CPPUNIT_TEST(testDocumentSize);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -70,6 +74,9 @@ private:
ScModelObj* createDoc(const char* pName);
static void callback(int nType, const char* pPayload, void* pData);
void callbackImpl(int nType, const char* pPayload);
+
+ /// document size changed callback.
+ osl::Condition m_aDocSizeCondition;
#endif
uno::Reference<lang::XComponent> mxComponent;
@@ -146,12 +153,16 @@ static void lcl_convertRectangle(const OUString& rString, Rectangle& rRectangle)
}
*/
-void ScTiledRenderingTest::callbackImpl(int /*nType*/, const char* /*pPayload*/)
+void ScTiledRenderingTest::callbackImpl(int nType, const char* /*pPayload*/)
{
- // TODO when needed...
- //switch (nType)
- //{
- //}
+ switch (nType)
+ {
+ case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED:
+ {
+ m_aDocSizeCondition.set();
+ }
+ break;
+ }
}
void ScTiledRenderingTest::testRowColumnSelections()
@@ -275,6 +286,40 @@ void ScTiledRenderingTest::testPartHash()
comphelper::LibreOfficeKit::setActive(false);
}
+void ScTiledRenderingTest::testDocumentSize()
+{
+ comphelper::LibreOfficeKit::setActive();
+ ScModelObj* pModelObj = createDoc("sort-range.ods");
+ pModelObj->registerCallback(&ScTiledRenderingTest::callback, this);
+
+ // check initial document size
+ Size aDocSize = pModelObj->getDocumentSize();
+ CPPUNIT_ASSERT(aDocSize.Width() > 0);
+ CPPUNIT_ASSERT(aDocSize.Height() > 0);
+
+ ScDocShell* pDocSh = dynamic_cast< ScDocShell* >( pModelObj->GetEmbeddedObject() );
+ CPPUNIT_ASSERT(pDocSh);
+
+ ScTabViewShell* pViewShell = pDocSh->GetBestViewShell(false);
+ CPPUNIT_ASSERT(pViewShell);
+
+ // Set cursor column
+ pViewShell->SetCursor(100, 0);
+ // 2 seconds
+ TimeValue aTime = { 2 , 0 };
+ osl::Condition::Result aResult = m_aDocSizeCondition.wait(aTime);
+ CPPUNIT_ASSERT_EQUAL(aResult, osl::Condition::result_ok);
+
+ // Set cursor row
+ pViewShell->SetCursor(0, 100);
+ // 2 seconds
+ aTime = { 2 , 0 };
+ aResult = m_aDocSizeCondition.wait(aTime);
+ CPPUNIT_ASSERT_EQUAL(aResult, osl::Condition::result_ok);
+
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
#endif
CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 2a305c0..e0058ec 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -708,16 +708,7 @@ bool ScDocument::GetDataStart( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow )
bool ScDocument::GetTiledRenderingArea(SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow) const
{
- bool bHasPrintArea = GetPrintArea(nTab, rEndCol, rEndRow, false);
-
- // we need some reasonable minimal document size
- if (!bHasPrintArea || rEndCol < 20)
- rEndCol = 20;
-
- if (!bHasPrintArea || rEndRow < 50)
- rEndRow = 50;
-
- return true;
+ return GetPrintArea(nTab, rEndCol, rEndRow, false);
}
bool ScDocument::MoveTab( SCTAB nOldPos, SCTAB nNewPos, ScProgress* pProgress )
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 20854ee..74734c9 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -135,6 +135,8 @@ private:
SCROW nOldCurY;
SCCOL nPosX[2]; ///< X position of the top left cell of the visible area.
SCROW nPosY[2]; ///< Y position of the top left cell of the visible area.
+ SCCOL nMaxTiledCol;
+ SCROW nMaxTiledRow;
bool bShowGrid; // per sheet show grid lines option.
bool mbOldCursorValid; // "virtual" Cursor position when combined
@@ -284,6 +286,9 @@ public:
long GetVSplitPos() const { return pThisTab->nVSplitPos; }
SCCOL GetFixPosX() const { return pThisTab->nFixPosX; }
SCROW GetFixPosY() const { return pThisTab->nFixPosY; }
+ SCCOL GetMaxTiledCol() const { return pThisTab->nMaxTiledCol; }
+ SCROW GetMaxTiledRow() const { return pThisTab->nMaxTiledRow; }
+
bool IsPagebreakMode() const { return bPagebreak; }
bool IsPasteMode() const { return (nPasteFlags & SC_PASTE_MODE) != 0; }
bool ShowPasteSource() const { return (nPasteFlags & SC_PASTE_BORDER) != 0; }
@@ -300,6 +305,9 @@ public:
void SetVSplitPos( long nPos ) { pThisTab->nVSplitPos = nPos; }
void SetFixPosX( SCCOL nPos ) { pThisTab->nFixPosX = nPos; }
void SetFixPosY( SCROW nPos ) { pThisTab->nFixPosY = nPos; }
+ void SetMaxTiledCol( SCCOL nCol ) { pThisTab->nMaxTiledCol = nCol; }
+ void SetMaxTiledRow( SCROW nRow ) { pThisTab->nMaxTiledRow = nRow; }
+
void SetPagebreakMode( bool bSet );
void SetPasteMode ( ScPasteFlags nFlags ) { nPasteFlags = nFlags; }
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index f03768d..0f919ea 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -546,6 +546,9 @@ Size ScModelObj::getDocumentSize()
if (!rDoc.GetTiledRenderingArea(nTab, nEndCol, nEndRow))
return aSize;
+ nEndCol = std::max(nEndCol, pViewData->GetMaxTiledCol());
+ nEndRow = std::max(nEndRow, pViewData->GetMaxTiledRow());
+
// convert to twips
aSize.setWidth(rDoc.GetColWidth(0, nEndCol, nTab, true));
aSize.setHeight(rDoc.GetRowHeight(0, nEndRow, nTab, true));
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 5b06035..6185a88 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1616,6 +1616,8 @@ void ScGridWindow::GetSelectionRects( ::std::vector< Rectangle >& rPixelRects )
SCCOL nMaxTiledCol;
SCROW nMaxTiledRow;
pDoc->GetTiledRenderingArea( nTab, nMaxTiledCol, nMaxTiledRow );
+ nMaxTiledCol = std::max(nMaxTiledCol, pViewData->GetMaxTiledCol());
+ nMaxTiledRow = std::max(nMaxTiledRow, pViewData->GetMaxTiledRow());
if (nX2 > nMaxTiledCol)
nX2 = nMaxTiledCol;
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index c7cf4cb..ac1f571 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2318,6 +2318,8 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle)
SCCOL nEndCol = 0;
SCROW nEndRow = 0;
pDoc->GetTiledRenderingArea(aViewData.GetTabNo(), nEndCol, nEndRow);
+ nEndCol = std::max(nEndCol, aViewData.GetMaxTiledCol());
+ nEndRow = std::max(nEndRow, aViewData.GetMaxTiledRow());
boost::property_tree::ptree aRows;
long nTotal = 0;
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index b7ec282..d16efbc 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -62,6 +62,8 @@
#include "tabprotection.hxx"
#include "markdata.hxx"
#include <formula/FormulaCompiler.hxx>
+#include <comphelper/lok.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <com/sun/star/chart2/data/HighlightedRange.hpp>
@@ -299,6 +301,21 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew )
ShowAllCursors();
CursorPosChanged();
+
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ if ( nPosX > aViewData.GetMaxTiledCol() || nPosY > aViewData.GetMaxTiledRow() )
+ {
+ aViewData.SetMaxTiledCol( std::max( nPosX, aViewData.GetMaxTiledCol() ) );
+ aViewData.SetMaxTiledRow( std::max( nPosY, aViewData.GetMaxTiledRow() ) );
+
+ ScDocShell* pDocSh = aViewData.GetDocShell();
+ if (pDocSh)
+ {
+ pDocSh->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, "");
+ }
+ }
+ }
}
}
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 0dddea6..7c84ac7 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -93,6 +93,8 @@ ScViewDataTable::ScViewDataTable() :
nCurY( 0 ),
nOldCurX( 0 ),
nOldCurY( 0 ),
+ nMaxTiledCol( 20 ),
+ nMaxTiledRow( 50 ),
bShowGrid( true ),
mbOldCursorValid( false )
{
commit a403ae3998fa27f68e782bf17459c4778e456792
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Aug 18 08:22:16 2015 +0200
tdf#84323: Make osl::Condition::wait more readable
[Stripped down version of the commit from master.]
Change-Id: Icd66ae1d390100549f903d45b2896cdcdca449be
diff --git a/include/osl/conditn.hxx b/include/osl/conditn.hxx
index 0859a14..8bb37e3 100644
--- a/include/osl/conditn.hxx
+++ b/include/osl/conditn.hxx
@@ -80,6 +80,10 @@ namespace osl
return (Result) osl_waitCondition(condition, pTimeout);
}
+#if defined LIBO_INTERNAL_ONLY
+ Result wait(TimeValue const & timeout) { return wait(&timeout); }
+#endif
+
/** Checks if the condition is set without blocking.
*/
bool check()
More information about the Libreoffice-commits
mailing list