summaryrefslogtreecommitdiff
path: root/svx/source/sdr
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2018-04-16 22:34:50 +0200
committerArmin Le Grand <Armin.Le.Grand@cib.de>2018-05-25 12:31:32 +0200
commit4b4942224b550235da228655677b5c068a053254 (patch)
treea660a04a1f7a3eee910da780ece271d68942201d /svx/source/sdr
parentf8edef392245c292398a80f6a858ca19f32df9c3 (diff)
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 <ci@libreoffice.org> Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'svx/source/sdr')
-rw-r--r--svx/source/sdr/contact/objectcontactofpageview.cxx8
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrobj.cxx4
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrpathobj.cxx2
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofgraphic.cxx2
-rw-r--r--svx/source/sdr/properties/attributeproperties.cxx61
-rw-r--r--svx/source/sdr/properties/graphicproperties.cxx17
-rw-r--r--svx/source/sdr/properties/itemsettools.cxx2
-rw-r--r--svx/source/sdr/properties/oleproperties.cxx19
-rw-r--r--svx/source/sdr/properties/properties.cxx6
9 files changed, 70 insertions, 51 deletions
diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx
index badb9f4aa121..bbd8f48a4c13 100644
--- a/svx/source/sdr/contact/objectcontactofpageview.cxx
+++ b/svx/source/sdr/contact/objectcontactofpageview.cxx
@@ -339,15 +339,15 @@ namespace sdr
if(pActiveGroupList)
{
- if(dynamic_cast<const SdrPage*>( pActiveGroupList) != nullptr)
+ if(nullptr != pActiveGroupList->getSdrPageFromSdrObjList())
{
// It's a Page itself
- return &(static_cast<SdrPage*>(pActiveGroupList)->GetViewContact());
+ return &(pActiveGroupList->getSdrPageFromSdrObjList()->GetViewContact());
}
- else if(pActiveGroupList->GetOwnerObj())
+ else if(pActiveGroupList->getSdrObjectFromSdrObjList())
{
// Group object
- return &(pActiveGroupList->GetOwnerObj()->GetViewContact());
+ return &(pActiveGroupList->getSdrObjectFromSdrObjList()->GetViewContact());
}
}
else if(GetSdrPage())
diff --git a/svx/source/sdr/contact/viewcontactofsdrobj.cxx b/svx/source/sdr/contact/viewcontactofsdrobj.cxx
index 67ba3c507967..6d3dfb2f80e3 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobj.cxx
@@ -99,9 +99,9 @@ ViewContact* ViewContactOfSdrObj::GetParentContact() const
else
{
// Is a group?
- if(pObjList->GetOwnerObj())
+ if(pObjList->getSdrObjectFromSdrObjList())
{
- pRetval = &(pObjList->GetOwnerObj()->GetViewContact());
+ pRetval = &(pObjList->getSdrObjectFromSdrObjList()->GetViewContact());
}
}
}
diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
index 3c7598115363..9cf85e52d530 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
@@ -96,7 +96,7 @@ namespace sdr
//width/height to avoid oom and massive churn generating a huge
//polygon chain to cover the length in applyLineDashing if this
//line is dashed
- const SdrPage* pPage = GetPathObj().GetPage();
+ const SdrPage* pPage(GetPathObj().getSdrPageFromSdrObject());
sal_Int32 nPageWidth = pPage ? pPage->GetWidth() : 0;
sal_Int32 nPageHeight = pPage ? pPage->GetHeight() : 0;
diff --git a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
index f6e425fb1cfa..db34c85e2c14 100644
--- a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
@@ -248,7 +248,7 @@ namespace sdr
{
// sometimes it is needed that each graphic is completely available and swapped in
// for these cases a ForceSwapIn is called later at the graphic object
- if ( rGrafObj.GetPage() && rGrafObj.GetPage()->IsMasterPage() )
+ if ( rGrafObj.getSdrPageFromSdrObject() && rGrafObj.getSdrPageFromSdrObject()->IsMasterPage() )
{
// #i102380# force Swap-In for GraphicObjects on MasterPage to have a nicer visualisation
bDoAsynchronGraphicLoading = false;
diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx
index 07987534b19b..4e8711341b82 100644
--- a/svx/source/sdr/properties/attributeproperties.cxx
+++ b/svx/source/sdr/properties/attributeproperties.cxx
@@ -44,32 +44,11 @@
#include <svx/svdmodel.hxx>
#include <svx/svdtrans.hxx>
#include <svx/svdpage.hxx>
-#include <svx/svdograf.hxx>
-#include <svx/svdoole2.hxx>
namespace sdr
{
namespace properties
{
- SfxStyleSheet* AttributeProperties::ImpGetDefaultStyleSheet() const
- {
- // use correct default stylesheet #119287#
- const SdrGrafObj* pIsSdrGrafObj(dynamic_cast< const SdrGrafObj* >(&GetSdrObject()));
- const SdrOle2Obj* pIsSdrOle2Obj(dynamic_cast< const SdrOle2Obj* >(&GetSdrObject()));
- SfxStyleSheet* pRetval(nullptr);
-
- if(pIsSdrGrafObj || pIsSdrOle2Obj)
- {
- pRetval = GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj();
- }
- else
- {
- pRetval = GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheet();
- }
-
- return pRetval;
- }
-
void AttributeProperties::ImpSetParentAtSfxItemSet(bool bDontRemoveHardAttr)
{
if(HasSfxItemSet() && mpStyleSheet)
@@ -260,25 +239,29 @@ namespace sdr
if(!bHadSfxItemSet)
{
- if(GetStyleSheet())
+ // SfxItemSet was created and ForceDefaultAttributes() is done.
+ // We now need to set a default SfxStyleSheet at the SdrObject. This
+ // is possible now since we always have the SdrModel in SdrObject,
+ // so use applyDefaultStyleSheetFromSdrModel() which will do the
+ // right thing in each derivation of BaseProperties.
+ // We also need to 'rescue' mpStyleSheet if it is already set,
+ // which means a SfxStyleSheet was already set/ocopied but not
+ // yet set at the SdrObject. See copy-constructor and how it remembers
+ // the SfxStyleSheet there. This time, do not reset the
+ // attributes already set - this is done above.
+ SfxStyleSheet* pImplicitelyAlreadySet(mpStyleSheet);
+
+ // Set missing defaults and do RemoveHardAttributes. This is
+ // important, it deletes again the attributes set in
+ // ForceDefaultAttributes() which are set in the default
+ // SfxStyleSheet.
+ const_cast< AttributeProperties* >(this)->applyDefaultStyleSheetFromSdrModel();
+
+ if(pImplicitelyAlreadySet)
{
// Late-Init of setting parent to SfxStyleSheet after
- // it's creation. See copy-constructor and how it remembers
- // the SfxStyleSheet there.
- // It is necessary to reset mpStyleSheet to nullptr to
- // not trigger alarm inside ImpAddStyleSheet (!)
- SfxStyleSheet* pNew(mpStyleSheet);
- const_cast< AttributeProperties* >(this)->mpStyleSheet = nullptr;
- const_cast< AttributeProperties* >(this)->ImpAddStyleSheet(
- pNew,
- true);
- }
- else
- {
- // Set missing defaults and do not RemoveHardAttributes
- const_cast< AttributeProperties* >(this)->ImpAddStyleSheet(
- ImpGetDefaultStyleSheet(),
- true);
+ // it's creation.
+ const_cast< AttributeProperties* >(this)->SetStyleSheet(pImplicitelyAlreadySet, true);
}
}
@@ -535,7 +518,7 @@ namespace sdr
const SdrObject& rObj(GetSdrObject());
if (rObj.IsInserted())
{
- const SdrPage* const pPage(rObj.GetPage());
+ const SdrPage* const pPage(rObj.getSdrPageFromSdrObject());
if (pPage && pPage->IsInserted())
return true;
}
diff --git a/svx/source/sdr/properties/graphicproperties.cxx b/svx/source/sdr/properties/graphicproperties.cxx
index 6c624a4108d3..2c606b80d433 100644
--- a/svx/source/sdr/properties/graphicproperties.cxx
+++ b/svx/source/sdr/properties/graphicproperties.cxx
@@ -27,12 +27,27 @@
#include <editeng/eeitem.hxx>
#include <svx/svdograf.hxx>
#include <svx/sdgcpitm.hxx>
-
+#include <svx/svdmodel.hxx>
namespace sdr
{
namespace properties
{
+ void GraphicProperties::applyDefaultStyleSheetFromSdrModel()
+ {
+ SfxStyleSheet* pStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj());
+
+ if(pStyleSheet)
+ {
+ SetStyleSheet(pStyleSheet, false);
+ }
+ else
+ {
+ SetMergedItem(XFillStyleItem(com::sun::star::drawing::FillStyle_NONE));
+ SetMergedItem(XLineStyleItem(com::sun::star::drawing::LineStyle_NONE));
+ }
+ }
+
// create a new itemset
std::unique_ptr<SfxItemSet> GraphicProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
{
diff --git a/svx/source/sdr/properties/itemsettools.cxx b/svx/source/sdr/properties/itemsettools.cxx
index 7c3bea85aac9..63b0ca75acda 100644
--- a/svx/source/sdr/properties/itemsettools.cxx
+++ b/svx/source/sdr/properties/itemsettools.cxx
@@ -36,7 +36,7 @@ namespace sdr
{
if (const SdrObjGroup* pGroupObj = dynamic_cast<const SdrObjGroup*>(&rObj))
{
- SdrObjListIter aIter(*pGroupObj, SdrIterMode::DeepNoGroups);
+ SdrObjListIter aIter(pGroupObj->GetSubList(), SdrIterMode::DeepNoGroups);
maRectangles.reserve(aIter.Count());
while(aIter.IsMore())
diff --git a/svx/source/sdr/properties/oleproperties.cxx b/svx/source/sdr/properties/oleproperties.cxx
index f740e9cc259b..096e3e2ec71f 100644
--- a/svx/source/sdr/properties/oleproperties.cxx
+++ b/svx/source/sdr/properties/oleproperties.cxx
@@ -17,17 +17,32 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
#include <sdr/properties/oleproperties.hxx>
#include <svl/itemset.hxx>
#include <svx/xfillit0.hxx>
#include <svx/xlineit0.hxx>
-
+#include <svx/svdobj.hxx>
+#include <svx/svdmodel.hxx>
namespace sdr
{
namespace properties
{
+ void OleProperties::applyDefaultStyleSheetFromSdrModel()
+ {
+ SfxStyleSheet* pStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj());
+
+ if(pStyleSheet)
+ {
+ SetStyleSheet(pStyleSheet, false);
+ }
+ else
+ {
+ SetMergedItem(XFillStyleItem(com::sun::star::drawing::FillStyle_NONE));
+ SetMergedItem(XLineStyleItem(com::sun::star::drawing::LineStyle_NONE));
+ }
+ }
+
OleProperties::OleProperties(SdrObject& rObj)
: RectangleProperties(rObj)
{
diff --git a/svx/source/sdr/properties/properties.cxx b/svx/source/sdr/properties/properties.cxx
index 256e6ea275bb..9670c743722f 100644
--- a/svx/source/sdr/properties/properties.cxx
+++ b/svx/source/sdr/properties/properties.cxx
@@ -24,6 +24,7 @@
#include <svx/svditer.hxx>
#include <svx/xfillit0.hxx>
#include <vcl/outdev.hxx>
+#include <svx/svdmodel.hxx>
using namespace com::sun::star;
@@ -40,6 +41,11 @@ namespace sdr
{
}
+ void BaseProperties::applyDefaultStyleSheetFromSdrModel()
+ {
+ SetStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheet(), false);
+ }
+
const SdrObject& BaseProperties::GetSdrObject() const
{
return mrObject;