Kaydet (Commit) 7010edf9 authored tarafından Ilhan Yesil's avatar Ilhan Yesil Kaydeden (comit) Katarina Behrens

tdf#117287 When saving as Xlsx, export visible flag if comment is visble

The visible flag will be exported now, when a comment is visible and
the file is saved as Xlsx.

Change-Id: Id05ab5f94ea85f48db123d1043ecdc4813a64382
Reviewed-on: https://gerrit.libreoffice.org/59934
Tested-by: Jenkins
Reviewed-by: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>
üst bfe16245
...@@ -121,6 +121,7 @@ public: ...@@ -121,6 +121,7 @@ public:
void testFormatExportODS(); void testFormatExportODS();
void testCommentExportXLSX(); void testCommentExportXLSX();
void testCommentExportXLSX_2_XLSX();
#if HAVE_MORE_FONTS #if HAVE_MORE_FONTS
void testCustomColumnWidthExportXLSX(); void testCustomColumnWidthExportXLSX();
#endif #endif
...@@ -242,8 +243,8 @@ public: ...@@ -242,8 +243,8 @@ public:
CPPUNIT_TEST(testCellNoteExportODS); CPPUNIT_TEST(testCellNoteExportODS);
CPPUNIT_TEST(testCellNoteExportXLS); CPPUNIT_TEST(testCellNoteExportXLS);
CPPUNIT_TEST(testFormatExportODS); CPPUNIT_TEST(testFormatExportODS);
CPPUNIT_TEST(testCommentExportXLSX); CPPUNIT_TEST(testCommentExportXLSX);
CPPUNIT_TEST(testCommentExportXLSX_2_XLSX);
#if HAVE_MORE_FONTS #if HAVE_MORE_FONTS
CPPUNIT_TEST(testCustomColumnWidthExportXLSX); CPPUNIT_TEST(testCustomColumnWidthExportXLSX);
#endif #endif
...@@ -698,8 +699,10 @@ void ScExportTest::testCommentExportXLSX() ...@@ -698,8 +699,10 @@ void ScExportTest::testCommentExportXLSX()
ScDocShellRef xShell = loadDoc("comment.", FORMAT_ODS); ScDocShellRef xShell = loadDoc("comment.", FORMAT_ODS);
CPPUNIT_ASSERT(xShell.is()); CPPUNIT_ASSERT(xShell.is());
std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); std::shared_ptr<utl::TempFile> pXPathFile
const xmlDocPtr pComments = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/comments1.xml"); = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
const xmlDocPtr pComments
= XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/comments1.xml");
CPPUNIT_ASSERT(pComments); CPPUNIT_ASSERT(pComments);
assertXPath(pComments, "/x:comments/x:authors/x:author[1]", "BAKO"); assertXPath(pComments, "/x:comments/x:authors/x:author[1]", "BAKO");
...@@ -707,7 +710,8 @@ void ScExportTest::testCommentExportXLSX() ...@@ -707,7 +710,8 @@ void ScExportTest::testCommentExportXLSX()
assertXPath(pComments, "/x:comments/x:commentList/x:comment/x:text/x:r/x:t", "Komentarz"); assertXPath(pComments, "/x:comments/x:commentList/x:comment/x:text/x:r/x:t", "Komentarz");
const xmlDocPtr pVmlDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/vmlDrawing1.vml"); const xmlDocPtr pVmlDrawing
= XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/vmlDrawing1.vml");
CPPUNIT_ASSERT(pVmlDrawing); CPPUNIT_ASSERT(pVmlDrawing);
//assertXPath(pVmlDrawing, "/xml/v:shapetype", "coordsize", "21600,21600"); //assertXPath(pVmlDrawing, "/xml/v:shapetype", "coordsize", "21600,21600");
...@@ -720,6 +724,37 @@ void ScExportTest::testCommentExportXLSX() ...@@ -720,6 +724,37 @@ void ScExportTest::testCommentExportXLSX()
assertXPath(pVmlDrawing, "/xml/v:shape/v:shadow", "obscured", "t"); assertXPath(pVmlDrawing, "/xml/v:shape/v:shadow", "obscured", "t");
} }
void ScExportTest::testCommentExportXLSX_2_XLSX()
{
//tdf#117287 FILESAVE XLSX: Comments always disappear after opening the exported XLSX file with Excel
ScDocShellRef xShell = loadDoc("tdf117287_comment.", FORMAT_XLSX);
CPPUNIT_ASSERT(xShell.is());
ScDocument& rDoc = xShell->GetDocument();
ScAddress aPosC9(2, 8, 0);
ScPostIt *pNote = rDoc.GetNote(aPosC9);
CPPUNIT_ASSERT(pNote);
CPPUNIT_ASSERT(!pNote->IsCaptionShown());
pNote->ShowCaption(aPosC9, true);
std::shared_ptr<utl::TempFile> pXPathFile
= ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
const xmlDocPtr pComments
= XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/comments1.xml");
CPPUNIT_ASSERT(pComments);
assertXPath(pComments, "/x:comments/x:commentList/x:comment/x:text/x:r/x:t", "visible comment");
const xmlDocPtr pVmlDrawing
= XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/vmlDrawing1.vml");
CPPUNIT_ASSERT(pVmlDrawing);
assertXPath(pVmlDrawing, "/xml/v:shape/x:ClientData/x:Visible", 0);
}
#if HAVE_MORE_FONTS #if HAVE_MORE_FONTS
void ScExportTest::testCustomColumnWidthExportXLSX() void ScExportTest::testCustomColumnWidthExportXLSX()
{ {
......
...@@ -537,22 +537,10 @@ static void lcl_FillProps( EscherPropertyContainer& rPropOpt, SdrObject* pCaptio ...@@ -537,22 +537,10 @@ static void lcl_FillProps( EscherPropertyContainer& rPropOpt, SdrObject* pCaptio
if( !rPropOpt.GetOpt( ESCHER_Prop_FitTextToShape, nValue ) ) if( !rPropOpt.GetOpt( ESCHER_Prop_FitTextToShape, nValue ) )
rPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x00080008 ); // bool field rPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x00080008 ); // bool field
if( rPropOpt.GetOpt( ESCHER_Prop_fillColor, nValue ) ) // Maybe the colour is the same as the 'ToolTip' System colour, but the tooltip
{ // colour shouldn't have influence on the fill colour of the exported shape
// If the Colour is the same as the 'ToolTip' System colour then if( !rPropOpt.GetOpt( ESCHER_Prop_fillColor, nValue ) )
// use the default rather than the explicit colour value. This will rPropOpt.AddOpt( ESCHER_Prop_fillColor, 0x08000050 );
// be incorrect where user has chosen to use this colour explicitly.
Color aColor( static_cast<sal_uInt8>(nValue), static_cast<sal_uInt8>( nValue >> 8 ), static_cast<sal_uInt8>( nValue >> 16 ) );
const StyleSettings& rSett = Application::GetSettings().GetStyleSettings();
if( aColor == rSett.GetHelpColor() )
{
rPropOpt.AddOpt( ESCHER_Prop_fillColor, 0x08000050 );
rPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0x08000050 );
}
}
else
rPropOpt.AddOpt( ESCHER_Prop_fillColor, 0x08000050 );
if( !rPropOpt.GetOpt( ESCHER_Prop_fillBackColor, nValue ) ) if( !rPropOpt.GetOpt( ESCHER_Prop_fillBackColor, nValue ) )
rPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0x08000050 ); rPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0x08000050 );
if( !rPropOpt.GetOpt( ESCHER_Prop_fNoFillHitTest, nValue ) ) if( !rPropOpt.GetOpt( ESCHER_Prop_fNoFillHitTest, nValue ) )
...@@ -682,7 +670,10 @@ void VmlCommentExporter::EndShape( sal_Int32 nShapeElement ) ...@@ -682,7 +670,10 @@ void VmlCommentExporter::EndShape( sal_Int32 nShapeElement )
XclXmlUtils::WriteElement( pVmlDrawing, FSNS( XML_x, XML_Anchor ), pAnchor ); XclXmlUtils::WriteElement( pVmlDrawing, FSNS( XML_x, XML_Anchor ), pAnchor );
XclXmlUtils::WriteElement( pVmlDrawing, FSNS( XML_x, XML_AutoFill ), "False" ); XclXmlUtils::WriteElement( pVmlDrawing, FSNS( XML_x, XML_AutoFill ), "False" );
XclXmlUtils::WriteElement( pVmlDrawing, FSNS( XML_x, XML_Row ), maScPos.Row() ); XclXmlUtils::WriteElement( pVmlDrawing, FSNS( XML_x, XML_Row ), maScPos.Row() );
XclXmlUtils::WriteElement( pVmlDrawing, FSNS( XML_x, XML_Column ), sal_Int32( maScPos.Col() ) ); XclXmlUtils::WriteElement( pVmlDrawing, FSNS(XML_x, XML_Column), sal_Int32(maScPos.Col()));
if(mbVisible)
pVmlDrawing->singleElement( FSNS(XML_x, XML_Visible),
FSEND);
pVmlDrawing->endElement( FSNS( XML_x, XML_ClientData ) ); pVmlDrawing->endElement( FSNS( XML_x, XML_ClientData ) );
VMLExport::EndShape( nShapeElement ); VMLExport::EndShape( nShapeElement );
......
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