From 4b4942224b550235da228655677b5c068a053254 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Mon, 16 Apr 2018 22:34:50 +0200 Subject: SOSAW080: Derive SdrObjGroup from SdrObjList Also simplify parent/child relationships, get rid of double data (SdrPage/Parent infos in SdrObjects, also in SdrObjList). This is all not needed - when a SdrObject is inserted to a SdrPage, get SdrPage by traveling over parents (no double info, member as soon as inserted, ...). More cleanups/reworks included, will need some more cleanups, too. Stabilizing: SetRectsDirty/DefaultStyleSheet Had to correct the SetRectsDirty stuff for 3D due to going down the hierarchy while the 2D implementation goes the other direction -> endless loops. Added special handling for 3D stuff for now (will be chnaged again when SnapRect is no longer needed at SdrObject level). Also had to adapt how the DefaultStyleSheet is set at incarnated SdrObjects - better: their properties. Since we now always have a SdrModel, it is possible to correctly initialize with the correct default StyleSheet from that SdrModel. This needs to be done after ForceDefaultAttributes and in a way that again deletes Items that are set in the StyleSheet. This leads to an error in CppunitTest_sd_import_tests where I checked tdf100491 - it is okay and thus I change the control instance of the imported, XML-dumped file. The less hard attributes, the better for Styles in general. Cleanup of comments for last two commits Corrected SvxShape::getParent() Needed to get the direct parent, so test for SdrObject first (to get SdrObjGroup/E3DScene), for SdrPage second Fixed CppunitTest_sc_subsequent_export_test Several problems arose. The used SdrCaptionObj was Cloned, but the clone not inserted to a SdrPage. This leads to not being able to access a UNO API imlementation of the SdrPage (SvxPage) on lower levels. It worked before due to SdrObject having a SdrPage* additionally to being added to a SdrPage - this is exactly the main cleanup this change does. Looked for why it is cloned, could see no reasons. The SdrCaptionObj exists during all im/export, not difference to other SdrObjects (that do not get cloned). It is not changed in any way. It *might* be to suppress a crash that happened due to UNO API Service emfio/emfio not being available in the UnitTest scenario. Interestingly it did not crash with the cloned SdrCaptionObj, but the Graphic exported was probably wrong. Fixed by no longer Cloning the SdrCaptionObj and adding emfio/emfio UNO API Service. d139f821a5b39535a3e7b9c6261df7e18f8ae8ac 910e7f4bc628a715fda7545dffaf3369d5e76ea0 ca1de01b723051e09ac37d7ec7bba978beea41c5 3a76da1471dfe75e69847f64a6a3519ad21c8c9c Change-Id: I986586e326b563acebf00d931a7084c6eb09e5f8 Reviewed-on: https://gerrit.libreoffice.org/54689 Tested-by: Jenkins Reviewed-by: Armin Le Grand --- include/svx/svditer.hxx | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'include/svx/svditer.hxx') diff --git a/include/svx/svditer.hxx b/include/svx/svditer.hxx index 6f87776401ce..e89efccf54c3 100644 --- a/include/svx/svditer.hxx +++ b/include/svx/svditer.hxx @@ -27,6 +27,7 @@ class SdrObjList; class SdrObject; +class SdrPage; class SdrMarkList; // SdrObjListIter methods: @@ -37,41 +38,36 @@ enum class SdrIterMode { Flat, DeepWithGroups, DeepNoGroups }; class SVX_DLLPUBLIC SdrObjListIter { - std::vector maObjList; - sal_uInt32 mnIndex; - bool mbReverse; + std::vector< const SdrObject* > maObjList; + size_t mnIndex; + bool mbReverse; + bool mbUseZOrder; - void ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode, bool bUseZOrder); + void ImpProcessObjectList(const SdrObjList& rSdrObjList, SdrIterMode eMode); void ImpProcessMarkList(const SdrMarkList& rMarkList, SdrIterMode eMode); - void ImpProcessObj(SdrObject* pObj, SdrIterMode eMode, bool bUseZOrder); + void ImpProcessObj(const SdrObject& rSdrObject, SdrIterMode eMode); public: - explicit SdrObjListIter(const SdrObjList& rObjList, SdrIterMode eMode = SdrIterMode::DeepNoGroups, bool bReverse = false); - /** This variant lets the user choose the order in which to travel over - the objects. - @param bUseZOrder - When then the z-order defines the order of iteration. - Otherwise the navigation position as returned by - SdrObject::GetNavigationPosition() is used. - */ - SdrObjListIter(const SdrObjList& rObjList, bool bUseZOrder, SdrIterMode eMode); + explicit SdrObjListIter(const SdrObjList* pObjList, SdrIterMode eMode = SdrIterMode::DeepNoGroups, bool bReverse = false); + explicit SdrObjListIter(const SdrObjList* pObjList, bool bUseZOrder, SdrIterMode eMode = SdrIterMode::DeepNoGroups, bool bReverse = false); /* SJ: the following function can now be used with every SdrObject and is no longer limited to group objects */ - explicit SdrObjListIter(const SdrObject& rObj, SdrIterMode eMode = SdrIterMode::DeepNoGroups); + explicit SdrObjListIter(const SdrObject& rSdrObject, SdrIterMode eMode = SdrIterMode::DeepNoGroups, bool bReverse = false); + explicit SdrObjListIter(const SdrPage* pSdrPage, SdrIterMode eMode = SdrIterMode::DeepNoGroups, bool bReverse = false); - /** Iterates over a list of marked objects received from the SdrMarkView. */ + /** Iterates over a list of marked objects received from the SdrMarkView. TTTT used in sc */ explicit SdrObjListIter(const SdrMarkList& rMarkList, SdrIterMode eMode = SdrIterMode::DeepNoGroups); void Reset() { mnIndex = (mbReverse ? maObjList.size() : 0L); } bool IsMore() const { return (mbReverse ? mnIndex != 0 : ( mnIndex < maObjList.size())); } SdrObject* Next() { - sal_uInt32 idx = (mbReverse ? --mnIndex : mnIndex++); - return idx < maObjList.size() ? maObjList[idx] : nullptr; + const size_t idx(mbReverse ? --mnIndex : mnIndex++); + return (idx < maObjList.size()) ? const_cast< SdrObject* >(maObjList[idx]) : nullptr; } - sal_uInt32 Count() { return maObjList.size(); } + size_t Count() { return maObjList.size(); } }; #endif // INCLUDED_SVX_SVDITER_HXX -- cgit