[Libreoffice-commits] core.git: 2 commits - chart2/inc chart2/source sc/inc sc/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Fri Jun 27 01:10:08 PDT 2014
chart2/inc/ChartView.hxx | 1
chart2/source/model/main/ChartModel.cxx | 2 +
chart2/source/view/main/ChartView.cxx | 37 ++++++++++++++++++++++++++++----
sc/inc/document.hxx | 1
sc/source/core/data/document.cxx | 26 ++++++++++++++++++++++
5 files changed, 63 insertions(+), 4 deletions(-)
New commits:
commit ce05c5e4b0b0b9e910b4d90013a993395dd9ed8c
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Jun 26 14:19:28 2014 +0200
fix incorrect ScAnnotationsObj UNO API, fdo#80551
The used index was a sheet local index but the returned position was
from a global container.
Change-Id: I0b9e9e7e9618c72daf8e6417bca9d3a1cb23abb1
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 00649b7..d7f8752 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -951,6 +951,7 @@ public:
void ForgetNoteCaptions( const ScRangeList& rRanges );
ScAddress GetNotePosition( size_t nIndex ) const;
+ ScAddress GetNotePosition( size_t nIndex, SCTAB nTab ) const;
SCROW GetNotePosition( SCTAB nTab, SCCOL nCol, size_t nIndex ) const;
SC_DLLPUBLIC void GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const;
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 30b9a75..e68758c 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -6097,6 +6097,32 @@ ScAddress ScDocument::GetNotePosition( size_t nIndex ) const
return ScAddress(ScAddress::INITIALIZE_INVALID);
}
+ScAddress ScDocument::GetNotePosition( size_t nIndex, SCTAB nTab ) const
+{
+ for (SCCOL nCol=0; nCol<MAXCOLCOUNT; nCol++)
+ {
+ size_t nColNoteCount = GetNoteCount(nTab, nCol);
+ if (!nColNoteCount)
+ continue;
+
+ if (nIndex >= nColNoteCount)
+ {
+ nIndex -= nColNoteCount;
+ continue;
+ }
+
+ SCROW nRow = GetNotePosition(nTab, nCol, nIndex);
+ if (nRow >= 0)
+ return ScAddress(nCol, nRow, nTab);
+
+ OSL_FAIL("note not found");
+ return ScAddress(ScAddress::INITIALIZE_INVALID);
+ }
+
+ OSL_FAIL("note not found");
+ return ScAddress(ScAddress::INITIALIZE_INVALID);
+}
+
SCROW ScDocument::GetNotePosition( SCTAB nTab, SCCOL nCol, size_t nIndex ) const
{
const ScTable* pTab = FetchTable(nTab);
commit 355c3cbb16b0bab705050dd24205878bcecd5687
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Jun 26 13:47:38 2014 +0200
fix invalid memory access in chart tests
Change-Id: I056101d146c939ff958c83efc57fd110e8d52509
diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx
index d69aa9f8..4f2b961 100644
--- a/chart2/inc/ChartView.hxx
+++ b/chart2/inc/ChartView.hxx
@@ -197,6 +197,7 @@ public:
std::exception) SAL_OVERRIDE;
void setViewDirty();
+ void updateOpenGLWindow();
private: //methods
ChartView();
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index 02c12347..e127cf3 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -1429,6 +1429,8 @@ void ChartModel::update()
mpChartView->setViewDirty();
mpChartView->update();
+ if(mpChartView)
+ mpChartView->updateOpenGLWindow();
}
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 9142b3e..116791a 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -165,22 +165,25 @@ public:
virtual void mouseDragMove(const Point& rBegin, const Point& rEnd, sal_uInt16 nButton) SAL_OVERRIDE;
virtual void scroll(long nDelta) SAL_OVERRIDE;
virtual void contextDestroyed() SAL_OVERRIDE;
+
+ void updateOpenGLWindow();
private:
ChartView* mpView;
bool mbContextDestroyed;
+ OpenGLWindow* mpWindow;
};
GL2DRenderer::GL2DRenderer(ChartView* pView):
mpView(pView),
- mbContextDestroyed(false)
+ mbContextDestroyed(false),
+ mpWindow(mpView->mrChartModel.getOpenGLWindow())
{
}
GL2DRenderer::~GL2DRenderer()
{
- OpenGLWindow* pWindow = mpView->mrChartModel.getOpenGLWindow();
- if(!mbContextDestroyed &&pWindow)
- pWindow->setRenderer(NULL);
+ if(!mbContextDestroyed && mpWindow)
+ mpWindow->setRenderer(NULL);
}
void GL2DRenderer::update()
@@ -205,6 +208,27 @@ void GL2DRenderer::contextDestroyed()
mbContextDestroyed = true;
}
+void GL2DRenderer::updateOpenGLWindow()
+{
+ if(mbContextDestroyed)
+ return;
+
+ OpenGLWindow* pWindow = mpView->mrChartModel.getOpenGLWindow();
+ if(pWindow != mpWindow)
+ {
+ if(mpWindow)
+ {
+ mpWindow->setRenderer(NULL);
+ }
+
+ if(pWindow)
+ {
+ pWindow->setRenderer(this);
+ }
+ }
+ mpWindow = pWindow;
+}
+
const uno::Sequence<sal_Int8>& ExplicitValueProvider::getUnoTunnelId()
{
return theExplicitValueProviderUnoTunnelId::get().getSeq();
@@ -3256,6 +3280,11 @@ void ChartView::createShapes3D()
m_pGL3DPlotter->render();
}
+void ChartView::updateOpenGLWindow()
+{
+ mp2DRenderer->updateOpenGLWindow();
+}
+
} //namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list