sc/CppunitTest_sc_rangelst_test.mk | 16 +++- sc/inc/conditio.hxx | 8 ++ sc/inc/rangelst.hxx | 3 sc/qa/unit/data/xml/universal-content.xml | 119 ++++++++++++++++++++++++++++++ sc/qa/unit/filters-test.cxx | 13 +++ sc/qa/unit/helper/qahelper.cxx | 22 +++++ sc/qa/unit/helper/qahelper.hxx | 11 ++ sc/qa/unit/rangelst_test.cxx | 40 +++++----- sc/qa/unit/ucalc.cxx | 44 +++++++++++ sc/qa/unit/ucalc.hxx | 2 sc/source/core/data/conditio.cxx | 22 +++++ sc/source/core/data/table2.cxx | 9 +- sc/source/core/tool/rangelst.cxx | 62 +++++++++++++++ vcl/source/window/menu.cxx | 4 - 14 files changed, 348 insertions(+), 27 deletions(-)
New commits: commit ce565ff09743c52a08dffc28b9639d657d56bee2 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Thu Sep 5 14:29:29 2013 +0200 add disabled test for Excel 2003 XML import Change-Id: I5c6ff3a79357ce37b220bd7cad64a3783bc7dc55 diff --git a/sc/qa/unit/data/xml/universal-content.xml b/sc/qa/unit/data/xml/universal-content.xml new file mode 100644 index 0000000..828af60 --- /dev/null +++ b/sc/qa/unit/data/xml/universal-content.xml @@ -0,0 +1,119 @@ +<?xml version="1.0"?> +<?mso-application progid="Excel.Sheet"?> +<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40"> + <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"> + <Author>moggi</Author> + <LastAuthor>moggi</LastAuthor> + <Created>2013-09-05T11:50:47Z</Created> + <Version>14.00</Version> + </DocumentProperties> + <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"> + <AllowPNG/> + </OfficeDocumentSettings> + <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> + <WindowHeight>8190</WindowHeight> + <WindowWidth>16380</WindowWidth> + <WindowTopX>0</WindowTopX> + <WindowTopY>0</WindowTopY> + <TabRatio>141</TabRatio> + <ProtectStructure>False</ProtectStructure> + <ProtectWindows>False</ProtectWindows> + </ExcelWorkbook> + <Styles> + <Style ss:ID="Default" ss:Name="Normal"> + <Alignment ss:Vertical="Bottom"/> + <Borders/> + <Font ss:FontName="Arial" x:Family="Swiss"/> + <Interior/> + <NumberFormat/> + <Protection/> + </Style> + </Styles> + <Worksheet ss:Name="Sheet1"> + <Table ss:ExpandedColumnCount="8" ss:ExpandedRowCount="4" x:FullColumns="1" x:FullRows="1" ss:DefaultColumnWidth="60.75"> + <Row> + <Cell> + <Data ss:Type="Number">1</Data> + </Cell> + <Cell> + <Data ss:Type="String">String1</Data> + </Cell> + <Cell ss:Formula="=2*3"> + <Data ss:Type="Number">6</Data> + </Cell> + </Row> + <Row> + <Cell> + <Data ss:Type="Number">2</Data> + </Cell> + <Cell> + <Data ss:Type="String">String2</Data> + </Cell> + <Cell ss:Formula="=2+3"> + <Data ss:Type="Number">5</Data> + </Cell> + <Cell ss:Index="5" ss:MergeAcross="1" ss:MergeDown="1"/> + </Row> + <Row> + <Cell ss:Index="3" ss:Formula="=2-3"> + <Data ss:Type="Number">-1</Data> + </Cell> + <Cell ss:Index="8"> + <Comment ss:Author=""> + <ss:Data xmlns="http://www.w3.org/TR/REC-html40"> + <Font html:Face="Tahoma" x:CharSet="1" html:Size="9" html:Color="#000000">Test</Font> + </ss:Data> + </Comment> + </Cell> + </Row> + <Row> + <Cell ss:Index="3" ss:Formula="=R[-3]C+R[-2]C"> + <Data ss:Type="Number">11</Data> + </Cell> + </Row> + </Table> + <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"> + <PageSetup> + <Layout x:StartPageNumber="1"/> + <Header x:Margin="0.78749999999999998" x:Data="&C&A"/> + <Footer x:Margin="0.78749999999999998" x:Data="&CPage &P"/> + <PageMargins x:Bottom="1.0249999999999999" x:Left="0.78749999999999998" x:Right="0.78749999999999998" x:Top="1.0249999999999999"/> + </PageSetup> + <Print> + <ValidPrinterInfo/> + <HorizontalResolution>300</HorizontalResolution> + <VerticalResolution>300</VerticalResolution> + </Print> + <Selected/> + <Panes> + <Pane> + <Number>3</Number> + <ActiveRow>6</ActiveRow> + <ActiveCol>3</ActiveCol> + </Pane> + </Panes> + <ProtectObjects>False</ProtectObjects> + <ProtectScenarios>False</ProtectScenarios> + <EnableSelection>NoSelection</EnableSelection> + </WorksheetOptions> + </Worksheet> + <Worksheet ss:Name="Sheet2"> + <Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="1" x:FullColumns="1" x:FullRows="1" ss:DefaultColumnWidth="60.75"> + </Table> + <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"> + <PageSetup> + <Header x:Margin="0.78749999999999998" x:Data="&C&A"/> + <Footer x:Margin="0.78749999999999998" x:Data="&CPage &P"/> + <PageMargins x:Bottom="1.0249999999999999" x:Left="0.78749999999999998" x:Right="0.78749999999999998" x:Top="1.0249999999999999"/> + </PageSetup> + <Print> + <ValidPrinterInfo/> + <HorizontalResolution>300</HorizontalResolution> + <VerticalResolution>300</VerticalResolution> + </Print> + <ProtectObjects>False</ProtectObjects> + <ProtectScenarios>False</ProtectScenarios> + <EnableSelection>NoSelection</EnableSelection> + </WorksheetOptions> + </Worksheet> +</Workbook> diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index deb1571..f6b9b0b 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -66,6 +66,7 @@ public: void testContentXLSX(); void testContentLotus123(); void testContentDIF(); + void testContentXLS_XML(); void testSharedFormulaXLS(); void testSharedFormulaXLSX(); #if TEST_BUG_FILES @@ -86,6 +87,7 @@ public: CPPUNIT_TEST(testContentXLSX); CPPUNIT_TEST(testContentLotus123); CPPUNIT_TEST(testContentDIF); + //CPPUNIT_TEST(testContentXLS_XML); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testSharedFormulaXLSX); CPPUNIT_TEST(testLegacyCellAnchoredRotatedShape); @@ -333,6 +335,17 @@ void ScFiltersTest::testContentDIF() xDocSh->DoClose(); } +void ScFiltersTest::testContentXLS_XML() +{ + ScDocShellRef xDocSh = loadDoc("universal-content.", XLS_XML); + CPPUNIT_ASSERT(xDocSh); + + ScDocument* pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(pDoc); + testContentImpl(pDoc, XLS_XML); + xDocSh->DoClose(); +} + void ScFiltersTest::testSharedFormulaXLS() { ScDocShellRef xDocSh = loadDoc("shared-formula.", XLS); diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 2a57213..7c409ef 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -58,6 +58,7 @@ FileFormat aFileFormats[] = { { "html" , "calc_HTML_WebQuery", "generic_HTML", HTML_FORMAT_TYPE }, { "123" , "Lotus", "calc_Lotus", LOTUS123_FORMAT_TYPE }, { "dif", "DIF", "calc_DIF", DIF_FORMAT_TYPE }, + { "xml", "MS Excel 2003 XML", "calc_MS_Excel_2003_XML", XLS_XML_FORMAT_TYPE } }; bool testEqualsWithTolerance( long nVal1, long nVal2, long nTol ) diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index eea4576..3597dd1 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -36,6 +36,7 @@ #define CSV_FORMAT_TYPE (SFX_FILTER_IMPORT | SFX_FILTER_EXPORT | SFX_FILTER_ALIEN | SFX_FILTER_USESOPTIONS) #define HTML_FORMAT_TYPE (SFX_FILTER_IMPORT | SFX_FILTER_EXPORT | SFX_FILTER_ALIEN | SFX_FILTER_USESOPTIONS) #define DIF_FORMAT_TYPE 195 +#define XLS_XML_FORMAT_TYPE (SFX_FILTER_IMPORT | SFX_FILTER_EXPORT | SFX_FILTER_ALIEN) #define ODS 0 #define XLS 1 @@ -44,6 +45,7 @@ #define HTML 4 #define LOTUS123 5 #define DIF 6 +#define XLS_XML 7 enum StringType { PureString, FormulaValue, StringValue }; commit fd2f96c2ff83bee968fec8aa7c402ae02e78e2e4 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Thu Sep 5 13:24:40 2013 +0200 add test case for fdo#67783 Change-Id: I3a8f99e00e12a6120a284afabbf51e6fbb36195b diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index ab227ea..ad98b7d 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -4138,6 +4138,50 @@ void Test::testCondFormatINSDEL() m_pDoc->DeleteTab(0); } +void Test::testCondFormatInsertCol() +{ + m_pDoc->InsertTab(0, "Test"); + ScConditionalFormatList* pList = m_pDoc->GetCondFormList(0); + + ScConditionalFormat* pFormat = new ScConditionalFormat(1, m_pDoc); + ScRangeList aRangeList(ScRange(0,0,0,3,3,0)); + pFormat->AddRange(aRangeList); + + ScCondFormatEntry* pEntry = new ScCondFormatEntry(SC_COND_DIRECT,"=B2","",m_pDoc,ScAddress(0,0,0),ScGlobal::GetRscString(STR_STYLENAME_RESULT)); + pFormat->AddEntry(pEntry); + + m_pDoc->AddCondFormatData(pFormat->GetRange(), 0, 1); + pList->InsertNew(pFormat); + + m_pDoc->InsertCol(0,0,MAXROW,0,4,2); + const ScRangeList& rRange = pFormat->GetRange(); + CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(0,0,0,5,3,0)), rRange); + + m_pDoc->DeleteTab(0); +} + +void Test::testCondFormatInsertRow() +{ + m_pDoc->InsertTab(0, "Test"); + ScConditionalFormatList* pList = m_pDoc->GetCondFormList(0); + + ScConditionalFormat* pFormat = new ScConditionalFormat(1, m_pDoc); + ScRangeList aRangeList(ScRange(0,0,0,3,3,0)); + pFormat->AddRange(aRangeList); + + ScCondFormatEntry* pEntry = new ScCondFormatEntry(SC_COND_DIRECT,"=B2","",m_pDoc,ScAddress(0,0,0),ScGlobal::GetRscString(STR_STYLENAME_RESULT)); + pFormat->AddEntry(pEntry); + + m_pDoc->AddCondFormatData(pFormat->GetRange(), 0, 1); + pList->InsertNew(pFormat); + + m_pDoc->InsertRow(0,0,MAXCOL,0,4,2); + const ScRangeList& rRange = pFormat->GetRange(); + CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(0,0,0,5,5,0)), rRange); + + m_pDoc->DeleteTab(0); +} + void Test::printRange(ScDocument* pDoc, const ScRange& rRange, const char* pCaption) { SCROW nRow1 = rRange.aStart.Row(), nRow2 = rRange.aEnd.Row(); diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index fba750f..9ad69b6 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -271,6 +271,8 @@ public: void testEditTextIterator(); void testCondFormatINSDEL(); + void testCondFormatInsertRow(); + void testCondFormatInsertCol(); CPPUNIT_TEST_SUITE(Test); #if CALC_TEST_PERF commit 6cc31515db179c61ec2269fa9fe939ad6ae7a9bc Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Thu Sep 5 13:41:28 2013 +0200 extract the calc data structure printers for cppunit equal macros Change-Id: I9bb1311f5c4688f66c3eb3f85da599686c95e87a diff --git a/sc/CppunitTest_sc_rangelst_test.mk b/sc/CppunitTest_sc_rangelst_test.mk index a2002c3..5618c04 100644 --- a/sc/CppunitTest_sc_rangelst_test.mk +++ b/sc/CppunitTest_sc_rangelst_test.mk @@ -9,12 +9,26 @@ $(eval $(call gb_CppunitTest_CppunitTest,sc_rangelst_test)) -$(eval $(call gb_CppunitTest_use_external,sc_rangelst_test,boost_headers)) +$(eval $(call gb_CppunitTest_use_externals,sc_rangelst_test, \ + boost_headers \ + icu_headers \ + icudata \ + icui18n \ + icuuc \ + libxml2 \ + mdds_headers \ + orcus \ + orcus-parser \ +)) $(eval $(call gb_CppunitTest_add_exception_objects,sc_rangelst_test, \ sc/qa/unit/rangelst_test \ )) +$(eval $(call gb_CppunitTest_use_library_objects,sc_rangelst_test, \ + scqahelper \ +)) + $(eval $(call gb_CppunitTest_use_libraries,sc_rangelst_test, \ avmedia \ basegfx \ diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 6ba96ce..2a57213 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -29,6 +29,27 @@ using namespace com::sun::star; using namespace ::com::sun::star::uno; +// calc data structure pretty printer +std::ostream& operator<<(std::ostream& rStrm, const ScAddress& rAddr) +{ + rStrm << "Col: " << rAddr.Col() << " Row: " << rAddr.Row() << " Tab: " << rAddr.Tab() << "\n"; + return rStrm; +} + +std::ostream& operator<<(std::ostream& rStrm, const ScRange& rRange) +{ + rStrm << "ScRange: " << rRange.aStart << rRange.aEnd << "\n"; + return rStrm; +} + +std::ostream& operator<<(std::ostream& rStrm, const ScRangeList& rList) +{ + rStrm << "ScRangeList: \n"; + for(size_t i = 0; i < rList.size(); ++i) + rStrm << *rList[i]; + return rStrm; +} + FileFormat aFileFormats[] = { { "ods" , "calc8", "", ODS_FORMAT_TYPE }, { "xls" , "MS Excel 97", "calc_MS_EXCEL_97", XLS_FORMAT_TYPE }, diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index a4966a1..eea4576 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -78,6 +78,15 @@ struct FileFormat { const char* pName; const char* pFilterName; const char* pTypeName; unsigned int nFormatType; }; +// Printers for the calc data structures. Needed for the EQUAL assertion +// macros from CPPUNIT. + +std::ostream& operator<<(std::ostream& rStrm, const ScAddress& rAddr); + +std::ostream& operator<<(std::ostream& rStrm, const ScRange& rRange); + +std::ostream& operator<<(std::ostream& rStrm, const ScRangeList& rList); + // Why is this here and not in osl, and using the already existing file // handling APIs? Do we really want to add arbitrary new file handling // wrappers here and there (and then having to handle the Android (and diff --git a/sc/qa/unit/rangelst_test.cxx b/sc/qa/unit/rangelst_test.cxx index 4281392..afec0d1 100644 --- a/sc/qa/unit/rangelst_test.cxx +++ b/sc/qa/unit/rangelst_test.cxx @@ -9,6 +9,7 @@ #include <sal/config.h> #include <test/bootstrapfixture.hxx> +#include "helper/qahelper.hxx" #include "document.hxx" #include "docsh.hxx" @@ -78,26 +79,6 @@ private: ScDocShellRef m_xDocShRef; }; -static std::ostream& operator<<(std::ostream& rStrm, const ScAddress& rAddr) -{ - rStrm << "Col: " << rAddr.Col() << " Row: " << rAddr.Row() << " Tab: " << rAddr.Tab() << "\n"; - return rStrm; -} - -static std::ostream& operator<<(std::ostream& rStrm, const ScRange& rRange) -{ - rStrm << "ScRange: " << rRange.aStart << rRange.aEnd << "\n"; - return rStrm; -} - -static std::ostream& operator<<(std::ostream& rStrm, const ScRangeList& rList) -{ - rStrm << "ScRangeList: \n"; - for(size_t i = 0; i < rList.size(); ++i) - rStrm << *rList[i]; - return rStrm; -} - void Test::setUp() { BootstrapFixture::setUp(); commit 7169026abcdc42182e7649e5bbf5b247a9575a2f Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Thu Sep 5 13:05:23 2013 +0200 add test cases for new ScRangeList methods Change-Id: Ia17d1eb26ac6ebc54d085ade8edabcaff442de5c diff --git a/sc/qa/unit/rangelst_test.cxx b/sc/qa/unit/rangelst_test.cxx index f543175..4281392 100644 --- a/sc/qa/unit/rangelst_test.cxx +++ b/sc/qa/unit/rangelst_test.cxx @@ -43,6 +43,9 @@ public: void testUpdateReference_DeleteRow(); void testUpdateReference_DeleteCol(); + void testInsertRow(); + void testInsertCol(); + CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testDeleteArea_4Ranges); CPPUNIT_TEST(testDeleteArea_3Ranges); @@ -65,6 +68,8 @@ public: CPPUNIT_TEST(testUpdateReference_DeleteRow); CPPUNIT_TEST(testUpdateReference_DeleteCol); CPPUNIT_TEST(testGetIntersectedRange); + CPPUNIT_TEST(testInsertRow); + CPPUNIT_TEST(testInsertCol); CPPUNIT_TEST_SUITE_END(); @@ -477,6 +482,20 @@ void Test::testGetIntersectedRange() CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(2,2,0,3,3,0)), aIntersecting); } +void Test::testInsertRow() +{ + ScRangeList aList(ScRange(1,1,0,4,4,0)); + aList.InsertRow(0, 0, MAXCOL, 5, 2); + CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(1,1,0,4,6,0)), aList); +} + +void Test::testInsertCol() +{ + ScRangeList aList(ScRange(1,1,0,4,4,0)); + aList.InsertCol(0, 0, MAXROW, 5, 2); + CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(1,1,0,6,4,0)), aList); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit 5d9e062a68eaf7544d02501d7b221150d74f7555 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Thu Sep 5 13:05:53 2013 +0200 increase conditional format range during inserting rows/cols, fdo#67783 Change-Id: Ib74667fb958aa9bbbcae3a0289b3cbd6edf8fb37 diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index 7f50a27..040f237 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -413,6 +413,10 @@ public: void UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt ); void UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt ); void UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt ); + + void InsertRow(SCTAB nTab, SCCOL nColStart, SCCOL nColEnd, SCROW nRowStart, SCSIZE nSize); + void InsertCol(SCTAB nTab, SCROW nRowStart, SCROW nRowEnd, SCCOL nColStart, SCSIZE nSize); + void DeleteArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); void RenameCellStyle( const OUString& rOld, const OUString& rNew ); @@ -478,6 +482,10 @@ public: void UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt ); void UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt ); void UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt ); + + void InsertRow(SCTAB nTab, SCCOL nColStart, SCCOL nColEnd, SCROW nRowStart, SCSIZE nSize); + void InsertCol(SCTAB nTab, SCROW nRowStart, SCROW nRowEnd, SCCOL nColStart, SCSIZE nSize); + void RenameCellStyle( const OUString& rOld, const OUString& rNew ); void DeleteArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx index 9902eab..6ff6150 100644 --- a/sc/inc/rangelst.hxx +++ b/sc/inc/rangelst.hxx @@ -59,6 +59,9 @@ public: SCsTAB nDz ); + void InsertRow( SCTAB nTab, SCCOL nColStart, SCCOL nColEnd, SCROW nRowPos, SCSIZE nSize ); + void InsertCol( SCTAB nTab, SCROW nRowStart, SCROW nRowEnd, SCCOL nColPos, SCSIZE nSize ); + /** For now this method assumes that nTab1 == nTab2 * The algorithm will be much more complicated if nTab1 != nTab2 */ diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 26f561a4..6cc4f1b 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1960,6 +1960,16 @@ void ScConditionalFormat::UpdateReference( sc::RefUpdateContext& rCxt, bool bCop maRanges.UpdateReference(rCxt.meMode, pDoc, rCxt.maRange, rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta); } +void ScConditionalFormat::InsertRow(SCTAB nTab, SCCOL nColStart, SCCOL nColEnd, SCROW nRowPos, SCSIZE nSize) +{ + maRanges.InsertRow(nTab, nColStart, nColEnd, nRowPos, nSize); +} + +void ScConditionalFormat::InsertCol(SCTAB nTab, SCROW nRowStart, SCROW nRowEnd, SCCOL nColPos, SCSIZE nSize) +{ + maRanges.InsertCol(nTab, nRowStart, nRowEnd, nColPos, nSize); +} + void ScConditionalFormat::UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt ) { for (CondFormatContainer::iterator it = maEntries.begin(); it != maEntries.end(); ++it) @@ -2168,6 +2178,18 @@ void ScConditionalFormatList::UpdateReference( sc::RefUpdateContext& rCxt ) } } +void ScConditionalFormatList::InsertRow(SCTAB nTab, SCCOL nColStart, SCCOL nColEnd, SCROW nRowPos, SCSIZE nSize) +{ + for(iterator it = begin(), itEnd = end(); it != itEnd; ++it) + it->InsertRow(nTab, nColStart, nColEnd, nRowPos, nSize); +} + +void ScConditionalFormatList::InsertCol(SCTAB nTab, SCROW nRowStart, SCROW nRowEnd, SCCOL nColPos, SCSIZE nSize) +{ + for(iterator it = begin(), itEnd = end(); it != itEnd; ++it) + it->InsertCol(nTab, nRowStart, nRowEnd, nColPos, nSize); +} + void ScConditionalFormatList::UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt ) { for (iterator it = begin(); it != end(); ++it) diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index da3d423..7bd7ac6 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -218,6 +218,8 @@ void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE aNotes.ReleaseNote( nCol, nRow); } + mpCondFormatList->InsertRow(nTab, nStartCol, nEndCol, nStartRow, nSize); + InvalidatePageBreaks(); if (IsStreamValid()) @@ -425,10 +427,9 @@ void ScTable::InsertCol( if (nStartCol>0) // copy old attributes { - sal_uInt16 nWhichArray[3]; + sal_uInt16 nWhichArray[2]; nWhichArray[0] = ATTR_MERGE; - nWhichArray[1] = ATTR_CONDITIONAL; - nWhichArray[2] = 0; + nWhichArray[1] = 0; sc::CopyToDocContext aCxt(*pDocument); for (SCSIZE i=0; i<nSize; i++) @@ -441,6 +442,8 @@ void ScTable::InsertCol( } } + mpCondFormatList->InsertCol(nTab, nStartRow, nEndRow, nStartCol, nSize); + InvalidatePageBreaks(); if (IsStreamValid()) diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index 8abb347..00a9ca0 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -459,6 +459,68 @@ bool ScRangeList::UpdateReference( return bChanged; } +void ScRangeList::InsertRow( SCTAB nTab, SCCOL nColStart, SCCOL nColEnd, SCROW nRowPos, SCSIZE nSize ) +{ + std::vector<ScRange> aNewRanges; + for(iterator it = maRanges.begin(), itEnd = maRanges.end(); it != itEnd; + ++it) + { + ScRange* pRange = *it; + if(pRange->aStart.Tab() <= nTab && pRange->aEnd.Tab() >= nTab) + { + if(pRange->aEnd.Row() == nRowPos - 1 && (nColStart <= pRange->aEnd.Col() || nColEnd >= pRange->aStart.Col())) + { + SCCOL nNewRangeStartCol = std::max<SCCOL>(nColStart, pRange->aStart.Col()); + SCCOL nNewRangeEndCol = std::min<SCCOL>(nColEnd, pRange->aEnd.Col()); + SCROW nNewRangeStartRow = pRange->aEnd.Row() + 1; + SCROW nNewRangeEndRow = nRowPos + nSize - 1; + aNewRanges.push_back(ScRange(nNewRangeStartCol, nNewRangeStartRow, nTab, nNewRangeEndCol, + nNewRangeEndRow, nTab)); + } + } + } + + for(std::vector<ScRange>::const_iterator it = aNewRanges.begin(), itEnd = aNewRanges.end(); + it != itEnd; ++it) + { + if(!it->IsValid()) + continue; + + Join(*it); + } +} + +void ScRangeList::InsertCol( SCTAB nTab, SCROW nRowStart, SCROW nRowEnd, SCCOL nColPos, SCSIZE nSize ) +{ + std::vector<ScRange> aNewRanges; + for(iterator it = maRanges.begin(), itEnd = maRanges.end(); it != itEnd; + ++it) + { + ScRange* pRange = *it; + if(pRange->aStart.Tab() <= nTab && pRange->aEnd.Tab() >= nTab) + { + if(pRange->aEnd.Col() == nColPos - 1 && (nRowStart <= pRange->aEnd.Row() || nRowEnd >= pRange->aStart.Row())) + { + SCROW nNewRangeStartRow = std::max<SCROW>(nRowStart, pRange->aStart.Row()); + SCROW nNewRangeEndRow = std::min<SCROW>(nRowEnd, pRange->aEnd.Row()); + SCCOL nNewRangeStartCol = pRange->aEnd.Col() + 1; + SCCOL nNewRangeEndCol = nColPos + nSize - 1; + aNewRanges.push_back(ScRange(nNewRangeStartCol, nNewRangeStartRow, nTab, nNewRangeEndCol, + nNewRangeEndRow, nTab)); + } + } + } + + for(std::vector<ScRange>::const_iterator it = aNewRanges.begin(), itEnd = aNewRanges.end(); + it != itEnd; ++it) + { + if(!it->IsValid()) + continue; + + Join(*it); + } +} + namespace { /** commit dcc05d40c6fdb41a4193072d6b72456d75269ba3 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Wed Sep 4 10:44:14 2013 +0200 this assert is too strong Change-Id: I130996a78695b38eb200a2b22a68e0aca575e3af diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 69625d6..a62f87a 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2007,9 +2007,7 @@ OUString Menu::ImplGetHelpText( sal_uInt16 nItemId ) const { MenuItemData* pData = pItemList->GetData( nItemId ); - assert ( pData ); - - if ( pData->aHelpText.isEmpty() && + if ( pData && pData->aHelpText.isEmpty() && (( !pData->aHelpId.isEmpty() ) || ( !pData->aCommandStr.isEmpty() ))) { if ( pData->aHelpText.isEmpty() && _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits