Kaydet (Commit) 50fe21c7 authored tarafından Mihai Varga's avatar Mihai Varga Kaydeden (comit) Jan Holesovsky

tiledrendering: added getPartName method for calc

This method is used to get the sheet's name and to display it
in the tabs (sheet selector)
I've also added an unit test for it and uncommented a similar one

Change-Id: Ia866815c594a873812c71a6c86e303c869e1f093
Reviewed-on: https://gerrit.libreoffice.org/17294Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJan Holesovsky <kendy@collabora.com>
üst d74436fb
...@@ -65,8 +65,9 @@ public: ...@@ -65,8 +65,9 @@ public:
void testDocumentLoadFail( Office* pOffice ); void testDocumentLoadFail( Office* pOffice );
void testDocumentTypes( Office* pOffice ); void testDocumentTypes( Office* pOffice );
#if 0
void testImpressSlideNames( Office* pOffice ); void testImpressSlideNames( Office* pOffice );
void testCalcSheetNames( Office* pOffice );
#if 0
void testOverlay( Office* pOffice ); void testOverlay( Office* pOffice );
#endif #endif
...@@ -90,8 +91,9 @@ void TiledRenderingTest::runAllTests() ...@@ -90,8 +91,9 @@ void TiledRenderingTest::runAllTests()
testDocumentLoadFail( pOffice.get() ); testDocumentLoadFail( pOffice.get() );
testDocumentTypes( pOffice.get() ); testDocumentTypes( pOffice.get() );
#if 0
testImpressSlideNames( pOffice.get() ); testImpressSlideNames( pOffice.get() );
testCalcSheetNames( pOffice.get() );
#if 0
testOverlay( pOffice.get() ); testOverlay( pOffice.get() );
#endif #endif
} }
...@@ -142,7 +144,6 @@ void TiledRenderingTest::testDocumentTypes( Office* pOffice ) ...@@ -142,7 +144,6 @@ void TiledRenderingTest::testDocumentTypes( Office* pOffice )
// TODO: do this for all supported document types // TODO: do this for all supported document types
} }
#if 0
void TiledRenderingTest::testImpressSlideNames( Office* pOffice ) void TiledRenderingTest::testImpressSlideNames( Office* pOffice )
{ {
const string sDocPath = m_sSrcRoot + "/libreofficekit/qa/data/impress_slidenames.odp"; const string sDocPath = m_sSrcRoot + "/libreofficekit/qa/data/impress_slidenames.odp";
...@@ -164,6 +165,23 @@ void TiledRenderingTest::testImpressSlideNames( Office* pOffice ) ...@@ -164,6 +165,23 @@ void TiledRenderingTest::testImpressSlideNames( Office* pOffice )
// have a localised version of "Slide 3". // have a localised version of "Slide 3".
} }
void TiledRenderingTest::testCalcSheetNames( Office* pOffice )
{
const string sDocPath = m_sSrcRoot + "/libreofficekit/qa/data/calc_sheetnames.ods";
const string sLockFile = m_sSrcRoot +"/libreofficekit/qa/data/.~lock.calc_sheetnames.ods#";
// FIXME: LOK will fail when trying to open a locked file
remove( sLockFile.c_str() );
scoped_ptr< Document> pDocument( pOffice->documentLoad( sDocPath.c_str() ) );
CPPUNIT_ASSERT( pDocument->getParts() == 3 );
CPPUNIT_ASSERT( strcmp( pDocument->getPartName( 0 ), "TestText1" ) == 0 );
CPPUNIT_ASSERT( strcmp( pDocument->getPartName( 1 ), "TestText2" ) == 0 );
CPPUNIT_ASSERT( strcmp( pDocument->getPartName( 2 ), "Sheet3" ) == 0 );
}
#if 0
static void dumpRGBABitmap( const OUString& rPath, const unsigned char* pBuffer, static void dumpRGBABitmap( const OUString& rPath, const unsigned char* pBuffer,
const int nWidth, const int nHeight ) const int nWidth, const int nHeight )
{ {
......
...@@ -388,6 +388,9 @@ public: ...@@ -388,6 +388,9 @@ public:
/// @see vcl::ITiledRenderable::getParts(). /// @see vcl::ITiledRenderable::getParts().
virtual int getParts() SAL_OVERRIDE; virtual int getParts() SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::getPartName().
virtual OUString getPartName(int nPart) SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::initializeForTiledRendering(). /// @see vcl::ITiledRenderable::initializeForTiledRendering().
virtual void initializeForTiledRendering() SAL_OVERRIDE; virtual void initializeForTiledRendering() SAL_OVERRIDE;
......
...@@ -510,6 +510,14 @@ int ScModelObj::getPart() ...@@ -510,6 +510,14 @@ int ScModelObj::getPart()
return pViewData->GetTabNo(); return pViewData->GetTabNo();
} }
OUString ScModelObj::getPartName( int nPart )
{
OUString sTabName;
ScViewData* pViewData = ScDocShell::GetViewData();
pViewData->GetDocument()->GetName(nPart, sTabName);
return sTabName;
}
Size ScModelObj::getDocumentSize() Size ScModelObj::getDocumentSize()
{ {
Size aSize(10, 10); // minimum size Size aSize(10, 10); // minimum size
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment