summaryrefslogtreecommitdiff
path: root/svx/source/sdr/properties
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/sdr/properties')
-rw-r--r--svx/source/sdr/properties/attributeproperties.cxx628
-rw-r--r--svx/source/sdr/properties/captionproperties.cxx120
-rw-r--r--svx/source/sdr/properties/circleproperties.cxx157
-rw-r--r--svx/source/sdr/properties/connectorproperties.cxx107
-rw-r--r--svx/source/sdr/properties/customshapeproperties.cxx239
-rw-r--r--svx/source/sdr/properties/defaultproperties.cxx237
-rw-r--r--svx/source/sdr/properties/e3dcompoundproperties.cxx165
-rw-r--r--svx/source/sdr/properties/e3dextrudeproperties.cxx90
-rw-r--r--svx/source/sdr/properties/e3dlatheproperties.cxx100
-rw-r--r--svx/source/sdr/properties/e3dproperties.cxx106
-rw-r--r--svx/source/sdr/properties/e3dsceneproperties.cxx334
-rw-r--r--svx/source/sdr/properties/e3dsphereproperties.cxx85
-rw-r--r--svx/source/sdr/properties/emptyproperties.cxx153
-rw-r--r--svx/source/sdr/properties/graphicproperties.cxx143
-rw-r--r--svx/source/sdr/properties/groupproperties.cxx298
-rw-r--r--svx/source/sdr/properties/itemsettools.cxx146
-rw-r--r--svx/source/sdr/properties/makefile.mk65
-rw-r--r--svx/source/sdr/properties/measureproperties.cxx141
-rw-r--r--svx/source/sdr/properties/oleproperties.cxx80
-rw-r--r--svx/source/sdr/properties/pageproperties.cxx101
-rw-r--r--svx/source/sdr/properties/properties.cxx189
-rw-r--r--svx/source/sdr/properties/rectangleproperties.cxx84
-rw-r--r--svx/source/sdr/properties/textproperties.cxx638
23 files changed, 4406 insertions, 0 deletions
diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx
new file mode 100644
index 000000000000..0f3325a0027e
--- /dev/null
+++ b/svx/source/sdr/properties/attributeproperties.cxx
@@ -0,0 +1,628 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/attributeproperties.hxx>
+#include <svx/sdr/properties/itemsettools.hxx>
+#include <tools/debug.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svl/whiter.hxx>
+#include <svl/poolitem.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svddef.hxx>
+#include <svx/xit.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xflgrit.hxx>
+#include <svx/xflftrit.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xlnasit.hxx>
+#include <svx/xflasit.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/svdpage.hxx>
+
+// #114265#
+#include <svl/smplhint.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ void AttributeProperties::ImpAddStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ // test if old StyleSheet is cleared, else it would be lost
+ // after this method -> memory leak (!)
+ DBG_ASSERT(!mpStyleSheet, "Old style sheet not deleted before setting new one (!)");
+
+ if(pNewStyleSheet)
+ {
+ mpStyleSheet = pNewStyleSheet;
+
+ // local ItemSet is needed here, force it
+ GetObjectItemSet();
+
+ // register as listener
+ StartListening(pNewStyleSheet->GetPool());
+ StartListening(*pNewStyleSheet);
+
+ // Delete hard attributes where items are set in the style sheet
+ if(!bDontRemoveHardAttr)
+ {
+ const SfxItemSet& rStyle = pNewStyleSheet->GetItemSet();
+ SfxWhichIter aIter(rStyle);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+
+ while(nWhich)
+ {
+ if(SFX_ITEM_SET == rStyle.GetItemState(nWhich))
+ {
+ mpItemSet->ClearItem(nWhich);
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+ }
+
+ // set new stylesheet as parent
+ mpItemSet->SetParent(&pNewStyleSheet->GetItemSet());
+ }
+ }
+
+ void AttributeProperties::ImpRemoveStyleSheet()
+ {
+ // Check type since it is destroyed when the type is deleted
+ if(GetStyleSheet() && HAS_BASE(SfxStyleSheet, mpStyleSheet))
+ {
+ EndListening(*mpStyleSheet);
+ EndListening(mpStyleSheet->GetPool());
+
+ // reset parent of ItemSet
+ if(mpItemSet)
+ {
+ mpItemSet->SetParent(0L);
+ }
+
+ SdrObject& rObj = GetSdrObject();
+ rObj.SetBoundRectDirty();
+ rObj.SetRectsDirty(sal_True);
+ }
+
+ mpStyleSheet = 0L;
+ }
+
+ // create a new itemset
+ SfxItemSet& AttributeProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return *(new SfxItemSet(rPool,
+
+ // ranges from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // end
+ 0, 0));
+ }
+
+ AttributeProperties::AttributeProperties(SdrObject& rObj)
+ : DefaultProperties(rObj),
+ mpStyleSheet(0L)
+ {
+ }
+
+ AttributeProperties::AttributeProperties(const AttributeProperties& rProps, SdrObject& rObj)
+ : DefaultProperties(rProps, rObj),
+ mpStyleSheet(0L)
+ {
+ if(rProps.GetStyleSheet())
+ {
+ ImpAddStyleSheet(rProps.GetStyleSheet(), sal_True);
+ }
+ }
+
+ AttributeProperties::~AttributeProperties()
+ {
+ ImpRemoveStyleSheet();
+ }
+
+ BaseProperties& AttributeProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new AttributeProperties(*this, rObj));
+ }
+
+ void AttributeProperties::ItemSetChanged(const SfxItemSet& /*rSet*/)
+ {
+ // own modifications
+ SdrObject& rObj = GetSdrObject();
+
+ rObj.SetBoundRectDirty();
+ rObj.SetRectsDirty(sal_True);
+ rObj.SetChanged();
+ }
+
+ void AttributeProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
+ {
+ if(pNewItem)
+ {
+ const SfxPoolItem* pItem = pNewItem;
+ SdrModel* pModel = GetSdrObject().GetModel();
+
+ switch( nWhich )
+ {
+ case XATTR_FILLBITMAP:
+ {
+ pItem = ((XFillBitmapItem*)pItem)->checkForUniqueItem( pModel );
+ break;
+ }
+ case XATTR_LINEDASH:
+ {
+ pItem = ((XLineDashItem*)pItem)->checkForUniqueItem( pModel );
+ break;
+ }
+ case XATTR_LINESTART:
+ {
+ pItem = ((XLineStartItem*)pItem)->checkForUniqueItem( pModel );
+ break;
+ }
+ case XATTR_LINEEND:
+ {
+ pItem = ((XLineEndItem*)pItem)->checkForUniqueItem( pModel );
+ break;
+ }
+ case XATTR_FILLGRADIENT:
+ {
+ pItem = ((XFillGradientItem*)pItem)->checkForUniqueItem( pModel );
+ break;
+ }
+ case XATTR_FILLFLOATTRANSPARENCE:
+ {
+ // #85953# allow all kinds of XFillFloatTransparenceItem to be set
+ pItem = ((XFillFloatTransparenceItem*)pItem)->checkForUniqueItem( pModel );
+ break;
+ }
+ case XATTR_FILLHATCH:
+ {
+ pItem = ((XFillHatchItem*)pItem)->checkForUniqueItem( pModel );
+ break;
+ }
+ }
+
+ // set item
+ if(pItem)
+ {
+ // force ItemSet
+ GetObjectItemSet();
+ mpItemSet->Put(*pItem);
+
+ // delete item if it was a generated one
+ if(pItem != pNewItem)
+ {
+ delete (SfxPoolItem*)pItem;
+ }
+ }
+ }
+ else
+ {
+ // clear item if ItemSet exists
+ if(mpItemSet)
+ {
+ mpItemSet->ClearItem(nWhich);
+ }
+ }
+ }
+
+ void AttributeProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ ImpRemoveStyleSheet();
+ ImpAddStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+
+ SdrObject& rObj = GetSdrObject();
+ rObj.SetBoundRectDirty();
+ rObj.SetRectsDirty(sal_True);
+ }
+
+ SfxStyleSheet* AttributeProperties::GetStyleSheet() const
+ {
+ return mpStyleSheet;
+ }
+
+ void AttributeProperties::MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel)
+ {
+ OSL_ASSERT(pNewModel!=NULL);
+
+ if(pSrcPool && pDestPool && (pSrcPool != pDestPool))
+ {
+ if(mpItemSet)
+ {
+ // migrate ItemSet to new pool. Scaling is NOT necessary
+ // because this functionality is used by UNDO only. Thus
+ // objects and ItemSets would be moved back to their original
+ // pool before usage.
+ SfxItemSet* pOldSet = mpItemSet;
+ SfxStyleSheet* pStySheet = GetStyleSheet();
+
+ if(pStySheet)
+ {
+ ImpRemoveStyleSheet();
+ }
+
+ mpItemSet = mpItemSet->Clone(FALSE, pDestPool);
+ GetSdrObject().GetModel()->MigrateItemSet(pOldSet, mpItemSet, pNewModel);
+
+ // set stylesheet (if used)
+ if(pStySheet)
+ {
+ // #i109515#
+ SfxItemPool* pStyleSheetPool = &pStySheet->GetPool().GetPool();
+
+ if(pStyleSheetPool == pDestPool)
+ {
+ // just re-set stylesheet
+ ImpAddStyleSheet(pStySheet, sal_True);
+ }
+ else
+ {
+ // StyleSheet is NOT from the correct pool.
+ // Look one up in the right pool with the same
+ // name or use the default.
+
+ // Look up the style in the new document.
+ OSL_ASSERT(pNewModel->GetStyleSheetPool() != NULL);
+ SfxStyleSheet* pNewStyleSheet = dynamic_cast<SfxStyleSheet*>(
+ pNewModel->GetStyleSheetPool()->Find(
+ pStySheet->GetName(),
+ SFX_STYLE_FAMILY_ALL));
+ if (pNewStyleSheet == NULL
+ || &pNewStyleSheet->GetPool().GetPool() != pDestPool)
+ {
+ // There is no copy of the style in the new
+ // document. Use the default as a fallback.
+ pNewStyleSheet = pNewModel->GetDefaultStyleSheet();
+ }
+ ImpAddStyleSheet(pNewStyleSheet, sal_True);
+ }
+ }
+
+ delete pOldSet;
+ }
+ }
+ }
+
+ void AttributeProperties::SetModel(SdrModel* pOldModel, SdrModel* pNewModel)
+ {
+ if(pOldModel != pNewModel && pNewModel && !pNewModel->IsLoading())
+ {
+ // For a living model move the items from one pool to the other
+ if(pOldModel)
+ {
+ // If metric has changed, scale items.
+ MapUnit aOldUnit(pOldModel->GetScaleUnit());
+ MapUnit aNewUnit(pNewModel->GetScaleUnit());
+ sal_Bool bScaleUnitChanged(aNewUnit != aOldUnit);
+ Fraction aMetricFactor;
+
+ if(bScaleUnitChanged)
+ {
+ aMetricFactor = GetMapFactor(aOldUnit, aNewUnit).X();
+ Scale(aMetricFactor);
+ }
+
+ // Move all styles which are used by the object to the new
+ // StyleSheet pool
+ SfxStyleSheet* pOldStyleSheet = GetStyleSheet();
+
+ if(pOldStyleSheet)
+ {
+ SfxStyleSheetBase* pSheet = pOldStyleSheet;
+ SfxStyleSheetBasePool* pOldPool = pOldModel->GetStyleSheetPool();
+ SfxStyleSheetBasePool* pNewPool = pNewModel->GetStyleSheetPool();
+ DBG_ASSERT(pOldPool, "Properties::SetModel(): Object has StyleSheet but no StyleSheetPool (!)");
+
+ if(pOldPool && pNewPool)
+ {
+ // build a list of to-be-copied Styles
+ List aList;
+ SfxStyleSheetBase* pAnchor = 0L;
+
+ while(pSheet)
+ {
+ pAnchor = pNewPool->Find(pSheet->GetName(), pSheet->GetFamily());
+
+ if(!pAnchor)
+ {
+ aList.Insert(pSheet, LIST_APPEND);
+ pSheet = pOldPool->Find(pSheet->GetParent(), pSheet->GetFamily());
+ }
+ else
+ {
+ // the style does exist
+ pSheet = 0L;
+ }
+ }
+
+ // copy and set the parents
+ pSheet = (SfxStyleSheetBase*)aList.First();
+ SfxStyleSheetBase* pNewSheet = 0L;
+ SfxStyleSheetBase* pLastSheet = 0L;
+ SfxStyleSheetBase* pForThisObject = 0L;
+
+ while(pSheet)
+ {
+ pNewSheet = &pNewPool->Make(pSheet->GetName(), pSheet->GetFamily(), pSheet->GetMask());
+ pNewSheet->GetItemSet().Put(pSheet->GetItemSet(), FALSE);
+
+ if(bScaleUnitChanged)
+ {
+ sdr::properties::ScaleItemSet(pNewSheet->GetItemSet(), aMetricFactor);
+ }
+
+ if(pLastSheet)
+ {
+ pLastSheet->SetParent(pNewSheet->GetName());
+ }
+
+ if(!pForThisObject)
+ {
+ pForThisObject = pNewSheet;
+ }
+
+ pLastSheet = pNewSheet;
+ pSheet = (SfxStyleSheetBase*)aList.Next();
+ }
+
+ // Set link to the Style found in the Pool
+ if(pAnchor && pLastSheet)
+ {
+ pLastSheet->SetParent(pAnchor->GetName());
+ }
+
+ // if list was empty (all Styles exist in destination pool)
+ // pForThisObject is not yet set
+ if(!pForThisObject && pAnchor)
+ {
+ pForThisObject = pAnchor;
+ }
+
+ // De-register at old and register at new Style
+ if(GetStyleSheet() != pForThisObject)
+ {
+ ImpRemoveStyleSheet();
+ ImpAddStyleSheet((SfxStyleSheet*)pForThisObject, sal_True);
+ }
+ }
+ else
+ {
+ // there is no StyleSheetPool in the new model, thus set
+ // all items as hard items in the object
+ List aList;
+ const SfxItemSet* pItemSet = &pOldStyleSheet->GetItemSet();
+
+ while(pItemSet)
+ {
+ aList.Insert((void*)pItemSet, CONTAINER_APPEND);
+ pItemSet = pItemSet->GetParent();
+ }
+
+ SfxItemSet* pNewSet = &CreateObjectSpecificItemSet(pNewModel->GetItemPool());
+ pItemSet = (SfxItemSet*)aList.Last();
+
+ while(pItemSet)
+ {
+ pNewSet->Put(*pItemSet);
+ pItemSet = (SfxItemSet*)aList.Prev();
+ }
+
+ // Items which were hard attributes before need to stay
+ if(mpItemSet)
+ {
+ SfxWhichIter aIter(*mpItemSet);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+
+ while(nWhich)
+ {
+ if(mpItemSet->GetItemState(nWhich, FALSE) == SFX_ITEM_SET)
+ {
+ pNewSet->Put(mpItemSet->Get(nWhich));
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+ }
+
+ if(bScaleUnitChanged)
+ {
+ ScaleItemSet(*pNewSet, aMetricFactor);
+ }
+
+ if(mpItemSet)
+ {
+ if(GetStyleSheet())
+ {
+ ImpRemoveStyleSheet();
+ }
+
+ delete mpItemSet;
+ mpItemSet = 0L;
+ }
+
+ mpItemSet = pNewSet;
+ }
+ }
+ }
+
+ // each object gets the default Style if there is none set yet.
+ if(mpItemSet && !GetStyleSheet() && pNewModel && !pNewModel->IsLoading())
+ {
+ SetStyleSheet(pNewModel->GetDefaultStyleSheet(), sal_True);
+ }
+ }
+ }
+
+ void AttributeProperties::ForceStyleToHardAttributes()
+ {
+ if(GetStyleSheet() && HAS_BASE(SfxStyleSheet, mpStyleSheet))
+ {
+ // prepare copied, new itemset, but WITHOUT parent
+ GetObjectItemSet();
+ SfxItemSet* pDestItemSet = new SfxItemSet(*mpItemSet);
+ pDestItemSet->SetParent(0L);
+
+ // pepare forgetting the current stylesheet like in RemoveStyleSheet()
+ EndListening(*mpStyleSheet);
+ EndListening(mpStyleSheet->GetPool());
+
+ // prepare the iter; use the mpObjectItemSet which may have less
+ // WhichIDs than the style.
+ SfxWhichIter aIter(*pDestItemSet);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+ const SfxPoolItem *pItem = NULL;
+
+ // now set all hard attributes of the current at the new itemset
+ while(nWhich)
+ {
+ // #i61284# use mpItemSet with parents, makes things easier and reduces to
+ // one loop
+ if(SFX_ITEM_SET == mpItemSet->GetItemState(nWhich, true, &pItem))
+ {
+ pDestItemSet->Put(*pItem);
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+
+ // replace itemsets
+ delete mpItemSet;
+ mpItemSet = pDestItemSet;
+
+ // set necessary changes like in RemoveStyleSheet()
+ GetSdrObject().SetBoundRectDirty();
+ GetSdrObject().SetRectsDirty(sal_True);
+
+ mpStyleSheet = NULL;
+ }
+ }
+
+ void AttributeProperties::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
+ {
+ sal_Bool bHintUsed(sal_False);
+
+ SfxStyleSheetHint *pStyleHint = PTR_CAST(SfxStyleSheetHint, &rHint);
+
+ if(pStyleHint && pStyleHint->GetStyleSheet() == GetStyleSheet())
+ {
+ SdrObject& rObj = GetSdrObject();
+ //SdrPage* pPage = rObj.GetPage();
+
+ switch(pStyleHint->GetHint())
+ {
+ case SFX_STYLESHEET_CREATED :
+ {
+ // cannot happen, nothing to do
+ break;
+ }
+ case SFX_STYLESHEET_MODIFIED :
+ case SFX_STYLESHEET_CHANGED :
+ {
+ // notify change
+ break;
+ }
+ case SFX_STYLESHEET_ERASED :
+ case SFX_STYLESHEET_INDESTRUCTION :
+ {
+ // Style needs to be exchanged
+ SfxStyleSheet* pNewStSh = 0L;
+ SdrModel* pModel = rObj.GetModel();
+
+ // #111111#
+ // Do nothing if object is in destruction, else a StyleSheet may be found from
+ // a StyleSheetPool which is just being deleted itself. and thus it would be fatal
+ // to register as listener to that new StyleSheet.
+ if(pModel && !rObj.IsInDestruction())
+ {
+ if(HAS_BASE(SfxStyleSheet, GetStyleSheet()))
+ {
+ pNewStSh = (SfxStyleSheet*)pModel->GetStyleSheetPool()->Find(
+ GetStyleSheet()->GetParent(), GetStyleSheet()->GetFamily());
+ }
+
+ if(!pNewStSh)
+ {
+ pNewStSh = pModel->GetDefaultStyleSheet();
+ }
+ }
+
+ // remove used style, it's erased or in destruction
+ ImpRemoveStyleSheet();
+
+ if(pNewStSh)
+ {
+ ImpAddStyleSheet(pNewStSh, sal_True);
+ }
+
+ break;
+ }
+ }
+
+ // Get old BoundRect. Do this after the style change is handled
+ // in the ItemSet parts because GetBoundRect() may calculate a new
+ Rectangle aBoundRect = rObj.GetLastBoundRect();
+
+ rObj.SetRectsDirty(sal_True);
+
+ // tell the object about the change
+ rObj.SetChanged();
+ rObj.BroadcastObjectChange();
+
+ //if(pPage && pPage->IsInserted())
+ //{
+ // rObj.BroadcastObjectChange();
+ //}
+
+ rObj.SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect);
+
+ bHintUsed = sal_True;
+ }
+
+ if(!bHintUsed)
+ {
+ // forward to SdrObject ATM. Not sure if this will be necessary
+ // in the future.
+ GetSdrObject().Notify(rBC, rHint);
+ }
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/captionproperties.cxx b/svx/source/sdr/properties/captionproperties.cxx
new file mode 100644
index 000000000000..e08bf5516f03
--- /dev/null
+++ b/svx/source/sdr/properties/captionproperties.cxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/captionproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svx/svddef.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/svdocapt.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ // create a new itemset
+ SfxItemSet& CaptionProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return *(new SfxItemSet(rPool,
+
+ // range from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // range from SdrCaptionObj
+ SDRATTR_CAPTION_FIRST, SDRATTR_CAPTION_LAST,
+
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END,
+
+ // end
+ 0, 0));
+ }
+
+ CaptionProperties::CaptionProperties(SdrObject& rObj)
+ : RectangleProperties(rObj)
+ {
+ }
+
+ CaptionProperties::CaptionProperties(const CaptionProperties& rProps, SdrObject& rObj)
+ : RectangleProperties(rProps, rObj)
+ {
+ }
+
+ CaptionProperties::~CaptionProperties()
+ {
+ }
+
+ BaseProperties& CaptionProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new CaptionProperties(*this, rObj));
+ }
+
+ void CaptionProperties::ItemSetChanged(const SfxItemSet& rSet)
+ {
+ SdrCaptionObj& rObj = (SdrCaptionObj&)GetSdrObject();
+
+ // local changes
+ rObj.ImpRecalcTail();
+
+ // call parent
+ RectangleProperties::ItemSetChanged(rSet);
+ }
+
+ void CaptionProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ SdrCaptionObj& rObj = (SdrCaptionObj&)GetSdrObject();
+
+ // call parent
+ RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+
+ // local changes
+ rObj.ImpRecalcTail();
+ }
+
+ void CaptionProperties::ForceDefaultAttributes()
+ {
+ // call parent
+ RectangleProperties::ForceDefaultAttributes();
+
+ // force ItemSet
+ GetObjectItemSet();
+
+ // this was set by TextProperties::ForceDefaultAttributes(),
+ // retet to default
+ mpItemSet->ClearItem(XATTR_LINESTYLE);
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/circleproperties.cxx b/svx/source/sdr/properties/circleproperties.cxx
new file mode 100644
index 000000000000..9dc37cb6b760
--- /dev/null
+++ b/svx/source/sdr/properties/circleproperties.cxx
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/circleproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svx/svddef.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/svdocirc.hxx>
+#include <svx/sxcikitm.hxx>
+#include <svx/sxciaitm.hxx>
+#include <svx/sxciaitm.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ // create a new itemset
+ SfxItemSet& CircleProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return *(new SfxItemSet(rPool,
+
+ // range from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // range from SdrCircObj
+ SDRATTR_CIRC_FIRST, SDRATTR_CIRC_LAST,
+
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END,
+
+ // end
+ 0, 0));
+ }
+
+ CircleProperties::CircleProperties(SdrObject& rObj)
+ : RectangleProperties(rObj)
+ {
+ }
+
+ CircleProperties::CircleProperties(const CircleProperties& rProps, SdrObject& rObj)
+ : RectangleProperties(rProps, rObj)
+ {
+ }
+
+ CircleProperties::~CircleProperties()
+ {
+ }
+
+ BaseProperties& CircleProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new CircleProperties(*this, rObj));
+ }
+
+ void CircleProperties::ItemSetChanged(const SfxItemSet& rSet)
+ {
+ SdrCircObj& rObj = (SdrCircObj&)GetSdrObject();
+
+ // call parent
+ RectangleProperties::ItemSetChanged(rSet);
+
+ // local changes
+ rObj.ImpSetAttrToCircInfo();
+ }
+
+ void CircleProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ SdrCircObj& rObj = (SdrCircObj&)GetSdrObject();
+
+ // local changes
+ rObj.SetXPolyDirty();
+
+ // call parent
+ RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+
+ // local changes
+ rObj.ImpSetAttrToCircInfo();
+ }
+
+ void CircleProperties::ForceDefaultAttributes()
+ {
+ SdrCircObj& rObj = (SdrCircObj&)GetSdrObject();
+ SdrCircKind eKindA = SDRCIRC_FULL;
+ SdrObjKind eKind = rObj.GetCircleKind();
+
+ if(eKind == OBJ_SECT)
+ {
+ eKindA = SDRCIRC_SECT;
+ }
+ else if(eKind == OBJ_CARC)
+ {
+ eKindA = SDRCIRC_ARC;
+ }
+ else if(eKind == OBJ_CCUT)
+ {
+ eKindA = SDRCIRC_CUT;
+ }
+
+ if(eKindA != SDRCIRC_FULL)
+ {
+ // force ItemSet
+ GetObjectItemSet();
+
+ mpItemSet->Put(SdrCircKindItem(eKindA));
+
+ if(rObj.GetStartWink())
+ {
+ mpItemSet->Put(SdrCircStartAngleItem(rObj.GetStartWink()));
+ }
+
+ if(rObj.GetEndWink() != 36000)
+ {
+ mpItemSet->Put(SdrCircEndAngleItem(rObj.GetEndWink()));
+ }
+ }
+
+ // call parent after SetObjectItem(SdrCircKindItem())
+ // because ForceDefaultAttr() will call
+ // ImpSetAttrToCircInfo() which needs a correct
+ // SdrCircKindItem
+ RectangleProperties::ForceDefaultAttributes();
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/connectorproperties.cxx b/svx/source/sdr/properties/connectorproperties.cxx
new file mode 100644
index 000000000000..963a541a73c1
--- /dev/null
+++ b/svx/source/sdr/properties/connectorproperties.cxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/connectorproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svx/svddef.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/svdoedge.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ // create a new itemset
+ SfxItemSet& ConnectorProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return *(new SfxItemSet(rPool,
+
+ // range from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // range from SdrEdgeObj
+ SDRATTR_EDGE_FIRST, SDRATTR_EDGE_LAST,
+
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END,
+
+ // end
+ 0, 0));
+ }
+
+ ConnectorProperties::ConnectorProperties(SdrObject& rObj)
+ : TextProperties(rObj)
+ {
+ }
+
+ ConnectorProperties::ConnectorProperties(const ConnectorProperties& rProps, SdrObject& rObj)
+ : TextProperties(rProps, rObj)
+ {
+ }
+
+ ConnectorProperties::~ConnectorProperties()
+ {
+ }
+
+ BaseProperties& ConnectorProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new ConnectorProperties(*this, rObj));
+ }
+
+ void ConnectorProperties::ItemSetChanged(const SfxItemSet& rSet)
+ {
+ SdrEdgeObj& rObj = (SdrEdgeObj&)GetSdrObject();
+
+ // call parent
+ TextProperties::ItemSetChanged(rSet);
+
+ // local changes
+ rObj.ImpSetAttrToEdgeInfo();
+ }
+
+ void ConnectorProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ SdrEdgeObj& rObj = (SdrEdgeObj&)GetSdrObject();
+
+ // call parent
+ TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+
+ // local changes
+ rObj.ImpSetAttrToEdgeInfo();
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/customshapeproperties.cxx b/svx/source/sdr/properties/customshapeproperties.cxx
new file mode 100644
index 000000000000..6146dc66e417
--- /dev/null
+++ b/svx/source/sdr/properties/customshapeproperties.cxx
@@ -0,0 +1,239 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/customshapeproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svx/svdoashp.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/sdtagitm.hxx>
+#include <svl/whiter.hxx>
+#include <svl/itemset.hxx>
+#include <svl/smplhint.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ void CustomShapeProperties::UpdateTextFrameStatus()
+ {
+ SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
+ SdrTextAutoGrowHeightItem& rAutoGrowHeightItem =
+ (SdrTextAutoGrowHeightItem&)rObj.GetMergedItem( SDRATTR_TEXT_AUTOGROWHEIGHT );
+ rObj.bTextFrame = rAutoGrowHeightItem.GetValue() != 0;
+
+ if ( rObj.bTextFrame )
+ rObj.NbcAdjustTextFrameWidthAndHeight();
+ }
+
+ SfxItemSet& CustomShapeProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return *(new SfxItemSet(rPool,
+
+ // ranges from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // Graphic Attributes
+ SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,
+
+ // 3d Properties
+ SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
+
+ // CustomShape properties
+ SDRATTR_CUSTOMSHAPE_FIRST, SDRATTR_CUSTOMSHAPE_LAST,
+
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END,
+
+ // end
+ 0, 0));
+ }
+ sal_Bool CustomShapeProperties::AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem ) const
+ {
+ sal_Bool bAllowItemChange = sal_True;
+ if ( !pNewItem )
+ {
+ if ( ( nWhich >= SDRATTR_CUSTOMSHAPE_FIRST ) && ( nWhich <= SDRATTR_CUSTOMSHAPE_LAST ) )
+ bAllowItemChange = sal_False;
+ }
+ if ( bAllowItemChange )
+ bAllowItemChange = TextProperties::AllowItemChange( nWhich, pNewItem );
+ return bAllowItemChange;
+ }
+ void CustomShapeProperties::ClearObjectItem(const sal_uInt16 nWhich)
+ {
+ if ( !nWhich )
+ {
+ SfxWhichIter aIter( *mpItemSet );
+ sal_uInt16 nWhich2 = aIter.FirstWhich();
+ while( nWhich2 )
+ {
+ TextProperties::ClearObjectItemDirect( nWhich2 );
+ nWhich2 = aIter.NextWhich();
+ }
+ SfxItemSet aSet((SfxItemPool&)(*GetSdrObject().GetObjectItemPool()));
+ ItemSetChanged(aSet);
+ }
+ else
+ TextProperties::ClearObjectItem( nWhich );
+ }
+ void CustomShapeProperties::ClearObjectItemDirect(const sal_uInt16 nWhich)
+ {
+ if ( !nWhich )
+ {
+ SfxWhichIter aIter( *mpItemSet );
+ sal_uInt16 nWhich2 = aIter.FirstWhich();
+ while( nWhich2 )
+ {
+ TextProperties::ClearObjectItemDirect( nWhich2 );
+ nWhich2 = aIter.NextWhich();
+ }
+ }
+ else
+ TextProperties::ClearObjectItemDirect( nWhich );
+ }
+ void CustomShapeProperties::ItemSetChanged(const SfxItemSet& rSet)
+ {
+ SdrObjCustomShape& rObj = (SdrObjCustomShape&)GetSdrObject();
+
+ if( SFX_ITEM_SET == rSet.GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) )
+ {
+ rObj.bTextFrame = ((SdrTextAutoGrowHeightItem&)rSet.Get( SDRATTR_TEXT_AUTOGROWHEIGHT )).GetValue() != 0;
+ }
+
+ // call parent
+ TextProperties::ItemSetChanged(rSet);
+
+ // local changes, removing cached objects
+ rObj.InvalidateRenderGeometry();
+ }
+ void CustomShapeProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
+ {
+ SdrObjCustomShape& rObj = (SdrObjCustomShape&)GetSdrObject();
+ //OutlinerParaObject* pParaObj = rObj.GetOutlinerParaObject();
+
+ if( pNewItem && ( SDRATTR_TEXT_AUTOGROWHEIGHT == nWhich ) )
+ {
+ rObj.bTextFrame = ((SdrTextAutoGrowHeightItem*)pNewItem)->GetValue() != 0;
+ }
+ // call parent
+ TextProperties::ItemChange( nWhich, pNewItem );
+
+ rObj.InvalidateRenderGeometry();
+ }
+ void CustomShapeProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ TextProperties::SetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr );
+ UpdateTextFrameStatus();
+ }
+ void CustomShapeProperties::ForceDefaultAttributes()
+ {
+ UpdateTextFrameStatus();
+
+/* SJ: Following is no good if creating customshapes, leading to objects that are white after loading via xml
+
+ SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
+ sal_Bool bTextFrame(rObj.IsTextFrame());
+
+ // force ItemSet
+ GetObjectItemSet();
+
+ if(bTextFrame)
+ {
+ mpItemSet->Put(XLineStyleItem(XLINE_NONE));
+ mpItemSet->Put(XFillColorItem(String(), Color(COL_WHITE)));
+ mpItemSet->Put(XFillStyleItem(XFILL_NONE));
+ }
+ else
+ {
+ mpItemSet->Put(SvxAdjustItem(SVX_ADJUST_CENTER));
+ mpItemSet->Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER));
+ mpItemSet->Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER));
+ }
+*/
+ }
+ CustomShapeProperties::CustomShapeProperties(SdrObject& rObj)
+ : TextProperties(rObj)
+ {
+ }
+
+ CustomShapeProperties::CustomShapeProperties(const CustomShapeProperties& rProps, SdrObject& rObj)
+ : TextProperties(rProps, rObj)
+ {
+ }
+
+ CustomShapeProperties::~CustomShapeProperties()
+ {
+ }
+
+ BaseProperties& CustomShapeProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new CustomShapeProperties(*this, rObj));
+ }
+ void CustomShapeProperties::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+ {
+ TextProperties::Notify( rBC, rHint );
+
+ sal_Bool bRemoveRenderGeometry = sal_False;
+
+ const SfxStyleSheetHint *pStyleHint = PTR_CAST( SfxStyleSheetHint, &rHint );
+ const SfxSimpleHint *pSimpleHint = PTR_CAST( SfxSimpleHint, &rHint );
+ if ( pStyleHint && pStyleHint->GetStyleSheet() == GetStyleSheet() )
+ {
+ switch( pStyleHint->GetHint() )
+ {
+ case SFX_STYLESHEET_MODIFIED :
+ case SFX_STYLESHEET_CHANGED :
+ bRemoveRenderGeometry = sal_True;
+ break;
+ };
+ }
+ else if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DATACHANGED )
+ {
+ bRemoveRenderGeometry = sal_True;
+ }
+ if ( bRemoveRenderGeometry )
+ {
+ UpdateTextFrameStatus();
+
+ // local changes, removing cached objects
+ SdrObjCustomShape& rObj = (SdrObjCustomShape&)GetSdrObject();
+ rObj.InvalidateRenderGeometry();
+ }
+
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx
new file mode 100644
index 000000000000..005ba0b19789
--- /dev/null
+++ b/svx/source/sdr/properties/defaultproperties.cxx
@@ -0,0 +1,237 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/defaultproperties.hxx>
+#include <svx/sdr/properties/itemsettools.hxx>
+#include <svl/itemset.hxx>
+#include <svl/whiter.hxx>
+
+#include <vector>
+#include <svx/svdobj.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svdpool.hxx>
+#include <editeng/eeitem.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ SfxItemSet& DefaultProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ // Basic implementation; Basic object has NO attributes
+ return *(new SfxItemSet(rPool));
+ }
+
+ DefaultProperties::DefaultProperties(SdrObject& rObj)
+ : BaseProperties(rObj),
+ mpItemSet(0L)
+ {
+ }
+
+ DefaultProperties::DefaultProperties(const DefaultProperties& rProps, SdrObject& rObj)
+ : BaseProperties(rObj),
+ mpItemSet(0L)
+ {
+ if(rProps.mpItemSet)
+ {
+ mpItemSet = rProps.mpItemSet->Clone(TRUE);
+
+ // do not keep parent info, this may be changed by later construrtors.
+ // This class just copies the ItemSet, ignore parent.
+ if(mpItemSet && mpItemSet->GetParent())
+ {
+ mpItemSet->SetParent(0L);
+ }
+ }
+ }
+
+ BaseProperties& DefaultProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new DefaultProperties(*this, rObj));
+ }
+
+ DefaultProperties::~DefaultProperties()
+ {
+ if(mpItemSet)
+ {
+ delete mpItemSet;
+ mpItemSet = 0L;
+ }
+ }
+
+ const SfxItemSet& DefaultProperties::GetObjectItemSet() const
+ {
+ if(!mpItemSet)
+ {
+ ((DefaultProperties*)this)->mpItemSet = &(((DefaultProperties*)this)->CreateObjectSpecificItemSet(*GetSdrObject().GetObjectItemPool()));
+ ((DefaultProperties*)this)->ForceDefaultAttributes();
+ }
+
+ DBG_ASSERT(mpItemSet, "Could not create an SfxItemSet(!)");
+
+ return *mpItemSet;
+ }
+
+ void DefaultProperties::SetObjectItem(const SfxPoolItem& rItem)
+ {
+ const sal_uInt16 nWhichID(rItem.Which());
+
+ if(AllowItemChange(nWhichID, &rItem))
+ {
+ ItemChange(nWhichID, &rItem);
+ PostItemChange(nWhichID);
+
+ SfxItemSet aSet(*GetSdrObject().GetObjectItemPool(), nWhichID, nWhichID);
+ aSet.Put(rItem);
+ ItemSetChanged(aSet);
+ }
+ }
+
+ void DefaultProperties::SetObjectItemDirect(const SfxPoolItem& rItem)
+ {
+ const sal_uInt16 nWhichID(rItem.Which());
+
+ if(AllowItemChange(nWhichID, &rItem))
+ {
+ ItemChange(nWhichID, &rItem);
+ }
+ }
+
+ void DefaultProperties::ClearObjectItem(const sal_uInt16 nWhich)
+ {
+ if(AllowItemChange(nWhich))
+ {
+ ItemChange(nWhich);
+ PostItemChange(nWhich);
+
+ if(nWhich)
+ {
+ SfxItemSet aSet(*GetSdrObject().GetObjectItemPool(), nWhich, nWhich, 0, 0);
+ ItemSetChanged(aSet);
+ }
+ }
+ }
+
+ void DefaultProperties::ClearObjectItemDirect(const sal_uInt16 nWhich)
+ {
+ if(AllowItemChange(nWhich))
+ {
+ ItemChange(nWhich);
+ }
+ }
+
+ void DefaultProperties::SetObjectItemSet(const SfxItemSet& rSet)
+ {
+ SfxWhichIter aWhichIter(rSet);
+ sal_uInt16 nWhich(aWhichIter.FirstWhich());
+ const SfxPoolItem *pPoolItem;
+ std::vector< sal_uInt16 > aPostItemChangeList;
+ sal_Bool bDidChange(sal_False);
+ SfxItemSet aSet(*GetSdrObject().GetObjectItemPool(), SDRATTR_START, EE_ITEMS_END, 0, 0);
+
+ // give a hint to STL_Vector
+ aPostItemChangeList.reserve(rSet.Count());
+
+ while(nWhich)
+ {
+ if(SFX_ITEM_SET == rSet.GetItemState(nWhich, FALSE, &pPoolItem))
+ {
+ if(AllowItemChange(nWhich, pPoolItem))
+ {
+ bDidChange = sal_True;
+ ItemChange(nWhich, pPoolItem);
+ aPostItemChangeList.push_back( nWhich );
+ aSet.Put(*pPoolItem);
+ }
+ }
+
+ nWhich = aWhichIter.NextWhich();
+ }
+
+ if(bDidChange)
+ {
+ std::vector< sal_uInt16 >::iterator aIter = aPostItemChangeList.begin();
+ const std::vector< sal_uInt16 >::iterator aEnd = aPostItemChangeList.end();
+
+ while(aIter != aEnd)
+ {
+ PostItemChange(*aIter);
+ aIter++;
+ }
+
+ ItemSetChanged(aSet);
+ }
+ }
+
+ void DefaultProperties::ItemSetChanged(const SfxItemSet& /*rSet*/)
+ {
+ }
+
+ sal_Bool DefaultProperties::AllowItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/) const
+ {
+ return sal_True;
+ }
+
+ void DefaultProperties::ItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/)
+ {
+ }
+
+ void DefaultProperties::PostItemChange(const sal_uInt16 /*nWhich*/)
+ {
+ }
+
+ void DefaultProperties::SetStyleSheet(SfxStyleSheet* /*pNewStyleSheet*/, sal_Bool /*bDontRemoveHardAttr*/)
+ {
+ // no StyleSheet in DefaultProperties
+ }
+
+ SfxStyleSheet* DefaultProperties::GetStyleSheet() const
+ {
+ // no StyleSheet in DefaultProperties
+ return 0L;
+ }
+
+ void DefaultProperties::ForceDefaultAttributes()
+ {
+ }
+
+ void DefaultProperties::Scale(const Fraction& rScale)
+ {
+ if(mpItemSet)
+ {
+ ScaleItemSet(*mpItemSet, rScale);
+ }
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/e3dcompoundproperties.cxx b/svx/source/sdr/properties/e3dcompoundproperties.cxx
new file mode 100644
index 000000000000..a939ed664a8d
--- /dev/null
+++ b/svx/source/sdr/properties/e3dcompoundproperties.cxx
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/e3dcompoundproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svx/obj3d.hxx>
+#include <svx/scene3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ E3dCompoundProperties::E3dCompoundProperties(SdrObject& rObj)
+ : E3dProperties(rObj)
+ {
+ }
+
+ E3dCompoundProperties::E3dCompoundProperties(const E3dCompoundProperties& rProps, SdrObject& rObj)
+ : E3dProperties(rProps, rObj)
+ {
+ }
+
+ E3dCompoundProperties::~E3dCompoundProperties()
+ {
+ }
+
+ BaseProperties& E3dCompoundProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new E3dCompoundProperties(*this, rObj));
+ }
+
+ const SfxItemSet& E3dCompoundProperties::GetObjectItemSet() const
+ {
+ //DBG_ASSERT(sal_False, "E3dCompoundProperties::GetObjectItemSet() maybe the wrong call (!)");
+ return E3dProperties::GetObjectItemSet();
+ }
+
+ const SfxItemSet& E3dCompoundProperties::GetMergedItemSet() const
+ {
+ // include Items of scene this object belongs to
+ E3dCompoundObject& rObj = (E3dCompoundObject&)GetSdrObject();
+ E3dScene* pScene = rObj.GetScene();
+
+ if(pScene)
+ {
+ // force ItemSet
+ GetObjectItemSet();
+
+ // add filtered scene properties (SDRATTR_3DSCENE_) to local itemset
+ SfxItemSet aSet(*mpItemSet->GetPool(), SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST);
+ aSet.Put(pScene->GetProperties().GetObjectItemSet());
+ mpItemSet->Put(aSet);
+ }
+
+ // call parent
+ return E3dProperties::GetMergedItemSet();
+ }
+
+ void E3dCompoundProperties::SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems)
+ {
+ // Set scene specific items at scene
+ E3dCompoundObject& rObj = (E3dCompoundObject&)GetSdrObject();
+ E3dScene* pScene = rObj.GetScene();
+
+ if(pScene)
+ {
+ // force ItemSet
+ GetObjectItemSet();
+
+ // Generate filtered scene properties (SDRATTR_3DSCENE_) itemset
+ SfxItemSet aSet(*mpItemSet->GetPool(), SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST);
+ aSet.Put(rSet);
+
+ if(bClearAllItems)
+ {
+ pScene->GetProperties().ClearObjectItem();
+ }
+
+ if(aSet.Count())
+ {
+ pScene->GetProperties().SetObjectItemSet(aSet);
+ }
+ }
+
+ // call parent. This will set items on local object, too.
+ E3dProperties::SetMergedItemSet(rSet, bClearAllItems);
+ }
+
+ void E3dCompoundProperties::PostItemChange(const sal_uInt16 nWhich)
+ {
+ // call parent
+ E3dProperties::PostItemChange(nWhich);
+
+ // handle value change
+ E3dCompoundObject& rObj = (E3dCompoundObject&)GetSdrObject();
+
+ switch(nWhich)
+ {
+ // #i28528#
+ // Added extra Item (Bool) for chart2 to be able to show reduced line geometry
+ case SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_DOUBLE_SIDED:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_NORMALS_KIND:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_NORMALS_INVERT:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_TEXTURE_PROJ_X:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_TEXTURE_PROJ_Y:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ }
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/e3dextrudeproperties.cxx b/svx/source/sdr/properties/e3dextrudeproperties.cxx
new file mode 100644
index 000000000000..91b86551339c
--- /dev/null
+++ b/svx/source/sdr/properties/e3dextrudeproperties.cxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/e3dextrudeproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svx/extrud3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ E3dExtrudeProperties::E3dExtrudeProperties(SdrObject& rObj)
+ : E3dCompoundProperties(rObj)
+ {
+ }
+
+ E3dExtrudeProperties::E3dExtrudeProperties(const E3dExtrudeProperties& rProps, SdrObject& rObj)
+ : E3dCompoundProperties(rProps, rObj)
+ {
+ }
+
+ E3dExtrudeProperties::~E3dExtrudeProperties()
+ {
+ }
+
+ BaseProperties& E3dExtrudeProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new E3dExtrudeProperties(*this, rObj));
+ }
+
+ void E3dExtrudeProperties::PostItemChange(const sal_uInt16 nWhich)
+ {
+ // call parent
+ E3dCompoundProperties::PostItemChange(nWhich);
+
+ // handle value change
+ E3dExtrudeObj& rObj = (E3dExtrudeObj&)GetSdrObject();
+
+ switch(nWhich)
+ {
+ case SDRATTR_3DOBJ_PERCENT_DIAGONAL:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_BACKSCALE:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_DEPTH:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ }
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/e3dlatheproperties.cxx b/svx/source/sdr/properties/e3dlatheproperties.cxx
new file mode 100644
index 000000000000..135104abab32
--- /dev/null
+++ b/svx/source/sdr/properties/e3dlatheproperties.cxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/e3dlatheproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svx/lathe3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ E3dLatheProperties::E3dLatheProperties(SdrObject& rObj)
+ : E3dCompoundProperties(rObj)
+ {
+ }
+
+ E3dLatheProperties::E3dLatheProperties(const E3dLatheProperties& rProps, SdrObject& rObj)
+ : E3dCompoundProperties(rProps, rObj)
+ {
+ }
+
+ E3dLatheProperties::~E3dLatheProperties()
+ {
+ }
+
+ BaseProperties& E3dLatheProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new E3dLatheProperties(*this, rObj));
+ }
+
+ void E3dLatheProperties::PostItemChange(const sal_uInt16 nWhich)
+ {
+ // call parent
+ E3dCompoundProperties::PostItemChange(nWhich);
+
+ // handle value change
+ E3dLatheObj& rObj = (E3dLatheObj&)GetSdrObject();
+
+ switch(nWhich)
+ {
+ case SDRATTR_3DOBJ_HORZ_SEGS:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_VERT_SEGS:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_PERCENT_DIAGONAL:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_BACKSCALE:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_END_ANGLE:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ }
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/e3dproperties.cxx b/svx/source/sdr/properties/e3dproperties.cxx
new file mode 100644
index 000000000000..9ae3e2565a78
--- /dev/null
+++ b/svx/source/sdr/properties/e3dproperties.cxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/e3dproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svx/svddef.hxx>
+#include <svx/obj3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ // create a new itemset
+ SfxItemSet& E3dProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return *(new SfxItemSet(rPool,
+
+ // ranges from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // ranges from E3dObject, contains object and scene because of GetMergedItemSet()
+ SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
+
+ // end
+ 0, 0));
+ }
+
+ E3dProperties::E3dProperties(SdrObject& rObj)
+ : AttributeProperties(rObj)
+ {
+ }
+
+ E3dProperties::E3dProperties(const E3dProperties& rProps, SdrObject& rObj)
+ : AttributeProperties(rProps, rObj)
+ {
+ }
+
+ E3dProperties::~E3dProperties()
+ {
+ }
+
+ BaseProperties& E3dProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new E3dProperties(*this, rObj));
+ }
+
+ void E3dProperties::ItemSetChanged(const SfxItemSet& rSet)
+ {
+ E3dObject& rObj = (E3dObject&)GetSdrObject();
+
+ // call parent
+ AttributeProperties::ItemSetChanged(rSet);
+
+ // local changes
+ rObj.StructureChanged();
+ }
+
+ void E3dProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ // call parent
+ AttributeProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+
+ // propagate call to contained objects
+ const SdrObjList* pSub = ((const E3dObject&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ pSub->GetObj(a)->GetProperties().SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+ }
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/e3dsceneproperties.cxx b/svx/source/sdr/properties/e3dsceneproperties.cxx
new file mode 100644
index 000000000000..41a3294b2a01
--- /dev/null
+++ b/svx/source/sdr/properties/e3dsceneproperties.cxx
@@ -0,0 +1,334 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/e3dsceneproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/whiter.hxx>
+#include <svx/svddef.hxx>
+#include <svx/scene3d.hxx>
+#include <svditer.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ E3dSceneProperties::E3dSceneProperties(SdrObject& rObj)
+ : E3dProperties(rObj)
+ {
+ }
+
+ E3dSceneProperties::E3dSceneProperties(const E3dSceneProperties& rProps, SdrObject& rObj)
+ : E3dProperties(rProps, rObj)
+ {
+ }
+
+ E3dSceneProperties::~E3dSceneProperties()
+ {
+ }
+
+ BaseProperties& E3dSceneProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new E3dSceneProperties(*this, rObj));
+ }
+
+ const SfxItemSet& E3dSceneProperties::GetObjectItemSet() const
+ {
+ //DBG_ASSERT(sal_False, "E3dSceneProperties::GetObjectItemSet() maybe the wrong call (!)");
+ return E3dProperties::GetObjectItemSet();
+ }
+
+ const SfxItemSet& E3dSceneProperties::GetMergedItemSet() const
+ {
+ // prepare ItemSet
+ if(mpItemSet)
+ {
+ // filter for SDRATTR_3DSCENE_ items, only keep those items
+ SfxItemSet aNew(*mpItemSet->GetPool(), SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST);
+ aNew.Put(*mpItemSet);
+ mpItemSet->ClearItem();
+ mpItemSet->Put(aNew);
+ }
+ else
+ {
+ // No ItemSet yet, force local ItemSet
+ GetObjectItemSet();
+ }
+
+ // collect all ItemSets of contained 3d objects
+ const SdrObjList* pSub = ((const E3dScene&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ SdrObject* pObj = pSub->GetObj(a);
+
+ if(pObj && pObj->ISA(E3dCompoundObject))
+ {
+ const SfxItemSet& rSet = pObj->GetMergedItemSet();
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+
+ while(nWhich)
+ {
+ // Leave out the SDRATTR_3DSCENE_ range, this would only be double
+ // and always equal.
+ if(nWhich <= SDRATTR_3DSCENE_FIRST || nWhich >= SDRATTR_3DSCENE_LAST)
+ {
+ if(SFX_ITEM_DONTCARE == rSet.GetItemState(nWhich, FALSE))
+ {
+ mpItemSet->InvalidateItem(nWhich);
+ }
+ else
+ {
+ mpItemSet->MergeValue(rSet.Get(nWhich), TRUE);
+ }
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+ }
+ }
+
+ // call parent
+ return E3dProperties::GetMergedItemSet();
+ }
+
+ void E3dSceneProperties::SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems)
+ {
+ // Set SDRATTR_3DOBJ_ range at contained objects.
+ const SdrObjList* pSub = ((const E3dScene&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ if(nCount)
+ {
+ // Generate filtered ItemSet which contains all but the SDRATTR_3DSCENE items.
+ // #i50808# Leak fix, Clone produces a new instance and we get ownership here
+ SfxItemSet* pNewSet = rSet.Clone(TRUE);
+ DBG_ASSERT(pNewSet, "E3dSceneProperties::SetMergedItemSet(): Could not clone ItemSet (!)");
+
+ for(sal_uInt16 b(SDRATTR_3DSCENE_FIRST); b <= SDRATTR_3DSCENE_LAST; b++)
+ {
+ pNewSet->ClearItem(b);
+ }
+
+ if(pNewSet->Count())
+ {
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ SdrObject* pObj = pSub->GetObj(a);
+
+ if(pObj && pObj->ISA(E3dCompoundObject))
+ {
+ // set merged ItemSet at contained 3d object.
+ pObj->SetMergedItemSet(*pNewSet, bClearAllItems);
+ }
+ }
+ }
+
+ delete pNewSet;
+ }
+
+ // call parent. This will set items on local object, too.
+ E3dProperties::SetMergedItemSet(rSet, bClearAllItems);
+ }
+
+ void E3dSceneProperties::SetMergedItem(const SfxPoolItem& rItem)
+ {
+ const SdrObjList* pSub = ((const E3dScene&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ pSub->GetObj(a)->SetMergedItem(rItem);
+ }
+
+ // #i43809# call parent. This will set items on local object, too.
+ E3dProperties::SetMergedItem(rItem);
+ }
+
+ void E3dSceneProperties::ClearMergedItem(const sal_uInt16 nWhich)
+ {
+ const SdrObjList* pSub = ((const E3dScene&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ pSub->GetObj(a)->ClearMergedItem(nWhich);
+ }
+
+ // #i43809# call parent. This will clear items on local object, too.
+ E3dProperties::ClearMergedItem(nWhich);
+ }
+
+ void E3dSceneProperties::PostItemChange(const sal_uInt16 nWhich)
+ {
+ // call parent
+ E3dProperties::PostItemChange(nWhich);
+
+ // local changes
+ E3dScene& rObj = (E3dScene&)GetSdrObject();
+ rObj.StructureChanged();
+
+ switch(nWhich)
+ {
+ case SDRATTR_3DSCENE_PERSPECTIVE :
+ case SDRATTR_3DSCENE_DISTANCE :
+ case SDRATTR_3DSCENE_FOCAL_LENGTH :
+ {
+ // #83387#, #83391#
+ // one common function for the camera attributes
+ // since SetCamera() sets all three back to the ItemSet
+ Camera3D aSceneCam(rObj.GetCamera());
+ sal_Bool bChange(sal_False);
+
+ // for SDRATTR_3DSCENE_PERSPECTIVE:
+ if(aSceneCam.GetProjection() != rObj.GetPerspective())
+ {
+ aSceneCam.SetProjection(rObj.GetPerspective());
+ bChange = sal_True;
+ }
+
+ // for SDRATTR_3DSCENE_DISTANCE:
+ basegfx::B3DPoint aActualPosition(aSceneCam.GetPosition());
+ double fNew = rObj.GetDistance();
+
+ if(fNew != aActualPosition.getZ())
+ {
+ aSceneCam.SetPosition(basegfx::B3DPoint(aActualPosition.getX(), aActualPosition.getY(), fNew));
+ bChange = sal_True;
+ }
+
+ // for SDRATTR_3DSCENE_FOCAL_LENGTH:
+ fNew = rObj.GetFocalLength() / 100.0;
+
+ if(aSceneCam.GetFocalLength() != fNew)
+ {
+ aSceneCam.SetFocalLength(fNew);
+ bChange = sal_True;
+ }
+
+ // for all
+ if(bChange)
+ {
+ rObj.SetCamera(aSceneCam);
+ }
+
+ break;
+ }
+ }
+ }
+
+ void E3dSceneProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ const SdrObjList* pSub = ((const E3dScene&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ pSub->GetObj(a)->SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+ }
+ }
+
+ SfxStyleSheet* E3dSceneProperties::GetStyleSheet() const
+ {
+ SfxStyleSheet* pRetval = 0L;
+
+ const SdrObjList* pSub = ((const E3dScene&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ SfxStyleSheet* pCandidate = pSub->GetObj(a)->GetStyleSheet();
+
+ if(pRetval)
+ {
+ if(pCandidate != pRetval)
+ {
+ // different StyleSheelts, return none
+ return 0L;
+ }
+ }
+ else
+ {
+ pRetval = pCandidate;
+ }
+ }
+
+ return pRetval;
+ }
+
+ void E3dSceneProperties::MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel)
+ {
+ if(pSrcPool && pDestPool && (pSrcPool != pDestPool))
+ {
+ // call parent
+ E3dProperties::MoveToItemPool(pSrcPool, pDestPool, pNewModel);
+
+ // own reaction, but only with outmost scene
+ E3dScene& rObj = (E3dScene&)GetSdrObject();
+ const SdrObjList* pSubList = rObj.GetSubList();
+
+ if(pSubList && rObj.GetScene() == &rObj)
+ {
+ SdrObjListIter a3DIterator(*pSubList, IM_DEEPWITHGROUPS);
+
+ while(a3DIterator.IsMore())
+ {
+ E3dObject* pObj = (E3dObject*)a3DIterator.Next();
+ DBG_ASSERT(pObj->ISA(E3dObject), "In scenes there are only 3D objects allowed (!)");
+ pObj->GetProperties().MoveToItemPool(pSrcPool, pDestPool, pNewModel);
+ }
+ }
+ }
+ }
+
+ void E3dSceneProperties::SetSceneItemsFromCamera()
+ {
+ // force ItemSet
+ GetObjectItemSet();
+
+ E3dScene& rObj = (E3dScene&)GetSdrObject();
+ Camera3D aSceneCam(rObj.GetCamera());
+
+ // ProjectionType
+ mpItemSet->Put(Svx3DPerspectiveItem((UINT16)aSceneCam.GetProjection()));
+
+ // CamPos
+ mpItemSet->Put(Svx3DDistanceItem((UINT32)(aSceneCam.GetPosition().getZ() + 0.5)));
+
+ // FocalLength
+ mpItemSet->Put(Svx3DFocalLengthItem((UINT32)((aSceneCam.GetFocalLength() * 100.0) + 0.5)));
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/e3dsphereproperties.cxx b/svx/source/sdr/properties/e3dsphereproperties.cxx
new file mode 100644
index 000000000000..589a5e639d0a
--- /dev/null
+++ b/svx/source/sdr/properties/e3dsphereproperties.cxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/e3dsphereproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svx/sphere3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ E3dSphereProperties::E3dSphereProperties(SdrObject& rObj)
+ : E3dCompoundProperties(rObj)
+ {
+ }
+
+ E3dSphereProperties::E3dSphereProperties(const E3dSphereProperties& rProps, SdrObject& rObj)
+ : E3dCompoundProperties(rProps, rObj)
+ {
+ }
+
+ E3dSphereProperties::~E3dSphereProperties()
+ {
+ }
+
+ BaseProperties& E3dSphereProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new E3dSphereProperties(*this, rObj));
+ }
+
+ void E3dSphereProperties::PostItemChange(const sal_uInt16 nWhich)
+ {
+ // call parent
+ E3dCompoundProperties::PostItemChange(nWhich);
+
+ // handle value change
+ E3dSphereObj& rObj = (E3dSphereObj&)GetSdrObject();
+
+ switch(nWhich)
+ {
+ case SDRATTR_3DOBJ_HORZ_SEGS:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_VERT_SEGS:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ }
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/emptyproperties.cxx b/svx/source/sdr/properties/emptyproperties.cxx
new file mode 100644
index 000000000000..a33d5b23f84d
--- /dev/null
+++ b/svx/source/sdr/properties/emptyproperties.cxx
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/emptyproperties.hxx>
+#include <tools/debug.hxx>
+#include <svl/itemset.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdpool.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ // create a new itemset
+ SfxItemSet& EmptyProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ // Basic implementation; Basic object has NO attributes
+ DBG_ASSERT(sal_False, "EmptyProperties::CreateObjectSpecificItemSet() should never be called");
+ return *(new SfxItemSet(rPool));
+ }
+
+ EmptyProperties::EmptyProperties(SdrObject& rObj)
+ : BaseProperties(rObj),
+ mpEmptyItemSet(0L)
+ {
+ }
+
+ EmptyProperties::EmptyProperties(const EmptyProperties& rProps, SdrObject& rObj)
+ : BaseProperties(rProps, rObj),
+ mpEmptyItemSet(0L)
+ {
+ // #115593#
+ // do not gererate an assert, else derivations like PageProperties will generate an assert
+ // using the Clone() operator path.
+ }
+
+ EmptyProperties::~EmptyProperties()
+ {
+ if(mpEmptyItemSet)
+ {
+ delete mpEmptyItemSet;
+ mpEmptyItemSet = 0L;
+ }
+ }
+
+ BaseProperties& EmptyProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new EmptyProperties(*this, rObj));
+ }
+
+ const SfxItemSet& EmptyProperties::GetObjectItemSet() const
+ {
+ if(!mpEmptyItemSet)
+ {
+ ((EmptyProperties*)this)->mpEmptyItemSet = &(((EmptyProperties*)this)->CreateObjectSpecificItemSet(*GetSdrObject().GetObjectItemPool()));
+ }
+
+ DBG_ASSERT(mpEmptyItemSet, "Could not create an SfxItemSet(!)");
+ DBG_ASSERT(sal_False, "EmptyProperties::GetObjectItemSet() should never be called (!)");
+
+ return *mpEmptyItemSet;
+ }
+
+ void EmptyProperties::SetObjectItem(const SfxPoolItem& /*rItem*/)
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::SetObjectItem() should never be called (!)");
+ }
+
+ void EmptyProperties::SetObjectItemDirect(const SfxPoolItem& /*rItem*/)
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::SetObjectItemDirect() should never be called (!)");
+ }
+
+ void EmptyProperties::ClearObjectItem(const sal_uInt16 /*nWhich*/)
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::ClearObjectItem() should never be called (!)");
+ }
+
+ void EmptyProperties::ClearObjectItemDirect(const sal_uInt16 /*nWhich*/)
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::ClearObjectItemDirect() should never be called (!)");
+ }
+
+ void EmptyProperties::SetObjectItemSet(const SfxItemSet& /*rSet*/)
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::SetObjectItemSet() should never be called (!)");
+ }
+
+ void EmptyProperties::ItemSetChanged(const SfxItemSet& /*rSet*/)
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::ItemSetChanged() should never be called (!)");
+ }
+
+ sal_Bool EmptyProperties::AllowItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/) const
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::AllowItemChange() should never be called (!)");
+ return sal_True;
+ }
+
+ void EmptyProperties::ItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/)
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::ItemChange() should never be called (!)");
+ }
+
+ void EmptyProperties::PostItemChange(const sal_uInt16 /*nWhich*/)
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::PostItemChange() should never be called (!)");
+ }
+
+ void EmptyProperties::SetStyleSheet(SfxStyleSheet* /*pNewStyleSheet*/, sal_Bool /*bDontRemoveHardAttr*/)
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::SetStyleSheet() should never be called (!)");
+ }
+
+ SfxStyleSheet* EmptyProperties::GetStyleSheet() const
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::GetStyleSheet() should never be called (!)");
+ return 0L;
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/graphicproperties.cxx b/svx/source/sdr/properties/graphicproperties.cxx
new file mode 100644
index 000000000000..76eacd537c27
--- /dev/null
+++ b/svx/source/sdr/properties/graphicproperties.cxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/graphicproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svx/svddef.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/sdgcpitm.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ // create a new itemset
+ SfxItemSet& GraphicProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return *(new SfxItemSet(rPool,
+
+ // range from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // range from SdrGrafObj
+ SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,
+
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END,
+
+ // end
+ 0, 0));
+ }
+
+ GraphicProperties::GraphicProperties(SdrObject& rObj)
+ : RectangleProperties(rObj)
+ {
+ }
+
+ GraphicProperties::GraphicProperties(const GraphicProperties& rProps, SdrObject& rObj)
+ : RectangleProperties(rProps, rObj)
+ {
+ }
+
+ GraphicProperties::~GraphicProperties()
+ {
+ }
+
+ BaseProperties& GraphicProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new GraphicProperties(*this, rObj));
+ }
+
+ void GraphicProperties::ItemSetChanged(const SfxItemSet& rSet)
+ {
+ SdrGrafObj& rObj = (SdrGrafObj&)GetSdrObject();
+
+ // local changes
+ rObj.SetXPolyDirty();
+
+ // #i29367# Update GraphicAttr, too. This was formerly
+ // triggered by SdrGrafObj::Notify, which is no longer
+ // called nowadays. BTW: strictly speaking, the whole
+ // ImpSetAttrToGrafInfo/ImpSetGrafInfoToAttr stuff could
+ // be dumped, when SdrGrafObj::aGrafInfo is removed and
+ // always created on the fly for repaint.
+ rObj.ImpSetAttrToGrafInfo();
+
+ // call parent
+ RectangleProperties::ItemSetChanged(rSet);
+ }
+
+ void GraphicProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ SdrGrafObj& rObj = (SdrGrafObj&)GetSdrObject();
+
+ // local changes
+ rObj.SetXPolyDirty();
+
+ // call parent
+ RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+
+ // local changes
+ rObj.ImpSetAttrToGrafInfo();
+ }
+
+ void GraphicProperties::ForceDefaultAttributes()
+ {
+ // call parent
+ RectangleProperties::ForceDefaultAttributes();
+
+ // force ItemSet
+ GetObjectItemSet();
+
+ mpItemSet->Put( SdrGrafLuminanceItem( 0 ) );
+ mpItemSet->Put( SdrGrafContrastItem( 0 ) );
+ mpItemSet->Put( SdrGrafRedItem( 0 ) );
+ mpItemSet->Put( SdrGrafGreenItem( 0 ) );
+ mpItemSet->Put( SdrGrafBlueItem( 0 ) );
+ mpItemSet->Put( SdrGrafGamma100Item( 100 ) );
+ mpItemSet->Put( SdrGrafTransparenceItem( 0 ) );
+ mpItemSet->Put( SdrGrafInvertItem( FALSE ) );
+ mpItemSet->Put( SdrGrafModeItem( GRAPHICDRAWMODE_STANDARD ) );
+ mpItemSet->Put( SdrGrafCropItem( 0, 0, 0, 0 ) );
+
+ // #i25616#
+ mpItemSet->Put( XFillStyleItem(XFILL_NONE) );
+ mpItemSet->Put( XLineStyleItem(XLINE_NONE) );
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/groupproperties.cxx b/svx/source/sdr/properties/groupproperties.cxx
new file mode 100644
index 000000000000..9761946d15b3
--- /dev/null
+++ b/svx/source/sdr/properties/groupproperties.cxx
@@ -0,0 +1,298 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/groupproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/whiter.hxx>
+#include <svx/svddef.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdpool.hxx>
+#include <svx/svdpage.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ // create a new itemset
+ SfxItemSet& GroupProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ // Groups have in principle no ItemSet. To support methods like
+ // GetMergedItemSet() the local one is used. Thus, all items in the pool
+ // may be used and a pool itemset is created.
+ return *(new SfxItemSet(rPool));
+ }
+
+ GroupProperties::GroupProperties(SdrObject& rObj)
+ : DefaultProperties(rObj)
+ {
+ }
+
+ GroupProperties::GroupProperties(const GroupProperties& rProps, SdrObject& rObj)
+ : DefaultProperties(rProps, rObj)
+ {
+ }
+
+ GroupProperties::~GroupProperties()
+ {
+ }
+
+ BaseProperties& GroupProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new GroupProperties(*this, rObj));
+ }
+
+ const SfxItemSet& GroupProperties::GetObjectItemSet() const
+ {
+ DBG_ASSERT(sal_False, "GroupProperties::GetObjectItemSet() should never be called (!)");
+ return DefaultProperties::GetObjectItemSet();
+ }
+
+ const SfxItemSet& GroupProperties::GetMergedItemSet() const
+ {
+ // prepare ItemSet
+ if(mpItemSet)
+ {
+ // clear local itemset for merge
+ mpItemSet->ClearItem();
+ }
+ else
+ {
+ // force local itemset
+ DefaultProperties::GetObjectItemSet();
+ }
+
+ // collect all ItemSets in mpItemSet
+ const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ const SfxItemSet& rSet = pSub->GetObj(a)->GetMergedItemSet();
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+
+ while(nWhich)
+ {
+ if(SFX_ITEM_DONTCARE == rSet.GetItemState(nWhich, FALSE))
+ {
+ mpItemSet->InvalidateItem(nWhich);
+ }
+ else
+ {
+ mpItemSet->MergeValue(rSet.Get(nWhich), TRUE);
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+ }
+
+ // For group proerties, do not call parent since groups do
+ // not have local ItemSets.
+ return *mpItemSet;
+ }
+
+ void GroupProperties::SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems)
+ {
+ // iterate over contained SdrObjects
+ const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ SdrObject* pObj = pSub->GetObj(a);
+
+ if(pObj)
+ {
+ // Set merged ItemSet at contained object
+ pObj->SetMergedItemSet(rSet, bClearAllItems);
+ }
+ }
+
+ // Do not call parent here. Group objects do not have local ItemSets
+ // where items need to be set.
+ // DefaultProperties::SetMergedItemSet(rSet, bClearAllItems);
+ }
+
+ void GroupProperties::SetObjectItem(const SfxPoolItem& /*rItem*/)
+ {
+ DBG_ASSERT(sal_False, "GroupProperties::SetObjectItem() should never be called (!)");
+ }
+
+ void GroupProperties::SetObjectItemDirect(const SfxPoolItem& /*rItem*/)
+ {
+ DBG_ASSERT(sal_False, "GroupProperties::SetObjectItemDirect() should never be called (!)");
+ }
+
+ void GroupProperties::ClearObjectItem(const sal_uInt16 /*nWhich*/)
+ {
+ DBG_ASSERT(sal_False, "GroupProperties::ClearObjectItem() should never be called (!)");
+ }
+
+ void GroupProperties::ClearObjectItemDirect(const sal_uInt16 /*nWhich*/)
+ {
+ DBG_ASSERT(sal_False, "GroupProperties::ClearObjectItemDirect() should never be called (!)");
+ }
+
+ void GroupProperties::SetMergedItem(const SfxPoolItem& rItem)
+ {
+ const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ pSub->GetObj(a)->GetProperties().SetMergedItem(rItem);
+ }
+ }
+
+ void GroupProperties::ClearMergedItem(const sal_uInt16 nWhich)
+ {
+ const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ pSub->GetObj(a)->GetProperties().ClearMergedItem(nWhich);
+ }
+ }
+
+ void GroupProperties::SetObjectItemSet(const SfxItemSet& /*rSet*/)
+ {
+ DBG_ASSERT(sal_False, "GroupProperties::SetObjectItemSet() should never be called (!)");
+ }
+
+ void GroupProperties::ItemSetChanged(const SfxItemSet& /*rSet*/)
+ {
+ DBG_ASSERT(sal_False, "GroupProperties::ItemSetChanged() should never be called (!)");
+ }
+
+ sal_Bool GroupProperties::AllowItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/) const
+ {
+ DBG_ASSERT(sal_False, "GroupProperties::AllowItemChange() should never be called (!)");
+ return sal_False;
+ }
+
+ void GroupProperties::ItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/)
+ {
+ DBG_ASSERT(sal_False, "GroupProperties::ItemChange() should never be called (!)");
+ }
+
+ void GroupProperties::PostItemChange(const sal_uInt16 /*nWhich*/)
+ {
+ DBG_ASSERT(sal_False, "GroupProperties::PostItemChange() should never be called (!)");
+ }
+
+ SfxStyleSheet* GroupProperties::GetStyleSheet() const
+ {
+ SfxStyleSheet* pRetval = 0L;
+
+ const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ SfxStyleSheet* pCandidate = pSub->GetObj(a)->GetStyleSheet();
+
+ if(pRetval)
+ {
+ if(pCandidate != pRetval)
+ {
+ // different StyleSheelts, return none
+ return 0L;
+ }
+ }
+ else
+ {
+ pRetval = pCandidate;
+ }
+ }
+
+ return pRetval;
+ }
+
+ void GroupProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ pSub->GetObj(a)->SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+ }
+ }
+
+ void GroupProperties::ForceDefaultAttributes()
+ {
+ // nothing to do here, groups have no items and thus no default items, too.
+ }
+
+ void GroupProperties::MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel)
+ {
+ if(pSrcPool && pDestPool && (pSrcPool != pDestPool))
+ {
+ const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ pSub->GetObj(a)->GetProperties().MoveToItemPool(pSrcPool, pDestPool, pNewModel);
+ }
+
+ // also clear local ItemSet, it's only temporary for group objects anyways.
+ if(mpItemSet)
+ {
+ // #121905#
+ // copy/paste is still using clone operators and MoveToItemPool functionality.
+ // Since SfxItemSet contains a pool pointer, ClearItem is not enough here.
+ // The ItemSet for merge is constructed on demand, so it's enough here to
+ // just delete it and set to 0L.
+ // mpItemSet->ClearItem();
+ delete mpItemSet;
+ mpItemSet = 0L;
+ }
+ }
+ }
+
+ void GroupProperties::ForceStyleToHardAttributes()
+ {
+ const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ pSub->GetObj(a)->GetProperties().ForceStyleToHardAttributes();
+ }
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/itemsettools.cxx b/svx/source/sdr/properties/itemsettools.cxx
new file mode 100644
index 000000000000..eab977681490
--- /dev/null
+++ b/svx/source/sdr/properties/itemsettools.cxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/itemsettools.hxx>
+#include <tools/debug.hxx>
+#include <svl/itemset.hxx>
+#include <svl/whiter.hxx>
+
+#include <vector>
+#include <svx/svdogrp.hxx>
+#include <svditer.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// class to remember broadcast start positions
+
+namespace sdr
+{
+ namespace properties
+ {
+ // helper vector to remember rectangles
+ typedef ::std::vector< Rectangle > RectangleVector;
+
+ ItemChangeBroadcaster::ItemChangeBroadcaster(const SdrObject& rObj)
+ {
+ if(rObj.ISA(SdrObjGroup))
+ {
+ SdrObjListIter aIter((const SdrObjGroup&)rObj, IM_DEEPNOGROUPS);
+ mpData = new RectangleVector;
+ DBG_ASSERT(mpData, "ItemChangeBroadcaster: No memory (!)");
+ ((RectangleVector*)mpData)->reserve(aIter.Count());
+
+ while(aIter.IsMore())
+ {
+ SdrObject* pObj = aIter.Next();
+
+ if(pObj)
+ {
+ ((RectangleVector*)mpData)->push_back(pObj->GetLastBoundRect());
+ }
+ }
+
+ mnCount = ((RectangleVector*)mpData)->size();
+ }
+ else
+ {
+ mpData = new Rectangle(rObj.GetLastBoundRect());
+ mnCount = 1L;
+ }
+ }
+
+ ItemChangeBroadcaster::~ItemChangeBroadcaster()
+ {
+ if(mnCount > 1)
+ {
+ delete ((RectangleVector*)mpData);
+ }
+ else
+ {
+ delete ((Rectangle*)mpData);
+ }
+ }
+
+ sal_uInt32 ItemChangeBroadcaster::GetRectangleCount() const
+ {
+ return mnCount;
+ }
+
+ const Rectangle& ItemChangeBroadcaster::GetRectangle(sal_uInt32 nIndex) const
+ {
+ if(mnCount > 1)
+ {
+ return (*((RectangleVector*)mpData))[nIndex];
+ }
+ else
+ {
+ return *((Rectangle*)mpData);
+ }
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ void ScaleItemSet(SfxItemSet& rSet, const Fraction& rScale)
+ {
+ sal_Int32 nMul(rScale.GetNumerator());
+ sal_Int32 nDiv(rScale.GetDenominator());
+
+ if(!rScale.IsValid() || !nDiv)
+ {
+ return;
+ }
+
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+ const SfxPoolItem *pItem = NULL;
+
+ while(nWhich)
+ {
+ if(SFX_ITEM_SET == rSet.GetItemState(nWhich, FALSE, &pItem))
+ {
+ if(pItem->HasMetrics())
+ {
+ SfxPoolItem* pNewItem = pItem->Clone();
+ pNewItem->ScaleMetrics(nMul, nDiv);
+ rSet.Put(*pNewItem);
+ }
+ }
+ nWhich = aIter.NextWhich();
+ }
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/makefile.mk b/svx/source/sdr/properties/makefile.mk
new file mode 100644
index 000000000000..5296765769b1
--- /dev/null
+++ b/svx/source/sdr/properties/makefile.mk
@@ -0,0 +1,65 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=svx
+TARGET=properties
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES=\
+ $(SLO)$/properties.obj \
+ $(SLO)$/emptyproperties.obj \
+ $(SLO)$/pageproperties.obj \
+ $(SLO)$/defaultproperties.obj \
+ $(SLO)$/attributeproperties.obj \
+ $(SLO)$/textproperties.obj \
+ $(SLO)$/customshapeproperties.obj \
+ $(SLO)$/rectangleproperties.obj \
+ $(SLO)$/oleproperties.obj \
+ $(SLO)$/captionproperties.obj \
+ $(SLO)$/circleproperties.obj \
+ $(SLO)$/connectorproperties.obj \
+ $(SLO)$/e3dproperties.obj \
+ $(SLO)$/e3dcompoundproperties.obj \
+ $(SLO)$/e3dextrudeproperties.obj \
+ $(SLO)$/e3dlatheproperties.obj \
+ $(SLO)$/e3dsceneproperties.obj \
+ $(SLO)$/e3dsphereproperties.obj \
+ $(SLO)$/graphicproperties.obj \
+ $(SLO)$/groupproperties.obj \
+ $(SLO)$/measureproperties.obj \
+ $(SLO)$/itemsettools.obj
+
+.INCLUDE : target.mk
diff --git a/svx/source/sdr/properties/measureproperties.cxx b/svx/source/sdr/properties/measureproperties.cxx
new file mode 100644
index 000000000000..8c935c2700f0
--- /dev/null
+++ b/svx/source/sdr/properties/measureproperties.cxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/measureproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svx/svddef.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/svdomeas.hxx>
+#include <svx/sxmsuitm.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xlnedwit.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ // create a new itemset
+ SfxItemSet& MeasureProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return *(new SfxItemSet(rPool,
+
+ // range from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // range from SdrMeasureObj
+ SDRATTR_MEASURE_FIRST, SDRATTR_MEASURE_LAST,
+
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END,
+
+ // end
+ 0, 0));
+ }
+
+ MeasureProperties::MeasureProperties(SdrObject& rObj)
+ : TextProperties(rObj)
+ {
+ }
+
+ MeasureProperties::MeasureProperties(const MeasureProperties& rProps, SdrObject& rObj)
+ : TextProperties(rProps, rObj)
+ {
+ }
+
+ MeasureProperties::~MeasureProperties()
+ {
+ }
+
+ BaseProperties& MeasureProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new MeasureProperties(*this, rObj));
+ }
+
+ void MeasureProperties::ItemSetChanged(const SfxItemSet& rSet)
+ {
+ SdrMeasureObj& rObj = (SdrMeasureObj&)GetSdrObject();
+
+ // call parent
+ TextProperties::ItemSetChanged(rSet);
+
+ // local changes
+ rObj.SetTextDirty();
+ }
+
+ void MeasureProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ SdrMeasureObj& rObj = (SdrMeasureObj&)GetSdrObject();
+
+ // local changes
+ rObj.SetTextDirty();
+
+ // call parent
+ TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+ }
+
+ void MeasureProperties::ForceDefaultAttributes()
+ {
+ // call parent
+ TextProperties::ForceDefaultAttributes();
+
+ // force ItemSet
+ GetObjectItemSet();
+
+ //#71958# by default, the show units Bool-Item is set as hard
+ // attribute to TRUE to aviod confusion when copying SdrMeasureObj's
+ // from one application to another
+ mpItemSet->Put(SdrMeasureShowUnitItem(TRUE));
+
+ basegfx::B2DPolygon aNewPolygon;
+ aNewPolygon.append(basegfx::B2DPoint(100.0, 0.0));
+ aNewPolygon.append(basegfx::B2DPoint(200.0, 400.0));
+ aNewPolygon.append(basegfx::B2DPoint(0.0, 400.0));
+ aNewPolygon.setClosed(true);
+
+ mpItemSet->Put(XLineStartItem(String(), basegfx::B2DPolyPolygon(aNewPolygon)));
+ mpItemSet->Put(XLineStartWidthItem(200));
+ mpItemSet->Put(XLineEndItem(String(), basegfx::B2DPolyPolygon(aNewPolygon)));
+ mpItemSet->Put(XLineEndWidthItem(200));
+ mpItemSet->Put(XLineStyleItem(XLINE_SOLID));
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+// eof
diff --git a/svx/source/sdr/properties/oleproperties.cxx b/svx/source/sdr/properties/oleproperties.cxx
new file mode 100644
index 000000000000..b2a103bd8cfc
--- /dev/null
+++ b/svx/source/sdr/properties/oleproperties.cxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: graphicproperties.cxx,v $
+ * $Revision: 1.12.76.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/properties/oleproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xlineit0.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ OleProperties::OleProperties(SdrObject& rObj)
+ : RectangleProperties(rObj)
+ {
+ }
+
+ OleProperties::OleProperties(const OleProperties& rProps, SdrObject& rObj)
+ : RectangleProperties(rProps, rObj)
+ {
+ }
+
+ OleProperties::~OleProperties()
+ {
+ }
+
+ BaseProperties& OleProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new OleProperties(*this, rObj));
+ }
+
+ void OleProperties::ForceDefaultAttributes()
+ {
+ // call parent
+ RectangleProperties::ForceDefaultAttributes();
+
+ // force ItemSet
+ GetObjectItemSet();
+
+ // #i108221#
+ mpItemSet->Put( XFillStyleItem(XFILL_NONE) );
+ mpItemSet->Put( XLineStyleItem(XLINE_NONE) );
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/pageproperties.cxx b/svx/source/sdr/properties/pageproperties.cxx
new file mode 100644
index 000000000000..2fc92633b953
--- /dev/null
+++ b/svx/source/sdr/properties/pageproperties.cxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/pageproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdpool.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ // create a new itemset
+ SfxItemSet& PageProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ // overloaded to legally return a valid ItemSet
+ return *(new SfxItemSet(rPool));
+ }
+
+ PageProperties::PageProperties(SdrObject& rObj)
+ : EmptyProperties(rObj)
+ {
+ }
+
+ PageProperties::PageProperties(const PageProperties& rProps, SdrObject& rObj)
+ : EmptyProperties(rProps, rObj)
+ {
+ }
+
+ PageProperties::~PageProperties()
+ {
+ }
+
+ BaseProperties& PageProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new PageProperties(*this, rObj));
+ }
+
+ // get itemset. Overloaded here to allow creating the empty itemset
+ // without asserting
+ const SfxItemSet& PageProperties::GetObjectItemSet() const
+ {
+ if(!mpEmptyItemSet)
+ {
+ ((PageProperties*)this)->mpEmptyItemSet = &(((PageProperties*)this)->CreateObjectSpecificItemSet(*GetSdrObject().GetObjectItemPool()));
+ }
+
+ DBG_ASSERT(mpEmptyItemSet, "Could not create an SfxItemSet(!)");
+
+ return *mpEmptyItemSet;
+ }
+
+ void PageProperties::ItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/)
+ {
+ // #86481# simply ignore item setting on page objects
+ }
+
+ SfxStyleSheet* PageProperties::GetStyleSheet() const
+ {
+ // overloaded to legally return a 0L pointer here
+ return 0L;
+ }
+
+ void PageProperties::ClearObjectItem(const sal_uInt16 /*nWhich*/)
+ {
+ // simply ignore item clearing on page objects
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// eof
diff --git a/svx/source/sdr/properties/properties.cxx b/svx/source/sdr/properties/properties.cxx
new file mode 100644
index 000000000000..576f9745e167
--- /dev/null
+++ b/svx/source/sdr/properties/properties.cxx
@@ -0,0 +1,189 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/properties.hxx>
+#include <svx/sdr/properties/itemsettools.hxx>
+#include <svl/itemset.hxx>
+#include <svx/svdogrp.hxx>
+#include <svditer.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ BaseProperties::BaseProperties(SdrObject& rObj)
+ : mrObject(rObj)
+ {
+ }
+
+ BaseProperties::BaseProperties(const BaseProperties& /*rProps*/, SdrObject& rObj)
+ : mrObject(rObj)
+ {
+ }
+
+ BaseProperties::~BaseProperties()
+ {
+ }
+
+ const SfxItemSet& BaseProperties::GetMergedItemSet() const
+ {
+ // default implementation falls back to GetObjectItemSet()
+ return GetObjectItemSet();
+ }
+
+ void BaseProperties::SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems)
+ {
+ // clear items if requested
+ if(bClearAllItems)
+ {
+ ClearObjectItem();
+ }
+
+ // default implementation falls back to SetObjectItemSet()
+ SetObjectItemSet(rSet);
+ }
+
+ void BaseProperties::SetMergedItem(const SfxPoolItem& rItem)
+ {
+ // default implementation falls back to SetObjectItem()
+ SetObjectItem(rItem);
+ }
+
+ void BaseProperties::ClearMergedItem(const sal_uInt16 nWhich)
+ {
+ // default implementation falls back to ClearObjectItem()
+ ClearObjectItem(nWhich);
+ }
+
+ void BaseProperties::Scale(const Fraction& /*rScale*/)
+ {
+ // default implementation does nothing; overload where
+ // an ItemSet is implemented.
+ }
+
+ void BaseProperties::MoveToItemPool(SfxItemPool* /*pSrcPool*/, SfxItemPool* /*pDestPool*/, SdrModel* /*pNewModel*/)
+ {
+ // Move properties to a new ItemPool. Default implementation does nothing.
+ // Overload where an ItemSet is implemented.
+ }
+
+ void BaseProperties::SetModel(SdrModel* /*pOldModel*/, SdrModel* /*pNewModel*/)
+ {
+ // Set new model. Default implementation does nothing.
+ // Overload where an ItemSet is implemented.
+ }
+
+ void BaseProperties::ForceStyleToHardAttributes()
+ {
+ // force all attributes which come from styles to hard attributes
+ // to be able to live without the style. Default implementation does nothing.
+ // Overload where an ItemSet is implemented.
+ }
+
+ //void BaseProperties::SetItemAndBroadcast(const SfxPoolItem& rItem)
+ //{
+ // ItemChangeBroadcaster aC(GetSdrObject());
+ // SetObjectItem(rItem);
+ // BroadcastItemChange(aC);
+ //}
+
+ //void BaseProperties::ClearItemAndBroadcast(const sal_uInt16 nWhich)
+ //{
+ // ItemChangeBroadcaster aC(GetSdrObject());
+ // ClearObjectItem(nWhich);
+ // BroadcastItemChange(aC);
+ //}
+
+ void BaseProperties::SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, sal_Bool bClearAllItems)
+ {
+ ItemChangeBroadcaster aC(GetSdrObject());
+
+ if(bClearAllItems)
+ {
+ ClearObjectItem();
+ }
+
+ SetMergedItemSet(rSet);
+ BroadcastItemChange(aC);
+ }
+
+ const SfxPoolItem& BaseProperties::GetItem(const sal_uInt16 nWhich) const
+ {
+ return GetObjectItemSet().Get(nWhich);
+ }
+
+ void BaseProperties::BroadcastItemChange(const ItemChangeBroadcaster& rChange)
+ {
+ const sal_uInt32 nCount(rChange.GetRectangleCount());
+
+ // #110094#-14 Reduce to do only second change
+ //// invalidate all remembered rectangles
+ //for(sal_uInt32 a(0); a < nCount; a++)
+ //{
+ // GetSdrObject().BroadcastObjectChange(rChange.GetRectangle(a));
+ //}
+
+ // invalidate all new rectangles
+ if(GetSdrObject().ISA(SdrObjGroup))
+ {
+ SdrObjListIter aIter((SdrObjGroup&)GetSdrObject(), IM_DEEPNOGROUPS);
+
+ while(aIter.IsMore())
+ {
+ SdrObject* pObj = aIter.Next();
+ // This is done with ItemSetChanged
+ // pObj->SetChanged();
+ pObj->BroadcastObjectChange();
+ }
+ }
+ else
+ {
+ // This is done with ItemSetChanged
+ // GetSdrObject().SetChanged();
+ GetSdrObject().BroadcastObjectChange();
+ }
+
+ // also send the user calls
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ GetSdrObject().SendUserCall(SDRUSERCALL_CHGATTR, rChange.GetRectangle(a));
+ }
+ }
+
+ sal_uInt32 BaseProperties::getVersion() const
+ {
+ return 0;
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/rectangleproperties.cxx b/svx/source/sdr/properties/rectangleproperties.cxx
new file mode 100644
index 000000000000..21907df0018d
--- /dev/null
+++ b/svx/source/sdr/properties/rectangleproperties.cxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/rectangleproperties.hxx>
+#include <svx/svdorect.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ RectangleProperties::RectangleProperties(SdrObject& rObj)
+ : TextProperties(rObj)
+ {
+ }
+
+ RectangleProperties::RectangleProperties(const RectangleProperties& rProps, SdrObject& rObj)
+ : TextProperties(rProps, rObj)
+ {
+ }
+
+ RectangleProperties::~RectangleProperties()
+ {
+ }
+
+ BaseProperties& RectangleProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new RectangleProperties(*this, rObj));
+ }
+
+ void RectangleProperties::ItemSetChanged(const SfxItemSet& rSet)
+ {
+ SdrRectObj& rObj = (SdrRectObj&)GetSdrObject();
+
+ // call parent
+ TextProperties::ItemSetChanged(rSet);
+
+ // local changes
+ rObj.SetXPolyDirty();
+ }
+
+ // set a new StyleSheet and broadcast
+ void RectangleProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ SdrRectObj& rObj = (SdrRectObj&)GetSdrObject();
+
+ // call parent
+ TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+
+ // local changes
+ rObj.SetXPolyDirty();
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx
new file mode 100644
index 000000000000..091656e1f261
--- /dev/null
+++ b/svx/source/sdr/properties/textproperties.cxx
@@ -0,0 +1,638 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/textproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svl/itemiter.hxx>
+#include <svl/smplhint.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svdoutl.hxx>
+#include <editeng/writingmodeitem.hxx>
+#include <svx/svdmodel.hxx>
+#include <editeng/outlobj.hxx>
+#include <svx/xflclit.hxx>
+#include <editeng/adjitem.hxx>
+#include <svx/svdetc.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/flditem.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/svdpool.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ SfxItemSet& TextProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return *(new SfxItemSet(rPool,
+
+ // range from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END,
+
+ // end
+ 0, 0));
+ }
+
+ TextProperties::TextProperties(SdrObject& rObj)
+ : AttributeProperties(rObj),
+ maVersion(0)
+ {
+ }
+
+ TextProperties::TextProperties(const TextProperties& rProps, SdrObject& rObj)
+ : AttributeProperties(rProps, rObj),
+ maVersion(rProps.getVersion())
+ {
+ }
+
+ TextProperties::~TextProperties()
+ {
+ }
+
+ BaseProperties& TextProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new TextProperties(*this, rObj));
+ }
+
+ void TextProperties::ItemSetChanged(const SfxItemSet& rSet)
+ {
+ SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
+ sal_Int32 nText = rObj.getTextCount();
+
+ // #i101556# ItemSet has changed -> new version
+ maVersion++;
+
+ while( --nText >= 0 )
+ {
+ SdrText* pText = rObj.getText( nText );
+
+ OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0;
+
+ if(pParaObj)
+ {
+ const bool bTextEdit = rObj.IsTextEditActive() && (rObj.getActiveText() == pText);
+
+ // handle outliner attributes
+ GetObjectItemSet();
+ Outliner* pOutliner = rObj.GetTextEditOutliner();
+
+ if(!bTextEdit)
+ {
+ pOutliner = &rObj.ImpGetDrawOutliner();
+ pOutliner->SetText(*pParaObj);
+ }
+
+ sal_uInt32 nParaCount(pOutliner->GetParagraphCount());
+
+ for(sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
+ {
+ SfxItemSet aSet(pOutliner->GetParaAttribs(nPara));
+ aSet.Put(rSet);
+ pOutliner->SetParaAttribs(nPara, aSet);
+ }
+
+ if(!bTextEdit)
+ {
+ if(nParaCount)
+ {
+ // force ItemSet
+ GetObjectItemSet();
+
+ SfxItemSet aNewSet(pOutliner->GetParaAttribs(0L));
+ mpItemSet->Put(aNewSet);
+ }
+
+ OutlinerParaObject* pTemp = pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount);
+ pOutliner->Clear();
+
+ rObj.NbcSetOutlinerParaObjectForText(pTemp,pText);
+ }
+ }
+ }
+
+ // Extra-Repaint for radical layout changes (#43139#)
+ if(SFX_ITEM_SET == rSet.GetItemState(SDRATTR_TEXT_CONTOURFRAME))
+ {
+ // Here only repaint wanted
+ rObj.ActionChanged();
+ //rObj.BroadcastObjectChange();
+ }
+
+ // call parent
+ AttributeProperties::ItemSetChanged(rSet);
+ }
+
+ void TextProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
+ {
+ SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
+
+ // #i25616#
+ sal_Int32 nOldLineWidth(0L);
+
+ if(XATTR_LINEWIDTH == nWhich && rObj.DoesSupportTextIndentingOnLineWidthChange())
+ {
+ nOldLineWidth = ((const XLineWidthItem&)GetItem(XATTR_LINEWIDTH)).GetValue();
+ }
+
+ if(pNewItem && (SDRATTR_TEXTDIRECTION == nWhich))
+ {
+ sal_Bool bVertical(com::sun::star::text::WritingMode_TB_RL == ((SvxWritingModeItem*)pNewItem)->GetValue());
+ rObj.SetVerticalWriting(bVertical);
+ }
+
+ // #95501# reset to default
+ if(!pNewItem && !nWhich && rObj.HasText() )
+ {
+ SdrOutliner& rOutliner = rObj.ImpGetDrawOutliner();
+
+ sal_Int32 nCount = rObj.getTextCount();
+ while( nCount-- )
+ {
+ SdrText* pText = rObj.getText( nCount );
+ OutlinerParaObject* pParaObj = pText->GetOutlinerParaObject();
+ if( pParaObj )
+ {
+ rOutliner.SetText(*pParaObj);
+ sal_uInt32 nParaCount(rOutliner.GetParagraphCount());
+
+ if(nParaCount)
+ {
+ ESelection aSelection( 0, 0, EE_PARA_ALL, EE_PARA_ALL);
+ rOutliner.RemoveAttribs(aSelection, sal_True, 0);
+
+ OutlinerParaObject* pTemp = rOutliner.CreateParaObject(0, (sal_uInt16)nParaCount);
+ rOutliner.Clear();
+
+ rObj.NbcSetOutlinerParaObjectForText( pTemp, pText );
+ }
+ }
+ }
+ }
+
+ // call parent
+ AttributeProperties::ItemChange( nWhich, pNewItem );
+
+ // #i25616#
+ if(XATTR_LINEWIDTH == nWhich && rObj.DoesSupportTextIndentingOnLineWidthChange())
+ {
+ const sal_Int32 nNewLineWidth(((const XLineWidthItem&)GetItem(XATTR_LINEWIDTH)).GetValue());
+ const sal_Int32 nDifference((nNewLineWidth - nOldLineWidth) / 2);
+
+ if(nDifference)
+ {
+ const sal_Bool bLineVisible(XLINE_NONE != ((const XLineStyleItem&)(GetItem(XATTR_LINESTYLE))).GetValue());
+
+ if(bLineVisible)
+ {
+ const sal_Int32 nLeftDist(((const SdrTextLeftDistItem&)GetItem(SDRATTR_TEXT_LEFTDIST)).GetValue());
+ const sal_Int32 nRightDist(((const SdrTextRightDistItem&)GetItem(SDRATTR_TEXT_RIGHTDIST)).GetValue());
+ const sal_Int32 nUpperDist(((const SdrTextUpperDistItem&)GetItem(SDRATTR_TEXT_UPPERDIST)).GetValue());
+ const sal_Int32 nLowerDist(((const SdrTextLowerDistItem&)GetItem(SDRATTR_TEXT_LOWERDIST)).GetValue());
+
+ SetObjectItemDirect(SdrTextLeftDistItem(nLeftDist + nDifference));
+ SetObjectItemDirect(SdrTextRightDistItem(nRightDist + nDifference));
+ SetObjectItemDirect(SdrTextUpperDistItem(nUpperDist + nDifference));
+ SetObjectItemDirect(SdrTextLowerDistItem(nLowerDist + nDifference));
+ }
+ }
+ }
+ }
+
+ void TextProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
+
+ // call parent
+ AttributeProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+
+ // #i101556# StyleSheet has changed -> new version
+ maVersion++;
+
+ if( rObj.GetModel() /*&& !rObj.IsTextEditActive()*/ && !rObj.IsLinkedText() )
+ {
+ SdrOutliner& rOutliner = rObj.ImpGetDrawOutliner();
+
+ sal_Int32 nText = rObj.getTextCount();
+
+ while( --nText >= 0 )
+ {
+ SdrText* pText = rObj.getText( nText );
+
+ OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0;
+ if( !pParaObj )
+ continue;
+
+ // apply StyleSheet to all paragraphs
+ rOutliner.SetText(*pParaObj);
+ sal_uInt32 nParaCount(rOutliner.GetParagraphCount());
+
+ if(nParaCount)
+ {
+ for(sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
+ {
+ SfxItemSet* pTempSet = 0L;
+
+ // since setting the stylesheet removes all para attributes
+ if(bDontRemoveHardAttr)
+ {
+ // we need to remember them if we want to keep them
+ pTempSet = new SfxItemSet(rOutliner.GetParaAttribs(nPara));
+ }
+
+ if(GetStyleSheet())
+ {
+ if((OBJ_OUTLINETEXT == rObj.GetTextKind()) && (SdrInventor == rObj.GetObjInventor()))
+ {
+ String aNewStyleSheetName(GetStyleSheet()->GetName());
+ aNewStyleSheetName.Erase(aNewStyleSheetName.Len() - 1, 1);
+ sal_Int16 nDepth = rOutliner.GetDepth((sal_uInt16)nPara);
+ aNewStyleSheetName += String::CreateFromInt32( nDepth <= 0 ? 1 : nDepth + 1);
+
+ SdrModel* pModel = rObj.GetModel();
+ SfxStyleSheetBasePool* pStylePool = (pModel != NULL) ? pModel->GetStyleSheetPool() : 0L;
+ SfxStyleSheet* pNewStyle = (SfxStyleSheet*)pStylePool->Find(aNewStyleSheetName, GetStyleSheet()->GetFamily());
+ DBG_ASSERT( pNewStyle, "AutoStyleSheetName - Style not found!" );
+
+ if(pNewStyle)
+ {
+ rOutliner.SetStyleSheet(nPara, pNewStyle);
+ }
+ }
+ else
+ {
+ rOutliner.SetStyleSheet(nPara, GetStyleSheet());
+ }
+ }
+ else
+ {
+ // remove StyleSheet
+ rOutliner.SetStyleSheet(nPara, 0L);
+ }
+
+ if(bDontRemoveHardAttr)
+ {
+ if(pTempSet)
+ {
+ // restore para attributes
+ rOutliner.SetParaAttribs(nPara, *pTempSet);
+ }
+ }
+ else
+ {
+ if(pNewStyleSheet)
+ {
+ // remove all hard paragraph attributes
+ // which occur in StyleSheet, take care of
+ // parents (!)
+ SfxItemIter aIter(pNewStyleSheet->GetItemSet());
+ const SfxPoolItem* pItem = aIter.FirstItem();
+
+ while(pItem)
+ {
+ if(!IsInvalidItem(pItem))
+ {
+ sal_uInt16 nW(pItem->Which());
+
+ if(nW >= EE_ITEMS_START && nW <= EE_ITEMS_END)
+ {
+ rOutliner.QuickRemoveCharAttribs((sal_uInt16)nPara, nW);
+ }
+ }
+ pItem = aIter.NextItem();
+ }
+ }
+ }
+
+ if(pTempSet)
+ {
+ delete pTempSet;
+ }
+ }
+
+ OutlinerParaObject* pTemp = rOutliner.CreateParaObject(0, (sal_uInt16)nParaCount);
+ rOutliner.Clear();
+ rObj.NbcSetOutlinerParaObjectForText(pTemp, pText);
+ }
+ }
+ }
+
+ if(rObj.IsTextFrame())
+ {
+ rObj.NbcAdjustTextFrameWidthAndHeight();
+ }
+ }
+
+ void TextProperties::ForceDefaultAttributes()
+ {
+ SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
+
+ if( rObj.GetObjInventor() == SdrInventor )
+ {
+ const sal_uInt16 nSdrObjKind = rObj.GetObjIdentifier();
+
+ if( nSdrObjKind == OBJ_TITLETEXT || nSdrObjKind == OBJ_OUTLINETEXT )
+ return; // no defaults for presentation objects
+ }
+
+ bool bTextFrame(rObj.IsTextFrame());
+
+ // force ItemSet
+ GetObjectItemSet();
+
+ if(bTextFrame)
+ {
+ mpItemSet->Put(XLineStyleItem(XLINE_NONE));
+ mpItemSet->Put(XFillColorItem(String(), Color(COL_WHITE)));
+ mpItemSet->Put(XFillStyleItem(XFILL_NONE));
+ }
+ else
+ {
+ mpItemSet->Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST));
+ mpItemSet->Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER));
+ mpItemSet->Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER));
+ }
+ }
+
+ void TextProperties::ForceStyleToHardAttributes()
+ {
+ // #i61284# call parent first to get the hard ObjectItemSet
+ AttributeProperties::ForceStyleToHardAttributes();
+
+ // #i61284# push hard ObjectItemSet to OutlinerParaObject attributes
+ // using existing functionality
+ GetObjectItemSet(); // force ItemSet
+ ItemSetChanged(*mpItemSet);
+
+ // now the standard TextProperties stuff
+ SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
+
+ if(rObj.GetModel()
+ && !rObj.IsTextEditActive()
+ && !rObj.IsLinkedText())
+ {
+ Outliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_OUTLINEOBJECT, rObj.GetModel());
+ sal_Int32 nText = rObj.getTextCount();
+
+ while( --nText >= 0 )
+ {
+ SdrText* pText = rObj.getText( nText );
+
+ OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0;
+ if( !pParaObj )
+ continue;
+
+ pOutliner->SetText(*pParaObj);
+
+ sal_uInt32 nParaCount(pOutliner->GetParagraphCount());
+
+ if(nParaCount)
+ {
+ sal_Bool bBurnIn(sal_False);
+
+ for(sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
+ {
+ SfxStyleSheet* pSheet = pOutliner->GetStyleSheet(nPara);
+
+ if(pSheet)
+ {
+ SfxItemSet aParaSet(pOutliner->GetParaAttribs(nPara));
+ SfxItemSet aSet(*aParaSet.GetPool());
+ aSet.Put(pSheet->GetItemSet());
+
+ /** the next code handles a special case for paragraphs that contain a
+ url field. The color for URL fields is either the system color for
+ urls or the char color attribute that formats the portion in which the
+ url field is contained.
+ When we set a char color attribute to the paragraphs item set from the
+ styles item set, we would have this char color attribute as an attribute
+ that is spanned over the complete paragraph after xml import due to some
+ problems in the xml import (using a XCursor on import so it does not know
+ the paragraphs and can't set char attributes to paragraphs ).
+
+ To avoid this, as soon as we try to set a char color attribute from the style
+ we
+ 1. check if we have at least one url field in this paragraph
+ 2. if we found at least one url field, we span the char color attribute over
+ all portions that are not url fields and remove the char color attribute
+ from the paragraphs item set
+ */
+
+ sal_Bool bHasURL(sal_False);
+
+ if(aSet.GetItemState(EE_CHAR_COLOR) == SFX_ITEM_SET)
+ {
+ EditEngine* pEditEngine = const_cast<EditEngine*>(&(pOutliner->GetEditEngine()));
+ EECharAttribArray aAttribs;
+ pEditEngine->GetCharAttribs((sal_uInt16)nPara, aAttribs);
+ sal_uInt16 nAttrib;
+
+ for(nAttrib = 0; nAttrib < aAttribs.Count(); nAttrib++)
+ {
+ struct EECharAttrib aAttrib(aAttribs.GetObject(nAttrib));
+
+ if(EE_FEATURE_FIELD == aAttrib.pAttr->Which())
+ {
+ if(aAttrib.pAttr)
+ {
+ SvxFieldItem* pFieldItem = (SvxFieldItem*)aAttrib.pAttr;
+
+ if(pFieldItem)
+ {
+ const SvxFieldData* pData = pFieldItem->GetField();
+
+ if(pData && pData->ISA(SvxURLField))
+ {
+ bHasURL = sal_True;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if(bHasURL)
+ {
+ SfxItemSet aColorSet(*aSet.GetPool(), EE_CHAR_COLOR, EE_CHAR_COLOR );
+ aColorSet.Put(aSet, FALSE);
+
+ ESelection aSel((sal_uInt16)nPara, 0);
+
+ for(nAttrib = 0; nAttrib < aAttribs.Count(); nAttrib++)
+ {
+ struct EECharAttrib aAttrib(aAttribs.GetObject(nAttrib));
+
+ if(EE_FEATURE_FIELD == aAttrib.pAttr->Which())
+ {
+ aSel.nEndPos = aAttrib.nStart;
+
+ if(aSel.nStartPos != aSel.nEndPos)
+ {
+ pEditEngine->QuickSetAttribs(aColorSet, aSel);
+ }
+
+ aSel.nStartPos = aAttrib.nEnd;
+ }
+ }
+
+ aSel.nEndPos = pEditEngine->GetTextLen((sal_uInt16)nPara);
+
+ if(aSel.nStartPos != aSel.nEndPos)
+ {
+ pEditEngine->QuickSetAttribs( aColorSet, aSel );
+ }
+ }
+
+ }
+
+ aSet.Put(aParaSet, FALSE);
+
+ if(bHasURL)
+ {
+ aSet.ClearItem(EE_CHAR_COLOR);
+ }
+
+ pOutliner->SetParaAttribs(nPara, aSet);
+ bBurnIn = sal_True; // #i51163# Flag was set wrong
+ }
+ }
+
+ if(bBurnIn)
+ {
+ OutlinerParaObject* pTemp = pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount);
+ rObj.NbcSetOutlinerParaObjectForText(pTemp,pText);
+ }
+ }
+
+ pOutliner->Clear();
+ }
+ delete pOutliner;
+ }
+ }
+
+ void TextProperties::SetObjectItemNoBroadcast(const SfxPoolItem& rItem)
+ {
+ GetObjectItemSet();
+ mpItemSet->Put(rItem);
+ }
+
+
+ void TextProperties::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
+ {
+ // call parent
+ AttributeProperties::Notify(rBC, rHint);
+
+ SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
+ if(rObj.HasText())
+ {
+ if(HAS_BASE(SfxStyleSheet, &rBC))
+ {
+ SfxSimpleHint* pSimple = PTR_CAST(SfxSimpleHint, &rHint);
+ sal_uInt32 nId(pSimple ? pSimple->GetId() : 0L);
+
+ if(SFX_HINT_DATACHANGED == nId)
+ {
+ rObj.SetPortionInfoChecked(sal_False);
+
+ sal_Int32 nText = rObj.getTextCount();
+ while( --nText > 0 )
+ {
+ OutlinerParaObject* pParaObj = rObj.getText(nText )->GetOutlinerParaObject();
+ if( pParaObj )
+ pParaObj->ClearPortionInfo();
+ }
+ rObj.SetTextSizeDirty();
+
+ if(rObj.IsTextFrame() && rObj.NbcAdjustTextFrameWidthAndHeight())
+ {
+ // here only repaint wanted
+ rObj.ActionChanged();
+ //rObj.BroadcastObjectChange();
+ }
+
+ // #i101556# content of StyleSheet has changed -> new version
+ maVersion++;
+ }
+
+ if(SFX_HINT_DYING == nId)
+ {
+ rObj.SetPortionInfoChecked(sal_False);
+ sal_Int32 nText = rObj.getTextCount();
+ while( --nText > 0 )
+ {
+ OutlinerParaObject* pParaObj = rObj.getText(nText )->GetOutlinerParaObject();
+ if( pParaObj )
+ pParaObj->ClearPortionInfo();
+ }
+ }
+ }
+ else if(HAS_BASE(SfxStyleSheetBasePool, &rBC))
+ {
+ SfxStyleSheetHintExtended* pExtendedHint = PTR_CAST(SfxStyleSheetHintExtended, &rHint);
+
+ if(pExtendedHint
+ && SFX_STYLESHEET_MODIFIED == pExtendedHint->GetHint())
+ {
+ String aOldName(pExtendedHint->GetOldName());
+ String aNewName(pExtendedHint->GetStyleSheet()->GetName());
+ SfxStyleFamily eFamily = pExtendedHint->GetStyleSheet()->GetFamily();
+
+ if(!aOldName.Equals(aNewName))
+ {
+ sal_Int32 nText = rObj.getTextCount();
+ while( --nText > 0 )
+ {
+ OutlinerParaObject* pParaObj = rObj.getText(nText )->GetOutlinerParaObject();
+ if( pParaObj )
+ pParaObj->ChangeStyleSheetName(eFamily, aOldName, aNewName);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // #i101556# Handout version information
+ sal_uInt32 TextProperties::getVersion() const
+ {
+ return maVersion;
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof