summaryrefslogtreecommitdiff
path: root/svx/source/engine3d/view3d.cxx
diff options
context:
space:
mode:
authorArmin Weiss <aw@openoffice.org>2000-10-30 10:00:01 +0000
committerArmin Weiss <aw@openoffice.org>2000-10-30 10:00:01 +0000
commit00b3648bc2de353a22433fa41d7504096532c315 (patch)
tree7898180f42194036bd917429b1a9374680e2a389 /svx/source/engine3d/view3d.cxx
parentf0af1d896d8828522ab165e55356a33ddf31b02d (diff)
change SdrObjects to use SfxItemSet instead of SfxSetItems.
Removed TakeAttributes() and SetAttributes(), new ItemSet modification methods (GetItem[Set], SetItem[Set], ClearItem,...)
Diffstat (limited to 'svx/source/engine3d/view3d.cxx')
-rw-r--r--svx/source/engine3d/view3d.cxx168
1 files changed, 103 insertions, 65 deletions
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index 177f48e4bbf9..27a1a8b4902e 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: view3d.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:01:15 $
+ * last change: $Author: aw $ $Date: 2000-10-30 10:55:03 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -752,62 +752,92 @@ void E3dView::ImpIsConvertTo3DPossible(SdrObject* pObj, BOOL& rAny3D,
void E3dView::ImpChangeSomeAttributesFor3DConversion(SdrObject* pObj)
{
- SfxItemPool& rPool = pMod->GetItemPool();
- SfxItemSet aSet(rPool);
- pObj->TakeAttributes(aSet, TRUE, FALSE);
- BOOL bChange(FALSE);
-
if(pObj->ISA(SdrTextObj))
{
- const SvxColorItem& rTextColorItem = (const SvxColorItem&)aSet.Get(rPool.GetWhich(SID_ATTR_CHAR_COLOR));
+ const SfxItemSet& rSet = pObj->GetItemSet();
+ const SvxColorItem& rTextColorItem = (const SvxColorItem&)rSet.Get(rSet.GetPool()->GetWhich(SID_ATTR_CHAR_COLOR));
if(rTextColorItem.GetValue() == RGB_Color(COL_BLACK))
{
// Bei schwarzen Textobjekten wird die Farbe auf grau gesetzt
- SvxColorItem aNewTextColorItem(RGB_Color(COL_GRAY), rPool.GetWhich(SID_ATTR_CHAR_COLOR));
- aSet.Put(aNewTextColorItem);
- bChange = TRUE;
+ if(pObj->GetPage())
+ AddUndo(new SdrUndoAttrObj(*pObj, FALSE, FALSE));
+ pObj->SetItem(SvxColorItem(RGB_Color(COL_GRAY), rSet.GetPool()->GetWhich(SID_ATTR_CHAR_COLOR)));
}
}
-
- if(bChange)
- {
- // UNDO fuer Textfarbe Aenderung (nur bei nicht
- // temporaeren Objekten)
- if(pObj->GetPage())
- AddUndo(new SdrUndoAttrObj(*pObj, FALSE, FALSE));
- pObj->NbcSetAttributes(aSet, FALSE);
- }
+//-/ SfxItemPool& rPool = pMod->GetItemPool();
+//-/ SfxItemSet aSet(rPool);
+//-/ pObj->TakeAttributes(aSet, TRUE, FALSE);
+//-/ BOOL bChange(FALSE);
+//-/
+//-/ if(pObj->ISA(SdrTextObj))
+//-/ {
+//-/ const SvxColorItem& rTextColorItem = (const SvxColorItem&)aSet.Get(rPool.GetWhich(SID_ATTR_CHAR_COLOR));
+//-/ if(rTextColorItem.GetValue() == RGB_Color(COL_BLACK))
+//-/ {
+//-/ // Bei schwarzen Textobjekten wird die Farbe auf grau gesetzt
+//-/ SvxColorItem aNewTextColorItem(RGB_Color(COL_GRAY), rPool.GetWhich(SID_ATTR_CHAR_COLOR));
+//-/ aSet.Put(aNewTextColorItem);
+//-/ bChange = TRUE;
+//-/ }
+//-/ }
+//-/
+//-/ if(bChange)
+//-/ {
+//-/ // UNDO fuer Textfarbe Aenderung (nur bei nicht
+//-/ // temporaeren Objekten)
+//-/ if(pObj->GetPage())
+//-/ AddUndo(new SdrUndoAttrObj(*pObj, FALSE, FALSE));
+//-/ pObj->NbcSetAttributes(aSet, FALSE);
+//-/ }
}
void E3dView::ImpChangeSomeAttributesFor3DConversion2(SdrObject* pObj)
{
- SfxItemPool& rPool = pMod->GetItemPool();
- SfxItemSet aSet(rPool);
- pObj->TakeAttributes(aSet, TRUE, FALSE);
- BOOL bChange(FALSE);
-
if(pObj->ISA(SdrPathObj))
{
- INT32 nLineWidth = ((const XLineWidthItem&)(aSet.Get(XATTR_LINEWIDTH))).GetValue();
- XLineStyle eLineStyle = (XLineStyle)((const XLineStyleItem&)aSet.Get(XATTR_LINESTYLE)).GetValue();
- XFillStyle eFillStyle = ITEMVALUE(aSet, XATTR_FILLSTYLE, XFillStyleItem);
-
- if(((SdrPathObj*)pObj)->IsClosed() && eLineStyle == XLINE_SOLID && !nLineWidth && eFillStyle != XFILL_NONE)
+ const SfxItemSet& rSet = pObj->GetItemSet();
+ sal_Int32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue();
+ XLineStyle eLineStyle = (XLineStyle)((const XLineStyleItem&)rSet.Get(XATTR_LINESTYLE)).GetValue();
+ XFillStyle eFillStyle = ITEMVALUE(rSet, XATTR_FILLSTYLE, XFillStyleItem);
+
+ if(((SdrPathObj*)pObj)->IsClosed()
+ && eLineStyle == XLINE_SOLID
+ && !nLineWidth
+ && eFillStyle != XFILL_NONE)
{
- aSet.Put(XLineStyleItem(XLINE_NONE));
- aSet.Put(XLineWidthItem(0L));
- bChange = TRUE;
+ if(pObj->GetPage())
+ AddUndo(new SdrUndoAttrObj(*pObj, FALSE, FALSE));
+ pObj->SetItem(XLineStyleItem(XLINE_NONE));
+ pObj->SetItem(XLineWidthItem(0L));
}
}
-
- if(bChange)
- {
- // UNDO fuer Textfarbe Aenderung (nur bei nicht
- // temporaeren Objekten)
- if(pObj->GetPage())
- AddUndo(new SdrUndoAttrObj(*pObj, FALSE, FALSE));
- pObj->NbcSetAttributes(aSet, FALSE);
- }
+//-/ SfxItemPool& rPool = pMod->GetItemPool();
+//-/ SfxItemSet aSet(rPool);
+//-/ pObj->TakeAttributes(aSet, TRUE, FALSE);
+//-/ BOOL bChange(FALSE);
+//-/
+//-/ if(pObj->ISA(SdrPathObj))
+//-/ {
+//-/ INT32 nLineWidth = ((const XLineWidthItem&)(aSet.Get(XATTR_LINEWIDTH))).GetValue();
+//-/ XLineStyle eLineStyle = (XLineStyle)((const XLineStyleItem&)aSet.Get(XATTR_LINESTYLE)).GetValue();
+//-/ XFillStyle eFillStyle = ITEMVALUE(aSet, XATTR_FILLSTYLE, XFillStyleItem);
+//-/
+//-/ if(((SdrPathObj*)pObj)->IsClosed() && eLineStyle == XLINE_SOLID && !nLineWidth && eFillStyle != XFILL_NONE)
+//-/ {
+//-/ aSet.Put(XLineStyleItem(XLINE_NONE));
+//-/ aSet.Put(XLineWidthItem(0L));
+//-/ bChange = TRUE;
+//-/ }
+//-/ }
+//-/
+//-/ if(bChange)
+//-/ {
+//-/ // UNDO fuer Textfarbe Aenderung (nur bei nicht
+//-/ // temporaeren Objekten)
+//-/ if(pObj->GetPage())
+//-/ AddUndo(new SdrUndoAttrObj(*pObj, FALSE, FALSE));
+//-/ pObj->NbcSetAttributes(aSet, FALSE);
+//-/ }
}
void E3dView::ImpCreateSingle3DObjectFlat(E3dScene* pScene, SdrObject* pObj, BOOL bExtrude, double fDepth, Matrix4D& rLatheMat)
@@ -824,9 +854,11 @@ void E3dView::ImpCreateSingle3DObjectFlat(E3dScene* pScene, SdrObject* pObj, BOO
aDefault.SetDefaultLatheCharacterMode(TRUE);
// ItemSet des Ursprungsobjektes holen
- SfxItemPool& rPool = pMod->GetItemPool();
- SfxItemSet aSet(rPool);
- pObj->TakeAttributes(aSet, FALSE, TRUE);
+//-/ SfxItemPool& rPool = pMod->GetItemPool();
+//-/ SfxItemSet aSet(rPool);
+//-/ pObj->TakeAttributes(aSet, FALSE, TRUE);
+ SfxItemSet aSet(pObj->GetItemSet());
+
XFillStyle eFillStyle = ITEMVALUE(aSet, XATTR_FILLSTYLE, XFillStyleItem);
// Linienstil ausschalten
@@ -868,7 +900,10 @@ void E3dView::ImpCreateSingle3DObjectFlat(E3dScene* pScene, SdrObject* pObj, BOO
if(p3DObj)
{
p3DObj->NbcSetLayer(pObj->GetLayer());
- p3DObj->NbcSetAttributes(aSet, FALSE);
+
+//-/ p3DObj->NbcSetAttributes(aSet, FALSE);
+ p3DObj->SetItemSet(aSet);
+
p3DObj->NbcSetStyleSheet(pObj->GetStyleSheet(), TRUE);
// Neues 3D-Objekt einfuegen
@@ -1158,10 +1193,11 @@ void E3dView::DoDepthArrange(E3dScene* pScene, double fDepth)
E3dExtrudeObj* pExtrudeObj = (E3dExtrudeObj*)pSubObj;
const PolyPolygon3D& rExtrudePoly = pExtrudeObj->GetExtrudePolygon();
- SfxItemSet aLocalSet(rPool);
- pExtrudeObj->TakeAttributes(aLocalSet, FALSE, TRUE);
- XFillStyle eLocalFillStyle = ITEMVALUE(aLocalSet, XATTR_FILLSTYLE, XFillStyleItem);
- Color aLocalColor = ((const XFillColorItem&)(aLocalSet.Get(XATTR_FILLCOLOR))).GetValue();
+//-/ SfxItemSet aLocalSet(rPool);
+//-/ pExtrudeObj->TakeAttributes(aLocalSet, FALSE, TRUE);
+ const SfxItemSet& rLocalSet = pExtrudeObj->GetItemSet();
+ XFillStyle eLocalFillStyle = ITEMVALUE(rLocalSet, XATTR_FILLSTYLE, XFillStyleItem);
+ Color aLocalColor = ((const XFillColorItem&)(rLocalSet.Get(XATTR_FILLCOLOR))).GetValue();
// ExtrudeObj einordnen
if(pLayer)
@@ -1180,16 +1216,17 @@ void E3dView::DoDepthArrange(E3dScene* pScene, double fDepth)
if(bOverlap)
{
// second ciriteria: is another fillstyle or color used?
- SfxItemSet aCompareSet(rPool);
- pAct->pObj->TakeAttributes(aCompareSet, FALSE, TRUE);
+//-/ SfxItemSet aCompareSet(rPool);
+//-/ pAct->pObj->TakeAttributes(aCompareSet, FALSE, TRUE);
+ const SfxItemSet& rCompareSet = pAct->pObj->GetItemSet();
- XFillStyle eCompareFillStyle = ITEMVALUE(aCompareSet, XATTR_FILLSTYLE, XFillStyleItem);
+ XFillStyle eCompareFillStyle = ITEMVALUE(rCompareSet, XATTR_FILLSTYLE, XFillStyleItem);
if(eLocalFillStyle == eCompareFillStyle)
{
if(eLocalFillStyle == XFILL_SOLID)
{
- Color aCompareColor = ((const XFillColorItem&)(aCompareSet.Get(XATTR_FILLCOLOR))).GetValue();
+ Color aCompareColor = ((const XFillColorItem&)(rCompareSet.Get(XATTR_FILLCOLOR))).GetValue();
if(aCompareColor == aLocalColor)
{
@@ -1252,7 +1289,8 @@ void E3dView::DoDepthArrange(E3dScene* pScene, double fDepth)
while(pAct)
{
// Anpassen
- pAct->pObj->SetExtrudeDepth(fMinDepth);
+//-/ pAct->pObj->SetExtrudeDepth(fMinDepth);
+ pAct->pObj->SetItem(SfxUInt32Item(SDRATTR_3DOBJ_DEPTH, sal_uInt32(fMinDepth + 0.5)));
// Naechster Eintrag
pAct = pAct->pNext;
@@ -1469,13 +1507,13 @@ void E3dView::InitScene(E3dScene* pScene, double fW, double fH, double fCamZ)
aCam.SetAutoAdjustProjection(FALSE);
aCam.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
Vector3D aLookAt;
- Vector3D aCamPos (aDefaultCamPos.X (), aDefaultCamPos.Y (), fCamZ < aDefaultCamPos.Z ()
- ? aDefaultCamPos.Z ()
- : fCamZ);
+
+ double fDefaultCamPosZ = GetDefaultCamPosZ();
+ Vector3D aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
aCam.SetPosAndLookAt(aCamPos, aLookAt);
- aCam.SetFocalLength(fDefaultCamFocal);
- aCam.SetDefaults(aDefaultCamPos, aLookAt, fDefaultCamFocal);
+ aCam.SetFocalLength(GetDefaultCamFocal());
+ aCam.SetDefaults(Vector3D(0.0, 0.0, fDefaultCamPosZ), aLookAt, GetDefaultCamFocal());
pScene->SetCamera(aCam);
}
@@ -1928,14 +1966,14 @@ void E3dView::InitView ()
fDefaultRotateY =
fDefaultRotateZ = 0.0;
fDefaultExtrusionDeepth = 1000; // old: 2000;
- fDefaultCamFocal = 100;
+//-/ fDefaultCamFocal = 100;
fDefaultLightIntensity = 0.8; // old: 0.6;
fDefaultAmbientIntensity = 0.4;
nHDefaultSegments = 12;
nVDefaultSegments = 12;
aDefaultLightColor = RGB_Color(COL_WHITE);
aDefaultAmbientColor = RGB_Color(COL_BLACK);
- aDefaultCamPos = Vector3D (0, 0, 100);
+//-/ aDefaultCamPos = Vector3D (0, 0, 100);
aDefaultLightPos = Vector3D (1, 1, 1); // old: Vector3D (0, 0, 1);
aDefaultLightPos.Normalize();
bDoubleSided = FALSE;
@@ -2194,9 +2232,9 @@ void E3dView::MergeScenes ()
double fDeepth = fabs (aMaxVec.Z () - aMinVec.Z ());
aCamera.SetPRP (Vector3D (0, 0, 1000));
- aCamera.SetPosition (Vector3D (aDefaultCamPos.X (), aDefaultCamPos.Y (),
- aDefaultCamPos.Z () + fDeepth / 2));
- aCamera.SetFocalLength(fDefaultCamFocal);
+ double fDefaultCamPosZ = GetDefaultCamPosZ();
+ aCamera.SetPosition (Vector3D(0.0, 0.0, fDefaultCamPosZ + fDeepth / 2));
+ aCamera.SetFocalLength(GetDefaultCamFocal());
pScene->SetCamera (aCamera);
// SnapRects der Objekte ungueltig