diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-09-18 22:19:11 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-09-18 22:51:18 -0400 |
commit | caa14121ea46982a97951728f08acb2dd5a97470 (patch) | |
tree | 6b90922979147d6c939f24c1e1c8b41249d35b89 /chart2 | |
parent | 312d1a5b443558c643fe4d2044909705749ccef0 (diff) |
Scope level reduction.
Change-Id: I02701e70c064fe0378ff3bfc1c31365f7fba33cc
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/view/main/DrawModelWrapper.cxx | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx index fef6cabb308c..d917ee16aadd 100644 --- a/chart2/source/view/main/DrawModelWrapper.cxx +++ b/chart2/source/view/main/DrawModelWrapper.cxx @@ -204,24 +204,27 @@ uno::Reference< lang::XMultiServiceFactory > DrawModelWrapper::getShapeFactory() uno::Reference< drawing::XDrawPage > DrawModelWrapper::getMainDrawPage() { - //create draw page: - if( !m_xMainDrawPage.is() ) + if (m_xMainDrawPage.is()) + return m_xMainDrawPage; + + // Create draw page. + uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSuplier(getUnoModel(), uno::UNO_QUERY); + if (!xDrawPagesSuplier.is()) + return m_xMainDrawPage; + + uno::Reference<drawing::XDrawPages> xDrawPages = xDrawPagesSuplier->getDrawPages(); + if (xDrawPages->getCount() > 1) { - uno::Reference< drawing::XDrawPagesSupplier > xDrawPagesSuplier( this->getUnoModel(), uno::UNO_QUERY ); - if( xDrawPagesSuplier.is() ) - { - uno::Reference< drawing::XDrawPages > xDrawPages( xDrawPagesSuplier->getDrawPages () ); - if( xDrawPages->getCount()>1 ) - { - uno::Any aPage = xDrawPages->getByIndex( 0 ) ; - aPage >>= m_xMainDrawPage; - } - if(!m_xMainDrawPage.is()) - { - m_xMainDrawPage = xDrawPages->insertNewByIndex( 0 ); - } - } + // Take the first page in case of multiple pages. + uno::Any aPage = xDrawPages->getByIndex(0); + aPage >>= m_xMainDrawPage; } + + if (!m_xMainDrawPage.is()) + { + m_xMainDrawPage = xDrawPages->insertNewByIndex(0); + } + //ensure that additional shapes are in front of the chart objects so create the chart root before // let us disable this call for now // TODO:moggi |