summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de (CIB)>2018-03-01 15:54:32 +0100
committerArmin Le Grand <Armin.Le.Grand@cib.de>2018-04-06 22:29:02 +0200
commit6c14c27c75a03e2363f2b363ddf0a6f2f46cfa91 (patch)
treee66f50adb222dbc1490b4df2d3c63541dad999ac /chart2
parente1b247a843c5eb850fe0079819239d9883412d38 (diff)
SOSAW080: Added first bunch of basic changes to helpers
SOSAW080: Make SdrModel& prerequisite to SdrObjects Added need for SdrModel& in constructors of SdrModel, SdrPage, SdrView and SdrObjList. Builds, not finished. SOSAW080: removed and replaced old SdrModel Removed and replaced GetModel()/SetModel() in all using classes (SdrObject, SdrPage, SdrView), added accessors to new referenced SdrModel, adapted all accessing places. Refactored/Extended ::Clone and ::operator== for these classes to allow cloning objects to a target SdrModel. Adapted places where this is done AFAP. Added quite some comments (tagged with 'TTTT') where possible further work is needed. Builds completely, thus checking in. This does not mean that this change is done yet. SOSAW080: Adapted SdrPage/SdrModel relationship Also needed to work on copy-construction of SdrPage and hierarchy, quite some stuff removed, no copy-constructor anymore, no MigrateItemPool stuff. Builds well, test stuck, will need some cleanup/finetunung SOSAW080: Smaller corrections/includes adapted SOSAW080: Smaller corrections/includes adapted SOSAW080: Debugging/Stabilizing/MakeUnitTestWork SOSAW080: Stabilized for UnitTests, cleanups SOSAW080: Adapted GetObjGraphic to just take a const SdrObject& SOSAW080: Removed ChangeModel from classes Classes SvxTextEditSource and SvxDrawPage (including TextEditSource stuff) do not need change of SdrModel anymore. SOSAW080: Adapted some comments to make more readable SOSAW080: Corrected constructor SOSAW080: getSdrModelFromUnoModel added override marks SOSAW080: Added missing includes SOSAW080: Corrected SdrPage constructor SOSAW080: Corrected some SdrObject::Clone scenarios Especially when cloning to another SdrModel and taking the sdr::properties into account. SOSAW080: Added include for Mac-Build SOSAW080: Added Scale to DefaultProperties If a SdrModel change happens in DefaultProperties copy constructor (used from Clone()), potentially a Scale for the SfxItems has to be done. SOSAW080: Added missing include for MacBuild SOSAW080: Corrected CppunitTest_sc_anchor_test An adaption of a SdrPathObj instantiation was missing, added that. Seems as if that test is no tpart of the usual 'make' scenario, but used/executed in gerrit builds SOSAW080: Reworked SvxShape to use SdrObject's SdrModel SOSAW080: Reworked SvxShape to use SdrObject's SdrModel SOSAW080: Free SdrObjects when SdrModel goes down In an UNO API test problem is that SvxShapes reference SdrShapes, but these are not added to a SdrPage and not 'owned' by the SvxShape. Thus these do not get deleted at all (same in master, memory leak). I extended SvxShape::Notify the case for ModelCleared to also Free the SdrObject when not owner and it's not added to a SdrPage (in that case it gets deleted with deleting the SdrModel) SOSAW080: Solve UNO API calls that move SvxShapes to other Model Due to UNO API tests I got a call to insert an xShape to a xDrawPage which was constructed in another Model, this has now to be done by Cloning the SdrObject to the new SdrModel, getting rid of the old one and getting all the UNO implementation stuff right (referemces SdrObject <-> xShape). Change-Id: Iaf53535de0502a481466be74a1768bbb39f0e78c 1cb7d573d323e98a89761fe662c10c4a654fdec0 24617494a0ef79f6e33dfcb02782a833a81c6434 763f39094b6a48b529a6952d01468f8776c97679 242b9e228a9a042c3a5bdd38b1ea6600144276d5 242b9e228a9a042c3a5bdd38b1ea6600144276d5 33a6f3f306b70c223171aef796dd5ee041ad14df 6878b33f8b05738a44c0910e40a60a0f0d1d58ed 0a636caf3cb36c2f9c6cd11aa22cb9bc435dc8f2 8c4626274a5cc531dad27f27c0c45d4c528fb2fb 446685a49a6d67aedd01cfbbd5e87b07f97a4d7b c1b5ed3c99bc7219a0061e4ece24ea42afd2889a 22de9a1c8af7c25be5c108671ddc548ba323ed47 4caf6b6fbbe6e8130741d793dffb560fd01d4ed5 488b9601735ec1822433f82f633990063951fe08 c366d60299f239e3df856ddffedb19e743e4be0c c5137ba8c597c7b5f90318df50e87b93a39a28dc f9e646242cf89f6fde1315046952252a2c429779 f830fbc5fadd89d04be5edd2a5abf9b0d4bf0410 1694b54903df784385abaa8452e1201e12344238 17bcb44d2e29920c0c74430c2d9c703b36cfa0ad 17bcb44d2e29920c0c74430c2d9c703b36cfa0ad 7b5c241faec7488924e5935ae8b19f785846b5e4 bf097ee7467895823fbd158a2a9543da3b5a5078
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/drawinglayer/DrawViewWrapper.cxx12
-rw-r--r--chart2/source/controller/drawinglayer/ViewElementListProvider.cxx2
-rw-r--r--chart2/source/controller/inc/DrawViewWrapper.hxx5
-rw-r--r--chart2/source/controller/main/ChartController.cxx2
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx11
-rw-r--r--chart2/source/controller/main/ChartTransferable.cxx11
-rw-r--r--chart2/source/controller/main/ChartTransferable.hxx11
-rw-r--r--chart2/source/controller/main/DrawCommandDispatch.cxx13
-rw-r--r--chart2/source/view/diagram/VDiagram.cxx8
9 files changed, 48 insertions, 27 deletions
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
index 5efd976dcef5..b86980f47782 100644
--- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
+++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
@@ -96,11 +96,13 @@ OutputDevice * lcl_GetParentRefDevice( const uno::Reference< frame::XModel > & x
}
-DrawViewWrapper::DrawViewWrapper( SdrModel* pSdrModel, OutputDevice* pOut)
- : E3dView(pSdrModel, pOut)
- , m_pMarkHandleProvider(nullptr)
- , m_apOutliner(SdrMakeOutliner(OutlinerMode::TextObject, *pSdrModel))
- , m_bRestoreMapMode( false )
+DrawViewWrapper::DrawViewWrapper(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut)
+: E3dView(rSdrModel, pOut)
+ ,m_pMarkHandleProvider(nullptr)
+ ,m_apOutliner(SdrMakeOutliner(OutlinerMode::TextObject, rSdrModel))
+ ,m_bRestoreMapMode( false )
{
SetBufferedOutputAllowed(true);
SetBufferedOverlayAllowed(true);
diff --git a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
index 954426f925a5..500488aaa39c 100644
--- a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
+++ b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
@@ -161,7 +161,7 @@ Graphic ViewElementListProvider::GetSymbolGraphic( sal_Int32 nStandardSymbol, co
SdrPage* pPage = new SdrPage( *pModel, false );
pPage->SetSize(Size(1000,1000));
pModel->InsertPage( pPage, 0 );
- std::unique_ptr<SdrView> pView( new SdrView( pModel.get(), pVDev ) );
+ std::unique_ptr<SdrView> pView( new SdrView( *pModel.get(), pVDev ) );
pView->hideMarkHandles();
SdrPageView* pPageView = pView->ShowSdrPage(pPage);
diff --git a/chart2/source/controller/inc/DrawViewWrapper.hxx b/chart2/source/controller/inc/DrawViewWrapper.hxx
index 91ffdf7eeb1b..2adf512fe015 100644
--- a/chart2/source/controller/inc/DrawViewWrapper.hxx
+++ b/chart2/source/controller/inc/DrawViewWrapper.hxx
@@ -46,7 +46,10 @@ protected:
class DrawViewWrapper : public E3dView
{
public:
- DrawViewWrapper(SdrModel* pModel, OutputDevice* pOut);
+ DrawViewWrapper(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
virtual ~DrawViewWrapper() override;
//triggers the use of an updated first page
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 139f17279b40..02c444d8f041 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -727,7 +727,7 @@ void ChartController::impl_createDrawViewController()
{
if( m_pDrawModelWrapper )
{
- m_pDrawViewWrapper = new DrawViewWrapper(&m_pDrawModelWrapper->getSdrModel(),GetChartWindow());
+ m_pDrawViewWrapper = new DrawViewWrapper(m_pDrawModelWrapper->getSdrModel(),GetChartWindow());
m_pDrawViewWrapper->attachParentReferenceDevice( getModel() );
}
}
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index d06524480847..00abbf63ad5e 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -395,11 +395,12 @@ void ChartController::impl_PasteShapes( SdrModel* pModel )
SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
while ( aIter.IsMore() )
{
- SdrObject* pObj = aIter.Next();
- SdrObject* pNewObj = ( pObj ? pObj->Clone() : nullptr );
+ SdrObject* pObj(aIter.Next());
+ // Clone to new SdrModel
+ SdrObject* pNewObj(pObj ? pObj->Clone(&pDrawModelWrapper->getSdrModel()) : nullptr);
+
if ( pNewObj )
{
- pNewObj->SetModel( &pDrawModelWrapper->getSdrModel() );
pNewObj->SetPage( pDestPage );
// set position
@@ -516,7 +517,9 @@ void ChartController::executeDispatch_Copy()
if ( pSelectedObj )
{
xTransferable.set( new ChartTransferable(
- &m_pDrawModelWrapper->getSdrModel(), pSelectedObj, aSelOID.isAdditionalShape() ) );
+ m_pDrawModelWrapper->getSdrModel(),
+ pSelectedObj,
+ aSelOID.isAdditionalShape() ) );
}
}
}
diff --git a/chart2/source/controller/main/ChartTransferable.cxx b/chart2/source/controller/main/ChartTransferable.cxx
index 2eeb46a764f2..4888c4802b9f 100644
--- a/chart2/source/controller/main/ChartTransferable.cxx
+++ b/chart2/source/controller/main/ChartTransferable.cxx
@@ -46,12 +46,15 @@ using ::com::sun::star::uno::Reference;
namespace chart
{
-ChartTransferable::ChartTransferable( SdrModel* pDrawModel, SdrObject* pSelectedObj, bool bDrawing )
- :m_pMarkedObjModel( nullptr )
+ChartTransferable::ChartTransferable(
+ SdrModel& rSdrModel,
+ SdrObject* pSelectedObj,
+ bool bDrawing)
+: m_pMarkedObjModel( nullptr )
,m_bDrawing( bDrawing )
{
- std::unique_ptr<SdrExchangeView> pExchgView(o3tl::make_unique<SdrView>( pDrawModel ));
- SdrPageView* pPv = pExchgView->ShowSdrPage( pDrawModel->GetPage( 0 ));
+ std::unique_ptr<SdrExchangeView> pExchgView(o3tl::make_unique<SdrView>( rSdrModel ));
+ SdrPageView* pPv = pExchgView->ShowSdrPage( rSdrModel.GetPage( 0 ));
if( pSelectedObj )
pExchgView->MarkObj( pSelectedObj, pPv );
else
diff --git a/chart2/source/controller/main/ChartTransferable.hxx b/chart2/source/controller/main/ChartTransferable.hxx
index 35e4f5d514c1..6fc8b4c26f8c 100644
--- a/chart2/source/controller/main/ChartTransferable.hxx
+++ b/chart2/source/controller/main/ChartTransferable.hxx
@@ -36,16 +36,19 @@ namespace chart
class ChartTransferable : public TransferableHelper
{
public:
- explicit ChartTransferable( SdrModel* pDrawModel, SdrObject* pSelectedObj, bool bDrawing );
+ explicit ChartTransferable(
+ SdrModel& rSdrModel,
+ SdrObject* pSelectedObj,
+ bool bDrawing );
virtual ~ChartTransferable() override;
protected:
// implementation of TransferableHelper methods
- virtual void AddSupportedFormats() override;
+ virtual void AddSupportedFormats() override;
virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
- virtual bool WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
- const css::datatransfer::DataFlavor& rFlavor ) override;
+ virtual bool WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
+ const css::datatransfer::DataFlavor& rFlavor ) override;
private:
css::uno::Reference< css::graphic::XGraphic > m_xMetaFileGraphic;
diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx
index 7e318646ebf5..6c59620ce6c1 100644
--- a/chart2/source/controller/main/DrawCommandDispatch.cxx
+++ b/chart2/source/controller/main/DrawCommandDispatch.cxx
@@ -74,7 +74,7 @@ bool DrawCommandDispatch::isFeatureSupported( const OUString& rCommandURL )
return parseCommandURL( rCommandURL, &nFeatureId, &aBaseCommand, &aCustomShapeType );
}
-::basegfx::B2DPolyPolygon getPolygon(const char* pResId, SdrModel const & rModel)
+::basegfx::B2DPolyPolygon getPolygon(const char* pResId, const SdrModel& rModel)
{
::basegfx::B2DPolyPolygon aReturn;
XLineEndListRef pLineEndList = rModel.GetLineEndList();
@@ -123,7 +123,7 @@ void DrawCommandDispatch::setAttributes( SdrObject* pObj )
{
const SfxItemSet& rSource = pSourceObj->GetMergedItemSet();
SfxItemSet aDest(
- pObj->GetModel()->GetItemPool(),
+ pObj->getSdrModelFromSdrObject().GetItemPool(),
svl::Items<
// Ranges from SdrAttrObj:
SDRATTR_START, SDRATTR_SHADOW_LAST,
@@ -425,8 +425,13 @@ SdrObject* DrawCommandDispatch::createDefaultObject( const sal_uInt16 nID )
if ( pPage )
{
SolarMutexGuard aGuard;
- pObj = SdrObjFactory::MakeNewObject( pDrawViewWrapper->GetCurrentObjInventor(),
- pDrawViewWrapper->GetCurrentObjIdentifier(), pPage );
+
+ pObj = SdrObjFactory::MakeNewObject(
+ pDrawModelWrapper->getSdrModel(),
+ pDrawViewWrapper->GetCurrentObjInventor(),
+ pDrawViewWrapper->GetCurrentObjIdentifier(),
+ pPage);
+
if ( pObj )
{
Size aObjectSize( 4000, 2500 );
diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx
index 4c5bac5abfc0..897bbe390ea4 100644
--- a/chart2/source/view/diagram/VDiagram.cxx
+++ b/chart2/source/view/diagram/VDiagram.cxx
@@ -436,7 +436,7 @@ void VDiagram::adjustAspectRatio3d( const awt::Size& rAvailableSize )
// To get the 3D aspect ratio's effect on the 2D scene size, the scene's 2D size needs to be adapted to
// 3D content changes here. The tooling class remembers the current 3D transformation stack
// and in its destructor, calculates a new 2D SnapRect for the scene and it's modified 3D geometry.
- E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene( m_xOuterGroupShape ));
+ E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene(m_xOuterGroupShape));
m_xAspectRatio3D->setPropertyValue( UNO_NAME_3D_TRANSFORM_MATRIX
, uno::Any(BaseGFXHelper::B3DHomMatrixToHomogenMatrix( aResult )) );
@@ -599,7 +599,8 @@ void VDiagram::createShapes_3d()
aEffectiveTranformation.shearXY(m_fYAnglePi,-m_fXAnglePi);
//#i98497# 3D charts are rendered with wrong size
- E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene( m_xOuterGroupShape ));
+ E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene(m_xOuterGroupShape));
+
xDestProp->setPropertyValue( UNO_NAME_3D_TRANSFORM_MATRIX,
uno::Any( BaseGFXHelper::B3DHomMatrixToHomogenMatrix( aEffectiveTranformation ) ) );
}
@@ -656,7 +657,8 @@ void VDiagram::createShapes_3d()
::basegfx::B3DHomMatrix aM;
aM.translate(GRID_TO_WALL_DISTANCE/fXScale, GRID_TO_WALL_DISTANCE/fYScale, GRID_TO_WALL_DISTANCE/fZScale);
aM.scale( fXScale, fYScale, fZScale );
- E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene( m_xOuterGroupShape ));
+ E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene(m_xOuterGroupShape));
+
xShapeProp->setPropertyValue( UNO_NAME_3D_TRANSFORM_MATRIX
, uno::Any(BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aM)) );
}