[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/qa sc/source

2016-06-23 Thread Caolán McNamara
 sc/qa/unit/ucalc.cxx |6 ++
 sc/source/core/data/column4.cxx  |1 +
 sc/source/ui/unoobj/cellsuno.cxx |   10 ++
 3 files changed, 17 insertions(+)

New commits:
commit 28e3843433c3dfa04aae70c3c0516911ee80bf69
Author: Caolán McNamara 
Date:   Thu Jun 23 10:24:49 2016 +0100

Resolves: tdf#100460 queryContentCells doesn't count annotations...

since

commit c06dbbe7594c2a0b5a5b19f8e183d9c421e6e094
Author: Markus Mohrhard 
Date:   Thu Feb 23 23:36:49 2012 +0100

remove mpNote from ScBaseCell

(cherry picked from commit 83f977c7f40d1a5fb975b8ce7c9958c992dba3f1)

Related: tdf#100460 GetNotesInRange doesn't count last cell in range

e.g. open document from tdf#100460 and select select A20:A21 and right click
and there is a hide comment entry. Shrink the selection to just A20 (which 
has
the comment in it) and the right click menu has no hide comment entry in it.

std::for_each(it, itEnd

means it < itEnd but here we want the rows indicated by

nStartRow <= nEndRow

so we need to increment itEnd by one to get the right range

(cherry picked from commit 84dc0157df9cb173ec74da2bd27507329efc3816)

Change-Id: I281a207e26aec8886b1f46b9279e1135b61586da
48e8c0748f520671e09f04b16961bf9729960317
Reviewed-on: https://gerrit.libreoffice.org/26614
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 337a4ef..e8f0f0a 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -5259,6 +5259,12 @@ void Test::testNoteCopyPaste()
 CPPUNIT_ASSERT(pNote);
 CPPUNIT_ASSERT_EQUAL(OUString("Note2"), pNote->GetText());
 
+// Test that GetNotesInRange includes the end of its range
+// and so can find the note
+std::vector aNotes;
+m_pDoc->GetNotesInRange(ScRange(1,7,0), aNotes);
+CPPUNIT_ASSERT_EQUAL(size_t(1), aNotes.size());
+
 m_pDoc->DeleteTab(0);
 }
 
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 6134eef..4c42a7d 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -700,6 +700,7 @@ void ScColumn::GetNotesInRange(SCROW nStartRow, SCROW 
nEndRow,
 std::pair aEndPos =
 maCellNotes.position(nEndRow);
 sc::CellNoteStoreType::const_iterator itEnd = aEndPos.first;
+std::advance(itEnd, 1);
 
 std::for_each(it, itEnd, NoteEntryCollector(rNotes, nTab, nCol, nStartRow, 
nEndRow));
 }
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 776a918..3bf6646 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -3600,7 +3600,17 @@ uno::Reference SAL_CALL 
ScCellRangesBase::queryContentC
 if (bAdd)
 aMarkData.SetMultiMarkArea(aIter.GetPos());
 }
+}
+
+if (nContentFlags & sheet::CellFlags::ANNOTATION)
+{
+std::vector aNotes;
+rDoc.GetNotesInRange(aRanges, aNotes);
 
+for (const auto& i : aNotes)
+{
+aMarkData.SetMultiMarkArea(i.maPos);
+}
 }
 
 ScRangeList aNewRanges;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/qa sc/source

2016-03-14 Thread Katarina Behrens
 sc/qa/unit/data/xls/cellformat.xls|binary
 sc/qa/unit/subsequent_export-test.cxx |   17 +
 sc/source/filter/excel/xestring.cxx   |   11 ++-
 sc/source/filter/excel/xetable.cxx|   25 ++---
 sc/source/filter/inc/xestring.hxx |4 +++-
 5 files changed, 44 insertions(+), 13 deletions(-)

New commits:
commit a2007d436e41db65374ced89039000a732a04dee
Author: Katarina Behrens 
Date:   Mon Feb 29 11:23:33 2016 +0100

tdf#98083: Always save cell format

