Fix another broadcaster bug and a test code to catch it.

Broadcasters are now independent of cell storage. We need to move them
even when the cell array is empty.

Change-Id: Ib26e544ad6e3842fa722d989c994c19d7c1b3005
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 9941815..ffb2c47 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1643,6 +1643,19 @@ void Test::testCellBroadcaster()
    pBC = m_pDoc->GetBroadcaster(ScAddress(1,2,0));
    CPPUNIT_ASSERT_MESSAGE("Broadcaster in B3 should have been removed.", !pBC);

    // Clear everything and start over.
    clearRange(m_pDoc, ScRange(0,0,0,10,100,0));

    m_pDoc->SetString(ScAddress(1,0,0), "=A1"); // B1 depends on A1.
    pBC = m_pDoc->GetBroadcaster(ScAddress(0,0,0));
    CPPUNIT_ASSERT_MESSAGE("Broadcaster should exist in A1.", pBC);

    // While column A is still empty, move column A down 2 cells. This should
    // move the broadcaster from A1 to A3.
    m_pDoc->InsertRow(0, 0, 0, 0, 0, 2);
    pBC = m_pDoc->GetBroadcaster(ScAddress(0,2,0));
    CPPUNIT_ASSERT_MESSAGE("Broadcaster should exist in A3.", pBC);

    m_pDoc->DeleteTab(0);
}

diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 297fd66..1ffa949 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1121,7 +1121,8 @@ void ScColumn::InsertRow( SCROW nStartRow, SCSIZE nSize )
{
    pAttrArray->InsertRow( nStartRow, nSize );

    //! Search
    maBroadcasters.insert_empty(nStartRow, nSize);
    maBroadcasters.resize(MAXROWCOUNT);

    if ( maItems.empty() )
        return;
@@ -1225,8 +1226,6 @@ void ScColumn::InsertRow( SCROW nStartRow, SCSIZE nSize )
    maTextWidths.resize(MAXROWCOUNT);
    maScriptTypes.insert_empty(nStartRow, nSize);
    maScriptTypes.resize(MAXROWCOUNT);
    maBroadcasters.insert_empty(nStartRow, nSize);
    maBroadcasters.resize(MAXROWCOUNT);

    CellStorageModified();
}