fdo#79676: Initialize with a default chart only from the UI.
When creating an embedded chart object during import, we don't want to create a default chart which would only mess up the chart data. With this change, ChartModel::initNew() is a no-op. Change-Id: Id29659c3885ec1e06bed26d2c851123fb63072cc
This commit is contained in:
parent
1785509235
commit
c5539bb585
@ -223,6 +223,8 @@ private:
|
|||||||
void impl_adjustAdditionalShapesPositionAndSize(
|
void impl_adjustAdditionalShapesPositionAndSize(
|
||||||
const ::com::sun::star::awt::Size& aVisualAreaSize );
|
const ::com::sun::star::awt::Size& aVisualAreaSize );
|
||||||
|
|
||||||
|
void insertDefaultChart();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//no default constructor
|
//no default constructor
|
||||||
ChartModel(::com::sun::star::uno::Reference<
|
ChartModel(::com::sun::star::uno::Reference<
|
||||||
@ -434,6 +436,8 @@ public:
|
|||||||
getPageBackground()
|
getPageBackground()
|
||||||
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
||||||
|
|
||||||
|
virtual void SAL_CALL createDefaultChart() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
||||||
|
|
||||||
// ____ XDataReceiver (public API) ____
|
// ____ XDataReceiver (public API) ____
|
||||||
virtual void SAL_CALL
|
virtual void SAL_CALL
|
||||||
attachDataProvider( const ::com::sun::star::uno::Reference<
|
attachDataProvider( const ::com::sun::star::uno::Reference<
|
||||||
|
@ -958,6 +958,12 @@ uno::Reference< beans::XPropertySet > SAL_CALL ChartModel::getPageBackground()
|
|||||||
return m_xPageBackground;
|
return m_xPageBackground;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SAL_CALL ChartModel::createDefaultChart()
|
||||||
|
throw (css::uno::RuntimeException, std::exception)
|
||||||
|
{
|
||||||
|
insertDefaultChart();
|
||||||
|
}
|
||||||
|
|
||||||
// ____ XTitled ____
|
// ____ XTitled ____
|
||||||
uno::Reference< chart2::XTitle > SAL_CALL ChartModel::getTitleObject()
|
uno::Reference< chart2::XTitle > SAL_CALL ChartModel::getTitleObject()
|
||||||
throw (uno::RuntimeException, std::exception)
|
throw (uno::RuntimeException, std::exception)
|
||||||
|
@ -385,12 +385,7 @@ void ChartModel::impl_store(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// frame::XLoadable
|
void ChartModel::insertDefaultChart()
|
||||||
void SAL_CALL ChartModel::initNew()
|
|
||||||
throw (frame::DoubleInitializationException,
|
|
||||||
io::IOException,
|
|
||||||
uno::Exception,
|
|
||||||
uno::RuntimeException, std::exception)
|
|
||||||
{
|
{
|
||||||
lockControllers();
|
lockControllers();
|
||||||
createInternalDataProvider( sal_False );
|
createInternalDataProvider( sal_False );
|
||||||
@ -486,6 +481,15 @@ void SAL_CALL ChartModel::initNew()
|
|||||||
unlockControllers();
|
unlockControllers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// frame::XLoadable
|
||||||
|
void SAL_CALL ChartModel::initNew()
|
||||||
|
throw (frame::DoubleInitializationException,
|
||||||
|
io::IOException,
|
||||||
|
uno::Exception,
|
||||||
|
uno::RuntimeException, std::exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void SAL_CALL ChartModel::load(
|
void SAL_CALL ChartModel::load(
|
||||||
const Sequence< beans::PropertyValue >& rMediaDescriptor )
|
const Sequence< beans::PropertyValue >& rMediaDescriptor )
|
||||||
throw (frame::DoubleInitializationException,
|
throw (frame::DoubleInitializationException,
|
||||||
|
@ -123,6 +123,10 @@ interface XChartDocument : ::com::sun::star::frame::XModel
|
|||||||
XDiagram::getWall().</p>
|
XDiagram::getWall().</p>
|
||||||
*/
|
*/
|
||||||
com::sun::star::beans::XPropertySet getPageBackground();
|
com::sun::star::beans::XPropertySet getPageBackground();
|
||||||
|
|
||||||
|
/** Creates a default chart type for a brand-new chart object.
|
||||||
|
*/
|
||||||
|
void createDefaultChart();
|
||||||
};
|
};
|
||||||
|
|
||||||
} ; // chart2
|
} ; // chart2
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
#include <com/sun/star/beans/PropertyValue.hpp>
|
#include <com/sun/star/beans/PropertyValue.hpp>
|
||||||
#include <com/sun/star/chart2/data/XDataProvider.hpp>
|
#include <com/sun/star/chart2/data/XDataProvider.hpp>
|
||||||
#include <com/sun/star/chart2/data/XDataReceiver.hpp>
|
#include <com/sun/star/chart2/data/XDataReceiver.hpp>
|
||||||
|
#include <com/sun/star/chart2/XChartDocument.hpp>
|
||||||
#include <com/sun/star/chart2/X3DChartWindowProvider.hpp>
|
#include <com/sun/star/chart2/X3DChartWindowProvider.hpp>
|
||||||
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
|
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
|
||||||
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
|
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
|
||||||
@ -504,6 +505,10 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView*
|
|||||||
if( xCompSupp.is())
|
if( xCompSupp.is())
|
||||||
xReceiver.set( xCompSupp->getComponent(), uno::UNO_QUERY );
|
xReceiver.set( xCompSupp->getComponent(), uno::UNO_QUERY );
|
||||||
|
|
||||||
|
uno::Reference<chart2::XChartDocument> xChartDoc(xReceiver, uno::UNO_QUERY);
|
||||||
|
if (xChartDoc.is())
|
||||||
|
xChartDoc->createDefaultChart();
|
||||||
|
|
||||||
// lock the model to suppress any internal updates
|
// lock the model to suppress any internal updates
|
||||||
uno::Reference< frame::XModel > xChartModel( xReceiver, uno::UNO_QUERY );
|
uno::Reference< frame::XModel > xChartModel( xReceiver, uno::UNO_QUERY );
|
||||||
if( xChartModel.is() )
|
if( xChartModel.is() )
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <toolkit/helper/vclunohelper.hxx>
|
#include <toolkit/helper/vclunohelper.hxx>
|
||||||
#include <svx/svxdlg.hxx>
|
#include <svx/svxdlg.hxx>
|
||||||
#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
|
#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
|
||||||
|
#include <com/sun/star/embed/XComponentSupplier.hpp>
|
||||||
#include <com/sun/star/embed/Aspects.hpp>
|
#include <com/sun/star/embed/Aspects.hpp>
|
||||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||||
#include <com/sun/star/chart2/XChartDocument.hpp>
|
#include <com/sun/star/chart2/XChartDocument.hpp>
|
||||||
@ -289,6 +290,15 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq )
|
|||||||
GetEmbeddedObjectContainer().CreateEmbeddedObject( aName.GetByteSequence(), aObjName );
|
GetEmbeddedObjectContainer().CreateEmbeddedObject( aName.GetByteSequence(), aObjName );
|
||||||
if ( xObj.is() )
|
if ( xObj.is() )
|
||||||
{
|
{
|
||||||
|
uno::Reference<embed::XComponentSupplier> xCompSupp(xObj, uno::UNO_QUERY);
|
||||||
|
if (xCompSupp.is())
|
||||||
|
{
|
||||||
|
// Create default chart type.
|
||||||
|
uno::Reference<chart2::XChartDocument> xChartDoc(xCompSupp->getComponent(), uno::UNO_QUERY);
|
||||||
|
if (xChartDoc.is())
|
||||||
|
xChartDoc->createDefaultChart();
|
||||||
|
}
|
||||||
|
|
||||||
sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
|
sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
|
||||||
|
|
||||||
MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
|
MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <com/sun/star/chart/ChartDataRowSource.hpp>
|
#include <com/sun/star/chart/ChartDataRowSource.hpp>
|
||||||
#include <com/sun/star/chart2/data/XDataProvider.hpp>
|
#include <com/sun/star/chart2/data/XDataProvider.hpp>
|
||||||
#include <com/sun/star/chart2/data/XDataReceiver.hpp>
|
#include <com/sun/star/chart2/data/XDataReceiver.hpp>
|
||||||
|
#include <com/sun/star/chart2/XChartDocument.hpp>
|
||||||
#include <com/sun/star/beans/PropertyState.hpp>
|
#include <com/sun/star/beans/PropertyState.hpp>
|
||||||
|
|
||||||
#include <sot/storage.hxx>
|
#include <sot/storage.hxx>
|
||||||
@ -229,8 +230,15 @@ uno::Reference< frame::XModel > SwTableFUNC::InsertChart(
|
|||||||
{
|
{
|
||||||
xChartModel.set( xCompSupp->getComponent(), uno::UNO_QUERY );
|
xChartModel.set( xCompSupp->getComponent(), uno::UNO_QUERY );
|
||||||
if( xChartModel.is() )
|
if( xChartModel.is() )
|
||||||
|
{
|
||||||
|
// Create a default chart type.
|
||||||
|
uno::Reference<chart2::XChartDocument> xChartDoc(xChartModel, uno::UNO_QUERY);
|
||||||
|
if (xChartDoc.is())
|
||||||
|
xChartDoc->createDefaultChart();
|
||||||
|
|
||||||
xChartModel->lockControllers(); //#i79578# don't request a new replacement image for charts to often - block change notifications
|
xChartModel->lockControllers(); //#i79578# don't request a new replacement image for charts to often - block change notifications
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// set the table name at the OLE-node
|
// set the table name at the OLE-node
|
||||||
if (!aName.isEmpty())
|
if (!aName.isEmpty())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user