it was pretty bad idea not to save it for rich-formatted cells
(tdf#92296) as there is more to cell format than just a font

Due to a bug in xpath helper I'm backporting only part of the test

(cherry picked from commit 7945cdf0ea570302a04550540848c03c0cd030ab)

Change-Id: I0e5e7d7187c69519bb8f4de2b627e385fccd3d46
Reviewed-on: https://gerrit.libreoffice.org/23032
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sc/qa/unit/data/xls/cellformat.xls 
b/sc/qa/unit/data/xls/cellformat.xls
new file mode 100644
index 000..bdb6c30
Binary files /dev/null and b/sc/qa/unit/data/xls/cellformat.xls differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 475570e..388d6ae 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -100,6 +100,7 @@ public:
 void testMiscRowHeightExport();
 void testNamedRangeBugfdo62729();
 void testRichTextExportODS();
+void testRichTextCellFormat();
 void testFormulaRefSheetNameODS();
 
 void testCellValuesExportODS();
@@ -174,6 +175,7 @@ public:
 CPPUNIT_TEST(testMiscRowHeightExport);
 CPPUNIT_TEST(testNamedRangeBugfdo62729);
 CPPUNIT_TEST(testRichTextExportODS);
+CPPUNIT_TEST(testRichTextCellFormat);
 CPPUNIT_TEST(testFormulaRefSheetNameODS);
 CPPUNIT_TEST(testCellValuesExportODS);
 CPPUNIT_TEST(testCellNoteExportODS);
@@ -1012,6 +1014,21 @@ void ScExportTest::testRichTextExportODS()
 xNewDocSh3->DoClose();
 }
 
+void ScExportTest::testRichTextCellFormat()
+{
+ScDocShellRef xDocSh = loadDoc("cellformat.", FORMAT_XLS);
+CPPUNIT_ASSERT(xDocSh.Is());
+
+xmlDocPtr pSheet = XPathHelper::parseExport(&(*xDocSh), m_xSFactory, 
"xl/worksheets/sheet1.xml", FORMAT_XLSX);
+CPPUNIT_ASSERT(pSheet);
+
+// make sure the only cell in this doc is assigned some formatting record
+OUString aCellFormat = getXPath(pSheet, 
"/x:worksheet/x:sheetData/x:row/x:c", "s");
+CPPUNIT_ASSERT_MESSAGE("Cell format is missing", !aCellFormat.isEmpty());
+
+xDocSh->DoClose();
+}
+
 void ScExportTest::testFormulaRefSheetNameODS()
 {
 ScDocShellRef xDocSh = loadDoc("formula-quote-in-sheet-name.", FORMAT_ODS, 
true);
diff --git a/sc/source/filter/excel/xestring.cxx 
b/sc/source/filter/excel/xestring.cxx
index 58d1acef..7e87879 100644
--- a/sc/source/filter/excel/xestring.cxx
+++ b/sc/source/filter/excel/xestring.cxx
@@ -178,12 +178,21 @@ void XclExpString::LimitFormatCount( sal_uInt16 nMaxCount 
)
 maFormats.erase( maFormats.begin() + nMaxCount, maFormats.end() );
 }
 
-sal_uInt16 XclExpString::RemoveLeadingFont()
+sal_uInt16 XclExpString::GetLeadingFont()
 {
 sal_uInt16 nFontIdx = EXC_FONT_NOTFOUND;
 if( !maFormats.empty() && (maFormats.front().mnChar == 0) )
 {
 nFontIdx = maFormats.front().mnFontIdx;
+}
+return nFontIdx;
+}
+
+sal_uInt16 XclExpString::RemoveLeadingFont()
+{
+sal_uInt16 nFontIdx = GetLeadingFont();
+if( nFontIdx != EXC_FONT_NOTFOUND )
+{
 maFormats.erase( maFormats.begin() );
 }
 return nFontIdx;
diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index 866c9ab..a13395b 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -724,18 +724,21 @@ void XclExpLabelCell::Init( const XclExpRoot& rRoot,
 mnSstIndex = 0;
 
 const XclFormatRunVec& rFormats = mxText->GetFormats();
-// Create the cell format and remove formatting of the leading run
-// if the entire string is equally formatted
+// remove formatting of the leading run if the entire string
+// is equally formatted
+sal_uInt16 nXclFont = EXC_FONT_NOTFOUND;
 if( rFormats.size() == 1 )
-{
-sal_uInt16 nXclFont = mxText->RemoveLeadingFont();
-if( GetXFId() == EXC_XFID_NOTFOUND )
-{
-OSL_ENSURE( nXclFont != EXC_FONT_NOTFOUND, "XclExpLabelCell::Init 
- leading font not found" );
-bool bForceLineBreak = mxText->IsWrapped();
-SetXFId( rRoot.GetXFBuffer().InsertWithFont( pPattern, 
ApiScriptType::WEAK, nXclFont, bForceLineBreak ) );
-}
-}
+nXclFont = mxText->RemoveLeadingFont();
+else
+nXclFont = mxText->GetLeadingFont();
+
+   // create cell format
+   if(